From 9f3181e149c534b702579061af5865a0482e1955 Mon Sep 17 00:00:00 2001 From: zhaoqiaobo <583671871@qq.com> Date: Wed, 19 Mar 2025 14:56:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(all):=20=E5=B9=B2=E7=BA=BF=E6=8F=90?= =?UTF-8?q?=E8=B4=A7=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1 修改干线提货报表分组条件不正确问题 --- .../controller/TrunklinePickupController.java | 45 +++++++++++++++-- .../report/mapper/TrunklinePickupMapper.xml | 49 ++++++------------- 2 files changed, 57 insertions(+), 37 deletions(-) diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/TrunklinePickupController.java b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/TrunklinePickupController.java index 0f389e827..7c2df24ba 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/TrunklinePickupController.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/TrunklinePickupController.java @@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletResponse; +import java.time.Duration; /** * 干线提货时效 @@ -40,8 +41,17 @@ public class TrunklinePickupController { @ApiOperationSupport(order = 1) @ApiOperation(value = "干线提货时效", notes = "干线提货时效") public R<IPage<TrunklinePickupEfficiencyVO>> efficiencyPage(TrunklinePickupEfficiencyQuery query) { - if(ObjectUtil.isEmpty(query.getStartCreateTime()) || ObjectUtil.isEmpty(query.getEndCreateTime())){ + if (ObjectUtil.isEmpty(query.getStartCreateTime()) || ObjectUtil.isEmpty(query.getEndCreateTime())) { throw new ServiceException("创建时间必须选择"); + } else { + // 时间跨度不能大于31天 + Duration duration = Duration.between( + query.getStartCreateTime().toInstant(), + query.getEndCreateTime().toInstant() + ); + if (duration.toDays() > 31) { + throw new ServiceException("时间跨度不能大于31天"); + } } IPage<TrunklinePickupEfficiencyVO> pages = trunklinePickupService.efficiencyPage(query); return R.data(pages); @@ -51,8 +61,17 @@ public class TrunklinePickupController { @ApiOperationSupport(order = 2) @ApiOperation(value = "导出干线提货时效", notes = "导出干线提货时效") public void exportEfficiency(HttpServletResponse response, TrunklinePickupEfficiencyQuery query) { - if(ObjectUtil.isEmpty(query.getStartCreateTime()) || ObjectUtil.isEmpty(query.getEndCreateTime())){ + if (ObjectUtil.isEmpty(query.getStartCreateTime()) || ObjectUtil.isEmpty(query.getEndCreateTime())) { throw new ServiceException("创建时间必须选择"); + } else { + // 时间跨度不能大于31天 + Duration duration = Duration.between( + query.getStartCreateTime().toInstant(), + query.getEndCreateTime().toInstant() + ); + if (duration.toDays() > 31) { + throw new ServiceException("时间跨度不能大于31天"); + } } trunklinePickupService.exportEfficiency(response, query); } @@ -91,8 +110,17 @@ public class TrunklinePickupController { @ApiOperationSupport(order = 1) @ApiOperation(value = "2B业务配送时效表", notes = "2B业务配送时效表") public R<IPage<B2BDeliverTimelinessVO>> b2BDeliveryTimelinessPage(B2BDeliveryTimelinessQuery query) { - if(ObjectUtil.isEmpty(query.getStartCreateTime()) || ObjectUtil.isEmpty(query.getEndCreateTime())){ + if (ObjectUtil.isEmpty(query.getStartCreateTime()) || ObjectUtil.isEmpty(query.getEndCreateTime())) { throw new ServiceException("入库时间必须选择"); + } else { + // 时间跨度不能大于31天 + Duration duration = Duration.between( + query.getStartCreateTime().toInstant(), + query.getEndCreateTime().toInstant() + ); + if (duration.toDays() > 31) { + throw new ServiceException("时间跨度不能大于31天"); + } } IPage<B2BDeliverTimelinessVO> pages = trunklinePickupService.b2BDeliveryTimelinessPage(query); return R.data(pages); @@ -102,8 +130,17 @@ public class TrunklinePickupController { @ApiOperationSupport(order = 2) @ApiOperation(value = "导出2B业务配送时效表", notes = "导出2B业务配送时效表") public void exportB2BDeliveryTimeliness(HttpServletResponse response, B2BDeliveryTimelinessQuery query) { - if(ObjectUtil.isEmpty(query.getStartCreateTime()) || ObjectUtil.isEmpty(query.getEndCreateTime())){ + if (ObjectUtil.isEmpty(query.getStartCreateTime()) || ObjectUtil.isEmpty(query.getEndCreateTime())) { throw new ServiceException("入库时间必须选择"); + } else { + // 时间跨度不能大于31天 + Duration duration = Duration.between( + query.getStartCreateTime().toInstant(), + query.getEndCreateTime().toInstant() + ); + if (duration.toDays() > 31) { + throw new ServiceException("时间跨度不能大于31天"); + } } trunklinePickupService.exportB2BDeliveryTimeliness(response, query); } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/TrunklinePickupMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/TrunklinePickupMapper.xml index 7314bd33f..7f3d9352d 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/TrunklinePickupMapper.xml +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/TrunklinePickupMapper.xml @@ -288,18 +288,17 @@ when ifnull(sum(t.num), 0) = 0 then 0 else round((ifnull(sum(tt.hgNum), 0)*100) / ifnull(sum(t.num), 0),2) end, '%') as signOnTimeRate from (select lww.business_line, t.warehouse, t.brand_name, - case when ifnull(lbc.type_service,1) = 1 then '商配' - when ifnull(lbc.type_service,1) = 2 then '市配' - when ifnull(lbc.type_service,1) = 3 then '自提' - when ifnull(lbc.type_service,1) = 4 then '三方中转' end - type_service - , count(distinct t.order_code) orderNum, sum(t.quantity) num + case + when ifnull(ldsa.type_service,'1') = '1' then '商配' + when ifnull(ldsa.type_service,'1') = '2' then '市配' + when ifnull(ldsa.type_service, '1') = '3' then '自提' + when ifnull(ldsa.type_service, '1') = '4' then '三方中转' end as type_service, + count(distinct t.order_code) orderNum, sum(t.quantity) num from logpm_distribution_parcel_list t - left join logpm_warehouse_waybill lww1 on lww1.waybill_no = t.waybill_number and lww1.is_deleted = 0 - left join logpm_basicdata_client lbc on lbc.client_name = lww1.consignee and lbc.is_deleted = 0 + join logpm_distribution_stock_article ldsa on ldsa.order_code = t.order_code and ldsa.is_deleted = 0 left join logpm_warehouse_warehouse lww on lww.id = t.warehouse_id where t.warehouse_entry_time_end >= #{query.startCreateTime} and t.warehouse_entry_time_end <= #{query.endCreateTime} - and t.is_transfer = 0 and (lbc.type_service != 2 or lbc.type_service is null) + and t.is_transfer = 0 and ldsa.type_service != '2' <if test="query.businessLineRange != null and query.businessLineRange != ''"> and lww.business_line in <foreach collection="query.businessLineRange.split(',')" item="businessLine" open="(" separator="," close=")"> @@ -325,7 +324,7 @@ </foreach> </if> <if test="query.typeServiceRange != null and query.typeServiceRange != ''"> - and ifnull(lbc.type_service,'1') in + and ifnull(ldsa.type_service,'1') in <foreach collection="query.typeServiceRange.split(',')" item="typeService" open="(" separator="," close=")"> <if test="typeService == '商配'.toString() "> '1' @@ -341,14 +340,11 @@ </if> </foreach> </if> - group by lww.business_line, t.warehouse, t.brand_name,ifnull(lbc.type_service,1)) t + group by lww.business_line, t.warehouse, t.brand_name,ifnull(ldsa.type_service,1)) t left join (select t.business_unit, t.warehouse_name, - t.brand_name, case when ifnull(lbc.type_service,1) = 1 then '商配' - when ifnull(lbc.type_service,1) = 2 then '市配' - when ifnull(lbc.type_service,1) = 3 then '自提' - when ifnull(lbc.type_service,1) = 4 then '三方中转' end - type_service, + t.brand_name, + t.custom_type as type_service, sum(t.sign_num) signNum, sum(case when t.sign_type = '文员批量签收' then t.sign_num else 0 end) batchNum, sum(case @@ -356,10 +352,8 @@ then 1 else 0 end) hgNum from logpm_quality_deliver t - left join logpm_warehouse_waybill lww1 on lww1.waybill_no = t.waybill_number and lww1.is_deleted = 0 - left join logpm_basicdata_client lbc on lbc.client_name = lww1.consignee and lbc.is_deleted = 0 where t.end_warehouse_in_time >= #{query.startCreateTime} and t.end_warehouse_in_time <= #{query.endCreateTime} - and t.sign_num is not null and (lbc.type_service != 2 or lbc.type_service is null) + and t.sign_num is not null and t.custom_type != '市配' <if test="query.businessLineRange != null and query.businessLineRange != ''"> and t.business_unit in <foreach collection="query.businessLineRange.split(',')" item="businessLine" open="(" separator="," close=")"> @@ -385,23 +379,12 @@ </foreach> </if> <if test="query.typeServiceRange != null and query.typeServiceRange != ''"> - and ifnull(lbc.type_service,'1') in + and t.custom_type in <foreach collection="query.typeServiceRange.split(',')" item="typeService" open="(" separator="," close=")"> - <if test="typeService == '商配'.toString() "> - '1' - </if> - <if test="typeService == '市配'.toString() "> - '2' - </if> - <if test="typeService == '自提'.toString() "> - '3' - </if> - <if test="typeService == '三方中转'.toString() "> - '4' - </if> + #{typeService} </foreach> </if> - group by t.business_unit, t.warehouse_name, t.brand_name,ifnull(lbc.type_service,1)) tt + group by t.business_unit, t.warehouse_name, t.brand_name,t.custom_type) tt on t.business_line = tt.business_unit and t.warehouse = tt.warehouse_name and t.brand_name = tt.brand_name and t.type_service = tt.type_service <if test="(query.businessLineRange != null and query.businessLineRange != '')