修改定时任务
This commit is contained in:
@@ -30,8 +30,8 @@ public class AcceptanceInfoDAO {
|
||||
acceptanceInfoMapper.insertSelective(acceptanceInfoDO);
|
||||
return acceptanceInfoDO.getId();
|
||||
}
|
||||
public List<AcceptanceInfoDO> selectAcceptanceInfoBySignatures(Integer status){
|
||||
return acceptanceInfoMapper.selectShopIdListBySignatures(status);
|
||||
public List<AcceptanceInfoDO> selectAcceptanceInfoBySignatures(Integer subStage, Integer status){
|
||||
return acceptanceInfoMapper.selectShopIdListBySignatures(subStage,status);
|
||||
}
|
||||
public Integer updateAcceptanceInfo(AcceptanceInfoDO acceptanceInfoDO){
|
||||
if (Objects.isNull(acceptanceInfoDO)){
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
|
||||
import com.cool.store.dto.openPreparation.OpeningOperationPlanDTO;
|
||||
import com.cool.store.entity.OpeningOperationPlanDO;
|
||||
import com.cool.store.mapper.OpeningOperationPlanMapper;
|
||||
import com.cool.store.request.PlanListRequest;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,9 +10,9 @@ public interface AcceptanceInfoMapper extends Mapper<AcceptanceInfoDO> {
|
||||
/**
|
||||
* @Auther: wangshuo
|
||||
* @Date: 2024/4/29
|
||||
* @description:三方验收g根据阶段状态
|
||||
* @description:三方验收g根据阶段状态 并且验收时间不为空
|
||||
*/
|
||||
List<AcceptanceInfoDO> selectShopIdListBySignatures(Integer status);
|
||||
List<AcceptanceInfoDO> selectShopIdListBySignatures(@Param("subStage") Integer subStage,@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* @Auther: wangshuo
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
|
||||
import com.cool.store.dto.openPreparation.OpeningOperationPlanDTO;
|
||||
import com.cool.store.entity.OpeningOperationPlanDO;
|
||||
import com.cool.store.request.PlanListRequest;
|
||||
import com.github.pagehelper.Page;
|
||||
|
||||
@@ -86,10 +86,11 @@
|
||||
</update>
|
||||
<select id="selectShopIdListBySignatures" resultType="com.cool.store.entity.AcceptanceInfoDO">
|
||||
select
|
||||
<include refid="baseColumn"/>
|
||||
a.shop_id as shopId ,a.actual_entry_time as actualEntry_time
|
||||
from xfsg_acceptance_info a
|
||||
left join join xfsg_shop_stage_info b on a.shop_id = b.shop_id
|
||||
where b.shop_sub_stage_status = #{status} and a.deleted = 0
|
||||
left join xfsg_shop_stage_info b on a.shop_id = b.shop_id
|
||||
where b.shop_sub_stage=#{subStage} and b.shop_sub_stage_status = #{status}
|
||||
and a.deleted = 0 and a.actual_entry_time is not null
|
||||
</select>
|
||||
<select id="selectByShopId" resultType="com.cool.store.entity.AcceptanceInfoDO">
|
||||
select
|
||||
|
||||
@@ -20,7 +20,7 @@ public class OpeningOperationPlanDTO {
|
||||
private String shopName;
|
||||
|
||||
@ApiModelProperty("门店代码")
|
||||
private String shopCode;
|
||||
private String shopNum;
|
||||
|
||||
@ApiModelProperty("开店负责人")
|
||||
private String shopManagerUserId;
|
||||
|
||||
@@ -37,7 +37,7 @@ public interface CoolStoreStartFlowService {
|
||||
* @Date: 2024/4/25
|
||||
* @description:获取订货金
|
||||
*/
|
||||
Boolean getFirstOrder(String shopCode);
|
||||
Boolean getFirstOrder(String shopNum);
|
||||
/**
|
||||
* @Auther: wangshuo
|
||||
* @Date: 2024/5/8
|
||||
|
||||
@@ -85,9 +85,9 @@ public class CoolStoreStartFlowServiceImpl implements CoolStoreStartFlowService
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean getFirstOrder(String shopCode) {
|
||||
log.info("getFirstOrder shopCode:{}", shopCode);
|
||||
if (Objects.isNull(shopCode)) {
|
||||
public Boolean getFirstOrder(String shopNum) {
|
||||
log.info("getFirstOrder shopNum:{}", shopNum);
|
||||
if (Objects.isNull(shopNum)) {
|
||||
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||
}
|
||||
Map<String, Object> requestMap = new HashMap<>();
|
||||
@@ -95,7 +95,7 @@ public class CoolStoreStartFlowServiceImpl implements CoolStoreStartFlowService
|
||||
try {
|
||||
String url = xfsgUrl + Constants.FIRST_ORDER +
|
||||
"?timestamp=" + requestMap.get("timestamp") + "&signature=" + requestMap.get("signature") +
|
||||
"&storeCode=" + shopCode;
|
||||
"&storeCode=" + shopNum;
|
||||
JSONObject jsonObject = httpRestTemplateService.getForObject(url, JSONObject.class, new HashMap<>());
|
||||
log.info("get url:{},jsonObject:{}", url, jsonObject);
|
||||
Boolean flag = (Boolean) jsonObject.get("data");
|
||||
|
||||
@@ -682,7 +682,7 @@ public class DecorationServiceImpl implements DecorationService {
|
||||
AcceptanceInfoDO acceptanceInfoDO = acceptanceInfoDAO.selectByShopId(request.getShopId());
|
||||
acceptanceInfoDO.setBookingUser(user.getUserId());
|
||||
acceptanceInfoDO.setUpdateTime(new Date());
|
||||
acceptanceInfoDO.setPlanAcceptanceTime(new Date());
|
||||
acceptanceInfoDO.setPlanAcceptanceTime(request.getBookingAcceptanceTime());
|
||||
acceptanceInfoDAO.updateAcceptanceInfo(acceptanceInfoDO);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.cool.store.context.LoginUserInfo;
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.dto.Preparation.PreparationDTO;
|
||||
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
|
||||
import com.cool.store.dto.openPreparation.OpeningOperationPlanDTO;
|
||||
import com.cool.store.dto.openPreparation.PlanLineDTO;
|
||||
import com.cool.store.dto.openPreparation.UserNameDTO;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
@@ -200,8 +199,8 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
|
||||
if (ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_152.getShopSubStageStatus().
|
||||
equals(orderStageInfo.getShopSubStageStatus())) {
|
||||
ShopInfoDO shopInfo = shopService.getShopInfo(shopId);
|
||||
String shopCode = shopInfo.getShopCode();
|
||||
Boolean firstOrder = coolStoreStartFlowService.getFirstOrder(shopCode);
|
||||
String shopNum = shopInfo.getStoreNum();
|
||||
Boolean firstOrder = coolStoreStartFlowService.getFirstOrder(shopNum);
|
||||
log.info("saveOrder,flag:{}", firstOrder);
|
||||
if (firstOrder) {
|
||||
//更改子阶段状态
|
||||
@@ -222,8 +221,8 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
|
||||
public Boolean getStatus(Long shopId) {
|
||||
try{
|
||||
ShopInfoDO shopInfo = shopService.getShopInfo(shopId);
|
||||
String shopCode = shopInfo.getShopCode();
|
||||
Boolean firstOrder = coolStoreStartFlowService.getFirstOrder(shopCode);
|
||||
String shopNum = shopInfo.getStoreNum();
|
||||
Boolean firstOrder = coolStoreStartFlowService.getFirstOrder(shopNum);
|
||||
return firstOrder;
|
||||
}catch (Exception e){
|
||||
log.error("获取鲜丰订货金异常或更新状态失败");
|
||||
|
||||
@@ -88,7 +88,7 @@ public class YlfServiceImpl implements YlfService {
|
||||
return rows.get(0);
|
||||
}
|
||||
} else {
|
||||
log.info("获取云立方装修公司信息失败,shopCode:{}", storeNum);
|
||||
log.info("获取云立方装修公司信息失败,shopNum:{}", storeNum);
|
||||
throw new ServiceException(ErrorCodeEnum.YLF_ERROR);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -138,7 +138,6 @@ public class XxlJobHandler {
|
||||
int pageNum = 1;
|
||||
int pageSize = 50;
|
||||
while (hasNext) {
|
||||
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<ShopStageInfoDO> shopIdListByStageStatus = shopStageInfoDAO.getShopIdListByStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_152.getShopSubStageStatus());
|
||||
if (CollectionUtils.isEmpty(shopIdListByStageStatus)) {
|
||||
@@ -157,7 +156,7 @@ public class XxlJobHandler {
|
||||
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);
|
||||
shopStageInfoDAO.updateShopStageInfo(map.get(o.getStoreCode()), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151);
|
||||
preparationService.whetherToOpenForAcceptance(map.get(o.getStoreCode()));
|
||||
}
|
||||
}
|
||||
@@ -175,53 +174,73 @@ public class XxlJobHandler {
|
||||
/**
|
||||
* @Auther: wangshuo
|
||||
* @Date: 2024/4/29
|
||||
* @description: 每天更新装修阶段进场时间等,至预约状态
|
||||
* @description: 每天更新装修阶段进场时间等
|
||||
*/
|
||||
@XxlJob("fitmentAcceptanceHandler")
|
||||
public void fitmentAcceptanceHandler() {
|
||||
log.info("----定时任务每天更新装修阶段进场时间,施工完成时间等,至预约状态----");
|
||||
@XxlJob("updateEntryTime")
|
||||
public void updateEntryTime() {
|
||||
log.info("----定时任务每天更新装修阶段进场时间,施工完成时间等----");
|
||||
boolean hasNext = true;
|
||||
int pageNum = 1;
|
||||
int pageSize = 50;
|
||||
while (hasNext) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
//获取表中处于施工中或施工完成阶段并且三方验收未预约的
|
||||
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStageListBySubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_111,
|
||||
ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120);
|
||||
if (CollectionUtils.isEmpty(subStageList)) {
|
||||
log.info("------定时任务结束调用鲜丰获取进场时间结束------");
|
||||
//获取表中进场时间为空的
|
||||
List<AcceptanceInfoDO> acceptanceInfoDOS = acceptanceInfoDAO.selectByEntryTimeNull();
|
||||
if (CollectionUtils.isEmpty(acceptanceInfoDOS)) {
|
||||
log.info("------定时任务结束每天更新至预约状态结束------");
|
||||
return;
|
||||
}
|
||||
for (ShopStageInfoDO shopStageInfoDO : subStageList) {
|
||||
for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) {
|
||||
int flag = CommonConstants.ZERO;
|
||||
while (flag < CommonConstants.TWO) {
|
||||
try {
|
||||
Long shopId = shopStageInfoDO.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)) {
|
||||
LocalDate plusFDays = DateUtils.getPlusFDays(date, CommonConstants.FOUR);
|
||||
//小于等于当前时间
|
||||
if (plusFDays.isEqual(LocalDate.now()) || plusFDays.isBefore(LocalDate.now())) {
|
||||
//三方验收待预约
|
||||
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120);
|
||||
}
|
||||
}
|
||||
}
|
||||
Long shopId = acceptanceInfoDO.getShopId();
|
||||
//施工子阶段 更新装修阶段进场时间等
|
||||
decorationService.getConstruction(shopId);
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
log.error("定时任务设置进场时间失败,shopId:{}", shopStageInfoDO.getShopId());
|
||||
log.error("定时任务设置进场时间失败,shopId:{}", acceptanceInfoDO.getShopId());
|
||||
flag++;
|
||||
}
|
||||
}
|
||||
}
|
||||
hasNext = subStageList.size() >= pageSize;
|
||||
hasNext = acceptanceInfoDOS.size() >= pageSize;
|
||||
pageNum++;
|
||||
}
|
||||
log.info("------定时任务结束每天更新至预约状态结束------");
|
||||
XxlJobHelper.handleSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Auther: wangshuo
|
||||
* @Date: 2024/4/29
|
||||
* @description: 每天更新装修阶段进场时间等,至预约状态
|
||||
*/
|
||||
@XxlJob("fitmentAcceptanceHandler")
|
||||
public void fitmentAcceptanceHandler() {
|
||||
log.info("----定时任务每天更新至预约状态----");
|
||||
boolean hasNext = true;
|
||||
int pageNum = 1;
|
||||
int pageSize = 50;
|
||||
while (hasNext) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
//获取表中的三方验收状态为-100状态和进场时间不为空的
|
||||
List<AcceptanceInfoDO> acceptanceInfoDOS = acceptanceInfoDAO.selectAcceptanceInfoBySignatures(ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_00.getShopSubStageStatus());
|
||||
if (CollectionUtils.isEmpty(acceptanceInfoDOS)) {
|
||||
log.info("------定时任务结束每天更新至预约状态结束------");
|
||||
return;
|
||||
}
|
||||
for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) {
|
||||
Long shopId = acceptanceInfoDO.getShopId();
|
||||
Date actualEntryTime = acceptanceInfoDO.getActualEntryTime();
|
||||
LocalDate plusFDays = DateUtils.getPlusFDays(actualEntryTime, CommonConstants.FOUR);
|
||||
//小于等于当前时间
|
||||
if (plusFDays.isEqual(LocalDate.now()) || plusFDays.isBefore(LocalDate.now())) {
|
||||
//三方验收待预约
|
||||
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120);
|
||||
}
|
||||
}
|
||||
hasNext = acceptanceInfoDOS.size() >= pageSize;
|
||||
pageNum++;
|
||||
}
|
||||
log.info("------定时任务结束调用鲜丰获取进场时间结束------");
|
||||
@@ -312,11 +331,10 @@ public class XxlJobHandler {
|
||||
}
|
||||
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);
|
||||
int flag = CommonConstants.ZERO;
|
||||
|
||||
for (AcceptanceInfoDO acceptanceInfoDO : acceptanceList) {
|
||||
int flag = CommonConstants.ZERO;
|
||||
while (flag < CommonConstants.TWO) {
|
||||
try {
|
||||
Date approach = acceptanceInfoDO.getActualEntryTime();
|
||||
@@ -366,7 +384,7 @@ public class XxlJobHandler {
|
||||
|
||||
|
||||
}
|
||||
flag = CommonConstants.ZERO;
|
||||
|
||||
}
|
||||
hasNext = ShopStageInfoList.size() >= pageSize;
|
||||
pageNum++;
|
||||
@@ -408,7 +426,7 @@ public class XxlJobHandler {
|
||||
LocalDate plusFDays = DateUtils.getPlusFDays(approach, CommonConstants.SIX);//7天
|
||||
if (plusFDays.equals(LocalDate.now())) {
|
||||
ShopInfoDO shopInfoDO = shopIdMap.get(shopId);
|
||||
if (StringUtils.isBlank(shopInfoDO.getSupervisorUserId())){
|
||||
if (StringUtils.isBlank(shopInfoDO.getSupervisorUserId())) {
|
||||
log.error("定时任务三方待验收钉钉通知,督导id为空,shopId:{}", shopId);
|
||||
}
|
||||
Long lineId = shopInfoDO.getLineId();
|
||||
|
||||
Reference in New Issue
Block a user