Kaynağa Gözat

运营端结算导出接口

xucaiqin 2 yıl önce
ebeveyn
işleme
ad4c1fdf1e

+ 5 - 6
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/operate/SettlementLogisticsController.java

@@ -4,8 +4,8 @@ import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.payment.model.constant.LogisticsUnitType;
 import com.sckw.payment.model.vo.SettlementLogistics;
+import com.sckw.payment.model.vo.excel.SettlementLogisticsExportVo;
 import com.sckw.payment.model.vo.req.SettlementReq;
-import com.sckw.payment.model.vo.res.SettlementLogisticsVo;
 import com.sckw.payment.service.operate.SettlementLogisticsService;
 import jakarta.annotation.Resource;
 import jakarta.servlet.http.HttpServletResponse;
@@ -67,17 +67,16 @@ public class SettlementLogisticsController {
     public HttpResult export(HttpServletResponse response, @RequestBody @Valid SettlementReq settlementReq) {
         settlementReq.setUnitType(LogisticsUnitType.SHIPPER);
         settlementReq.setUnitTypeTwo(LogisticsUnitType.CARRIER);
-        List<SettlementLogistics> list;
-        list = settlementLogisticsService.exportList(settlementReq);
+        List<SettlementLogistics> list = settlementLogisticsService.exportList(settlementReq);
         if (CollectionUtils.isEmpty(list)) {
             return HttpResult.error("没有可导出的数据");
         }
-        List<SettlementLogisticsVo> collect = list.stream().map(a -> {
-            SettlementLogisticsVo settlementLogisticsVo = new SettlementLogisticsVo();
+        List<SettlementLogisticsExportVo> collect = list.stream().map(a -> {
+            SettlementLogisticsExportVo settlementLogisticsVo = new SettlementLogisticsExportVo();
             BeanUtils.copyProperties(a, settlementLogisticsVo);
             return settlementLogisticsVo;
         }).collect(Collectors.toList());
-        ExcelUtil.downData(response, SettlementLogisticsVo.class, collect);
+        ExcelUtil.downData(response, SettlementLogisticsExportVo.class, collect);
         return null;
     }
 

+ 9 - 16
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/operate/SettlementTradeController.java

@@ -1,12 +1,11 @@
 package com.sckw.payment.controller.operate;
 
-import com.sckw.core.model.page.PageRes;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.payment.model.constant.TradeUnitType;
 import com.sckw.payment.model.vo.SettlementTrade;
+import com.sckw.payment.model.vo.excel.SettlementTradeExportVo;
 import com.sckw.payment.model.vo.req.SettlementTradeReq;
-import com.sckw.payment.model.vo.res.SettlementLogisticsVo;
 import com.sckw.payment.service.operate.SettlementTradeService;
 import jakarta.annotation.Resource;
 import jakarta.servlet.http.HttpServletResponse;
@@ -72,24 +71,18 @@ public class SettlementTradeController {
     @PostMapping("export")
     public HttpResult exportCollection(HttpServletResponse response, @RequestBody @Valid SettlementTradeReq settlementReq) {
         settlementReq.check();
-        List<SettlementTrade> list = null;
-        settlementReq.setUnitType(TradeUnitType.PURCHASE);
-        settlementReq.setUnitTypeTwo(TradeUnitType.SELL);
-        if (CollectionUtils.isEmpty(settlementReq.getIdList())) {
-            PageRes<SettlementTrade> pageResult = settlementTradeService.list(settlementReq);
-            list = pageResult.getList();
-        } else {
-//            list = settlementTradeService.selectList(settlementReq.getIdList(), TradeUnitType.PURCHASE);
-        }
+        settlementReq.setUnitType(TradeUnitType.SELL);
+        settlementReq.setUnitTypeTwo(TradeUnitType.PURCHASE);
+        List<SettlementTrade> list = settlementTradeService.exportList(settlementReq,settlementReq.getIdList());
         if (CollectionUtils.isEmpty(list)) {
             return HttpResult.error("没有可导出的数据");
         }
-        List<SettlementLogisticsVo> collect = list.stream().map(a -> {
-            SettlementLogisticsVo settlementLogisticsVo = new SettlementLogisticsVo();
-            BeanUtils.copyProperties(a, settlementLogisticsVo);
-            return settlementLogisticsVo;
+        List<SettlementTradeExportVo> collect = list.stream().map(a -> {
+            SettlementTradeExportVo settlementTradeExportVo = new SettlementTradeExportVo();
+            BeanUtils.copyProperties(a, settlementTradeExportVo);
+            return settlementTradeExportVo;
         }).collect(Collectors.toList());
-        ExcelUtil.downData(response, SettlementLogisticsVo.class, collect);
+        ExcelUtil.downData(response, SettlementTradeExportVo.class, collect);
         return null;
     }
 }

+ 1 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpSettlementTradeMapper.java

@@ -79,4 +79,5 @@ public interface KwpSettlementTradeMapper extends BaseMapper<KwpSettlementTrade>
     List<KwpSettlementRecord> queryRecord();
 
     List<SettlementTradeDto> exportList(@Param("settlementReq")SettlementTradeReq settlementReq, @Param("idList")List<Long> idList);
+    List<SettlementTrade> operateExportList(@Param("settlementReq")SettlementTradeReq settlementReq, @Param("idList")List<Long> idList);
 }

+ 1 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/PayCenterEnum.java

@@ -48,6 +48,7 @@ public enum PayCenterEnum {
     PAY_AGENT_PAY("/v1/pay/agent_pay", "清分"),
     PAY_AGENT_PAY_V2("/v2/pay/agent_pay", "清分"),
     AGENT_PAY_QUERY("/v2/pay/status/query", "清分结果查询"),
+    WITHDRAW_TRANSFER("/v2/wallet/withdraw/transfer", "转出加提现"),
     WALLET_INDEX("/v1/wallet/index", "创建钱包");
     private final String addr;
     private final String desc;

+ 4 - 4
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/SettlementTrade.java

@@ -19,6 +19,10 @@ import java.util.Date;
 @Getter
 @Setter
 public class SettlementTrade implements ISettlement {
+    /**
+     * 主键
+     */
+    private Long id;
     /**
      * 对账单id主键
      */
@@ -28,10 +32,6 @@ public class SettlementTrade implements ISettlement {
      */
     @JsonProperty("tLedgerId")
     private Long tLedgerId;
-    /**
-     * 主键
-     */
-    private Long id;
 
     /**
      * 企业id

+ 113 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/excel/SettlementLogisticsExportVo.java

@@ -0,0 +1,113 @@
+package com.sckw.payment.model.vo.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.format.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.sckw.excel.annotation.ExcelContext;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+/**
+ * @author 运营端导出
+ * @date 2023-07-21 15:28
+ */
+@Getter
+@Setter
+@ExcelContext(fileName = "物流结算订单列表", sheetName = "物流结算订单列表")
+public class SettlementLogisticsExportVo {
+
+    /**
+     * 主键
+     */
+    @ExcelProperty(value = "主键")
+    private Long id;
+
+    @ExcelProperty(value = "状态")
+    private String statusLabel;
+    /**
+     * 结算单编号
+     */
+    @ExcelProperty(value = "结算单编号")
+    private String slOrderNo;
+
+    @JsonProperty("lLedgerNo")
+    @ExcelProperty(value = "对账单编号")
+    private String lLedgerNo;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonProperty("generateTime")
+    @ExcelProperty(value = "生成时间")
+    private LocalDateTime generateTime;
+    /**
+     * 结算单名称
+     */
+    @ExcelProperty(value = "对账表名称")
+    private String name;
+
+    @ExcelProperty(value = "托运单位")
+    private String shipperFirmName;
+    @ExcelProperty(value = "承运单位")
+    private String carrierFirmName;
+
+    @ExcelProperty(value = "支付方式")
+    private String tradingLabel;
+    /**
+     * 总应收/元
+     */
+    @ExcelProperty(value = "实际应收/元")
+    private BigDecimal totalPrice;
+
+    /**
+     * 当前收款/元
+     */
+    @ExcelProperty(value = "当前收款/元")
+    private BigDecimal actualPrice;
+    /**
+     * 剩余待收款/元
+     */
+    @ExcelProperty(value = "剩余待收款/元")
+    private BigDecimal waitPrice;
+
+    /**
+     * 预计收款日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @ExcelProperty(value = "预计收款日期")
+    @DateTimeFormat("yyyy-MM-dd")
+    private Date receiptTime;
+
+
+    /**
+     * 承运方联系人
+     */
+    @ExcelProperty(value = "承运方联系人")
+    private String auditUser;
+
+    /**
+     * 承运方联系电话
+     */
+    @ExcelProperty(value = "承运方联系电话")
+    private String auditPhone;
+
+    /**
+     * 托运方联系人
+     */
+    @ExcelProperty(value = "托运方联系人")
+    private String successUser;
+
+    /**
+     * 托运方联系电话
+     */
+    @ExcelProperty(value = "托运方联系电话")
+    private String successPhone;
+
+    @ExcelProperty(value = "提交人")
+    private String createByLabel;
+
+
+}

+ 111 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/excel/SettlementTradeExportVo.java

@@ -0,0 +1,111 @@
+package com.sckw.payment.model.vo.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.format.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.sckw.excel.annotation.ExcelContext;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+/**
+ * 运营端导出
+ *
+ * @author 徐才钦
+ * @date 2023-07-20 12:26
+ */
+@Getter
+@Setter
+@ExcelContext(fileName = "贸易结算订单列表", sheetName = "贸易结算订单列表")
+public class SettlementTradeExportVo {
+    /**
+     * 主键
+     */
+    @ExcelProperty(value = "主键")
+    private Long id;
+
+    @ExcelProperty(value = "状态")
+    private String statusLabel;
+    /**
+     * 结算单编号
+     */
+    @ExcelProperty(value = "结算单编号")
+    private String stOrderNo;
+
+    @JsonProperty("tLedgerNo")
+    @ExcelProperty(value = "对账单编号")
+    private String tLedgerNo;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonProperty("generateTime")
+    @ExcelProperty(value = "生成时间")
+    private LocalDateTime generateTime;
+    /**
+     * 结算单名称
+     */
+    @ExcelProperty(value = "对账表名称")
+    private String name;
+
+    @ExcelProperty(value = "供应单位")
+    private String sellFirmName;
+    @ExcelProperty(value = "采购单位")
+    private String purchaseFirmName;
+    @ExcelProperty(value = "支付方式")
+    private String tradingLabel;
+    /**
+     * 总应收/元
+     */
+    @ExcelProperty(value = "实际应收/元")
+    private BigDecimal totalPrice;
+
+    /**
+     * 当前收款/元
+     */
+    @ExcelProperty(value = "当前收款/元")
+    private BigDecimal actualPrice;
+    /**
+     * 剩余待收款/元
+     */
+    @ExcelProperty(value = "剩余待收款/元")
+    private BigDecimal waitPrice;
+
+    /**
+     * 预计收款日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @ExcelProperty(value = "预计收款日期")
+    @DateTimeFormat("yyyy-MM-dd")
+    private Date receiptTime;
+
+
+    /**
+     * 对账采购财务联系人名称
+     */
+    @ExcelProperty(value = "供方联系人")
+    private String auditUser;
+
+    /**
+     * 对账采购财务联系人电话
+     */
+    @ExcelProperty(value = "供方联系电话")
+    private String auditPhone;
+
+    /**
+     * 对账销售财务联系人名称
+     */
+    @ExcelProperty(value = "采方联系人")
+    private String successUser;
+
+    /**
+     * 对账销售财务联系人电话
+     */
+    @ExcelProperty(value = "采方联系电话")
+    private String successPhone;
+
+    @ExcelProperty(value = "提交人")
+    private String createByLabel;
+}

+ 2 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/SettlementLogisticsVo.java

@@ -1,6 +1,7 @@
 package com.sckw.payment.model.vo.res;
 
 import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.format.DateTimeFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.sckw.excel.annotation.ExcelContext;
 import lombok.Getter;
@@ -63,6 +64,7 @@ public class SettlementLogisticsVo {
     /**
      * 预计收款日期
      */
+    @DateTimeFormat(value = "yyyy-MM-dd")
     @JsonFormat(pattern = "yyyy-MM-dd")
     @ExcelProperty(value = "预计收款日期")
     private Date receiptTime;

+ 25 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/operate/SettlementLogisticsService.java

@@ -9,6 +9,7 @@ import com.sckw.core.utils.StringTimeUtil;
 import com.sckw.payment.dao.KwpSettlementLogisticsMapper;
 import com.sckw.payment.model.constant.LogisticsUnitType;
 import com.sckw.payment.model.constant.SettlementEnum;
+import com.sckw.payment.model.dto.ISettlement;
 import com.sckw.payment.model.vo.SettlementLogistics;
 import com.sckw.payment.model.vo.req.SettlementReq;
 import com.sckw.payment.model.vo.res.SettlementLogisticsSumVo;
@@ -35,6 +36,23 @@ public class SettlementLogisticsService {
     private RemoteSystemService remoteSystemService;
     private final KwpSettlementLogisticsMapper settlementLogisticsMapper;
 
+    /**
+     * 字典转换
+     *
+     * @param list 结算单列表数据
+     */
+    private void changeDict(List<? extends ISettlement> list) {
+        //字典等数据转换
+        Map<String, SysDictResDto> dictResDtoMap = remoteSystemService.queryDictMapByType(DictTypeEnum.TRADE_TYPE.getType());
+        for (ISettlement iSettlement : list) {
+            String trading = iSettlement.getTrading();
+            SysDictResDto sysDictResDto = dictResDtoMap.get(trading);
+            if (Objects.nonNull(sysDictResDto)) {
+                iSettlement.setTradingLabel(sysDictResDto.getLabel());
+            }
+            iSettlement.setStatusLabel(SettlementEnum.getStatusDesc(iSettlement.getStatus()));
+        }
+    }
 
     public List<TableTop> count(SettlementReq settlementReq) {
         settlementReq.setUnitType(LogisticsUnitType.SHIPPER);
@@ -78,7 +96,13 @@ public class SettlementLogisticsService {
 
     public List<SettlementLogistics> exportList(SettlementReq settlementReq) {
         validSettlementReq(settlementReq);
-        return settlementLogisticsMapper.exportList(settlementReq, settlementReq.getIdList());
+        List<SettlementLogistics> settlementLogistics = settlementLogisticsMapper.exportList(settlementReq, settlementReq.getIdList());
+        changeDict(settlementLogistics);
+        for (SettlementLogistics tmp : settlementLogistics) {
+            UserCacheResDto userCacheResDto = remoteSystemService.queryUserCacheById(tmp.getCreateBy());
+            tmp.setCreateByLabel(Objects.nonNull(userCacheResDto) ? userCacheResDto.getName() : "");
+        }
+        return settlementLogistics;
     }
 
 

+ 9 - 6
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/operate/SettlementTradeService.java

@@ -5,15 +5,10 @@ import com.github.pagehelper.PageInfo;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.model.page.PageRes;
 import com.sckw.core.model.vo.TableTop;
-import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.payment.dao.KwpSettlementTradeMapper;
 import com.sckw.payment.model.constant.SettlementEnum;
-import com.sckw.payment.model.constant.TradeUnitType;
 import com.sckw.payment.model.dto.ISettlement;
-import com.sckw.payment.model.dto.SettlementPurchaseDto;
-import com.sckw.payment.model.dto.SettlementSellDto;
-import com.sckw.payment.model.dto.SettlementTradeDto;
 import com.sckw.payment.model.vo.SettlementTrade;
 import com.sckw.payment.model.vo.req.SettlementTradeReq;
 import com.sckw.payment.model.vo.res.SettlementSumVo;
@@ -114,5 +109,13 @@ public class SettlementTradeService {
     }
 
 
-
+    public List<SettlementTrade> exportList(SettlementTradeReq settlementReq, List<Long> idList) {
+        List<SettlementTrade> settlementTradeDtos = settlementTradeMapper.operateExportList(settlementReq, idList);
+        changeDict(settlementTradeDtos);
+        for (SettlementTrade settlementTradeDto : settlementTradeDtos) {
+            UserCacheResDto userCacheResDto = remoteSystemService.queryUserCacheById(settlementTradeDto.getCreateBy());
+            settlementTradeDto.setCreateByLabel(Objects.nonNull(userCacheResDto) ? userCacheResDto.getName() : "");
+        }
+        return settlementTradeDtos;
+    }
 }

+ 64 - 0
sckw-modules/sckw-payment/src/main/resources/mapper/KwpSettlementTradeMapper.xml

@@ -563,4 +563,68 @@
             </choose>
         </where>
     </select>
+    <select id="operateExportList" resultType="com.sckw.payment.model.vo.SettlementTrade">
+        select kst.id,
+               kst.status,
+               kst.st_order_no                                    stOrderNo,
+               kst.receipt_time                                   receiptTime,
+               cast(kst.actual_price as char)                     actualPrice,
+               cast(kst.total_price as char)                      totalPrice,
+               cast((kst.total_price - kst.actual_price) as char) waitPrice,
+               kst.audit_user                                     auditUser,
+               kst.audit_phone                                    auditPhone,
+               kst.success_user                                   successUser,
+               kst.success_phone                                  successPhone,
+               kst.create_by                                      createBy,
+               kst.create_time                                    createTime,
+               kst.t_ledger_id                                    tLedgerId,
+               klt.id                                             ledgerId,
+               klt.name,
+               klt.trading,
+               klt.t_ledger_no                                    tLedgerNo,
+               klt.generate_time                                  generateTime,
+               kltu.firm_name                                     sellFirmName,
+               kltu2.firm_name                                    purchaseFirmName,
+               kst.update_by                                      updateBy
+        from kwp_settlement_trade kst
+                 inner join kwp_ledger_trade klt on kst.t_ledger_id = klt.id and klt.del_flag = 0
+                 inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0 and
+                                                          kltu.unit_type = #{settlementReq.unitType,jdbcType=INTEGER}
+                 inner join kwp_ledger_trade_unit kltu2 on klt.id = kltu2.t_ledger_id and kltu2.del_flag = 0 and
+                                                           kltu2.unit_type =
+                                                           #{settlementReq.unitTypeTwo,jdbcType=INTEGER}
+        <where>
+            kst.del_flag = 0
+            <choose>
+                <when test="idList != null and idList.size() != 0">
+                    and kst.id in
+                    <foreach collection="idList" open="(" separator="," close=")" item="item">
+                        #{item,jdbcType=BIGINT}
+                    </foreach>
+                </when>
+                <otherwise>
+                    <if test="settlementReq.keywords != null and settlementReq.keywords != ''">
+                        and (
+                                    klt.name like concat('%', #{settlementReq.keywords,jdbcType=VARCHAR}, '%')
+                                or kltu.firm_name like concat('%', #{settlementReq.keywords,jdbcType=VARCHAR}, '%')
+                                or kltu2.firm_name like concat('%', #{settlementReq.keywords,jdbcType=VARCHAR}, '%')
+                                or kst.st_order_no like concat('%', #{settlementReq.keywords,jdbcType=VARCHAR}, '%')
+                            )
+                    </if>
+                    <if test="settlementReq.trading != null and settlementReq.trading != ''">
+                        and klt.trading = #{settlementReq.trading,jdbcType=VARCHAR}
+                    </if>
+                    <if test="settlementReq.status != null">
+                        and kst.status = #{settlementReq.status,jdbcType=INTEGER}
+                    </if>
+                    <if test="settlementReq.startCreateTime != null and settlementReq.startCreateTime != '' and settlementReq.endCreateTime != null and settlementReq.endCreateTime != ''">
+                        and kst.create_time between #{settlementReq.startCreateTime,jdbcType=TIMESTAMP} and #{settlementReq.endCreateTime,jdbcType=TIMESTAMP}
+                    </if>
+                    <if test="settlementReq.startReceiptTime != null and settlementReq.startReceiptTime != '' and settlementReq.endReceiptTime != null and settlementReq.endReceiptTime != ''">
+                        and kst.receipt_time between #{settlementReq.startReceiptTime,jdbcType=TIMESTAMP} and #{settlementReq.endReceiptTime,jdbcType=TIMESTAMP}
+                    </if>
+                </otherwise>
+            </choose>
+        </where>
+    </select>
 </mapper>