Merge remote-tracking branch 'origin/cc_partner_init' into cc_partner_init

This commit is contained in:
zhangchenbiao
2024-05-11 13:56:41 +08:00
11 changed files with 198 additions and 74 deletions

View File

@@ -40,6 +40,9 @@ public enum MessageEnum {
MESSAGE_22("您收到一位员工由您带教,请查收", "##### 员工姓名:【${userName}】,员工手机号码:【${mobile}】,登记时间:【${registerTime}】"), MESSAGE_22("您收到一位员工由您带教,请查收", "##### 员工姓名:【${userName}】,员工手机号码:【${mobile}】,登记时间:【${registerTime}】"),
MESSAGE_23("您有一个门店待发布加盟费/保证金账单,请查收", "##### 门店名称:${storeName}\n##### 加盟商姓名:${partnerName}\n##### 加盟商手机号码:${partnerMobile}\n"), MESSAGE_23("您有一个门店待发布加盟费/保证金账单,请查收", "##### 门店名称:${storeName}\n##### 加盟商姓名:${partnerName}\n##### 加盟商手机号码:${partnerMobile}\n"),
MESSAGE_24("您有一个门店待预约三方验收时间,请查收", "#####门店名称:${storeName}\n##### 加盟商姓名:${partnerUsername}\n##### 加盟商手机号码:${partnerMobile}\n"), MESSAGE_24("您有一个门店待预约三方验收时间,请查收", "#####门店名称:${storeName}\n##### 加盟商姓名:${partnerUsername}\n##### 加盟商手机号码:${partnerMobile}\n"),
MESSAGE_25("您有一个门店待进行三方验收,请查收","#####门店名称:${storeName}\n#####加盟商姓名:${partnerUsername}\n#####加盟商手机号码:${partnerMobile}\n"),
MESSAGE_26("您有一个门店需要上传开业运营方案,请查收","#####门店名称:${storeName}\n#####加盟商姓名:${partnerUsername}\n#####加盟商手机号码:${partnerMobile}\n"),
MESSAGE_27("您有一个门店需要上传首批订货清单,请查收","#####门店名称:${storeName}\n#####加盟商姓名:${partnerUsername}\n#####加盟商手机号码:${partnerMobile}\n"),
; ;
private String title; private String title;
@@ -108,11 +111,12 @@ public enum MessageEnum {
case MESSAGE_19: case MESSAGE_19:
case MESSAGE_20: case MESSAGE_20:
case MESSAGE_23: case MESSAGE_23:
return "dingtalk://dingtalkclient/action/open_micro_app?appId="+appId+"&corpId="+corpId+"&page=" + //跳转我的加盟商的加盟商详情都可以使用这个
URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=franchiseeDetails&timestamp="+System.currentTimeMillis()+"&lineId="+ paramMap.get("lineId"), StandardCharsets.UTF_8.name()); return domainUrl + "/dd-noticemsg?appId=" + appId + "&corpId=" + corpId + "&appUrl=" +
URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=franchiseeDetails&timestamp=" + System.currentTimeMillis() + "&lineId=" + paramMap.get("lineId"), StandardCharsets.UTF_8.name());
case MESSAGE_17: case MESSAGE_17:
return "dingtalk://dingtalkclient/action/open_micro_app?appId="+appId+"&corpId="+corpId+"&page=" + return domainUrl + "/dd-noticemsg?appId=" + appId + "&corpId=" + corpId + "&appUrl=" +
URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=license&timestamp="+System.currentTimeMillis()+"&shopId="+ paramMap.get("shopId"), StandardCharsets.UTF_8.name()); URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=license&timestamp=" + System.currentTimeMillis() + "&shopId=" + paramMap.get("shopId"), StandardCharsets.UTF_8.name());
case MESSAGE_21: case MESSAGE_21:
return domainUrl + "/dd-noticemsg?appId="+appId+"&corpId="+corpId+"&page=" + return domainUrl + "/dd-noticemsg?appId="+appId+"&corpId="+corpId+"&page=" +
URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=employeeTraining&timestamp="+System.currentTimeMillis()+"&userDetailId="+ paramMap.get("userDetailId"), StandardCharsets.UTF_8.name()); URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=employeeTraining&timestamp="+System.currentTimeMillis()+"&userDetailId="+ paramMap.get("userDetailId"), StandardCharsets.UTF_8.name());
@@ -122,6 +126,15 @@ public enum MessageEnum {
case MESSAGE_24: case MESSAGE_24:
return "dingtalk://dingtalkclient/action/open_micro_app?appId="+appId+"&corpId="+corpId+"&page=" + return "dingtalk://dingtalkclient/action/open_micro_app?appId="+appId+"&corpId="+corpId+"&page=" +
URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=employeeTraining&timestamp="+System.currentTimeMillis(), StandardCharsets.UTF_8.name()); URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=employeeTraining&timestamp="+System.currentTimeMillis(), StandardCharsets.UTF_8.name());
case MESSAGE_25:
return "dingtalk://dingtalkclient/action/open_micro_app?appId="+appId+"&corpId="+corpId+"&page=" +
URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=employeeTraining&timestamp="+System.currentTimeMillis(), StandardCharsets.UTF_8.name());
case MESSAGE_26:
return "dingtalk://dingtalkclient/action/open_micro_app?appId="+appId+"&corpId="+corpId+"&page=" +
URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=employeeTraining&timestamp="+System.currentTimeMillis()+"&shopId="+ paramMap.get("shopId"), StandardCharsets.UTF_8.name());
case MESSAGE_27:
return "dingtalk://dingtalkclient/action/open_micro_app?appId="+appId+"&corpId="+corpId+"&page=" +
URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=employeeTraining&timestamp="+System.currentTimeMillis()+"&shopId="+ paramMap.get("shopId"), StandardCharsets.UTF_8.name());
default: default:
return ""; return "";

