完成部分定时任务

This commit is contained in:
shuo.wang
2024-05-10 20:10:14 +08:00
parent 4cb229f087
commit ec918a1d7b
11 changed files with 278 additions and 131 deletions

View File

@@ -39,7 +39,7 @@ public enum MessageEnum {
MESSAGE_21("加盟商已登记一位员工,请及时安排培训", "##### 员工姓名:【${userName}】,员工手机号码:【${mobile}】,登记时间:【${registerTime}】"), MESSAGE_21("加盟商已登记一位员工,请及时安排培训", "##### 员工姓名:【${userName}】,员工手机号码:【${mobile}】,登记时间:【${registerTime}】"),
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"),
; ;
private String title; private String title;
@@ -59,7 +59,7 @@ public enum MessageEnum {
return content; return content;
} }
public String getContent(Map<String, String> paramMap){ public String getContent(Map<String, String> paramMap) {
String result = this.content; String result = this.content;
for (String key : paramMap.keySet()) { for (String key : paramMap.keySet()) {
result = result.replace("${" + key + "}", paramMap.get(key)); result = result.replace("${" + key + "}", paramMap.get(key));
@@ -72,8 +72,8 @@ public enum MessageEnum {
} }
public String getMessageUrl(String domainUrl, String appId, String corpId, Map<String, String> paramMap){ public String getMessageUrl(String domainUrl, String appId, String corpId, Map<String, String> paramMap) {
if(StringUtils.isAnyBlank(domainUrl, appId, corpId) || Objects.isNull(paramMap)){ if (StringUtils.isAnyBlank(domainUrl, appId, corpId) || Objects.isNull(paramMap)) {
return ""; return "";
} }
try { try {
@@ -86,22 +86,22 @@ public enum MessageEnum {
case MESSAGE_7: case MESSAGE_7:
case MESSAGE_8: case MESSAGE_8:
case MESSAGE_9: case MESSAGE_9:
return domainUrl + "/dd-noticemsg?appId=" + appId + "&corpId="+ corpId + "&appUrl=" + return domainUrl + "/dd-noticemsg?appId=" + appId + "&corpId=" + corpId + "&appUrl=" +
URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=clue&timestamp="+System.currentTimeMillis()+"&lineId=" + paramMap.get("lineId"), StandardCharsets.UTF_8.name()); URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=clue&timestamp=" + System.currentTimeMillis() + "&lineId=" + paramMap.get("lineId"), StandardCharsets.UTF_8.name());
case MESSAGE_3: case MESSAGE_3:
case MESSAGE_10: case MESSAGE_10:
return domainUrl + "/dd-noticemsg?appId=" + appId + "&corpId="+ corpId + "&appUrl=" + return domainUrl + "/dd-noticemsg?appId=" + appId + "&corpId=" + corpId + "&appUrl=" +
URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=interview&timestamp="+System.currentTimeMillis()+"&lineId=" + paramMap.get("lineId"), StandardCharsets.UTF_8.name()); URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=interview&timestamp=" + System.currentTimeMillis() + "&lineId=" + paramMap.get("lineId"), StandardCharsets.UTF_8.name());
case MESSAGE_11: case MESSAGE_11:
case MESSAGE_12: case MESSAGE_12:
return domainUrl + "/dd-noticemsg?appId=" + appId + "&corpId="+ corpId + "&appUrl=" + return domainUrl + "/dd-noticemsg?appId=" + appId + "&corpId=" + corpId + "&appUrl=" +
URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=point&timestamp="+System.currentTimeMillis()+"&pointId=" + paramMap.get("pointId"), StandardCharsets.UTF_8.name()); URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=point&timestamp=" + System.currentTimeMillis() + "&pointId=" + paramMap.get("pointId"), StandardCharsets.UTF_8.name());
case MESSAGE_13: case MESSAGE_13:
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=point&timestamp="+System.currentTimeMillis()+"&pointId="+ paramMap.get("pointId"), StandardCharsets.UTF_8.name()); URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=point&timestamp=" + System.currentTimeMillis() + "&pointId=" + paramMap.get("pointId"), StandardCharsets.UTF_8.name());
case MESSAGE_14: case MESSAGE_14:
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=pointPush&timestamp="+System.currentTimeMillis()+"&lineId="+ paramMap.get("lineId"), StandardCharsets.UTF_8.name()); URLEncoder.encode("pages/common-web-view/index?noticeType=xfsg&routerUrl=notice&target=pointPush&timestamp=" + System.currentTimeMillis() + "&lineId=" + paramMap.get("lineId"), StandardCharsets.UTF_8.name());
case MESSAGE_15: case MESSAGE_15:
case MESSAGE_16: case MESSAGE_16:
case MESSAGE_18: case MESSAGE_18:
@@ -117,6 +117,10 @@ public enum MessageEnum {
case MESSAGE_22: case MESSAGE_22:
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()+"&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());
case MESSAGE_24:
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());
default: default:
return ""; return "";
} }

View File

@@ -22,13 +22,14 @@ public enum SMSMsgEnum {
SELECT_SUCCESS("选铺成功", "", "SMS_465950846"), SELECT_SUCCESS("选铺成功", "", "SMS_465950846"),
RENT_CONTRACT_AUDIT_FAIL("租赁合同上传未通过", "", "SMS_465955429"), RENT_CONTRACT_AUDIT_FAIL("租赁合同上传未通过", "", "SMS_465955429"),
SHOP_EXPERIENCE("门店体验安排", "", "SMS_465905828"), SHOP_EXPERIENCE("门店体验安排", "", "SMS_465905828"),
SYS_BUILD_STORE_DONE("系统建店已完成","","SMS_465916277"), SYS_BUILD_STORE_DONE("系统建店已完成", "", "SMS_465916277"),
LICENSE_SUBMITTED("证照待提交","","SMS_465981218"), LICENSE_SUBMITTED("证照待提交", "", "SMS_465981218"),
LICENSE_NOT_PASS("证照未通过","","SMS_465971250"), LICENSE_NOT_PASS("证照未通过", "", "SMS_465971250"),
FRANCHISE_FEE_SUBMITTED("缴纳加盟费待缴纳","","SMS_465921311"), FRANCHISE_FEE_SUBMITTED("缴纳加盟费待缴纳", "", "SMS_465921311"),
FRANCHISE_FEE_NOT_PASS("缴纳加盟费缴纳失败","","SMS_465896262"), FRANCHISE_FEE_NOT_PASS("缴纳加盟费缴纳失败", "", "SMS_465896262"),
DECORATION_MODEL_PAY("装修款待缴费", "","SMS_465961253"),
THREE_ACCEPTANCE_WAIT("三方验收待验收","","SMS_465961257"),
TRAINING_REGISTER_SUCCESS("培训登记中", "", "SMS_466035101"), TRAINING_REGISTER_SUCCESS("培训登记中", "", "SMS_466035101"),
; ;
private String title; private String title;

View File

@@ -8,6 +8,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@@ -50,4 +51,7 @@ public class AcceptanceInfoDAO {
} }
return acceptanceInfoMapper.selectByShopIds(shopIds); return acceptanceInfoMapper.selectByShopIds(shopIds);
} }
public List<AcceptanceInfoDO> selectByEntryTimeNull(){
return acceptanceInfoMapper.selectByEntryTimeNull();
}
} }

