Longlin 5 éve
szülő
commit
ea87552a8c

+ 21 - 0
whepi-ui/templates/groupBuying/groupBuyingXx.ftl

@@ -57,6 +57,9 @@
                     <span class="weui-loadmore__tips">参团状态</span>
                     <div class="weui-cells__title">在团</div>
                 </div>
+                <#if tgItem.roleType==1>
+                    <p id="gb_ck4" class="weui-btn weui-btn_primary">查看参团信息</p>
+                </#if>
             </div>
         </#if>
         <#if isMine=='mine' && tgItem.tgStatus==2>
@@ -80,6 +83,9 @@
                     <span class="weui-loadmore__tips">参团状态</span>
                     <div class="weui-cells__title">发货</div>
                 </div>
+                <#if tgItem.roleType==1>
+                    <p id="gb_ck5" class="weui-btn weui-btn_primary">查看参团信息</p>
+                </#if>
             </div>
         </#if>
         <#if isMine=='mine' && tgItem.tgStatus==3>
@@ -102,6 +108,9 @@
                     <span class="weui-loadmore__tips">参团状态</span>
                     <div class="weui-cells__title">完成</div>
                 </div>
+                <#if tgItem.roleType==1>
+                    <p id="gb_ck6" class="weui-btn weui-btn_primary">查看参团信息</p>
+                </#if>
             </div>
         </#if>
         <#if tgItem.tgStatus==4>
@@ -153,6 +162,18 @@
         window.location.href = "/yeweihui/tuangou/member/list.html?jmId=" + tgItem.jmId + "&userId=" + userId;
     });
 
+    $('#gb_ck4').on('click', function () {
+        window.location.href = "/yeweihui/tuangou/member/list.html?jmId=" + tgItem.jmId + "&userId=" + userId;
+    });
+
+    $('#gb_ck5').on('click', function () {
+        window.location.href = "/yeweihui/tuangou/member/list.html?jmId=" + tgItem.jmId + "&userId=" + userId;
+    });
+
+    $('#gb_ck6').on('click', function () {
+        window.location.href = "/yeweihui/tuangou/member/list.html?jmId=" + tgItem.jmId + "&userId=" + userId;
+    });
+
     function goback() {
         window.location.href = "/yeweihui/home.html?show=tuangou&userId=" + userId;
     }

+ 2 - 0
whepi-web/src/main/java/com/bofeng/dao/JmTuangouDao.java

