Procházet zdrojové kódy

从saas 平台获取 支付 uid

18782137998 před 1 rokem
rodič
revize
8c1b858855

+ 1 - 0
src/main/java/com/sckw/freight/config/DataSourceNames.java

@@ -11,4 +11,5 @@ package com.sckw.freight.config;
 public   class DataSourceNames {
     public static final String KLL = "kll";
     public static final String FREIGHT = "freight";
+    public static final String SAAS = "saas";
 }

+ 236 - 0
src/main/java/com/sckw/freight/entity/saas/SaasCompany.java

@@ -0,0 +1,236 @@
+package com.sckw.freight.entity.saas;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.time.LocalDate;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 客户信息
+ * </p>
+ *
+ * @author xj
+ * @since 2025-01-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("saas_company")
+public class SaasCompany implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 自增长id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 企业全称
+     */
+    private String fullName;
+
+    /**
+     * 企业简称
+     */
+    private String sortName;
+
+    /**
+     * 社会统一信息代码
+     */
+    private String companyNo;
+
+    /**
+     * 1:矿山,2:贸易商,3:第三方物流,4,矿山主体公司
+     */
+    private Boolean companyType;
+
+    /**
+     * 企业地址
+     */
+    private String companyAddress;
+
+    /**
+     * 企业联系电话
+     */
+    private String companyMobile;
+
+    /**
+     * 业务联系人姓名
+     */
+    private String person;
+
+    /**
+     * 业务联系人电话
+     */
+    private String personMobile;
+
+    /**
+     * 财务联系人
+     */
+    private String financeName;
+
+    /**
+     * 财务联系人电话
+     */
+    private String financeMobile;
+
+    /**
+     * 技术联系人
+     */
+    private String technologyName;
+
+    /**
+     * 技术联系人电话
+     */
+    private String technologyMobile;
+
+    /**
+     * 合同时效开始
+     */
+    private LocalDate contractDateStart;
+
+    /**
+     * 合同时效结束
+     */
+    private LocalDate contractDateEnd;
+
+    /**
+     * 法人姓名
+     */
+    private String juristicName;
+
+    /**
+     * 法人联系电话
+     */
+    private String juristicMobile;
+
+    /**
+     * 法人身份证
+     */
+    private String juristicNo;
+
+    /**
+     * 法人身份证正面
+     */
+    private String juristicNoFront;
+
+    /**
+     * 法人身份证反面
+     */
+    private String juristicNoBack;
+
+    /**
+     * 营业执照
+     */
+    private String companyPhoto;
+
+    /**
+     * 0:新提交,1审核不通过,2审核通过,3:合作中,4:合作过期,
+     */
+    private Boolean status;
+
+    /**
+     * 审核人
+     */
+    private Integer checkUserid;
+
+    /**
+     * 审核时间
+     */
+    private LocalDateTime checkTime;
+
+    /**
+     * 审核原因
+     */
+    private String reason;
+
+    /**
+     * 开户行
+     */
+    private String bankName;
+
+    /**
+     * 开户支行
+     */
+    private String bankNameDetail;
+
+    /**
+     * 开户账号
+     */
+    private String bankNo;
+
+    /**
+     * 矿山主体的父ID
+     */
+    private Integer pCompanyId;
+
+    /**
+     * 用户ID
+     */
+    private Integer userId;
+
+    /**
+     * 新增时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 修改时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 删除时间
+     */
+    private Integer deleteTime;
+
+    /**
+     * 经纬度
+     */
+    private String json;
+
+    /**
+     * 唯一标志符号
+     */
+    private String mine;
+
+    /**
+     * 纬度
+     */
+    private String lat;
+
+    /**
+     * 经度
+     */
+    private String lng;
+
+    /**
+     * 对应金蝶接口的唯一标识
+     */
+    private String extCode;
+
+    /**
+     * 道路经营许可证,物流公司需要
+     */
+    private String roadImage;
+
+    /**
+     * 支付平台唯一编码
+     */
+    private String payPlatformUid;
+
+    /**
+     * 中信支付主体账户
+     */
+    private String payPlatformMainAccount;
+
+
+}

+ 19 - 0
src/main/java/com/sckw/freight/mapper/saas/SaasCompanyMapper.java

@@ -0,0 +1,19 @@
+package com.sckw.freight.mapper.saas;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sckw.freight.config.DataSourceNames;
+import com.sckw.freight.entity.saas.SaasCompany;
+
+/**
+ * <p>
+ * 客户信息 Mapper 接口
+ * </p>
+ *
+ * @author xj
+ * @since 2025-01-15
+ */
+@DS(DataSourceNames.SAAS)
+public interface SaasCompanyMapper extends BaseMapper<SaasCompany> {
+
+}

