44 changed files with 1828 additions and 99 deletions
@ -0,0 +1,25 @@ |
|||||||
|
package com.logpm.report.config; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.DbType; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
||||||
|
import org.mybatis.spring.annotation.MapperScan; |
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author zhaoqiaobo |
||||||
|
* @create 2024-03-08 13:59 |
||||||
|
*/ |
||||||
|
@Configuration |
||||||
|
@MapperScan("com.baomidou.cloud.service.*.mapper*r") |
||||||
|
public class MybatisPlusConfig { |
||||||
|
|
||||||
|
@Bean |
||||||
|
public MybatisPlusInterceptor mybatisPlusInterceptor(){ |
||||||
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
||||||
|
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); |
||||||
|
return interceptor; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,110 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are met: |
||||||
|
* |
||||||
|
* Redistributions of source code must retain the above copyright notice, |
||||||
|
* this list of conditions and the following disclaimer. |
||||||
|
* Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* Neither the name of the dreamlu.net developer nor the names of its |
||||||
|
* contributors may be used to endorse or promote products derived from |
||||||
|
* this software without specific prior written permission. |
||||||
|
* Author: Chill 庄骞 (smallchill@163.com) |
||||||
|
*/ |
||||||
|
package com.logpm.report.controller; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import com.logpm.report.service.ReportDeliverService; |
||||||
|
import com.logpm.report.vo.ReportCustomerVO; |
||||||
|
import com.logpm.report.vo.ReportDetailVO; |
||||||
|
import com.logpm.report.vo.ReportDevilerVO; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.springblade.core.boot.ctrl.BladeController; |
||||||
|
import org.springblade.core.mp.support.Query; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
|
||||||
|
/** |
||||||
|
* 配送报表 控制器 |
||||||
|
* |
||||||
|
* @author cyz |
||||||
|
* @since 2023-06-08 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/reportDelivery") |
||||||
|
@Api(value = "配送报表", tags = "配送报表") |
||||||
|
public class ReportDeliveryController extends BladeController { |
||||||
|
|
||||||
|
private final ReportDeliverService reportDeliverService; |
||||||
|
|
||||||
|
@GetMapping("/train") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "配送车次报表", notes = "配送车次报表") |
||||||
|
public R<IPage<ReportDevilerVO>> deliveryTrainPage(ReportDevilerVO vo, Query query) { |
||||||
|
IPage<ReportDevilerVO> pages = reportDeliverService.deliveryTrainPage(vo, query); |
||||||
|
return R.data(pages); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/exportTrain") |
||||||
|
@ApiOperationSupport(order = 2) |
||||||
|
@ApiOperation(value = "导出配送车次报表", notes = "导出配送车次报表") |
||||||
|
public void exportTrain(HttpServletResponse response, ReportDevilerVO vo) { |
||||||
|
try { |
||||||
|
reportDeliverService.exportTrain(response, vo); |
||||||
|
} catch (Exception e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/customer") |
||||||
|
@ApiOperationSupport(order = 3) |
||||||
|
@ApiOperation(value = "配送客户报表", notes = "配送客户报表") |
||||||
|
public R<IPage<ReportCustomerVO>> customerPage(ReportCustomerVO vo, Query query) { |
||||||
|
IPage<ReportCustomerVO> pages = reportDeliverService.customerPage(vo, query); |
||||||
|
return R.data(pages); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/exportCustomer") |
||||||
|
@ApiOperationSupport(order = 4) |
||||||
|
@ApiOperation(value = "导出配送客户报表", notes = "导出配送客户报表") |
||||||
|
public void exportCustomer(HttpServletResponse response, ReportCustomerVO vo) { |
||||||
|
try { |
||||||
|
reportDeliverService.exportCustomer(response, vo); |
||||||
|
} catch (Exception e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/details") |
||||||
|
@ApiOperationSupport(order = 3) |
||||||
|
@ApiOperation(value = "配送明细报表", notes = "配送明细报表") |
||||||
|
public R<IPage<ReportDetailVO>> detailsPage(ReportDetailVO vo, Query query) { |
||||||
|
IPage<ReportDetailVO> pages = reportDeliverService.detailsPage(vo, query); |
||||||
|
return R.data(pages); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/exportDetails") |
||||||
|
@ApiOperationSupport(order = 4) |
||||||
|
@ApiOperation(value = "导出配送明细报表", notes = "导出配送明细报表") |
||||||
|
public void exportDetails(HttpServletResponse response, ReportDetailVO vo) { |
||||||
|
try { |
||||||
|
reportDeliverService.exportDetails(response, vo); |
||||||
|
} catch (Exception e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,28 @@ |
|||||||
|
package com.logpm.report.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.logpm.report.vo.ReportCustomerVO; |
||||||
|
import com.logpm.report.vo.ReportDetailVO; |
||||||
|
import com.logpm.report.vo.ReportDevilerVO; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author zhaoqiaobo |
||||||
|
* @create 2024-03-06 15:54 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface ReportDeliverMapeer extends BaseMapper { |
||||||
|
|
||||||
|
List<ReportDevilerVO> getDeliveryTrainPage(IPage<ReportDevilerVO> page, @Param("ew") Wrapper<ReportDevilerVO> query); |
||||||
|
|
||||||
|
List<ReportCustomerVO> getCustomerPage(IPage<ReportCustomerVO> page, @Param("ew") Wrapper query); |
||||||
|
|
||||||
|
List<ReportDetailVO> getDetailsPage(IPage<ReportDetailVO> page, @Param("ew") Wrapper query); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,429 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.logpm.report.mapper.ReportDeliverMapeer"> |
||||||
|
|
||||||
|
<select id="getDeliveryTrainPage" resultType="com.logpm.report.vo.ReportDevilerVO"> |
||||||
|
select * from (SELECT d.train_number train_number, |
||||||
|
d.task_time task_time, |
||||||
|
d.warehouse_name warehouse_name, |
||||||
|
CASE |
||||||
|
WHEN d.type = 1 THEN |
||||||
|
'市配' |
||||||
|
WHEN d.type = 2 THEN |
||||||
|
'商配' |
||||||
|
ELSE '' |
||||||
|
END type, |
||||||
|
CASE |
||||||
|
WHEN d.kind = 1 THEN |
||||||
|
'自主配送' |
||||||
|
WHEN d.kind = 2 THEN |
||||||
|
'自主配送' |
||||||
|
ELSE '' |
||||||
|
END kind, |
||||||
|
d.vehicle_name vehicle_name, |
||||||
|
d.driver_name driver_name, |
||||||
|
d.distribution_company distribution_company, |
||||||
|
CASE |
||||||
|
WHEN d.delivery_status = 1 THEN |
||||||
|
'待配送' |
||||||
|
WHEN d.delivery_status = 2 THEN |
||||||
|
'配送中' |
||||||
|
WHEN d.delivery_status = 3 THEN |
||||||
|
'已完成' |
||||||
|
ELSE '' |
||||||
|
END delivery_status, |
||||||
|
d.customers_number customers_number, |
||||||
|
d.price, |
||||||
|
d.order_number order_number, |
||||||
|
rn.num reservation_num, |
||||||
|
rsln.num reservation_stock_listNum, |
||||||
|
IFNULL(loadScan.loadedNum,0) loaded_num, |
||||||
|
IFNULL(loadscaninvn.loadedNum,0) invn_loaded_num, |
||||||
|
IFNULL(loadScan.exLoadedNum,0) ex_loaded_num, |
||||||
|
IFNULL(loadScan.reNum,0) re_num, |
||||||
|
IFNULL(loadscaninvn.reNum,0) invn_re_num, |
||||||
|
IFNULL(loadScan.exReNum,0) ex_reNum, |
||||||
|
ifnull(ds.dsNum,0)ds_num, |
||||||
|
ifnull(ds.ssNum,0)ss_num, |
||||||
|
ifnull(d.unloading_team_name,'') unloading_team_name |
||||||
|
FROM |
||||||
|
logpm_distribution_delivery_list d |
||||||
|
LEFT JOIN ( |
||||||
|
SELECT |
||||||
|
lds.delivery_id, |
||||||
|
COALESCE ( sum( ldr.reservation_num ), 0 ) num |
||||||
|
FROM |
||||||
|
logpm_distribution_signfor lds |
||||||
|
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id |
||||||
|
WHERE |
||||||
|
ldr.reservation_status != '40' |
||||||
|
GROUP BY |
||||||
|
lds.delivery_id |
||||||
|
) rn ON rn.delivery_id = d.id |
||||||
|
|
||||||
|
LEFT JOIN ( |
||||||
|
SELECT |
||||||
|
lds.delivery_id, |
||||||
|
COALESCE ( sum( ldr.reservation_stock_list_num ), 0 ) num |
||||||
|
FROM |
||||||
|
logpm_distribution_signfor lds |
||||||
|
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id |
||||||
|
GROUP BY |
||||||
|
lds.delivery_id |
||||||
|
) rsln ON rsln.delivery_id = d.id |
||||||
|
|
||||||
|
left join ( |
||||||
|
select |
||||||
|
t.delivery_id,SUM(t.loaded_nub) loadedNum,sum(t.received_quantity) reNum,sum(t.is_abnormal_loading) exLoadedNum,sum(t.is_abnormal_signing) exReNum |
||||||
|
from logpm_distribution_loadscan t |
||||||
|
group by t.delivery_id |
||||||
|
) loadScan on loadScan.delivery_id = d.id |
||||||
|
|
||||||
|
left join ( |
||||||
|
select |
||||||
|
t.delivery_id,SUM(t.loaded_nub) loadedNum,sum(t.received_quantity) reNum |
||||||
|
from logpm_distribution_loadscaninvn t |
||||||
|
group by t.delivery_id |
||||||
|
) loadscaninvn on loadscaninvn.delivery_id = d.id |
||||||
|
|
||||||
|
left join ( |
||||||
|
select |
||||||
|
t.delivery_id, |
||||||
|
SUM(CASE |
||||||
|
WHEN t.driver_signing = 2 THEN |
||||||
|
1 |
||||||
|
ELSE |
||||||
|
0 |
||||||
|
END) dsNum, |
||||||
|
SUM(CASE |
||||||
|
WHEN t.signing_status = 2 THEN |
||||||
|
1 |
||||||
|
ELSE |
||||||
|
0 |
||||||
|
END) ssNum |
||||||
|
from logpm_distribution_signfor t |
||||||
|
group by t.delivery_id |
||||||
|
) ds on ds.delivery_id = d.id) t |
||||||
|
${ew.customSqlSegment} |
||||||
|
</select> |
||||||
|
<select id="getCustomerPage" resultType="com.logpm.report.vo.ReportCustomerVO"> |
||||||
|
select * |
||||||
|
from (select lddl.train_number train_number, |
||||||
|
obj.reservation_code reservation_code, |
||||||
|
obj.stock_article_id stock_article_id, |
||||||
|
lddl.task_time task_time, |
||||||
|
lddl.warehouse_name warehouse_name, |
||||||
|
obj.receiving_unit receiving_unit, |
||||||
|
obj.mall_name mall_name, |
||||||
|
obj.consignee, |
||||||
|
obj.delivery_phone delivery_phone, |
||||||
|
obj.delivery_address delivery_address, |
||||||
|
CASE |
||||||
|
WHEN lddl.type = 1 THEN |
||||||
|
'市配' |
||||||
|
WHEN lddl.type = 2 THEN |
||||||
|
'商配' |
||||||
|
ELSE '' |
||||||
|
END type, |
||||||
|
CASE |
||||||
|
WHEN lddl.kind = 1 THEN |
||||||
|
'自主配送' |
||||||
|
WHEN lddl.kind = 2 THEN |
||||||
|
'自主配送' |
||||||
|
ELSE '' |
||||||
|
END kind, |
||||||
|
lddl.vehicle_name vehicle_name, |
||||||
|
lddl.driver_name driver_name, |
||||||
|
lddl.distribution_company distribution_company, |
||||||
|
CASE |
||||||
|
WHEN lddl.delivery_status = 1 THEN |
||||||
|
'待配送' |
||||||
|
WHEN lddl.delivery_status = 2 THEN |
||||||
|
'配送中' |
||||||
|
WHEN lddl.delivery_status = 3 THEN |
||||||
|
'已完成' |
||||||
|
ELSE '' |
||||||
|
END delivery_status, |
||||||
|
lddl.order_number order_number, |
||||||
|
rn.num reservation_num, |
||||||
|
rsln.num reservation_stock_sist_num, |
||||||
|
IFNULL(loadScan.loadedNum, 0) loaded_num, |
||||||
|
IFNULL(loadscaninvn.loadedNum, 0) invn_loaded_num, |
||||||
|
IFNULL(loadScan.exLoadedNum, 0) ex_loaded_num, |
||||||
|
IFNULL(loadScan.reNum, 0) re_num, |
||||||
|
IFNULL(loadscaninvn.reNum, 0) invn_re_num, |
||||||
|
IFNULL(loadScan.exReNum, 0) ex_re_num, |
||||||
|
lds.sjsigning_time sjsigning_time, |
||||||
|
lds.signee_name signee_name, |
||||||
|
lds.signing_time signing_time, |
||||||
|
lds.examine_user_name examine_user_name |
||||||
|
from logpm_distribution_reservation obj |
||||||
|
left join logpm_distribution_signfor lds on lds.reservation_id = obj.id |
||||||
|
left join logpm_distribution_delivery_list lddl on lds.delivery_id = lddl.id |
||||||
|
LEFT JOIN ( |
||||||
|
SELECT lds.delivery_id, |
||||||
|
COALESCE(sum(ldr.reservation_num), 0) num |
||||||
|
FROM logpm_distribution_signfor lds |
||||||
|
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id |
||||||
|
WHERE ldr.reservation_status != '40' |
||||||
|
GROUP BY |
||||||
|
lds.delivery_id |
||||||
|
) rn ON rn.delivery_id = lddl.id |
||||||
|
|
||||||
|
LEFT JOIN ( |
||||||
|
SELECT lds.delivery_id, |
||||||
|
COALESCE(sum(ldr.reservation_stock_list_num), 0) num |
||||||
|
FROM logpm_distribution_signfor lds |
||||||
|
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id |
||||||
|
GROUP BY lds.delivery_id |
||||||
|
) rsln ON rsln.delivery_id = lddl.id |
||||||
|
|
||||||
|
left join ( |
||||||
|
select t.delivery_id, |
||||||
|
SUM(t.loaded_nub) loadedNum, |
||||||
|
sum(t.received_quantity) reNum, |
||||||
|
sum(t.is_abnormal_loading) exLoadedNum, |
||||||
|
sum(t.is_abnormal_signing) exReNum |
||||||
|
from logpm_distribution_loadscan t |
||||||
|
group by t.delivery_id |
||||||
|
) loadScan on loadScan.delivery_id = lddl.id |
||||||
|
|
||||||
|
left join ( |
||||||
|
select t.delivery_id, |
||||||
|
SUM(t.loaded_nub) loadedNum, |
||||||
|
sum(t.received_quantity) reNum |
||||||
|
from logpm_distribution_loadscaninvn t |
||||||
|
group by t.delivery_id |
||||||
|
) loadscaninvn on loadscaninvn.delivery_id = lddl.id |
||||||
|
)t |
||||||
|
${ew.customSqlSegment} |
||||||
|
</select> |
||||||
|
<select id="getDetailsPage" resultType="com.logpm.report.vo.ReportDetailVO"> |
||||||
|
select * |
||||||
|
from ( |
||||||
|
SELECT drp.reservation_id id, |
||||||
|
lddl.train_number train_number, |
||||||
|
obj.reservation_code reservation_code, |
||||||
|
lddl.task_time task_time, |
||||||
|
lddl.warehouse_name warehouse_name, |
||||||
|
CASE |
||||||
|
WHEN lddl.type = 1 THEN |
||||||
|
'市配' |
||||||
|
WHEN lddl.type = 2 THEN |
||||||
|
'商配' |
||||||
|
ELSE '' |
||||||
|
END type, |
||||||
|
CASE |
||||||
|
WHEN lddl.kind = 1 THEN |
||||||
|
'自主配送' |
||||||
|
WHEN lddl.kind = 2 THEN |
||||||
|
'自主配送' |
||||||
|
ELSE '' |
||||||
|
END kind, |
||||||
|
lddl.vehicle_name vehicle_name, |
||||||
|
lddl.driver_name driver_name, |
||||||
|
lddl.distribution_company distribution_company, |
||||||
|
obj.consignee dr_consignee, |
||||||
|
obj.delivery_phone delivery_phone, |
||||||
|
obj.delivery_address delivery_address, |
||||||
|
wi.consignee, |
||||||
|
wi.consignee_name consignee_name, |
||||||
|
wi.consignee_mobile consignee_mobile, |
||||||
|
wi.waybill_no waybill_no, |
||||||
|
obj.stock_article_id stock_article_id, |
||||||
|
dpl.order_package_code order_package_code, |
||||||
|
wi.customer_train customer_train, |
||||||
|
CASE |
||||||
|
|
||||||
|
WHEN dpl.conditions = 1 THEN |
||||||
|
'定制品' |
||||||
|
WHEN dpl.conditions = 2 THEN |
||||||
|
'库存品' |
||||||
|
ELSE '零担' |
||||||
|
END conditions, |
||||||
|
dpl.firsts, |
||||||
|
dpl.SECOND decond, |
||||||
|
dpl.third_product third_product, |
||||||
|
dpl.material_code material_code, |
||||||
|
dpl.material_name material_name, |
||||||
|
'' start_war, |
||||||
|
'' start_war_in_time, |
||||||
|
'' start_war_out_time, |
||||||
|
dpl.warehouse_entry_time_end warehouse_entry_time_end, |
||||||
|
ldl.unload_time unload_time, |
||||||
|
ldl.un_administrators_name un_administrators_name, |
||||||
|
|
||||||
|
lds.sjsigning_time sjsigning_time, |
||||||
|
lds.signee_name lds_signee_name, |
||||||
|
CASE |
||||||
|
|
||||||
|
WHEN lds.signing_status = 1 THEN |
||||||
|
'未签收' |
||||||
|
WHEN lds.signing_status = 1 THEN |
||||||
|
'签收' |
||||||
|
ELSE '' |
||||||
|
END signing_status, |
||||||
|
lds.signing_time signing_time, |
||||||
|
lds.examine_user_name examine_user_name, |
||||||
|
CASE |
||||||
|
|
||||||
|
WHEN ldl.is_abnormal_signing = 1 THEN |
||||||
|
'是' |
||||||
|
ELSE '否' |
||||||
|
END abnormal_signing, |
||||||
|
CASE |
||||||
|
|
||||||
|
WHEN ldl.is_abnormal_loading = 1 THEN |
||||||
|
'是' |
||||||
|
ELSE '否' |
||||||
|
END abnormal_loading, |
||||||
|
CASE |
||||||
|
|
||||||
|
WHEN ldla.auditing_status = 3 THEN |
||||||
|
'异常' |
||||||
|
WHEN ldla.auditing_status = 1 THEN |
||||||
|
'未审核' |
||||||
|
WHEN ldla.auditing_status = 2 THEN |
||||||
|
'已审核' |
||||||
|
ELSE '' |
||||||
|
END auditing_status, |
||||||
|
ldla.auditing_user auditing_user, |
||||||
|
ldla.auditing_time auditing_time |
||||||
|
FROM logpm_distribution_reservation_package drp |
||||||
|
LEFT JOIN logpm_distribution_parcel_list dpl |
||||||
|
ON dpl.order_package_code = drp.packet_bar_code AND dpl.is_deleted = 0 |
||||||
|
left join logpm_distribution_reservation obj on drp.reservation_id = obj.id |
||||||
|
LEFT JOIN logpm_distribution_signfor lds ON lds.reservation_id = drp.reservation_id |
||||||
|
LEFT JOIN logpm_distribution_delivery_list lddl ON lds.delivery_id = lddl.id |
||||||
|
LEFT JOIN logpm_warehouse_waybill wi ON wi.id = obj.waybill_id |
||||||
|
LEFT JOIN logpm_distribution_loadscan ldl |
||||||
|
ON ldl.order_package_code = dpl.order_package_code |
||||||
|
AND ldl.type = 2 |
||||||
|
LEFT JOIN logpm_distribution_loadscan_abnormal ldla |
||||||
|
ON ldla.package_code = dpl.order_package_code |
||||||
|
) t |
||||||
|
${ew.customSqlSegment} |
||||||
|
<if test="ew!=null and ew.customSqlSegment !=null and ew.customSqlSegment!=''"> |
||||||
|
and |
||||||
|
</if> |
||||||
|
<if test="ew==null or ew.customSqlSegment ==null or ew.customSqlSegment==''"> |
||||||
|
where |
||||||
|
</if> |
||||||
|
EXISTS( |
||||||
|
SELECT obj.id |
||||||
|
FROM logpm_distribution_reservation obj |
||||||
|
WHERE obj.id = t.id) |
||||||
|
|
||||||
|
|
||||||
|
union all |
||||||
|
|
||||||
|
select * |
||||||
|
from (SELECT drp.reservation_id id, |
||||||
|
lddl.train_number train_number, |
||||||
|
obj.reservation_code reservation_code, |
||||||
|
lddl.task_time task_time, |
||||||
|
lddl.warehouse_name warehouse_name, |
||||||
|
CASE |
||||||
|
WHEN lddl.type = 1 THEN |
||||||
|
'市配' |
||||||
|
WHEN lddl.type = 2 THEN |
||||||
|
'商配' |
||||||
|
ELSE '' |
||||||
|
END type, |
||||||
|
CASE |
||||||
|
WHEN lddl.kind = 1 THEN |
||||||
|
'自主配送' |
||||||
|
WHEN lddl.kind = 2 THEN |
||||||
|
'自主配送' |
||||||
|
ELSE '' |
||||||
|
END kind, |
||||||
|
lddl.vehicle_name vehicle_name, |
||||||
|
lddl.driver_name driver_name, |
||||||
|
lddl.distribution_company distribution_company, |
||||||
|
obj.consignee dr_consignee, |
||||||
|
obj.delivery_phone delivery_phone, |
||||||
|
obj.delivery_address delivery_address, |
||||||
|
wi.consignee, |
||||||
|
wi.consignee_name consignee_name, |
||||||
|
wi.consignee_mobile consignee_mobile, |
||||||
|
wi.waybill_no waybill_no, |
||||||
|
obj.stock_article_id stock_article_id, |
||||||
|
dpl.order_package_code order_package_code, |
||||||
|
wi.customer_train customer_train, |
||||||
|
CASE |
||||||
|
WHEN dpl.conditions = 1 THEN |
||||||
|
'定制品' |
||||||
|
WHEN dpl.conditions = 2 THEN |
||||||
|
'库存品' |
||||||
|
ELSE '零担' |
||||||
|
END conditions, |
||||||
|
dpl.firsts, |
||||||
|
dpl.SECOND decond, |
||||||
|
dpl.third_product third_product, |
||||||
|
dpl.material_code material_code, |
||||||
|
dpl.material_name material_name, |
||||||
|
'' start_war, |
||||||
|
'' start_war_in_time, |
||||||
|
'' start_war_out_time, |
||||||
|
dpl.warehouse_entry_time_end warehouse_entry_time_end, |
||||||
|
ldl.unload_time unload_time, |
||||||
|
ldl.un_administrators_name un_administrators_name, |
||||||
|
lds.sjsigning_time sjsigning_time, |
||||||
|
lds.signee_name lds_signee_name, |
||||||
|
CASE |
||||||
|
WHEN lds.signing_status = 1 THEN |
||||||
|
'未签收' |
||||||
|
WHEN lds.signing_status = 1 THEN |
||||||
|
'签收' |
||||||
|
ELSE '' |
||||||
|
END signing_status, |
||||||
|
lds.signing_time signing_time, |
||||||
|
lds.examine_user_name examine_user_name, |
||||||
|
CASE |
||||||
|
WHEN ldl.is_abnormal_signing = 1 THEN |
||||||
|
'是' |
||||||
|
ELSE '否' |
||||||
|
END abnormal_signing, |
||||||
|
CASE |
||||||
|
WHEN ldl.is_abnormal_loading = 1 THEN |
||||||
|
'是' |
||||||
|
ELSE '否' |
||||||
|
END abnormal_loading, |
||||||
|
CASE |
||||||
|
WHEN ldla.auditing_status = 3 THEN |
||||||
|
'异常' |
||||||
|
WHEN ldla.auditing_status = 1 THEN |
||||||
|
'未审核' |
||||||
|
WHEN ldla.auditing_status = 2 THEN |
||||||
|
'已审核' |
||||||
|
ELSE '' |
||||||
|
END auditing_status, |
||||||
|
ldla.auditing_user auditing_user, |
||||||
|
ldla.auditing_time auditing_time |
||||||
|
FROM logpm_distribution_reservation_zero_package drp |
||||||
|
LEFT JOIN logpm_distribution_parcel_list dpl |
||||||
|
ON dpl.id = drp.parcel_list_id |
||||||
|
left join logpm_distribution_reservation obj on drp.reservation_id = obj.id |
||||||
|
LEFT JOIN logpm_distribution_signfor lds ON lds.reservation_id = drp.reservation_id |
||||||
|
LEFT JOIN logpm_distribution_delivery_list lddl ON lds.delivery_id = lddl.id |
||||||
|
LEFT JOIN logpm_warehouse_waybill wi ON wi.id = obj.waybill_id |
||||||
|
LEFT JOIN logpm_distribution_loadscan ldl |
||||||
|
ON ldl.order_package_code = dpl.order_package_code |
||||||
|
AND ldl.type = 2 |
||||||
|
LEFT JOIN logpm_distribution_loadscan_abnormal ldla |
||||||
|
ON ldla.package_code = dpl.order_package_code |
||||||
|
) t |
||||||
|
${ew.customSqlSegment} |
||||||
|
<if test="ew!=null and ew.customSqlSegment !=null and ew.customSqlSegment!=''"> |
||||||
|
and |
||||||
|
</if> |
||||||
|
<if test="ew==null or ew.customSqlSegment ==null or ew.customSqlSegment==''"> |
||||||
|
where |
||||||
|
</if> |
||||||
|
EXISTS( |
||||||
|
SELECT obj.id |
||||||
|
FROM logpm_distribution_reservation obj |
||||||
|
WHERE obj.id = t.id) |
||||||
|
</select> |
||||||
|
|
||||||
|
</mapper> |
@ -0,0 +1,36 @@ |
|||||||
|
package com.logpm.report.reader; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.logpm.report.mapper.ReportDeliverMapeer; |
||||||
|
import com.logpm.report.service.ExportReaderService; |
||||||
|
import org.apache.poi.ss.formula.functions.T; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author zhaoqiaobo |
||||||
|
* @create 2024-03-08 9:50 |
||||||
|
*/ |
||||||
|
@Component |
||||||
|
public class DeliveryCustomerReader implements ExportReaderService { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private ReportDeliverMapeer reportDeliverMapeer; |
||||||
|
|
||||||
|
@Override |
||||||
|
public Long getCount(QueryWrapper query) { |
||||||
|
Page page = new Page(1, 1); |
||||||
|
reportDeliverMapeer.getCustomerPage(page, query); |
||||||
|
return page.getTotal(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<T> findList(Page page, QueryWrapper query) { |
||||||
|
return reportDeliverMapeer.getCustomerPage(page,query); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
package com.logpm.report.reader; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.logpm.report.mapper.ReportDeliverMapeer; |
||||||
|
import com.logpm.report.service.ExportReaderService; |
||||||
|
import org.apache.poi.ss.formula.functions.T; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author zhaoqiaobo |
||||||
|
* @create 2024-03-08 9:50 |
||||||
|
*/ |
||||||
|
@Component |
||||||
|
public class DeliveryDetailReader implements ExportReaderService { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private ReportDeliverMapeer reportDeliverMapeer; |
||||||
|
|
||||||
|
@Override |
||||||
|
public Long getCount(QueryWrapper query) { |
||||||
|
Page page = new Page(1, 1); |
||||||
|
reportDeliverMapeer.getDetailsPage(page, query); |
||||||
|
return page.getTotal(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<T> findList(Page page, QueryWrapper query) { |
||||||
|
return reportDeliverMapeer.getDetailsPage(page,query); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
package com.logpm.report.reader; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.logpm.report.mapper.ReportDeliverMapeer; |
||||||
|
import com.logpm.report.service.ExportReaderService; |
||||||
|
import org.apache.poi.ss.formula.functions.T; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author zhaoqiaobo |
||||||
|
* @create 2024-03-08 9:50 |
||||||
|
*/ |
||||||
|
@Component |
||||||
|
public class DeliveryTrainReader implements ExportReaderService { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private ReportDeliverMapeer reportDeliverMapeer; |
||||||
|
|
||||||
|
@Override |
||||||
|
public Long getCount(QueryWrapper query) { |
||||||
|
Page page = new Page(1, 1); |
||||||
|
reportDeliverMapeer.getDeliveryTrainPage(page, query); |
||||||
|
return page.getTotal(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<T> findList(Page page, QueryWrapper query) { |
||||||
|
return reportDeliverMapeer.getDeliveryTrainPage(page,query); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
package com.logpm.report.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import org.apache.poi.ss.formula.functions.T; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 导出数据读取器接口 |
||||||
|
* @author zhaoqiaobo |
||||||
|
* @create 2024-03-07 18:14 |
||||||
|
*/ |
||||||
|
public interface ExportReaderService { |
||||||
|
|
||||||
|
/** |
||||||
|
* 导出的总条数 |
||||||
|
* @param query 分页查询对象 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
Long getCount(QueryWrapper query); |
||||||
|
|
||||||
|
/** |
||||||
|
* 导出数据的分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param query 分页查询对象 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
List<T> findList(Page page, QueryWrapper query); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
package com.logpm.report.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.logpm.report.vo.ReportCustomerVO; |
||||||
|
import com.logpm.report.vo.ReportDetailVO; |
||||||
|
import com.logpm.report.vo.ReportDevilerVO; |
||||||
|
import org.springblade.core.mp.support.Query; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
import java.io.IOException; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author zhaoqiaobo |
||||||
|
* @create 2024-03-06 15:51 |
||||||
|
*/ |
||||||
|
public interface ReportDeliverService { |
||||||
|
|
||||||
|
IPage<ReportDevilerVO> deliveryTrainPage(ReportDevilerVO vo, Query query); |
||||||
|
|
||||||
|
void exportTrain(HttpServletResponse response, ReportDevilerVO vo) throws InterruptedException, IOException; |
||||||
|
|
||||||
|
IPage<ReportCustomerVO> customerPage(ReportCustomerVO vo, Query query); |
||||||
|
|
||||||
|
void exportCustomer(HttpServletResponse response, ReportCustomerVO vo) throws InterruptedException, IOException; |
||||||
|
|
||||||
|
IPage<ReportDetailVO> detailsPage(ReportDetailVO vo, Query query); |
||||||
|
|
||||||
|
void exportDetails(HttpServletResponse response, ReportDetailVO vo) throws InterruptedException, IOException; |
||||||
|
} |
@ -0,0 +1,82 @@ |
|||||||
|
package com.logpm.report.service.impl; |
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.logpm.report.mapper.ReportDeliverMapeer; |
||||||
|
import com.logpm.report.reader.DeliveryCustomerReader; |
||||||
|
import com.logpm.report.reader.DeliveryDetailReader; |
||||||
|
import com.logpm.report.reader.DeliveryTrainReader; |
||||||
|
import com.logpm.report.service.ReportDeliverService; |
||||||
|
import com.logpm.report.util.ReportExcelUtil; |
||||||
|
import com.logpm.report.vo.ReportCustomerVO; |
||||||
|
import com.logpm.report.vo.ReportDetailVO; |
||||||
|
import com.logpm.report.vo.ReportDevilerVO; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.springblade.core.mp.support.Condition; |
||||||
|
import org.springblade.core.mp.support.Query; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
import java.io.IOException; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author zhaoqiaobo |
||||||
|
* @create 2024-03-06 15:52 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
@AllArgsConstructor |
||||||
|
public class ReportDeliverServiceImpl implements ReportDeliverService { |
||||||
|
|
||||||
|
private final ReportDeliverMapeer reportDeliverMapeer; |
||||||
|
private final DeliveryTrainReader deliveryTrainReader; |
||||||
|
private final DeliveryCustomerReader deliveryCustomerReader; |
||||||
|
private final DeliveryDetailReader deliveryDetailReader; |
||||||
|
|
||||||
|
@Override |
||||||
|
public IPage<ReportDevilerVO> deliveryTrainPage(ReportDevilerVO vo, Query query) { |
||||||
|
IPage<ReportDevilerVO> page = Condition.getPage(query); |
||||||
|
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(vo); |
||||||
|
QueryWrapper<ReportDevilerVO> queryWrapper = Condition.getQueryWrapper(stringObjectMap, ReportDevilerVO.class); |
||||||
|
return page.setRecords(reportDeliverMapeer.getDeliveryTrainPage(page, queryWrapper)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void exportTrain(HttpServletResponse response,ReportDevilerVO vo) throws InterruptedException, IOException { |
||||||
|
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(vo); |
||||||
|
QueryWrapper<ReportDevilerVO> queryWrapper = Condition.getQueryWrapper(stringObjectMap, ReportDevilerVO.class); |
||||||
|
new ReportExcelUtil().export(response, deliveryTrainReader, ReportDevilerVO.class, queryWrapper, "配送车次维度报表"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public IPage<ReportCustomerVO> customerPage(ReportCustomerVO vo, Query query) { |
||||||
|
IPage<ReportCustomerVO> page = Condition.getPage(query); |
||||||
|
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(vo); |
||||||
|
QueryWrapper<ReportDevilerVO> queryWrapper = Condition.getQueryWrapper(stringObjectMap, ReportDevilerVO.class); |
||||||
|
return page.setRecords(reportDeliverMapeer.getCustomerPage(page, queryWrapper)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void exportCustomer(HttpServletResponse response, ReportCustomerVO vo) throws InterruptedException, IOException { |
||||||
|
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(vo); |
||||||
|
QueryWrapper<ReportDevilerVO> queryWrapper = Condition.getQueryWrapper(stringObjectMap, ReportDevilerVO.class); |
||||||
|
new ReportExcelUtil().export(response, deliveryCustomerReader, ReportCustomerVO.class, queryWrapper, "配送客户维度报表"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public IPage<ReportDetailVO> detailsPage(ReportDetailVO vo,Query query) { |
||||||
|
IPage<ReportDetailVO> page = Condition.getPage(query); |
||||||
|
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(vo); |
||||||
|
QueryWrapper<ReportDevilerVO> queryWrapper = Condition.getQueryWrapper(stringObjectMap, ReportDevilerVO.class); |
||||||
|
return page.setRecords(reportDeliverMapeer.getDetailsPage(page, queryWrapper)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void exportDetails(HttpServletResponse response, ReportDetailVO vo) throws InterruptedException, IOException { |
||||||
|
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(vo); |
||||||
|
QueryWrapper<ReportDevilerVO> queryWrapper = Condition.getQueryWrapper(stringObjectMap, ReportDevilerVO.class); |
||||||
|
new ReportExcelUtil().export(response, deliveryDetailReader, ReportDetailVO.class, queryWrapper, "配送明细报表"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,161 @@ |
|||||||
|
package com.logpm.report.util; |
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil; |
||||||
|
import com.alibaba.excel.EasyExcel; |
||||||
|
import com.alibaba.excel.ExcelWriter; |
||||||
|
import com.alibaba.excel.write.metadata.WriteSheet; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.logpm.report.service.ExportReaderService; |
||||||
|
import org.apache.poi.ss.formula.functions.T; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
import java.io.IOException; |
||||||
|
import java.io.UnsupportedEncodingException; |
||||||
|
import java.net.URLEncoder; |
||||||
|
import java.nio.charset.StandardCharsets; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.concurrent.CountDownLatch; |
||||||
|
import java.util.concurrent.ExecutorService; |
||||||
|
import java.util.concurrent.Executors; |
||||||
|
|
||||||
|
/** |
||||||
|
* excel导出工具类 |
||||||
|
* |
||||||
|
* @author zhaoqiaobo |
||||||
|
* @create 2024-03-06 17:48 |
||||||
|
*/ |
||||||
|
public class ReportExcelUtil { |
||||||
|
|
||||||
|
public static final String CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; |
||||||
|
public static final String CONTENT_TYPE_ECXCEL = "application/vnd.ms-excel"; |
||||||
|
/** |
||||||
|
* 每个sheet装多少条数据 |
||||||
|
*/ |
||||||
|
public static final Long SHEETDATANUM = 1000000L; |
||||||
|
/** |
||||||
|
* 每次查询几条数据 |
||||||
|
*/ |
||||||
|
public static final Long PAGESIZE = 50000L; |
||||||
|
|
||||||
|
/** |
||||||
|
* 设置excel导出的返回头 |
||||||
|
* @param response HttpServletResponse对象 |
||||||
|
* @param fileName 文件名 |
||||||
|
*/ |
||||||
|
public static void setExportHeader(HttpServletResponse response, String fileName) { |
||||||
|
response.setContentType(CONTENT_TYPE); |
||||||
|
response.setCharacterEncoding(StandardCharsets.UTF_8.name()); |
||||||
|
try { |
||||||
|
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".xlsx"); |
||||||
|
} catch (UnsupportedEncodingException e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 多线程导出数据到excel 带默认参数 pageSize onceSheetDataNum |
||||||
|
* @param response |
||||||
|
* @param service |
||||||
|
* @param classz |
||||||
|
* @param query |
||||||
|
* @param fileName |
||||||
|
*/ |
||||||
|
public void export(HttpServletResponse response, ExportReaderService service, Class classz, QueryWrapper query, String fileName) { |
||||||
|
export(response, service, classz, query, fileName, PAGESIZE, SHEETDATANUM); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 多线程导出数据到excel |
||||||
|
* 注意事项: |
||||||
|
* 1 需要定义导出数据读取器,实现 ExportReaderService 接口.实现接口中的两个方法 |
||||||
|
* |
||||||
|
* @param response HttpServletResponse对象 |
||||||
|
* @param service ExportReaderService读取器接口实现类 |
||||||
|
* @param classz easyexcel 导出数据定义对象 |
||||||
|
* @param query 数据查询对象 |
||||||
|
* @param fileName 导出文件名称 |
||||||
|
* @param pageSize 每次查询多少条数据 |
||||||
|
* @param onceSheetDataNum 一个sheet页最大装多少条数据 |
||||||
|
*/ |
||||||
|
public void export(HttpServletResponse response, ExportReaderService service, Class classz, QueryWrapper query, String fileName, Long pageSize, Long onceSheetDataNum) { |
||||||
|
// 设置响应头
|
||||||
|
ReportExcelUtil.setExportHeader(response, fileName); |
||||||
|
// 获取需要导出的总条数
|
||||||
|
Long count = service.getCount(query); |
||||||
|
// 每个 sheet 放多少条数据
|
||||||
|
Double sheetDataNum = onceSheetDataNum.doubleValue(); |
||||||
|
// 总共要几个 sheet
|
||||||
|
int sheetNum = (int) Math.ceil((count / sheetDataNum)); |
||||||
|
// 总共需要查询数据库几次
|
||||||
|
int findNum = (int) Math.ceil((count / pageSize.doubleValue())); |
||||||
|
// 封装查询后需要导出的数据
|
||||||
|
Map<Integer, List<Object>> pageMap = new HashMap<>(); |
||||||
|
// 定义线程池,每个大表导出使用一个线程池
|
||||||
|
ExecutorService executorService = Executors.newFixedThreadPool(findNum); |
||||||
|
// 控制线程全部查询完后执行导出操作
|
||||||
|
CountDownLatch countDownLatch = new CountDownLatch(findNum); |
||||||
|
ExcelWriter excelWriter = null; |
||||||
|
try { |
||||||
|
// 创建 excelWriter
|
||||||
|
excelWriter = EasyExcel.write(response.getOutputStream(), classz).build(); |
||||||
|
} catch (IOException e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
int num = 0; |
||||||
|
for (int i = 0; i < sheetNum; i++) { |
||||||
|
// sheet编号
|
||||||
|
int finalI = i + 1; |
||||||
|
// 每页需要查几次
|
||||||
|
long l = count - (pageSize * num); |
||||||
|
long ceil = l > pageSize ? (int) Math.ceil(onceSheetDataNum / pageSize.doubleValue()) : (int) Math.ceil(l / pageSize.doubleValue()); |
||||||
|
for (int j = 0; j < ceil; j++) { |
||||||
|
// 已经查询过几次了
|
||||||
|
int finalNum = num; |
||||||
|
// 查询次数+1
|
||||||
|
num = num + 1; |
||||||
|
// 提交线程执行查询
|
||||||
|
executorService.submit(() -> { |
||||||
|
// 剩余数据
|
||||||
|
long remaindNum = count - (finalNum * pageSize); |
||||||
|
// 当前第几次查询
|
||||||
|
int current = finalNum + 1; |
||||||
|
// 当前查询需要查询几条数据
|
||||||
|
long lastNum = remaindNum > pageSize ? pageSize : remaindNum; |
||||||
|
// 分页查询对象
|
||||||
|
Page<T> page = new Page(current, lastNum); |
||||||
|
// 执行查询操作返回数据
|
||||||
|
List deliveryTrainPage = service.findList(page, query); |
||||||
|
// 获取组装的数据列表
|
||||||
|
List<Object> reportDevilerVOS = pageMap.get(finalI); |
||||||
|
// 将查询数据添加到本地缓存
|
||||||
|
if (CollectionUtil.isEmpty(reportDevilerVOS)) { |
||||||
|
pageMap.put(finalI, deliveryTrainPage); |
||||||
|
} else { |
||||||
|
pageMap.get(finalI).addAll(deliveryTrainPage); |
||||||
|
} |
||||||
|
// 当前线程执行完成
|
||||||
|
countDownLatch.countDown(); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
try { |
||||||
|
// 等待其他线程执行完成
|
||||||
|
countDownLatch.await(); |
||||||
|
} catch (InterruptedException e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
// 分sheet向excel中写数据,
|
||||||
|
for (Map.Entry<Integer, List<Object>> entry : pageMap.entrySet()) { |
||||||
|
Integer key = entry.getKey(); |
||||||
|
List<Object> value = entry.getValue(); |
||||||
|
WriteSheet writeSheet = EasyExcel.writerSheet(key, "sheet" + key).build(); |
||||||
|
excelWriter.write(value, writeSheet); |
||||||
|
} |
||||||
|
// 关闭流
|
||||||
|
excelWriter.finish(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,143 @@ |
|||||||
|
package com.logpm.report.vo; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
||||||
|
import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* 配送报表 客户维度 |
||||||
|
* @author zhaoqiaobo |
||||||
|
* @create 2024-03-06 16:02 |
||||||
|
*/ |
||||||
|
@ColumnWidth(25) |
||||||
|
@HeadRowHeight(20) |
||||||
|
@ContentRowHeight(18) |
||||||
|
@ApiModel(value = "配送报表-客户维度", description = "配送报表-客户维度") |
||||||
|
@Data |
||||||
|
public class ReportCustomerVO implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "车次") |
||||||
|
@ExcelProperty("车次") |
||||||
|
private String trainNumber; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "预约单号") |
||||||
|
@ExcelProperty("预约单号") |
||||||
|
private String reservationCode; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单自编码") |
||||||
|
@ExcelProperty("订单自编码") |
||||||
|
private String stockArticleId; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送日期") |
||||||
|
@ExcelProperty("配送日期") |
||||||
|
private String taskTime; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "仓库") |
||||||
|
@ExcelProperty("仓库") |
||||||
|
private String warehouseName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "收货单位") |
||||||
|
@ExcelProperty("收货单位") |
||||||
|
private String receivingUnit; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "商场名称") |
||||||
|
@ExcelProperty("商场名称") |
||||||
|
private String mallName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "客户名称") |
||||||
|
@ExcelProperty("客户名称") |
||||||
|
private String consignee; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "客户电话") |
||||||
|
@ExcelProperty("客户电话") |
||||||
|
private String deliveryPhone; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "地址") |
||||||
|
@ExcelProperty("地址") |
||||||
|
private String deliveryAddress; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送类型") |
||||||
|
@ExcelProperty("配送类型") |
||||||
|
private String type; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送种类") |
||||||
|
@ExcelProperty("配送种类") |
||||||
|
private String kind; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送车辆") |
||||||
|
@ExcelProperty("配送车辆") |
||||||
|
private String vehicleName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送司机") |
||||||
|
@ExcelProperty("配送司机") |
||||||
|
private String driverName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送公司") |
||||||
|
@ExcelProperty("配送公司") |
||||||
|
private String distributionCompany; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送状态") |
||||||
|
@ExcelProperty("配送状态") |
||||||
|
private String deliveryStatus; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单总数") |
||||||
|
@ExcelProperty("订单总数") |
||||||
|
private String orderNumber; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "计划定制品件数") |
||||||
|
@ExcelProperty("计划定制品件数") |
||||||
|
private String reservationNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "计划库存品件数") |
||||||
|
@ExcelProperty("计划库存品件数") |
||||||
|
private String reservationStockListNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "定制品装车件数") |
||||||
|
@ExcelProperty("定制品装车件数") |
||||||
|
private String loadedNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "库存品装车件数") |
||||||
|
@ExcelProperty("库存品装车件数") |
||||||
|
private String invnLoadedNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "异常装车件数") |
||||||
|
@ExcelProperty("异常装车件数") |
||||||
|
private String exLoadedNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "定制品签收件数") |
||||||
|
@ExcelProperty("定制品签收件数") |
||||||
|
private String reNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "库存品签收件数") |
||||||
|
@ExcelProperty("库存品签收件数") |
||||||
|
private String invnReNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "异常签收件数") |
||||||
|
@ExcelProperty("异常签收件数") |
||||||
|
private String exReNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "司机完成签收时间") |
||||||
|
@ExcelProperty("司机完成签收时间") |
||||||
|
private String sjsigningTime; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "签收人") |
||||||
|
@ExcelProperty("签收人") |
||||||
|
private String signeeName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "文员复核时间") |
||||||
|
@ExcelProperty("文员复核时间") |
||||||
|
private String signingTime; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "复核人") |
||||||
|
@ExcelProperty("复核人") |
||||||
|
private String examineUserName; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,191 @@ |
|||||||
|
package com.logpm.report.vo; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
||||||
|
import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* 配送报表 车次维度 |
||||||
|
* @author zhaoqiaobo |
||||||
|
* @create 2024-03-06 16:02 |
||||||
|
*/ |
||||||
|
@ColumnWidth(25) |
||||||
|
@HeadRowHeight(20) |
||||||
|
@ContentRowHeight(18) |
||||||
|
@ApiModel(value = "配送报表-车次维度", description = "配送报表-车次维度") |
||||||
|
@Data |
||||||
|
public class ReportDetailVO implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "车次") |
||||||
|
@ExcelProperty("车次") |
||||||
|
private String trainNumber; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "预约单号") |
||||||
|
@ExcelProperty("预约单号") |
||||||
|
private String reservationCode; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送日期") |
||||||
|
@ExcelProperty("配送日期") |
||||||
|
private String taskTime; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "仓库") |
||||||
|
@ExcelProperty("仓库") |
||||||
|
private String warehouseName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送类型") |
||||||
|
@ExcelProperty("配送类型") |
||||||
|
private String type; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送种类") |
||||||
|
@ExcelProperty("配送种类") |
||||||
|
private String kind; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送车辆") |
||||||
|
@ExcelProperty("配送车辆") |
||||||
|
private String vehicleName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送司机") |
||||||
|
@ExcelProperty("配送司机") |
||||||
|
private String driverName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送公司") |
||||||
|
@ExcelProperty("配送公司") |
||||||
|
private String distributionCompany; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "客户名称") |
||||||
|
@ExcelProperty("客户名称") |
||||||
|
private String drConsignee; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "客户电话") |
||||||
|
@ExcelProperty("客户电话") |
||||||
|
private String deliveryPhone; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "地址") |
||||||
|
@ExcelProperty("地址") |
||||||
|
private String deliveryAddress; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "运单收货单位") |
||||||
|
@ExcelProperty("运单收货单位") |
||||||
|
private String consignee; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "运单收货人") |
||||||
|
@ExcelProperty("运单收货人") |
||||||
|
private String consigneeName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "运单收货电话") |
||||||
|
@ExcelProperty("运单收货电话") |
||||||
|
private String consigneeMobile; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "运单号") |
||||||
|
@ExcelProperty("运单号") |
||||||
|
private String waybillNo; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单自编码") |
||||||
|
@ExcelProperty("订单自编码") |
||||||
|
private String stockArticleId; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "客户电话") |
||||||
|
@ExcelProperty("包条码") |
||||||
|
private String orderPackageCode; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "客户车次号") |
||||||
|
@ExcelProperty("客户车次号") |
||||||
|
private String customerTrain; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "包件类型") |
||||||
|
@ExcelProperty("包件类型") |
||||||
|
private String conditions; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "一级品") |
||||||
|
@ExcelProperty("一级品") |
||||||
|
private String firsts; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "二级品") |
||||||
|
@ExcelProperty("二级品") |
||||||
|
private String decond; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "三级品") |
||||||
|
@ExcelProperty("三级品") |
||||||
|
private String thirdProduct; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "物料编码") |
||||||
|
@ExcelProperty("物料编码") |
||||||
|
private String materialCode; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "物料名称") |
||||||
|
@ExcelProperty("物料名称") |
||||||
|
private String materialName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "始发仓") |
||||||
|
@ExcelProperty("始发仓") |
||||||
|
private String startWar; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "始发仓入库日期") |
||||||
|
@ExcelProperty("始发仓入库日期") |
||||||
|
private String startWarInTime; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "始发仓发货日期") |
||||||
|
@ExcelProperty("始发仓发货日期") |
||||||
|
private String startWarOutTime; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "入库时间") |
||||||
|
@ExcelProperty("入库时间") |
||||||
|
private String warehouseEntryTimeEnd; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "装车时间") |
||||||
|
@ExcelProperty("装车时间") |
||||||
|
private String unloadTime; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "装车人") |
||||||
|
@ExcelProperty("装车人") |
||||||
|
private String unAdministratorsName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "签收时间") |
||||||
|
@ExcelProperty("签收时间") |
||||||
|
private String sjsigningTime; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "签收人") |
||||||
|
@ExcelProperty("签收人") |
||||||
|
private String ldsSigneeName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "文员审核状态") |
||||||
|
@ExcelProperty("文员审核状态") |
||||||
|
private String signingStatus; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "文员审核时间") |
||||||
|
@ExcelProperty("文员审核时间") |
||||||
|
private String signingTime; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "审核人名称") |
||||||
|
@ExcelProperty("审核人名称") |
||||||
|
private String examineUserName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否异常签收") |
||||||
|
@ExcelProperty("是否异常签收") |
||||||
|
private String abnormalSigning; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否异常装车") |
||||||
|
@ExcelProperty("是否异常装车") |
||||||
|
private String abnormalLoading; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "异常审核状态") |
||||||
|
@ExcelProperty("异常审核状态") |
||||||
|
private String auditingStatus; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "审核人") |
||||||
|
@ExcelProperty("审核人") |
||||||
|
private String auditingUser; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "审核时间") |
||||||
|
@ExcelProperty("审核时间") |
||||||
|
private String auditingTime; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,119 @@ |
|||||||
|
package com.logpm.report.vo; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
||||||
|
import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* 配送报表 车次维度 |
||||||
|
* @author zhaoqiaobo |
||||||
|
* @create 2024-03-06 16:02 |
||||||
|
*/ |
||||||
|
@ColumnWidth(25) |
||||||
|
@HeadRowHeight(20) |
||||||
|
@ContentRowHeight(18) |
||||||
|
@ApiModel(value = "配送报表-车次维度", description = "配送报表-车次维度") |
||||||
|
@Data |
||||||
|
public class ReportDevilerVO implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "车次") |
||||||
|
@ExcelProperty("车次") |
||||||
|
private String trainNumber; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送日期") |
||||||
|
@ExcelProperty("配送日期") |
||||||
|
private String taskTime; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "仓库") |
||||||
|
@ExcelProperty("仓库") |
||||||
|
private String warehouseName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送类型") |
||||||
|
@ExcelProperty("配送类型") |
||||||
|
private String type; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送种类") |
||||||
|
@ExcelProperty("配送种类") |
||||||
|
private String kind; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送车辆") |
||||||
|
@ExcelProperty("配送车辆") |
||||||
|
private String vehicleName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送司机") |
||||||
|
@ExcelProperty("配送司机") |
||||||
|
private String driverName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送公司") |
||||||
|
@ExcelProperty("配送公司") |
||||||
|
private String distributionCompany; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送状态") |
||||||
|
@ExcelProperty("配送状态") |
||||||
|
private String deliveryStatus; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送客户数") |
||||||
|
@ExcelProperty("配送客户数") |
||||||
|
private String customersNumber; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送价格") |
||||||
|
@ExcelProperty("配送价格") |
||||||
|
private String price; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单总数") |
||||||
|
@ExcelProperty("订单总数") |
||||||
|
private String orderNumber; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "计划定制品件数") |
||||||
|
@ExcelProperty("计划定制品件数") |
||||||
|
private String reservationNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "计划库存品件数") |
||||||
|
@ExcelProperty("计划库存品件数") |
||||||
|
private String reservationStockListNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "定制品装车件数") |
||||||
|
@ExcelProperty("定制品装车件数") |
||||||
|
private String loadedNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "库存品装车件数") |
||||||
|
@ExcelProperty("库存品装车件数") |
||||||
|
private String invnLoadedNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "异常装车件数") |
||||||
|
@ExcelProperty("异常装车件数") |
||||||
|
private String exLoadedNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "定制品签收件数") |
||||||
|
@ExcelProperty("定制品签收件数") |
||||||
|
private String reNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "库存品签收件数") |
||||||
|
@ExcelProperty("库存品签收件数") |
||||||
|
private String invnReNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "异常签收件数") |
||||||
|
@ExcelProperty("异常签收件数") |
||||||
|
private String exReNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "签收完成客户数") |
||||||
|
@ExcelProperty("签收完成客户数") |
||||||
|
private String dsNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "文员复核客户数") |
||||||
|
@ExcelProperty("文员复核客户数") |
||||||
|
private String ssNum; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "卸车班组名称") |
||||||
|
@ExcelProperty("卸车班组名称") |
||||||
|
private String unloadingTeamName; |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue