feat:发票回传数据处理

This commit is contained in:
苏竹红
2025-01-02 15:40:29 +08:00
parent 154b5d1aaf
commit 85ccaf5dea
3 changed files with 72 additions and 0 deletions

View File

@@ -1,12 +1,17 @@
package com.cool.store.controller.webc;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.dto.OpenCityDTO;
import com.cool.store.dto.ocr.InvoiceDTO;
import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.IDCardSideEnum;
import com.cool.store.enums.WorkflowSubStageEnum;
import com.cool.store.enums.point.ShopStageEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ApiException;
import com.cool.store.exception.ServiceException;
import com.cool.store.job.XxlJobHandler;
@@ -26,10 +31,14 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.ByteArrayOutputStream;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
@Slf4j
@RestController
@@ -60,6 +69,9 @@ public class TestController {
@Resource
private XxlJobHandler xxlJobHandler;
@Resource
ShopStageInfoDAO shopStageInfoDAO;
@PostMapping("/getFirstOrders")
public ResponseResult<xfsgFirstOderListResponse> getFirstOrders(@RequestBody xfsgFirstOrderListRequest storeCodeList) {
xfsgFirstOderListResponse firstOrderList = coolStoreStartFlowService.getFirstOrderList(storeCodeList);
@@ -200,4 +212,53 @@ public class TestController {
return ResponseResult.success();
}
@GetMapping("/stageDataHandler")
public ResponseResult stageDataHandler(){
//查询所有完成初始化铺位加盟合同的完成情况
List<ShopStageInfoDO> subStages = shopStageInfoDAO.getSubStages(ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
List<ShopStageInfoDO> existSubStages = shopStageInfoDAO.getSubStages(ShopSubStageEnum.SHOP_STAGE_8_5.getShopSubStage());
//existSubStages
List<Long> shopIds = existSubStages.stream().map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
//-100 800 840 如果是-100或者800直接 发票回传是-100 如果是840 发票回传是直接完成 890
List<ShopStageInfoDO> list = new ArrayList<>();
for (ShopStageInfoDO x : subStages) {
if (shopIds.contains(x.getShopId())) {
log.info("已存在");
continue;
}
ShopStageInfoDO shopStageInfo = new ShopStageInfoDO();
shopStageInfo.setLineId(x.getLineId());
shopStageInfo.setShopId(x.getShopId());
//发票回传 是2
ShopStageEnum shopStageEnum = ShopStageEnum.SHOP_STAGE_2;
shopStageInfo.setShopStage(shopStageEnum.getShopStage());
ShopSubStageEnum shopSubStageEnum = ShopSubStageEnum.SHOP_STAGE_8_5;
shopStageInfo.setShopSubStage(shopSubStageEnum.getShopSubStage());
//默认是已完成
ShopSubStageStatusEnum initStatus = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85_3;
//如果加盟合同没完成 则发票回传是未开始
if (x.getShopSubStageStatus() == -100 || x.getShopSubStageStatus() == 800) {
initStatus = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_00;
}
shopStageInfo.setShopSubStageStatus(initStatus.getShopSubStageStatus());
shopStageInfo.setRemark(shopSubStageEnum.getShopSubStageName() + CommonConstants.PATH_BAR + initStatus.getShopSubStageStatusName());
shopStageInfo.setIsTerminated(Boolean.FALSE);
LocalDate localDate = LocalDate.parse(x.getPlanCompleteTime()).plusDays(1);
shopStageInfo.setPlanCompleteTime(shopSubStageEnum.getPlanCompleteTime(localDate));
list.add(shopStageInfo);
}
log.info("list:{}",JSONObject.toJSONString(list));
shopStageInfoDAO.batchInsert(list);
return ResponseResult.success();
}
}