TRX vor 1 Jahr
Ursprung
Commit
1cd88ed937
28 geänderte Dateien mit 815 neuen und 329 gelöschten Zeilen
  1. 22 0
      FullCardClient/src/main/java/com/zhongshu/card/client/model/org/BelongOigParam.java
  2. 0 48
      FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/payConfig/PaySharingConfig.java
  3. 4 0
      FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/PayConfigFieldModel.java
  4. 28 4
      FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/PayConfigParam.java
  5. 24 0
      FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/ProjectMainPaySettingModel.java
  6. 67 0
      FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/ProjectMainPaySettingParam.java
  7. 18 6
      FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/ProjectPaySettingInfoModel.java
  8. 48 0
      FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/ProjectPaySettingInfoSearch.java
  9. 3 0
      FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/WxPayConfigModel.java
  10. 0 3
      FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/WxPayConfigParam.java
  11. 21 0
      FullCardClient/src/main/java/com/zhongshu/card/client/model/payment/PaymentTypeParam.java
  12. 20 0
      FullCardClient/src/main/java/com/zhongshu/card/client/type/paySetting/RegularType.java
  13. 19 0
      FullCardClient/src/main/java/com/zhongshu/card/client/type/paySetting/SettlementRulesType.java
  14. 19 0
      FullCardClient/src/main/java/com/zhongshu/card/client/type/paySetting/WithdrawType.java
  15. 40 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/paySetting/ProjectMainPaySettingController.java
  16. 40 37
      FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/paySetting/ProjectPaySettingController.java
  17. 12 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/projectAbout/ProjectMainPaySettingDao.java
  18. 13 7
      FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/projectAbout/ProjectPaySettingInfoDao.java
  19. 19 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/projectAbout/extend/ProjectOrgPaySettingInfoDaoExtend.java
  20. 87 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/projectAbout/impl/ProjectOrgPaySettingInfoDaoImpl.java
  21. 1 1
      FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/paySetting/PayShareList.java
  22. 80 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/paySetting/ProjectMainPaySetting.java
  23. 24 11
      FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/paySetting/ProjectOrgPaySettingInfo.java
  24. 27 24
      FullCardServer/src/main/java/com/zhongshu/card/server/core/service/org/OrganizationServiceImpl.java
  25. 4 4
      FullCardServer/src/main/java/com/zhongshu/card/server/core/service/orgManager/OrganizationManagerServiceImpl.java
  26. 2 4
      FullCardServer/src/main/java/com/zhongshu/card/server/core/service/orgManager/ProjectBindOrgServiceImpl.java
  27. 63 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/service/paySetting/ProjectMainPaySettingService.java
  28. 110 180
      FullCardServer/src/main/java/com/zhongshu/card/server/core/service/paySetting/ProjectPaySettingServiceImpl.java

+ 22 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/org/BelongOigParam.java

@@ -0,0 +1,22 @@
+package com.zhongshu.card.client.model.org;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotEmpty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author TRX
+ * @date 2024/11/4
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class BelongOigParam extends ProjectOrgModel {
+
+    @Schema(description = "所属机构oid")
+    @NotEmpty(message = "belongOig不能为空")
+    private String belongOig;
+
+}

+ 0 - 48
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/payConfig/PaySharingConfig.java

@@ -1,48 +0,0 @@
-package com.zhongshu.card.client.model.paySetting.payConfig;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.math.BigDecimal;
-
-/**
- * 分账规则   提现规则
- *
- * @author TRX
- * @date 2024/9/25
- */
-@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
-public class PaySharingConfig {
-
-    //----------------------------分账规则配置 start -------------------
-
-    @Schema(description = "最小分账金额, 单位分")
-    private Long minSharing = 0L;
-
-    @Schema(description = "全局项目分账比例,0-100")
-    private BigDecimal projectScale = BigDecimal.ZERO;
-
-    @Schema(description = "全局机构分账比例,0-100")
-    private BigDecimal orgScale = BigDecimal.ZERO;
-
-    //------------------ 提现设置 start--------------
-
-    @Schema(description = "是否开启提现审核")
-    private Boolean isOpenWithdrawReView = Boolean.FALSE;
-
-    @Schema(description = "单笔提现最低提现金额")
-    private Long minWithdraw = 0L;
-
-    @Schema(description = "单笔提现最高提现金额")
-    private Long maxWithdraw = 0L;
-
-    @Schema(description = "单日提现额度")
-    private Long maxDayWithdraw = 0L;
-
-}

+ 4 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/PayConfigFieldModel.java