View File

@@ -186,9 +186,11 @@ public class ShopStageInfoDAO {
ShopSubStageStatusEnum shopSubStageStatus = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_21; ShopSubStageStatusEnum shopSubStageStatus = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_21;
return shopStageInfoMapper.getRentContractToDoPage(userId, shopSubStageStatus.getShopSubStageEnum().getShopSubStage(), shopSubStageStatus.getShopSubStageStatus()); return shopStageInfoMapper.getRentContractToDoPage(userId, shopSubStageStatus.getShopSubStageEnum().getShopSubStage(), shopSubStageStatus.getShopSubStageStatus());
} }
public Page<Long> getShopIdListByStageStatus( Integer pageNum, Integer pageSize){ public List<ShopStageInfoDO> getShopIdListByStageStatus(Integer shopSubStageStatus){
PageHelper.startPage(pageNum, pageSize); if (shopSubStageStatus == null ||shopSubStageStatus ==CommonConstants.ZERO){
return shopStageInfoMapper.getShopIdListByStageStatus(); return null;
}
return shopStageInfoMapper.getShopIdListByStageStatus(shopSubStageStatus);
} }
public List<ScheduleDTO> getScheduleList(List<Long> shopIdList){ public List<ScheduleDTO> getScheduleList(List<Long> shopIdList){

View File

@@ -30,5 +30,5 @@ public interface AcceptanceInfoMapper extends Mapper<AcceptanceInfoDO> {
* @Date: 2024/5/3 * @Date: 2024/5/3
* @description:查询进场时间为空的数据 * @description:查询进场时间为空的数据
*/ */
List<AcceptanceInfoDO> selectListByActualEntryTime(); List<AcceptanceInfoDO> selectByEntryTimeNull();
} }

View File

@@ -100,12 +100,8 @@ public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
* @return * @return
*/ */
Page<RentInfoToDoVO> getRentContractToDoPage(@Param("userId") String userId, @Param("shopSubStage")Integer shopSubStage, @Param("shopSubStageStatus") Integer shopSubStageStatus); Page<RentInfoToDoVO> getRentContractToDoPage(@Param("userId") String userId, @Param("shopSubStage")Integer shopSubStage, @Param("shopSubStageStatus") Integer shopSubStageStatus);
/**
* @Auther: wangshuo List<ShopStageInfoDO> getShopIdListByStageStatus(@Param("shopSubStageStatus") Integer shopSubStageStatus);
* @Date: 2024/4/25
* @description:获取处于订货金阶段的shopid
*/
Page<Long> getShopIdListByStageStatus();
List<ScheduleDTO> getScheduleList(@Param("shopIds") List<Long> shopIds); List<ScheduleDTO> getScheduleList(@Param("shopIds") List<Long> shopIds);

View File

@@ -93,7 +93,7 @@
from xfsg_acceptance_info from xfsg_acceptance_info
where shop_id = #{shopId} and deleted = 0 where shop_id = #{shopId} and deleted = 0
</select> </select>
<select id="selectListByActualEntryTime" resultType="com.cool.store.entity.AcceptanceInfoDO"> <select id="selectByEntryTimeNull" resultType="com.cool.store.entity.AcceptanceInfoDO">
select select
<include refid="baseColumn"/> <include refid="baseColumn"/>
from xfsg_acceptance_info from xfsg_acceptance_info

View File

@@ -161,11 +161,7 @@
where where
a.shop_sub_stage = #{shopSubStage} and a.shop_sub_stage_status = #{shopSubStageStatus} and a.deleted = 0 and b.deleted = 0 and b.investment_manager = #{userId} a.shop_sub_stage = #{shopSubStage} and a.shop_sub_stage_status = #{shopSubStageStatus} and a.deleted = 0 and b.deleted = 0 and b.investment_manager = #{userId}
</select> </select>
<select id="getShopIdListByStageStatus" resultType="java.lang.Long">
select shop_id
from xfsg_shop_stage_info
where shop_stage = 2 and shop_sub_stage = 150 and shop_sub_stage_status= 1505 and is_terminated = 0
</select>
<select id="getScheduleList" resultType="com.cool.store.dto.Preparation.ScheduleDTO"> <select id="getScheduleList" resultType="com.cool.store.dto.Preparation.ScheduleDTO">
select select
@@ -266,4 +262,9 @@
and shop_sub_stage =#{shopSubStage} and shop_sub_stage =#{shopSubStage}
</if> </if>
</select> </select>
<select id="getShopIdListByStageStatus" resultType="com.cool.store.entity.ShopStageInfoDO">
select *
from xfsg_shop_stage_info
where shop_sub_stage_status = #{shopSubStageStatus}
</select>
</mapper> </mapper>

View File

@@ -92,7 +92,8 @@ public class DecorationServiceImpl implements DecorationService {
private UserAuthMappingService userAuthMappingService; private UserAuthMappingService userAuthMappingService;
@Resource @Resource
private ShopInfoMapper shopInfoMapper; private ShopInfoMapper shopInfoMapper;
@Resource
private CommonService commonService;
@Override @Override
public DesignInfoVo DesignInfo(Long shopId) { public DesignInfoVo DesignInfo(Long shopId) {
@@ -130,12 +131,14 @@ public class DecorationServiceImpl implements DecorationService {
flag++; flag++;
} }
if (flag == CommonConstants.FOUR) { if (flag == CommonConstants.FOUR) {
//如果设计阶段未完成 //如果设计阶段进行中
if (!ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_91.getShopSubStageStatus(). ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_9);
equals(shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_9).getShopSubStageStatus())) { if (ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_90.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())) {
//更新设计阶段状态完成//初始化装修款阶段 //更新设计阶段状态完成//初始化装修款阶段
shopStageInfoDAO.batchUpdateShopStageStatus(shopId, Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_91, shopStageInfoDAO.batchUpdateShopStageStatus(shopId, Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_91,
ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_100)); ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_100));
LineInfoDO lineInfo = lineInfoMapper.getByLineId(shopSubStageInfo.getLineId());
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.DECORATION_MODEL_PAY, null);
} }
} }
return designInfoVo; return designInfoVo;

