Prechádzať zdrojové kódy

新增有盛报表导出

donglang 2 dní pred
rodič
commit
526ee6bdcf

+ 21 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/enterpriseApp/AppWayBillController.java

@@ -1,19 +1,24 @@
 package com.sckw.transport.controller.enterpriseApp;
 
+import com.sckw.core.exception.CustomPromptException;
 import com.sckw.core.exception.SystemException;
+import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.BaseResult;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.core.web.response.result.PageDataResult;
+import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.transport.model.dto.WaybillListAppDTO;
 import com.sckw.transport.model.param.*;
 import com.sckw.transport.model.vo.OrderTotalTakeVo;
 import com.sckw.transport.model.vo.StatisticsWaybillResp;
+import com.sckw.transport.model.vo.WaybillOrderReportRespExcelVO;
 import com.sckw.transport.service.KwtLogisticsConsignmentService;
 import com.sckw.transport.service.KwtWaybillManagementService;
 import com.sckw.transport.service.KwtWaybillManagementV1Service;
 import com.sckw.transport.service.app.WaybillOrderService;
 import io.swagger.v3.oas.annotations.Operation;
+import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.Valid;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -439,10 +444,25 @@ public class AppWayBillController {
      */
     @Operation(summary = "运单每日报表", description = "运单每日报表")
     @PostMapping("/queryWaybillOrderReport")
-    public BaseResult<List<WaybillOrderReportResp>> queryWaybillOrderReport(WaybillOrderReportQueryParam param){
+    public BaseResult<List<WaybillOrderReportResp>> queryWaybillOrderReport(@RequestBody @Valid WaybillOrderReportQueryParam param){
         waybillOrderService.queryWaybillOrderReport(param);
         return BaseResult.success();
     }
 
 
+    /**
+     * 导出
+     * @param params
+     * @param response
+     */
+    @PostMapping(value = "/export")
+    public void export(@RequestBody @Validated WaybillOrderReportQueryParam params, HttpServletResponse response) {
+        List<WaybillOrderReportRespExcelVO> list = waybillOrderService.exportReport(params);
+        if (CollectionUtils.isEmpty(list)) {
+            throw new CustomPromptException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认");
+        }
+        ExcelUtil.downData(response, WaybillOrderReportRespExcelVO.class, list);
+    }
+
+
 }

+ 119 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/WaybillOrderReportRespExcelVO.java

@@ -0,0 +1,119 @@
+package com.sckw.transport.model.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author :chenXiaoFei
+ * @version :1.0
+ * @description : 分页查询运单每日报表
+ * @create :2025-11-11 20:16:00
+ */
+@Data
+public class WaybillOrderReportRespExcelVO implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 7250765223450002066L;
+
+    /**
+     * 运单id
+     */
+    @ExcelProperty(value = "序号" )
+    private Long id;
+
+    /**
+     * 采购单位id
+     */
+    private Long ProcurementEntId;
+
+    /**
+     * 采购单位名称
+     */
+    @ExcelProperty(value = "客户名称" )
+    private String ProcurementEntName;
+
+    /**
+     * 贸易订单编号
+     */
+    @ExcelProperty(value = "订单号" )
+    private String tradeOrderNo;
+
+    /**
+     * 运单编号
+     */
+    @ExcelProperty(value = "运单号" )
+    private String waybillNo;
+
+    /**
+     * 商品id
+     */
+    private String goodsId;
+
+    /**
+     * 商品名称
+     */
+    @ExcelProperty(value = "商品名称" )
+    private String goodsName;
+
+    /**
+     * 车牌号
+     */
+    @ExcelProperty(value = "车牌号")
+    private String truckNo;
+
+    /**
+     * 毛重
+     */
+    @ExcelProperty(value = "毛重(吨)")
+    private BigDecimal grossAmount;
+
+    /**
+     * 皮重
+     */
+    @ExcelProperty(value = "毛重(吨)")
+    private BigDecimal tareAmount;
+
+    /**
+     * 净重
+     */
+    @ExcelProperty(value = "净重(吨)")
+    private BigDecimal amount;
+
+    /**
+     * 离场时间
+     */
+    @ExcelProperty(value = "离场时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date leaveTime;
+
+    /**
+     * 卸货联系人
+     */
+    @ExcelProperty(value = "联系人")
+    private String unloadingPerson;
+
+    /**
+     * 单价
+     */
+    @ExcelProperty(value = "单价(元/吨)")
+    private BigDecimal unitPrice;
+
+    /**
+     * 金额:单价*净重
+     */
+    @ExcelProperty(value = "金额(元)")
+    private BigDecimal totalPrice;
+
+    /**
+     * 剩余预付款
+     */
+
+    private BigDecimal advancePayment;
+
+}

+ 18 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/app/WaybillOrderService.java

@@ -17,13 +17,13 @@ import com.sckw.core.model.enums.AddressTypeEnum;
 import com.sckw.core.model.enums.CarWaybillV1Enum;
 import com.sckw.core.model.enums.LogisticsOrderV1Enum;
 import com.sckw.core.model.enums.UnitTypeEnum;
+import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.DateUtils;
 import com.sckw.core.web.response.result.PageDataResult;
 import com.sckw.fleet.api.RemoteFleetService;
 import com.sckw.fleet.api.model.vo.RTruckVo;
 import com.sckw.order.api.dubbo.TradeOrderInfoService;
-import com.sckw.order.api.model.GoodsVo;
 import com.sckw.order.api.model.OrderDetailVo;
 import com.sckw.order.api.model.OrderUnitInfoDetailVO;
 import com.sckw.order.api.model.TradeOrderGoodsVo;
@@ -36,6 +36,7 @@ import com.sckw.transport.model.*;
 import com.sckw.transport.model.param.*;
 import com.sckw.transport.model.vo.OrderTotalTakeVo;
 import com.sckw.transport.model.vo.StatisticsWaybillResp;
+import com.sckw.transport.model.vo.WaybillOrderReportRespExcelVO;
 import com.sckw.transport.repository.*;
 import com.sckw.transport.service.KwtWaybillOrderV1Service;
 import jakarta.annotation.Resource;
@@ -43,7 +44,6 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.dubbo.config.annotation.DubboReference;
-import org.jetbrains.annotations.NotNull;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.script.DefaultRedisScript;
 import org.springframework.stereotype.Service;
@@ -2215,6 +2215,22 @@ public class WaybillOrderService {
     }
 
 
+    /**
+     * 查询运单每日报表
+     * @param param
+     * @return
+     */
+    public List<WaybillOrderReportRespExcelVO> exportReport(WaybillOrderReportQueryParam param) {
+        log.info("[报表]开始查询运单每日报表:{}", JSON.toJSONString(param));
+        // 查询运单数据
+        List<WaybillOrderReportResp> orderRepoost = getWaybillOrderRepoost(param);
+        //汇总数据
+        List<WaybillOrderReportResp> orderGroupedReportList = buildGroupedReport(orderRepoost);
+
+        return BeanUtils.copyToList(orderGroupedReportList, WaybillOrderReportRespExcelVO.class);
+    }
+
+
 //    /**
 //     * 物流订单接单
 //     * @param param