diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/opFailRetryPushPackage/PushStatus.java b/blade-biz-common/src/main/java/org/springblade/common/constant/opFailRetryPushPackage/PushStatus.java new file mode 100644 index 000000000..b106f20fb --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/opFailRetryPushPackage/PushStatus.java @@ -0,0 +1,31 @@ +package org.springblade.common.constant.opFailRetryPushPackage; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public enum PushStatus { + wait("等待中", 1), + complete("已完成", 2), + expire("已过期", 3); + + private String name; + private Integer value; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } +} diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/OpFailRetryPushPackageEntity.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/OpFailRetryPushPackageEntity.java new file mode 100644 index 000000000..b5d939ee7 --- /dev/null +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/OpFailRetryPushPackageEntity.java @@ -0,0 +1,56 @@ +package com.logpm.factory.oupai.entity; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + +@Data +@TableName("op_fail_retry_push_package") +@ApiModel(value = "opFailRetryPushPackage对象", description = "欧派失败重推包件") +@EqualsAndHashCode(callSuper = true) +public class OpFailRetryPushPackageEntity extends BaseEntity { + /** 预留1 */ + @ApiModelProperty(name = "预留1",notes = "") + private String reserve1 ; + + /** 预留2 */ + @ApiModelProperty(name = "预留2",notes = "") + private String reserve2 ; + + /** 预留3 */ + @ApiModelProperty(name = "预留3",notes = "") + private String reserve3 ; + + /** 预留4 */ + @ApiModelProperty(name = "预留4",notes = "") + private String reserve4 ; + + /** 预留5 */ + @ApiModelProperty(name = "预留5",notes = "") + private String reserve5 ; + + /** 预留5 */ + @TableField("order_package_code") + @ApiModelProperty(name = "包件码",notes = "") + private String orderPackageCode; + + /** 预留5 */ + @ApiModelProperty(name = "执行参数",notes = "") + private String params ; + + /** 预留5 */ + @TableField("push_status") + @ApiModelProperty(name = "状态:1=待处理,2=已处理,3=已过期",notes = "") + private Integer pushStatus ; + + /** 预留5 */ + @ApiModelProperty(name = "类型:1=入库,2=出库",notes = "") + private Integer type ; + + +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java index 9801f5d5e..389e271d3 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java @@ -862,22 +862,22 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl list = distributionStockupService.selectStockupSelf(reservationId); + List list = distributionStockupService.selectStockupSelf(stockupDTO.getReservationId()); list.forEach(i -> { if (i.getPlanNum().equals(i.getRealNum())) { i.setCompleteStact(true); @@ -1192,7 +1177,22 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl list = distributionReservationService.selectStockupStockList(reservationId,myCurrentWarehouse.getId(),mallName); for (DistributionStockupStockListVO distributionStockupStockListVO : list) { diff --git a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/mq/ZbomFactoryOrderListener.java b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/mq/ZbomFactoryOrderListener.java index 48fe3c9c1..08b8f8e6a 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/mq/ZbomFactoryOrderListener.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/mq/ZbomFactoryOrderListener.java @@ -197,7 +197,7 @@ public class ZbomFactoryOrderListener { advanceEntity.setWaybillNo(""); advanceEntity.setTrainNumber(zbReceiptDTO.getDepartCode()); advanceEntity.setFreezeStatus("0"); - advanceEntity.setLegacyStatus("0"); + advanceEntity.setSenderFactory(zbReceiptDTO.getSenderName()); List packageList = new ArrayList<>(); for (OrderPackageDTO orderPackageDTO : value) { @@ -210,12 +210,18 @@ public class ZbomFactoryOrderListener { advanceEntity.setConsigneePerson(orderPackageDTO.getReceiverName()); advanceEntity.setConsigneeMobile(orderPackageDTO.getReceiverMobile()); advanceEntity.setConsigneeAddress(orderPackageDTO.getReceiverAddress()); + // 封装包件 TrunklineAdvanceDetailEntity advanceDetailEntity = new TrunklineAdvanceDetailEntity(); advanceDetailEntity.setWarehouseId(startWarehouseId); advanceDetailEntity.setWarehouseName(startWarehouseName); // advanceDetailEntity.setIncomingWarehouseId(0L); // advanceDetailEntity.setIncomingWarehouseName(""); + // 根据志邦的一流单标识赋值 + advanceEntity.setLegacyStatus("0"); + if(ObjectUtil.equal(orderPackageDTO.getLegacyFlag(),"Y")){ + advanceEntity.setLegacyStatus("1"); + } advanceDetailEntity.setOrderCode(orderPackageDTO.getPlatformOrderCode()); advanceDetailEntity.setBrand(zbReceiptDTO.getSenderName()); diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/OpFailPackageRetryJob.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/OpFailPackageRetryJob.java new file mode 100644 index 000000000..d62b1af9c --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/OpFailPackageRetryJob.java @@ -0,0 +1,69 @@ +package com.logpm.factory.jobhandler; + +import com.logpm.factory.oupai.entity.OpFailRetryPushPackageEntity; +import com.logpm.factory.oupai.mapper.OpFailRetryPushPackageMapper; +import com.logpm.factory.oupai.service.OpFailRetryPushPackageService; +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.common.constant.opFailRetryPushPackage.PushStatus; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.List; + + +@Slf4j +@Component +@AllArgsConstructor +public class OpFailPackageRetryJob { + + private final OpFailRetryPushPackageService opFailRetryPushPackageService; + + private OpFailRetryPushPackageMapper opFailRetryPushPackageMapper; + + // 是否开启多线程处理 + private static final boolean IsMultithreadingHandle = false; + + // 多线程批次处理的时候,每次最大处理的数据量 + private static final Integer batchHandleQuantity = 1000; + + /** + * 欧派数据推送失败的进行定时重推 + * @return + */ + @XxlJob("opFailPackageRetryJob") + public ReturnT execute(String param) { + + try { + if (IsMultithreadingHandle) { + batchHandleData(null); + } else { + HashMap condition = new HashMap<>(); + condition.put("push_status", PushStatus.wait.getValue()); + List opFailRetryPushPackageEntities = opFailRetryPushPackageMapper.selectByMap(condition); + opFailRetryPushPackageService.retry(opFailRetryPushPackageEntities); + } + }catch (Exception exception){ + log.error("OpFailPackageRetryJob error:{}",exception.getMessage()); + } + + return ReturnT.SUCCESS; + } + + /** + * 批次处理 + * @param startId + */ + private void batchHandleData(Long startId) { + List batchData = opFailRetryPushPackageMapper.selectWaitData(batchHandleQuantity, startId); + + if (batchData.size() == batchHandleQuantity) { + batchHandleData(batchData.get(batchHandleQuantity - 1).getId()); + } + + opFailRetryPushPackageService.retry(batchData); + } +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpFailRetryPushPackageMapper.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpFailRetryPushPackageMapper.java new file mode 100644 index 000000000..393c882c9 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpFailRetryPushPackageMapper.java @@ -0,0 +1,16 @@ +package com.logpm.factory.oupai.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.logpm.factory.oupai.entity.OpFailRetryPushPackageEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface OpFailRetryPushPackageMapper extends BaseMapper{ + void updateStatusToCompleteByIds(List ids); + void updateStatusToExpireByIds(List ids, String date); + + List selectWaitData(Integer limit, Long startId); +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpFailRetryPushPackageMapper.xml b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpFailRetryPushPackageMapper.xml new file mode 100644 index 000000000..825e5078b --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpFailRetryPushPackageMapper.xml @@ -0,0 +1,33 @@ + + + + + UPDATE logpm_factory.op_fail_retry_push_package + SET push_status = 2 + WHERE id IN + + #{id} + + + + + UPDATE logpm_factory.op_fail_retry_push_package + SET push_status = 3 + WHERE id IN + + #{id} + + AND create_time #{date} + + + + + diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryService.java index 588e3f22e..dae259581 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryService.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryService.java @@ -40,5 +40,13 @@ public interface IOuPaiFactoryService { */ R handleStatusData(OrderStatusDTO orderStatusDTO); + /** + * 欧派推送包件状态 + * @see IOuPaiFactoryService#handleStatusData + * @param orderStatusDTO + * @return + */ + boolean retryHandleStatusData(OrderStatusDTO orderStatusDTO); + R newSystemHandleStatusData(OrderStatusDTO orderStatusDTO); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/OpFailRetryPushPackageService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/OpFailRetryPushPackageService.java new file mode 100644 index 000000000..8498c61a2 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/OpFailRetryPushPackageService.java @@ -0,0 +1,13 @@ +package com.logpm.factory.oupai.service; + +import com.logpm.factory.oupai.entity.OpFailRetryPushPackageEntity; + +import java.util.List; + +public interface OpFailRetryPushPackageService { + + /** + * 重推 + */ + void retry(List waitData); +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/OpPushFailedPackageRecordService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/OpPushFailedPackageRecordService.java new file mode 100644 index 000000000..6b0acdc11 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/OpPushFailedPackageRecordService.java @@ -0,0 +1,15 @@ +package com.logpm.factory.oupai.service; + +import com.logpm.factory.comfac.dto.OrderStatusDTO; + +public interface OpPushFailedPackageRecordService { + + /** + * 记录失败的数据 + * + * @param orderPackageCode 包条 + * @param orderStatusDTO + */ + void record(String orderPackageCode, OrderStatusDTO orderStatusDTO); + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OpFailRetryPushPackageServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OpFailRetryPushPackageServiceImpl.java new file mode 100644 index 000000000..8fc004111 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OpFailRetryPushPackageServiceImpl.java @@ -0,0 +1,96 @@ +package com.logpm.factory.oupai.service.impl; + +import com.alibaba.nacos.shaded.com.google.gson.Gson; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.logpm.factory.comfac.dto.OrderStatusDTO; +import com.logpm.factory.oupai.entity.OpFailRetryPushPackageEntity; +import com.logpm.factory.oupai.mapper.OpFailRetryPushPackageMapper; +import com.logpm.factory.oupai.service.IOuPaiFactoryService; +import com.logpm.factory.oupai.service.OpFailRetryPushPackageService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import org.springblade.common.constant.opFailRetryPushPackage.PushStatus; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * 欧派数据失败重推 + */ +@Slf4j +@Service("one") +@AllArgsConstructor +public class OpFailRetryPushPackageServiceImpl implements OpFailRetryPushPackageService { + + protected OpFailRetryPushPackageMapper opFailRetryPushPackageMapper; + + protected IOuPaiFactoryService ouPaiFactoryService; + + protected final int MAX_RETRY_TIMES = 3; + + @Async + @Override + public void retry(List waitData){ + ArrayList completeIds = new ArrayList<>(); + ArrayList failIds = new ArrayList<>(); + + waitData.forEach(opFailRetryPushPackageEntity -> executeRetry(opFailRetryPushPackageEntity, completeIds, failIds)); + + updatePushStatus(completeIds, failIds); + } + + /** + * 更新推送状态 + * @param completeIds + * @param failIds + */ + protected void updatePushStatus(ArrayList completeIds, ArrayList failIds){ + if (!completeIds.isEmpty()) { + opFailRetryPushPackageMapper.updateStatusToCompleteByIds(completeIds); + } + if (!failIds.isEmpty()) { + opFailRetryPushPackageMapper.updateStatusToExpireByIds(failIds, getExpireTime()); + } + } + + /** + * 获取过期的时间 + * + * @return + */ + protected String getExpireTime(){ + Calendar calendar = Calendar.getInstance(); + Date date = new Date(); + + calendar.setTime(date); + calendar.add(Calendar.DATE, -MAX_RETRY_TIMES); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + return sdf.format(calendar.getTime()); + } + + /** + * 执行重试 + * @param opFailRetryPushPackageEntity + * @param completeIds + */ + protected void executeRetry(OpFailRetryPushPackageEntity opFailRetryPushPackageEntity, ArrayList completeIds, ArrayList failIds) { + try { + OrderStatusDTO orderStatusDTO = new Gson().fromJson(opFailRetryPushPackageEntity.getParams(), OrderStatusDTO.class); + + boolean res = ouPaiFactoryService.retryHandleStatusData(orderStatusDTO); + + if (res) { + completeIds.add(opFailRetryPushPackageEntity.getId()); + } else { + failIds.add(opFailRetryPushPackageEntity.getId()); + } + } catch (Exception e) { + log.error("executeRetry error: {}", e.getMessage()); + } + } +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OpPushFailedPackageRecordServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OpPushFailedPackageRecordServiceImpl.java new file mode 100644 index 000000000..67e89772e --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OpPushFailedPackageRecordServiceImpl.java @@ -0,0 +1,53 @@ +package com.logpm.factory.oupai.service.impl; + +import com.alibaba.nacos.shaded.com.google.gson.Gson; +import com.logpm.factory.comfac.dto.OrderStatusDTO; +import com.logpm.factory.oupai.entity.OpFailRetryPushPackageEntity; +import com.logpm.factory.oupai.mapper.OpFailRetryPushPackageMapper; +import com.logpm.factory.oupai.service.OpPushFailedPackageRecordService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.HashMap; + +@Slf4j +@Service +@AllArgsConstructor +public class OpPushFailedPackageRecordServiceImpl implements OpPushFailedPackageRecordService { + + private OpFailRetryPushPackageMapper opFailRetryPushPackageMapper; + + /** + * 记录失败的数据 + * + * @param orderPackageCode 包条 + * @param orderStatusDTO + */ + @Override + public void record(String orderPackageCode, OrderStatusDTO orderStatusDTO){ + + try { + OpFailRetryPushPackageEntity opFailRetryPushPackageEntity = new OpFailRetryPushPackageEntity(); + + opFailRetryPushPackageEntity.setOrderPackageCode(orderPackageCode); + opFailRetryPushPackageEntity.setParams(new Gson().toJson(orderStatusDTO)); + opFailRetryPushPackageEntity.setCreateTime(new Date()); + + // 判重 +// HashMap queryMap = new HashMap<>(); +// queryMap.put("orderPackageCode", orderPackageCode); +// if (opFailRetryPushPackageMapper.selectByMap(queryMap) != null) { +// return; +// } + + opFailRetryPushPackageMapper.insert(opFailRetryPushPackageEntity); + + }catch (Exception e){ + log.error(e.getMessage(),e); + } + + } + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java index 1bcf982eb..a04f40e86 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java @@ -94,6 +94,9 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { @Autowired private IDistributionParcelListClient distributionParcelListClient; + @Autowired + private OpPushFailedPackageRecordService opPushFailedPackageRecordService; + @Override public String saveOuPaiFactoryOrderDTOByCarCarNumber(String code) { @@ -403,9 +406,33 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { return orderCode; } - @Override public R handleStatusData(OrderStatusDTO orderStatusDTO) { + // 重写 handleStatusData, 增加重试参数 + // 原调用执行 + return handleStatusData(orderStatusDTO, false); + } + + /** + * 重推 + * @see #handleStatusData(OrderStatusDTO, boolean) + * @param orderStatusDTO + * @return + */ + public boolean retryHandleStatusData(OrderStatusDTO orderStatusDTO){ + R res = handleStatusData(orderStatusDTO, true); + return res.getCode() == 200; + // 测试功能时使用 +// return res.getCode() == 200 || Math.random() < 0.5; + } + + /** + * + * @param orderStatusDTO + * @param isRetry 是否是重推调用 + * @return + */ + private R handleStatusData(OrderStatusDTO orderStatusDTO, boolean isRetry) { // 推送数据 String status = orderStatusDTO.getStatus(); String unitNo = orderStatusDTO.getUnitNo(); @@ -439,6 +466,12 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { FactoryOrderEntity factoryOrder = factoryOrderService.selectEntityByOrderPackageCode(unitNo); if (Objects.isNull(factoryOrder)) { + + // 不是重试的时候,记录对应数据 + if (!isRetry) { + opPushFailedPackageRecordService.record(unitNo, orderStatusDTO); + } + return Resp.fail(400, "未查询到该单据推送订单信息"); } // 如何判断这个包间是非干仓配的数据 diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/IndexCountService.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/IndexCountService.java index 205658d90..8ef6c774f 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/IndexCountService.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/IndexCountService.java @@ -10,18 +10,4 @@ import com.logpm.report.vo.indexCount.QuantityAbnormalWorkOrdersVO; public interface IndexCountService { IndexCountVO indexCount(Long warehouseId); - - /** - * 当月异常工单数量 - * @param warehouseId - * @return - */ - QuantityAbnormalWorkOrdersVO numberOfAbnormalWorkOrdersTheMonth(Long warehouseId); - - /** - * 当月出入库数量 - * @param warehouseId - * @return - */ - InboundAndOutboundQuantityVO inboundAndOutboundQuantityTheMonth(Long warehouseId); } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/InLibraryDeliverServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/InLibraryDeliverServiceImpl.java index 6542c0dd1..279fb645b 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/InLibraryDeliverServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/InLibraryDeliverServiceImpl.java @@ -31,7 +31,7 @@ public class InLibraryDeliverServiceImpl implements InLibraryDeliverService { /** * 上架数量 * @param id - * @param order_package_grounding_status 状态 ;1=已上架,2 = 未上架 + * @param order_package_grounding_status 状态 ;2=已上架,1 = 未上架 * @return */ public Integer theNumberOfShelvesInTheLibrary(Long id, Integer order_package_grounding_status){ diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/IndexCountServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/IndexCountServiceImpl.java index 910d9bbfc..a7139521c 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/IndexCountServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/IndexCountServiceImpl.java @@ -10,6 +10,7 @@ import lombok.AllArgsConstructor; import org.springblade.common.constant.aftersales.WorkOrderStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageStatusConstant; import org.springblade.common.constant.stockup.StockupTypeConstant; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import java.util.HashMap; @@ -33,6 +34,7 @@ public class IndexCountServiceImpl implements IndexCountService { /** * 首页统计数据 */ + @Cacheable(value = "indexCount=10", key = "#warehouseId") public IndexCountVO indexCount(Long warehouseId) { // 这里需要换这里的代码,测试是模拟请求携带仓库ID参数 // Long warehouseId = AuthUtil.getWarehouseId(); @@ -52,8 +54,8 @@ public class IndexCountServiceImpl implements IndexCountService { private InStoreDataVO inStoreData(Long warehouseId) { InStoreDataVO inStoreDataVO = new InStoreDataVO(); - Integer OnTheShelves = 1; // 上架 - Integer NotOnTheShelves = 2; // 未上架 + Integer OnTheShelves = 2; // 上架 + Integer NotOnTheShelves = 1; // 未上架 inStoreDataVO.setAll(inLibraryDeliverService.indexCount(warehouseId)); inStoreDataVO.setOnTheShelves(inLibraryDeliverService.theNumberOfShelvesInTheLibrary(warehouseId, OnTheShelves)); @@ -66,7 +68,6 @@ public class IndexCountServiceImpl implements IndexCountService { /** * 异常工单数据 */ - @Override public QuantityAbnormalWorkOrdersVO numberOfAbnormalWorkOrdersTheMonth(Long warehouseId) { String status = WorkOrderStatusConstant.daichuli.getValue(); @@ -81,7 +82,6 @@ public class IndexCountServiceImpl implements IndexCountService { * * @param warehouseId */ - @Override public InboundAndOutboundQuantityVO inboundAndOutboundQuantityTheMonth(Long warehouseId) { InboundAndOutboundQuantityVO inboundAndOutboundQuantityVO = new InboundAndOutboundQuantityVO(); String status = OrderPackageStatusConstant.yichuku.getValue();