feat:阶段子状态完成-校验门店状态

This commit is contained in:
suzhuhong
2026-05-25 18:41:22 +08:00
parent 555f4cd089
commit ce882e5d87

View File

@@ -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<ShopStageInfoDO> 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<ShopStageInfoDO> shopStageList = Lists.newArrayList();
extracted(subStageStatusList, shopId, shopStageList);
return shopStageInfoMapper.batchUpdateShopStageStatus(shopId, shopStageList);
Integer i = shopStageInfoMapper.batchUpdateShopStageStatus(shopId, shopStageList);
//没有完成的数据 如果是空 表示都是完成的 如果有未完成的阶段 不需要调用
List<ShopStageInfoDO> list = shopStageList.stream().filter(x -> !x.getIsTerminated()).collect(Collectors.toList());
if (CollectionUtils.isEmpty(list)){
updateShopStatus(shopId);
}
return i;
}