开业筹备阶段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;
return shopStageInfoMapper.getRentContractToDoPage(userId, shopSubStageStatus.getShopSubStageEnum().getShopSubStage(), shopSubStageStatus.getShopSubStageStatus());
}
public List<Long> getShopIdListByStageStatus(List<Long> shopIdList){
return shopStageInfoMapper.getShopIdListByStageStatus(shopIdList);
public Page<Long> getShopIdListByStageStatus( Integer pageNum, Integer pageSize){
PageHelper.startPage(pageNum, pageSize);
return shopStageInfoMapper.getShopIdListByStageStatus();
}
}

View File

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

View File

@@ -137,12 +137,6 @@
select shop_id
from xfsg_shop_stage_info
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>
</mapper>

View File

@@ -75,18 +75,18 @@ public class FirstOrderServiceImp implements FirstOrderService {
order.setUpdateTime(new Date());
order.setUpdateUserId(userId);
}
Integer flag = firstOrderDAO.insertFirstOrder(order);
Integer num = firstOrderDAO.insertFirstOrder(order);
//云立方同步
if (flag > 0) {
if (num > 0) {
try {
ShopInfoDO shopInfo = shopService.getShopInfo(order.getShopId());
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(order.getShopId(),
ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151, null);
@@ -96,7 +96,7 @@ public class FirstOrderServiceImp implements FirstOrderService {
log.error("获取鲜丰订货金异常", e);
}
}
return flag;
return num;
}
@Override

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++;
}
}
}