TRX hai 1 ano
pai
achega
4692186e3c
Modificáronse 13 ficheiros con 214 adicións e 19 borrados
  1. 0 3
      FullCardClient/src/main/java/com/zhongshu/card/client/model/orgModel/ProjectBindOrgsParam.java
  2. 1 1
      FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/payConfig/LaKaLaCollectionConfig.java
  3. 2 2
      FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/UnionFrictionlessSettingModel.java
  4. 2 2
      FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/UnionFrictionlessSettingParam.java
  5. 11 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/config/PayServerConfig.java
  6. 7 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/orgManager/ProjectBindOrgController.java
  7. 1 1
      FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/paySetting/UnionFrictionlessSettingController.java
  8. 19 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/projectAbout/OrgPayAccountDao.java
  9. 14 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/paySetting/OrgPayAccount.java
  10. 2 2
      FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/paySetting/UnionFrictionlessSetting.java
  11. 14 3
      FullCardServer/src/main/java/com/zhongshu/card/server/core/service/orgManager/ProjectBindOrgServiceImpl.java
  12. 98 0
      FullCardServer/src/main/java/com/zhongshu/card/server/core/service/paySetting/OrgPayAccountService.java
  13. 43 5
      FullCardServer/src/main/java/com/zhongshu/card/server/core/service/paySetting/UnionFrictionlessSettingService.java

+ 0 - 3
FullCardClient/src/main/java/com/zhongshu/card/client/model/orgModel/ProjectBindOrgsParam.java

@@ -1,9 +1,7 @@
 package com.zhongshu.card.client.model.orgModel;
 
-import com.zhongshu.card.client.type.DataState;
 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;
@@ -24,7 +22,6 @@ public class ProjectBindOrgsParam {
     private String projectOid;
 
     @Schema(description = "机构oid")
-    @NotEmpty
     private List<String> orgOids;
 
 }

+ 1 - 1
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/payConfig/LaKaLaCollectionConf.java → FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/payConfig/LaKaLaCollectionConfig.java

@@ -13,7 +13,7 @@ import lombok.NoArgsConstructor;
 @Data
 @AllArgsConstructor
 @NoArgsConstructor
