完成部分定时任务

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_22("您收到一位员工由您带教,请查收", "##### 员工姓名:【${userName}】,员工手机号码:【${mobile}】,登记时间:【${registerTime}】"),
MESSAGE_23("您有一个门店待发布加盟费/保证金账单,请查收", "##### 门店名称:${storeName}\n##### 加盟商姓名:${partnerName}\n##### 加盟商手机号码:${partnerMobile}\n"),
MESSAGE_24("您有一个门店待预约三方验收时间,请查收", "#####门店名称:${storeName}\n##### 加盟商姓名:${partnerUsername}\n##### 加盟商手机号码:${partnerMobile}\n"),
;
private String title;
@@ -59,7 +59,7 @@ public enum MessageEnum {
return content;
}
public String getContent(Map<String, String> paramMap){
public String getContent(Map<String, String> paramMap) {
String result = this.content;
for (String key : paramMap.keySet()) {
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){
if(StringUtils.isAnyBlank(domainUrl, appId, corpId) || Objects.isNull(paramMap)){
public String getMessageUrl(String domainUrl, String appId, String corpId, Map<String, String> paramMap) {
if (StringUtils.isAnyBlank(domainUrl, appId, corpId) || Objects.isNull(paramMap)) {
return "";
}
try {
@@ -86,22 +86,22 @@ public enum MessageEnum {
case MESSAGE_7:
case MESSAGE_8:
case MESSAGE_9:
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());
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());
case MESSAGE_3:
case MESSAGE_10:
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());
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());
case MESSAGE_11:
case MESSAGE_12:
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());
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());
case MESSAGE_13:
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());
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());
case MESSAGE_14:
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());
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());
case MESSAGE_15:
case MESSAGE_16:
case MESSAGE_18:
@@ -117,6 +117,10 @@ public enum MessageEnum {
case MESSAGE_22:
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());
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:
return "";
}

View File

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

View File

