修改定时任务

This commit is contained in:
shuo.wang
2024-05-13 16:21:31 +08:00
parent 8c3312df65
commit 7b436de2bc
4 changed files with 51 additions and 26 deletions

View File

@@ -226,7 +226,17 @@ public class ShopStageInfoDAO {
public List<Long> getShopContractIncompletion(){ public List<Long> getShopContractIncompletion(){
return shopStageInfoMapper.getShopContractIncompletion(); return shopStageInfoMapper.getShopContractIncompletion();
} }
/**
* @Auther: wangshuo
* @Date: 2024/5/13
* @description:批量更新店铺某一阶段的状态
*/
public Integer batchUpdateShopStageStatus(List<Long> shopIdList,Integer shopSubStageEnum, Integer shopSubStageStatusEnum) {
if (CollectionUtils.isEmpty(shopIdList)){
return CommonConstants.ZERO;
}
return shopStageInfoMapper.batchUpdateStatus(shopIdList,shopSubStageEnum,shopSubStageStatusEnum);
}
public List<ShopStageInfoDO> getSpecialShopStageInfo(List<Long> shopIds, Integer shopSubStage, public List<ShopStageInfoDO> getSpecialShopStageInfo(List<Long> shopIds, Integer shopSubStage,
List<Integer> shopSubStageStatusList,String investmentUserId,Integer queryUserType){ List<Integer> shopSubStageStatusList,String investmentUserId,Integer queryUserType){

View File

@@ -2,6 +2,7 @@ package com.cool.store.mapper;
import com.cool.store.dto.Preparation.ScheduleDTO; import com.cool.store.dto.Preparation.ScheduleDTO;
import com.cool.store.entity.ShopStageInfoDO; import com.cool.store.entity.ShopStageInfoDO;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum; import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.vo.shop.RentInfoToDoVO; import com.cool.store.vo.shop.RentInfoToDoVO;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
@@ -121,6 +122,7 @@ public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
*/ */
List<Long> getShopContractIncompletion(); List<Long> getShopContractIncompletion();
Integer batchUpdateStatus(@Param("shopIdList") List<Long> shopIdList,@Param("shopSubStageEnum") Integer shopSubStageEnum,@Param("shopSubStageStatusEnum") Integer shopSubStageStatusEnum) ;
List<ShopStageInfoDO> getSpecialShopStageInfo(@Param("shopIds") List<Long> shopIds, List<ShopStageInfoDO> getSpecialShopStageInfo(@Param("shopIds") List<Long> shopIds,
@Param("shopSubStage") Integer shopSubStage, @Param("shopSubStage") Integer shopSubStage,

View File

@@ -142,6 +142,21 @@
where shop_id = #{shopStageInfoDO.shopId} AND shop_sub_stage = #{shopStageInfoDO.shopSubStage} where shop_id = #{shopStageInfoDO.shopId} AND shop_sub_stage = #{shopStageInfoDO.shopSubStage}
</update> </update>
<update id="batchUpdateStatus">
update xfsg_shop_stage_info
<set>
<if test="shopSubStageEnum ! = null">
shop_sub_stage = #{shopSubStageEnum}
</if>
<if test="shopSubStageStatusEnum !=null">
shop_sub_stage_status = #{shopSubStageStatusEnum}
</if>
</set>
where shop_id in
<foreach collection="shopIdList" item="shopId" open="(" separator="," close=")">
#{shopId}
</foreach>
</update>
<select id="getRentContractToDoPage" resultType="com.cool.store.vo.shop.RentInfoToDoVO"> <select id="getRentContractToDoPage" resultType="com.cool.store.vo.shop.RentInfoToDoVO">
select select

View File

@@ -230,6 +230,7 @@ public class XxlJobHandler {
log.info("------定时任务结束每天更新至预约状态结束------"); log.info("------定时任务结束每天更新至预约状态结束------");
return; return;
} }
List<Long> shopIds = new ArrayList<>();
for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) { for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) {
Long shopId = acceptanceInfoDO.getShopId(); Long shopId = acceptanceInfoDO.getShopId();
Date actualEntryTime = acceptanceInfoDO.getActualEntryTime(); Date actualEntryTime = acceptanceInfoDO.getActualEntryTime();
@@ -237,9 +238,11 @@ public class XxlJobHandler {
//小于等于当前时间 //小于等于当前时间
if (plusFDays.isEqual(LocalDate.now()) || plusFDays.isBefore(LocalDate.now())) { if (plusFDays.isEqual(LocalDate.now()) || plusFDays.isBefore(LocalDate.now())) {
//三方验收待预约 //三方验收待预约
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120); shopIds.add(shopId);
} }
} }
shopStageInfoDAO.batchUpdateShopStageStatus(shopIds, ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120.getShopSubStageStatus());
hasNext = acceptanceInfoDOS.size() >= pageSize; hasNext = acceptanceInfoDOS.size() >= pageSize;
pageNum++; pageNum++;
} }
@@ -260,16 +263,14 @@ public class XxlJobHandler {
int pageSize = 50; int pageSize = 50;
while (hasNext) { while (hasNext) {
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
//获取为带预约状态的 //获取为带预约状态的和进场时间不为空的
List<ShopStageInfoDO> shopIdListByStageStatus = shopStageInfoDAO. List<AcceptanceInfoDO> acceptanceInfoDOS = acceptanceInfoDAO
getShopIdListByStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120.getShopSubStageStatus()); .selectAcceptanceInfoBySignatures(ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120.getShopSubStageStatus());
if (CollectionUtils.isEmpty(shopIdListByStageStatus)) {
if (CollectionUtils.isEmpty(acceptanceInfoDOS)) {
log.info("------定时任务结束三方验收待预约钉钉通知------"); log.info("------定时任务结束三方验收待预约钉钉通知------");
return; 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) { for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) {
int flag = CommonConstants.ZERO; int flag = CommonConstants.ZERO;
//进场时间 //进场时间
@@ -302,7 +303,7 @@ public class XxlJobHandler {
} }
} }
} }
hasNext = shopIdListByStageStatus.size() >= pageSize; hasNext = acceptanceInfoDOS.size() >= pageSize;
pageNum++; pageNum++;
} }
@@ -323,17 +324,14 @@ public class XxlJobHandler {
while (hasNext) { while (hasNext) {
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
//获取待验收的 //获取待验收的
List<ShopStageInfoDO> ShopStageInfoList = shopStageInfoDAO. List<AcceptanceInfoDO> acceptanceInfoDOS = acceptanceInfoDAO
getShopIdListByStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121.getShopSubStageStatus()); .selectAcceptanceInfoBySignatures(ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121.getShopSubStageStatus());
if (CollectionUtils.isEmpty(ShopStageInfoList)) { if (CollectionUtils.isEmpty(acceptanceInfoDOS)) {
log.info("------定时任务结束三方验收预约短信通知------"); log.info("------定时任务结束三方验收预约短信通知------");
return; return;
} }
List<Long> shopIds = ShopStageInfoList.stream().filter(o -> o.getShopId() != null)
.map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
List<AcceptanceInfoDO> acceptanceList = acceptanceInfoDAO.selectByShopIds(shopIds);
for (AcceptanceInfoDO acceptanceInfoDO : acceptanceList) { for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) {
int flag = CommonConstants.ZERO; int flag = CommonConstants.ZERO;
while (flag < CommonConstants.TWO) { while (flag < CommonConstants.TWO) {
try { try {
@@ -386,7 +384,7 @@ public class XxlJobHandler {
} }
} }
hasNext = ShopStageInfoList.size() >= pageSize; hasNext = acceptanceInfoDOS.size() >= pageSize;
pageNum++; pageNum++;
} }
XxlJobHelper.handleSuccess(); XxlJobHelper.handleSuccess();
@@ -406,19 +404,19 @@ public class XxlJobHandler {
while (hasNext) { while (hasNext) {
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
//获取待验收的 //获取待验收的
List<ShopStageInfoDO> ShopStageInfoList = shopStageInfoDAO. List<AcceptanceInfoDO> acceptanceInfoDOS = acceptanceInfoDAO
getShopIdListByStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121.getShopSubStageStatus()); .selectAcceptanceInfoBySignatures(ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121.getShopSubStageStatus());
if (CollectionUtils.isEmpty(ShopStageInfoList)) {
if (CollectionUtils.isEmpty(acceptanceInfoDOS)) {
log.info("------定时任务结束三方待验收钉钉通知------"); log.info("------定时任务结束三方待验收钉钉通知------");
return; return;
} }
List<Long> shopIds = ShopStageInfoList.stream().filter(o -> o.getShopId() != null) List<Long> shopIds = acceptanceInfoDOS.stream().filter(o -> o.getShopId() != null)
.map(ShopStageInfoDO::getShopId).collect(Collectors.toList()); .map(AcceptanceInfoDO::getShopId).collect(Collectors.toList());
List<AcceptanceInfoDO> acceptanceList = acceptanceInfoDAO.selectByShopIds(shopIds);
List<ShopInfoDO> shopListByIds = shopInfoDAO.getShopListByIds(shopIds); List<ShopInfoDO> shopListByIds = shopInfoDAO.getShopListByIds(shopIds);
Map<Long, ShopInfoDO> shopIdMap = shopListByIds.stream().filter(o -> o.getId() != null) Map<Long, ShopInfoDO> shopIdMap = shopListByIds.stream().filter(o -> o.getId() != null)
.collect(Collectors.toMap(ShopInfoDO::getId, Function.identity())); .collect(Collectors.toMap(ShopInfoDO::getId, Function.identity()));
for (AcceptanceInfoDO acceptance : acceptanceList) { for (AcceptanceInfoDO acceptance : acceptanceInfoDOS) {
//进场时间 //进场时间
Date approach = acceptance.getActualEntryTime(); Date approach = acceptance.getActualEntryTime();
Long shopId = acceptance.getShopId(); Long shopId = acceptance.getShopId();
@@ -440,7 +438,7 @@ public class XxlJobHandler {
} }
} }
} }
hasNext = ShopStageInfoList.size() >= pageSize; hasNext = acceptanceInfoDOS.size() >= pageSize;
pageNum++; pageNum++;
} }
XxlJobHelper.handleSuccess(); XxlJobHelper.handleSuccess();