@@ -1,5 +1,6 @@
 package com.zhongshu.card.client.model.paySetting.paySetting;
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
@@ -17,10 +18,13 @@ import java.util.List;
 @NoArgsConstructor
 public class PayConfigFieldModel {
 
+    @Schema(description = "参数列表")
     private List<PayConfigField> fields = new ArrayList<PayConfigField>();
 
+    @Schema(description = "api名称")
     private String apiName = "";
 
+    @Schema(description = "提交方式")
     private String method = "post";
 
     private String type = "form-data";

+ 28 - 4
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/PayConfigParam.java

@@ -1,5 +1,7 @@
 package com.zhongshu.card.client.model.paySetting.paySetting;
 
+import com.github.microservice.types.payment.PaymentType;
+import com.zhongshu.card.client.type.DataState;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.AllArgsConstructor;
 import lombok.Data;
@@ -17,15 +19,37 @@ public class PayConfigParam {
     @Schema(description = "数据ID")
     private String id;
 
-    @Schema(description = "名称")
+    @Schema(description = "账户/名称")
     private String name;
 
-    @Schema(description = "项目id", required = true)
+    @Schema(description = "商户ID")
+    private String mchId;
+
+    @Schema(description = "银行账号")
+    private String bankAccountNumber;
+
+    @Schema(description = "开户行")
+    private String bankName;
+
+    @Schema(description = "开户支行")
+    private String bankSubName;
+
+    @Schema(description = "所属机构oid")
+    private String belongOig;
+
+    @Schema(description = "所属项目oid", required = true)
     private String projectOid;
 
-    @Schema(description = "上层的数据ID")
-    private String projectPaySettingId;
+    @Schema(description = "支付产品", required = true)
+    private PaymentType channelType;
 
     @Schema(description = "是否是默认的")
     private Boolean isDefault = Boolean.FALSE;
+
+    @Schema(description = "是否可用")
+    private DataState state;
+
+//    @Schema(description = "上层的数据ID")
+//    private String projectPaySettingId;
+
 }

+ 24 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/ProjectMainPaySettingModel.java

@@ -0,0 +1,24 @@
+package com.zhongshu.card.client.model.paySetting.paySetting;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author TRX
+ * @date 2024/11/5
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class ProjectMainPaySettingModel {
+
+    @Schema(description = "选择的机构主支付配置数据id")
+    private String paySettingInfoId;
+
+    @Schema(description = "选择的机构主支付配置数据id")
+    private String paySettingInfoName;
+
+
+}

+ 67 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/ProjectMainPaySettingParam.java

@@ -0,0 +1,67 @@
+package com.zhongshu.card.client.model.paySetting.paySetting;
+
+import com.zhongshu.card.client.type.paySetting.RegularType;
+import com.zhongshu.card.client.type.paySetting.SettlementRulesType;
+import com.zhongshu.card.client.type.paySetting.WithdrawType;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+
+/**
+ * @author TRX
+ * @date 2024/11/5
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class ProjectMainPaySettingParam {
+
+    @Schema(description = "选择的机构主支付配置数据id")
+    @NotEmpty
+    private String paySettingInfoId;
+
+    @Schema(description = "项目oid")
+    @NotEmpty
+    private String projectOid;
+
+    //----------------------- 结算规则 start -----------------
+
+    @Schema(description = "结算规则")
+    @NotNull
+    private SettlementRulesType settlementRulesType;
+
+    //---------------D+N结算 设置
+    @Schema(description = "天数,>= 1")
+    private Integer days;
+
+    //---------------定期结算 设置
+
+    @Schema(description = "定期类型")
+    @NotNull
+    private RegularType regularType;
+
+    @Schema(description = "当前的时间,如:12:30")
+    private String timeStr;
+
+    //----------------------------提现规则 start --------------
+
+    @Schema(description = "提现规则类型")
+    @NotNull
+    private WithdrawType withdrawType;
+
+    //---------------------------分账规则配置 start ------------
+    @Schema(description = "最小分账金额, 单位分")
+    private Long minSharing = 0L;
+
+    @Schema(description = "全局项目分账比例,0-100")
+    private BigDecimal projectScale = BigDecimal.ZERO;
+
+    @Schema(description = "全局机构分账比例,0-100")
+    private BigDecimal orgScale = BigDecimal.ZERO;
+
+}

+ 18 - 6
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/ProjectPaySettingInfoModel.java

@@ -21,24 +21,36 @@ public class ProjectPaySettingInfoModel extends SuperModel {
 
     //----------------------------------业务数据 -------------------
 
-    @Schema(description = "上层的选择ID")
-    private String projectPaySettingId;
+    @Schema(description = "支付产品的logo")
+    private String payLogo;
 
-    @Schema(description = "名称")
+    @Schema(description = "账户/名称")
     private String name;
 
+    @Schema(description = "商户ID")
+    private String mchId;
+
+    @Schema(description = "银行账号")
+    private String bankAccountNumber;
+
+    @Schema(description = "开户行")
+    private String bankName;
+
+    @Schema(description = "开户支行")
+    private String bankSubName;
+
     @Schema(description = "显示的")
     private String code = "";
 
     public String getCode() {
-        if(payConfig != null) {
+        if (payConfig != null) {
             if (channelType == PaymentType.WeChat) {
-                try{
+                try {
                     WxPayConfigModel configModel = (WxPayConfigModel) payConfig;
                     if (ObjectUtils.isNotEmpty(configModel)) {
                         return configModel.getMchId();
                     }
-                }catch (Exception e){
+                } catch (Exception e) {
                     e.printStackTrace();
                 }
             }

+ 48 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/ProjectPaySettingInfoSearch.java

@@ -0,0 +1,48 @@
+package com.zhongshu.card.client.model.paySetting.paySetting;
+
+import com.github.microservice.types.payment.PaymentChannelType;
+import com.github.microservice.types.payment.PaymentType;
+import com.zhongshu.card.client.model.base.SuperSearch;
+import com.zhongshu.card.client.type.DataState;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author TRX
+ * @date 2024/11/5
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class ProjectPaySettingInfoSearch extends SuperSearch {
+
+    @Schema(description = "账户/名称")
+    private String name;
+
+    @Schema(description = "所属机构oid")
+    private String belongOig;
+
+    @Schema(description = "项目的支付渠道设置:微信支付、银联支付")
+    private PaymentType channelType;
+
+    @Schema(description = "支付产品")
+    private PaymentChannelType paymentChannelType;
+
+    @Schema(description = "银行账号")
+    private String bankAccountNumber;
+
+    @Schema(description = "开户行")
+    private String bankName;
+
+    @Schema(description = "开户支行")
+    private String bankSubName;
+
+    @Schema(description = "是否可用")
+    private DataState state;
+
+    @Schema(description = "是否是默认的")
+    private Boolean isDefault;
+
+}

+ 3 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/WxPayConfigModel.java

@@ -21,6 +21,9 @@ public class WxPayConfigModel {
     @Schema(description = "项目名称")
     private String projectName;
 
+    @Schema(description = "所属机构oid")
+    private String belongOig;
+
     @Schema(description = "appid")
     private String appId;
 

+ 0 - 3
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/WxPayConfigParam.java

@@ -21,9 +21,6 @@ public class WxPayConfigParam extends PayConfigParam {
     @Schema(description = "商户证书序列号")
     private String mchSerialNo;
 
-    @Schema(description = "商户id")
-    private String mchId;
-
     @Schema(description = "API V3密钥")
     private String apiV3Key;
 

+ 21 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/payment/PaymentTypeParam.java

@@ -0,0 +1,21 @@
+package com.zhongshu.card.client.model.payment;
+
+import com.github.microservice.types.payment.PaymentType;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author TRX
+ * @date 2024/11/4
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class PaymentTypeParam {
+
+    @Schema(description = "支付渠道")
+    private PaymentType paymentType;
+
+}

+ 20 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/type/paySetting/RegularType.java

@@ -0,0 +1,20 @@
+package com.zhongshu.card.client.type.paySetting;
+
+import lombok.Getter;
+
+/**
+ * 结算规则
+ */
+public enum RegularType {
+    Day("每天"),
+    Week("每周"),
+    Month("每月"),
+    ;
+
+    @Getter
+    private String remark;
+
+    RegularType(String remark) {
+        this.remark = remark;
+    }
+}

+ 19 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/type/paySetting/SettlementRulesType.java

@@ -0,0 +1,19 @@
+package com.zhongshu.card.client.type.paySetting;
+
+import lombok.Getter;
+
+/**
+ * 结算规则
+ */
+public enum SettlementRulesType {
+    Dn("D+N"),
+    Regular("定期结算"),
+    ;
+
+    @Getter
+    private String remark;
+
+    SettlementRulesType(String remark) {
+        this.remark = remark;
+    }
+}

+ 19 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/type/paySetting/WithdrawType.java

@@ -0,0 +1,19 @@
+package com.zhongshu.card.client.type.paySetting;
+
+import lombok.Getter;
+
+/**
+ * 提现规则
+ */
+public enum WithdrawType {
+    Auto("自动"),
+    Hand("手动"),
+    ;
+
+    @Getter
+    private String remark;
+
+    WithdrawType(String remark) {
+        this.remark = remark;
+    }
+}

+ 40 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/paySetting/ProjectMainPaySettingController.java

@@ -0,0 +1,40 @@
+package com.zhongshu.card.server.core.controller.paySetting;
+
+import com.github.microservice.auth.security.annotations.ResourceAuth;
+import com.github.microservice.auth.security.type.AuthType;
+import com.github.microservice.net.ResultContent;
+import com.zhongshu.card.client.model.paySetting.paySetting.PayConfigFieldModel;
+import com.zhongshu.card.client.model.paySetting.paySetting.ProjectMainPaySettingParam;
+import com.zhongshu.card.server.core.service.paySetting.ProjectMainPaySettingService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 项目的配置
+ *
+ * @author TRX
+ * @date 2024/7/26
+ */
+@RestController
+@RequestMapping("/project/mainPaySetting")
+@Tag(name = "项目-配置")
+public class ProjectMainPaySettingController {
+
+    @Autowired
+    private ProjectMainPaySettingService projectMainPaySettingService;
+
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @Operation(summary = "保存项目配置", description = "保存项目配置")
+    @RequestMapping(value = "saveMainPaySetting", method = {RequestMethod.POST})
+    public ResultContent<PayConfigFieldModel> saveMainPaySetting(
+            @RequestBody ProjectMainPaySettingParam param) {
+        return projectMainPaySettingService.saveMainPaySetting(param);
+    }
+
+
+}

+ 40 - 37
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/paySetting/ProjectPaySettingController.java

@@ -5,83 +5,85 @@ import com.github.microservice.auth.security.type.AuthType;
 import com.github.microservice.net.ResultContent;
 import com.zhongshu.card.client.model.base.IDParam;
 import com.zhongshu.card.client.model.base.ProjectOidParam;
+import com.zhongshu.card.client.model.org.BelongOigParam;
 import com.zhongshu.card.client.model.paySetting.payConfig.LaKaLaCollectionConfig;
 import com.zhongshu.card.client.model.paySetting.payConfig.LaKaLaCollectionConfigParam;
 import com.zhongshu.card.client.model.paySetting.paySetting.*;
+import com.zhongshu.card.client.model.payment.PaymentTypeParam;
+import com.zhongshu.card.client.model.projectAbout.PayChannelConfigAllPayModel;
+import com.zhongshu.card.client.model.projectAbout.PayChannelConfigSearch;
 import com.zhongshu.card.client.type.DataState;
 import com.zhongshu.card.server.core.service.paySetting.ProjectPaySettingServiceImpl;
 import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.web.PageableDefault;
 import org.springframework.http.MediaType;
+import org.springframework.util.Assert;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
+ * 机构的支付配置
+ *
  * @author TRX
  * @date 2024/7/26
  */
 @RestController
 @RequestMapping("/project/paySetting")
-@Tag(name = "项目-支付设置")
+@Tag(name = "机构-支付设置")
 public class ProjectPaySettingController {
 
     @Autowired
     private ProjectPaySettingServiceImpl projectPaySettingService;
 
-    @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "关联支付产品", description = "关联支付产品")
-    @RequestMapping(value = "savePayChannel", method = {RequestMethod.POST})
-    public ResultContent savePayChannel(@RequestBody ProjectPaySettingParam param) {
-        return projectPaySettingService.savePayChannel(param);
-    }
-
-    @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "得到项目所有的支付渠道参数配置", description = "得到项目所有的支付渠道参数配置")
-    @RequestMapping(value = "getAllProjectPaySetting", method = {RequestMethod.POST})
-    public ResultContent<List<ProjectPaySettingModel>> getAllProjectPaySetting(@RequestBody ProjectOidParam param) {
-        return projectPaySettingService.getAllProjectPaySetting(param.getProjectOid());
-    }
+    //------------------------------------------------机构支付参数配置 start-----------------------
 
     @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "删除参数配置", description = "删除参数配置")
-    @RequestMapping(value = "deleteInfo", method = {RequestMethod.POST})
-    public ResultContent deleteInfo(@RequestBody IDParam param) {
-        return projectPaySettingService.deleteInfo(param.getId());
+    @Operation(summary = "数据列表-分页查询", description = "数据列表-分页查询")
+    @RequestMapping(value = {"page"}, method = {RequestMethod.POST})
+    public ResultContent<Page<ProjectPaySettingInfoModel>> page(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable, @Parameter(required = false) ProjectPaySettingInfoSearch param) {
+        Assert.hasText(param.getProjectOid(), "projectOid不能为空");
+        return projectPaySettingService.page(param, pageable);
     }
 
     @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "启用支付方式", description = "启用支付方式")