View File

@@ -94,7 +94,14 @@ public class CoolDateUtils {
} }
return date; return date;
} }
public static final String DateFormat(Date date,String format){
if (StringUtils.isBlank(format)){
return null;
}
DateFormat dateFormat = new SimpleDateFormat(format);
String str = dateFormat.format(date);
return str;
}
} }

View File

@@ -3,6 +3,7 @@ package com.cool.store.dao;
import com.cool.store.entity.AssessmentDataDO; import com.cool.store.entity.AssessmentDataDO;
import com.cool.store.mapper.AssessmentDataMapper; import com.cool.store.mapper.AssessmentDataMapper;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
@@ -65,8 +66,11 @@ public class AssessmentDataDAO {
return assessmentDataMapper.selectByPrimaryKey(id); return assessmentDataMapper.selectByPrimaryKey(id);
} }
public List<AssessmentDataDO> selectListByShopId(Long shopId) { public List<AssessmentDataDO> selectListByShopId(Long shopId,Long templateIdMin, Long templateIdMax) {
return assessmentDataMapper.selectListByShopId(shopId); if (shopId == null || templateIdMin == 0L || templateIdMax == 0L) {
return null;
}
return assessmentDataMapper.selectListByShopId(shopId,templateIdMin,templateIdMax);
} }
public void batchInsertDO(List<AssessmentDataDO> assessmentDataDOList) { public void batchInsertDO(List<AssessmentDataDO> assessmentDataDOList) {

View File

@@ -19,7 +19,7 @@ public interface AssessmentDataMapper extends Mapper<AssessmentDataDO> {
* @Date: 2024/5/8 * @Date: 2024/5/8
* @description:三方验收 * @description:三方验收
*/ */
List<AssessmentDataDO> selectListByShopId(@Param("shopId") Long shopId); List<AssessmentDataDO> selectListByShopId(@Param("shopId") Long shopId,@Param("templateIdMin") Long templateIdMin,@Param("templateIdMax") Long templateIdMax);
Integer batchInsert(@Param("assessmentDataList") List<AssessmentDataDO> assessmentDataList); Integer batchInsert(@Param("assessmentDataList") List<AssessmentDataDO> assessmentDataList);

View File

@@ -80,6 +80,6 @@
<select id="selectListByShopId" resultType="com.cool.store.entity.AssessmentDataDO"> <select id="selectListByShopId" resultType="com.cool.store.entity.AssessmentDataDO">
select * select *
from xfsg_assessment_data from xfsg_assessment_data
where shop_id = #{shopId} and template_id >=75 and template_id &lt;= 108 where shop_id = #{shopId} and template_id >=#{templateIdMin} and template_id &lt;= #{templateIdMax}
</select> </select>
</mapper> </mapper>

View File

@@ -65,7 +65,7 @@
xfsg_shop_stage_info xfsg_shop_stage_info
where where
shop_id = #{shopId} and deleted = 0 and is_terminated = 1 shop_id = #{shopId} and deleted = 0 and is_terminated = 1
and shop_sub_stage in (60,40,120,130,140,150) and shop_sub_stage in (60,40,120,140,150)
</select> </select>
<update id="updateShopStageInfo"> <update id="updateShopStageInfo">

View File

@@ -31,6 +31,7 @@ import java.text.MessageFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -75,6 +76,10 @@ public class CommonService {
return (AuditResultService) applicationContext.getBean(auditEnum.getClazz()); return (AuditResultService) applicationContext.getBean(auditEnum.getClazz());
} }
public void sendMessageAsync(List<String> userIds, MessageEnum message, Map<String, String> requestMap){
CompletableFuture.runAsync(() -> sendMessage(userIds, message, requestMap));
}
public void sendMessage(List<String> userIds, MessageEnum message, Map<String, String> requestMap){ public void sendMessage(List<String> userIds, MessageEnum message, Map<String, String> requestMap){
if(CollectionUtils.isEmpty(userIds)){ if(CollectionUtils.isEmpty(userIds)){
return; return;
@@ -120,6 +125,10 @@ public class CommonService {
sendSms(Arrays.asList(poneNumber), templateCode, templateParamMap); sendSms(Arrays.asList(poneNumber), templateCode, templateParamMap);
} }
public void sendSmsAsync(String poneNumber, SMSMsgEnum templateCode, Map<String, String> templateParamMap){
CompletableFuture.runAsync(() -> sendSms(Arrays.asList(poneNumber), templateCode, templateParamMap));
}
public void sendSms(List<String> poneNumbers, SMSMsgEnum templateCode, Map<String, String> templateParamMap){ public void sendSms(List<String> poneNumbers, SMSMsgEnum templateCode, Map<String, String> templateParamMap){
List<String> signNameList = new ArrayList<>(); List<String> signNameList = new ArrayList<>();
signNameList.add("酷店掌"); signNameList.add("酷店掌");

View File

@@ -24,6 +24,7 @@ import com.cool.store.response.ThreeSignResponse;
import com.cool.store.service.*; import com.cool.store.service.*;
import com.cool.store.utils.CoolDateUtils; import com.cool.store.utils.CoolDateUtils;
import com.cool.store.utils.poi.StringUtils; import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.AssessmentTemplateVO;
import com.cool.store.vo.Fitment.DecorationStageVO; import com.cool.store.vo.Fitment.DecorationStageVO;
import com.cool.store.vo.Fitment.DecorationModelVO; import com.cool.store.vo.Fitment.DecorationModelVO;
import com.cool.store.vo.Fitment.DesignInfoVo; import com.cool.store.vo.Fitment.DesignInfoVo;
@@ -94,7 +95,8 @@ public class DecorationServiceImpl implements DecorationService {
private ShopInfoMapper shopInfoMapper; private ShopInfoMapper shopInfoMapper;
@Resource @Resource
private CommonService commonService; private CommonService commonService;
@Resource
private AssessmentTemplateService assessmentTemplateService;
@Override @Override
public DesignInfoVo DesignInfo(Long shopId) { public DesignInfoVo DesignInfo(Long shopId) {
DecorationDTO decoration = getDecorationDTO(shopId); DecorationDTO decoration = getDecorationDTO(shopId);
@@ -358,8 +360,10 @@ public class DecorationServiceImpl implements DecorationService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean submitThreeCheck(ThreeAcceptanceCheckRequest request) { public Boolean submitThreeCheck(ThreeAcceptanceCheckRequest request) {
log.info("submitThreeCheck, request:{} ", JSONObject.toJSONString(request)); log.info("submitThreeCheck, request:{} ", JSONObject.toJSONString(request));
List<AssessmentTemplateVO> assessmentTemplateVOS = assessmentTemplateService.listByType(AssessmentTemplateType.TRIPARTITE_ACCEPTANCE.getCode());
List<AssessmentDataDO> assessmentDataDOList = assessmentDataDAO.selectListByShopId(request.getShopId()); Long max = assessmentTemplateVOS.stream().mapToLong(AssessmentTemplateVO::getId).max().orElse(0L);
Long min = assessmentTemplateVOS.stream().mapToLong(AssessmentTemplateVO::getId).min().orElse(0L);
List<AssessmentDataDO> assessmentDataDOList = assessmentDataDAO.selectListByShopId(request.getShopId(), min,max);
List<AssessmentDataDO> assessmentDataDOS = new ArrayList<>(); List<AssessmentDataDO> assessmentDataDOS = new ArrayList<>();
for (AssessmentDataDTO assessmentDataDTO : request.getAssessmentDataDTOS()) { for (AssessmentDataDTO assessmentDataDTO : request.getAssessmentDataDTOS()) {
AssessmentDataDO assessmentDataDO = new AssessmentDataDO(); AssessmentDataDO assessmentDataDO = new AssessmentDataDO();
@@ -382,8 +386,10 @@ public class DecorationServiceImpl implements DecorationService {
@Override @Override
public ThreeAcceptanceCheckRequest getThreeChecks(Long shopId) { public ThreeAcceptanceCheckRequest getThreeChecks(Long shopId) {
//todo sql 确定范围 List<AssessmentTemplateVO> assessmentTemplateVOS = assessmentTemplateService.listByType(AssessmentTemplateType.TRIPARTITE_ACCEPTANCE.getCode());
List<AssessmentDataDO> assessmentDataDOS = assessmentDataDAO.selectListByShopId(shopId); Long max = assessmentTemplateVOS.stream().mapToLong(AssessmentTemplateVO::getId).max().orElse(0L);
Long min = assessmentTemplateVOS.stream().mapToLong(AssessmentTemplateVO::getId).min().orElse(0L);
List<AssessmentDataDO> assessmentDataDOS = assessmentDataDAO.selectListByShopId(shopId,min,max);
if (CollectionUtils.isEmpty(assessmentDataDOS)) { if (CollectionUtils.isEmpty(assessmentDataDOS)) {
log.error("该用户门店三方验收检查项为空"); log.error("该用户门店三方验收检查项为空");
return null; return null;

View File

@@ -448,6 +448,13 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt
auditStatusService.insert(lineInfo.getId(),interviewInfo.getId(),auditId,AuditStageEnum.TWO.getCode()); auditStatusService.insert(lineInfo.getId(),interviewInfo.getId(),auditId,AuditStageEnum.TWO.getCode());
//发送短信 //发送短信
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.SECOND_INTERVIEW_SUCCESS, null); commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.SECOND_INTERVIEW_SUCCESS, null);
Map<String, String> requestMap = new HashMap<>();
//todo 建店还未开始时
requestMap.put("storeName","XXX");
requestMap.put("partnerName",lineInfo.getUsername());
requestMap.put("partnerMobile",lineInfo.getMobile());
requestMap.put("lineId",String.valueOf(lineInfo.getId()));
commonService.sendMessage(Arrays.asList(lineInfo.getInvestmentManager()),MessageEnum.MESSAGE_23,requestMap);
} }
return lineInterviewDAO.updateInterviewInfo(updateInterviewInfo) > 0; return lineInterviewDAO.updateInterviewInfo(updateInterviewInfo) > 0;
} }

View File

@@ -10,6 +10,7 @@ import com.cool.store.dto.decoration.ProjectDTO;
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO; import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.entity.*; import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum; import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.MessageEnum;
import com.cool.store.enums.point.ShopStageEnum; import com.cool.store.enums.point.ShopStageEnum;
import com.cool.store.enums.point.ShopSubStageEnum; import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum; import com.cool.store.enums.point.ShopSubStageStatusEnum;
@@ -46,6 +47,8 @@ public class PreparationServiceImpl implements PreparationService {
private static final Logger log = LoggerFactory.getLogger(PreparationServiceImpl.class); private static final Logger log = LoggerFactory.getLogger(PreparationServiceImpl.class);
@Resource @Resource
private CommonService commonService;
@Resource
private ShopStageInfoDAO shopStageInfoDAO; private ShopStageInfoDAO shopStageInfoDAO;
@Resource @Resource
private OpenAcceptanceInfoDAO openAcceptanceInfoDAO; private OpenAcceptanceInfoDAO openAcceptanceInfoDAO;
@@ -178,7 +181,8 @@ public class PreparationServiceImpl implements PreparationService {
Map<Integer, ShopStageInfoDO> shopStageInfoDOMap = shopStageInfo.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopSubStage, data -> data)); Map<Integer, ShopStageInfoDO> shopStageInfoDOMap = shopStageInfo.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopSubStage, data -> data));
Boolean buildStoreCompletionFlag = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33.getShopSubStageStatus().equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_3.getShopSubStage()).getShopSubStageStatus()); Boolean buildStoreCompletionFlag = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33.getShopSubStageStatus().equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_3.getShopSubStage()).getShopSubStageStatus());
Boolean contractCompletionFlag = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_73.getShopSubStageStatus().equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_7.getShopSubStage()).getShopSubStageStatus()); Boolean contractCompletionFlag = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_73.getShopSubStageStatus().equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_7.getShopSubStage()).getShopSubStageStatus());
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
//都完成了 初始化后续流程数据 //都完成了 初始化后续流程数据
if (buildStoreCompletionFlag && contractCompletionFlag) { if (buildStoreCompletionFlag && contractCompletionFlag) {
//初始化后续流程数据 设计阶段 装修阶段 开业运营方案 首批订货清单 //初始化后续流程数据 设计阶段 装修阶段 开业运营方案 首批订货清单
@@ -197,9 +201,23 @@ public class PreparationServiceImpl implements PreparationService {
ShopStageInfoDO data3 = shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_14.getShopSubStage()); ShopStageInfoDO data3 = shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_14.getShopSubStage());
data3.setShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_140.getShopSubStageStatus()); data3.setShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_140.getShopSubStageStatus());
list.add(data3); list.add(data3);
//发送督导钉钉
Map<String, String> messageMap = new HashMap<>();
messageMap.put("storeName",shopInfo.getShopName());
messageMap.put("shopId",shopId.toString());
messageMap.put("partnerUsername",lineInfo.getUsername());
messageMap.put("partnerMobile",lineInfo.getMobile());
commonService.sendMessage(Arrays.asList(shopInfo.getSupervisorUserId()), MessageEnum.MESSAGE_26, messageMap);
ShopStageInfoDO data4 = shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_15.getShopSubStage()); ShopStageInfoDO data4 = shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_15.getShopSubStage());
data4.setShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_150.getShopSubStageStatus()); data4.setShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_150.getShopSubStageStatus());
list.add(data4); list.add(data4);
//发送督导钉钉
Map<String, String> messageMap1 = new HashMap<>();
messageMap1.put("storeName",shopInfo.getShopName());
messageMap1.put("shopId",shopId.toString());
messageMap1.put("partnerUsername",lineInfo.getUsername());
messageMap1.put("partnerMobile",lineInfo.getMobile());
commonService.sendMessage(Arrays.asList(shopInfo.getSupervisorUserId()), MessageEnum.MESSAGE_27, messageMap1);
shopStageInfoDAO.batchUpdate(list); shopStageInfoDAO.batchUpdate(list);
} }
} }
@@ -209,7 +227,7 @@ public class PreparationServiceImpl implements PreparationService {
public void whetherToOpenForAcceptance(Long shopId) { public void whetherToOpenForAcceptance(Long shopId) {
Integer allCompletionCount = shopStageInfoDAO.getAllCompletionCount(shopId); Integer allCompletionCount = shopStageInfoDAO.getAllCompletionCount(shopId);
//如果等于6 表示前面阶段都已经完成 初始化开业验收数据 //如果等于6 表示前面阶段都已经完成 初始化开业验收数据
if (allCompletionCount.equals(CommonConstants.SIX)) { if (allCompletionCount.equals(CommonConstants.FIVE)) {
OpenAcceptanceInfoDO openAcceptanceInfoDO = new OpenAcceptanceInfoDO(); OpenAcceptanceInfoDO openAcceptanceInfoDO = new OpenAcceptanceInfoDO();
openAcceptanceInfoDO.setShopId(shopId); openAcceptanceInfoDO.setShopId(shopId);
openAcceptanceInfoDO.setAcceptanceStatus(CommonConstants.ZERO); openAcceptanceInfoDO.setAcceptanceStatus(CommonConstants.ZERO);
@@ -246,10 +264,8 @@ public class PreparationServiceImpl implements PreparationService {
decorationService.getConstructionInfo(shopId); decorationService.getConstructionInfo(shopId);
flushFlag = Boolean.TRUE; flushFlag = Boolean.TRUE;
} }
return flushFlag; return flushFlag;
} }
} }

