开业筹备阶段2.0

This commit is contained in:
shuo.wang
2024-04-25 21:03:18 +08:00
parent ca8856539b
commit 51849f02d2
6 changed files with 40 additions and 35 deletions

View File

@@ -85,12 +85,12 @@ public class MiniOpenPreparationController {
equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151.getShopSubStageStatus())) {
ShopInfoDO shopInfo = shopService.getShopInfo(shopId);
String shopCode = shopInfo.getShopCode();
String data = coolStoreStartFlowService.getFirstOrder(shopCode).getData().toString();
log.info("saveOrder,data:{}", data);
if (data == null) {
Boolean flag = coolStoreStartFlowService.getFirstOrder(shopCode);
log.info("saveOrder,flag:{}", flag);
if (flag == null) {
throw new ServiceException(ErrorCodeEnum.GET_FIRST_ORDER);
}
if (data.equals("true")) {
if (flag) {
//更改子阶段状态
shopStageInfoDAO.updateShopStageAndAuditInfo(shopId,
ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151, null);

View File

@@ -13,6 +13,7 @@ import com.cool.store.mapper.TrainingExperienceMapper;
import com.cool.store.mq.util.HttpRestTemplateService;
import com.cool.store.service.PreparationService;
import com.cool.store.utils.poi.constant.Constants;
import com.github.pagehelper.Page;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
@@ -24,6 +25,7 @@ import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@Slf4j
@@ -94,19 +96,22 @@ public class XxlJobHandler {
*/
@XxlJob("updateFirstOrder")
public void updateFirstOrder() {
log.info("----查询更新订货金----");
List<Long> shopIdListByStage = shopInfoDAO.queryShopIdListByStage();
if (CollectionUtils.isEmpty(shopIdListByStage)) {
log.info("------今日没有待更新数据------");
return;
}
List<Long> shopIdListByStageStatus = shopStageInfoDAO.getShopIdListByStageStatus(shopIdListByStage);
List<OpenPlanShopInfoDTO> openPlanShopInfoDTOS = shopInfoDAO.queryShopCodeListByid(shopIdListByStageStatus);
Map<Long, String> map = openPlanShopInfoDTOS.stream().
collect(Collectors.toMap(OpenPlanShopInfoDTO::getShopId, OpenPlanShopInfoDTO::getShopCode));
for (Long shopId : map.keySet()){
String shopCode = map.get(shopId);
try {
boolean hasNext =true;
int PageNum = 1;
int PageSize = 50;
while(hasNext){
log.info("----查询更新订货金----");
Page<Long> shopIdListByStageStatus = shopStageInfoDAO.getShopIdListByStageStatus(PageNum,PageSize);
if (CollectionUtils.isEmpty(shopIdListByStageStatus)) {
log.info("------今日没有待更新数据------");
return;
}
List<OpenPlanShopInfoDTO> openPlanShopInfoDTOS = shopInfoDAO.queryShopCodeListByid(shopIdListByStageStatus);
Map<Long, String> map = openPlanShopInfoDTOS.stream().
collect(Collectors.toMap(OpenPlanShopInfoDTO::getShopId, OpenPlanShopInfoDTO::getShopCode));
for (Long shopId : map.keySet()){
String shopCode = map.get(shopId);
try {
String url = xfsgUrl + Constants.FIRST_ORDER + "?storeCode=" + shopCode;
JSONObject jsonObject = httpRestTemplateService.getForObject(url, JSONObject.class, new HashMap<>());
log.info("updateFirstOrder url:{},jsonObject:{}",url,jsonObject);
@@ -117,11 +122,16 @@ public class XxlJobHandler {
if (string.equals("true")) {
shopStageInfoDAO.updateShopStageAndAuditInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151, null);
preparationService.whetherToOpenForAcceptance(shopId);
}
}catch (Exception e) {
log.error("获取鲜丰订货金异常",e);
}
}catch (Exception e) {
log.error("获取鲜丰订货金异常",e);
}
hasNext = shopIdListByStageStatus.size() >= PageSize;
PageNum++;
}
}
}