From ce882e5d875f7713337407db71b9222547c3544b Mon Sep 17 00:00:00 2001 From: suzhuhong Date: Mon, 25 May 2026 18:41:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E9=98=B6=E6=AE=B5=E5=AD=90=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=AE=8C=E6=88=90-=E6=A0=A1=E9=AA=8C=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cool/store/dao/ShopStageInfoDAO.java | 45 +++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/coolstore-partner-dao/src/main/java/com/cool/store/dao/ShopStageInfoDAO.java b/coolstore-partner-dao/src/main/java/com/cool/store/dao/ShopStageInfoDAO.java index 5a3e07fa6..9c8787dcb 100644 --- a/coolstore-partner-dao/src/main/java/com/cool/store/dao/ShopStageInfoDAO.java +++ b/coolstore-partner-dao/src/main/java/com/cool/store/dao/ShopStageInfoDAO.java @@ -7,8 +7,10 @@ import com.cool.store.dto.Preparation.ScheduleDTO; import com.cool.store.entity.LineInfoDO; import com.cool.store.entity.ShopInfoDO; import com.cool.store.entity.ShopStageInfoDO; +import com.cool.store.entity.StoreDO; import com.cool.store.enums.FranchiseBrandEnum; import com.cool.store.enums.point.ShopStageEnum; +import com.cool.store.enums.point.ShopStatusEnum; import com.cool.store.enums.point.ShopSubStageEnum; import com.cool.store.enums.point.ShopSubStageStatusEnum; import com.cool.store.mapper.ShopStageInfoMapper; @@ -27,6 +29,7 @@ import org.springframework.stereotype.Repository; import javax.annotation.Resource; import java.time.LocalDate; import java.util.*; +import java.util.stream.Collectors; /** * @author zhangchenbiao @@ -39,6 +42,10 @@ public class ShopStageInfoDAO { @Resource private ShopStageInfoMapper shopStageInfoMapper; + @Resource + ShopInfoDAO shopInfoDAO; + @Resource + StoreDao storeDao; /** * 初始化店铺阶段信息 @@ -93,6 +100,30 @@ public class ShopStageInfoDAO { return shopStageInfoMapper.batchInsert(addShopStageList); } + public void updateShopStatus(Long shopId) { + ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId); + if (shopInfo.getShopStatus().equals(ShopStatusEnum.ING.getCode())) { + // 20260520门店状态判断排除食安阶段 + ScheduleDTO scheduleAll = getScheduleAllExcludeFoodLicense(shopId); + ShopInfoDO shopInfoDO = new ShopInfoDO(); + shopInfoDO.setShopStatus(shopInfo.getShopStatus()); + if (scheduleAll.getTotalColumn().equals(scheduleAll.getCompletionColumn())) { + shopInfoDO.setShopStatus(ShopStatusEnum.DONE.getCode()); + shopInfoDO.setUpdateTime(new Date()); + shopInfoDO.setId(shopId); + shopInfoDAO.updateShopInfo(shopInfoDO); + } + if (shopInfoDO.getShopStatus() == ShopStatusEnum.DONE.getCode()) { + // 更新门店开店流程完成时间 + StoreDO store = storeDao.getByStoreNum(shopInfo.getShopCode()); + if (Objects.nonNull(store)) { + storeDao.insertOrUpdateOpenReportTime(store.getStoreId(), new Date()); + } + } + + } + } + public Integer batchInsert(List addShopStageList) { if (CollectionUtils.isEmpty(addShopStageList)) { return 0; @@ -186,7 +217,10 @@ public class ShopStageInfoDAO { } String remark = shopStageInfo.getShopSubStageName() + CommonConstants.PATH_BAR + shopStageInfo.getShopSubStageStatusName(); boolean isTerminated = shopStageInfo.isTerminated(); - return shopStageInfoMapper.updateShopStageInfo(shopId, shopStageInfo.getShopSubStageEnum().getShopSubStage(), shopStageInfo.getShopSubStageStatus(), isTerminated, remark); + Integer ii = shopStageInfoMapper.updateShopStageInfo(shopId, shopStageInfo.getShopSubStageEnum().getShopSubStage(), shopStageInfo.getShopSubStageStatus(), isTerminated, remark); + //如果完成 + if (isTerminated){updateShopStatus(shopId);} + return ii; } //数据处理专用 @@ -212,8 +246,13 @@ public class ShopStageInfoDAO { } List shopStageList = Lists.newArrayList(); extracted(subStageStatusList, shopId, shopStageList); - - return shopStageInfoMapper.batchUpdateShopStageStatus(shopId, shopStageList); + Integer i = shopStageInfoMapper.batchUpdateShopStageStatus(shopId, shopStageList); + //没有完成的数据 如果是空 表示都是完成的 如果有未完成的阶段 不需要调用 + List list = shopStageList.stream().filter(x -> !x.getIsTerminated()).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(list)){ + updateShopStatus(shopId); + } + return i; }