TRX преди 1 година
родител
ревизия
3543347a6b

+ 6 - 8
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/payConfig/FrictionlessUnionConfigParam.java

@@ -19,14 +19,6 @@ import lombok.NoArgsConstructor;
 @NoArgsConstructor
 public class FrictionlessUnionConfigParam extends PayConfigParam {
 
-    //----------------------------业务信息 start-----------------
-
-    @Schema(description = "无感支付签约状态通知地址")
-    private String notifyUrl = "";
-
-    @Schema(description = "支付结果通知地址")
-    private String payNotifyUrl = "";
-
     @Schema(description = "无感支付 秘钥 测试环境通知加密密钥")
     private String notifySecret;
 
@@ -51,6 +43,12 @@ public class FrictionlessUnionConfigParam extends PayConfigParam {
     @Schema(description = "商户订单号固定开头")
     private String orderStart = "";
 
+    @Schema(description = "无感支付签约状态通知地址")
+    private String notifyUrl = "";
+
+    @Schema(description = "支付结果通知地址")
+    private String payNotifyUrl = "";
+
     @Schema(description = "订单交易过期时间")
     private Long expireTime = 30 * 60 * 1000L;
 

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

@@ -30,6 +30,9 @@ public class ProjectMainPaySettingModel {
     @Schema(description = "选择的机构主支付配置数据id")
     private String paySettingInfoName;
 
+    @Schema(description = "选中的机构支付配置")
+    private ProjectPaySettingInfoModel settingInfoModel;
+
     @Schema(description = "所属机构oid")
     private String belongOig;
 

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

@@ -19,6 +19,12 @@ import org.apache.commons.lang3.ObjectUtils;
 @NoArgsConstructor
 public class ProjectPaySettingInfoModel extends SuperModel {
 
+    @Schema(description = "所属机构oid")
+    private String belongOig;
+
+    @Schema(description = "所属机构名称")
+    private String belongOrgName;
+
     //----------------------------------业务数据 -------------------
 
     @Schema(description = "支付产品的logo")

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

@@ -96,16 +96,14 @@ public class ProjectPaySettingController {
     @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "项目下所有主账户数据列表", description = "项目下所有主账户数据列表")
     @RequestMapping(value = {"getMainList"}, method = {RequestMethod.POST})
-    public ResultContent<List<ProjectPaySettingInfoModel>> getMainList(@Parameter(required = false) ProjectPaySettingInfoSearch param) {
+    public ResultContent<Page<ProjectPaySettingInfoModel>> getMainList(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable,
+            @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());
+        if (param.getChannelType() == null) {
+            return ResultContent.buildFail("channelType不能为空");
         }
-        List<ProjectPaySettingInfoModel> list = pageContent.getContent().getContent();
-        return ResultContent.buildSuccess(list);
+        return projectPaySettingService.page(param, pageable);
     }
 
     @ResourceAuth(value = "user", type = AuthType.User)
@@ -156,8 +154,8 @@ public class ProjectPaySettingController {
 
     @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "保存银联云闪付支付配置", description = "保存银联云闪付支付配置")
-    @RequestMapping(value = "saveUnionPayConfig", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, method = RequestMethod.POST)
-    public ResultContent saveUnionPayConfig(FrictionlessUnionConfigParam param) {
+    @RequestMapping(value = "saveUnionPayConfig", method = RequestMethod.POST)
+    public ResultContent saveUnionPayConfig(@RequestBody @Valid FrictionlessUnionConfigParam param) {
         return projectPaySettingService.saveUnionPayConfig(param);
     }
 

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

@@ -49,6 +49,9 @@ public class ProjectMainPaySettingService extends SuperService {
     @Autowired
     private ScheduleTaskConfigService scheduleTaskConfigService;
 
+    @Autowired
+    private ProjectPaySettingServiceImpl projectPaySettingService;
+
     /**
      * 保存项目配置
      *
@@ -173,7 +176,7 @@ public class ProjectMainPaySettingService extends SuperService {
     }
 
     public ProjectMainPaySettingModel toMainModel(ProjectMainPaySetting entity) {
-        ProjectMainPaySettingModel model = null;
+        ProjectMainPaySettingModel model = new ProjectMainPaySettingModel();
         if (ObjectUtils.isNotEmpty(entity)) {
             model = new ProjectMainPaySettingModel();
             BeanUtils.copyProperties(entity, model);
@@ -183,6 +186,7 @@ public class ProjectMainPaySettingService extends SuperService {
                 model.setPaySettingInfoId(paySettingInfo.getId());
                 model.setPaySettingInfoName(paySettingInfo.getName());
             }
+            model.setSettingInfoModel(projectPaySettingService.toModel(entity.getPaySettingInfo()));
         }
         return model;
     }

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

@@ -479,6 +479,7 @@ public class ProjectPaySettingServiceImpl extends SuperService {
             // 银联云闪付
             model.setApiName("saveUnionPayConfig");
             model.setFields(getUnionPay());
+            model.setType("json");
         }
         return ResultContent.buildSuccess(model);
     }
@@ -530,6 +531,10 @@ public class ProjectPaySettingServiceImpl extends SuperService {
             if (ObjectUtils.isNotEmpty(payChannelConfig)) {
                 model.setPayLogo(payChannelConfig.getLogo());
             }
+            Organization organization = organizationDao.findTopByOid(entity.getBelongOig());
+            if (ObjectUtils.isNotEmpty(organization)) {
+                model.setBelongOrgName(organization.getName());
+            }
         }
         return model;
     }
@@ -583,7 +588,16 @@ public class ProjectPaySettingServiceImpl extends SuperService {
      * @return
      */
     public ResultContent upsertPayAccount(String projectOid, PaymentType paymentType) {
-        ProjectOrgPaySettingInfo entity = projectPaySettingInfoDao.findTopByProjectOidAndChannelTypeAndIsDefault(projectOid, paymentType, Boolean.TRUE);
+        ProjectMainPaySetting projectMainPaySetting = projectMainPaySettingDao.findTopByProjectOidAndChannelType(projectOid, paymentType);
+        if (ObjectUtils.isEmpty(projectMainPaySetting)) {
+            log.error("upsertPayAccount 项目未配置");
+            return ResultContent.buildFail("项目未配置");
+        }
+        ProjectOrgPaySettingInfo entity = projectMainPaySetting.getPaySettingInfo();
+        if (ObjectUtils.isEmpty(entity)) {
+            log.error("upsertPayAccount 关联机构支付配置为空");
+            return ResultContent.buildFail("关联机构支付配置为空");
+        }
 
         String payAccountName = orgPayAccountService.buildPayAccountName(projectOid, paymentType);
 
@@ -606,7 +620,18 @@ public class ProjectPaySettingServiceImpl extends SuperService {
                 accountModel.setConf(appConf);
             } else if (paymentType == PaymentType.UnionFrictionlessPay) {
                 // 银联无感支付
+                accountModel.setProductChannelType(PayProductChannelType.ChinaumsSenseless);
 
+                WxPayConfigModel model = (WxPayConfigModel) entity.getPayConfig();
+
+                WeChatMiniAppConf appConf = new WeChatMiniAppConf();
+                appConf.setAppId(model.getAppId());
+                appConf.setMchId(model.getMchId());
+                appConf.setMchSerialNo(model.getMchSerialNo());
+                appConf.setPriKeyPath(model.getPrivateKeyStr());
+                appConf.setApiV3KeyPath(model.getApiV3Key());
+                appConf.setNotifyUrl(model.getNotifyUrl());
+                accountModel.setConf(appConf);
             }
 
             // 查看平台支付产品状态
@@ -620,6 +645,14 @@ public class ProjectPaySettingServiceImpl extends SuperService {
             } else {
                 disable = Boolean.TRUE;
             }
+
+            if (!disable) {
+                // 项目配置 项目上没启用
+                ProjectPaySetting projectPaySetting = projectPaySettingDao.findTopByProjectOidAndChannelType(projectOid, paymentType);
+                if (projectPaySetting.getState() == null || projectPaySetting.getState() == DataState.Disable) {
+                    disable = Boolean.TRUE;
+                }
+            }
         } else {
             // 不可用
             disable = Boolean.TRUE;