完成定时任务和短信和消息通知

This commit is contained in:
shuo.wang
2024-05-11 13:42:37 +08:00
parent 3a7940bcb8
commit a37c20e840
8 changed files with 175 additions and 68 deletions

View File

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

View File

@@ -10,6 +10,7 @@ import com.cool.store.dto.decoration.ProjectDTO;
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.entity.*;
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.ShopSubStageEnum;
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);
@Resource
private CommonService commonService;
@Resource
private ShopStageInfoDAO shopStageInfoDAO;
@Resource
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));
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());
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
//都完成了 初始化后续流程数据
if (buildStoreCompletionFlag && contractCompletionFlag) {
//初始化后续流程数据 设计阶段 装修阶段 开业运营方案 首批订货清单
@@ -197,9 +201,23 @@ public class PreparationServiceImpl implements PreparationService {
ShopStageInfoDO data3 = shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_14.getShopSubStage());
data3.setShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_140.getShopSubStageStatus());
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());
data4.setShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_150.getShopSubStageStatus());
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);
}
}
@@ -246,10 +264,8 @@ public class PreparationServiceImpl implements PreparationService {
decorationService.getConstructionInfo(shopId);
flushFlag = Boolean.TRUE;
}
return flushFlag;
return flushFlag;
}
}