@@ -8,6 +8,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@@ -50,4 +51,7 @@ public class AcceptanceInfoDAO {
}
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;
return shopStageInfoMapper.getRentContractToDoPage(userId, shopSubStageStatus.getShopSubStageEnum().getShopSubStage(), shopSubStageStatus.getShopSubStageStatus());
}
public Page<Long> getShopIdListByStageStatus( Integer pageNum, Integer pageSize){
PageHelper.startPage(pageNum, pageSize);
return shopStageInfoMapper.getShopIdListByStageStatus();
public List<ShopStageInfoDO> getShopIdListByStageStatus(Integer shopSubStageStatus){
if (shopSubStageStatus == null ||shopSubStageStatus ==CommonConstants.ZERO){
return null;
}
return shopStageInfoMapper.getShopIdListByStageStatus(shopSubStageStatus);
}
public List<ScheduleDTO> getScheduleList(List<Long> shopIdList){

View File

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

View File

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

View File

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

View File

@@ -161,11 +161,7 @@
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}
</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
@@ -266,4 +262,9 @@
and shop_sub_stage =#{shopSubStage}
</if>
</select>
<select id="getShopIdListByStageStatus" resultType="com.cool.store.entity.ShopStageInfoDO">
select *
from xfsg_shop_stage_info
where shop_sub_stage_status = #{shopSubStageStatus}
</select>
</mapper>

View File

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

View File

@@ -222,21 +222,30 @@ public class PreparationServiceImpl implements PreparationService {
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, ShopStageEnum.SHOP_STAGE_2.getShopStage());
Map<Integer, ShopStageInfoDO> collect = shopStageInfo.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopSubStage, Function.identity()));
//设计
if (!ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_91.getShopSubStageStatus().
equals(collect.get(ShopSubStageEnum.SHOP_STAGE_9.getShopSubStage()).getShopSubStageStatus())) {
Boolean flushFlag = Boolean.FALSE;
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);
flushFlag = Boolean.TRUE;
}
//装修款
if (!ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_102.getShopSubStageStatus().
equals(collect.get(ShopSubStageEnum.SHOP_STAGE_10.getShopSubStage()).getShopSubStageStatus())) {
Integer Status1000 = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_100.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);
flushFlag = Boolean.TRUE;
}
//施工阶段
if (!ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112.getShopSubStageStatus().
equals(collect.get(ShopSubStageEnum.SHOP_STAGE_11.getShopSubStage()).getShopSubStageStatus())) {
Integer Status1100 = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_110.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);
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.request.xfsgFirstOrderListRequest;
import com.cool.store.response.xfsgFirstOderListResponse;
import com.cool.store.service.CoolStoreStartFlowService;
import com.cool.store.service.DecorationService;
import com.cool.store.service.PreparationService;
import com.cool.store.service.XfsgEhrService;
import com.cool.store.service.*;
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.StringUtils;
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.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.ParseException;
@@ -42,6 +41,7 @@ import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j
@@ -83,6 +83,8 @@ public class XxlJobHandler {
private TempUserDetailDAO tempUserDetailDAO;
@Resource
private EnterpriseUserDAO enterpriseUserDAO;
@Resource
private UserAuthMappingService userAuthMappingService;
/**
* 每天都将待体验门店信息变更到体验中
@@ -128,38 +130,43 @@ public class XxlJobHandler {
*/
@XxlJob("updateFirstOrder")
public void updateFirstOrder() {
log.info("----定时任务查询更新订货金----");
boolean hasNext = true;
int PageNum = 1;
int PageSize = 50;
int pageNum = 1;
int pageSize = 50;
while (hasNext) {
log.info("----查询更新订货金----");
//sql 判定传入
Page<Long> shopIdListByStageStatus = shopStageInfoDAO.getShopIdListByStageStatus(PageNum, PageSize);
PageHelper.startPage(pageNum, pageSize);
List<ShopStageInfoDO> shopIdListByStageStatus = shopStageInfoDAO.getShopIdListByStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_152.getShopSubStageStatus());
if (CollectionUtils.isEmpty(shopIdListByStageStatus)) {
log.info("------今日没有待更新数据------");
log.info("------定时任务结束调用鲜丰更新订货金结束------");
return;
}
List<OpenPlanShopInfoDTO> openPlanShopInfoDTOS = shopInfoDAO.queryStoreNumeListByid(shopIdListByStageStatus);
Map<String, Long> map = openPlanShopInfoDTOS.stream().filter(OpenPlanShopInfoDTO -> OpenPlanShopInfoDTO.getStoreNum() != null).
collect(Collectors.toMap(OpenPlanShopInfoDTO::getStoreNum, OpenPlanShopInfoDTO::getShopId));
List<String> storeCodes = new ArrayList<>(map.keySet());
xfsgFirstOrderListRequest request = new xfsgFirstOrderListRequest();
request.setStoreCodeList(storeCodes);
xfsgFirstOderListResponse firstOrderList = coolStoreStartFlowService.getFirstOrderList(request);
if (Objects.nonNull(firstOrderList) && CollectionUtils.isNotEmpty(firstOrderList.getData())) {
for (xfsgFirstOderDTO o : firstOrderList.getData()) {
if (o.getBalance()) {
shopStageInfoDAO.updateShopStageAndAuditInfo(map.get(o.getStoreCode()), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151, null);
preparationService.whetherToOpenForAcceptance(map.get(o.getStoreCode()));
List<Long> shopIds = shopIdListByStageStatus.stream().filter(o -> o.getShopId() != null).map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
try {
List<OpenPlanShopInfoDTO> openPlanShopInfoDTOS = shopInfoDAO.queryStoreNumeListByid(shopIds);
Map<String, Long> map = openPlanShopInfoDTOS.stream().filter(OpenPlanShopInfoDTO -> StringUtils.isNoneBlank(OpenPlanShopInfoDTO.getStoreNum())).
collect(Collectors.toMap(OpenPlanShopInfoDTO::getStoreNum, OpenPlanShopInfoDTO::getShopId));
List<String> storeCodes = new ArrayList<>(map.keySet());
xfsgFirstOrderListRequest request = new xfsgFirstOrderListRequest();
request.setStoreCodeList(storeCodes);
xfsgFirstOderListResponse firstOrderList = coolStoreStartFlowService.getFirstOrderList(request);
if (Objects.nonNull(firstOrderList) && CollectionUtils.isNotEmpty(firstOrderList.getData())) {
for (xfsgFirstOderDTO o : firstOrderList.getData()) {
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;
PageNum++;
hasNext = shopIdListByStageStatus.size() >= pageSize;
pageNum++;
}
log.info("------定时任务结束调用鲜丰更新订货金结束------");
XxlJobHelper.handleSuccess();
}
/**
@@ -168,67 +175,107 @@ public class XxlJobHandler {
* @description: 每天更新装修阶段进场时间等,至预约状态
*/
@XxlJob("fitmentAcceptanceHandler")
@Transactional(rollbackFor = Exception.class)
public void fitmentAcceptanceHandler() {
log.info("----定时任务每天更新装修阶段进场时间,施工完成时间等,至预约状态----");
boolean hasNext = true;
int PageNum = 1;
int PageSize = 50;
int pageNum = 1;
int pageSize = 50;
while (hasNext) {
log.info("----每天更新装修阶段进场时间,施工完成时间等,至预约状态----");
PageHelper.startPage(PageNum, PageSize);
//获取施工阶段未完成shopID
List<Long> shops = shopStageInfoDAO.getShopContractIncompletion();
if (CollectionUtils.isEmpty(shops)) {
log.info("------今日没有待更新数据------");
PageHelper.startPage(pageNum, pageSize);
//获取表中进场时间为空的店铺
List<AcceptanceInfoDO> acceptanceList = acceptanceInfoDAO.selectByEntryTimeNull();
if (CollectionUtils.isEmpty(acceptanceList)) {
log.info("------定时任务结束调用鲜丰获取进场时间结束------");
return;
}
List<AcceptanceInfoDO> acceptanceInfoDOS = new ArrayList<>();
acceptanceInfoDOS.addAll(acceptanceInfoDAO.selectByShopIds(shops));
for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) {
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");
int flag = CommonConstants.ZERO;
for (AcceptanceInfoDO acceptanceInfoDO : acceptanceList) {
while (flag < CommonConstants.TWO) {
try {
Date constructionEndTime = sdf.parse(constructionInfo.getActualEndDate());
acceptanceInfoDO.setConstructionCompletionTime(constructionEndTime);
Date PlanBegin = sdf.parse(constructionInfo.getPlanBeginDate());
Date PlanEnd = sdf.parse(constructionInfo.getPlanEndDate());
acceptanceInfoDO.setDecorationPlannedStartTime(PlanBegin);
acceptanceInfoDO.setDecorationPlannedCompletionTime(PlanEnd);
acceptanceInfoDAO.updateAcceptanceInfo(acceptanceInfoDO);
} catch (ParseException e) {
log.error("初始化acceptanceInfo鲜丰服务施工完成时间日期转化异常");
Long shopId = acceptanceInfoDO.getShopId();
//施工子阶段
List<ConstructionScheduleDTO> construction = decorationService.getConstruction(shopId);
Map<String, ConstructionScheduleDTO> constructionMap = construction.stream().
collect(Collectors.toMap(ConstructionScheduleDTO::getName, dto -> dto));
//进场时间
ConstructionScheduleDTO approach = constructionMap.get(CommonConstants.APPROACH);
if (Objects.nonNull(approach)) {
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())
&& Objects.isNull(acceptanceInfoDO.getActualEntryTime())) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
Date constructionBeginTime = sdf.parse(construction.get(CommonConstants.ZERO).getActualBeginDate());
acceptanceInfoDO.setActualEntryTime(constructionBeginTime);
acceptanceInfoDAO.updateAcceptanceInfo(acceptanceInfoDO);
//+5tian
Instant instant = acceptanceInfoDO.getActualEntryTime().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);
}
} catch (ParseException e) {
log.error("初始化acceptanceInfo鲜丰服务进场时间日期转化异常");
Date approach = acceptanceInfoDO.getActualEntryTime();
if (Objects.nonNull(approach)) {
Instant instant = approach.toInstant();
ZoneId zone = ZoneId.systemDefault();
LocalDate localDate = instant.atZone(zone).toLocalDate();
LocalDate datePlusFiveDays = localDate.plusDays(CommonConstants.FOUR); // 5天
if (datePlusFiveDays.equals(localDate)) {
//三方验收带预约
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(acceptanceInfoDO.getShopId());
EnterpriseUserDO userByRoleEnumAndRegionId = userAuthMappingService
.getUserByRoleEnumAndRegionId(UserRoleEnum.ENGINEER_DEP_SUPERVISOR, shopInfo.getRegionId());
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
Map<String, String> messageMap = new HashMap<>();
messageMap.put("storeName", shopInfo.getShopName());
messageMap.put("partnerUsername", lineInfo.getUsername());
messageMap.put("partnerMobile", lineInfo.getMobile());
commonService.sendMessage(Arrays.asList(userByRoleEnumAndRegionId.getUserId()), MessageEnum.MESSAGE_24, messageMap);
}
}
}
hasNext = acceptanceInfoDOS.size() >= PageSize;
PageNum++;
hasNext = shopIdListByStageStatus.size() >= pageSize;
pageNum++;
}
}
@@ -236,20 +283,100 @@ public class XxlJobHandler {
/**
* @Auther: wangshuo
* @Date: 2024/5/7
* @description:三方验收预约短信通知
* @description:三方验收预约短信通知+7day
*/
@XxlJob("ThreeAcceptanceMessage")
public void ThreeAcceptanceMessage() {
log.info("------三方验收预约短信通知-----");
@XxlJob("threeAcceptanceMessage")
public void threeAcceptanceMessage() {
log.info("------定时任务三方验收预约短信通知-----");
boolean hasNext = true;
int PageNum = 1;
int PageSize = 50;
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);
// hasNext = ;
PageNum++;
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);
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")