+ 41 - 18
src/main/java/com/sckw/freight/service/freight/impl/KwpLedgerLogisticsServiceImpl.java

@@ -3,13 +3,17 @@ package com.sckw.freight.service.freight.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.sckw.freight.entity.freight.*;
+import com.sckw.freight.entity.freight.KwpLedgerLogistics;
+import com.sckw.freight.entity.freight.KwpLedgerLogisticsOrder;
+import com.sckw.freight.entity.freight.KwpLedgerLogisticsTrack;
+import com.sckw.freight.entity.freight.KwpSettlementLogistics;
 import com.sckw.freight.entity.kll.KllOrder;
 import com.sckw.freight.entity.kll.KllOrderTask;
+import com.sckw.freight.entity.saas.SaasCompany;
 import com.sckw.freight.mapper.freight.KwpLedgerLogisticsMapper;
 import com.sckw.freight.mapper.freight.KwpSettlementLogisticsMapper;
-import com.sckw.freight.mapper.freight.KwpWalletRelationMapper;
 import com.sckw.freight.mapper.kll.KllOrderTaskMapper;
+import com.sckw.freight.mapper.saas.SaasCompanyMapper;
 import com.sckw.freight.model.dto.PayIndex;
 import com.sckw.freight.model.enums.*;
 import com.sckw.freight.model.po.LedgerLogisticsStatistics;
@@ -61,8 +65,11 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
     KwpLedgerLogisticsMapper kwpLedgerLogisticsMapper;
     @Autowired
     KllOrderTaskMapper kllOrderTaskMapper;
+    //    @Autowired
+//    KwpWalletRelationMapper kwpWalletRelationMapper;
     @Autowired
-    KwpWalletRelationMapper kwpWalletRelationMapper;
+    SaasCompanyMapper saasCompanyMapper;
+
     @Autowired
     PayCenterService payCenterService;
     //@Lazy