View File

@@ -30,6 +30,7 @@ import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -203,12 +204,8 @@ public class XxlJobHandler {
if (Objects.nonNull(approach)) { if (Objects.nonNull(approach)) {
Date date = CoolDateUtils.parseDate(approach.getActualBeginDate(), CoolDateUtils.DATE_FORMAT_DAY); Date date = CoolDateUtils.parseDate(approach.getActualBeginDate(), CoolDateUtils.DATE_FORMAT_DAY);
if (Objects.nonNull(date)) { if (Objects.nonNull(date)) {
Instant instant = date.toInstant(); Result result = getResult(date,CommonConstants.FOUR);
ZoneId zone = ZoneId.systemDefault(); if (result.datePlusDays.equals(result.localDate)) {
LocalDate localDate = instant.atZone(zone).toLocalDate();
LocalDate datePlusFiveDays = localDate.plusDays(CommonConstants.FOUR); // 5天
LocalDate now = LocalDate.now();
if (datePlusFiveDays.equals(now)) {
//三方验收带预约 //三方验收带预约
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120); shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120);
} }
@@ -241,7 +238,6 @@ public class XxlJobHandler {
int pageNum = 1; int pageNum = 1;
int pageSize = 50; int pageSize = 50;
while (hasNext) { while (hasNext) {
//TODO
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
//获取为带预约状态的 //获取为带预约状态的
List<ShopStageInfoDO> shopIdListByStageStatus = shopStageInfoDAO. List<ShopStageInfoDO> shopIdListByStageStatus = shopStageInfoDAO.
@@ -252,27 +248,33 @@ public class XxlJobHandler {
} }
List<Long> shopIds = shopIdListByStageStatus.stream().filter(o -> o.getShopId() != null).map(o -> o.getShopId()).collect(Collectors.toList()); List<Long> shopIds = shopIdListByStageStatus.stream().filter(o -> o.getShopId() != null).map(o -> o.getShopId()).collect(Collectors.toList());
List<AcceptanceInfoDO> acceptanceInfoDOS = acceptanceInfoDAO.selectByShopIds(shopIds); List<AcceptanceInfoDO> acceptanceInfoDOS = acceptanceInfoDAO.selectByShopIds(shopIds);
int flag = CommonConstants.ZERO;
for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) { for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) {
//进场时间 //进场时间
Date approach = acceptanceInfoDO.getActualEntryTime(); while (flag < CommonConstants.TWO) {
if (Objects.nonNull(approach)) { try {
Instant instant = approach.toInstant(); Date approach = acceptanceInfoDO.getActualEntryTime();
ZoneId zone = ZoneId.systemDefault(); if (Objects.nonNull(approach)) {
LocalDate localDate = instant.atZone(zone).toLocalDate(); Result result = getResult(approach,CommonConstants.FOUR);
LocalDate datePlusFiveDays = localDate.plusDays(CommonConstants.FOUR); // 5天 if (result.datePlusDays.equals(result.localDate)) {
if (datePlusFiveDays.equals(localDate)) { ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(acceptanceInfoDO.getShopId());
//三方验收带预约 EnterpriseUserDO userByRoleEnumAndRegionId = userAuthMappingService
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(acceptanceInfoDO.getShopId()); .getUserByRoleEnumAndRegionId(UserRoleEnum.ENGINEER_DEP_SUPERVISOR, shopInfo.getRegionId());
EnterpriseUserDO userByRoleEnumAndRegionId = userAuthMappingService LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
.getUserByRoleEnumAndRegionId(UserRoleEnum.ENGINEER_DEP_SUPERVISOR, shopInfo.getRegionId()); Map<String, String> messageMap = new HashMap<>();
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId()); messageMap.put("storeName", shopInfo.getShopName());
Map<String, String> messageMap = new HashMap<>(); messageMap.put("partnerUsername", lineInfo.getUsername());
messageMap.put("storeName", shopInfo.getShopName()); messageMap.put("partnerMobile", lineInfo.getMobile());
messageMap.put("partnerUsername", lineInfo.getUsername()); commonService.sendMessage(Arrays.asList(userByRoleEnumAndRegionId.getUserId()), MessageEnum.MESSAGE_24, messageMap);
messageMap.put("partnerMobile", lineInfo.getMobile()); }
commonService.sendMessage(Arrays.asList(userByRoleEnumAndRegionId.getUserId()), MessageEnum.MESSAGE_24, messageMap); }
break;
} catch (Exception e) {
log.error("------定时任务三方验收待预约钉钉通知失败,shopId:{}", acceptanceInfoDO.getShopId());
flag++;
} }
} }
flag = CommonConstants.ZERO;
} }
hasNext = shopIdListByStageStatus.size() >= pageSize; hasNext = shopIdListByStageStatus.size() >= pageSize;
pageNum++; pageNum++;
@@ -280,10 +282,29 @@ public class XxlJobHandler {
} }
private static @NotNull Result getResult(Date date,Integer days) {
Instant instant = date.toInstant();
ZoneId zone = ZoneId.systemDefault();
LocalDate localDate = instant.atZone(zone).toLocalDate();
LocalDate datePlusFiveDays = localDate.plusDays(days); // 5天
Result result = new Result(localDate, datePlusFiveDays);
return result;
}
private static class Result {
public final LocalDate localDate;
public final LocalDate datePlusDays;
public Result(LocalDate localDate, LocalDate datePlusDays) {
this.localDate = localDate;
this.datePlusDays = datePlusDays;
}
}
/** /**
* @Auther: wangshuo * @Auther: wangshuo
* @Date: 2024/5/7 * @Date: 2024/5/7
* @description:三方验收预约短信通知+7day * @description:三方验收预约短信通知,进场时间+7天的1800发送短信到加盟商
*/ */
@XxlJob("threeAcceptanceMessage") @XxlJob("threeAcceptanceMessage")
public void threeAcceptanceMessage() { public void threeAcceptanceMessage() {
@@ -305,31 +326,67 @@ public class XxlJobHandler {
Map<Long, ShopStageInfoDO> lineIdMap = ShopStageInfoList.stream().filter(o -> o.getLineId() != null) Map<Long, ShopStageInfoDO> lineIdMap = ShopStageInfoList.stream().filter(o -> o.getLineId() != null)
.collect(Collectors.toMap(ShopStageInfoDO::getLineId, Function.identity())); .collect(Collectors.toMap(ShopStageInfoDO::getLineId, Function.identity()));
List<AcceptanceInfoDO> acceptanceList = acceptanceInfoDAO.selectByShopIds(shopIds); List<AcceptanceInfoDO> acceptanceList = acceptanceInfoDAO.selectByShopIds(shopIds);
int flag = CommonConstants.ZERO;
for (AcceptanceInfoDO acceptanceInfoDO : acceptanceList) {
while (flag < CommonConstants.TWO) {
try {
Date approach = acceptanceInfoDO.getActualEntryTime();
if (Objects.nonNull(approach)) {
Result result = getResult(approach,CommonConstants.SIX);//7 day
if (result.datePlusDays.equals(result.localDate)) {
//三方验收带预约
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(acceptanceInfoDO.getShopId());
EnterpriseUserDO supervisor = userAuthMappingService
.getUserByRoleEnumAndRegionId(UserRoleEnum.ENGINEER_DEP_SUPERVISOR, shopInfo.getRegionId());
//获取撤场计划完成时间
List<ConstructionScheduleDTO> construction = decorationService.getConstruction(acceptanceInfoDO.getShopId());
Map<String, ConstructionScheduleDTO> map = construction.stream()
.filter(o -> StringUtils.isNoneBlank(o.getName()))
.collect(Collectors.toMap(ConstructionScheduleDTO::getName, dto -> dto));
ConstructionScheduleDTO withdrawal = map.get(CommonConstants.WITHDRAWAL);
//获取施工阶段计划完成时间
ConstructionScheduleDTO constructionInfo = decorationService.getConstructionInfo(acceptanceInfoDO.getShopId());
//获取计划验收时间
String palnAcceptanceTime = CoolDateUtils.DateFormat(acceptanceInfoDO.getPlanAcceptanceTime(), CoolDateUtils.DATE_FORMAT_SEC);
//区域监理name
String supervisorName = enterpriseUserDAO.getUserName(supervisor.getUserId());
//区域监理手机号
String mobile = supervisor.getMobile();
Map<String, String> messageMap = new HashMap<>();
if (Objects.nonNull(withdrawal) && withdrawal.getPlanEndDate() != null) {
messageMap.put("demolitionPlanTime", withdrawal.getPlanEndDate());
} else {
for (AcceptanceInfoDO acceptance : acceptanceList) { if (Objects.nonNull(constructionInfo)) {
Date approach = acceptance.getActualEntryTime(); messageMap.put("demolitionPlanTime", constructionInfo.getPlanEndDate());
if (Objects.nonNull(approach)) { }
Instant instant = approach.toInstant(); }
ZoneId zone = ZoneId.systemDefault(); messageMap.put("palnAcceptanceTime", palnAcceptanceTime);
LocalDate localDate = instant.atZone(zone).toLocalDate(); messageMap.put("supervisionName", supervisorName);
LocalDate datePlusFiveDays = localDate.plusDays(CommonConstants.SIX); // 7天 messageMap.put("supervisionMobile", mobile);
if (datePlusFiveDays.equals(localDate)) { //加盟商手机号
ShopStageInfoDO stageInfoDO = lineIdMap.get(acceptance.getShopId()); ShopStageInfoDO stageInfoDO = lineIdMap.get(acceptanceInfoDO.getShopId());
if (Objects.nonNull(stageInfoDO)) { Long lineId = stageInfoDO.getLineId();
Long lineId = stageInfoDO.getLineId(); LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId); commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.THREE_ACCEPTANCE_WAIT, messageMap);
}
Map<String, String> templateParam = new HashMap<>();
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.THREE_ACCEPTANCE_WAIT, null);
} }
break;
} catch (Exception e) {
log.error("定时任务三方验收预约短信通知失败 shopId:{}", acceptanceInfoDO.getShopId());
flag++;
} }
} }
flag = CommonConstants.ZERO;
} }
hasNext = ShopStageInfoList.size() >= pageSize; hasNext = ShopStageInfoList.size() >= pageSize;
pageNum++; pageNum++;
} }
XxlJobHelper.handleSuccess(); XxlJobHelper.handleSuccess();
} }
/** /**
* @Auther: wangshuo * @Auther: wangshuo
* @Date: 2024/5/7 * @Date: 2024/5/7
@@ -337,7 +394,7 @@ public class XxlJobHandler {
*/ */
@XxlJob("waitThreeAcceptanceMessage") @XxlJob("waitThreeAcceptanceMessage")
public void waitThreeAcceptanceMessage() { public void waitThreeAcceptanceMessage() {
log.info("------定时任务三方待验收通知-----"); log.info("------定时任务三方待验收钉钉通知-----");
boolean hasNext = true; boolean hasNext = true;
int pageNum = 1; int pageNum = 1;
int pageSize = 50; int pageSize = 50;
@@ -347,7 +404,7 @@ public class XxlJobHandler {
List<ShopStageInfoDO> ShopStageInfoList = shopStageInfoDAO. List<ShopStageInfoDO> ShopStageInfoList = shopStageInfoDAO.
getShopIdListByStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121.getShopSubStageStatus()); getShopIdListByStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121.getShopSubStageStatus());
if (CollectionUtils.isEmpty(ShopStageInfoList)) { if (CollectionUtils.isEmpty(ShopStageInfoList)) {
log.info("------定时任务结束三方验收预约短信通知------"); log.info("------定时任务结束三方验收钉钉通知------");
return; return;
} }
List<Long> shopIds = ShopStageInfoList.stream().filter(o -> o.getShopId() != null) List<Long> shopIds = ShopStageInfoList.stream().filter(o -> o.getShopId() != null)
@@ -355,21 +412,26 @@ public class XxlJobHandler {
Map<Long, ShopStageInfoDO> lineIdMap = ShopStageInfoList.stream().filter(o -> o.getLineId() != null) Map<Long, ShopStageInfoDO> lineIdMap = ShopStageInfoList.stream().filter(o -> o.getLineId() != null)
.collect(Collectors.toMap(ShopStageInfoDO::getLineId, Function.identity())); .collect(Collectors.toMap(ShopStageInfoDO::getLineId, Function.identity()));
List<AcceptanceInfoDO> acceptanceList = acceptanceInfoDAO.selectByShopIds(shopIds); List<AcceptanceInfoDO> acceptanceList = acceptanceInfoDAO.selectByShopIds(shopIds);
List<ShopInfoDO> shopListByIds = shopInfoDAO.getShopListByIds(shopIds);
Map<Long, ShopInfoDO> shopIdMap = shopListByIds.stream().filter(o -> o.getId() != null)
.collect(Collectors.toMap(ShopInfoDO::getId, Function.identity()));
for (AcceptanceInfoDO acceptance : acceptanceList) { for (AcceptanceInfoDO acceptance : acceptanceList) {
//进场时间
Date approach = acceptance.getActualEntryTime(); Date approach = acceptance.getActualEntryTime();
Long shopId = acceptance.getShopId();
if (Objects.nonNull(approach)) { if (Objects.nonNull(approach)) {
Instant instant = approach.toInstant(); Result result = getResult(approach,CommonConstants.SIX);//7天
ZoneId zone = ZoneId.systemDefault(); if (result.datePlusDays.equals(result.localDate)) {
LocalDate localDate = instant.atZone(zone).toLocalDate(); ShopStageInfoDO stageInfoDO = lineIdMap.get(shopId);
LocalDate datePlusFiveDays = localDate.plusDays(CommonConstants.SIX); // 7天 ShopInfoDO shopInfoDO = shopIdMap.get(shopId);
if (datePlusFiveDays.equals(localDate)) { Long lineId = stageInfoDO.getLineId();
ShopStageInfoDO stageInfoDO = lineIdMap.get(acceptance.getShopId()); LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
if (Objects.nonNull(stageInfoDO)) { Map<String, String> messageMap = new HashMap<>();
Long lineId = stageInfoDO.getLineId(); messageMap.put("storeName",shopInfoDO.getShopName());
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId); messageMap.put("partnerUsername", lineInfo.getUsername());
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.THREE_ACCEPTANCE_WAIT, null); messageMap.put("partnerMobile", lineInfo.getMobile());
} commonService.sendMessage(Arrays.asList(shopInfoDO.getSupervisorUserId()), MessageEnum.MESSAGE_25, messageMap);
} }
} }
} }