View File

@@ -222,21 +222,30 @@ public class PreparationServiceImpl implements PreparationService {
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, ShopStageEnum.SHOP_STAGE_2.getShopStage()); List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, ShopStageEnum.SHOP_STAGE_2.getShopStage());
Map<Integer, ShopStageInfoDO> collect = shopStageInfo.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopSubStage, Function.identity())); Map<Integer, ShopStageInfoDO> collect = shopStageInfo.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopSubStage, Function.identity()));
//设计 //设计
if (!ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_91.getShopSubStageStatus(). Boolean flushFlag = Boolean.FALSE;
equals(collect.get(ShopSubStageEnum.SHOP_STAGE_9.getShopSubStage()).getShopSubStageStatus())) { Integer Status900 = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_90.getShopSubStageStatus();
Integer Design = collect.get(ShopSubStageEnum.SHOP_STAGE_9.getShopSubStage()).getShopSubStageStatus();
if (Status900.equals(Design)) {
decorationService.DesignInfo(shopId); decorationService.DesignInfo(shopId);
flushFlag = Boolean.TRUE;
} }
//装修款 //装修款
if (!ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_102.getShopSubStageStatus(). Integer Status1000 = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_100.getShopSubStageStatus();
equals(collect.get(ShopSubStageEnum.SHOP_STAGE_10.getShopSubStage()).getShopSubStageStatus())) { Integer Status1010 = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_101.getShopSubStageStatus();
Integer DecorationModel = collect.get(ShopSubStageEnum.SHOP_STAGE_10.getShopSubStage()).getShopSubStageStatus();
if (Status1000.equals(DecorationModel) || Status1010.equals(DecorationModel)) {
decorationService.getDecorationModel(shopId, null); decorationService.getDecorationModel(shopId, null);
flushFlag = Boolean.TRUE;
} }
//施工阶段 //施工阶段
if (!ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112.getShopSubStageStatus(). Integer Status1100 = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_110.getShopSubStageStatus();
equals(collect.get(ShopSubStageEnum.SHOP_STAGE_11.getShopSubStage()).getShopSubStageStatus())) { Integer Status1110 = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_111.getShopSubStageStatus();
Integer Construction = collect.get(ShopSubStageEnum.SHOP_STAGE_11.getShopSubStage()).getShopSubStageStatus();
if (Status1110.equals(Construction) || Status1100.equals(Construction)) {
decorationService.getConstructionInfo(shopId); decorationService.getConstructionInfo(shopId);
flushFlag = Boolean.TRUE;
} }
return Boolean.TRUE; return flushFlag;
} }