-    @RequestMapping(value = "enablePay", method = {RequestMethod.POST})
-    public ResultContent enablePay(@RequestBody IDParam param) {
-        return projectPaySettingService.changeState(param.getId(), DataState.Enable);
+    @Operation(summary = "项目下所有主账户数据列表", description = "项目下所有主账户数据列表")
+    @RequestMapping(value = {"getMainList"}, method = {RequestMethod.POST})
+    public ResultContent<List<ProjectPaySettingInfoModel>> getMainList(@Parameter(required = false) ProjectPaySettingInfoSearch param) {
+        Assert.hasText(param.getProjectOid(), "projectOid不能为空");
+        param.setIsDefault(Boolean.TRUE);
+        Pageable pageable = PageRequest.of(0, 100);
+        ResultContent<Page<ProjectPaySettingInfoModel>> pageContent = projectPaySettingService.page(param, pageable);
+        if (pageContent.isFailed()) {
+            return ResultContent.buildFail(pageContent.getMsg());
+        }
+        List<ProjectPaySettingInfoModel> list = pageContent.getContent().getContent();
+        return ResultContent.buildSuccess(list);
     }
 
     @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "停用支付方式", description = "停用支付方式")
-    @RequestMapping(value = "disablePay", method = {RequestMethod.POST})
-    public ResultContent disablePay(@RequestBody IDParam param) {
-        return projectPaySettingService.changeState(param.getId(), DataState.Disable);
-    }
-
-    //------------------------------------------------支付参数配置 start-----------------------
-
-    @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "账户-账户列表", description = "账户-账户列表")
-    @RequestMapping(value = "getProjectPaySettingInfo", method = {RequestMethod.POST})
-    public ResultContent<List<ProjectPaySettingInfoModel>> getProjectPaySettingInfo(@RequestBody IDParam param) {
-        return projectPaySettingService.getProjectPaySettingInfo(param.getId());
+    @Operation(summary = "账户-机构支付账户列表(所有)", description = "账户-机构支付账户列表")
+    @RequestMapping(value = "getOrgPaySettingInfo", method = {RequestMethod.POST})
+    public ResultContent<List<ProjectPaySettingInfoModel>> getProjectPaySettingInfo(@RequestBody @Valid BelongOigParam param) {
+        return projectPaySettingService.getOrgPaySettingInfo(param);
     }
 
     @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "账户-配置字段", description = "账户-配置字段")
     @RequestMapping(value = "getFieldByConfigId", method = {RequestMethod.POST})
-    public ResultContent<PayConfigFieldModel> getFieldByConfigId(@RequestBody IDParam param) {
-        return projectPaySettingService.getFieldByConfigId(param.getId());
+    public ResultContent<PayConfigFieldModel> getFieldByConfigId(@RequestBody PaymentTypeParam param) {
+        return projectPaySettingService.getFieldByConfigId(param);
     }
 
     @ResourceAuth(value = "user", type = AuthType.User)
@@ -98,6 +100,7 @@ public class ProjectPaySettingController {
         return projectPaySettingService.getPaySettingInfo(param.getId());
     }
 
+    //-----------------------------提供的支付渠道参数保存 start -----------------------
     @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "保存项目的微信支付设置", description = "保存项目的微信支付设置")
     @RequestMapping(value = "saveWxPayConfig", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, method = {RequestMethod.POST})

+ 12 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/projectAbout/ProjectMainPaySettingDao.java

@@ -0,0 +1,12 @@
+package com.zhongshu.card.server.core.dao.projectAbout;
+
+import com.github.microservice.components.data.mongo.mongo.dao.MongoDao;
+import com.zhongshu.card.server.core.domain.paySetting.ProjectMainPaySetting;
+
+public interface ProjectMainPaySettingDao extends MongoDao<ProjectMainPaySetting> {
+
+    ProjectMainPaySetting findTopById(String id);
+
+    ProjectMainPaySetting findTopByProjectOid(String projectOid);
+
+}

+ 13 - 7
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/projectAbout/ProjectPaySettingInfoDao.java

@@ -2,21 +2,27 @@ package com.zhongshu.card.server.core.dao.projectAbout;
 
 import com.github.microservice.components.data.mongo.mongo.dao.MongoDao;
 import com.github.microservice.types.payment.PaymentType;
+import com.zhongshu.card.server.core.dao.projectAbout.extend.ProjectOrgPaySettingInfoDaoExtend;
 import com.zhongshu.card.server.core.domain.paySetting.ProjectPaySetting;
-import com.zhongshu.card.server.core.domain.paySetting.ProjectPaySettingInfo;
+import com.zhongshu.card.server.core.domain.paySetting.ProjectOrgPaySettingInfo;
 
 import java.util.List;
 