@@ -35,6 +35,8 @@ public interface JmTuangouDao extends BaseMapper<JmTuangou> {
 
   int updateAll(@Param("tg") List<JmTuangou> tg);
 
+  Integer insertJmTuangouList(@Param("tgList") List<JmTuangou> tgList);
+
   JmTuangou selectByUserId();
 
   JmTuangou getSelectOne(@Param("jmId") Long jmId);

+ 1 - 1
whepi-web/src/main/java/com/bofeng/entity/JmTuangou.java

@@ -99,7 +99,7 @@ public class JmTuangou implements Serializable {
     /**
      * 增补修订
      */
-    private String remark;
+    private String remark = "";
 
     /**
      * 团购状态:1在团,2发货,3完成,4取消

+ 17 - 8
whepi-web/src/main/java/com/bofeng/service/JmTuangouService.java

@@ -9,17 +9,16 @@ import com.bofeng.dao.YeweihuiUserRoleMapper;
 import com.bofeng.entity.JmTuangou;
 import com.bofeng.entity.UserOpen;
 import com.yvan.PageDb;
+import org.apache.commons.beanutils.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.lang.reflect.InvocationTargetException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 @Service
 @Transactional(readOnly = true)
@@ -86,12 +85,13 @@ public class JmTuangouService {
   }
 
   @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
-  public Integer whepiTuangouPublish(String uptownIds, JmTuangou jmTuangou) {
+  public Integer whepiTuangouPublish(String uptownIds, JmTuangou jmTuangou) throws InvocationTargetException, IllegalAccessException {
+    long startTime = System.currentTimeMillis();
     Calendar cal = Calendar.getInstance();
     int moth = cal.get(Calendar.MONTH) + 1;
     int date = cal.get(Calendar.DAY_OF_MONTH);
-    Integer success = 0;
     List<String> uptownIdArray = Arrays.asList(uptownIds.split(","));
+    ArrayList tgList = new ArrayList();
     for (String uptownId : uptownIdArray) {
 
       jmTuangou.setJmId(IdWorker.getId());
@@ -100,6 +100,7 @@ public class JmTuangouService {
 
       jmTuangou.setTgStatus(1);
       jmTuangou.setRoleType(1);
+      jmTuangou.setUserCreate(JwtHelper.getUserId());
       jmTuangou.setUserUpdate(JwtHelper.getUserId());
 
       if (jmTuangou.getTgType() == 1) {
@@ -118,14 +119,22 @@ public class JmTuangouService {
 
       }
       jmTuangou.setUserId(JwtHelper.getUserId());
-      success = jmTuangouDao.insert(jmTuangou);
-      if (success == 1) {
+
+      JmTuangou jmTuangou1 = new JmTuangou();
+      BeanUtils.copyProperties(jmTuangou1, jmTuangou);
+      tgList.add(jmTuangou1);
+    }
+    Integer success = jmTuangouDao.insertJmTuangouList(tgList);
+    if (success == 1) {
+      for (String uptownId : uptownIdArray) {
         List<UserOpen> userList = userOpenMapper.getUsersByUptownId(Long.parseLong(uptownId));
         for (UserOpen user : userList) {
           epiTemplateMessageService.tuangouSendRemindMessage(user.getUserId(), user.getOpenId(), jmTuangou.getTgEndTime());
         }
       }
     }
+    long endTime = System.currentTimeMillis();
+    System.out.print((endTime-startTime)/1000);
     return success;
   }
 

+ 2 - 1
whepi-web/src/main/java/com/bofeng/wx/controller/YeWeiHuiController.java

@@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletResponse;
+import java.lang.reflect.InvocationTargetException;
 import java.util.List;
 import java.util.Map;
 
@@ -380,7 +381,7 @@ public class YeWeiHuiController {
   }
 
   @PostMapping("/whepi/yeweihui/tgPublish")
-  public ModelOps whepiTuangouPublish(@JsonBody JmTuangou jmTuangou) {
+  public ModelOps whepiTuangouPublish(@JsonBody JmTuangou jmTuangou) throws InvocationTargetException, IllegalAccessException {
 
     int success = jmTuangouService.whepiTuangouPublish(jmTuangou.getUptownIds(), jmTuangou);
     return ModelOps.newSuccess(success);

+ 1 - 1
whepi-web/src/main/resources/application.yml

@@ -43,7 +43,7 @@ endpoints:
 #  whitelabel.enabled: false
 
 spring:
-  profiles.active: guojing
+  profiles.active: lll
 
   application:
     name: bofeng-web

+ 7 - 0
whepi-web/src/main/resources/mapper/JmTuangouMapper.xml

@@ -79,6 +79,13 @@
         </foreach>
     </update>
 
+    <insert id="insertJmTuangouList">
+        insert into jm_tuangou (jm_id, user_id, uptown_id, tg_title, tg_type, tg_supplier, tg_goods, tg_price, tg_min_num, tg_end_time, tg_deliver_time, tg_phone_number, role_type, remark, tg_status, tg_max_num, user_create, time_create, user_update, time_update) VALUES
+        <foreach collection="tgList" item="tg" separator=",">
+            (#{tg.jmId}, #{tg.userId}, #{tg.uptownId}, #{tg.tgTitle}, #{tg.tgType}, #{tg.tgSupplier}, #{tg.tgGoods}, #{tg.tgPrice}, #{tg.tgMinNum}, #{tg.tgEndTime}, #{tg.tgDeliverTime}, #{tg.tgPhoneNumber}, #{tg.roleType}, #{tg.remark}, #{tg.tgStatus}, #{tg.tgMaxNum}, #{tg.userCreate}, now(), #{tg.userCreate}, now())
+        </foreach>
+    </insert>
+
     <select id="selectByUserId" resultType="com.bofeng.entity.JmTuangou">
         select * from sys_user limit 1
     </select>