开业筹备阶段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

@@ -146,7 +146,8 @@ public class ShopStageInfoDAO {
ShopSubStageStatusEnum shopSubStageStatus = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_21; ShopSubStageStatusEnum shopSubStageStatus = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_21;
return shopStageInfoMapper.getRentContractToDoPage(userId, shopSubStageStatus.getShopSubStageEnum().getShopSubStage(), shopSubStageStatus.getShopSubStageStatus()); return shopStageInfoMapper.getRentContractToDoPage(userId, shopSubStageStatus.getShopSubStageEnum().getShopSubStage(), shopSubStageStatus.getShopSubStageStatus());
} }
public List<Long> getShopIdListByStageStatus(List<Long> shopIdList){ public Page<Long> getShopIdListByStageStatus( Integer pageNum, Integer pageSize){
return shopStageInfoMapper.getShopIdListByStageStatus(shopIdList); PageHelper.startPage(pageNum, pageSize);
return shopStageInfoMapper.getShopIdListByStageStatus();
} }
} }

View File

@@ -91,5 +91,5 @@ public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
* @Date: 2024/4/25 * @Date: 2024/4/25
* @description:获取处于订货金阶段的shopid * @description:获取处于订货金阶段的shopid
*/ */
List<Long> getShopIdListByStageStatus(@Param("shopIdList")List<Long> shopIdList); Page<Long> getShopIdListByStageStatus();
} }

View File

@@ -137,12 +137,6 @@
select shop_id select shop_id
from xfsg_shop_stage_info from xfsg_shop_stage_info
where shop_stage = 2 and shop_sub_stage = 150 and shop_sub_stage_status= 1505 and is_terminated = 0 where shop_stage = 2 and shop_sub_stage = 150 and shop_sub_stage_status= 1505 and is_terminated = 0
<if test="shopIdList != null and shopIdList.size>0">
and shop_id in
<foreach collection="shopIdList" item="shopId" separator="," open="(" close=")">
#{shopId}
</foreach>
</if>
</select> </select>
</mapper> </mapper>

View File

@@ -75,18 +75,18 @@ public class FirstOrderServiceImp implements FirstOrderService {
order.setUpdateTime(new Date()); order.setUpdateTime(new Date());
order.setUpdateUserId(userId); order.setUpdateUserId(userId);
} }
Integer flag = firstOrderDAO.insertFirstOrder(order); Integer num = firstOrderDAO.insertFirstOrder(order);
//云立方同步 //云立方同步
if (flag > 0) { if (num > 0) {
try { try {
ShopInfoDO shopInfo = shopService.getShopInfo(order.getShopId()); ShopInfoDO shopInfo = shopService.getShopInfo(order.getShopId());
String shopCode = shopInfo.getShopCode(); String shopCode = shopInfo.getShopCode();
String data = coolStoreStartFlowService.getFirstOrder(shopCode).getData().toString(); Boolean flag = coolStoreStartFlowService.getFirstOrder(shopCode);
log.info("saveOrder,data:{}", data); log.info("saveOrder,flag:{}", flag);
if (data == null) { if (flag == null) {
throw new ServiceException(ErrorCodeEnum.GET_FIRST_ORDER); throw new ServiceException(ErrorCodeEnum.GET_FIRST_ORDER);
} }
if (data.equals("true")) { if (flag) {
//更改子阶段状态 //更改子阶段状态
shopStageInfoDAO.updateShopStageAndAuditInfo(order.getShopId(), shopStageInfoDAO.updateShopStageAndAuditInfo(order.getShopId(),
ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151, null); ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151, null);
@@ -96,7 +96,7 @@ public class FirstOrderServiceImp implements FirstOrderService {
log.error("获取鲜丰订货金异常", e); log.error("获取鲜丰订货金异常", e);
} }
} }
return flag; return num;
} }
@Override @Override

View File

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