-public interface ProjectPaySettingInfoDao extends MongoDao<ProjectPaySettingInfo> {
+public interface ProjectPaySettingInfoDao extends MongoDao<ProjectOrgPaySettingInfo>, ProjectOrgPaySettingInfoDaoExtend {
 
-    ProjectPaySettingInfo findTopById(String id);
+    ProjectOrgPaySettingInfo findTopById(String id);
 
-    ProjectPaySettingInfo findTopByProjectOidAndChannelTypeAndIsDefault
+    ProjectOrgPaySettingInfo findTopByProjectOidAndChannelTypeAndIsDefault
             (String projectOid, PaymentType channelType, Boolean isDefault);
 
-    List<ProjectPaySettingInfo> findByProjectOidAndChannelType(String projectOid, PaymentType channelType);
+    List<ProjectOrgPaySettingInfo> findByBelongOigAndProjectOidAndChannelType(String belongOig, String projectOid, PaymentType channelType);
 
-    List<ProjectPaySettingInfo> findByProjectPaySetting(ProjectPaySetting projectPaySetting);
+    List<ProjectOrgPaySettingInfo> findByBelongOigAndProjectOid(String belongOig, String projectOid);
+
+    List<ProjectOrgPaySettingInfo> findByProjectPaySetting(ProjectPaySetting projectPaySetting);
+
+    int countByBelongOigAndProjectOidAndChannelType(String belongOig, String projectOid, PaymentType channelType);
+
+    ProjectOrgPaySettingInfo findTopByBelongOigAndProjectOidAndChannelType(String belongOig, String projectOid, PaymentType channelType);
 
-    int countByProjectOidAndChannelType(String projectOid, PaymentType channelType);
 }

+ 19 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/projectAbout/extend/ProjectOrgPaySettingInfoDaoExtend.java

@@ -0,0 +1,19 @@
+package com.zhongshu.card.server.core.dao.projectAbout.extend;
+
+import com.zhongshu.card.client.model.paySetting.paySetting.ProjectPaySettingInfoSearch;
+import com.zhongshu.card.client.model.projectAbout.PayChannelConfigSearch;
+import com.zhongshu.card.server.core.domain.paySetting.PayChannelConfig;
+import com.zhongshu.card.server.core.domain.paySetting.ProjectOrgPaySettingInfo;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+
+/**
+ * @Author TRX
+ * @CreateDate: 2023/7/7
+ * @Version: 1.0
+ */
+public interface ProjectOrgPaySettingInfoDaoExtend {
+
+    Page<ProjectOrgPaySettingInfo> page(Pageable pageable, ProjectPaySettingInfoSearch param);
+
+}

+ 87 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/projectAbout/impl/ProjectOrgPaySettingInfoDaoImpl.java

@@ -0,0 +1,87 @@
+package com.zhongshu.card.server.core.dao.projectAbout.impl;
+
+import com.github.microservice.components.data.mongo.mongo.helper.DBHelper;
+import com.zhongshu.card.client.model.paySetting.paySetting.ProjectPaySettingInfoSearch;
+import com.zhongshu.card.server.core.dao.BaseImpl;
+import com.zhongshu.card.server.core.dao.projectAbout.extend.ProjectOrgPaySettingInfoDaoExtend;
+import com.zhongshu.card.server.core.domain.paySetting.ProjectOrgPaySettingInfo;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+/**
+ * @Author TRX
+ * @CreateDate: 2023/4/12
+ * @Version: 1.0
+ */
+public class ProjectOrgPaySettingInfoDaoImpl extends BaseImpl implements ProjectOrgPaySettingInfoDaoExtend {
+
+    @Autowired
+    private DBHelper dbHelper;
+
+    @Override
+    public Page<ProjectOrgPaySettingInfo> page(Pageable pageable, ProjectPaySettingInfoSearch param) {
+        Criteria criteria = buildCriteriaNotOid(param);
+
+        if (ObjectUtils.isNotEmpty(param.getProjectOid())) {
+            criteria.and("projectOid").is(param.getProjectOid());
+        }
+
+        if (StringUtils.isNotEmpty(param.getBelongOig())) {
+            criteria.and("belongOig").is(param.getBelongOig());
+        }
+
+        if (param.getChannelType() != null) {
+            criteria.and("channelType").is(param.getChannelType());
+        }
+
+        if (param.getPaymentChannelType() != null) {
+            criteria.and("paymentChannelType").is(param.getPaymentChannelType());
+        }
+
+        if (param.getState() != null) {
+            criteria.and("state").is(param.getState());
+        }
+
+        if (param.getIsDefault() != null) {
+            criteria.and("isDefault").is(param.getIsDefault());
+        }
+
+        // 模糊搜索
+        List<Criteria> criterias = new ArrayList<>();
+        if (StringUtils.isNotEmpty(param.getName())) {
+            Pattern pattern = Pattern.compile("^.*" + param.getName() + ".*$");
+            criterias.add(Criteria.where("name").is(pattern));
+        }
+        if (StringUtils.isNotEmpty(param.getBankAccountNumber())) {
+            Pattern pattern = Pattern.compile("^.*" + param.getBankAccountNumber() + ".*$");
+            criterias.add(Criteria.where("bankAccountNumber").is(pattern));
+        }
+        if (StringUtils.isNotEmpty(param.getBankName())) {
+            Pattern pattern = Pattern.compile("^.*" + param.getBankName() + ".*$");
+            criterias.add(Criteria.where("bankName").is(pattern));
+        }
+        if (StringUtils.isNotEmpty(param.getBankSubName())) {
+            Pattern pattern = Pattern.compile("^.*" + param.getBankSubName() + ".*$");
+            criterias.add(Criteria.where("bankSubName").is(pattern));
+        }
+        if (!CollectionUtils.isEmpty(criterias)) {
+            criteria.andOperator(criterias.toArray(new Criteria[]{}));
+        }
+        Sort sort = buildSort(param);
+        Query query = Query.query(criteria);
+        query.with(sort);
+        return dbHelper.pages(query, pageable, ProjectOrgPaySettingInfo.class);
+    }
+
+}

+ 1 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/paySetting/PayShareList.java

@@ -13,7 +13,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
 import java.math.BigDecimal;
 
 /**
- * 分账规则
+ * 分账规则 灵活规则
  *
  * @author TRX
  * @date 2024/9/25

+ 80 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/paySetting/ProjectMainPaySetting.java

@@ -0,0 +1,80 @@
+package com.zhongshu.card.server.core.domain.paySetting;
+
+import com.github.microservice.types.payment.PaymentChannelType;
+import com.github.microservice.types.payment.PaymentType;
+import com.zhongshu.card.client.type.paySetting.RegularType;
+import com.zhongshu.card.client.type.paySetting.SettlementRulesType;
+import com.zhongshu.card.client.type.paySetting.WithdrawType;
+import com.zhongshu.card.server.core.domain.base.SuperMain;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.data.mongodb.core.mapping.DBRef;
+import org.springframework.data.mongodb.core.mapping.Document;
+
+import java.math.BigDecimal;
+
+/**
+ * 项目主支付配置
+ *
+ * @author TRX
+ * @date 2024/11/4
+ */
+@Data
+@Builder
+@Document
+@AllArgsConstructor
+@NoArgsConstructor
+public class ProjectMainPaySetting extends SuperMain {
+
+    @Schema(description = "所属主账户信息")
+    @DBRef(lazy = true)
+    private ProjectOrgPaySettingInfo paySettingInfo;
+
+    @Schema(description = "所属机构oid")
+    private String belongOig;
+
+    @Schema(description = "所属机构名称")
+    private String belongOrgName;
+
+    @Schema(description = "项目的支付渠道设置:微信支付、银联支付")
+    private PaymentType channelType;
+
+    @Schema(description = "支付产品")
+    private PaymentChannelType paymentChannelType;
+
+    //----------------------- 结算规则 start -----------------
+
+    @Schema(description = "结算规则")
+    private SettlementRulesType settlementRulesType;
+
+    //---------------D+N结算 设置
+    @Schema(description = "天数,>= 1")
+    private Integer days;
+
+    //---------------定期结算 设置
+
+    @Schema(description = "定期类型")
+    private RegularType regularType;
+
+    @Schema(description = "当前的时间,如:12:30")
+    private String timeStr;
+
+    //----------------------------提现规则 start --------------
+
+    @Schema(description = "提现规则类型")
+    private WithdrawType withdrawType;
+
+    //---------------------------分账规则配置 start ------------
+    @Schema(description = "最小分账金额, 单位分")
+    private Long minSharing = 0L;
+
+    @Schema(description = "全局项目分账比例,0-100")
+    private BigDecimal projectScale = BigDecimal.ZERO;
+
+    @Schema(description = "全局机构分账比例,0-100")
+    private BigDecimal orgScale = BigDecimal.ZERO;
+
+}

+ 24 - 11
FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/paySetting/ProjectPaySettingInfo.java → FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/paySetting/ProjectOrgPaySettingInfo.java

@@ -4,17 +4,15 @@ import com.github.microservice.types.payment.PaymentChannelType;
 import com.github.microservice.types.payment.PaymentType;
 import com.zhongshu.card.client.type.DataState;
 import com.zhongshu.card.server.core.domain.base.SuperMain;
-import com.zhongshu.card.server.core.domain.org.Organization;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
 import lombok.NoArgsConstructor;
-import org.springframework.data.mongodb.core.mapping.DBRef;
 import org.springframework.data.mongodb.core.mapping.Document;
 
 /**
- * 项目的支付设置 主设置
+ * 项目里 机构的的支付设置
  *
  * @author TRX
  * @date 2024/7/26
@@ -24,22 +22,20 @@ import org.springframework.data.mongodb.core.mapping.Document;
 @Document
 @AllArgsConstructor
 @NoArgsConstructor
-public class ProjectPaySettingInfo extends SuperMain {
+public class ProjectOrgPaySettingInfo extends SuperMain {
 
+    // 机构信息
     @Schema(description = "项目名称")
     private String projectName;
 
     @Schema(description = "项目编码")
     private String projectCode;
 
-    @Schema(description = "关联的支付产品数据")
-    @DBRef(lazy = true)
-    private ProjectPaySetting projectPaySetting;
+    @Schema(description = "所属机构oid")
+    private String belongOig;
 
-    //----------------------------------业务数据 -------------------
-
-    @Schema(description = "名称")
-    private String name;
+    @Schema(description = "所属机构名称")
+    private String belongOrgName;
 
     @Schema(description = "项目的支付渠道设置:微信支付、银联支付")
     private PaymentType channelType;
@@ -47,6 +43,23 @@ public class ProjectPaySettingInfo extends SuperMain {
     @Schema(description = "支付产品")
     private PaymentChannelType paymentChannelType;
 
+    //----------------------------------业务数据 -------------------
+
+    @Schema(description = "账户/名称")
+    private String name;
+
+    @Schema(description = "商户ID")
+    private String mchId;
+
+    @Schema(description = "银行账号")
+    private String bankAccountNumber;
+
+    @Schema(description = "开户行")
+    private String bankName;
+
+    @Schema(description = "开户支行")
+    private String bankSubName;
+
     @Schema(description = "支付渠道的参数配置")
     private Object payConfig;
 

+ 27 - 24
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/org/OrganizationServiceImpl.java

@@ -13,9 +13,9 @@ import com.github.microservice.auth.client.type.LoginType;
 import com.github.microservice.auth.security.helper.AuthHelper;
 import com.github.microservice.auth.security.type.AuthType;
 import com.github.microservice.components.data.base.util.PageEntityUtil;
-import com.zhongshu.card.client.model.org.*;
 import com.github.microservice.net.ResultContent;
 import com.github.microservice.net.ResultMessage;
+import com.zhongshu.card.client.model.org.*;
 import com.zhongshu.card.client.model.project.ProjectSaveParam;
 import com.zhongshu.card.client.service.org.OrganizationService;
 import com.zhongshu.card.client.type.*;
@@ -24,16 +24,19 @@ import com.zhongshu.card.server.core.dao.org.*;
 import com.zhongshu.card.server.core.dataConfig.CardSystemDefault;
 import com.zhongshu.card.server.core.domain.org.*;
 import com.zhongshu.card.server.core.service.base.SuperService;
+import com.zhongshu.card.server.core.service.devices.ProjectSyncIotCenterService;
 import com.zhongshu.card.server.core.service.orgManager.OrganizationManagerServiceImpl;
 import com.zhongshu.card.server.core.service.orgManager.ProjectBindOrgServiceImpl;
 import com.zhongshu.card.server.core.service.projectAbout.ProjectCommonConfigService;
 import com.zhongshu.card.server.core.service.projectAbout.ProjectIotInfoService;
 import com.zhongshu.card.server.core.service.projectAbout.ProjectWeChatInfoService;
-import com.zhongshu.card.server.core.service.devices.ProjectSyncIotCenterService;
 import com.zhongshu.card.server.core.service.user.DepartmentServiceImpl;
 import com.zhongshu.card.server.core.service.user.RoleServiceImpl;
 import com.zhongshu.card.server.core.service.user.UserAccountServiceImpl;
-import com.zhongshu.card.server.core.util.*;
+import com.zhongshu.card.server.core.util.BeanUtils;
+import com.zhongshu.card.server.core.util.NextNoUtil;
+import com.zhongshu.card.server.core.util.ValidateResult;
+import com.zhongshu.card.server.core.util.ValidateUtils;
 import com.zhongshu.opengateway.client.service.SignService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
@@ -62,70 +65,70 @@ import java.util.stream.Collectors;
 public class OrganizationServiceImpl extends SuperService implements OrganizationService {
 
     @Autowired
-    OrganizationDao organizationDao;
+    private OrganizationDao organizationDao;
 
     @Autowired
-    com.github.microservice.auth.client.service.OrganizationService organizationService;
+    private com.github.microservice.auth.client.service.OrganizationService organizationService;
 
     @Autowired
-    OrganizationUserService organizationUserService;
+    private OrganizationUserService organizationUserService;
 
     @Autowired
-    RoleService roleService;
+    private RoleService roleService;
 
     @Autowired
-    UserService userService;
+    private UserService userService;
 
     @Autowired
-    UserCountDao userCountDao;
+    private UserCountDao userCountDao;
 
     @Autowired
-    UserAccountServiceImpl userAccountService;
+    private UserAccountServiceImpl userAccountService;
 
     @Autowired
     private OrganizationUserDao organizationUserDao;
 
     @Autowired
-    RoleDao roleDao;
+    private RoleDao roleDao;
 
     @Autowired
-    DepartmentServiceImpl departmentService;
+    private DepartmentServiceImpl departmentService;
 
     @Autowired
-    AuthHelper authHelper;
+    private AuthHelper authHelper;
 
     @Autowired
-    RegionDao regionDao;
+    private RegionDao regionDao;
 
     @Autowired
-    OrganizationRelationDao organizationRelationDao;
+    private OrganizationRelationDao organizationRelationDao;
 
     @Autowired
-    ProjectSyncIotCenterService projectSyncIotCenterService;
+    private ProjectSyncIotCenterService projectSyncIotCenterService;
 
     @Autowired
-    OrganizationUserServiceImpl organizationUserServiceImpl;
+    private OrganizationUserServiceImpl organizationUserServiceImpl;
 
     @Autowired
-    RoleServiceImpl roleServiceImpl;
+    private RoleServiceImpl roleServiceImpl;
 
     @Autowired
-    ProjectIotInfoService projectIotInfoService;
+    private ProjectIotInfoService projectIotInfoService;
 
     @Autowired
-    ProjectWeChatInfoService projectWeChatInfoService;
+    private ProjectWeChatInfoService projectWeChatInfoService;
 
     @Autowired
-    ProjectCommonConfigService projectCommonConfigService;
+    private ProjectCommonConfigService projectCommonConfigService;
 
     @Autowired
-    OrganizationManagerServiceImpl organizationManagerService;
+    private OrganizationManagerServiceImpl organizationManagerService;
+
     @Autowired
     private ProjectBindOrgServiceImpl projectBindOrgServiceImpl;
 
     @Autowired
-    SignService signService;
-
+    private SignService signService;
 
     /**
      * 保存项目信息

+ 4 - 4
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/orgManager/OrganizationManagerServiceImpl.java

@@ -16,11 +16,12 @@ import com.zhongshu.card.server.core.domain.org.Organization;
 import com.zhongshu.card.server.core.domain.org.OrganizationRelation;
 import com.zhongshu.card.server.core.domain.org.Region;
 import com.zhongshu.card.server.core.service.base.SuperService;
-import com.zhongshu.card.server.core.service.org.*;
+import com.zhongshu.card.server.core.service.devices.ProjectSyncIotCenterService;
+import com.zhongshu.card.server.core.service.org.OrganizationServiceImpl;
+import com.zhongshu.card.server.core.service.org.OrganizationUserServiceImpl;
 import com.zhongshu.card.server.core.service.projectAbout.ProjectCommonConfigService;
 import com.zhongshu.card.server.core.service.projectAbout.ProjectIotInfoService;
 import com.zhongshu.card.server.core.service.projectAbout.ProjectWeChatInfoService;
-import com.zhongshu.card.server.core.service.devices.ProjectSyncIotCenterService;
 import com.zhongshu.card.server.core.service.user.DepartmentServiceImpl;
 import com.zhongshu.card.server.core.service.user.RoleServiceImpl;
 import com.zhongshu.card.server.core.service.user.UserAccountServiceImpl;
@@ -120,8 +121,7 @@ public class OrganizationManagerServiceImpl extends SuperService {
     @Transactional
     public ResultContent saveOrgInfo(OrgSaveParam param) {
         AuthType authType = param.getAuthType();
-        if (authType == AuthType.User || authType == AuthType.Platform
-                || authType == AuthType.Project) {
+        if (authType == AuthType.User || authType == AuthType.Platform || authType == AuthType.Project) {
             return ResultContent.buildFail("authType 类型错误");
         }
         String name = param.getName();

+ 2 - 4
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/orgManager/ProjectBindOrgServiceImpl.java

@@ -16,7 +16,6 @@ import com.zhongshu.card.server.core.dao.org.OrganizationUserDao;
 import com.zhongshu.card.server.core.dao.projectAbout.PayShareListDao;
 import com.zhongshu.card.server.core.domain.org.Organization;
 import com.zhongshu.card.server.core.domain.org.OrganizationRelation;
-import com.zhongshu.card.server.core.domain.org.OrganizationUser;
 import com.zhongshu.card.server.core.domain.paySetting.PayShareList;
 import com.zhongshu.card.server.core.service.base.SuperService;
 import com.zhongshu.card.server.core.service.projectAbout.PayShareListService;
@@ -144,8 +143,7 @@ public class ProjectBindOrgServiceImpl extends SuperService {
 
                 OrganizationRelation orgRelation = null;
                 if (ObjectUtils.isNotEmpty(orgInfo)) {
-                    orgRelation = organizationRelationDao.findTopByMainOrganizationAndRelOrganizationAndRelationType(
-                            projectInfo, orgInfo, OrganizationRelationType.ProjectBindOrg);
+                    orgRelation = organizationRelationDao.findTopByMainOrganizationAndRelOrganizationAndRelationType(projectInfo, orgInfo, OrganizationRelationType.ProjectBindOrg);
                 }
                 if (ObjectUtils.isEmpty(orgRelation)) {
                     orgRelation = new OrganizationRelation();
@@ -256,7 +254,7 @@ public class ProjectBindOrgServiceImpl extends SuperService {
     }
 
     /**
-     * 统计项目绑定的 构数量
+     * 统计项目绑定的 构数量
      *
      * @param projectOid
      * @return

+ 63 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/paySetting/ProjectMainPaySettingService.java

@@ -0,0 +1,63 @@
+package com.zhongshu.card.server.core.service.paySetting;
+
+import com.github.microservice.net.ResultContent;
+import com.zhongshu.card.client.model.paySetting.paySetting.ProjectMainPaySettingParam;
+import com.zhongshu.card.server.core.dao.projectAbout.ProjectMainPaySettingDao;
+import com.zhongshu.card.server.core.dao.projectAbout.ProjectPaySettingInfoDao;
+import com.zhongshu.card.server.core.domain.paySetting.ProjectMainPaySetting;
+import com.zhongshu.card.server.core.domain.paySetting.ProjectOrgPaySettingInfo;
+import com.zhongshu.card.server.core.service.base.SuperService;
+import com.zhongshu.card.server.core.util.BeanUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 项目的配置
+ *
+ * @author TRX
+ * @date 2024/11/5
+ */
+@Slf4j
+@Service
+public class ProjectMainPaySettingService extends SuperService {
+
+    @Autowired
+    private ProjectMainPaySettingDao projectMainPaySettingDao;
+
+    @Autowired
+    private ProjectPaySettingInfoDao projectPaySettingInfoDao;
+
+    /**
+     * 保存项目配置
+     *
+     * @param param
+     * @return
+     */
+    public ResultContent saveMainPaySetting(ProjectMainPaySettingParam param) {
+        if (StringUtils.isEmpty(param.getProjectOid())) {
+            return ResultContent.buildFail("projectOid不能为空");
+        }
+        ProjectOrgPaySettingInfo orgPaySettingInfo = projectPaySettingInfoDao.findTopById(param.getPaySettingInfoId());
+        if (ObjectUtils.isEmpty(orgPaySettingInfo)) {
+            return ResultContent.buildFail("主账号数据不存在");
+        }
+
+        ProjectMainPaySetting mainPaySetting = projectMainPaySettingDao.findTopByProjectOid(param.getProjectOid());
+        if (ObjectUtils.isEmpty(mainPaySetting)) {
+            mainPaySetting = new ProjectMainPaySetting();
+        }
+        BeanUtils.copyProperties(param, mainPaySetting);
+        mainPaySetting.setPaySettingInfo(orgPaySettingInfo);
+        mainPaySetting.setBelongOig(orgPaySettingInfo.getBelongOig());
+        mainPaySetting.setBelongOrgName(orgPaySettingInfo.getBelongOrgName());
+        mainPaySetting.setChannelType(orgPaySettingInfo.getChannelType());
+        mainPaySetting.setPaymentChannelType(orgPaySettingInfo.getPaymentChannelType());
+
+        projectMainPaySettingDao.save(mainPaySetting);
+        return ResultContent.buildSuccess();
+    }
+
+}

+ 110 - 180
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/paySetting/ProjectPaySettingServiceImpl.java

@@ -1,5 +1,6 @@
 package com.zhongshu.card.server.core.service.paySetting;
 
+import com.github.microservice.components.data.base.util.PageEntityUtil;
 import com.github.microservice.net.ResultContent;
 import com.github.microservice.net.ResultMessage;
 import com.github.microservice.pay.client.model.AccountModel;
@@ -9,9 +10,13 @@ import com.github.microservice.pay.client.service.PayProductAccountService;
 import com.github.microservice.pay.client.type.PayProductChannelType;
 import com.github.microservice.types.payment.PayFieldType;
 import com.github.microservice.types.payment.PaymentType;
+import com.zhongshu.card.client.model.org.BelongOigParam;
 import com.zhongshu.card.client.model.paySetting.payConfig.LaKaLaCollectionConfig;
 import com.zhongshu.card.client.model.paySetting.payConfig.LaKaLaCollectionConfigParam;
 import com.zhongshu.card.client.model.paySetting.paySetting.*;
+import com.zhongshu.card.client.model.payment.PaymentTypeParam;
+import com.zhongshu.card.client.model.projectAbout.PayChannelConfigAllPayModel;
+import com.zhongshu.card.client.model.projectAbout.PayChannelConfigSearch;
 import com.zhongshu.card.client.type.DataState;
 import com.zhongshu.card.server.core.dao.org.OrganizationDao;
 import com.zhongshu.card.server.core.dao.projectAbout.PayChannelConfigDao;
@@ -19,8 +24,8 @@ import com.zhongshu.card.server.core.dao.projectAbout.ProjectPaySettingDao;
 import com.zhongshu.card.server.core.dao.projectAbout.ProjectPaySettingInfoDao;
 import com.zhongshu.card.server.core.domain.org.Organization;
 import com.zhongshu.card.server.core.domain.paySetting.PayChannelConfig;
+import com.zhongshu.card.server.core.domain.paySetting.ProjectOrgPaySettingInfo;
 import com.zhongshu.card.server.core.domain.paySetting.ProjectPaySetting;
-import com.zhongshu.card.server.core.domain.paySetting.ProjectPaySettingInfo;
 import com.zhongshu.card.server.core.service.base.SuperService;
 import com.zhongshu.card.server.core.util.AesUtils;
 import com.zhongshu.card.server.core.util.BeanUtils;
@@ -28,6 +33,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
 import org.springframework.data.mongodb.gridfs.GridFsTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
@@ -70,119 +77,29 @@ public class ProjectPaySettingServiceImpl extends SuperService {
     @Autowired
     private OrgPayAccountService orgPayAccountService;
 
-    /**
-     * 关联支付渠道
-     *
-     * @return
-     */
-    public ResultContent savePayChannel(ProjectPaySettingParam param) {
-        String projectOid = param.getProjectOid();
-        if (StringUtils.isEmpty(projectOid)) {
-            return ResultContent.buildFail("projectOid不能为空");
-        }
-        Organization project = organizationDao.findTopByOid(projectOid);
-        if (ObjectUtils.isEmpty(project)) {
-            return ResultContent.buildFail("项目不存在");
-        }
-        PayChannelConfig payChannelConfig = payChannelConfigDao.findTopById(param.getId());
-        if (ObjectUtils.isEmpty(payChannelConfig)) {
-            return ResultContent.buildFail("支付产品不存在");
-        }
-        PaymentType paymentType = payChannelConfig.getPaymentType();
-
-        ProjectPaySetting projectPaySetting = projectPaySettingDao.findTopByProjectOidAndChannelType(projectOid, paymentType);
-        if (ObjectUtils.isNotEmpty(projectPaySetting)) {
-            return ResultContent.buildFail(String.format("%s已存在", paymentType.name()));
-        }
-        projectPaySetting = new ProjectPaySetting();
-        initEntityNoCheckOid(projectPaySetting);
-        projectPaySetting.setProjectOid(projectOid);
-        projectPaySetting.setProjectInfo(project);
-        projectPaySetting.setProjectCode(project.getCode());
-        projectPaySetting.setProjectName(project.getName());
-        projectPaySetting.setChannelType(paymentType);
-        projectPaySetting.setPaymentChannelType(payChannelConfig.getPaymentChannelType());
-
-        projectPaySetting.setState(DataState.Disable);
-        projectPaySettingDao.save(projectPaySetting);
-        return ResultContent.buildSuccess();
-    }
+    //-----------------------------通用配置方法 start----------------------------
 
     /**
-     * 项目得到所有的支付渠道配置
+     * 机构配置分页查询
      *
-     * @param projectOid
+     * @param param
+     * @param pageable
      * @return
      */
-    public ResultContent<List<ProjectPaySettingModel>> getAllProjectPaySetting(String projectOid) {
-        List<ProjectPaySetting> list = projectPaySettingDao.findByProjectOid(projectOid);
-        List<ProjectPaySettingModel> models = new ArrayList<>(list.size());
-        if (ObjectUtils.isNotEmpty(list)) {
-            models = list.stream().map(this::toModel).collect(Collectors.toUnmodifiableList());
-        }
-        return ResultContent.buildSuccess(models);
-    }
-
-    public ResultContent deleteInfo(String id) {
-        ProjectPaySetting paySetting = projectPaySettingDao.findTopById(id);
-        if (ObjectUtils.isEmpty(paySetting)) {
-            return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, id));
-        }
-        // 判断是否可以删除
-        int count = projectPaySettingInfoDao.countByProjectOidAndChannelType(paySetting.getProjectOid(), paySetting.getChannelType());
-        if (count > 0) {
-            return ResultContent.buildFail(String.format("%s有账户信息,不能删除", paySetting.getChannelType().getRemark()));
-        }
-        projectPaySettingDao.delete(paySetting);
-        return ResultContent.buildSuccess();
-    }
-
-    public ResultContent changeState(String id, DataState state) {
-        ProjectPaySetting paySetting = projectPaySettingDao.findTopById(id);
-        if (ObjectUtils.isEmpty(paySetting)) {
-            return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, id));
-        }
-        //TODO  检查是否可以启用
-        if (state != null && state == DataState.Enable) {
-            List<ProjectPaySettingInfo> list = projectPaySettingInfoDao.findByProjectOidAndChannelType(paySetting.getProjectOid(), paySetting.getChannelType());
-            if (ObjectUtils.isEmpty(list)) {
-                return ResultContent.buildFail(String.format("没有账户信息,不能启用"));
-            }
-            boolean hasDefault = false;
-            for (ProjectPaySettingInfo entity : list) {
-                if (entity.getIsDefault() != null && entity.getIsDefault()) {
-                    hasDefault = true;
-                    if (entity.getPayConfig() == null) {
-                        return ResultContent.buildFail(String.format("默认账户参数信息未配置"));
-                    }
-                }
-            }
-            if (!hasDefault) {
-                return ResultContent.buildFail("没有默认账户信息,不能启用");
-            }
-        }
-        paySetting.setState(state);
-        projectPaySettingDao.save(paySetting);
-
-        upsertPayAccount(paySetting.getProjectOid(), paySetting.getChannelType());
-        return ResultContent.buildSuccess();
+    public ResultContent<Page<ProjectPaySettingInfoModel>> page(ProjectPaySettingInfoSearch param, Pageable pageable) {
+        Page<ProjectOrgPaySettingInfo> page = projectPaySettingInfoDao.page(pageable, param);
+        return ResultContent.buildSuccess(PageEntityUtil.concurrent2PageModel(page, this::toModel));
     }
 
