Ver código fonte

Merge remote-tracking branch 'origin/master'

guojing 5 anos atrás
pai
commit
0bcf877d28

+ 12 - 5
whepi-doc/group.sql

@@ -26,15 +26,15 @@ create table jm_tuangou (
     jm_id           bigint(20)      NOT NULL DEFAULT 0          COMMENT '团购id',
     user_id         bigint(20)      NOT NULL DEFAULT 0          COMMENT '用户id',
     uptown_id       bigint(20)      NOT NULL DEFAULT 0          COMMENT '小区ID',
-    tg_title        varchar(20)     NOT NULL DEFAULT ''         COMMENT '团购标题',
-    tg_supplier     varchar(20)     NOT NULL DEFAULT ''         COMMENT '团购供应商',
-    tg_goods        varchar(50)     NOT NULL DEFAULT ''         COMMENT '团购物资(套餐)',
+    tg_title        varchar(50)     NOT NULL DEFAULT ''         COMMENT '团购标题',
+    tg_supplier     varchar(50)     NOT NULL DEFAULT ''         COMMENT '团购供应商',
+    tg_goods        varchar(500)    NOT NULL DEFAULT ''         COMMENT '团购物资(套餐)',
     tg_price        varchar(20)     NOT NULL DEFAULT ''         COMMENT '价格',
     tg_min_num      int(11)         NOT NULL DEFAULT 0          COMMENT '最低起送',
     tg_end_time     datetime(0)     NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '团购截止时间',
     tg_deliver_time datetime(0)     NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '预计送货时间',
     tg_phone_number varchar(20)     NOT NULL DEFAULT ''         COMMENT '联系人电话',
-    remark          varchar(100)    NOT NULL DEFAULT ''         COMMENT '增补修订',
+    remark          varchar(500)    NOT NULL DEFAULT ''         COMMENT '增补修订',
     tg_status       int(11)         NOT NULL DEFAULT 0          COMMENT '团购状态:1在团,2发货,3完成,4取消',
     PRIMARY KEY (jm_id) USING BTREE,
     INDEX user_id(user_id) USING BTREE,
@@ -46,4 +46,11 @@ COMMENT = '团购表'
 ;
 
 ALTER TABLE jm_tuangou
-ADD  tg_max_num     int(11)         NOT NULL DEFAULT 0          COMMENT '最大订量' AFTER tg_min_num;
+ADD  tg_max_num     int(11)         NOT NULL DEFAULT 0          COMMENT '最大订量' AFTER tg_min_num;
+
+ALTER TABLE jm_tuangou
+ADD  tg_type        varchar(20)     NOT NULL DEFAULT 0          COMMENT '团购类型' AFTER tg_title,
+ADD  user_create    bigint(20)      NOT NULL DEFAULT 0          COMMENT '新增人',
+ADD  time_create    datetime(0)     NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增时间',
+ADD  user_update    bigint(20)      NOT NULL DEFAULT 0          COMMENT '修改人',
+ADD  time_update    datetime(0)     NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间';

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

@@ -29,4 +29,6 @@ public interface UserOpenMapper extends BaseMapper<UserOpen> {
             "select user_id as userId, open_id as openId, nick_name as nickName from sys_user_open limit #{start}, #{count}"
     )
     List<UserOpen> getOpenUser(@Param("start") Long start, @Param("count") Long count);
+
+    List<UserOpen> getUsersByUptownId(@Param("uptownId") Long uptownId);
 }

+ 38 - 0
whepi-web/src/main/java/com/bofeng/service/JmTuangouService.java

@@ -3,9 +3,11 @@ package com.bofeng.service;
 import com.baomidou.mybatisplus.toolkit.IdWorker;
 import com.bofeng.JwtHelper;
 import com.bofeng.dao.JmTuangouDao;
+import com.bofeng.dao.UserOpenMapper;
 import com.bofeng.dao.YeweihuiSysOwnerMapper;
 import com.bofeng.dao.YeweihuiUserRoleMapper;
 import com.bofeng.entity.JmTuangou;