@@ -121,7 +128,7 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
         if (kwpSettlementLogistics == null) kwpSettlementLogistics = new ArrayList<>();
         BigDecimal totalPrice = kwpSettlementLogistics.stream().map(KwpSettlementLogistics::getActualPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
         newLedgerLogistics.setActualPrice(totalPrice);
-        if (totalPrice.compareTo(BigDecimal.ZERO)==0)return;
+        if (totalPrice.compareTo(BigDecimal.ZERO) == 0) return;
         KwpLedgerLogisticsStatusEnum status = KwpLedgerLogisticsStatusEnum.Unpaid;
         if (totalPrice.compareTo(ledgerLogistics.getSettlePrice()) < 0) {
             status = KwpLedgerLogisticsStatusEnum.PartialPaid;
@@ -493,24 +500,40 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
         if (money.compareTo(BigDecimal.ZERO) <= 0) {
             return R.failed("对账单已支付");
         }
-        //查询收款方(卖方)  账户信息
-        LambdaQueryWrapper<KwpWalletRelation> walletRelationWrapperS = new LambdaQueryWrapper<>();
-        walletRelationWrapperS.eq(KwpWalletRelation::getEntId, entId);
-        KwpWalletRelation walletRelationS = kwpWalletRelationMapper.selectOne(walletRelationWrapperS);
-        if (walletRelationS == null) {
-            return R.failed("收款方【"+entId+"】账户不存在");
+        //查询收款方(卖方-收款方)  账户信息
+//        LambdaQueryWrapper<KwpWalletRelation> walletRelationWrapperS = new LambdaQueryWrapper<>();
+//        walletRelationWrapperS.eq(KwpWalletRelation::getEntId, entId);
+//        KwpWalletRelation walletRelationS = kwpWalletRelationMapper.selectOne(walletRelationWrapperS);
+//        if (walletRelationS == null) {
+//            return R.failed("收款方【"+entId+"】账户不存在");
+//        }
+        SaasCompany saasCompanyS = saasCompanyMapper.selectById(entId);
+        if (saasCompanyS == null) {
+            return R.failed("收款方【" + entId + "】账户不存在");
+        }
+        if (StringUtils.isEmpty(saasCompanyS.getPayPlatformUid())) {
+            return R.failed("收款方【" + entId + "】钱包账户不存在");
         }
-        //查询付款方(买方)  账户信息
-        LambdaQueryWrapper<KwpWalletRelation> walletRelationWrapperP = new LambdaQueryWrapper<>();
-        walletRelationWrapperP.eq(KwpWalletRelation::getEntId, ledgerLogistics.getCompanyId());
-        KwpWalletRelation walletRelationP = kwpWalletRelationMapper.selectOne(walletRelationWrapperP);
-        if (walletRelationP == null) {
-            return R.failed("付款方【"+ledgerLogistics.getCompanyId()+"】账户不存在");
+        //查询付款方(买方-付款方)  账户信息
+//        LambdaQueryWrapper<KwpWalletRelation> walletRelationWrapperP = new LambdaQueryWrapper<>();
+//        walletRelationWrapperP.eq(KwpWalletRelation::getEntId, ledgerLogistics.getCompanyId());
+//        KwpWalletRelation walletRelationP = kwpWalletRelationMapper.selectOne(walletRelationWrapperP);
+//        if (walletRelationP == null) {
+//            return R.failed("付款方【"+ledgerLogistics.getCompanyId()+"】账户不存在");
+//        }
+        SaasCompany saasCompanyP = saasCompanyMapper.selectById(ledgerLogistics.getCompanyId());
+        if (saasCompanyP == null) {
+            return R.failed("付款方【" + ledgerLogistics.getCompanyId() + "】账户不存在");
+        }
+        if (StringUtils.isEmpty(saasCompanyP.getPayPlatformUid())) {
+            return R.failed("付款方【" + ledgerLogistics.getCompanyId() + "】钱包账户不存在");
         }
         //调用支付中台的【在线充值】接口
-        R<PayIndex> payIndexR = payCenterService.payIndex(walletRelationP.getUid(), walletRelationS.getUid(), ChannelEnum.XW, money.multiply(BigDecimal.valueOf(100)).longValue());
+        //R<PayIndex> payIndexR = payCenterService.payIndex(walletRelationP.getUid(), walletRelationS.getUid(), ChannelEnum.XW, money.multiply(BigDecimal.valueOf(100)).longValue());
+        R<PayIndex> payIndexR = payCenterService.payIndex(saasCompanyP.getPayPlatformUid(), saasCompanyS.getPayPlatformUid(), ChannelEnum.XW, money.multiply(BigDecimal.valueOf(100)).longValue());
+
         if (payIndexR == null || !payIndexR.getStatus() || payIndexR.getCode() != 200) {
-            return R.failed("支付中台的【在线充值】接口失败,"+payIndexR.getMsg());
+            return R.failed("支付中台的【在线充值】接口失败," + payIndexR.getMsg());
         }
         PayIndex payIndex = payIndexR.getData();
         //保存付款单信息

+ 16 - 0
src/main/java/com/sckw/freight/service/saas/ISaasCompanyService.java

@@ -0,0 +1,16 @@
+package com.sckw.freight.service.saas;
+
+import com.sckw.freight.entity.saas.SaasCompany;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 客户信息 服务类
+ * </p>
+ *
+ * @author xj
+ * @since 2025-01-15
+ */
+public interface ISaasCompanyService extends IService<SaasCompany> {
+
+}

+ 20 - 0
src/main/java/com/sckw/freight/service/saas/impl/SaasCompanyServiceImpl.java

@@ -0,0 +1,20 @@
+package com.sckw.freight.service.saas.impl;
+
+import com.sckw.freight.entity.saas.SaasCompany;
+import com.sckw.freight.mapper.saas.SaasCompanyMapper;
+import com.sckw.freight.service.saas.ISaasCompanyService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 客户信息 服务实现类
+ * </p>
+ *
+ * @author xj
+ * @since 2025-01-15
+ */
+@Service
+public class SaasCompanyServiceImpl extends ServiceImpl<SaasCompanyMapper, SaasCompany> implements ISaasCompanyService {
+
+}

+ 5 - 0
src/main/resources/application-dev.yml

@@ -19,6 +19,11 @@ spring:
           url: jdbc:mysql://10.10.10.230:3306/kll?useUnicode=true&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
           username: kll
           password: kll
+        saas:
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          url: jdbc:mysql://10.10.10.230:3306/saas?useUnicode=true&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+          username: saas
+          password: saas
 
   data:
     redis:

+ 5 - 0
src/main/resources/application-test.yml

@@ -20,6 +20,11 @@ spring:
           url: jdbc:mysql://10.10.10.221:3306/kll?useUnicode=true&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
           username: kll
           password: kll
+        saas:
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          url: jdbc:mysql://10.10.10.221:3306/saas?useUnicode=true&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+          username: saas
+          password: saas
   data:
     redis:
       host: 10.10.10.221

+ 5 - 0
src/main/resources/com/sckw/freight/mapper/saas/SaasCompanyMapper.xml

@@ -0,0 +1,5 @@
+<?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.sckw.freight.mapper.saas.SaasCompanyMapper">
+
+</mapper>