View File

@@ -18,11 +18,9 @@ import com.cool.store.mapper.TrainingExperienceMapper;
import com.cool.store.mq.util.HttpRestTemplateService; import com.cool.store.mq.util.HttpRestTemplateService;
import com.cool.store.request.xfsgFirstOrderListRequest; import com.cool.store.request.xfsgFirstOrderListRequest;
import com.cool.store.response.xfsgFirstOderListResponse; import com.cool.store.response.xfsgFirstOderListResponse;
import com.cool.store.service.CoolStoreStartFlowService; import com.cool.store.service.*;
import com.cool.store.service.DecorationService;
import com.cool.store.service.PreparationService;
import com.cool.store.service.XfsgEhrService;
import com.cool.store.service.impl.CommonService; import com.cool.store.service.impl.CommonService;
import com.cool.store.utils.CoolDateUtils;
import com.cool.store.utils.poi.DateUtils; import com.cool.store.utils.poi.DateUtils;
import com.cool.store.utils.poi.StringUtils; import com.cool.store.utils.poi.StringUtils;
import com.cool.store.utils.poi.constant.Constants; import com.cool.store.utils.poi.constant.Constants;
@@ -34,6 +32,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
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 javax.annotation.Resource; import javax.annotation.Resource;
import java.text.ParseException; import java.text.ParseException;
@@ -42,6 +41,7 @@ import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
@@ -83,6 +83,8 @@ public class XxlJobHandler {
private TempUserDetailDAO tempUserDetailDAO; private TempUserDetailDAO tempUserDetailDAO;
@Resource @Resource
private EnterpriseUserDAO enterpriseUserDAO; private EnterpriseUserDAO enterpriseUserDAO;
@Resource
private UserAuthMappingService userAuthMappingService;
/** /**
* 每天都将待体验门店信息变更到体验中 * 每天都将待体验门店信息变更到体验中
@@ -128,38 +130,43 @@ public class XxlJobHandler {
*/ */
@XxlJob("updateFirstOrder") @XxlJob("updateFirstOrder")
public void updateFirstOrder() { public void updateFirstOrder() {
log.info("----定时任务查询更新订货金----");
boolean hasNext = true; boolean hasNext = true;
int PageNum = 1; int pageNum = 1;
int PageSize = 50; int pageSize = 50;
while (hasNext) { while (hasNext) {
log.info("----查询更新订货金----");
//sql 判定传入 PageHelper.startPage(pageNum, pageSize);
Page<Long> shopIdListByStageStatus = shopStageInfoDAO.getShopIdListByStageStatus(PageNum, PageSize); List<ShopStageInfoDO> shopIdListByStageStatus = shopStageInfoDAO.getShopIdListByStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_152.getShopSubStageStatus());
if (CollectionUtils.isEmpty(shopIdListByStageStatus)) { if (CollectionUtils.isEmpty(shopIdListByStageStatus)) {
log.info("------今日没有待更新数据------"); log.info("------定时任务结束调用鲜丰更新订货金结束------");
return; return;
} }
List<OpenPlanShopInfoDTO> openPlanShopInfoDTOS = shopInfoDAO.queryStoreNumeListByid(shopIdListByStageStatus); List<Long> shopIds = shopIdListByStageStatus.stream().filter(o -> o.getShopId() != null).map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
Map<String, Long> map = openPlanShopInfoDTOS.stream().filter(OpenPlanShopInfoDTO -> OpenPlanShopInfoDTO.getStoreNum() != null). try {
collect(Collectors.toMap(OpenPlanShopInfoDTO::getStoreNum, OpenPlanShopInfoDTO::getShopId)); List<OpenPlanShopInfoDTO> openPlanShopInfoDTOS = shopInfoDAO.queryStoreNumeListByid(shopIds);
List<String> storeCodes = new ArrayList<>(map.keySet()); Map<String, Long> map = openPlanShopInfoDTOS.stream().filter(OpenPlanShopInfoDTO -> StringUtils.isNoneBlank(OpenPlanShopInfoDTO.getStoreNum())).
xfsgFirstOrderListRequest request = new xfsgFirstOrderListRequest(); collect(Collectors.toMap(OpenPlanShopInfoDTO::getStoreNum, OpenPlanShopInfoDTO::getShopId));
request.setStoreCodeList(storeCodes); List<String> storeCodes = new ArrayList<>(map.keySet());
xfsgFirstOderListResponse firstOrderList = coolStoreStartFlowService.getFirstOrderList(request); xfsgFirstOrderListRequest request = new xfsgFirstOrderListRequest();
if (Objects.nonNull(firstOrderList) && CollectionUtils.isNotEmpty(firstOrderList.getData())) { request.setStoreCodeList(storeCodes);
for (xfsgFirstOderDTO o : firstOrderList.getData()) { xfsgFirstOderListResponse firstOrderList = coolStoreStartFlowService.getFirstOrderList(request);
if (o.getBalance()) { if (Objects.nonNull(firstOrderList) && CollectionUtils.isNotEmpty(firstOrderList.getData())) {
shopStageInfoDAO.updateShopStageAndAuditInfo(map.get(o.getStoreCode()), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151, null); for (xfsgFirstOderDTO o : firstOrderList.getData()) {
preparationService.whetherToOpenForAcceptance(map.get(o.getStoreCode())); if (o.getBalance()) {
shopStageInfoDAO.updateShopStageAndAuditInfo(map.get(o.getStoreCode()), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151, null);
preparationService.whetherToOpenForAcceptance(map.get(o.getStoreCode()));
}
} }
} }
} catch (Exception e) {
log.error("定时任务更新订货金失败 shopIds:{}", shopIds);
} }
hasNext = shopIdListByStageStatus.size() >= PageSize; hasNext = shopIdListByStageStatus.size() >= pageSize;
PageNum++; pageNum++;
} }
log.info("------定时任务结束调用鲜丰更新订货金结束------");
XxlJobHelper.handleSuccess();
} }
/** /**
@@ -168,67 +175,107 @@ public class XxlJobHandler {
* @description: 每天更新装修阶段进场时间等,至预约状态 * @description: 每天更新装修阶段进场时间等,至预约状态
*/ */
@XxlJob("fitmentAcceptanceHandler") @XxlJob("fitmentAcceptanceHandler")
@Transactional(rollbackFor = Exception.class)
public void fitmentAcceptanceHandler() { public void fitmentAcceptanceHandler() {
log.info("----定时任务每天更新装修阶段进场时间,施工完成时间等,至预约状态----");
boolean hasNext = true; boolean hasNext = true;
int PageNum = 1; int pageNum = 1;
int PageSize = 50; int pageSize = 50;
while (hasNext) { while (hasNext) {
log.info("----每天更新装修阶段进场时间,施工完成时间等,至预约状态----"); PageHelper.startPage(pageNum, pageSize);
PageHelper.startPage(PageNum, PageSize); //获取表中进场时间为空的店铺
//获取施工阶段未完成shopID List<AcceptanceInfoDO> acceptanceList = acceptanceInfoDAO.selectByEntryTimeNull();
List<Long> shops = shopStageInfoDAO.getShopContractIncompletion(); if (CollectionUtils.isEmpty(acceptanceList)) {
if (CollectionUtils.isEmpty(shops)) { log.info("------定时任务结束调用鲜丰获取进场时间结束------");
log.info("------今日没有待更新数据------");
return; return;
} }
List<AcceptanceInfoDO> acceptanceInfoDOS = new ArrayList<>(); int flag = CommonConstants.ZERO;
acceptanceInfoDOS.addAll(acceptanceInfoDAO.selectByShopIds(shops)); for (AcceptanceInfoDO acceptanceInfoDO : acceptanceList) {
for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) { while (flag < CommonConstants.TWO) {
Long shopId = acceptanceInfoDO.getShopId();
acceptanceInfoDO.setUpdateTime(new Date());
ConstructionScheduleDTO constructionInfo = decorationService.getConstructionInfo(shopId);
List<ConstructionScheduleDTO> construction = decorationService.getConstruction(shopId);
//施工完成时间,装修计划开始和完成时间
if (Objects.nonNull(constructionInfo) && !StringUtils.isNull(constructionInfo.getPlanEndDate())
&& Objects.isNull(acceptanceInfoDO.getConstructionCompletionTime())) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try { try {
Date constructionEndTime = sdf.parse(constructionInfo.getActualEndDate()); Long shopId = acceptanceInfoDO.getShopId();
acceptanceInfoDO.setConstructionCompletionTime(constructionEndTime); //施工子阶段
Date PlanBegin = sdf.parse(constructionInfo.getPlanBeginDate()); List<ConstructionScheduleDTO> construction = decorationService.getConstruction(shopId);
Date PlanEnd = sdf.parse(constructionInfo.getPlanEndDate()); Map<String, ConstructionScheduleDTO> constructionMap = construction.stream().
acceptanceInfoDO.setDecorationPlannedStartTime(PlanBegin); collect(Collectors.toMap(ConstructionScheduleDTO::getName, dto -> dto));
acceptanceInfoDO.setDecorationPlannedCompletionTime(PlanEnd); //进场时间
acceptanceInfoDAO.updateAcceptanceInfo(acceptanceInfoDO); ConstructionScheduleDTO approach = constructionMap.get(CommonConstants.APPROACH);
} catch (ParseException e) { if (Objects.nonNull(approach)) {
log.error("初始化acceptanceInfo鲜丰服务施工完成时间日期转化异常"); Date date = CoolDateUtils.parseDate(approach.getActualBeginDate(), CoolDateUtils.DATE_FORMAT_DAY);
if (Objects.nonNull(date)) {
Instant instant = date.toInstant();
ZoneId zone = ZoneId.systemDefault();
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);
}
}
}
break;
} catch (Exception e) {
log.error("定时任务设置进场时间失败,shopId:{}", acceptanceInfoDO.getShopId());
flag++;
} }
} }
flag = CommonConstants.ZERO;
}
hasNext = acceptanceList.size() >= pageSize;
pageNum++;
}
log.info("------定时任务结束调用鲜丰获取进场时间结束------");
XxlJobHelper.handleSuccess();
}
/**
* @Auther: wangshuo
* @Date: 2024/5/10
* @description:实际进场时间+5天发送钉钉通知到工程监理
*/
@XxlJob("threeAcceptanceBookingMessage")
public void threeAcceptanceBookingMessage() {
log.info("------定时任务三方验收待预约钉钉通知-----");
boolean hasNext = true;
int pageNum = 1;
int pageSize = 50;
while (hasNext) {
//TODO
PageHelper.startPage(pageNum, pageSize);
//获取为带预约状态的
List<ShopStageInfoDO> shopIdListByStageStatus = shopStageInfoDAO.
getShopIdListByStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120.getShopSubStageStatus());
if (CollectionUtils.isEmpty(shopIdListByStageStatus)) {
log.info("------定时任务结束三方验收待预约钉钉通知------");
return;
}
List<Long> shopIds = shopIdListByStageStatus.stream().filter(o -> o.getShopId() != null).map(o -> o.getShopId()).collect(Collectors.toList());
List<AcceptanceInfoDO> acceptanceInfoDOS = acceptanceInfoDAO.selectByShopIds(shopIds);
for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) {
//进场时间 //进场时间
if (Objects.nonNull(construction) && !StringUtils.isNull(construction.get(CommonConstants.ZERO).getActualBeginDate()) Date approach = acceptanceInfoDO.getActualEntryTime();
&& Objects.isNull(acceptanceInfoDO.getActualEntryTime())) { if (Objects.nonNull(approach)) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Instant instant = approach.toInstant();
try { ZoneId zone = ZoneId.systemDefault();
Date constructionBeginTime = sdf.parse(construction.get(CommonConstants.ZERO).getActualBeginDate()); LocalDate localDate = instant.atZone(zone).toLocalDate();
acceptanceInfoDO.setActualEntryTime(constructionBeginTime); LocalDate datePlusFiveDays = localDate.plusDays(CommonConstants.FOUR); // 5天
acceptanceInfoDAO.updateAcceptanceInfo(acceptanceInfoDO); if (datePlusFiveDays.equals(localDate)) {
//+5tian //三方验收带预约
Instant instant = acceptanceInfoDO.getActualEntryTime().toInstant(); ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(acceptanceInfoDO.getShopId());
ZoneId zone = ZoneId.systemDefault(); EnterpriseUserDO userByRoleEnumAndRegionId = userAuthMappingService
LocalDate localDate = instant.atZone(zone).toLocalDate(); .getUserByRoleEnumAndRegionId(UserRoleEnum.ENGINEER_DEP_SUPERVISOR, shopInfo.getRegionId());
LocalDate datePlusFiveDays = localDate.plusDays(CommonConstants.FOUR); // 添加5天 LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
LocalDate now = LocalDate.now(); Map<String, String> messageMap = new HashMap<>();
if (datePlusFiveDays.equals(now)) { messageMap.put("storeName", shopInfo.getShopName());
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120); messageMap.put("partnerUsername", lineInfo.getUsername());
} messageMap.put("partnerMobile", lineInfo.getMobile());
} catch (ParseException e) { commonService.sendMessage(Arrays.asList(userByRoleEnumAndRegionId.getUserId()), MessageEnum.MESSAGE_24, messageMap);
log.error("初始化acceptanceInfo鲜丰服务进场时间日期转化异常");
} }
} }
} }
hasNext = acceptanceInfoDOS.size() >= PageSize; hasNext = shopIdListByStageStatus.size() >= pageSize;
PageNum++; pageNum++;
} }
} }
@@ -236,20 +283,100 @@ public class XxlJobHandler {
/** /**
* @Auther: wangshuo * @Auther: wangshuo
* @Date: 2024/5/7 * @Date: 2024/5/7
* @description:三方验收预约短信通知 * @description:三方验收预约短信通知+7day
*/ */
@XxlJob("ThreeAcceptanceMessage") @XxlJob("threeAcceptanceMessage")
public void ThreeAcceptanceMessage() { public void threeAcceptanceMessage() {
log.info("------三方验收预约短信通知-----"); log.info("------定时任务三方验收预约短信通知-----");
boolean hasNext = true; boolean hasNext = true;
int PageNum = 1; int pageNum = 1;
int PageSize = 50; int pageSize = 50;
while (hasNext) { while (hasNext) {
PageHelper.startPage(pageNum, pageSize);
//获取待验收的
List<ShopStageInfoDO> ShopStageInfoList = shopStageInfoDAO.
getShopIdListByStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121.getShopSubStageStatus());
if (CollectionUtils.isEmpty(ShopStageInfoList)) {
log.info("------定时任务结束三方验收预约短信通知------");
return;
}
List<Long> shopIds = ShopStageInfoList.stream().filter(o -> o.getShopId() != null)
.map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
Map<Long, ShopStageInfoDO> lineIdMap = ShopStageInfoList.stream().filter(o -> o.getLineId() != null)
.collect(Collectors.toMap(ShopStageInfoDO::getLineId, Function.identity()));
List<AcceptanceInfoDO> acceptanceList = acceptanceInfoDAO.selectByShopIds(shopIds);
// hasNext = ; for (AcceptanceInfoDO acceptance : acceptanceList) {
PageNum++; Date approach = acceptance.getActualEntryTime();
if (Objects.nonNull(approach)) {
Instant instant = approach.toInstant();
ZoneId zone = ZoneId.systemDefault();
LocalDate localDate = instant.atZone(zone).toLocalDate();
LocalDate datePlusFiveDays = localDate.plusDays(CommonConstants.SIX); // 7天
if (datePlusFiveDays.equals(localDate)) {
ShopStageInfoDO stageInfoDO = lineIdMap.get(acceptance.getShopId());
if (Objects.nonNull(stageInfoDO)) {
Long lineId = stageInfoDO.getLineId();
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
Map<String, String> templateParam = new HashMap<>();
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.THREE_ACCEPTANCE_WAIT, null);
}
}
}
}
hasNext = ShopStageInfoList.size() >= pageSize;
pageNum++;
} }
XxlJobHelper.handleSuccess();
}
/**
* @Auther: wangshuo
* @Date: 2024/5/7
* @description:实际进场时间+7天发送钉钉通知到督导
*/
@XxlJob("waitThreeAcceptanceMessage")
public void waitThreeAcceptanceMessage() {
log.info("------定时任务三方待验收通知-----");
boolean hasNext = true;
int pageNum = 1;
int pageSize = 50;
while (hasNext) {
PageHelper.startPage(pageNum, pageSize);
//获取待验收的
List<ShopStageInfoDO> ShopStageInfoList = shopStageInfoDAO.
getShopIdListByStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121.getShopSubStageStatus());
if (CollectionUtils.isEmpty(ShopStageInfoList)) {
log.info("------定时任务结束三方验收预约短信通知------");
return;
}
List<Long> shopIds = ShopStageInfoList.stream().filter(o -> o.getShopId() != null)
.map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
Map<Long, ShopStageInfoDO> lineIdMap = ShopStageInfoList.stream().filter(o -> o.getLineId() != null)
.collect(Collectors.toMap(ShopStageInfoDO::getLineId, Function.identity()));
List<AcceptanceInfoDO> acceptanceList = acceptanceInfoDAO.selectByShopIds(shopIds);
for (AcceptanceInfoDO acceptance : acceptanceList) {
Date approach = acceptance.getActualEntryTime();
if (Objects.nonNull(approach)) {
Instant instant = approach.toInstant();
ZoneId zone = ZoneId.systemDefault();
LocalDate localDate = instant.atZone(zone).toLocalDate();
LocalDate datePlusFiveDays = localDate.plusDays(CommonConstants.SIX); // 7天
if (datePlusFiveDays.equals(localDate)) {
ShopStageInfoDO stageInfoDO = lineIdMap.get(acceptance.getShopId());
if (Objects.nonNull(stageInfoDO)) {
Long lineId = stageInfoDO.getLineId();
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.THREE_ACCEPTANCE_WAIT, null);
}
}
}
}
hasNext = ShopStageInfoList.size() >= pageSize;
pageNum++;
}
XxlJobHelper.handleSuccess();
} }
@XxlJob("interviewRemind") @XxlJob("interviewRemind")