Browse Source

自提单报表导出

chenglong
汤建军 1 year ago
parent
commit
fe1bbd9b47
  1. 35
      blade-service/logpm-report/src/main/java/com/logpm/report/controller/ReportBillLoadingController.java
  2. 2
      blade-service/logpm-report/src/main/java/com/logpm/report/excel/BillLoadingReportExcel.java
  3. 20
      blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportBillLoadingMapper.java
  4. 22
      blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportBillLoadingMapper.xml
  5. 11
      blade-service/logpm-report/src/main/java/com/logpm/report/service/IReportBillLoadingAsyncService.java
  6. 29
      blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportBillLoadingAsyncService.java
  7. 4
      blade-service/logpm-report/src/main/java/com/logpm/report/util/MyExcelUtil.java

35
blade-service/logpm-report/src/main/java/com/logpm/report/controller/ReportBillLoadingController.java

@ -1,9 +1,25 @@
package com.logpm.report.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.report.excel.BillLoadingReportExcel;
import com.logpm.report.service.IReportBillLoadingAsyncService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 自提单包条控制器
@ -14,6 +30,25 @@ import org.springframework.web.bind.annotation.RestController;
@Api(value = "自提单报表", tags = "自提单报表接口")
public class ReportBillLoadingController {
private IReportBillLoadingAsyncService reportBillLoadingAsyncService;
/**
* 导出数据
*/
@GetMapping("/export-billLoading")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "导出数据", notes = "传入distributionDeliveryList")
public R exportBillLoading(@ApiIgnore @RequestParam Map<String, Object> param, HttpServletResponse response) {
List<BillLoadingReportExcel> list = reportBillLoadingAsyncService.exportBillLoading(param);
ExcelUtil.export(response, "配送管理数据" + DateUtil.time(), "配送管理数据表", list, BillLoadingReportExcel.class);
return R.status(true);
}

2
blade-service/logpm-report/src/main/java/com/logpm/report/excel/BillLoadingReportExcel.java

@ -21,7 +21,7 @@ public class BillLoadingReportExcel implements Serializable {
@ColumnWidth(20)
@ExcelProperty("提货件数")
private String stockupCode;
private String BillLoadingNum;
@ColumnWidth(20)
@ExcelProperty("到付运费")

20
blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportBillLoadingMapper.java

@ -0,0 +1,20 @@
package com.logpm.report.mapper;
import com.logpm.report.excel.BillLoadingReportExcel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface ReportBillLoadingMapper {
/**
* 导出自提单
* @param param
* @return
*/
List<BillLoadingReportExcel> exportBillLoading(@Param("param") Map<String, Object> param);
}

22
blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportBillLoadingMapper.xml

@ -0,0 +1,22 @@
<?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.ReportBillLoadingMapper">
<select id="exportBillLoading" resultType="com.logpm.report.excel.BillLoadingReportExcel">
SELECT
ldbl.create_time AS createdTime,
IF(SUM(ldbll.quantity) is null,0,SUM(ldbll.quantity)) AS BillLoadingNum,
IF( (SELECT money FROM logpm_distribution_delivery_charge WHERE bill_lading = ldbl.id AND cost ='1' AND is_deleted = 0) is null,0, (SELECT money FROM logpm_distribution_delivery_charge WHERE bill_lading = ldbl.id AND cost ='1' AND is_deleted = 0)) AS collectPaymentFee,
IF((SELECT money FROM logpm_distribution_delivery_charge WHERE bill_lading = ldbl.id AND cost ='2' AND is_deleted = 0) is null,0,(SELECT money FROM logpm_distribution_delivery_charge WHERE bill_lading = ldbl.id AND cost ='2' AND is_deleted = 0)) AS transportFee,
IF((SELECT money FROM logpm_distribution_delivery_charge WHERE bill_lading = ldbl.id AND cost ='3' AND is_deleted = 0) is null ,0,(SELECT money FROM logpm_distribution_delivery_charge WHERE bill_lading = ldbl.id AND cost ='3' AND is_deleted = 0) )AS storageFee,
IF((SELECT money FROM logpm_distribution_delivery_charge WHERE bill_lading = ldbl.id AND cost ='4' AND is_deleted = 0) is null,0,(SELECT money FROM logpm_distribution_delivery_charge WHERE bill_lading = ldbl.id AND cost ='4' AND is_deleted = 0)) AS forkliftFee,
IF((SELECT money FROM logpm_distribution_delivery_charge WHERE bill_lading = ldbl.id AND cost ='5' AND is_deleted = 0) is null,0,(SELECT money FROM logpm_distribution_delivery_charge WHERE bill_lading = ldbl.id AND cost ='5' AND is_deleted = 0)) AS addValueFee
FROM
logpm_distrilbution_bill_lading AS ldbl
LEFT JOIN logpm_distribution_delivery_charge AS lddc ON ldbl.id = lddc.bill_lading
LEFT JOIN logpm_distribution_bill_lading_scan AS ldbll ON ldbll.bill_lading_id = ldbl.id
GROUP BY
ldbl.id
</select>
</mapper>

11
blade-service/logpm-report/src/main/java/com/logpm/report/service/IReportBillLoadingAsyncService.java

@ -1,7 +1,18 @@
package com.logpm.report.service;
import com.logpm.report.excel.BillLoadingReportExcel;
import java.util.List;
import java.util.Map;
public interface IReportBillLoadingAsyncService {
/**
* 导出自提单报表
* @param param
* @return
*/
List<BillLoadingReportExcel> exportBillLoading(Map<String, Object> param);
}

29
blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportBillLoadingAsyncService.java

@ -1,19 +1,38 @@
package com.logpm.report.service.impl;
import com.logpm.report.excel.BillLoadingReportExcel;
import com.logpm.report.mapper.ReportBillLoadingMapper;
import com.logpm.report.service.IReportBillLoadingAsyncService;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@Log4j2
@Service
@AllArgsConstructor
public class ReportBillLoadingAsyncService implements IReportBillLoadingAsyncService {
private ReportBillLoadingMapper reportBillLoadingMapper;
/**
* @param param
* @return
*/
@Override
@Async
public List<BillLoadingReportExcel> exportBillLoading(Map<String, Object> param) {
List<BillLoadingReportExcel> list = reportBillLoadingMapper.exportBillLoading(param);
log.info("导出数据条数:{}",list.size());
list.stream().forEach(l->l.setAmountToFee(l.getForkliftFee()+l.getAddValueFee()+l.getStorageFee()+l.getCollectPaymentFee()+l.getTransportFee()));
return list;
}
}

4
blade-service/logpm-report/src/main/java/com/logpm/report/util/MyExcelUtil.java

@ -0,0 +1,4 @@
package com.logpm.report.util;
public class MyExcelUtil {
}
Loading…
Cancel
Save