From 9be4bb5ae1d693eda98f28634c86b9b920ca36ca Mon Sep 17 00:00:00 2001 From: PigBaoBei <2739175034@qq.com> Date: Fri, 10 May 2024 16:12:16 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E9=80=81=E5=88=97=E8=A1=A8=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E3=80=81=E5=AF=BC=E5=87=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/utils/StringSplitUtil.java | 30 ++ .../dto/DistributionDeliveryListDTO.java | 26 ++ .../DistributionDeliveryListMapper.java | 2 +- .../mapper/DistributionDeliveryListMapper.xml | 351 +++++++++++++----- .../DistributionDeliveryListServiceImpl.java | 53 ++- 5 files changed, 331 insertions(+), 131 deletions(-) create mode 100644 blade-biz-common/src/main/java/org/springblade/common/utils/StringSplitUtil.java diff --git a/blade-biz-common/src/main/java/org/springblade/common/utils/StringSplitUtil.java b/blade-biz-common/src/main/java/org/springblade/common/utils/StringSplitUtil.java new file mode 100644 index 000000000..f83b8919a --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/utils/StringSplitUtil.java @@ -0,0 +1,30 @@ +package org.springblade.common.utils; + +import org.apache.logging.log4j.util.Strings; + +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +public class StringSplitUtil { + + + + public static List StringSplitToList(String string) { + List strs = null; + if (!Objects.isNull(string)) { + String str = string; + if (Strings.isNotBlank(str)) { + if (str.indexOf(",") > 0) { + //存在中文逗号 + str = str.replaceAll(",", ","); + } + strs = Arrays.stream(str.split(",")).collect(Collectors.toList()); + } + + } + return strs; + } + +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionDeliveryListDTO.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionDeliveryListDTO.java index d62c8941a..317b3f1a8 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionDeliveryListDTO.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionDeliveryListDTO.java @@ -88,6 +88,19 @@ public class DistributionDeliveryListDTO extends DistributionDeliveryListEntity @ApiModelProperty(value = "主司机信息") private String masterDriverName; + /** + * 车次号多个 + */ + @ApiModelProperty(value = "车次号多个") + private String trainNumbers; + + + /** + * 车次号多个 + */ + @ApiModelProperty(value = "车次号多个") + private List trainNumberList; + /** * 主车辆信息 */ @@ -99,6 +112,19 @@ public class DistributionDeliveryListDTO extends DistributionDeliveryListEntity @ApiModelProperty(value = "备注") private String remarks; + + /** + * 时间区间起始 + */ + @ApiModelProperty(value = "备注") + private String taskTimeStart; + + /** + * 时间区间结束 + */ + @ApiModelProperty(value = "备注") + private String taskTimeEnd; + /** * 是否修改司机 */ diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java index 209a3ed9b..90e961ee7 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java @@ -60,7 +60,7 @@ public interface DistributionDeliveryListMapper extends BaseMapper exportDistributionDeliveryList(@Param("params") Map map); + List exportDistributionDeliveryList(@Param("param") Map map); /** * 商配车次 * diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml index b3937b3cb..bc07253dc 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml @@ -192,14 +192,14 @@ ) inventoryNub, ( SELECT - COALESCE (sum(lds.loaded_number), 0) + COALESCE (sum(lds.loaded_number), 0) + COALESCE (sum(lds.loadedin_number), 0) FROM logpm_distribution_signfor lds WHERE lddl.id = lds.delivery_id ) scannedNumber, (SELECT - COALESCE (sum(lds.received_quantity), 0) + COALESCE (sum(lds.received_quantity), 0) + COALESCE (sum(lds.receivedin_quantity), 0) FROM logpm_distribution_signfor lds WHERE @@ -219,6 +219,12 @@ and lddl.train_number like concat('%',#{param.trainNumber},'%') + + and lddl.train_number IN + + #{train} + + and lddl.warehouse_id in @@ -270,6 +276,9 @@ and date_format(lddl.task_time,'%y%m%d%') = date_format(#{param.taskTime},'%y%m%d%') + + and date_format(lddl.task_time,'%y%m%d%') BETWEEN #{param.taskTimeStart} AND #{param.taskTimeEnd} + GROUP BY lddl.id , lddl.train_number , @@ -307,119 +316,263 @@ - + SELECT + lddl.id id, + lww.name AS warehouseName, + lddl.train_number trainNumber, + lddl.warehouse_name warehouseName, + lddl.warehouse_id warehouseId, + lddl.vehicle_name vehicle, + lddl.driver_name driver, + lddl.vehicle_id vehicleId, + lddl.driver_id driverId, + lddl.distribution_company distributionCompany, + lddl.delivery_status deliveryStatus, + lddl.delivery_list_loading_status deliveryListLoadingStatus, + GROUP_CONCAT(y.order_code) AS orderCode, + CASE lddl.kind + WHEN 1 THEN '自主配送' + WHEN 2 THEN '三方配送' + ELSE + '其他' + END kind, + CASE lddl.type + WHEN 1 THEN '商配' + WHEN 2 THEN '市配' + END type, + CASE lddl.delivery_status + WHEN 1 THEN '待配送' + WHEN 2 THEN '配送中' + WHEN 3 THEN '已完成' + ELSE + '其他' + END state, + ( + SELECT + GROUP_CONCAT( + DISTINCT ldsu.forklift_name SEPARATOR ',' + ) + FROM + logpm_distribution_signfor lds + JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id + JOIN logpm_distribution_stockup_info ldsi ON ldr.id = ldsi.reservation_id + JOIN logpm_distribution_stockup ldsu ON ldsu.id = ldsi.stockup_id + WHERE + lds.delivery_id = lddl.id + ) forkliftName, + lddl.create_time createTime, + ( + SELECT + COALESCE (COUNT(*), 0) + FROM + logpm_distribution_signfor lds INNER JOIN logpm_distribution_reservation AS ldr ON lds.reservation_id = ldr.id + WHERE + lds.delivery_id = lddl.id and ldr.reservation_status != '40' AND (ldr.reservation_num + ldr.reservation_stock_list_num) > 0 + ) customersNumber, + lddl.price price, + lddl.added_services_id addedServicesId, + ( + SELECT + COALESCE (COUNT(*), 0) + FROM + logpm_distribution_signfor lds + JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id + JOIN logpm_distribution_reservation_stockarticle ldrs ON ldrs.reservation_id = ldr.id + WHERE + lds.delivery_id = lddl.id and ldrs.stock_article_status != 2 + ) orderNumber, + ( + SELECT + COALESCE (sum(ldr.reservation_num), 0) + FROM + logpm_distribution_signfor lds + JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id + WHERE + lds.delivery_id = lddl.id and ldr.reservation_status != '40' + ) deliveryNumber, + ( + SELECT + COALESCE ( + sum( + ldr.reservation_stock_list_num + ), + 0 + ) + FROM + logpm_distribution_signfor lds + JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id + WHERE + lds.delivery_id = lddl.id + ) reservationStockListNum, + ( + SELECT + GROUP_CONCAT( + DISTINCT lds.loader_name SEPARATOR ',' + ) + FROM + logpm_distribution_signfor ldsf + JOIN logpm_distribution_reservation ldr ON ldr.id = ldsf.reservation_id + JOIN logpm_distribution_stockup_info AS ldsi ON ldr.id = ldsi.reservation_id + INNER JOIN logpm_distribution_stockup AS lds ON ldsi.stockup_id = lds.id + WHERE + ldsf.delivery_id = lddl.id + ) loadingTeamName, + ( + SELECT + GROUP_CONCAT( + DISTINCT lds.fix_time SEPARATOR ',' + ) + FROM + logpm_distribution_signfor ldsf + JOIN logpm_distribution_reservation ldr ON ldr.id = ldsf.reservation_id + JOIN logpm_distribution_stockup_info AS ldsi ON ldr.id = ldsi.reservation_id + INNER JOIN logpm_distribution_stockup AS lds ON ldsi.stockup_id = lds.id + WHERE + ldsf.delivery_id = lddl.id + -- ) leadTime, + -- lds.delivery_id = lddl.id + ) reservationId, + lddl.order_id orderId, + lddl.fee fee, + lddl.task_time taskTime, + lddl.loading_time loadingTime, + lddl.note_number noteNumber, + lddl.source source, ( SELECT - COALESCE (sum(lds.loaded_number + lds.loadedin_number), 0) + COALESCE ( + sum( + ldr.reservation_stock_list_num + ), + 0 + ) + FROM + logpm_distribution_signfor lds + JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id + WHERE + lds.delivery_id = lddl.id + ) inventoryNub, + ( + SELECT + COALESCE (sum(lds.loaded_number), 0) + COALESCE (sum(lds.loadedin_number), 0) FROM logpm_distribution_signfor lds WHERE lddl.id = lds.delivery_id ) scannedNumber, (SELECT - COALESCE (sum(lds.received_quantity + receivedin_quantity), 0) + COALESCE (sum(lds.received_quantity), 0) + COALESCE (sum(lds.receivedin_quantity), 0) FROM logpm_distribution_signfor lds WHERE lddl.id = lds.delivery_id ) signingNumber, - GROUP_CONCAT( lddl.loading_team_name, lddl.unloading_team_name ) AS handlingCrew + GROUP_CONCAT(DISTINCT ldr.consignee SEPARATOR ',') consignee, + GROUP_CONCAT(DISTINCT ldr.mall_name SEPARATOR ',') mallName, + (SELECT group_concat( DISTINCT ldsa.order_code SEPARATOR ',' ) FROM logpm_distribution_delivery_list lddll LEFT JOIN logpm_distribution_signfor lds ON lddll.id = lds.delivery_id LEFT JOIN logpm_distribution_reservation_stockarticle AS ldrs ON lds.reservation_id = ldrs.reservation_id AND ldrs.stock_article_status != 2 LEFT JOIN logpm_distribution_stock_article AS ldsa ON ldrs.stock_article_id = ldsa.id WHERE lddll.id = lddl.id GROUP BY lddl.id ) AS orderCode + FROM logpm_distribution_delivery_list lddl + LEFT JOIN ( + SELECT + lddl.id, + a.consignee AS consignee, + a.mall_name AS mallName, FROM - logpm_distribution_delivery_list AS lddl - LEFT JOIN logpm_distribution_signfor AS lds ON lddl.id = lds.delivery_id AND lds.is_deleted = 0 - LEFT JOIN logpm_distribution_reservation AS ldr ON lds.reservation_id = ldr.id AND ldr.is_deleted = 0 - LEFT JOIN logpm_distribution_delivery_self AS ldds ON ldds.delivery_id = lddl.id AND ldds.is_deleted = 0 - LEFT JOIN logpm_distribution_delivery_tripartite AS lddt ON ldds.delivery_id = lddl.id AND lddt.is_deleted = 0 - - lddl.is_deleted = 0 - - AND lddl.id in - - #{item} - - - - AND lddl.train_number like concat('%',#{params.trainNumber},'%') - - - AND ldr.consignee like concat('%',#{params.clineName},'%') - - - AND ldr.mall_name like concat('%',#{params.mallName},'%') - - - AND lddl.type = #{params.type} - - - AND lddl.kind = #{params.kind} - - - AND ldds.vehicle_nub like concat('%',#{params.vehicleName},'%') - - - AND ldds.driver_name like concat('%',#{params.driverName},'%') - - - AND ldds.distribution_company like concat('%',#{params.distributionCompany},'%') - - - AND ldds.task_time like concat('%',#{params.taskTime},'%') - - - AND lddl.delivery_status =#{params.deliveryStatus} - - - AND lddl.warehouse_id =#{params.warehouseId} - - - AND lddl.warehouse_id IN - - #{warehouseId} - - - + logpm_distribution_delivery_list lddl + LEFT JOIN logpm_distribution_signfor lds ON lddl.id = lds.delivery_id + LEFT JOIN logpm_distribution_reservation ldr ON ldr.id = lds.reservation_id + WHERE + IF + ( lddl.delivery_number IS NULL, 0, lddl.delivery_number ) + + IF + ( lddl.inventory_nub IS NULL, 0, lddl.inventory_nub ) > 0 + AND ( lddl.customers_number > 0 AND ldr.reservation_num + ldr.reservation_stock_list_num ) > 0 + AND lds.is_deleted = 0 AND lddl.is_deleted = 0 AND ldr.is_deleted = 0 GROUP BY lddl.id + ) AS a On a.id = lddl.id + LEFT JOIN (SELECT lddl.id,ldsa.order_code FROM logpm_distribution_delivery_list lddl + LEFT JOIN logpm_distribution_signfor lds ON lddl.id = lds.delivery_id + LEFT JOIN logpm_distribution_reservation_stockarticle AS ldrs ON lds.reservation_id = ldrs.reservation_id AND ldrs.stock_article_status != 2 + LEFT JOIN logpm_distribution_stock_article AS ldsa ON ldrs.stock_article_id = ldsa.id ) AS y ON y.id = lddl.id + LEFT JOIN logpm_warehouse_warehouse AS lww ON lddl.warehouse_id = lww.id + + lddl.is_deleted = 0 + AND (IF(lddl.delivery_number is null ,0,lddl.delivery_number) + IF(lddl.inventory_nub is null ,0,lddl.inventory_nub)) > 0 + AND (lddl.customers_number > 0 AND ldr.reservation_num + ldr.reservation_stock_list_num) >0 + + and lddl.train_number like concat('%',#{param.trainNumber},'%') + + + and lddl.warehouse_id in + + #{item} + + + + and lddl.warehouse_name like concat('%',#{param.warehouseName},'%') + + + and a.consignee like concat('%',#{param.clineName},'%') + + + and a.mall_name like concat('%',#{param.mallName},'%') + + + and lddl.vehicle_name like concat('%',#{param.vehicleName},'%') + + + and lddl.driver_name like concat('%',#{param.driverName},'%') + + + and lddl.loading_team_name like concat('%',#{param.loadingTeamName},'%') + + + and y.order_code like concat('%',#{param.orderCode},'%') + + + and lddl.kind = #{param.kind} + + + and lddl.distribution_company = #{param.distributionCompany} + + + and lddl.type = #{param.type} + + + and lddl.delivery_status = #{param.deliveryStatus} + + + and date_format(lddl.create_time,'%y%m%d%') = date_format(#{param.createTime_query},'%y%m%d%') + + + and date_format(lddl.lead_time,'%y%m%d%') = date_format(#{param.leadTime},'%y%m%d%') + + + and date_format(lddl.loading_time,'%y%m%d%') = date_format(#{param.loadingTime},'%y%m%d%') + + + and date_format(lddl.task_time,'%y%m%d%') = date_format(#{param.taskTime},'%y%m%d%') + + + and date_format(lddl.task_time,'%y%m%d%') BETWEEN #{param.taskTimeStart} AND #{param.taskTimeEnd} + + + GROUP BY lddl.id , + lddl.train_number, + lddl.warehouse_name , + lddl.warehouse_id , + lddl.type , + lddl.kind , + lddl.vehicle_name , + lddl.driver_name , + lddl.vehicle_id , + lddl.driver_id , + lddl.distribution_company , + lddl.delivery_status , + lddl.delivery_list_loading_status + ORDER BY + lddl.create_time DESC