+import com.bofeng.entity.UserOpen;
 import com.yvan.PageDb;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -34,6 +36,12 @@ public class JmTuangouService {
   @Autowired
   private YeweihuiSysOwnerMapper yeweihuiSysOwnerMapper;
 
+  @Autowired
+  private EpiTemplateMessageService epiTemplateMessageService;
+
+  @Autowired
+  private UserOpenMapper userOpenMapper;
+
   @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
   public Integer tuangouPublish(JmTuangou jmTuangou) {
 
@@ -91,6 +99,12 @@ public class JmTuangouService {
             jmTuangou.setTgDeliverTime(tgDeliverTime);*/
       jmTuangou.setUserId(JwtHelper.getUserId());
       success = jmTuangouDao.insert(jmTuangou);
+      if (success == 1) {
+        List<UserOpen> userList = userOpenMapper.getUsersByUptownId(Long.parseLong(uptownId));
+        for (UserOpen user : userList) {
+          epiTemplateMessageService.tuangouSendRemindMessage(user.getUserId(), user.getOpenId(), jmTuangou.getTgEndTime());
+        }
+      }
     }
     return success;
   }
@@ -147,11 +161,35 @@ public class JmTuangouService {
     return jmTuangouDao.updateStatusRemarkByJmId(jmId, status, remark);
   }
 
+  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
   public JmTuangou selectByUserId() {
+    buyService.updateStatus();
     return jmTuangouDao.selectByUserId();
   }
 
+  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
   public JmTuangou getSelectOne(Long jmId){
+    buyService.updateStatus();
     return jmTuangouDao.getSelectOne(jmId);
   }
+
+  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+  public Integer zhihuibuTuangouPublish(JmTuangou jmTuangou) {
+
+    jmTuangou.setJmId(IdWorker.getId());
+
+    Long propertyId = yeweihuiUserRoleMapper.queryPropertyIdByUserId(jmTuangou.getUserId());
+    Long uptownId = yeweihuiSysOwnerMapper.queryUptownIdByUserId(propertyId);
+    jmTuangou.setUptownId(uptownId);
+
+    jmTuangou.setTgStatus(1);
+    jmTuangou.setUserId(JwtHelper.getUserId());
+
+    return jmTuangouDao.insert(jmTuangou);
+  }
+
+  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+  public Integer zhihuibuUpdateStatus(Long jmId, Long status) {
+    return jmTuangouDao.updateStatusByJmId(jmId, status);
+  }
 }

+ 23 - 0
whepi-web/src/main/java/com/bofeng/wx/controller/YeWeiHuiController.java

@@ -417,4 +417,27 @@ public class YeWeiHuiController {
   public Model<JmTuangou> getSelectOne(@Pd(name = "jmId")Long jmId){
     return Model.newSuccess(jmTuangouService.getSelectOne(jmId));
   }
+
+  @GetMapping("/whepi/zhihuibu/tgPublish")
+  public Model zhihuibuTuangouPublish(JmTuangou jmTuangou) {
+
+    Integer success = jmTuangouService.zhihuibuTuangouPublish(jmTuangou);
+    if (success == 1) {
+      return Model.newSuccess("操作成功");
+    } else {
+      return Model.newFail("操作失败");
+    }
+  }
+
+  @GetMapping("/whepi/zhihuibu/updateStatus")
+  public Model zhihuibuUpdateStatus(@Pd(name = "jmId") Long jmId, @Pd(name = "status", required = false, defaultValue = "0") Long status) {
+
+    Integer success = jmTuangouService.zhihuibuUpdateStatus(jmId, status);
+
+    if (success == 1) {
+      return Model.newSuccess("操作成功");
+    } else {
+      return Model.newFail("操作失败");
+    }
+  }
 }

+ 9 - 0
whepi-web/src/main/resources/mapper/UserOpen.xml

@@ -19,4 +19,13 @@
     <select id="getAllUser" resultType="com.bofeng.entity.UserOpen">
         select * from sys_user_open
     </select>
+
+    <select id="getUsersByUptownId" resultType="com.bofeng.entity.UserOpen">
+        select uo.*,uu.unit,uu.uptown_id from sys_user_open uo
+          inner join sys_user_role ur on ur.user_id = uo.user_id and ur.role_id = 1
+          inner join sys_uptown_house uh on uh.house_id = ur.property_id
+          inner join sys_uptown_unit uu on uu.unit_id = uh.unit_id
+          inner join sys_uptown u on u.uptown_id = uu.uptown_id
+        where u.uptown_id = #{uptownId}
+    </select>
 </mapper>