|
@@ -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;
|
|
@@ -15,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -34,6 +37,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) {
|
|
|
|
|
@@ -59,12 +68,28 @@ public class JmTuangouService {
|
|
|
jmTuangou.setTgEndTime(tgEndTime);
|
|
|
jmTuangou.setTgDeliverTime(tgDeliverTime);
|
|
|
|
|
|
- return jmTuangouDao.insert(jmTuangou);
|
|
|
+ jmTuangou.setUserCreate(jmTuangou.getUserId());
|
|
|
+ jmTuangou.setTimeCreate(new Date());
|
|
|
+ jmTuangou.setUserUpdate(jmTuangou.getUserId());
|
|
|
+ jmTuangou.setTimeUpdate(new Date());
|
|
|
+
|
|
|
+ Integer success = jmTuangouDao.insert(jmTuangou);
|
|
|
+
|
|
|
+ if (success == 1) {
|
|
|
+ List<UserOpen> userList = userOpenMapper.getUsersByUptownId(uptownId);
|
|
|
+ for (UserOpen user : userList) {
|
|
|
+ epiTemplateMessageService.tuangouSendRemindMessage(user.getUserId(), user.getOpenId(), tgEndTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return success;
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
public Integer whepiTuangouPublish(String uptownIds, JmTuangou jmTuangou) {
|
|
|
-
|
|
|
+ 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(","));
|
|
|
for (String uptownId : uptownIdArray) {
|
|
@@ -74,23 +99,32 @@ public class JmTuangouService {
|
|
|
jmTuangou.setUptownId(Long.parseLong(uptownId));
|
|
|
|
|
|
jmTuangou.setTgStatus(1);
|
|
|
+ jmTuangou.setRoleType(1);
|
|
|
+ jmTuangou.setUserUpdate(JwtHelper.getUserId());
|
|
|
+
|
|
|
+ if (jmTuangou.getTgType() == 1) {
|
|
|
+ jmTuangou.setTgTitle("食蔬采购需求统计(指挥部" + moth + "月" + date + "日)");
|
|
|
|
|
|
- /*SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
+ } else if (jmTuangou.getTgType() == 2) {
|
|
|
+ jmTuangou.setTgTitle("药品采购需求统计((指挥部" + moth + "月" + date + "日)");
|
|
|
|
|
|
- Date tgEndTime = new Date();
|
|
|
- Date tgDeliverTime = new Date();
|
|
|
- try {
|
|
|
- tgEndTime = sdf.parse(jmTuangou.getEndTime());
|
|
|
- tgDeliverTime = sdf.parse(jmTuangou.getDeliverTime());
|
|
|
- }
|
|
|
- catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+ } else if (jmTuangou.getTgType() == 3) {
|
|
|
+ jmTuangou.setTgTitle("医疗服务需求统计((指挥部" + moth + "月" + date + "日)");
|
|
|
|
|
|
- jmTuangou.setTgEndTime(jmTuangou.gettgEndTime);
|
|
|
- jmTuangou.setTgDeliverTime(tgDeliverTime);*/
|
|
|
+ } else if (jmTuangou.getTgType() == 4) {
|
|
|
+ jmTuangou.setTgTitle("生活用品需求统计((指挥部" + moth + "月" + date + "日)");
|
|
|
+ } else if (jmTuangou.getTgType() == 5) {
|
|
|
+ jmTuangou.setTgTitle("其他服务需求统计((指挥部" + moth + "月" + date + "日)");
|
|
|
+
|
|
|
+ }
|
|
|
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 +181,25 @@ public class JmTuangouService {
|
|
|
return jmTuangouDao.updateStatusRemarkByJmId(jmId, status, remark);
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
public JmTuangou selectByUserId() {
|
|
|
+ buyService.updateStatus();
|
|
|
return jmTuangouDao.selectByUserId();
|
|
|
}
|
|
|
|
|
|
- public JmTuangou getSelectOne(Long jmId){
|
|
|
+ @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 zhihuibuUpdateStatus(Long jmId, Long status) {
|
|
|
+ return jmTuangouDao.updateStatusByJmId(jmId, status);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
+ public int updateStatus(Long jmId,Long tgStatus){
|
|
|
+ return jmTuangouDao.updateStatusByJmId(jmId,tgStatus);
|
|
|
+ }
|
|
|
}
|