-    //-----------------------------通用配置方法 start----------------------------
-
     /**
-     * 得到项目的支付产品的 账户配置
+     * 得到项目的支付产品的所有 账户配置
      *
-     * @param id
+     * @param param
      * @return
      */
-    public ResultContent<List<ProjectPaySettingInfoModel>> getProjectPaySettingInfo(String id) {
+    public ResultContent<List<ProjectPaySettingInfoModel>> getOrgPaySettingInfo(BelongOigParam param) {
         List<ProjectPaySettingInfoModel> models = new ArrayList<>();
-        ProjectPaySetting projectPaySetting = projectPaySettingDao.findTopById(id);
-        if (ObjectUtils.isEmpty(projectPaySetting)) {
-            return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, id));
-        }
-        List<ProjectPaySettingInfo> list = projectPaySettingInfoDao.findByProjectOidAndChannelType(projectPaySetting.getProjectOid(), projectPaySetting.getChannelType());
+        List<ProjectOrgPaySettingInfo> list = projectPaySettingInfoDao.findByBelongOigAndProjectOid(param.getBelongOig(), param.getProjectOid());
         if (ObjectUtils.isNotEmpty(list)) {
             models = list.parallelStream().map(this::toModel).collect(Collectors.toUnmodifiableList());
         }
