From 3896ecbcd23cfbf58944fb7e4764169eb0286d79 Mon Sep 17 00:00:00 2001 From: chenlong Date: Thu, 19 Dec 2024 17:13:17 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E7=9A=84=E8=8A=82=E7=82=B9=E3=80=81=E5=BA=93=E4=BD=8D=E3=80=81?= =?UTF-8?q?=E5=B9=B2=E7=BA=BF=E4=BA=8B=E4=B8=9A=E7=BA=BF=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/LargeScreenController.java | 25 ++++-- .../mapper/largeScreen/BinLocationMapper.java | 17 ++++ .../mapper/largeScreen/BinLocationMapper.xml | 16 ++++ .../largeScreen/CarsLoadDataMapper.java | 8 +- .../mapper/largeScreen/CarsLoadDataMapper.xml | 24 +++++- .../mapper/largeScreen/NodeDataMapper.java | 13 +++ .../mapper/largeScreen/NodeDataMapper.xml | 24 ++++++ .../largeScreen/IBinLocationService.java | 7 ++ .../service/largeScreen/INodeDataService.java | 7 ++ .../impl/BinLocationServiceImpl.java | 28 ++++++ .../impl/CarsLoadDataServiceImpl.java | 85 +++++++++++++++++-- .../impl/MapWarehouseServiceImpl.java | 8 +- .../largeScreen/impl/NodeDataServiceImpl.java | 35 ++++++++ ...{CareerLineInfoVO.java => DeptInfoVO.java} | 4 +- .../CareerLineData/VehicleStowageDataVO.java | 15 ++++ .../VehicleStowageMonthDataVo.java | 17 ++++ .../CareerLineData/WarehouseDeptVO.java | 11 +++ .../vo/largeScreen/CareerLineDataVO.java | 15 ++++ 18 files changed, 338 insertions(+), 21 deletions(-) create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BinLocationMapper.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BinLocationMapper.xml create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/NodeDataMapper.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/NodeDataMapper.xml create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/IBinLocationService.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/INodeDataService.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BinLocationServiceImpl.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/NodeDataServiceImpl.java rename blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/{CareerLineInfoVO.java => DeptInfoVO.java} (72%) create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/VehicleStowageDataVO.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/VehicleStowageMonthDataVo.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/WarehouseDeptVO.java diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java index 485712f06..daafd405c 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java @@ -2,11 +2,11 @@ package com.logpm.report.controller; import com.logpm.report.service.largeScreen.IBillingDataService; +import com.logpm.report.service.largeScreen.ICarsLoadDataService; import com.logpm.report.service.largeScreen.IMapWarehouseService; -import com.logpm.report.vo.largeScreen.BillingDataVO; -import com.logpm.report.vo.largeScreen.MapWarehouseVO; -import com.logpm.report.vo.largeScreen.MonthBillingDataVO; -import com.logpm.report.vo.largeScreen.WarehouseBillingDataVO; +import com.logpm.report.service.largeScreen.INodeDataService; +import com.logpm.report.service.largeScreen.impl.BinLocationServiceImpl; +import com.logpm.report.vo.largeScreen.*; import io.swagger.annotations.Api; import lombok.AllArgsConstructor; import org.springblade.core.tool.api.R; @@ -25,6 +25,9 @@ public class LargeScreenController{ private final IMapWarehouseService mapWarehouseService; private final IBillingDataService billingDataService; + private final ICarsLoadDataService CarsLoad; + private final INodeDataService nodeData; + private final BinLocationServiceImpl BinLocation; /** * 地图仓库数据 @@ -62,7 +65,17 @@ public class LargeScreenController{ * 事业线配载件量趋势 */ @GetMapping("/careerLineData") - public R> getCareerLineData(){ - return R.data(billingDataService.getMonthBillingData()); + public R> getCareerLineData(){ + return R.data(CarsLoad.getCareerLineData()); + } + + @GetMapping("/nodeData") + public R getNodeData(){ + return R.data(nodeData.getNodeData()); + } + + @GetMapping("/binLocationData") + public R getBinLocationData(){ + return R.data(BinLocation.getBinLocationData()); } } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BinLocationMapper.java b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BinLocationMapper.java new file mode 100644 index 000000000..afd290a58 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BinLocationMapper.java @@ -0,0 +1,17 @@ +package com.logpm.report.mapper.largeScreen; + + +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface BinLocationMapper { + // 在库订单数 + Integer getOrderNum(); + // 包裹数 + Integer getPackageNum(); + // 货柜数 + Integer getBinLocationNum(); + // 使用货柜数 + // 空闲货柜数 + Integer getIdleBinLocationNum(); +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BinLocationMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BinLocationMapper.xml new file mode 100644 index 000000000..2bc5bbbe2 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BinLocationMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.java b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.java index 377dba328..fdf981cf6 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.java @@ -1,14 +1,18 @@ package com.logpm.report.mapper.largeScreen; -import com.logpm.report.vo.largeScreen.CareerLineData.CareerLineInfoVO; +import com.logpm.report.vo.largeScreen.CareerLineData.DeptInfoVO; +import com.logpm.report.vo.largeScreen.CareerLineData.VehicleStowageDataVO; +import com.logpm.report.vo.largeScreen.CareerLineData.WarehouseDeptVO; import org.apache.ibatis.annotations.Mapper; import java.util.List; @Mapper public interface CarsLoadDataMapper { - public List getCareerLineInfo(); + public List getDeptInfo(); + public List getVehicleStowageData(String startTime, String endTime); + public List getWarehouseDept(); } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.xml index 4de3891d4..b94adf4b6 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.xml +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.xml @@ -1,11 +1,27 @@ - SELECT id, - dept_name as deptName + dept_name as deptName, + parent_id as parentId FROM logpm.blade_dept - WHERE dept_category = 2 AND dept_name like '%事业线%' + + + diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/NodeDataMapper.java b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/NodeDataMapper.java new file mode 100644 index 000000000..fdc26a361 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/NodeDataMapper.java @@ -0,0 +1,13 @@ +package com.logpm.report.mapper.largeScreen; + + +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface NodeDataMapper { + public Integer getWaybill(String startTime, String endTime); + public Integer getCarsLoadLoading(String startTime, String endTime); + public Integer getDeliveryLading(String startTime, String endTime); + public Integer getArrival(String startTime, String endTime); + public Integer getSign(String startTime, String endTime); +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/NodeDataMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/NodeDataMapper.xml new file mode 100644 index 000000000..3dbc89abc --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/NodeDataMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/IBinLocationService.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/IBinLocationService.java new file mode 100644 index 000000000..e40f35c7a --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/IBinLocationService.java @@ -0,0 +1,7 @@ +package com.logpm.report.service.largeScreen; + +import com.logpm.report.vo.largeScreen.BinLocationDataVO; + +public interface IBinLocationService { + BinLocationDataVO getBinLocationData(); +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/INodeDataService.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/INodeDataService.java new file mode 100644 index 000000000..4c8be9126 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/INodeDataService.java @@ -0,0 +1,7 @@ +package com.logpm.report.service.largeScreen; + +import com.logpm.report.vo.largeScreen.NodeDataVO; + +public interface INodeDataService { + NodeDataVO getNodeData(); +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BinLocationServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BinLocationServiceImpl.java new file mode 100644 index 000000000..cb062aad8 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BinLocationServiceImpl.java @@ -0,0 +1,28 @@ +package com.logpm.report.service.largeScreen.impl; + +import com.logpm.report.mapper.largeScreen.BinLocationMapper; +import com.logpm.report.service.largeScreen.IBinLocationService; +import com.logpm.report.vo.largeScreen.BinLocationDataVO; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + + +@AllArgsConstructor +@Service +@Log4j2 +public class BinLocationServiceImpl implements IBinLocationService { + private BinLocationMapper binLocationMapper; + + public BinLocationDataVO getBinLocationData() { + + BinLocationDataVO binLocationDataVO = new BinLocationDataVO(); + binLocationDataVO.setOrderNum(binLocationMapper.getOrderNum()); + binLocationDataVO.setPackageNum(binLocationMapper.getPackageNum()); + binLocationDataVO.setBinLocationNum(binLocationMapper.getBinLocationNum()); + binLocationDataVO.setUseBinLocationNum(binLocationMapper.getBinLocationNum() - binLocationMapper.getIdleBinLocationNum()); + binLocationDataVO.setIdleBinLocationNum(binLocationMapper.getIdleBinLocationNum()); + + return binLocationDataVO; + } +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/CarsLoadDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/CarsLoadDataServiceImpl.java index e8c328e3b..afd07cc70 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/CarsLoadDataServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/CarsLoadDataServiceImpl.java @@ -2,14 +2,19 @@ package com.logpm.report.service.largeScreen.impl; import com.logpm.report.mapper.largeScreen.CarsLoadDataMapper; import com.logpm.report.service.largeScreen.ICarsLoadDataService; -import com.logpm.report.vo.largeScreen.CareerLineData.CareerLineInfoVO; +import com.logpm.report.vo.largeScreen.CareerLineData.DeptInfoVO; +import com.logpm.report.vo.largeScreen.CareerLineData.VehicleStowageDataVO; +import com.logpm.report.vo.largeScreen.CareerLineData.VehicleStowageMonthDataVo; +import com.logpm.report.vo.largeScreen.CareerLineData.WarehouseDeptVO; import com.logpm.report.vo.largeScreen.CareerLineDataVO; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; import org.springframework.stereotype.Service; -import java.util.Collections; -import java.util.List; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; @AllArgsConstructor @Service @@ -21,9 +26,79 @@ public class CarsLoadDataServiceImpl implements ICarsLoadDataService { @Override public List getCareerLineData() { - List careerLineInfo = carsLoadDataMapper.getCareerLineInfo(); + Map careerLineMap = analysisCareerLineByDept(carsLoadDataMapper.getDeptInfo()); + Map warehouseDept = carsLoadDataMapper.getWarehouseDept().stream() + .filter(WarehouseDeptVO -> WarehouseDeptVO.getDept() != null) + .collect(Collectors.toMap(WarehouseDeptVO::getWarehouseId, WarehouseDeptVO::getDept)); + List vehicleStowageData = carsLoadDataMapper.getVehicleStowageData( + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-01-01 00:00:00")), + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-12-31 23:59:59")) + ); + HashMap resultMap = new HashMap<>(); - return Collections.emptyList(); + for (VehicleStowageDataVO vehicleStowageDataVO : vehicleStowageData) { + Long DeptId = warehouseDept.get(vehicleStowageDataVO.getWarehouseId()); + if (!careerLineMap.containsKey(DeptId)) { + log.info("未找到事业线:" + DeptId); + continue; + } + + DeptInfoVO careerLine = careerLineMap.get(DeptId); + if (!resultMap.containsKey(careerLine.getId())) { + resultMap.put(careerLine.getId(), new CareerLineDataVO(careerLine.getDeptName(), monthDataInit())); + } + + resultMap.get(careerLine.getId()).getMonthData().forEach(vehicleStowageMonthDataVo -> { + if (vehicleStowageDataVO.getCreateMonth().equals(vehicleStowageMonthDataVo.getCreateMonth())) { + vehicleStowageMonthDataVo.setTotal(vehicleStowageMonthDataVo.getTotal() + vehicleStowageDataVO.getTotal()); + } + }); + } + + return new ArrayList<>(resultMap.values()); + } + + + private List monthDataInit(){ + String year = String.valueOf(LocalDate.now().getYear()); + List vehicleStowageMonthDataVos = new ArrayList<>(); + for (int i = 1; i <= 12; i++) { + vehicleStowageMonthDataVos.add(new VehicleStowageMonthDataVo(year + "-" + String.format("%02d", i), 0)); + } + return vehicleStowageMonthDataVos; + } + + + /** + * 根据部门id获取事业线信息 + * @param deptInfo 所有部门信息 + */ + private Map analysisCareerLineByDept(List deptInfo) { + + Map deptInfoVOMap = deptInfo.stream().collect(Collectors.toMap(DeptInfoVO::getId, deptInfoVO -> deptInfoVO)); + Map careerLineMap = new HashMap<>(); + + deptInfo.forEach(deptInfoVO -> { + if (deptInfoVO.getDeptName().contains("事业线")) { + careerLineMap.put(deptInfoVO.getId(), deptInfoVO); + return; + } + Long parentId = deptInfoVO.getParentId(); + + while (deptInfoVOMap.containsKey(parentId)) { + + if (deptInfoVOMap.get(parentId).getDeptName().contains("事业线")) { + careerLineMap.put(deptInfoVO.getId(), deptInfoVOMap.get(parentId)); + return; + } + parentId = deptInfoVOMap.get(parentId).getParentId(); + } + + careerLineMap.put(deptInfoVO.getId(), deptInfoVO); + }); + + + return careerLineMap; } } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/MapWarehouseServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/MapWarehouseServiceImpl.java index ff49dbf19..a6f177030 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/MapWarehouseServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/MapWarehouseServiceImpl.java @@ -11,6 +11,9 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; @@ -25,10 +28,9 @@ public class MapWarehouseServiceImpl implements IMapWarehouseService { public List list() { List warehouselist = mapWarehouseMapper.warehouselist(); List lineInfoVOS = mapWarehouseMapper.lineInfolist( - DateUtil.format(new Date(), "yyyy-10-dd 00:00:00"), - DateUtil.format(new Date(), "yyyy-MM-dd 23:59:59") + LocalDateTime.now().minusMonths(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd 23:59:59")) ); - log.info("lineInfoVOS:{}", lineInfoVOS); Map> warehouseLine = lineInfoVOS.stream().collect(Collectors.groupingBy(LineInfoVO::getStartWarehouseId)); diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/NodeDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/NodeDataServiceImpl.java new file mode 100644 index 000000000..39af61d94 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/NodeDataServiceImpl.java @@ -0,0 +1,35 @@ +package com.logpm.report.service.largeScreen.impl; + +import com.logpm.report.mapper.largeScreen.NodeDataMapper; +import com.logpm.report.service.largeScreen.INodeDataService; +import com.logpm.report.vo.largeScreen.NodeDataVO; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +@AllArgsConstructor +@Log4j2 +@Service +public class NodeDataServiceImpl implements INodeDataService { + + private final NodeDataMapper nodeDataMapper; + + @Override + public NodeDataVO getNodeData() { + + String startTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-01-01 00:00:00")); + String endTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-12-31 23:59:59")); + + NodeDataVO nodeDataVO = new NodeDataVO(); + nodeDataVO.setWaybill(nodeDataMapper.getWaybill(startTime, endTime)); + nodeDataVO.setCarsLoadLoading(nodeDataMapper.getCarsLoadLoading(startTime, endTime)); + nodeDataVO.setDeliveryLading(nodeDataMapper.getDeliveryLading(startTime, endTime)); + nodeDataVO.setArrival(nodeDataMapper.getArrival(startTime, endTime)); + nodeDataVO.setSign(nodeDataMapper.getSign(startTime, endTime)); + + return nodeDataVO; + } +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/CareerLineInfoVO.java b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/DeptInfoVO.java similarity index 72% rename from blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/CareerLineInfoVO.java rename to blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/DeptInfoVO.java index f212a9257..f8821eec4 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/CareerLineInfoVO.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/DeptInfoVO.java @@ -4,8 +4,10 @@ package com.logpm.report.vo.largeScreen.CareerLineData; import lombok.Data; @Data -public class CareerLineInfoVO { +public class DeptInfoVO { public String deptName; + public Long parentId; + public Long id; } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/VehicleStowageDataVO.java b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/VehicleStowageDataVO.java new file mode 100644 index 000000000..5f0729788 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/VehicleStowageDataVO.java @@ -0,0 +1,15 @@ +package com.logpm.report.vo.largeScreen.CareerLineData; + + +import lombok.Data; + +import java.util.List; + +@Data +public class VehicleStowageDataVO { + private Long warehouseId; + + private String createMonth; + + private Integer total; +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/VehicleStowageMonthDataVo.java b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/VehicleStowageMonthDataVo.java new file mode 100644 index 000000000..f1d6cdece --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/VehicleStowageMonthDataVo.java @@ -0,0 +1,17 @@ +package com.logpm.report.vo.largeScreen.CareerLineData; + + +import lombok.Data; + +@Data +public class VehicleStowageMonthDataVo { + + private String createMonth; + + private Integer total; + + public VehicleStowageMonthDataVo(String createMonth, Integer total){ + this.createMonth = createMonth; + this.total = total; + } +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/WarehouseDeptVO.java b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/WarehouseDeptVO.java new file mode 100644 index 000000000..365fd622f --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineData/WarehouseDeptVO.java @@ -0,0 +1,11 @@ +package com.logpm.report.vo.largeScreen.CareerLineData; + + +import lombok.Data; + +@Data +public class WarehouseDeptVO { + private Long dept; + + private Long warehouseId; +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineDataVO.java b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineDataVO.java index 9b72c96e3..2677205d0 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineDataVO.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/CareerLineDataVO.java @@ -1,7 +1,22 @@ package com.logpm.report.vo.largeScreen; +import com.logpm.report.vo.largeScreen.CareerLineData.VehicleStowageMonthDataVo; +import lombok.Data; + +import java.util.List; + /** * 事业线车辆配载数据 */ +@Data public class CareerLineDataVO { + + private String careerLineName; + + private List monthData; + + public CareerLineDataVO(String careerLineName, List monthData) { + this.careerLineName = careerLineName; + this.monthData = monthData; + } } From e54f6eeaf818aa1109dc251b1409cae12a8edb68 Mon Sep 17 00:00:00 2001 From: chenlong Date: Fri, 20 Dec 2024 13:50:34 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E9=80=81,=E4=B8=9A=E5=8A=A1=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/LargeScreenController.java | 50 ++++++++++++++++--- .../largeScreen/BusinessRatioMapper.java | 15 ++++++ .../largeScreen/BusinessRatioMapper.xml | 20 ++++++++ .../largeScreen/CarsLoadDataMapper.java | 1 + .../mapper/largeScreen/CarsLoadDataMapper.xml | 8 +++ .../largeScreen/DeliveryDataMapper.java | 11 ++++ .../mapper/largeScreen/DeliveryDataMapper.xml | 33 ++++++++++++ .../mapper/largeScreen/TrunkDataMapper.java | 10 ++++ .../mapper/largeScreen/TrunkDataMapper.xml | 25 ++++++++++ .../largeScreen/IBusinessRationService.java | 8 +++ .../largeScreen/ICarsLoadDataService.java | 2 +- .../largeScreen/IDeliveryDataService.java | 8 +++ .../largeScreen/ITrunkDataService.java | 8 +++ .../impl/BusinessRationServiceImpl.java | 31 ++++++++++++ .../impl/CarsLoadDataServiceImpl.java | 12 +++-- .../impl/DeliveryDataServiceImpl.java | 45 +++++++++++++++++ .../impl/TrunkDataServiceImpl.java | 33 ++++++++++++ .../largeScreen/BusinessRatio/ItemDataVO.java | 11 ++++ .../vo/largeScreen/BusinessRatioDataVO.java | 14 ++++++ .../report/vo/largeScreen/DeliveryDataVO.java | 33 ++++++++++++ 20 files changed, 365 insertions(+), 13 deletions(-) create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BusinessRatioMapper.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BusinessRatioMapper.xml create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/DeliveryDataMapper.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/DeliveryDataMapper.xml create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/TrunkDataMapper.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/TrunkDataMapper.xml create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/IBusinessRationService.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/IDeliveryDataService.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/ITrunkDataService.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BusinessRationServiceImpl.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/DeliveryDataServiceImpl.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/TrunkDataServiceImpl.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/BusinessRatio/ItemDataVO.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/BusinessRatioDataVO.java diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java index daafd405c..7367ed19a 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java @@ -1,15 +1,15 @@ package com.logpm.report.controller; -import com.logpm.report.service.largeScreen.IBillingDataService; -import com.logpm.report.service.largeScreen.ICarsLoadDataService; -import com.logpm.report.service.largeScreen.IMapWarehouseService; -import com.logpm.report.service.largeScreen.INodeDataService; +import com.logpm.report.service.largeScreen.*; import com.logpm.report.service.largeScreen.impl.BinLocationServiceImpl; import com.logpm.report.vo.largeScreen.*; import io.swagger.annotations.Api; import lombok.AllArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springblade.core.tool.api.R; +import org.springframework.data.repository.query.Param; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -23,11 +23,15 @@ import java.util.List; @AllArgsConstructor public class LargeScreenController{ + private static final Logger log = LoggerFactory.getLogger(LargeScreenController.class); private final IMapWarehouseService mapWarehouseService; private final IBillingDataService billingDataService; private final ICarsLoadDataService CarsLoad; private final INodeDataService nodeData; - private final BinLocationServiceImpl BinLocation; + private final IBinLocationService BinLocation; + private final ITrunkDataService trunkData; + private final IDeliveryDataService deliveryDataService; + private final IBusinessRationService businessRatio; /** * 地图仓库数据 @@ -65,17 +69,49 @@ public class LargeScreenController{ * 事业线配载件量趋势 */ @GetMapping("/careerLineData") - public R> getCareerLineData(){ - return R.data(CarsLoad.getCareerLineData()); + public R> getCareerLineData(@Param("isDelivery") Integer isDelivery){ + return R.data(CarsLoad.getCareerLineData(isDelivery)); } + /** + * 节点数据 + */ @GetMapping("/nodeData") public R getNodeData(){ return R.data(nodeData.getNodeData()); } + /** + * 库位数据 + */ @GetMapping("/binLocationData") public R getBinLocationData(){ return R.data(BinLocation.getBinLocationData()); } + + /** + * 干线车次数据 + */ + @GetMapping("/trunkData") + public R getTrunkData(){ + return R.data(trunkData.getTrunkData()); + } + + /** + * 配送数据 + * @param isYear 是否是年数据 1是 + */ + @GetMapping("/deliveryData") + public R getDeliveryData(@Param("isYear") Integer isYear){ + log.info("getDeliveryData: isYear={}", isYear); + return R.data(deliveryDataService.getDeliveryAllData(isYear)); + } + + /** + * 业务占比 + */ + @GetMapping("/businessRatio") + public R getDeliveryData2B(){ + return R.data(businessRatio.getBusinessRatioData()); + } } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BusinessRatioMapper.java b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BusinessRatioMapper.java new file mode 100644 index 000000000..251a4c3d6 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BusinessRatioMapper.java @@ -0,0 +1,15 @@ +package com.logpm.report.mapper.largeScreen; + + +import com.logpm.report.vo.largeScreen.BusinessRatio.ItemDataVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface BusinessRatioMapper { + + List getTypeData(String startTime, String endTime); + + List getBrandData(String startTime, String endTime); +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BusinessRatioMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BusinessRatioMapper.xml new file mode 100644 index 000000000..9362ed39a --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BusinessRatioMapper.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.java b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.java index fdf981cf6..870225a56 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.java @@ -13,6 +13,7 @@ public interface CarsLoadDataMapper { public List getDeptInfo(); public List getVehicleStowageData(String startTime, String endTime); + public List getDeliveryData(String startTime, String endTime); public List getWarehouseDept(); } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.xml index b94adf4b6..981c5cc28 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.xml +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/CarsLoadDataMapper.xml @@ -24,4 +24,12 @@ department as dept from logpm_platform.logpm_warehouse_warehouse + diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/DeliveryDataMapper.java b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/DeliveryDataMapper.java new file mode 100644 index 000000000..d50b5c2a8 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/DeliveryDataMapper.java @@ -0,0 +1,11 @@ +package com.logpm.report.mapper.largeScreen; + +import com.logpm.report.vo.largeScreen.DeliveryDataVO; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface DeliveryDataMapper { + public DeliveryDataVO getDeliveryAllData(String startTime, String endTime); + public DeliveryDataVO getDelivery2BData(String startTime, String endTime); + public DeliveryDataVO getDelivery2CData(String startTime, String endTime); +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/DeliveryDataMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/DeliveryDataMapper.xml new file mode 100644 index 000000000..9d4e6d450 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/DeliveryDataMapper.xml @@ -0,0 +1,33 @@ + + + + + + + diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/TrunkDataMapper.java b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/TrunkDataMapper.java new file mode 100644 index 000000000..de5b1220f --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/TrunkDataMapper.java @@ -0,0 +1,10 @@ +package com.logpm.report.mapper.largeScreen; + +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface TrunkDataMapper { + public Integer getTotal(String startTime, String endTime); + public Integer getOnTheWay(); + public Integer getArrival(String startTime, String endTime); +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/TrunkDataMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/TrunkDataMapper.xml new file mode 100644 index 000000000..f10b15961 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/TrunkDataMapper.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/IBusinessRationService.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/IBusinessRationService.java new file mode 100644 index 000000000..d33922e45 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/IBusinessRationService.java @@ -0,0 +1,8 @@ +package com.logpm.report.service.largeScreen; + +import com.logpm.report.vo.largeScreen.BusinessRatioDataVO; + +public interface IBusinessRationService { + + BusinessRatioDataVO getBusinessRatioData(); +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/ICarsLoadDataService.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/ICarsLoadDataService.java index 6e27b53dd..521ffe3ef 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/ICarsLoadDataService.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/ICarsLoadDataService.java @@ -11,5 +11,5 @@ import java.util.List; public interface ICarsLoadDataService { - public List getCareerLineData(); + public List getCareerLineData(Integer isDelivery); } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/IDeliveryDataService.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/IDeliveryDataService.java new file mode 100644 index 000000000..6a3027aef --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/IDeliveryDataService.java @@ -0,0 +1,8 @@ +package com.logpm.report.service.largeScreen; + + +import com.logpm.report.vo.largeScreen.DeliveryDataVO; + +public interface IDeliveryDataService { + DeliveryDataVO getDeliveryAllData(Integer isYear); +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/ITrunkDataService.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/ITrunkDataService.java new file mode 100644 index 000000000..51e4a7a12 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/ITrunkDataService.java @@ -0,0 +1,8 @@ +package com.logpm.report.service.largeScreen; + +import com.logpm.report.vo.largeScreen.TrunkDataVO; + +public interface ITrunkDataService { + + public TrunkDataVO getTrunkData(); +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BusinessRationServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BusinessRationServiceImpl.java new file mode 100644 index 000000000..cc5424380 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BusinessRationServiceImpl.java @@ -0,0 +1,31 @@ +package com.logpm.report.service.largeScreen.impl; + +import com.logpm.report.mapper.largeScreen.BusinessRatioMapper; +import com.logpm.report.service.largeScreen.IBusinessRationService; +import com.logpm.report.vo.largeScreen.BusinessRatioDataVO; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +@AllArgsConstructor +@Service +@Log4j2 +public class BusinessRationServiceImpl implements IBusinessRationService { + + private final BusinessRatioMapper businessRatioMapper; + + @Override + public BusinessRatioDataVO getBusinessRatioData() { + String startTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-01-01 00:00:00")); + String endTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-12-31 23:59:59")); + + BusinessRatioDataVO businessRatioDataVO = new BusinessRatioDataVO(); + businessRatioDataVO.setType(businessRatioMapper.getTypeData(startTime, endTime)); + businessRatioDataVO.setBrand(businessRatioMapper.getBrandData(startTime, endTime)); + + return businessRatioDataVO; + } +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/CarsLoadDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/CarsLoadDataServiceImpl.java index afd07cc70..c6420ea7e 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/CarsLoadDataServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/CarsLoadDataServiceImpl.java @@ -24,17 +24,19 @@ public class CarsLoadDataServiceImpl implements ICarsLoadDataService { private CarsLoadDataMapper carsLoadDataMapper; @Override - public List getCareerLineData() { + public List getCareerLineData(Integer isDelivery) { Map careerLineMap = analysisCareerLineByDept(carsLoadDataMapper.getDeptInfo()); Map warehouseDept = carsLoadDataMapper.getWarehouseDept().stream() .filter(WarehouseDeptVO -> WarehouseDeptVO.getDept() != null) .collect(Collectors.toMap(WarehouseDeptVO::getWarehouseId, WarehouseDeptVO::getDept)); - List vehicleStowageData = carsLoadDataMapper.getVehicleStowageData( - LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-01-01 00:00:00")), - LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-12-31 23:59:59")) - ); + String startTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-01-01 00:00:00")); + String endTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-12-31 23:59:59")); + List vehicleStowageData = isDelivery.equals(1) + ? carsLoadDataMapper.getDeliveryData(startTime, endTime) + : carsLoadDataMapper.getVehicleStowageData(startTime, endTime); + HashMap resultMap = new HashMap<>(); for (VehicleStowageDataVO vehicleStowageDataVO : vehicleStowageData) { diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/DeliveryDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/DeliveryDataServiceImpl.java new file mode 100644 index 000000000..d3de4f0e6 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/DeliveryDataServiceImpl.java @@ -0,0 +1,45 @@ +package com.logpm.report.service.largeScreen.impl; + +import com.logpm.report.mapper.largeScreen.DeliveryDataMapper; +import com.logpm.report.service.largeScreen.IDeliveryDataService; +import com.logpm.report.vo.largeScreen.DeliveryDataVO; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +@AllArgsConstructor +@Service +@Log4j2 +public class DeliveryDataServiceImpl implements IDeliveryDataService { + + private final DeliveryDataMapper deliveryDataMapper; + + @Override + public DeliveryDataVO getDeliveryAllData(Integer isYear) { + + DeliveryDataVO deliveryDataVO = new DeliveryDataVO(); + String startTime = isYear.equals(1) ? LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-01-01 00:00:00")) : null; + String endTime = isYear.equals(1) ? LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-12-31 23:59:59")) : null; + + DeliveryDataVO deliveryAllData = deliveryDataMapper.getDeliveryAllData(startTime, endTime); + DeliveryDataVO delivery2CData = deliveryDataMapper.getDelivery2CData(startTime, endTime); + DeliveryDataVO delivery2BData = deliveryDataMapper.getDelivery2BData(startTime, endTime); + + deliveryDataVO.setTotal(deliveryAllData.getTotal()); + deliveryDataVO.setToBeSigned(deliveryAllData.getToBeSigned()); + deliveryDataVO.setSigned(deliveryAllData.getTotal() - deliveryAllData.getToBeSigned()); + + deliveryDataVO.setTotal2B(delivery2BData.getTotal2B()); + deliveryDataVO.setToBeSigned2B(delivery2BData.getToBeSigned2B()); + deliveryDataVO.setSigned2B(delivery2BData.getTotal2B() - delivery2BData.getToBeSigned2B()); + + deliveryDataVO.setTotal2C(delivery2CData.getTotal2C()); + deliveryDataVO.setToBeSigned2C(delivery2CData.getToBeSigned2C()); + deliveryDataVO.setSigned2C(delivery2CData.getTotal2C() - delivery2CData.getToBeSigned2C()); + + return deliveryDataVO; + } +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/TrunkDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/TrunkDataServiceImpl.java new file mode 100644 index 000000000..65159ab61 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/TrunkDataServiceImpl.java @@ -0,0 +1,33 @@ +package com.logpm.report.service.largeScreen.impl; + +import com.logpm.report.mapper.largeScreen.TrunkDataMapper; +import com.logpm.report.service.largeScreen.ITrunkDataService; +import com.logpm.report.vo.largeScreen.TrunkDataVO; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + + +@AllArgsConstructor +@Service +@Log4j2 +public class TrunkDataServiceImpl implements ITrunkDataService { + + private final TrunkDataMapper trunkDataMapper; + + @Override + public TrunkDataVO getTrunkData() { + String startTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-01-01 00:00:00")); + String endTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-12-31 23:59:59")); + + TrunkDataVO trunkDataVO = new TrunkDataVO(); + trunkDataVO.setTotal(trunkDataMapper.getTotal(startTime, endTime)); + trunkDataVO.setOnTheWay(trunkDataMapper.getOnTheWay()); + trunkDataVO.setArrival(trunkDataMapper.getArrival(startTime, endTime)); + + return trunkDataVO; + } +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/BusinessRatio/ItemDataVO.java b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/BusinessRatio/ItemDataVO.java new file mode 100644 index 000000000..afb3999d1 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/BusinessRatio/ItemDataVO.java @@ -0,0 +1,11 @@ +package com.logpm.report.vo.largeScreen.BusinessRatio; + + +import lombok.Data; + +@Data +public class ItemDataVO { + private String name; + + private Integer value; +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/BusinessRatioDataVO.java b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/BusinessRatioDataVO.java new file mode 100644 index 000000000..3be043f3f --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/BusinessRatioDataVO.java @@ -0,0 +1,14 @@ +package com.logpm.report.vo.largeScreen; + +import com.logpm.report.vo.largeScreen.BusinessRatio.ItemDataVO; +import lombok.Data; + +import java.util.List; + +@Data +public class BusinessRatioDataVO { + + private List type; + + private List brand; +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/DeliveryDataVO.java b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/DeliveryDataVO.java index f2a7e28d6..f4f5fa3ce 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/DeliveryDataVO.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/DeliveryDataVO.java @@ -11,4 +11,37 @@ public class DeliveryDataVO { /** * 配送总数 */ + private Integer total; + /** + * 待签数 + */ + private Integer toBeSigned; + /** + * 已签数 + */ + private Integer signed; + /** + * 2B总数 + */ + private Integer total2B; + /** + * 2B已签数 + */ + private Integer signed2B; + /** + * 2B待签数 + */ + private Integer toBeSigned2B; + /** + * 2C总数 + */ + private Integer total2C; + /** + * 2C已签数 + */ + private Integer signed2C; + /** + * 2C待签数 + */ + private Integer toBeSigned2C; } From a52cfac5888e2c19b3d17a823d1a8dc3294b962f Mon Sep 17 00:00:00 2001 From: chenlong Date: Fri, 20 Dec 2024 15:34:13 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E7=9A=84xxljob?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/entity/LargeScreenDataEntity.java | 41 +++++++++++ blade-service/logpm-report/pom.xml | 4 ++ .../controller/LargeScreenController.java | 34 ++++++++- .../report/job/LargeScreenQueryXxlJob.java | 70 +++++++++++++++++++ .../largeScreen/LargeScreenDataMapper.java | 10 +++ .../httpImpl/BillingDataServiceImpl.java | 63 +++++++++++++++++ .../httpImpl/BinLocationServiceImpl.java | 32 +++++++++ .../httpImpl/BusinessRationServiceImpl.java | 34 +++++++++ .../httpImpl/CarsLoadDataServiceImpl.java | 48 +++++++++++++ .../httpImpl/DeliveryDataServiceImpl.java | 38 ++++++++++ .../httpImpl/MapWarehouseServiceImpl.java | 42 +++++++++++ .../httpImpl/NodeDataServiceImpl.java | 32 +++++++++ .../httpImpl/TrunkDataServiceImpl.java | 37 ++++++++++ .../impl/BillingDataServiceImpl.java | 4 +- .../impl/BinLocationServiceImpl.java | 2 + .../impl/BusinessRationServiceImpl.java | 2 + .../impl/CarsLoadDataServiceImpl.java | 2 + .../impl/DeliveryDataServiceImpl.java | 2 + .../impl/MapWarehouseServiceImpl.java | 2 + .../largeScreen/impl/NodeDataServiceImpl.java | 2 + .../impl/TrunkDataServiceImpl.java | 2 + .../report/vo/largeScreen/XxlJobQueryVO.java | 66 +++++++++++++++++ 22 files changed, 567 insertions(+), 2 deletions(-) create mode 100644 blade-service-api/logpm-report-api/src/main/java/com/logpm/report/entity/LargeScreenDataEntity.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/job/LargeScreenQueryXxlJob.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/LargeScreenDataMapper.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/BillingDataServiceImpl.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/BinLocationServiceImpl.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/BusinessRationServiceImpl.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/CarsLoadDataServiceImpl.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/DeliveryDataServiceImpl.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/MapWarehouseServiceImpl.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/NodeDataServiceImpl.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/TrunkDataServiceImpl.java create mode 100644 blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/XxlJobQueryVO.java diff --git a/blade-service-api/logpm-report-api/src/main/java/com/logpm/report/entity/LargeScreenDataEntity.java b/blade-service-api/logpm-report-api/src/main/java/com/logpm/report/entity/LargeScreenDataEntity.java new file mode 100644 index 000000000..a5504d82a --- /dev/null +++ b/blade-service-api/logpm-report-api/src/main/java/com/logpm/report/entity/LargeScreenDataEntity.java @@ -0,0 +1,41 @@ +package com.logpm.report.entity; + + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tenant.mp.TenantEntity; + +import java.util.Map; + +@Data +@TableName("logpm_large_screen_data") +@EqualsAndHashCode(callSuper = true) +@AllArgsConstructor +public class LargeScreenDataEntity extends TenantEntity { + + /** 预留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 ; + + @ApiModelProperty(name = "数据",notes = "") + private Map data; + + public LargeScreenDataEntity(Map data) { + this.data = data; + } +} diff --git a/blade-service/logpm-report/pom.xml b/blade-service/logpm-report/pom.xml index 0fcdb9ef7..ae7ed3676 100644 --- a/blade-service/logpm-report/pom.xml +++ b/blade-service/logpm-report/pom.xml @@ -48,6 +48,10 @@ logpm-factory-data-api 3.2.0.RELEASE + + com.xuxueli + xxl-job-core + diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java index 7367ed19a..ee89b4b2e 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java @@ -9,18 +9,19 @@ import lombok.AllArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springblade.core.tool.api.R; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.data.repository.query.Param; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import javax.annotation.Resource; import java.util.List; @RestController @RequestMapping("/largeScreen") @Api(value = "大屏数据", tags = "大屏数据") -@AllArgsConstructor public class LargeScreenController{ private static final Logger log = LoggerFactory.getLogger(LargeScreenController.class); @@ -33,6 +34,37 @@ public class LargeScreenController{ private final IDeliveryDataService deliveryDataService; private final IBusinessRationService businessRatio; + + public LargeScreenController( + // 正式使用是使用这个 +// @Qualifier(value = "mapWarehouseServiceHttp") IMapWarehouseService mapWarehouseService, +// @Qualifier(value = "billingDataServiceHttp") IBillingDataService billingDataService, +// @Qualifier(value = "carsLoadDataServiceHttp") ICarsLoadDataService carsLoadDataService, +// @Qualifier(value = "nodeDataServiceHttp") INodeDataService nodeData, +// @Qualifier(value = "binLocationServiceHttp") IBinLocationService binLocation, +// @Qualifier(value = "trunkDataServiceHttp") ITrunkDataService trunkData, +// @Qualifier(value = "deliveryDataServiceHttp") IDeliveryDataService deliveryDataService, +// @Qualifier(value = "businessRationServiceHttp") IBusinessRationService businessRatio + IMapWarehouseService mapWarehouseService, + IBillingDataService billingDataService, + ICarsLoadDataService carsLoadDataService, + INodeDataService nodeData, + IBinLocationService binLocation, + ITrunkDataService trunkData, + IDeliveryDataService deliveryDataService, + IBusinessRationService businessRatio + ) { + this.mapWarehouseService = mapWarehouseService; + this.billingDataService = billingDataService; + this.CarsLoad = carsLoadDataService; + this.nodeData = nodeData; + this.BinLocation = binLocation; + this.trunkData = trunkData; + this.deliveryDataService = deliveryDataService; + this.businessRatio = businessRatio; + } + + /** * 地图仓库数据 */ diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/job/LargeScreenQueryXxlJob.java b/blade-service/logpm-report/src/main/java/com/logpm/report/job/LargeScreenQueryXxlJob.java new file mode 100644 index 000000000..39a5bfd99 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/job/LargeScreenQueryXxlJob.java @@ -0,0 +1,70 @@ +package com.logpm.report.job; + + +import com.logpm.report.entity.LargeScreenDataEntity; +import com.logpm.report.mapper.largeScreen.LargeScreenDataMapper; +import com.logpm.report.service.largeScreen.*; +import com.logpm.report.vo.largeScreen.XxlJobQueryVO; +import com.xxl.job.core.handler.annotation.XxlJob; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Component; + +import java.util.HashMap; + +/** + * 大屏数据查询job + */ +@AllArgsConstructor +@Component +@Log4j2 +public class LargeScreenQueryXxlJob { + + private final IMapWarehouseService mapWarehouseService; + private final IBillingDataService billingDataService; + private final ICarsLoadDataService CarsLoad; + private final INodeDataService nodeData; + private final IBinLocationService BinLocation; + private final ITrunkDataService trunkData; + private final IDeliveryDataService deliveryDataService; + private final IBusinessRationService businessRatio; + + private final LargeScreenDataMapper largeScreenDataMapper; + + /** + * 数据查询 + */ + @XxlJob("LargeScreenQuery") + public void query() + { + XxlJobQueryVO xxlJobQueryVO = new XxlJobQueryVO(); + xxlJobQueryVO.setMapWarehouse(mapWarehouseService.list()); + xxlJobQueryVO.setBillingData(billingDataService.getBillingData()); + xxlJobQueryVO.setCareerLineDeliveryData(CarsLoad.getCareerLineData(1)); + xxlJobQueryVO.setCareerLineData(CarsLoad.getCareerLineData(0)); + xxlJobQueryVO.setNodeData(nodeData.getNodeData()); + xxlJobQueryVO.setBinLocationData(BinLocation.getBinLocationData()); + xxlJobQueryVO.setTrunkData(trunkData.getTrunkData()); + xxlJobQueryVO.setDeliveryData(deliveryDataService.getDeliveryAllData(0)); + xxlJobQueryVO.setDeliveryYearData(deliveryDataService.getDeliveryAllData(1)); + xxlJobQueryVO.setBusinessRatio(businessRatio.getBusinessRatioData()); + xxlJobQueryVO.setWarehouseBillingData(billingDataService.getWarehouseBillingData()); + xxlJobQueryVO.setMonthBillingData(billingDataService.getMonthBillingData()); + + HashMap data = new HashMap<>(); + data.put("mapWarehouse", xxlJobQueryVO.getMapWarehouse()); + data.put("billingData", xxlJobQueryVO.getBillingData()); + data.put("warehouseBillingData", xxlJobQueryVO.getWarehouseBillingData()); + data.put("monthBillingData", xxlJobQueryVO.getMonthBillingData()); + data.put("careerLineData", xxlJobQueryVO.getCareerLineData()); + data.put("careerLineDeliveryData", xxlJobQueryVO.getCareerLineDeliveryData()); + data.put("nodeData", xxlJobQueryVO.getNodeData()); + data.put("binLocationData", xxlJobQueryVO.getBinLocationData()); + data.put("trunkData", xxlJobQueryVO.getTrunkData()); + data.put("deliveryData", xxlJobQueryVO.getDeliveryData()); + data.put("deliveryYearData", xxlJobQueryVO.getDeliveryYearData()); + data.put("businessRatio", xxlJobQueryVO.getBusinessRatio()); + + largeScreenDataMapper.insert(new LargeScreenDataEntity(data)); + } +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/LargeScreenDataMapper.java b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/LargeScreenDataMapper.java new file mode 100644 index 000000000..dbf06b11d --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/LargeScreenDataMapper.java @@ -0,0 +1,10 @@ +package com.logpm.report.mapper.largeScreen; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.logpm.report.entity.LargeScreenDataEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface LargeScreenDataMapper extends BaseMapper { + +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/BillingDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/BillingDataServiceImpl.java new file mode 100644 index 000000000..199f082f7 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/BillingDataServiceImpl.java @@ -0,0 +1,63 @@ +package com.logpm.report.service.largeScreen.httpImpl; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.logpm.report.entity.LargeScreenDataEntity; +import com.logpm.report.mapper.largeScreen.BillingDataMapper; +import com.logpm.report.mapper.largeScreen.LargeScreenDataMapper; +import com.logpm.report.mapper.largeScreen.MapWarehouseMapper; +import com.logpm.report.service.largeScreen.IBillingDataService; +import com.logpm.report.vo.largeScreen.BillingDataVO; +import com.logpm.report.vo.largeScreen.MapWarehouse.WarehouseInfoVO; +import com.logpm.report.vo.largeScreen.MonthBillingDataVO; +import com.logpm.report.vo.largeScreen.WarehouseBillingDataVO; +import com.logpm.report.vo.largeScreen.XxlJobQueryVO; +import com.logpm.report.vo.largeScreen.billingData.BillingDataInfoVO; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Service("billingDataServiceHttp") +@Log4j2 +@AllArgsConstructor +public class BillingDataServiceImpl implements IBillingDataService { + + private final LargeScreenDataMapper largeScreenDataMapper; + + @Override + public BillingDataVO getBillingData() { + + LargeScreenDataEntity largeScreenDataEntity = largeScreenDataMapper.selectOne(Wrappers.lambdaQuery().orderByDesc(LargeScreenDataEntity::getCreateTime)); + + XxlJobQueryVO init = XxlJobQueryVO.init(largeScreenDataEntity.getData()); + + return init.getBillingData(); + } + + @Override + public List getWarehouseBillingData() { + LargeScreenDataEntity largeScreenDataEntity = largeScreenDataMapper.selectOne(Wrappers.lambdaQuery().orderByDesc(LargeScreenDataEntity::getCreateTime)); + + XxlJobQueryVO init = XxlJobQueryVO.init(largeScreenDataEntity.getData()); + + return init.getWarehouseBillingData(); + } + + @Override + public List getMonthBillingData() { + LargeScreenDataEntity largeScreenDataEntity = largeScreenDataMapper.selectOne(Wrappers.lambdaQuery().orderByDesc(LargeScreenDataEntity::getCreateTime)); + + if (largeScreenDataEntity == null) { + return new ArrayList<>(); + } + XxlJobQueryVO init = XxlJobQueryVO.init(largeScreenDataEntity.getData()); + + return init.getMonthBillingData(); + } +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/BinLocationServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/BinLocationServiceImpl.java new file mode 100644 index 000000000..8ad9f44e8 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/BinLocationServiceImpl.java @@ -0,0 +1,32 @@ +package com.logpm.report.service.largeScreen.httpImpl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.logpm.report.entity.LargeScreenDataEntity; +import com.logpm.report.mapper.largeScreen.BinLocationMapper; +import com.logpm.report.mapper.largeScreen.LargeScreenDataMapper; +import com.logpm.report.service.largeScreen.IBinLocationService; +import com.logpm.report.vo.largeScreen.BinLocationDataVO; +import com.logpm.report.vo.largeScreen.XxlJobQueryVO; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + + +@AllArgsConstructor +@Service("binLocationServiceHttp") +@Log4j2 +public class BinLocationServiceImpl implements IBinLocationService { + private final LargeScreenDataMapper largeScreenDataMapper; + + public BinLocationDataVO getBinLocationData() { + + LargeScreenDataEntity largeScreenDataEntity = largeScreenDataMapper.selectOne(Wrappers.lambdaQuery().orderByDesc(LargeScreenDataEntity::getCreateTime)); + + if (largeScreenDataEntity == null) { + return new BinLocationDataVO(); + } + XxlJobQueryVO init = XxlJobQueryVO.init(largeScreenDataEntity.getData()); + + return init.getBinLocationData(); + } +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/BusinessRationServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/BusinessRationServiceImpl.java new file mode 100644 index 000000000..d0d58f29b --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/BusinessRationServiceImpl.java @@ -0,0 +1,34 @@ +package com.logpm.report.service.largeScreen.httpImpl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.logpm.report.entity.LargeScreenDataEntity; +import com.logpm.report.mapper.largeScreen.BusinessRatioMapper; +import com.logpm.report.mapper.largeScreen.LargeScreenDataMapper; +import com.logpm.report.service.largeScreen.IBusinessRationService; +import com.logpm.report.vo.largeScreen.BusinessRatioDataVO; +import com.logpm.report.vo.largeScreen.XxlJobQueryVO; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +@AllArgsConstructor +@Service("businessRationServiceHttp") +@Log4j2 +public class BusinessRationServiceImpl implements IBusinessRationService { + + private final LargeScreenDataMapper largeScreenDataMapper; + + @Override + public BusinessRatioDataVO getBusinessRatioData() { + LargeScreenDataEntity largeScreenDataEntity = largeScreenDataMapper.selectOne(Wrappers.lambdaQuery().orderByDesc(LargeScreenDataEntity::getCreateTime)); + if (largeScreenDataEntity == null) { + return new BusinessRatioDataVO(); + } + XxlJobQueryVO init = XxlJobQueryVO.init(largeScreenDataEntity.getData()); + + return init.getBusinessRatio(); + } +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/CarsLoadDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/CarsLoadDataServiceImpl.java new file mode 100644 index 000000000..1cf7df6eb --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/CarsLoadDataServiceImpl.java @@ -0,0 +1,48 @@ +package com.logpm.report.service.largeScreen.httpImpl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.logpm.report.entity.LargeScreenDataEntity; +import com.logpm.report.mapper.largeScreen.CarsLoadDataMapper; +import com.logpm.report.mapper.largeScreen.LargeScreenDataMapper; +import com.logpm.report.service.largeScreen.ICarsLoadDataService; +import com.logpm.report.vo.largeScreen.CareerLineData.DeptInfoVO; +import com.logpm.report.vo.largeScreen.CareerLineData.VehicleStowageDataVO; +import com.logpm.report.vo.largeScreen.CareerLineData.VehicleStowageMonthDataVo; +import com.logpm.report.vo.largeScreen.CareerLineData.WarehouseDeptVO; +import com.logpm.report.vo.largeScreen.CareerLineDataVO; +import com.logpm.report.vo.largeScreen.XxlJobQueryVO; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@AllArgsConstructor +@Service("carsLoadDataServiceHttp") +@Log4j2 +public class CarsLoadDataServiceImpl implements ICarsLoadDataService { + + + private final LargeScreenDataMapper largeScreenDataMapper; + + @Override + public List getCareerLineData(Integer isDelivery) { + LargeScreenDataEntity largeScreenDataEntity = largeScreenDataMapper.selectOne(Wrappers.lambdaQuery().orderByDesc(LargeScreenDataEntity::getCreateTime)); + + if (largeScreenDataEntity == null) { + return new ArrayList<>(); + } + + XxlJobQueryVO init = XxlJobQueryVO.init(largeScreenDataEntity.getData()); + + return isDelivery.equals(1) + ? init.getCareerLineDeliveryData() + : init.getCareerLineData(); + } +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/DeliveryDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/DeliveryDataServiceImpl.java new file mode 100644 index 000000000..262f30952 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/DeliveryDataServiceImpl.java @@ -0,0 +1,38 @@ +package com.logpm.report.service.largeScreen.httpImpl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.logpm.report.entity.LargeScreenDataEntity; +import com.logpm.report.mapper.largeScreen.DeliveryDataMapper; +import com.logpm.report.mapper.largeScreen.LargeScreenDataMapper; +import com.logpm.report.service.largeScreen.IDeliveryDataService; +import com.logpm.report.vo.largeScreen.DeliveryDataVO; +import com.logpm.report.vo.largeScreen.XxlJobQueryVO; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +@AllArgsConstructor +@Service("deliveryDataServiceHttp") +@Log4j2 +public class DeliveryDataServiceImpl implements IDeliveryDataService { + + private final LargeScreenDataMapper largeScreenDataMapper; + + @Override + public DeliveryDataVO getDeliveryAllData(Integer isYear) { + LargeScreenDataEntity largeScreenDataEntity = largeScreenDataMapper.selectOne(Wrappers.lambdaQuery().orderByDesc(LargeScreenDataEntity::getCreateTime)); + + if (largeScreenDataEntity == null) { + return new DeliveryDataVO(); + } + + XxlJobQueryVO init = XxlJobQueryVO.init(largeScreenDataEntity.getData()); + + return isYear.equals(1) + ? init.getDeliveryYearData() + : init.getDeliveryData(); + } +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/MapWarehouseServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/MapWarehouseServiceImpl.java new file mode 100644 index 000000000..a6e2fb633 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/MapWarehouseServiceImpl.java @@ -0,0 +1,42 @@ +package com.logpm.report.service.largeScreen.httpImpl; + + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.logpm.report.entity.LargeScreenDataEntity; +import com.logpm.report.mapper.largeScreen.LargeScreenDataMapper; +import com.logpm.report.mapper.largeScreen.MapWarehouseMapper; +import com.logpm.report.service.largeScreen.IMapWarehouseService; +import com.logpm.report.vo.largeScreen.MapWarehouse.LineInfoVO; +import com.logpm.report.vo.largeScreen.MapWarehouse.WarehouseInfoVO; +import com.logpm.report.vo.largeScreen.MapWarehouseVO; +import com.logpm.report.vo.largeScreen.XxlJobQueryVO; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@AllArgsConstructor +@Service("mapWarehouseServiceHttp") +@Slf4j +public class MapWarehouseServiceImpl implements IMapWarehouseService { + + private final LargeScreenDataMapper largeScreenDataMapper; + + @Override + public List list() { + LargeScreenDataEntity largeScreenDataEntity = largeScreenDataMapper.selectOne(Wrappers.lambdaQuery().orderByDesc(LargeScreenDataEntity::getCreateTime)); + + if (largeScreenDataEntity == null) { + return new ArrayList<>(); + } + XxlJobQueryVO init = XxlJobQueryVO.init(largeScreenDataEntity.getData()); + + return init.getMapWarehouse(); + } +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/NodeDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/NodeDataServiceImpl.java new file mode 100644 index 000000000..d25bfd48d --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/NodeDataServiceImpl.java @@ -0,0 +1,32 @@ +package com.logpm.report.service.largeScreen.httpImpl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.logpm.report.entity.LargeScreenDataEntity; +import com.logpm.report.mapper.largeScreen.LargeScreenDataMapper; +import com.logpm.report.service.largeScreen.INodeDataService; +import com.logpm.report.vo.largeScreen.NodeDataVO; +import com.logpm.report.vo.largeScreen.XxlJobQueryVO; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +@AllArgsConstructor +@Log4j2 +@Service("nodeDataServiceHttp") +public class NodeDataServiceImpl implements INodeDataService { + + private final LargeScreenDataMapper largeScreenDataMapper; + + @Override + public NodeDataVO getNodeData() { + + LargeScreenDataEntity largeScreenDataEntity = largeScreenDataMapper.selectOne(Wrappers.lambdaQuery().orderByDesc(LargeScreenDataEntity::getCreateTime)); + + if (largeScreenDataEntity == null) { + return new NodeDataVO(); + } + XxlJobQueryVO init = XxlJobQueryVO.init(largeScreenDataEntity.getData()); + + return init.getNodeData(); + } +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/TrunkDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/TrunkDataServiceImpl.java new file mode 100644 index 000000000..badb6a50a --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/httpImpl/TrunkDataServiceImpl.java @@ -0,0 +1,37 @@ +package com.logpm.report.service.largeScreen.httpImpl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.logpm.report.entity.LargeScreenDataEntity; +import com.logpm.report.mapper.largeScreen.LargeScreenDataMapper; +import com.logpm.report.mapper.largeScreen.TrunkDataMapper; +import com.logpm.report.service.largeScreen.ITrunkDataService; +import com.logpm.report.vo.largeScreen.TrunkDataVO; +import com.logpm.report.vo.largeScreen.XxlJobQueryVO; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + + +@AllArgsConstructor +@Service("trunkDataServiceHttp") +@Log4j2 +public class TrunkDataServiceImpl implements ITrunkDataService { + + private final LargeScreenDataMapper largeScreenDataMapper; + + @Override + public TrunkDataVO getTrunkData() { + LargeScreenDataEntity largeScreenDataEntity = largeScreenDataMapper.selectOne(Wrappers.lambdaQuery().orderByDesc(LargeScreenDataEntity::getCreateTime)); + + if (largeScreenDataEntity == null) { + return new TrunkDataVO(); + } + + XxlJobQueryVO init = XxlJobQueryVO.init(largeScreenDataEntity.getData()); + + return init.getTrunkData(); + } +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BillingDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BillingDataServiceImpl.java index 8d58d7977..b5e8ffedf 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BillingDataServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BillingDataServiceImpl.java @@ -11,14 +11,16 @@ import com.logpm.report.vo.largeScreen.WarehouseBillingDataVO; import com.logpm.report.vo.largeScreen.billingData.BillingDataInfoVO; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; +import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; import java.util.*; import java.util.stream.Collectors; -@Service +@Service("张三") @Log4j2 @AllArgsConstructor +@Primary public class BillingDataServiceImpl implements IBillingDataService { private final BillingDataMapper billingDataMapper; diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BinLocationServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BinLocationServiceImpl.java index cb062aad8..3dfabd14e 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BinLocationServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BinLocationServiceImpl.java @@ -5,12 +5,14 @@ import com.logpm.report.service.largeScreen.IBinLocationService; import com.logpm.report.vo.largeScreen.BinLocationDataVO; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; +import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; @AllArgsConstructor @Service @Log4j2 +@Primary public class BinLocationServiceImpl implements IBinLocationService { private BinLocationMapper binLocationMapper; diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BusinessRationServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BusinessRationServiceImpl.java index cc5424380..cbb347680 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BusinessRationServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/BusinessRationServiceImpl.java @@ -5,6 +5,7 @@ import com.logpm.report.service.largeScreen.IBusinessRationService; import com.logpm.report.vo.largeScreen.BusinessRatioDataVO; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; +import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; import java.time.LocalDateTime; @@ -13,6 +14,7 @@ import java.time.format.DateTimeFormatter; @AllArgsConstructor @Service @Log4j2 +@Primary public class BusinessRationServiceImpl implements IBusinessRationService { private final BusinessRatioMapper businessRatioMapper; diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/CarsLoadDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/CarsLoadDataServiceImpl.java index c6420ea7e..63b49af0f 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/CarsLoadDataServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/CarsLoadDataServiceImpl.java @@ -9,6 +9,7 @@ import com.logpm.report.vo.largeScreen.CareerLineData.WarehouseDeptVO; import com.logpm.report.vo.largeScreen.CareerLineDataVO; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; +import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; import java.time.LocalDate; @@ -19,6 +20,7 @@ import java.util.stream.Collectors; @AllArgsConstructor @Service @Log4j2 +@Primary public class CarsLoadDataServiceImpl implements ICarsLoadDataService { private CarsLoadDataMapper carsLoadDataMapper; diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/DeliveryDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/DeliveryDataServiceImpl.java index d3de4f0e6..6c377e7dc 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/DeliveryDataServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/DeliveryDataServiceImpl.java @@ -5,6 +5,7 @@ import com.logpm.report.service.largeScreen.IDeliveryDataService; import com.logpm.report.vo.largeScreen.DeliveryDataVO; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; +import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; import java.time.LocalDateTime; @@ -13,6 +14,7 @@ import java.time.format.DateTimeFormatter; @AllArgsConstructor @Service @Log4j2 +@Primary public class DeliveryDataServiceImpl implements IDeliveryDataService { private final DeliveryDataMapper deliveryDataMapper; diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/MapWarehouseServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/MapWarehouseServiceImpl.java index a6f177030..bca70eb7f 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/MapWarehouseServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/MapWarehouseServiceImpl.java @@ -9,6 +9,7 @@ import com.logpm.report.vo.largeScreen.MapWarehouse.WarehouseInfoVO; import com.logpm.report.vo.largeScreen.MapWarehouseVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; import java.time.LocalDate; @@ -20,6 +21,7 @@ import java.util.stream.Collectors; @AllArgsConstructor @Service @Slf4j +@Primary public class MapWarehouseServiceImpl implements IMapWarehouseService { private final MapWarehouseMapper mapWarehouseMapper; diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/NodeDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/NodeDataServiceImpl.java index 39af61d94..62afaecb9 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/NodeDataServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/NodeDataServiceImpl.java @@ -5,6 +5,7 @@ import com.logpm.report.service.largeScreen.INodeDataService; import com.logpm.report.vo.largeScreen.NodeDataVO; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; +import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; import java.time.LocalDateTime; @@ -13,6 +14,7 @@ import java.time.format.DateTimeFormatter; @AllArgsConstructor @Log4j2 @Service +@Primary public class NodeDataServiceImpl implements INodeDataService { private final NodeDataMapper nodeDataMapper; diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/TrunkDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/TrunkDataServiceImpl.java index 65159ab61..c88b4295b 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/TrunkDataServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/largeScreen/impl/TrunkDataServiceImpl.java @@ -5,6 +5,7 @@ import com.logpm.report.service.largeScreen.ITrunkDataService; import com.logpm.report.vo.largeScreen.TrunkDataVO; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; +import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; import java.time.LocalDateTime; @@ -14,6 +15,7 @@ import java.time.format.DateTimeFormatter; @AllArgsConstructor @Service @Log4j2 +@Primary public class TrunkDataServiceImpl implements ITrunkDataService { private final TrunkDataMapper trunkDataMapper; diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/XxlJobQueryVO.java b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/XxlJobQueryVO.java new file mode 100644 index 000000000..606a7c97d --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/largeScreen/XxlJobQueryVO.java @@ -0,0 +1,66 @@ +package com.logpm.report.vo.largeScreen; + +import lombok.Data; + +import java.util.List; +import java.util.Map; + +@Data +public class XxlJobQueryVO { + List mapWarehouse; + BillingDataVO billingData; + List warehouseBillingData; + List monthBillingData; + List careerLineData; + List careerLineDeliveryData; + NodeDataVO nodeData; + BinLocationDataVO binLocationData; + TrunkDataVO trunkData; + DeliveryDataVO deliveryData; + DeliveryDataVO deliveryYearData; + BusinessRatioDataVO businessRatio; + + public static XxlJobQueryVO init(Map data){ + XxlJobQueryVO xxlJobQueryVO = new XxlJobQueryVO(); + data.forEach((k,v) -> { + if (k.equals("mapWarehouse")) { + xxlJobQueryVO.setMapWarehouse((List) v); + } + if (k.equals("billingData")) { + xxlJobQueryVO.setBillingData((BillingDataVO) v); + } + if (k.equals("warehouseBillingData")) { + xxlJobQueryVO.setWarehouseBillingData((List) v); + } + if (k.equals("monthBillingData")) { + xxlJobQueryVO.setMonthBillingData((List) v); + } + if (k.equals("careerLineData")) { + xxlJobQueryVO.setCareerLineData((List) v); + } + if (k.equals("careerLineDeliveryData")) { + xxlJobQueryVO.setCareerLineDeliveryData((List) v); + } + if (k.equals("nodeData")) { + xxlJobQueryVO.setNodeData((NodeDataVO) v); + } + if (k.equals("binLocationData")) { + xxlJobQueryVO.setBinLocationData((BinLocationDataVO) v); + } + if (k.equals("trunkData")) { + xxlJobQueryVO.setTrunkData((TrunkDataVO) v); + } + if (k.equals("deliveryData")) { + xxlJobQueryVO.setDeliveryData((DeliveryDataVO) v); + } + if (k.equals("deliveryYearData")) { + xxlJobQueryVO.setDeliveryYearData((DeliveryDataVO) v); + } + if (k.equals("businessRatio")) { + xxlJobQueryVO.setBusinessRatio((BusinessRatioDataVO) v); + } + }); + + return xxlJobQueryVO; + } +} From c6a11e3fce8f0a581f826f5b2118dad07661748a Mon Sep 17 00:00:00 2001 From: chenlong Date: Mon, 6 Jan 2025 16:27:55 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/logpm/report/controller/LargeScreenController.java | 2 +- .../com/logpm/report/mapper/largeScreen/BillingDataMapper.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java index ee89b4b2e..46f3c33f8 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/LargeScreenController.java @@ -62,7 +62,7 @@ public class LargeScreenController{ this.trunkData = trunkData; this.deliveryDataService = deliveryDataService; this.businessRatio = businessRatio; - } + } /** diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BillingDataMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BillingDataMapper.xml index dff9e478a..61ada2f67 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BillingDataMapper.xml +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/largeScreen/BillingDataMapper.xml @@ -18,7 +18,7 @@ count(d.id) as value, w.destination_warehouse_id as warehouseId from logpm_platform.logpm_warehouse_waybill as w - INNER JOIN logpm_platform.logpm_trunkline_advance_detail as d on w.waybill_no = d.waybill_no + INNER JOIN logpm_platform.logpm_trunkline_advance_detail as d on w.id = d.waybill_id where w.freeze_status = 0 and w.create_time BETWEEN #{startTime} and #{endTime} group by w.destination_warehouse_id @@ -30,7 +30,7 @@ count(d.id) as value, date_format(w.create_time, '%Y-%m') as month from logpm_platform.logpm_warehouse_waybill as w - INNER JOIN logpm_platform.logpm_trunkline_advance_detail as d on w.waybill_no = d.waybill_no + INNER JOIN logpm_platform.logpm_trunkline_advance_detail as d on w.id = d.waybill_id where w.freeze_status = 0 and w.create_time BETWEEN #{startTime} and #{endTime} group by month From 2160b569b7abae7093d63527b70d09f59b2896dd Mon Sep 17 00:00:00 2001 From: zhaoqiaobo <583671871@qq.com> Date: Tue, 7 Jan 2025 11:23:33 +0800 Subject: [PATCH 5/8] =?UTF-8?q?feat(all):=20=E7=B4=A2=E8=8F=B2=E4=BA=9A?= =?UTF-8?q?=E5=B7=A5=E5=8E=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1 增加华之韵物流对接 --- .../suofeiya/service/impl/FactoryDataServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/impl/FactoryDataServiceImpl.java b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/impl/FactoryDataServiceImpl.java index 636a1c4aa..b8bfd17f5 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/impl/FactoryDataServiceImpl.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/impl/FactoryDataServiceImpl.java @@ -133,6 +133,7 @@ public class FactoryDataServiceImpl implements FactoryDataService { entity.setDeliveryNoteId(vo.getId().toString()); entity.setLogId(ObjectUtil.isNotEmpty(logId) ? logId.toString() : null); entity.setTenantCode(AuthUtil.getTenantId()); + entity.setOrderType(vo.getOrderType()); packageInfoEntities.add(entity); } packageInfoService.saveBatch(packageInfoEntities); From ff741a6117bdca4600d5e3f2f97059a8dc535ec1 Mon Sep 17 00:00:00 2001 From: zhaoqiaobo <583671871@qq.com> Date: Tue, 7 Jan 2025 16:07:34 +0800 Subject: [PATCH 6/8] =?UTF-8?q?feat(all):=20=E4=BB=93=E5=82=A8=E9=85=8D?= =?UTF-8?q?=E9=80=81=E6=88=90=E6=9C=AC=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1 修改订单维度的成本统计逻辑 --- .../constant/report/ReportConstants.java | 12 ++ .../entity/QualityDeliverEntity.java | 45 +++++ .../ExpenseDispatchOrderDetailEntity.java | 58 +++--- .../entity/ExpenseWarehouseOrderEntity.java | 34 ++-- .../feign/IExpenseDispatchClient.java | 7 + .../report/DeliverFinishReportListener.java | 54 +++++- .../report/QualityDeliverListener.java | 53 +++++- .../receiver/report/ReportListener.java | 48 +++++ .../service/IQualityDeliverService.java | 5 + .../impl/QualityDeliverServiceImpl.java | 176 ++++++++++++++++++ blade-service/logpm-statisticsdata/pom.xml | 5 + .../feign/ExpenseDispatchClient.java | 32 +++- .../com/logpm/statistics/job/ExpenseJob.java | 38 ++++ .../ExpenseDispatchOrderDetailMapper.xml | 18 +- .../ExpenseOrderWarehouseTotalMapper.xml | 18 ++ .../vo/ExpenseWarehouseOrderVO.java | 48 ++--- 16 files changed, 566 insertions(+), 85 deletions(-) diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/report/ReportConstants.java b/blade-biz-common/src/main/java/org/springblade/common/constant/report/ReportConstants.java index 0b7e79f4a..c4e448641 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/report/ReportConstants.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/report/ReportConstants.java @@ -29,5 +29,17 @@ public class ReportConstants { public static final String REPORT_QUALITY_CAR_FINAL_EXCHANGE = "report.quality.car.final.exchange" + ModuleNameConstant.DEVAUTH; public static final String REPORT_QUALITY_CAR_FINAL_QUEUE = "report.quality.car.final.queue" + ModuleNameConstant.DEVAUTH; public static final String REPORT_QUALITY_CAR_FINAL_ROUTINGKEY = "report.quality.car.final.key" + ModuleNameConstant.DEVAUTH; + /** + * 配送订单成本报表 + */ + public static final String REPORT_EXPENSE_ORDER_EXCHANGE = "report.expense.order.exchange" + ModuleNameConstant.DEVAUTH; + public static final String REPORT_EXPENSE_ORDER_QUEUE = "report.expense.order.queue" + ModuleNameConstant.DEVAUTH; + public static final String REPORT_EXPENSE_ORDER_ROUTINGKEY = "report.expense.order.key" + ModuleNameConstant.DEVAUTH; + /** + * 仓储订单成本报表 + */ + public static final String REPORT_EXPENSE_WAREHOUSE_ORDER_EXCHANGE = "report.expense.warehouse.order.exchange" + ModuleNameConstant.DEVAUTH; + public static final String REPORT_EXPENSE_WAREHOUSE_ORDER_QUEUE = "report.expense.warehouse.order.queue" + ModuleNameConstant.DEVAUTH; + public static final String REPORT_EXPENSE_WAREHOUSE_ORDER_ROUTINGKEY = "report.expense.warehouse.order.key" + ModuleNameConstant.DEVAUTH; } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java index 83a34b82c..4877d777c 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java @@ -118,6 +118,11 @@ public class QualityDeliverEntity extends TenantEntity { */ @ApiModelProperty(value = "运单发货地址") private String shipperAddress; + /** + * 发站 + */ + @ApiModelProperty(value = "发站") + private String shipperStation; /** * 运单收货单位id */ @@ -143,6 +148,11 @@ public class QualityDeliverEntity extends TenantEntity { */ @ApiModelProperty(value = "运单收货地址") private String consigneeAddress; + /** + * 到站 + */ + @ApiModelProperty(value = "到站") + private String consigneeStation; /** * 运单号 */ @@ -719,6 +729,41 @@ public class QualityDeliverEntity extends TenantEntity { */ @ApiModelProperty(value = "异动金额") private Double changeAmount; + /** + * 订单运单总数 + */ + @ApiModelProperty(value = "订单运单总数") + private Integer orderWaybillNumber; + /** + * 预留1 + */ + @ApiModelProperty(value = "预留1") + private String reserve1; + /** + * 预留2 + */ + @ApiModelProperty(value = "预留2") + private String reserve2; + /** + * 预留3 + */ + @ApiModelProperty(value = "预留3") + private String reserve3; + /** + * 预留4 + */ + @ApiModelProperty(value = "预留4") + private String reserve4; + /** + * 预留5 + */ + @ApiModelProperty(value = "预留5") + private String reserve5; + /** + * 客户服务类型 + */ + @ApiModelProperty(value = "客户服务类型") + private String customType; } diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseDispatchOrderDetailEntity.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseDispatchOrderDetailEntity.java index 54acc275d..dab85bb56 100644 --- a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseDispatchOrderDetailEntity.java +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseDispatchOrderDetailEntity.java @@ -75,8 +75,8 @@ public class ExpenseDispatchOrderDetailEntity extends TenantEntity { /** * 配送类型 */ - @ApiModelProperty(value = "配送类型") - @ExcelProperty("配送类型") + @ApiModelProperty(value = "运单类型") + @ExcelProperty("运单类型") private String waybillType; /** * 开单时间 @@ -96,12 +96,12 @@ public class ExpenseDispatchOrderDetailEntity extends TenantEntity { @ApiModelProperty(value = "复核件数") @ExcelProperty("复核件数") private Integer reviewNumber; - /** - * 结算件数 - */ - @ApiModelProperty(value = "结算件数") - @ExcelProperty("结算件数") - private Integer settlementNumber; + // /** + // * 结算件数 + // */ + // @ApiModelProperty(value = "结算件数") + // @ExcelProperty("结算件数") + // private Integer settlementNumber; /** * 总重量 */ @@ -126,12 +126,12 @@ public class ExpenseDispatchOrderDetailEntity extends TenantEntity { @ApiModelProperty(value = "配送成本") @ExcelProperty("配送成本") private Double distributionCost; - /** - * 撕标签成本 - */ - @ApiModelProperty(value = "撕标签成本") - @ExcelProperty("撕标签成本") - private Double inventoryDistributionCost; + // /** + // * 撕标签成本 + // */ + // @ApiModelProperty(value = "撕标签成本") + // @ExcelProperty("撕标签成本") + // private Double inventoryDistributionCost; /** * 上楼费成本 */ @@ -198,18 +198,18 @@ public class ExpenseDispatchOrderDetailEntity extends TenantEntity { @ApiModelProperty(value = "其他成本") @ExcelProperty("其他成本") private Double otherCosts; - /** - * 异动金额 - */ - @ApiModelProperty(value = "异动金额") - @ExcelProperty("异动金额") - private Double changeAmount; - /** - * 配送公里数 - */ - @ApiModelProperty(value = "配送公里数") - @ExcelProperty("配送公里数") - private Double deliveryKilometers; + // /** + // * 异动金额 + // */ + // @ApiModelProperty(value = "异动金额") + // @ExcelProperty("异动金额") + // private Double changeAmount; + // /** + // * 配送公里数 + // */ + // @ApiModelProperty(value = "配送公里数") + // @ExcelProperty("配送公里数") + // private Double deliveryKilometers; /** * 发货人 */ @@ -264,5 +264,11 @@ public class ExpenseDispatchOrderDetailEntity extends TenantEntity { @ApiModelProperty(value = "客户车次") @ExcelProperty("客户车次") private String customerTrip; + /** + * 复核完成时间 + */ + @ApiModelProperty(value = "复核完成时间") + @ExcelProperty("复核完成时间") + private String reviewCompletionTime; } diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseWarehouseOrderEntity.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseWarehouseOrderEntity.java index d85d558de..a82431f88 100644 --- a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseWarehouseOrderEntity.java +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseWarehouseOrderEntity.java @@ -9,8 +9,6 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.tenant.mp.TenantEntity; -import java.math.BigDecimal; - /** * 订单仓储成本报表 * @@ -60,30 +58,42 @@ public class ExpenseWarehouseOrderEntity extends TenantEntity { @ExcelProperty("发货单位") private String shippingUnit; /** - * 发站仓 + * 配送类型 */ - @ApiModelProperty(value = "发站仓") - @ExcelProperty("发站仓") - private String originWarehouse; + @ApiModelProperty(value = "运单类型") + @ExcelProperty("运单类型") + private String waybillType; /** - * 订单总件数 + * 订单运单总件数 */ - @ApiModelProperty(value = "订单总件数") - @ExcelProperty("订单总件数") + @ApiModelProperty(value = "订单运单总件数") + @ExcelProperty("订单运单总件数") private Integer totalNumber; /** * 出库件数 */ - @ApiModelProperty(value = "出库件数") - @ExcelProperty("出库件数") + @ApiModelProperty(value = "签收复核件数") + @ExcelProperty("签收复核件数") private Integer outNumber; + /** + * 发站仓 + */ + @ApiModelProperty(value = "发站仓") + @ExcelProperty("发站仓") + private String originWarehouse; /** * 租赁成本 */ @ApiModelProperty(value = "租赁成本") @ExcelProperty("租赁成本") - private BigDecimal warehouseRentalCost; + private Double warehouseRentalCost; + /** + * 复核完成时间 + */ + @ApiModelProperty(value = "复核完成时间") + @ExcelProperty("复核完成时间") + private String reviewCompletionTime; } diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/feign/IExpenseDispatchClient.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/feign/IExpenseDispatchClient.java index 13b876899..d8dd89f30 100644 --- a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/feign/IExpenseDispatchClient.java +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/feign/IExpenseDispatchClient.java @@ -1,7 +1,9 @@ package com.logpm.statistics.feign; import com.logpm.statistics.dto.ExpenseDispatchClientDTO; +import com.logpm.statistics.entity.ExpenseDispatchOrderDetailEntity; import com.logpm.statistics.entity.ExpenseDispatchTrainDetailEntity; +import com.logpm.statistics.entity.ExpenseWarehouseOrderEntity; import org.springblade.common.constant.ModuleNameConstant; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; @@ -22,4 +24,9 @@ public interface IExpenseDispatchClient { @PostMapping(API_PREFIX + "/saveTrainDetailEntity") void saveTrainDetailEntity(@RequestBody ExpenseDispatchTrainDetailEntity entity); + @PostMapping(API_PREFIX + "/saveDispatchOrderDetailEntity") + void saveDispatchOrderDetailEntity(ExpenseDispatchOrderDetailEntity orderDetailEntity); + + @PostMapping(API_PREFIX + "/saveWarehouseOrderEntity") + void saveWarehouseOrderEntity(ExpenseWarehouseOrderEntity orderDetailEntity); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java index 9ba6abb77..97a45c455 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java @@ -23,6 +23,7 @@ import com.logpm.statistics.entity.ExpenseDispatchPriceOverZoneEntity; import com.logpm.statistics.feign.IExpenseDispatchClient; import com.logpm.statistics.vo.ExpenseDispatchPriceCategoryVO; import com.logpm.statistics.vo.ExpenseDispatchPriceVO; +import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.common.constant.report.ReportConstants; @@ -37,6 +38,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Collection; import java.util.Comparator; import java.util.Date; import java.util.HashMap; @@ -87,6 +89,7 @@ public class DeliverFinishReportListener implements ReportService { .delay(10000) .build()); + } public void calculateTripCost(String trainNumber, String deliveryKindParam) { @@ -95,35 +98,32 @@ public class DeliverFinishReportListener implements ReportService { .eq(QualityDeliverEntity::getSignTrainNumber, trainNumber) ); if (CollUtil.isNotEmpty(entities)) { + // 按签收车分组 Map> collect = null; - if(StrUtil.isEmpty(deliveryKindParam)){ - return; - } - if(StrUtil.equals(deliveryKindParam, "自主配送")){ + if (StrUtil.equals(deliveryKindParam, "自主配送")) { collect = entities.stream() .filter(entity -> StrUtil.isNotEmpty(entity.getSignCarNumber())) .filter(entity -> ObjectUtil.isNotEmpty(entity.getSignCarId())) .collect(Collectors.groupingBy(i -> Convert.toStr(i.getSignCarId()))); } - if(StrUtil.equals(deliveryKindParam, "三方配送")){ + if (StrUtil.equals(deliveryKindParam, "三方配送")) { collect = entities.stream() .filter(entity -> StrUtil.isNotEmpty(entity.getSignCarNumber())) .collect(Collectors.groupingBy(i -> Convert.toStr(i.getSignTrainNumber()))); } if (CollUtil.isNotEmpty(collect)) { for (Map.Entry> entry : collect.entrySet()) { - List value = entry.getValue(); // 根据车查询出司机id List collect2 = new ArrayList<>(); - if(StrUtil.equals(deliveryKindParam, "自主配送")){ + if (StrUtil.equals(deliveryKindParam, "自主配送")) { collect2 = value.stream() .filter(entity -> ObjectUtil.isNotEmpty(entity.getSignUserId())) .map(entity -> entity.getSignUserId()) .collect(Collectors.toList()); } - if(StrUtil.equals(deliveryKindParam, "三方配送")){ + if (StrUtil.equals(deliveryKindParam, "三方配送")) { collect2.add("0"); } @@ -214,7 +214,7 @@ public class DeliverFinishReportListener implements ReportService { ExpenseDispatchPriceVO priceVO = expenseDispatchClientDTO.getPriceVO(); // 整车计费,则车内的每个包件分摊整车成本费用 if (ynWholeVehicle) { - if(ObjectUtil.isNotEmpty(priceVO)){ + if (ObjectUtil.isNotEmpty(priceVO)) { String wholeVehicleCost = priceVO.getWholeVehicleCost(); if (StrUtil.isNotEmpty(wholeVehicleCost)) { BigDecimal deliveryFeeSum = BigDecimal.ZERO; @@ -237,7 +237,7 @@ public class DeliverFinishReportListener implements ReportService { } } } else { - if(ObjectUtil.isNotEmpty(priceVO)){ + if (ObjectUtil.isNotEmpty(priceVO)) { List overZoneList = priceVO.getOverZoneList(); Map overZoneEntityMap = new HashMap<>(); if (CollUtil.isNotEmpty(overZoneList)) { @@ -901,11 +901,43 @@ public class DeliverFinishReportListener implements ReportService { )); sendReport(BizOperationEnums.MODIFY, entityEntry.getValue(), BizOperationEnums.MODIFY); } + Map waybillOrderMap = new HashMap<>(); + Collection values = valueMap.values(); + for (QualityDeliverEntity entity : values) { + if (StrUtil.isEmpty(entity.getOrderCode()) || StrUtil.isEmpty(entity.getWaybillNumber())) { + log.info("订单或运单为空,不生成订单总成本报表:id = {}", entity.getId()); + continue; + } + String key = entity.getOrderCode() + entity.getWaybillNumber(); + if (waybillOrderMap.containsKey(key)) { + TrunklineWaybillOrderEntity waybillOrderEntity = waybillOrderMap.get(key); + Integer totalNumber = waybillOrderEntity.getTotalNumber(); + waybillOrderEntity.setTotalNumber(totalNumber + entity.getSignNum()); + } else { + TrunklineWaybillOrderEntity waybillOrderEntity = new TrunklineWaybillOrderEntity(); + waybillOrderEntity.setOrderCode(entity.getOrderCode()); + waybillOrderEntity.setWaybillNo(entity.getWaybillNumber()); + waybillOrderEntity.setTotalNumber(entity.getSignNum()); + waybillOrderMap.put(key, waybillOrderEntity); + } + } + // 生成订单 发送延时消息生成报表 + if (CollUtil.isNotEmpty(waybillOrderMap)) { + for (Map.Entry entityEntry : waybillOrderMap.entrySet()) { + factoryDataClient.sendMessage(SendMsg.builder() + .exchange(ReportConstants.REPORT_EXPENSE_ORDER_EXCHANGE) + .routingKey(ReportConstants.REPORT_EXPENSE_ORDER_ROUTINGKEY) + .message(JSONUtil.toJsonStr(entityEntry.getValue())) + .delay(10000) + .build()); + } + } } } } } } + } private static void buildUltrAllpwCost(Map valueMap, BigDecimal mul, Integer totalNum) { @@ -925,6 +957,7 @@ public class DeliverFinishReportListener implements ReportService { idex++; } } + private static void buildPointAllowCost(Map valueMap, BigDecimal mul, Integer totalNum) { BigDecimal deliveryFeeSum = BigDecimal.ZERO; int idex = 0; @@ -942,6 +975,7 @@ public class DeliverFinishReportListener implements ReportService { idex++; } } + private static void buildFuelCost(Map valueMap, BigDecimal mul, Integer totalNum) { BigDecimal deliveryFeeSum = BigDecimal.ZERO; int idex = 0; diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java index bb14b53b0..054e198ae 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java @@ -23,7 +23,9 @@ import com.logpm.distribution.service.IDistributionStockArticleService; import com.logpm.distribution.service.IDistributionStockListInfoService; import com.logpm.distribution.service.IDistributionStockListService; import com.logpm.distribution.service.IQualityDeliverService; +import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; import com.logpm.trunkline.feign.ITrunklineAdvanceDetailClient; +import com.logpm.trunkline.feign.ITrunklineWaybillOrderClient; import com.logpm.warehouse.entity.WarehouseWayBillDetail; import com.logpm.warehouse.entity.WarehouseWaybillEntity; import com.logpm.warehouse.feign.IWarehouseWaybillClient; @@ -35,6 +37,7 @@ import org.springblade.common.constant.WorkNodeEnums; import org.springblade.common.enums.BizOperationEnums; import org.springblade.common.enums.PackageTypeEnums; import org.springblade.core.redis.cache.BladeRedis; +import org.springblade.core.secure.utils.AuthUtil; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -87,6 +90,8 @@ public class QualityDeliverListener implements ReportService { private BladeRedis redisCache; @Resource private DistributionProperties destinationProperties; + @Resource + private ITrunklineWaybillOrderClient waybillOrderClient; @Transactional public void buildReport(String msg) { @@ -103,19 +108,19 @@ public class QualityDeliverListener implements ReportService { saveOrUpdate(null, qualityDeliverEntity); } if (ObjectUtil.equals(bean.getOperation(), BizOperationEnums.DELETE)) { - if (StrUtil.equals(node, WorkNodeEnums.PLANNED_RESERVATION.getValue())){ + if (StrUtil.equals(node, WorkNodeEnums.PLANNED_RESERVATION.getValue())) { qualityDeliverService.deleteEntityById(qualityDeliverEntity.getId()); } - if (StrUtil.equals(node, WorkNodeEnums.STOCKING_OPERATION.getValue())){ + if (StrUtil.equals(node, WorkNodeEnums.STOCKING_OPERATION.getValue())) { qualityDeliverService.delStockingOperation(qualityDeliverEntity.getId()); } - if (StrUtil.equals(node, WorkNodeEnums.PLAN_DELIVERY.getValue())){ + if (StrUtil.equals(node, WorkNodeEnums.PLAN_DELIVERY.getValue())) { qualityDeliverService.delPlanDelivery(qualityDeliverEntity.getId()); } - if (StrUtil.equals(node, WorkNodeEnums.DISTRIBUTION_CAR_START.getValue())){ + if (StrUtil.equals(node, WorkNodeEnums.DISTRIBUTION_CAR_START.getValue())) { qualityDeliverService.delDistributionCarStart(qualityDeliverEntity.getId()); } - if (StrUtil.equals(node, WorkNodeEnums.PLAN_BILLOFLADING.getValue())){ + if (StrUtil.equals(node, WorkNodeEnums.PLAN_BILLOFLADING.getValue())) { qualityDeliverService.deleteEntityById(qualityDeliverEntity.getId()); } } @@ -282,6 +287,7 @@ public class QualityDeliverListener implements ReportService { } private void buildCmpBasicInfo(QualityDeliverEntity qualityDeliverEntity, DistributionParcelListEntity parcelListEntity) { + String orderCode = qualityDeliverEntity.getOrderCode(); if (ObjectUtil.isNotEmpty(parcelListEntity)) { // 品牌 qualityDeliverEntity.setBrandName(parcelListEntity.getBrandName()); @@ -321,6 +327,9 @@ public class QualityDeliverListener implements ReportService { qualityDeliverEntity.setEndWarehouseInTime(parcelListEntity.getWarehouseEntryTimeEnd()); // 构建运单相关信息 buildWaybillInfo(qualityDeliverEntity, waybillNumber); + // 设置订单运单总数 + buildOrderWaybillNumber(qualityDeliverEntity, orderCode, waybillNumber); + } // 暂存单查询结算品类 // TrunklineAdvanceDetailEntity advanceDetailEntity = advanceDetailClient.findEntityByOrderPackageCode(qualityDeliverEntity.getOrderPackageCode()); @@ -331,7 +340,23 @@ public class QualityDeliverListener implements ReportService { // qualityDeliverEntity.setRevenueCategory(advanceDetailEntity.getIncomeCategoryName()); // } // 构建订单相关信息 - buildOrderInfo(qualityDeliverEntity, qualityDeliverEntity.getWarehouseId(), qualityDeliverEntity.getOrderCode()); + buildOrderInfo(qualityDeliverEntity, qualityDeliverEntity.getWarehouseId(), orderCode); + } + + private void buildOrderWaybillNumber(QualityDeliverEntity qualityDeliverEntity, String orderCode, String waybillNumber) { + if (StrUtil.isNotEmpty(orderCode) && StrUtil.isNotEmpty(waybillNumber)) { + String key = AuthUtil.getTenantId() + ":" + "logpm-distribution:" + "OrderWaybill:" + orderCode + "_" + waybillNumber; + Integer totalNumber = redisCache.get(key); + if (ObjectUtil.isNotEmpty(totalNumber)) { + qualityDeliverEntity.setOrderWaybillNumber(totalNumber); + } else { + TrunklineWaybillOrderEntity entityByWaybillNoAndOrderCode = waybillOrderClient.findEntityByWaybillNoAndOrderCode(waybillNumber, orderCode); + if (ObjectUtil.isNotEmpty(entityByWaybillNoAndOrderCode)) { + qualityDeliverEntity.setOrderWaybillNumber(entityByWaybillNoAndOrderCode.getTotalNumber()); + } + redisCache.set(key, entityByWaybillNoAndOrderCode.getTotalNumber()); + } + } } private void buildOrderInfo(QualityDeliverEntity qualityDeliverEntity, Long warehouseId, String orderCode) { @@ -356,6 +381,19 @@ public class QualityDeliverListener implements ReportService { qualityDeliverEntity.setStoreName(stockArticleEntity.getStoreName()); // 品牌 qualityDeliverEntity.setBrandName(stockArticleEntity.getBrand()); + // 服务类型 + String typeService = stockArticleEntity.getTypeService(); + if(StrUtil.isNotEmpty(typeService)){ + if("1".equals(typeService)){ + qualityDeliverEntity.setCustomType("商配"); + }else if("2".equals(typeService)){ + qualityDeliverEntity.setCustomType("市配"); + }else if("3".equals(typeService)){ + qualityDeliverEntity.setCustomType("自提"); + }else if("4".equals(typeService)){ + qualityDeliverEntity.setCustomType("三方中转"); + } + } } } @@ -394,6 +432,9 @@ public class QualityDeliverListener implements ReportService { qualityDeliverEntity.setAssignedCustomerId(Convert.toStr(byWaybillNo.getConsigneeId())); qualityDeliverEntity.setAssignedCustomer(byWaybillNo.getConsignee()); + qualityDeliverEntity.setShipperStation(byWaybillNo.getDeparture()); + qualityDeliverEntity.setConsigneeStation(byWaybillNo.getDestination()); + } } } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReportListener.java index 0fd72a880..7e927d1f3 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReportListener.java @@ -1,6 +1,8 @@ package com.logpm.distribution.receiver.report; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONArray; import cn.hutool.json.JSONUtil; import com.logpm.distribution.pros.DistributionProperties; import com.logpm.distribution.service.IQualityDeliverService; @@ -513,6 +515,52 @@ public class ReportListener { throw new RuntimeException(e); } } + @RabbitListener(bindings = @QueueBinding( + value = @Queue(name = ReportConstants.REPORT_EXPENSE_ORDER_QUEUE, durable = "true"), + exchange = @Exchange(name = ReportConstants.REPORT_EXPENSE_ORDER_EXCHANGE, type = ExchangeTypes.TOPIC, + delayed = FactoryDataConstants.Mq.DELAYED), + key = ReportConstants.REPORT_EXPENSE_ORDER_ROUTINGKEY + ), ackMode = "MANUAL") + public void orderExpenseDispatchDetailFinal(String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) { + log.info("生成订单总成本报表: {}", msg); + try { + JSONArray objects = JSONUtil.parseArray(msg); + if(CollUtil.isNotEmpty(objects)){ + qualityDeliverService.orderExpenseDispatchDetailFinal(objects); + } + } catch (Exception e) { + e.printStackTrace(); + log.error("生成订单总成本报表失败: {}", e.getMessage()); + } + try { + channel.basicAck(tag, false); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + @RabbitListener(bindings = @QueueBinding( + value = @Queue(name = ReportConstants.REPORT_EXPENSE_WAREHOUSE_ORDER_QUEUE, durable = "true"), + exchange = @Exchange(name = ReportConstants.REPORT_EXPENSE_WAREHOUSE_ORDER_EXCHANGE, type = ExchangeTypes.TOPIC, + delayed = FactoryDataConstants.Mq.DELAYED), + key = ReportConstants.REPORT_EXPENSE_WAREHOUSE_ORDER_ROUTINGKEY + ), ackMode = "MANUAL") + public void expenseWarehouseOrder(String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) { + log.info("生成仓储订单总成本报表: {}", msg); + try { + JSONArray objects = JSONUtil.parseArray(msg); + if(CollUtil.isNotEmpty(objects)){ + qualityDeliverService.expenseWarehouseOrder(objects); + } + } catch (Exception e) { + e.printStackTrace(); + log.error("生成仓储订单总成本报表失败: {}", e.getMessage()); + } + try { + channel.basicAck(tag, false); + } catch (IOException e) { + throw new RuntimeException(e); + } + } private ReportService selectReportService(Class clazz) { diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IQualityDeliverService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IQualityDeliverService.java index 7be05663f..047c08358 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IQualityDeliverService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IQualityDeliverService.java @@ -16,6 +16,7 @@ */ package com.logpm.distribution.service; +import cn.hutool.json.JSONArray; import com.logpm.distribution.entity.QualityDeliverEntity; import org.springblade.core.mp.base.BaseService; @@ -42,4 +43,8 @@ public interface IQualityDeliverService extends BaseService list = JSONUtil.toList(objects, TrunklineWaybillOrderEntity.class); + TrunklineWaybillOrderEntity entity = list.get(0); + List qualityDeliverEntities = baseMapper.selectList(Wrappers.lambdaQuery() + .eq(QualityDeliverEntity::getOrderCode, entity.getOrderCode()) + .eq(QualityDeliverEntity::getWaybillNumber, entity.getWaybillNo()) + .orderByDesc(QualityDeliverEntity::getCarComplateTime) + ); + if (CollUtil.isNotEmpty(qualityDeliverEntities)) { + QualityDeliverEntity qualityDeliverEntity = qualityDeliverEntities.get(0); + // 订单运单总数 + Integer totalNumber = qualityDeliverEntity.getOrderWaybillNumber(); + // 计算签收总数 + Integer reduce = qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .map(QualityDeliverEntity::getSignNum) + .filter(Objects::nonNull) + .reduce(0, Integer::sum); + // 全部计算完成之后生成订单总成本 + if (NumberUtil.equals(totalNumber, reduce)) { + ExpenseDispatchOrderDetailEntity orderDetailEntity = new ExpenseDispatchOrderDetailEntity(); + orderDetailEntity.setBrand(qualityDeliverEntity.getBrandName()); + orderDetailEntity.setOrderCode(qualityDeliverEntity.getOrderCode()); + orderDetailEntity.setWaybillNumber(qualityDeliverEntity.getWaybillNumber()); + orderDetailEntity.setDestinationWarehouse(qualityDeliverEntity.getWarehouseName()); + orderDetailEntity.setShippingOrg(qualityDeliverEntity.getShipperUnit()); + orderDetailEntity.setConsigneeOrg(qualityDeliverEntity.getConsigneeUnit()); + orderDetailEntity.setWaybillType(qualityDeliverEntity.getCustomType()); + orderDetailEntity.setDocumentCreationTime(DateUtil.formatDateTime(qualityDeliverEntity.getOpenOrderTime())); + orderDetailEntity.setTotalQuantity(totalNumber); + orderDetailEntity.setReviewNumber(reduce); + orderDetailEntity.setTotalWeight(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .filter(item -> Objects.nonNull(item.getWeight())) + .map(QualityDeliverEntity::getWeight) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + orderDetailEntity.setTotalVolume(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .filter(item -> Objects.nonNull(item.getVolume())) + .map(QualityDeliverEntity::getVolume) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + orderDetailEntity.setTotalDistributionCost(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .filter(item -> Objects.nonNull(item.getTotalDistributionCost())) + .map(QualityDeliverEntity::getTotalDistributionCost) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + orderDetailEntity.setDistributionCost(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .filter(item -> Objects.nonNull(item.getDistributionCost())) + .map(QualityDeliverEntity::getDistributionCost) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + orderDetailEntity.setStairCarryingFee(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .filter(item -> Objects.nonNull(item.getApstairsCost())) + .map(QualityDeliverEntity::getApstairsCost) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + orderDetailEntity.setGoodsAllocationCost(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .filter(item -> Objects.nonNull(item.getApartCost())) + .map(QualityDeliverEntity::getApartCost) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + orderDetailEntity.setRepositioningCost(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .filter(item -> Objects.nonNull(item.getMoveCost())) + .map(QualityDeliverEntity::getMoveCost) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + orderDetailEntity.setHandlingCost(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .filter(item -> Objects.nonNull(item.getStevedoreCost())) + .map(QualityDeliverEntity::getStevedoreCost) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + orderDetailEntity.setMileageCost(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .filter(item -> Objects.nonNull(item.getKiloAllowCost())) + .map(QualityDeliverEntity::getKiloAllowCost) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + orderDetailEntity.setSubsidizedKilometerCost(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .filter(item -> Objects.nonNull(item.getAllowKiloAllowCost())) + .map(QualityDeliverEntity::getAllowKiloAllowCost) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + orderDetailEntity.setExcessZoneMileageCost(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .filter(item -> Objects.nonNull(item.getUltrAllpwCost())) + .map(QualityDeliverEntity::getUltrAllpwCost) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + orderDetailEntity.setLocationSubsidyCost(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .filter(item -> Objects.nonNull(item.getPointAllowCost())) + .map(QualityDeliverEntity::getPointAllowCost) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + orderDetailEntity.setMinimumGuaranteeCost(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .filter(item -> Objects.nonNull(item.getGuarCost())) + .map(QualityDeliverEntity::getGuarCost) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + orderDetailEntity.setFuelCost(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .filter(item -> Objects.nonNull(item.getFuelCost())) + .map(QualityDeliverEntity::getFuelCost) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + orderDetailEntity.setOtherCosts(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getCarComplateTime())) + .filter(item -> Objects.nonNull(item.getOtherCost())) + .map(QualityDeliverEntity::getOtherCost) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + orderDetailEntity.setShipper(qualityDeliverEntity.getShipperPerson()); + orderDetailEntity.setShippingPhone(qualityDeliverEntity.getShipperMobile()); + orderDetailEntity.setShippingAddress(qualityDeliverEntity.getShipperAddress()); + orderDetailEntity.setArrivalStation(qualityDeliverEntity.getConsigneeStation()); + orderDetailEntity.setDepartureWarehouse(qualityDeliverEntity.getShipperStation()); + orderDetailEntity.setConsignee(qualityDeliverEntity.getConsigneePerson()); + orderDetailEntity.setConsigneePhone(qualityDeliverEntity.getConsigneeMobile()); + orderDetailEntity.setConsigneeAddress(qualityDeliverEntity.getConsigneeAddress()); + orderDetailEntity.setCustomerTrip(qualityDeliverEntity.getTrainNumber()); + orderDetailEntity.setReviewCompletionTime(DateUtil.formatDateTime(qualityDeliverEntity.getReviewTime())); + expenseDispatchClient.saveDispatchOrderDetailEntity(orderDetailEntity); + } + } + } + } + + @Override + public void expenseWarehouseOrder(JSONArray objects) { + // 生成仓储订单总成本 + if (CollUtil.isNotEmpty(objects)) { + List list = JSONUtil.toList(objects, TrunklineWaybillOrderEntity.class); + TrunklineWaybillOrderEntity entity = list.get(0); + List qualityDeliverEntities = baseMapper.selectList(Wrappers.lambdaQuery() + .eq(QualityDeliverEntity::getOrderCode, entity.getOrderCode()) + .eq(QualityDeliverEntity::getWaybillNumber, entity.getWaybillNo()) + .orderByDesc(QualityDeliverEntity::getReviewTime) + ); + if (CollUtil.isNotEmpty(qualityDeliverEntities)) { + QualityDeliverEntity qualityDeliverEntity = qualityDeliverEntities.get(0); + // 订单运单总数 + Integer totalNumber = qualityDeliverEntity.getOrderWaybillNumber(); + // 计算签收总数 + Integer reduce = qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getReviewUserName())) + .map(QualityDeliverEntity::getSignNum) + .filter(Objects::nonNull) + .reduce(0, Integer::sum); + // 全部计算完成之后生成订单总成本 + if (NumberUtil.equals(totalNumber, reduce)) { + ExpenseWarehouseOrderEntity orderDetailEntity = new ExpenseWarehouseOrderEntity(); + orderDetailEntity.setBusinessUnit(qualityDeliverEntity.getBusinessUnit()); + orderDetailEntity.setWarehouseName(qualityDeliverEntity.getWarehouseName()); + orderDetailEntity.setOrderCode(qualityDeliverEntity.getOrderCode()); + orderDetailEntity.setShipmentNumber(qualityDeliverEntity.getWaybillNumber()); + orderDetailEntity.setReceivingUnit(qualityDeliverEntity.getConsigneeUnit()); + orderDetailEntity.setShippingUnit(qualityDeliverEntity.getShipperUnit()); + orderDetailEntity.setWaybillType(qualityDeliverEntity.getCustomType()); + orderDetailEntity.setTotalNumber(totalNumber); + orderDetailEntity.setOutNumber(totalNumber); + orderDetailEntity.setOriginWarehouse(qualityDeliverEntity.getShipperStation()); + orderDetailEntity.setReviewCompletionTime(DateUtil.formatDateTime(qualityDeliverEntity.getReviewTime())); + orderDetailEntity.setWarehouseRentalCost(Convert.toDouble(qualityDeliverEntities.stream() + .filter(item -> ObjectUtil.isNotEmpty(item.getReviewUserName())) + .filter(item -> Objects.nonNull(item.getWarehouseCost())) + .map(QualityDeliverEntity::getWarehouseCost) + .reduce(BigDecimal.ZERO, BigDecimal::add))); + expenseDispatchClient.saveWarehouseOrderEntity(orderDetailEntity); + } + } + } + } + } diff --git a/blade-service/logpm-statisticsdata/pom.xml b/blade-service/logpm-statisticsdata/pom.xml index d0824022a..1af0c5837 100644 --- a/blade-service/logpm-statisticsdata/pom.xml +++ b/blade-service/logpm-statisticsdata/pom.xml @@ -78,6 +78,11 @@ 3.2.0.RELEASE compile + + org.springblade + logpm-factory-data-api + 3.2.0.RELEASE + diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/feign/ExpenseDispatchClient.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/feign/ExpenseDispatchClient.java index b8fd9cb2c..d7296bf25 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/feign/ExpenseDispatchClient.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/feign/ExpenseDispatchClient.java @@ -7,14 +7,18 @@ import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.statistics.dto.ExpenseDispatchClientDTO; import com.logpm.statistics.dto.ExpenseDispatchPriceRuleDTO; +import com.logpm.statistics.entity.ExpenseDispatchOrderDetailEntity; import com.logpm.statistics.entity.ExpenseDispatchPriceEntity; import com.logpm.statistics.entity.ExpenseDispatchPriceRuleEntity; import com.logpm.statistics.entity.ExpenseDispatchPriceServiceEntity; import com.logpm.statistics.entity.ExpenseDispatchTrainDetailEntity; +import com.logpm.statistics.entity.ExpenseWarehouseOrderEntity; +import com.logpm.statistics.service.IExpenseDispatchOrderDetailService; import com.logpm.statistics.service.IExpenseDispatchPriceRuleService; import com.logpm.statistics.service.IExpenseDispatchPriceService; import com.logpm.statistics.service.IExpenseDispatchPriceServiceService; import com.logpm.statistics.service.IExpenseDispatchTrainDetailService; +import com.logpm.statistics.service.IExpenseOrderWarehouseTotalService; import com.logpm.statistics.vo.ExpenseDispatchPriceVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -35,6 +39,8 @@ public class ExpenseDispatchClient implements IExpenseDispatchClient { private final IExpenseDispatchPriceService priceService; private final IExpenseDispatchPriceRuleService ruleService; private final IExpenseDispatchTrainDetailService trainDetailService; + private final IExpenseDispatchOrderDetailService orderDetailService; + private final IExpenseOrderWarehouseTotalService orderWarehouseTotalService; @Override public ExpenseDispatchClientDTO findPriceByDriverId(Long warehouseId, Long driverId, Long carType, String dispatchType) { @@ -42,21 +48,21 @@ public class ExpenseDispatchClient implements IExpenseDispatchClient { .eq(ExpenseDispatchPriceServiceEntity::getWarehouseId, warehouseId) .eq(ExpenseDispatchPriceServiceEntity::getDriverId, driverId) ); - if(CollUtil.isNotEmpty(list)){ + if (CollUtil.isNotEmpty(list)) { ExpenseDispatchClientDTO dto = new ExpenseDispatchClientDTO(); Long templateId = list.get(0).getTemplateId(); ExpenseDispatchPriceRuleEntity rule = ruleService.getOne(Wrappers.lambdaQuery() .eq(ExpenseDispatchPriceRuleEntity::getTemplateId, templateId) - .eq(ExpenseDispatchPriceRuleEntity::getType, StrUtil.equals(dispatchType, "商配") ? 1: 2) + .eq(ExpenseDispatchPriceRuleEntity::getType, StrUtil.equals(dispatchType, "商配") ? 1 : 2) ); - if(ObjectUtil.isNotEmpty(rule)){ + if (ObjectUtil.isNotEmpty(rule)) { ExpenseDispatchPriceRuleDTO expenseDispatchPriceRuleDTO = BeanUtil.copyProperties(rule, ExpenseDispatchPriceRuleDTO.class); dto.setRule(expenseDispatchPriceRuleDTO); } ExpenseDispatchPriceEntity param = new ExpenseDispatchPriceVO(); param.setCarModel(Convert.toStr(carType)); param.setTemplateId(templateId); - param.setType(StrUtil.equals(dispatchType, "商配") ? 1: 2); + param.setType(StrUtil.equals(dispatchType, "商配") ? 1 : 2); ExpenseDispatchPriceVO detail = priceService.detail(param); dto.setPriceVO(detail); return dto; @@ -64,20 +70,30 @@ public class ExpenseDispatchClient implements IExpenseDispatchClient { return null; } - @Override - public void saveTrainDetailEntity(ExpenseDispatchTrainDetailEntity entity) { + @Override + public void saveTrainDetailEntity(ExpenseDispatchTrainDetailEntity entity) { List list = trainDetailService.list(Wrappers.lambdaQuery() .eq(ExpenseDispatchTrainDetailEntity::getTrainNumber, entity.getTrainNumber()) .eq(ExpenseDispatchTrainDetailEntity::getDeliveryVehicle, entity.getDeliveryVehicle()) ); - if(CollUtil.isNotEmpty(list)){ + if (CollUtil.isNotEmpty(list)) { ExpenseDispatchTrainDetailEntity trainDetailEntity = list.get(0); trainDetailService.update(entity, Wrappers.lambdaUpdate() .eq(ExpenseDispatchTrainDetailEntity::getId, trainDetailEntity.getId())); - }else{ + } else { entity.setSettlementStatus("未结算"); trainDetailService.save(entity); } } + + @Override + public void saveDispatchOrderDetailEntity(ExpenseDispatchOrderDetailEntity orderDetailEntity) { + orderDetailService.save(orderDetailEntity); + } + + @Override + public void saveWarehouseOrderEntity(ExpenseWarehouseOrderEntity orderDetailEntity) { + orderWarehouseTotalService.save(orderDetailEntity); + } } diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/job/ExpenseJob.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/job/ExpenseJob.java index 333424d30..67a94363e 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/job/ExpenseJob.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/job/ExpenseJob.java @@ -7,22 +7,27 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.entity.WarehouseLeasingEntity; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.basicdata.feign.IWarehouseLeasingClient; import com.logpm.distribution.entity.QualityDeliverEntity; import com.logpm.distribution.feign.IQualityDeliverClient; +import com.logpm.factorydata.feign.IFactoryDataClient; +import com.logpm.factorydata.vo.SendMsg; import com.logpm.statistics.entity.ExpenseWarehouseDayEntity; import com.logpm.statistics.entity.ExpenseWarehouseMonthEntity; import com.logpm.statistics.service.IExpenseDispatchWarehouseMonthService; import com.logpm.statistics.service.IExpenseWarehouseDayService; import com.logpm.statistics.service.IExpenseWarehouseMonthService; +import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; import com.logpm.trunkline.feign.ITrunklineCarsLoadScanClient; 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.report.ReportConstants; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -59,6 +64,8 @@ public class ExpenseJob { private IExpenseDispatchWarehouseMonthService dispatchWarehouseMonthService; @Resource private ITrunklineCarsLoadScanClient carsLoadScanClient; + @Resource + private IFactoryDataClient factoryDataClient; /** * 仓库月度仓储成本统计表 @@ -133,7 +140,27 @@ public class ExpenseJob { Map> customMap = new HashMap<>(); Map> tempMap = new HashMap<>(); Map> gcpMap = new HashMap<>(); + Map waybillOrderMap = new HashMap<>(); if (CollUtil.isNotEmpty(qualityDeliverEntities)) { + for (QualityDeliverEntity entity : qualityDeliverEntities) { + if (StrUtil.isEmpty(entity.getOrderCode()) || StrUtil.isEmpty(entity.getWaybillNumber())) { + log.info("订单或运单为空,不生成订单总成本报表:id = {}", entity.getId()); + continue; + } + String key = entity.getOrderCode() + entity.getWaybillNumber(); + if (waybillOrderMap.containsKey(key)) { + TrunklineWaybillOrderEntity waybillOrderEntity = waybillOrderMap.get(key); + Integer totalNumber = waybillOrderEntity.getTotalNumber(); + waybillOrderEntity.setTotalNumber(totalNumber + entity.getSignNum()); + } else { + TrunklineWaybillOrderEntity waybillOrderEntity = new TrunklineWaybillOrderEntity(); + waybillOrderEntity.setOrderCode(entity.getOrderCode()); + waybillOrderEntity.setWaybillNo(entity.getWaybillNumber()); + waybillOrderEntity.setTotalNumber(entity.getSignNum()); + waybillOrderMap.put(key, waybillOrderEntity); + } + } + // 每个仓有多少数据 Map> map = qualityDeliverEntities.stream().collect(Collectors.groupingBy(QualityDeliverEntity::getWarehouseId)); for (Map.Entry> longListEntry : map.entrySet()) { @@ -307,6 +334,17 @@ public class ExpenseJob { if (CollUtil.isNotEmpty(packageCostMap)) { qualityDeliverClient.updateWarehouseCost(packageCostMap); } + // 生成订单 发送延时消息生成报表 + if (CollUtil.isNotEmpty(waybillOrderMap)) { + for (Map.Entry entityEntry : waybillOrderMap.entrySet()) { + factoryDataClient.sendMessage(SendMsg.builder() + .exchange(ReportConstants.REPORT_EXPENSE_WAREHOUSE_ORDER_EXCHANGE) + .routingKey(ReportConstants.REPORT_EXPENSE_WAREHOUSE_ORDER_ROUTINGKEY) + .message(JSONUtil.toJsonStr(entityEntry.getValue())) + .delay(10000) + .build()); + } + } } return ReturnT.SUCCESS; } diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchOrderDetailMapper.xml b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchOrderDetailMapper.xml index 89b13f6b9..94678069c 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchOrderDetailMapper.xml +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchOrderDetailMapper.xml @@ -6,8 +6,22 @@ - - + select * + from logpm_expense_dispatch_order_detail t + + + and t.order_code like concat('%',#{expenseDispatchOrderDetail.orderCode},'%') + + + and t.destination_warehouse = #{expenseDispatchOrderDetail.destinationWarehouse} + + + and t.waybill_number like concat('%',#{expenseDispatchOrderDetail.waybillNumber},'%') + + + + + select * + from logpm_expense_warehouse_order + + + and order_code = #{query.orderCode} + + + and shipment_number = #{query.shipmentNumber} + + + and warehouse_name in + + #{item} + + + + + @@ -1498,12 +1505,6 @@ where ltad.waybill_id is not null and ltad.create_time > '2024-10-22 00:00:00' and lww.departure_warehouse_id != lww.destination_warehouse_id - - and ltad.create_time >= #{param.startTime} - - - and ltad.create_time <= #{param.endTime} - and lww.brand in @@ -1545,7 +1546,6 @@ and GROUP_CONCAT(DISTINCT ltad.train_number) like concat('%',#{param.trainNumber},'%') - GROUP_CONCAT(DISTINCT IFNULL(ltcls.load_code,ltclsm.load_code)) loadCode, and GROUP_CONCAT(DISTINCT IFNULL(ltcls.load_code,ltclsm.load_code)) like concat('%',#{param.loadCode},'%') @@ -1558,6 +1558,27 @@ lww.departure_warehouse_name, lww.destination_warehouse_name, oat.day_time + + + and GROUP_CONCAT(DISTINCT ltad.train_number) like concat('%',#{param.trainNumber},'%') + GROUP_CONCAT(DISTINCT IFNULL(ltcls.load_code,ltclsm.load_code)) loadCode, + + + and GROUP_CONCAT(DISTINCT IFNULL(ltcls.load_code,ltclsm.load_code)) like concat('%',#{param.loadCode},'%') + + + and min(ltad.create_time) >= #{param.startTime} + + + and min(ltad.create_time) <= #{param.endTime} + + + and min(lww.create_time) >= #{param.openTimeStart} + + + and min(lww.create_time) <= #{param.openTimeEnd} + + diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportTimeServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportTimeServiceImpl.java index 12f2ff6d0..f71a937ec 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportTimeServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportTimeServiceImpl.java @@ -415,6 +415,8 @@ public class ReportTimeServiceImpl implements IReportTimeService { reportTimeDTO.setStartTime(CommonUtil.getStartByDateStr(reportTimeDTO.getStartTimeStr())); reportTimeDTO.setEndTime(CommonUtil.getEndByDateStr(reportTimeDTO.getEndTimeStr())); + reportTimeDTO.setOpenTimeStart(CommonUtil.getStartByDateStr(reportTimeDTO.getOpenTimeStartStr())); + reportTimeDTO.setOpenTimeEnd(CommonUtil.getEndByDateStr(reportTimeDTO.getOpenTimeEndStr())); reportTimeDTO.setDayTime(0); @@ -447,9 +449,9 @@ public class ReportTimeServiceImpl implements IReportTimeService { reportTimeDTO.setDayTime(orderAllEntity.getDayTime()); } - List list = reportTimeMapper.orderAllTimeExport(reportTimeDTO); + List list = reportTimeMapper.orderAllTimeExport(reportTimeDTO); //导出ls - ExcelUtil.export(response, "订单整体时效报表导出", "订单整体时效报表导出", list, ReportConfigOrderAllEntity.class); + ExcelUtil.export(response, "订单整体时效报表导出", "订单整体时效报表导出", list, ReportOrderAllTimeVO.class); } } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java index f1ea2521c..8b36e8e77 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java @@ -9043,7 +9043,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl