Explorar el Código

业主购买2月10号

guojing hace 5 años
padre
commit
72c488427d

+ 7 - 7
whepi-ui/templates/home/home.ftl

@@ -8,8 +8,8 @@
             <#include "/home/ribao.ftl" /></div>
         <div id="tab2" class="weui-tab__bd-item">
             <#include "/home/qiuzhu.ftl" /></div>
-        <#--<div id="tab3" class="weui-tab__bd-item">-->
-           <#--<#include "/home/buy.ftl" /></div>-->
+        <div id="tab3" class="weui-tab__bd-item">
+    <#include "/home/buy.ftl" /></div>
     <#--<div id="tab4" class="weui-tab__bd-item">-->
     <#--<h1>页面四</h1> </div>-->
     </div>
@@ -22,10 +22,10 @@
             <div class="weui-tabbar__icon"><img src="/static/images/wx/customer_service.png" alt=""></div>
             <p class="weui-tabbar__label">家庭求助</p>
         </a>
-        <#--<a id="jt3" href="#tab3" class="weui-tabbar__item" onclick="buyGroup()">-->
-            <#--<div class="weui-tabbar__icon"><img src="/static/images/wx/upload.png" alt=""></div>-->
-            <#--<p class="weui-tabbar__label">商品团购</p>-->
-        <#--</a>-->
+        <a id="jt3" href="#tab3" class="weui-tabbar__item" onclick="buyGroup()">
+            <div class="weui-tabbar__icon"><img src="/static/images/wx/upload.png" alt=""></div>
+            <p class="weui-tabbar__label">商品团购</p>
+        </a>
     <#--<a href="#tab4" class="weui-tabbar__item">-->
     <#--<div class="weui-tabbar__icon"> <img src="./images/icon_nav_cell.png" alt=""> </div>-->
     <#--<p class="weui-tabbar__label">我</p>-->
@@ -89,7 +89,7 @@
             $("#jt1").removeClass('weui-bar__item--on');
             $("#tab3").addClass('weui-tab__bd-item--active');
             $("#jt3").addClass('weui-bar__item--on');
-           /* buyGroup();*/
+            buyGroup();
         }
 
         var show = ${show!'"-"'};

+ 1 - 1
whepi-web/src/main/java/com/bofeng/dao/BuyMapper.java

@@ -23,5 +23,5 @@ public interface BuyMapper extends BaseMapper<Buy> {
 
   Buy status(@Param("jmId") Long jmId,@Param("userId") Long userId);
 
-  List<Buy> selectCountNum(@Param("jmId") Long jmId);
+  Buy selectCountNum(@Param("jmId") Long jmId);
 }

+ 14 - 5
whepi-web/src/main/java/com/bofeng/service/BuyService.java

@@ -74,7 +74,7 @@ public class BuyService {
   }
 
   public Buy status(Buy buy) {
-    return buyMapper.status(buy.getJmId(),buy.getUserId());
+    return buyMapper.status(buy.getJmId(), buy.getUserId());
   }
 
   //截止日期状态的更改
@@ -87,9 +87,18 @@ public class BuyService {
         if (list.getTgEndTime().getTime() < new DateTime().getMillis()) {
 
           // 团购数量  最小起订量
-          List<Buy> buys = buyMapper.selectCountNum(list.getJmId());
-          if (buys != null && buys.size() > 0) {
-            for (Buy v : buys) {                //最小起订量
+          Buy buy = buyMapper.selectCountNum(list.getJmId());
+          if (buy != null) { //最小起订量
+            if (list.getTgMinNum().intValue() > buy.getCount().intValue()) {
+              jmTuangouDao.updateStatusByJmId(list.getJmId(), 4L);//取消
+            } else {
+              jmTuangouDao.updateStatusByJmId(list.getJmId(), 2L);//发货
+            }
+          } else {
+            jmTuangouDao.updateStatusByJmId(list.getJmId(), 4L);//取消
+          }
+      /*    if (buys != null && buys.size() > 0) {
+            for (Buy v : buys) {
               if (v.getCount().intValue() < list.getTgMinNum().intValue()) {
                 jmTuangouDao.updateStatusByJmId(list.getJmId(), 4L);//取消
               } else {
@@ -98,7 +107,7 @@ public class BuyService {
             }
           } else {
             jmTuangouDao.updateStatusByJmId(list.getJmId(), 4L);//取消
-          }
+          }*/
 
         }
     }

+ 1 - 1
whepi-web/src/main/resources/mapper/BuyMapper.xml

@@ -40,7 +40,7 @@
     </select>
 
     <select id="selectCountNum" resultType="com.bofeng.entity.Buy">
-        select sum(buy_count) as count,buy_id from jm_buy where jm_id=#{jmId} GROUP BY buy_id
+        select sum(buy_count) as count,jm_id from jm_buy where jm_id=#{jmId} and buy_status=1 GROUP BY jm_id
     </select>
 
 </mapper>