@@ -196,12 +113,12 @@ public class ProjectPaySettingServiceImpl extends SuperService {
      * @return
      */
     public ResultContent deletePaySettingInfo(String id) {
-        ProjectPaySettingInfo entity = projectPaySettingInfoDao.findTopById(id);
+        ProjectOrgPaySettingInfo entity = projectPaySettingInfoDao.findTopById(id);
         if (ObjectUtils.isEmpty(entity)) {
             return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, id));
         }
         projectPaySettingInfoDao.delete(entity);
-        initChangeDefault(null, entity.getProjectOid(), entity.getChannelType());
+        initChangeDefault(null, entity.getBelongOig(), entity.getProjectOid(), entity.getChannelType());
         return ResultContent.buildSuccess();
     }
 
@@ -212,7 +129,7 @@ public class ProjectPaySettingServiceImpl extends SuperService {
      * @return
      */
     public ResultContent getPaySettingInfo(String id) {
-        ProjectPaySettingInfo entity = projectPaySettingInfoDao.findTopById(id);
+        ProjectOrgPaySettingInfo entity = projectPaySettingInfoDao.findTopById(id);
         if (ObjectUtils.isEmpty(entity)) {
             return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, id));
         }
@@ -228,13 +145,14 @@ public class ProjectPaySettingServiceImpl extends SuperService {
      * @return
      */
     public ResultContent saveWxPayConfig(WxPayConfigParam param) {
-        //TODO 检查微信支付参数等
-        ResultContent<ProjectPaySettingInfo> content = initProjectPayInfo(param);
+        // 机构初始支付产品对应的数据
+        ResultContent<ProjectOrgPaySettingInfo> content = initProjectPayInfo(param);
         if (content.isFailed()) {
             return ResultContent.buildFail(content.getMsg());
         }
-        ProjectPaySettingInfo settingInfo = content.getContent();
+        ProjectOrgPaySettingInfo settingInfo = content.getContent();
 
+        //TODO 检查微信支付参数等
         WxPayConfigModel configModel = null;
         if (settingInfo.getPayConfig() != null) {
             configModel = (WxPayConfigModel) settingInfo.getPayConfig();
@@ -256,8 +174,9 @@ public class ProjectPaySettingServiceImpl extends SuperService {
         }
         settingInfo.setPayConfig(configModel);
         projectPaySettingInfoDao.save(settingInfo);
+
         // 如果当前设置为默认,把其他的取消默认
-        initChangeDefault(settingInfo.getId(), settingInfo.getProjectOid(), settingInfo.getChannelType());
+        initChangeDefault(settingInfo.getId(), settingInfo.getBelongOig(), settingInfo.getProjectOid(), settingInfo.getChannelType());
         return ResultContent.buildSuccess();
     }
 
@@ -268,7 +187,7 @@ public class ProjectPaySettingServiceImpl extends SuperService {
      * @return
      */
     public ResultContent<WxPayConfigModel> getProjectWxConfig(String projectOid) {
-        ResultContent<ProjectPaySettingInfo> content = getProjectConfig(projectOid, PaymentType.WeChat);
+        ResultContent<ProjectOrgPaySettingInfo> content = getProjectConfig(projectOid, PaymentType.WeChat);
         if (content.isFailed()) {
             return ResultContent.buildFail(content.getMsg());
         }
@@ -285,11 +204,11 @@ public class ProjectPaySettingServiceImpl extends SuperService {
      * @return
      */
     public ResultContent saveLaKaLaConfig(LaKaLaCollectionConfigParam param) {
-        ResultContent<ProjectPaySettingInfo> content = initProjectPayInfo(param);
+        ResultContent<ProjectOrgPaySettingInfo> content = initProjectPayInfo(param);
         if (content.isFailed()) {
             return ResultContent.buildFail(content.getMsg());
         }
-        ProjectPaySettingInfo settingInfo = content.getContent();
+        ProjectOrgPaySettingInfo settingInfo = content.getContent();
 
         //TODO 检查支付参数等
         LaKaLaCollectionConfig laKaLaCollectionConfig = (LaKaLaCollectionConfig) settingInfo.getPayConfig();
@@ -310,53 +229,84 @@ public class ProjectPaySettingServiceImpl extends SuperService {
         settingInfo.setPayConfig(laKaLaCollectionConfig);
         projectPaySettingInfoDao.save(settingInfo);
         // 如果当前设置为默认,把其他的取消默认
-        initChangeDefault(settingInfo.getId(), settingInfo.getProjectOid(), settingInfo.getChannelType());
+        initChangeDefault(settingInfo.getId(), settingInfo.getBelongOig(), settingInfo.getProjectOid(), settingInfo.getChannelType());
         return ResultContent.buildSuccess();
     }
 
-    public ResultContent<ProjectPaySettingInfo> initProjectPayInfo(PayConfigParam param) {
+    /**
+     * @param param
+     * @return
+     */
+    public ResultContent<ProjectOrgPaySettingInfo> initProjectPayInfo(PayConfigParam param) {
+        // 所属项目
         Organization project = organizationDao.findTopByOid(param.getProjectOid());
         if (ObjectUtils.isEmpty(project)) {
             return ResultContent.buildFail("projectOid不存在");
         }
-        ProjectPaySettingInfo projectPaySettingInfo = null;
+        // 所属机构
+        Organization orgInfo = organizationDao.findTopByOid(param.getBelongOig());
+        if (ObjectUtils.isEmpty(orgInfo)) {
+            return ResultContent.buildFail(String.format("belongOig不存在"));
+        }
+
+        ProjectOrgPaySettingInfo temp = projectPaySettingInfoDao.findTopByBelongOigAndProjectOidAndChannelType(param.getBelongOig(), param.getProjectOid(), param.getChannelType());
+        ProjectOrgPaySettingInfo projectPaySettingInfo = null;
         if (StringUtils.isNotEmpty(param.getId())) {
+            // 编辑
             projectPaySettingInfo = projectPaySettingInfoDao.findTopById(param.getId());
             if (ObjectUtils.isEmpty(projectPaySettingInfo)) {
                 return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getId()));
             }
+            // 支付渠道是否已存在
+            if (ObjectUtils.isNotEmpty(temp) && temp.getId().equals(projectPaySettingInfo.getId())) {
+                return ResultContent.buildFail(String.format("支付渠道已存在:%s", param.getChannelType().getRemark()));
+            }
+
             initUpdateEntity(projectPaySettingInfo);
         } else {
-            if (StringUtils.isEmpty(param.getProjectPaySettingId())) {
-                return ResultContent.buildFail("projectPaySettingId不能为空");
+            // 新增
+            PayChannelConfig channelConfig = payChannelConfigDao.findTopByPaymentType(param.getChannelType());
+            if (ObjectUtils.isEmpty(channelConfig)) {
+                return ResultContent.buildFail(String.format("支付渠道产品不存在:%s", param.getChannelType().getRemark()));
             }
-            ProjectPaySetting paySetting = projectPaySettingDao.findTopById(param.getProjectPaySettingId());
-            if (ObjectUtils.isEmpty(paySetting)) {
-                return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getProjectPaySettingId()));
+            if (ObjectUtils.isNotEmpty(temp)) {
+                return ResultContent.buildFail(String.format("支付渠道已存在:%s", param.getChannelType().getRemark()));
             }
-            projectPaySettingInfo = new ProjectPaySettingInfo();
-            projectPaySettingInfo.setProjectPaySetting(paySetting);
-            projectPaySettingInfo.setChannelType(paySetting.getChannelType());
-            projectPaySettingInfo.setPaymentChannelType(paySetting.getPaymentChannelType());
-            projectPaySettingInfo.setState(DataState.Enable);
+
+            projectPaySettingInfo = new ProjectOrgPaySettingInfo();
+            projectPaySettingInfo.setChannelType(channelConfig.getPaymentType());
+            projectPaySettingInfo.setPaymentChannelType(channelConfig.getPaymentChannelType());
+
+            // 项目信息
             projectPaySettingInfo.setProjectOid(project.getOid());
-            projectPaySettingInfo.setProjectName(project.getName());
             projectPaySettingInfo.setProjectCode(project.getCode());
-            projectPaySettingInfo.setOid(project.getOid());
-            int total = projectPaySettingInfoDao.countByProjectOidAndChannelType(project.getOid(), paySetting.getChannelType());
+
+            // 机构信息
+            projectPaySettingInfo.setBelongOig(orgInfo.getOid());
+            projectPaySettingInfo.setOid(orgInfo.getOid());
+            int total = projectPaySettingInfoDao.countByBelongOigAndProjectOidAndChannelType(orgInfo.getOid(), project.getOid(), param.getChannelType());
             if (total <= 0) {
                 param.setIsDefault(Boolean.TRUE);
             }
         }
+        projectPaySettingInfo.setProjectName(project.getName());
+        projectPaySettingInfo.setBelongOrgName(orgInfo.getName());
+
         projectPaySettingInfo.setName(param.getName());
         projectPaySettingInfo.setIsDefault(param.getIsDefault());
+        projectPaySettingInfo.setMchId(param.getMchId());
+        projectPaySettingInfo.setBankAccountNumber(param.getBankAccountNumber());
+        projectPaySettingInfo.setBankName(param.getBankName());
+        projectPaySettingInfo.setBankSubName(param.getBankSubName());
+        projectPaySettingInfo.setState(param.getState());
+
         return ResultContent.buildSuccess(projectPaySettingInfo);
     }
 
-    public ResultContent initChangeDefault(String id, String projectOid, PaymentType paymentType) {
-        List<ProjectPaySettingInfo> list = projectPaySettingInfoDao.findByProjectOidAndChannelType(projectOid, paymentType);
+    public ResultContent initChangeDefault(String id, String belongOig, String projectOid, PaymentType paymentType) {
+        List<ProjectOrgPaySettingInfo> list = projectPaySettingInfoDao.findByBelongOigAndProjectOidAndChannelType(belongOig, projectOid, paymentType);
         if (ObjectUtils.isNotEmpty(list)) {
-            List<ProjectPaySettingInfo> _tempList = list.stream().filter(it -> it.getIsDefault() != null && it.getIsDefault()).collect(Collectors.toList());
+            List<ProjectOrgPaySettingInfo> _tempList = list.stream().filter(it -> it.getIsDefault() != null && it.getIsDefault()).collect(Collectors.toList());
             if (ObjectUtils.isNotEmpty(_tempList)) {
                 if (_tempList.size() > 1 && StringUtils.isNotEmpty(id)) {
                     // 其他的设置为  非默认
@@ -368,7 +318,7 @@ public class ProjectPaySettingServiceImpl extends SuperService {
                     });
                 }
             } else {
-                ProjectPaySettingInfo first = list.get(0);
+                ProjectOrgPaySettingInfo first = list.get(0);
                 first.setIsDefault(Boolean.TRUE);
                 projectPaySettingInfoDao.save(first);
             }
@@ -377,39 +327,31 @@ public class ProjectPaySettingServiceImpl extends SuperService {
         return ResultContent.buildSuccess();
     }
 
-    public ProjectPaySettingModel toModel(ProjectPaySetting entity) {
-        ProjectPaySettingModel model = null;
-        if (ObjectUtils.isNotEmpty(entity)) {
-            model = new ProjectPaySettingModel();
-            BeanUtils.copyProperties(entity, model);
-            // 关联的支付产品信息
-            model.setPayChannelConfigModel(projectChannelConfigService.getProjectPayChannelModel(entity.getChannelType()));
-            // 判断是否完成配置
-            ProjectPaySettingInfo settingInfo = projectPaySettingInfoDao.findTopByProjectOidAndChannelTypeAndIsDefault(entity.getProjectOid(), entity.getChannelType(), Boolean.TRUE);
-            if (ObjectUtils.isNotEmpty(settingInfo)) {
-                model.setIsConfig(Boolean.TRUE);
-            }
-        }
-        return model;
-    }
-
     /**
      * 得到字段
      *
-     * @param configId
+     * @param
      * @return
      */
-    public ResultContent<PayConfigFieldModel> getFieldByConfigId(String configId) {
-        ProjectPaySetting paySetting = projectPaySettingDao.findTopById(configId);
-        if (ObjectUtils.isEmpty(paySetting)) {
-            return ResultContent.buildFail("数据不存在");
+    public ResultContent<PayConfigFieldModel> getFieldByConfigId(PaymentTypeParam param) {
+        // 支付产品
+        PayChannelConfig payChannelConfig = payChannelConfigDao.findTopByPaymentType(param.getPaymentType());
+        if (ObjectUtils.isEmpty(payChannelConfig)) {
+            return ResultContent.buildFail("支付产品数据不存在");
         }
-        return getField(paySetting.getChannelType());
+        return getField(param.getPaymentType());
     }
 
+    /**
+     * 得到支付渠道 动态参数
+     *
+     * @param paymentType
+     * @return
+     */
     public ResultContent<PayConfigFieldModel> getField(PaymentType paymentType) {
         PayConfigFieldModel model = new PayConfigFieldModel();
         if (paymentType == PaymentType.WeChat) {
+            // 微信小程序支付
             model.setApiName("saveWxPayConfig");
             model.setFields(getWxConfig());
         }
@@ -432,13 +374,16 @@ public class ProjectPaySettingServiceImpl extends SuperService {
         return fields;
     }
 
-    public ProjectPaySettingInfoModel toModel(ProjectPaySettingInfo entity) {
+    public ProjectPaySettingInfoModel toModel(ProjectOrgPaySettingInfo entity) {
         ProjectPaySettingInfoModel model = null;
         if (ObjectUtils.isNotEmpty(entity)) {
             model = new ProjectPaySettingInfoModel();
             BeanUtils.copyProperties(entity, model);
-            if (entity.getProjectPaySetting() != null) {
-                model.setProjectPaySettingId(entity.getProjectPaySetting().getId());
+
+            // 支付产品logo
+            PayChannelConfig payChannelConfig = payChannelConfigDao.findTopByPaymentType(entity.getChannelType());
+            if (ObjectUtils.isNotEmpty(payChannelConfig)) {
+                model.setPayLogo(payChannelConfig.getLogo());
             }
         }
         return model;
@@ -451,7 +396,7 @@ public class ProjectPaySettingServiceImpl extends SuperService {
      * @param paymentType
      * @return
      */
-    public ResultContent<ProjectPaySettingInfo> getProjectConfig(String projectOid, PaymentType paymentType) {
+    public ResultContent<ProjectOrgPaySettingInfo> getProjectConfig(String projectOid, PaymentType paymentType) {
         if (paymentType == null) {
             return ResultContent.buildFail("PaymentType未指定");
         }
@@ -465,17 +410,8 @@ public class ProjectPaySettingServiceImpl extends SuperService {
             return ResultContent.buildFail(String.format("平台%s未启用", payName));
         }
 
-        // 项目的
-        ProjectPaySetting paySetting = projectPaySettingDao.findTopByProjectOidAndChannelType(projectOid, paymentType);
-        if (ObjectUtils.isEmpty(paySetting)) {
-            return ResultContent.buildFail(String.format("项目未配置%s", payName));
-        }
-        if (paySetting.getState() == null || paySetting.getState() != DataState.Enable) {
-            return ResultContent.buildFail(String.format("项目 %s未启动", payName));
-        }
-
         // 参数的配置 (默认状态的)
-        ProjectPaySettingInfo paySettingInfo = projectPaySettingInfoDao.findTopByProjectOidAndChannelTypeAndIsDefault(projectOid, paymentType, Boolean.TRUE);
+        ProjectOrgPaySettingInfo paySettingInfo = projectPaySettingInfoDao.findTopByProjectOidAndChannelTypeAndIsDefault(projectOid, paymentType, Boolean.TRUE);
         if (ObjectUtils.isEmpty(paySettingInfo)) {
             return ResultContent.buildFail(String.format("%s没有默认的支付配置", payName));
         }
@@ -483,8 +419,7 @@ public class ProjectPaySettingServiceImpl extends SuperService {
     }
 
     public ResultContent<PaymentType> getProjectPayment(String projectOid) {
-        ProjectPaySetting paySetting = projectPaySettingDao.findTopByProjectOidAndState(
-                projectOid, DataState.Enable);
+        ProjectPaySetting paySetting = projectPaySettingDao.findTopByProjectOidAndState(projectOid, DataState.Enable);
         if (ObjectUtils.isEmpty(paySetting)) {
             return ResultContent.buildFail(String.format("项目未设置可用的支付产品"));
         }
@@ -503,8 +438,7 @@ public class ProjectPaySettingServiceImpl extends SuperService {
      * @return
      */
     public ResultContent upsertPayAccount(String projectOid, PaymentType paymentType) {
-        ProjectPaySettingInfo entity = projectPaySettingInfoDao.findTopByProjectOidAndChannelTypeAndIsDefault(
-                projectOid, paymentType, Boolean.TRUE);
+        ProjectOrgPaySettingInfo entity = projectPaySettingInfoDao.findTopByProjectOidAndChannelTypeAndIsDefault(projectOid, paymentType, Boolean.TRUE);
 
         String payAccountName = orgPayAccountService.buildPayAccountName(projectOid, paymentType);
         AccountModel accountModel = new AccountModel();
@@ -523,19 +457,15 @@ public class ProjectPaySettingServiceImpl extends SuperService {
                 appConf.setNotifyUrl(model.getNotifyUrl());
                 accountModel.setConf(appConf);
             }
-            ProjectPaySetting paySetting = projectPaySettingDao.findTopByProjectOidAndChannelType(projectOid, paymentType);
-            if (ObjectUtils.isNotEmpty(paySetting)
-                    && paySetting.getState() != null && paySetting.getState() == DataState.Enable) {
-                ProjectPaySetting projectPaySetting = entity.getProjectPaySetting();
-                if (ObjectUtils.isNotEmpty(projectPaySetting) && projectPaySetting.getState() != null && projectPaySetting.getState() == DataState.Enable) {
-                    // 可用
+            // 支付产品
+            PayChannelConfig channelConfig = payChannelConfigDao.findTopByPaymentType(paymentType);
+            if (ObjectUtils.isNotEmpty(channelConfig)) {
+                if (channelConfig.getState() == null || channelConfig.getState() != DataState.Enable) {
                     disable = Boolean.FALSE;
                 } else {
-                    // 不可用
                     disable = Boolean.TRUE;
                 }
             } else {
-                // 不可用
                 disable = Boolean.TRUE;
             }
         } else {