Răsfoiți Sursa

物流对账导出接口

xucaiqin 2 ani în urmă
părinte
comite
14f80720a6

+ 8 - 18
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpLedgerLogisticsController.java

@@ -1,12 +1,11 @@
 package com.sckw.payment.controller;
 package com.sckw.payment.controller;
 
 
-import com.sckw.core.model.page.PageRes;
 import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.payment.model.constant.LedgerEnum;
 import com.sckw.payment.model.constant.LedgerEnum;
 import com.sckw.payment.model.constant.LogisticsUnitType;
 import com.sckw.payment.model.constant.LogisticsUnitType;
-import com.sckw.payment.model.dto.ILedger;
+import com.sckw.payment.model.dto.LedgerLogisticsDto;
 import com.sckw.payment.model.vo.req.*;
 import com.sckw.payment.model.vo.req.*;
 import com.sckw.payment.model.vo.res.LedgerLogisticsVo;
 import com.sckw.payment.model.vo.res.LedgerLogisticsVo;
 import com.sckw.payment.service.KwpLedgerLogisticsService;
 import com.sckw.payment.service.KwpLedgerLogisticsService;
@@ -159,7 +158,7 @@ public class KwpLedgerLogisticsController {
      * @return 物流对账单统计数据
      * @return 物流对账单统计数据
      */
      */
     @PostMapping("carrierCount")
     @PostMapping("carrierCount")
-    public HttpResult carrierCount(@RequestBody  LogisticsReq logisticsReq) {
+    public HttpResult carrierCount(@RequestBody LogisticsReq logisticsReq) {
         logisticsReq.setUnitType(LogisticsUnitType.SHIPPER);
         logisticsReq.setUnitType(LogisticsUnitType.SHIPPER);
         logisticsReq.setUnitTypeTwo(LogisticsUnitType.CARRIER);
         logisticsReq.setUnitTypeTwo(LogisticsUnitType.CARRIER);
         return HttpResult.ok(kwpLedgerLogisticsService.orderCount(logisticsReq));
         return HttpResult.ok(kwpLedgerLogisticsService.orderCount(logisticsReq));
@@ -244,13 +243,9 @@ public class KwpLedgerLogisticsController {
      */
      */
     @PostMapping("exportShipper")
     @PostMapping("exportShipper")
     public HttpResult exportShipper(HttpServletResponse response, @RequestBody LogisticsReq logisticsReq) {
     public HttpResult exportShipper(HttpServletResponse response, @RequestBody LogisticsReq logisticsReq) {
-        List<ILedger> list;
-        if (CollectionUtils.isEmpty(logisticsReq.getIdList())) {
-            PageRes<ILedger> pageResult = kwpLedgerLogisticsService.shipperList(logisticsReq);
-            list = pageResult.getList();
-        } else {
-            list = kwpLedgerLogisticsService.selectShipperList(logisticsReq.getIdList());
-        }
+        logisticsReq.setUnitType(LogisticsUnitType.CARRIER);
+        logisticsReq.setUnitTypeTwo(LogisticsUnitType.SHIPPER);
+        List<LedgerLogisticsDto> list = kwpLedgerLogisticsService.exportList(logisticsReq, logisticsReq.getIdList());
         if (CollectionUtils.isEmpty(list)) {
         if (CollectionUtils.isEmpty(list)) {
             return HttpResult.error("没有可导出的数据");
             return HttpResult.error("没有可导出的数据");
         }
         }
@@ -273,14 +268,9 @@ public class KwpLedgerLogisticsController {
      */
      */
     @PostMapping("exportCarrier")
     @PostMapping("exportCarrier")
     public HttpResult exportCarrier(HttpServletResponse response, @RequestBody LogisticsReq logisticsReq) {
     public HttpResult exportCarrier(HttpServletResponse response, @RequestBody LogisticsReq logisticsReq) {
-        List<ILedger> list;
-        if (CollectionUtils.isEmpty(logisticsReq.getIdList())) {
-            PageRes<ILedger> pageResult = kwpLedgerLogisticsService.carrierList(logisticsReq);
-            list = pageResult.getList();
-
-        } else {
-            list = kwpLedgerLogisticsService.selectCarrierList(logisticsReq.getIdList());
-        }
+        logisticsReq.setUnitType(LogisticsUnitType.SHIPPER);
+        logisticsReq.setUnitTypeTwo(LogisticsUnitType.CARRIER);
+        List<LedgerLogisticsDto> list = kwpLedgerLogisticsService.exportList(logisticsReq, logisticsReq.getIdList());
         if (CollectionUtils.isEmpty(list)) {
         if (CollectionUtils.isEmpty(list)) {
             return HttpResult.error("没有可导出的数据");
             return HttpResult.error("没有可导出的数据");
         }
         }

+ 10 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpLedgerLogisticsMapper.java

@@ -93,6 +93,7 @@ public interface KwpLedgerLogisticsMapper extends BaseMapper<KwpLedgerLogistics>
      * @return
      * @return
      */
      */
     Long countSum(@Param("logisticsReq") LogisticsReq logisticsReq, @Param("status") List<Integer> status);
     Long countSum(@Param("logisticsReq") LogisticsReq logisticsReq, @Param("status") List<Integer> status);
+
     /**
     /**
      * app统计对账金额
      * app统计对账金额
      *
      *
@@ -115,4 +116,13 @@ public interface KwpLedgerLogisticsMapper extends BaseMapper<KwpLedgerLogistics>
      * @return
      * @return
      */
      */
     LedgerSize countSize(@Param("entId") Long entId);
     LedgerSize countSize(@Param("entId") Long entId);
+
+    /**
+     * 列表导出
+     *
+     * @param logisticsReq
+     * @param idList
+     * @return
+     */
+    List<LedgerLogisticsDto> exportList(@Param("logisticsReq") LogisticsReq logisticsReq, @Param("idList") List<Long> idList);
 }
 }

+ 16 - 42
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/LedgerLogisticsVo.java

@@ -51,22 +51,7 @@ public class LedgerLogisticsVo {
      * 订单数量
      * 订单数量
      */
      */
     @ExcelProperty(value = "订单数量")
     @ExcelProperty(value = "订单数量")
-    private Long orderCount;
-//    /**
-//     * 开始日期
-//     */
-//    @ExcelProperty(value = "开始日期")
-//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-//    private LocalDateTime startTime;
-//
-//    /**
-//     * 结束日期
-//     */
-//    @ExcelProperty(value = "结束日期")
-//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-//    private LocalDateTime endTime;
+    private Integer orderCount;
 
 
     /**
     /**
      * 付款方式(预付款、货到付款)
      * 付款方式(预付款、货到付款)
@@ -87,11 +72,7 @@ public class LedgerLogisticsVo {
     @ExcelProperty(value = "总应收/元")
     @ExcelProperty(value = "总应收/元")
     private BigDecimal totalPrice;
     private BigDecimal totalPrice;
 
 
-//    /**
-//     * 实际结算金额
-//     */
-//    @ExcelProperty(value = "实际结算金额")
-//    private BigDecimal settlePrice;
+
 
 
     /**
     /**
      * 已收款/元
      * 已收款/元
@@ -100,35 +81,28 @@ public class LedgerLogisticsVo {
     private BigDecimal actualPrice;
     private BigDecimal actualPrice;
 
 
     /**
     /**
-     * 客户联系人
+     * 财务联系人
      */
      */
-    @ExcelProperty(value = "客户联系人")
+    @ExcelProperty(value = "财务联系人")
     private String contacts;
     private String contacts;
     /**
     /**
-     * 联系方式
+     * 财务联系方式
      */
      */
-    @ExcelProperty(value = "联系方式")
+    @ExcelProperty(value = "财务联系方式")
     private String phone;
     private String phone;
 
 
-
-
-//    /**
-//     * 对账托运方财务联系人电话
-//     */
-//    @ExcelProperty(value = "对账托运方财务联系人电话")
-//    private String auditPhone;
-
     /**
     /**
-     * 对账托运方财务联系人
+     * 预计收款时间
+     */
+    @ExcelProperty(value = "预计收款时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private LocalDateTime receiptTime;
+    /**
+     * 创建人
      */
      */
-    @ExcelProperty(value = "提交人")
-    private String auditUser;
-//
-//    /**
-//     * 对账清单凭证
-//     */
-//    @ExcelProperty(value = "对账清单凭证")
-//    private String url;
+    @ExcelProperty(value = "创建人")
+    private String createByName;
     /**
     /**
      * 生成时间
      * 生成时间
      */
      */

+ 8 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerLogisticsService.java

@@ -74,7 +74,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
     @DubboReference(version = "1.0.0", group = "design", check = false)
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private TransportDubboService transportDubboService;
     private TransportDubboService transportDubboService;
 
 
-    private void changeDict(List<ILedger> list) {
+    private void changeDict(List<? extends ILedger> list) {
         List<SysDictResDto> taxRateDict = remoteSystemService.queryDictByType(DictTypeEnum.TAX_RATE.getType());
         List<SysDictResDto> taxRateDict = remoteSystemService.queryDictByType(DictTypeEnum.TAX_RATE.getType());
         Map<String, String> taxRateMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
         Map<String, String> taxRateMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
         Map<String, String> tradingMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
         Map<String, String> tradingMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
@@ -801,4 +801,11 @@ public class KwpLedgerLogisticsService extends AbsLedger {
     public LedgerSize count(Long entId) {
     public LedgerSize count(Long entId) {
         return logisticsMapper.countSize(entId);
         return logisticsMapper.countSize(entId);
     }
     }
+
+    public List<LedgerLogisticsDto> exportList(LogisticsReq logisticsReq, List<Long> idList) {
+        fillPara(logisticsReq);
+        List<LedgerLogisticsDto> ledgerLogisticsDtos = logisticsMapper.exportList(logisticsReq, idList);
+        changeDict(ledgerLogisticsDtos);
+        return ledgerLogisticsDtos;
+    }
 }
 }

+ 69 - 0
sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerLogisticsMapper.xml

@@ -504,4 +504,73 @@
               and kllu.top_ent_id = #{entId,jdbcType=BIGINT}
               and kllu.top_ent_id = #{entId,jdbcType=BIGINT}
         </where>
         </where>
     </select>
     </select>
+
+    <select id="exportList" resultType="com.sckw.payment.model.dto.LedgerLogisticsDto">
+        select kll.id,
+               kll.l_ledger_no                  lLedgerNo,
+               kll.name,
+               kll.start_time                   startTime,
+               kll.end_time                     endTime,
+               kll.tax_rate                     taxRate,
+               kll.trading,
+               kll.total_price                  totalPrice,
+               kll.ex_tax_price                 exTaxPrice,
+               kll.settle_price                 settlePrice,
+               kll.actual_price                 actualPrice,
+               kll.success_phone                successPhone,
+               kll.success_user                 successUser,
+               kll.url,
+               kll.generate_time                generateTime,
+               kll.receipt_time                 receiptTime,
+               kll.remark,
+               kll.status,
+               kll.create_by                    createBy,
+               kllu.top_ent_id                  checkEntId,
+               (case
+                    when #{logisticsReq.unitType,jdbcType=INTEGER} = 1 then kll.audit_user
+                    else kll.success_user end) as contacts,
+               (case
+                    when #{logisticsReq.unitType,jdbcType=INTEGER} = 1 then kll.audit_phone
+                    else kll.success_phone end) as phone,
+               kllu.firm_name                   firmName,
+               kll.order_count                  orderCount
+        from kwp_ledger_logistics kll
+                 inner join kwp_ledger_logistics_unit kllu
+                            on kll.id = kllu.l_ledger_id and kllu.del_flag = 0 and
+                               kllu.unit_type = #{logisticsReq.unitType,jdbcType=INTEGER}
+                 inner join kwp_ledger_logistics_unit kllu2
+                            on kll.id = kllu2.l_ledger_id and kllu2.del_flag = 0 and
+                               kllu2.unit_type = #{logisticsReq.unitTypeTwo,jdbcType=INTEGER}
+        <where>
+            kll.del_flag = 0
+            <choose>
+                <when test="idList != null and idList.size() != 0">
+                    and kll.id in
+                    <foreach collection="idList" open="(" separator="," close=")" item="item">
+                        #{item,jdbcType=BIGINT}
+                    </foreach>
+                </when>
+                <otherwise>
+                    and kllu2.top_ent_id = #{logisticsReq.entId,jdbcType=BIGINT}
+                    <if test="logisticsReq.status != null">
+                        and kll.status = #{logisticsReq.status}
+                    </if>
+                    <if test="logisticsReq.trading != null">
+                        and kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
+                    </if>
+                    <if test="logisticsReq.startCreateTime != null and logisticsReq.startCreateTime != '' and logisticsReq.endCreateTime != null and logisticsReq.endCreateTime != ''">
+                        and kll.generate_time between #{logisticsReq.startCreateTime,jdbcType=TIMESTAMP}
+                            and #{logisticsReq.endCreateTime,jdbcType=TIMESTAMP}
+                    </if>
+                    <if test="logisticsReq.keywords != null and logisticsReq.keywords != ''">
+                        and (
+                                    kll.l_ledger_no like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
+                                or kllu.firm_name like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
+                                or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
+                            )
+                    </if>
+                </otherwise>
+            </choose>
+        </where>
+    </select>
 </mapper>
 </mapper>