-public class LaKaLaCollectionConf {
+public class LaKaLaCollectionConfig {
 
     // 接入方唯一编号(appid):OP00000003
     private String appId;

+ 2 - 2
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/UnionFrictionlessSettingModel.java

@@ -4,7 +4,7 @@ import com.github.microservice.types.payment.PaymentType;
 import com.zhongshu.card.client.model.base.SuperModel;
 import com.zhongshu.card.client.model.paySetting.payConfig.FrictionlessUnionConfig;
 import com.zhongshu.card.client.model.paySetting.payConfig.FrictionlessWeChatConfig;
-import com.zhongshu.card.client.model.paySetting.payConfig.LaKaLaCollectionConf;
+import com.zhongshu.card.client.model.paySetting.payConfig.LaKaLaCollectionConfig;
 import com.zhongshu.card.client.model.paySetting.payConfig.PaySharingConfig;
 import io.swagger.v3.oas.annotations.media.Schema;
 import jakarta.validation.constraints.NotNull;
@@ -47,7 +47,7 @@ public class UnionFrictionlessSettingModel extends SuperModel {
     private FrictionlessWeChatConfig frictionlessWeChatConfig;
 
     @Schema(description = "拉卡拉无感支付--参数配置")
-    private LaKaLaCollectionConf laKaLaCollectionConf;
+    private LaKaLaCollectionConfig laKaLaCollectionConf;
 
     @Schema(description = "分账规则")
     private PaySharingConfig paySharingConfig;

+ 2 - 2
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/UnionFrictionlessSettingParam.java

@@ -4,7 +4,7 @@ import com.github.microservice.types.payment.PaymentType;
 import com.zhongshu.card.client.model.base.ProjectOidParam;
 import com.zhongshu.card.client.model.paySetting.payConfig.FrictionlessUnionConfig;
 import com.zhongshu.card.client.model.paySetting.payConfig.FrictionlessWeChatConfig;
-import com.zhongshu.card.client.model.paySetting.payConfig.LaKaLaCollectionConf;
+import com.zhongshu.card.client.model.paySetting.payConfig.LaKaLaCollectionConfig;
 import com.zhongshu.card.client.model.paySetting.payConfig.PaySharingConfig;
 import io.swagger.v3.oas.annotations.media.Schema;
 import jakarta.validation.constraints.NotNull;
@@ -34,7 +34,7 @@ public class UnionFrictionlessSettingParam extends ProjectOidParam {
     private FrictionlessWeChatConfig frictionlessWeChatConfig;
 
     @Schema(description = "拉卡拉无感支付--参数配置")
-    private LaKaLaCollectionConf laKaLaCollectionConf;
+    private LaKaLaCollectionConfig laKaLaCollectionConf;
 
     @Schema(description = "分账规则")
     private PaySharingConfig paySharingConfig;

+ 11 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/config/PayServerConfig.java

@@ -0,0 +1,11 @@
+package com.zhongshu.card.server.core.config;
+
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@EnableFeignClients("com.github.microservice.pay.client")
+@ComponentScan({"com.github.microservice.pay.client"})
+public class PayServerConfig {
+}

+ 7 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/orgManager/ProjectBindOrgController.java

@@ -81,4 +81,11 @@ public class ProjectBindOrgController {
         return this.projectBindOrgService.deleteRelation(param.getId());
     }
 
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @Operation(summary = "得到项目机构信息", description = "得到项目机构信息")
+    @RequestMapping(value = "getDetailRelation", method = {RequestMethod.POST})
+    public ResultContent getDetailRelation(@RequestBody IDParam param) {
+        return this.projectBindOrgService.getDetailRelation(param.getId());
+    }
+
 }

+ 1 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/paySetting/UnionFrictionlessSettingController.java

@@ -53,7 +53,7 @@ public class UnionFrictionlessSettingController {
     }
 
     @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "删除数据", description = "删除数据")
+    @Operation(summary = "删除无感支付数据", description = "删除无感支付数据")
     @RequestMapping(value = "deleteInfo", method = {RequestMethod.POST})
     public ResultContent deleteInfo(
             @RequestBody @Valid IDParam param) {

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

@@ -0,0 +1,19 @@
+package com.zhongshu.card.server.core.dao.projectAbout;
+
+import com.github.microservice.components.data.mongo.mongo.dao.MongoDao;
+import com.github.microservice.types.payment.PaymentChannelType;
+import com.github.microservice.types.payment.PaymentType;
+import com.zhongshu.card.server.core.dao.projectAbout.extend.PayChannelConfigDaoExtend;
+import com.zhongshu.card.server.core.domain.paySetting.OrgPayAccount;
+import com.zhongshu.card.server.core.domain.paySetting.PayChannelConfig;
+
+/**
+ * 机构管理的支付账号
+ */
+public interface OrgPayAccountDao extends MongoDao<OrgPayAccount> {
+
+    OrgPayAccount findTopById(String id);
+
+    OrgPayAccount findTopByOidAndPaymentType(String oid, PaymentType paymentType);
+
+}

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

@@ -1,5 +1,7 @@
 package com.zhongshu.card.server.core.domain.paySetting;
 
+import com.github.microservice.pay.client.type.PayProductChannelType;
+import com.github.microservice.types.payment.PaymentType;
 import com.zhongshu.card.server.core.domain.base.SuperMain;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.AllArgsConstructor;
@@ -21,7 +23,19 @@ import org.springframework.data.mongodb.core.mapping.Document;
 @NoArgsConstructor
 public class OrgPayAccount extends SuperMain {
 
+    @Schema(description = "机构名称")
+    private String orgName;
+
     @Schema(description = "账号id")
     private String payAccountId;
 
+    @Schema(description = "支付类型")
+    private PaymentType paymentType;
+
+    @Schema(description = "支付中心的支付方式")
+    PayProductChannelType productChannelType;
+
+    @Schema(description = "是否禁用")
+    private Boolean disable = Boolean.FALSE;
+
 }

+ 2 - 2
FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/paySetting/UnionFrictionlessSetting.java

@@ -3,7 +3,7 @@ package com.zhongshu.card.server.core.domain.paySetting;
 import com.github.microservice.types.payment.PaymentType;
 import com.zhongshu.card.client.model.paySetting.payConfig.FrictionlessUnionConfig;
 import com.zhongshu.card.client.model.paySetting.payConfig.FrictionlessWeChatConfig;
-import com.zhongshu.card.client.model.paySetting.payConfig.LaKaLaCollectionConf;
+import com.zhongshu.card.client.model.paySetting.payConfig.LaKaLaCollectionConfig;
 import com.zhongshu.card.client.model.paySetting.payConfig.PaySharingConfig;
 import com.zhongshu.card.server.core.domain.base.SuperMain;
 import com.zhongshu.card.server.core.domain.org.Organization;
@@ -50,7 +50,7 @@ public class UnionFrictionlessSetting extends SuperMain {
     private FrictionlessWeChatConfig frictionlessWeChatConfig;
 
     @Schema(description = "拉卡拉无感支付--参数配置")
-    private LaKaLaCollectionConf laKaLaCollectionConf;
+    private LaKaLaCollectionConfig laKaLaCollectionConf;
 
     @Schema(description = "分账规则")
     private PaySharingConfig paySharingConfig;

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

@@ -216,6 +216,14 @@ public class ProjectBindOrgServiceImpl extends SuperService {
         return ResultContent.buildSuccess();
     }
 
+    public ResultContent getDetailRelation(String id) {
+        OrganizationRelation relation = organizationRelationDao.findTopById(id);
+        if (ObjectUtils.isEmpty(relation)) {
+            return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, id));
+        }
+        return ResultContent.buildSuccess(toModel(relation));
+    }
+
     /**
      * 统计结构绑定的项目数量
      *
@@ -263,7 +271,7 @@ public class ProjectBindOrgServiceImpl extends SuperService {
     }
 
     /**
-     * 得到项目绑定的结构信息
+     * 得到项目绑定的机构列表信息
      *
      * @param projectOid
      * @return
@@ -285,10 +293,13 @@ public class ProjectBindOrgServiceImpl extends SuperService {
         if (ObjectUtils.isNotEmpty(entity)) {
             model = new ProjectBindOrgModel();
             BeanUtils.copyProperties(entity, model);
-            // 负责人信息
-            model.setManagerUserList(userAccountService.toListSimpleModel(userAccountService.getUserAccounts(entity.getManagerUserIds())));
+            if (ObjectUtils.isNotEmpty(entity.getManagerUserIds())) {
+                // 负责人信息
+                model.setManagerUserList(userAccountService.toListSimpleModel(userAccountService.getUserAccounts(entity.getManagerUserIds())));
+            }
             // 分账规则信息
             model.setPayShareList(payShareListService.toModel(entity.getPayShareList()));
+
             // 主机构信息,如:项目信息
             model.setMainOrganization(organizationManagerService.toRelationModel(entity.getMainOrganization()));
             // 绑定的机构信息,如:机构信息

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

@@ -0,0 +1,98 @@
+package com.zhongshu.card.server.core.service.paySetting;
+
+import com.github.microservice.net.ResultContent;
+import com.github.microservice.pay.client.model.AccountModel;
+import com.github.microservice.pay.client.model.PayProductChannelConf;
+import com.github.microservice.pay.client.product.senseless.laKaLacollection.conf.LaKaLaCollectionConf;
+import com.github.microservice.pay.client.ret.ResultState;
+import com.github.microservice.pay.client.service.PayProductAccountService;
+import com.github.microservice.pay.client.type.PayProductChannelType;
+import com.github.microservice.types.payment.PaymentType;
+import com.zhongshu.card.client.model.paySetting.payConfig.LaKaLaCollectionConfig;
+import com.zhongshu.card.server.core.dao.projectAbout.OrgPayAccountDao;
+import com.zhongshu.card.server.core.domain.org.Organization;
+import com.zhongshu.card.server.core.domain.paySetting.OrgPayAccount;
+import com.zhongshu.card.server.core.domain.paySetting.UnionFrictionlessSetting;
+import com.zhongshu.card.server.core.service.base.SuperService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 机构的支付类型账号管理
+ *
+ * @author TRX
+ * @date 2024/10/9
+ */
+@Slf4j
+@Service
+public class OrgPayAccountService extends SuperService {
+
+    @Autowired
+    private OrgPayAccountDao orgPayAccountDao;
+
+    @Autowired
+    private PayProductAccountService payProductAccountService;
+
+    /**
+     * 项目无感支付初始账号
+     *
+     * @param entity
+     * @return
+     */
+    public ResultContent initUnionFrictionPayAccount(UnionFrictionlessSetting entity) {
+        if (ObjectUtils.isNotEmpty(entity)) {
+            Organization projectInfo = entity.getProjectInfo();
+            String projectOid = projectInfo.getOid();
+
+            PayProductChannelType productChannelType = null;
+            PaymentType paymentType = entity.getPaymentType();
+            PayProductChannelConf conf = null;
+            if (paymentType == PaymentType.LakalaFrictionlessPay) {
+                productChannelType = PayProductChannelType.LaKaLaCollection;
+                LaKaLaCollectionConf laKaLaCollectionConf = new LaKaLaCollectionConf();
+
+                LaKaLaCollectionConfig laKaLaCollectionConfig = entity.getLaKaLaCollectionConf();
+                BeanUtils.copyProperties(laKaLaCollectionConfig, laKaLaCollectionConf);
+                conf = laKaLaCollectionConf;
+            }
+
+            AccountModel model = new AccountModel();
+            model.setDisable(Boolean.FALSE);
+            model.setProductChannelType(productChannelType);
+            model.setName(projectOid);
+            model.setConf(conf);
+            model.setRemark(projectInfo.getName());
+            com.github.microservice.pay.client.ret.ResultContent<Void> resultContent = payProductAccountService.upsert(model);
+            if (resultContent.getState() == ResultState.Success) {
+                OrgPayAccount orgPayAccount = orgPayAccountDao.findTopByOidAndPaymentType(projectOid, paymentType);
+                if (orgPayAccount == null) {
+                    orgPayAccount = new OrgPayAccount();
+                }
+                orgPayAccount.setPayAccountId(projectOid);
+                orgPayAccount.setPaymentType(paymentType);
+                orgPayAccount.setOrgName(projectInfo.getName());
+                orgPayAccount.setOid(projectOid);
+                orgPayAccount.setProductChannelType(productChannelType);
+                orgPayAccountDao.save(orgPayAccount);
+            } else {
+                log.error("初始支付账号出错:%s", resultContent.getMsg());
+            }
+        }
+        return ResultContent.buildSuccess();
+    }
+
+    /**
+     * 查询结构 支付账号
+     *
+     * @param oid         机构oid
+     * @param paymentType 支付方式
+     * @return
+     */
+    public OrgPayAccount queryOgPayAccount(String oid, PaymentType paymentType) {
+        OrgPayAccount orgPayAccount = orgPayAccountDao.findTopByOidAndPaymentType(oid, paymentType);
+        return orgPayAccount;
+    }
+}

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

@@ -3,12 +3,11 @@ package com.zhongshu.card.server.core.service.paySetting;
 import com.github.microservice.net.ResultContent;
 import com.github.microservice.types.payment.PaymentChannelType;
 import com.github.microservice.types.payment.PaymentType;
-import com.zhongshu.card.client.model.paySetting.payConfig.LaKaLaCollectionConf;
+import com.zhongshu.card.client.model.paySetting.payConfig.LaKaLaCollectionConfig;
 import com.zhongshu.card.client.model.paySetting.paySetting.UnionFrictionlessSettingModel;
 import com.zhongshu.card.client.model.paySetting.paySetting.UnionFrictionlessSettingParam;
 import com.zhongshu.card.server.core.dao.org.OrganizationDao;
 import com.zhongshu.card.server.core.dao.projectAbout.UnionFrictionlessSettingDao;
-import com.zhongshu.card.server.core.domain.base.SuperMain;
 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.UnionFrictionlessSetting;
@@ -43,8 +42,11 @@ public class UnionFrictionlessSettingService extends SuperService {
     @Autowired
     private OrganizationDao organizationDao;
 
+    @Autowired
+    private OrgPayAccountService orgPayAccountService;
+
     /**
-     * 保存数据
+     * 保存无感支付数据
      *
      * @param param
      * @return
@@ -73,7 +75,7 @@ public class UnionFrictionlessSettingService extends SuperService {
         UnionFrictionlessSetting entity = unionFrictionlessSettingDao
                 .findTopByProjectInfoAndPaymentType(projectInfo, paymentType);
         if (paymentType == PaymentType.LakalaFrictionlessPay) {
-            LaKaLaCollectionConf laKaLaCollectionConf = param.getLaKaLaCollectionConf();
+            LaKaLaCollectionConfig laKaLaCollectionConf = param.getLaKaLaCollectionConf();
             // 检查数据
         }
         if (entity == null) {
@@ -83,10 +85,13 @@ public class UnionFrictionlessSettingService extends SuperService {
         entity.setProjectInfo(projectInfo);
         entity.setProjectName(projectInfo.getName());
         entity.setProjectCode(projectInfo.getCode());
+        entity.setOid(projectOid);
 
         BeanUtils.copyProperties(param, entity);
         unionFrictionlessSettingDao.save(entity);
-        // 在支付中心开始账号
+
+        // 在支付中心 初始账号
+        orgPayAccountService.initUnionFrictionPayAccount(entity);
 
         return ResultContent.buildSuccess();
     }
@@ -118,6 +123,39 @@ public class UnionFrictionlessSettingService extends SuperService {
         return ResultContent.buildSuccess(models);
     }
 
+    /**
+     * 得到项目的指定类型的  无感支付配置
+     *
+     * @param projectOid
+     * @param paymentType
+     * @return
+     */
+    public UnionFrictionlessSetting getProjectPayment(String projectOid, PaymentType paymentType) {
+        Organization projectInfo = organizationDao.findTopByOid(projectOid);
+        if (ObjectUtils.isEmpty(projectInfo)) {
+            return null;
+        }
+        return unionFrictionlessSettingDao.findTopByProjectInfoAndPaymentType(projectInfo, paymentType);
+    }
+
+    /**
+     * 得到项目的 拉卡拉无感支付配置信息
+     *
+     * @param projectOid
+     * @return
+     */
+    public LaKaLaCollectionConfig getLakaLaConf(String projectOid) {
+        Organization projectInfo = organizationDao.findTopByOid(projectOid);
+        if (ObjectUtils.isEmpty(projectInfo)) {
+            return null;
+        }
+        UnionFrictionlessSetting entity = unionFrictionlessSettingDao.findTopByProjectInfoAndPaymentType(
+                projectInfo, PaymentType.LakalaFrictionlessPay);
+        if (ObjectUtils.isNotEmpty(entity)) {
+            return entity.getLaKaLaCollectionConf();
+        }
+        return null;
+    }
 
     public UnionFrictionlessSettingModel toModel(UnionFrictionlessSetting entity) {
         UnionFrictionlessSettingModel model = null;