TRX 1 gadu atpakaļ
vecāks
revīzija
ecb166f50c

+ 2 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/org/OrganizationSearchParam.java

@@ -61,4 +61,6 @@ public class OrganizationSearchParam extends SuperSearch {
 
     @Schema(description = "是否是机构")
     private Boolean isOrg;
+
+    private String keyWord;
 }

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

@@ -25,10 +25,10 @@ public class PaySharingConfig {
     @Schema(description = "最小分账金额, 单位分")
     private Long minSharing = 0L;
 
-    @Schema(description = "项目分账比例,0-100")
+    @Schema(description = "全局项目分账比例,0-100")
     private BigDecimal projectScale = BigDecimal.ZERO;
 
-    @Schema(description = "机构分账比例,0-100")
+    @Schema(description = "全局机构分账比例,0-100")
     private BigDecimal orgScale = BigDecimal.ZERO;
 
     //------------------ 提现设置 start--------------

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

@@ -1,8 +1,55 @@
 package com.zhongshu.card.client.model.paySetting.paySetting;
 
+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.PaySharingConfig;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
 /**
  * @author TRX
  * @date 2024/10/9
  */
-public class UnionFrictionlessSettingModel {
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class UnionFrictionlessSettingModel extends SuperModel {
+
+    @Schema(description = "项目名称")
+    private String projectName;
+
+    @Schema(description = "项目编码")
+    private String projectCode;
+
+    @NotNull
+    @Schema(description = "具体的支付方式")
+    private PaymentType paymentType;
+
+    private String paymentTypeStr;
+
+    public String getPaymentTypeStr() {
+        if (paymentType != null) {
+            return paymentType.getRemark();
+        }
+        return "";
+    }
+
+    @Schema(description = "银联的无感支付 参数配置")
+    private FrictionlessUnionConfig frictionlessUnionConfig;
+
+    @Schema(description = "无感支付--微信关联配置")
+    private FrictionlessWeChatConfig frictionlessWeChatConfig;
+
+    @Schema(description = "拉卡拉无感支付--参数配置")
+    private LaKaLaCollectionConf laKaLaCollectionConf;
+
+    @Schema(description = "分账规则")
+    private PaySharingConfig paySharingConfig;
+
 }

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

@@ -34,7 +34,7 @@ import javax.validation.Valid;
  * @date 2024/7/26
  */
 @RestController
-@RequestMapping("/project/projectChannel")
+@RequestMapping("/project/unionFrictionless")
 @Tag(name = "项目-无感支付产品配置设置")
 public class UnionFrictionlessSettingController {
 
@@ -52,6 +52,14 @@ public class UnionFrictionlessSettingController {
         return unionFrictionlessSettingService.saveInfo(param);
     }
 
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @Operation(summary = "删除数据", description = "删除数据")
+    @RequestMapping(value = "deleteInfo", method = {RequestMethod.POST})
+    public ResultContent deleteInfo(
+            @RequestBody @Valid IDParam param) {
+        return unionFrictionlessSettingService.deleteInfo(param.getId());
+    }
+
 
     //------------------------------feign start -----------------------
     @Operation(hidden = true, summary = "根据小程序appId得到配置", description = "根据小程序appId得到配置")

+ 2 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/org/extend/OrganizationDaoExtend.java

@@ -11,5 +11,7 @@ import org.springframework.data.domain.Pageable;
  * @Version: 1.0
  */
 public interface OrganizationDaoExtend {
+
     Page<Organization> page(Pageable pageable, OrganizationSearchParam param);
+
 }

+ 6 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/org/impl/OrganizationDaoImpl.java

@@ -115,6 +115,12 @@ public class OrganizationDaoImpl extends BaseImpl implements OrganizationDaoExte
         if (!CollectionUtils.isEmpty(criterias)) {
             criteria.andOperator(criterias.toArray(new Criteria[]{}));
         }
+
+        if (StringUtils.isNotEmpty(param.getKeyWord())) {
+            Pattern pattern = Pattern.compile("^.*" + param.getKeyWord() + ".*$");
+            criteria.orOperator(Criteria.where("name").regex(pattern), Criteria.where("code").regex(pattern));
+        }
+
         criteria.and("isDelete").is(Boolean.FALSE);
         Sort sort = buildSort(param);
         Query query = Query.query(criteria);

+ 3 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/projectAbout/UnionFrictionlessSettingDao.java

@@ -5,6 +5,8 @@ import com.github.microservice.types.payment.PaymentType;
 import com.zhongshu.card.server.core.domain.org.Organization;
 import com.zhongshu.card.server.core.domain.paySetting.UnionFrictionlessSetting;
 
+import java.util.List;
+
 /**
  * 项目的无感支付设置
  */
@@ -12,7 +14,7 @@ public interface UnionFrictionlessSettingDao extends MongoDao<UnionFrictionlessS
 
     UnionFrictionlessSetting findTopById(String id);
 
-    UnionFrictionlessSetting findTopByProjectInfo(Organization projectInfo);
+    List<UnionFrictionlessSetting> findByProjectInfo(Organization projectInfo);
 
     UnionFrictionlessSetting findTopByProjectInfoAndPaymentType(Organization projectInfo, PaymentType paymentType);
 

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

@@ -4,6 +4,7 @@ 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.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;
@@ -19,6 +20,10 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
 /**
  * 项目的无感支付设置
  *
@@ -53,7 +58,8 @@ public class UnionFrictionlessSettingService extends SuperService {
         if (StringUtils.isEmpty(projectOid)) {
             return ResultContent.buildFail(String.format("projectOid不能为空"));
         }
-        PayChannelConfig payChannelConfig = projectChannelConfigService.getProjectPayChannel(projectOid, PaymentChannelType.SecretFreePayment);
+        PayChannelConfig payChannelConfig = projectChannelConfigService
+                .getProjectPayChannel(projectOid, PaymentChannelType.SecretFreePayment);
         if (ObjectUtils.isEmpty(payChannelConfig)) {
             return ResultContent.buildFail(String.format("当前项目未配置%s",
                     PaymentChannelType.SecretFreePayment.getRemark()));
@@ -83,4 +89,41 @@ public class UnionFrictionlessSettingService extends SuperService {
         return ResultContent.buildSuccess();
     }
 
+    public ResultContent deleteInfo(String id) {
+        UnionFrictionlessSetting entity = unionFrictionlessSettingDao.findTopById(id);
+        if (ObjectUtils.isEmpty(entity)) {
+            return ResultContent.buildFail(String.format("数据不存在:%s", id));
+        }
+        unionFrictionlessSettingDao.delete(entity);
+        return ResultContent.buildSuccess();
+    }
+
+    /**
+     * 得到项目所有的无感支付配置
+     *
+     * @param projectOid
+     * @return
+     */
+    public ResultContent<List<UnionFrictionlessSettingModel>> getProjectSecretFree(String projectOid) {
+        List<UnionFrictionlessSettingModel> models = new ArrayList<>();
+        Organization projectInfo = organizationDao.findTopByOid(projectOid);
+        if (ObjectUtils.isNotEmpty(projectInfo)) {
+            List<UnionFrictionlessSetting> list = unionFrictionlessSettingDao.findByProjectInfo(projectInfo);
+            if (ObjectUtils.isNotEmpty(list)) {
+                models = list.stream().map(this::toModel).collect(Collectors.toList());
+            }
+        }
+        return ResultContent.buildSuccess(models);
+    }
+
+
+    public UnionFrictionlessSettingModel toModel(UnionFrictionlessSetting entity) {
+        UnionFrictionlessSettingModel model = null;
+        if (ObjectUtils.isNotEmpty(entity)) {
+            model = new UnionFrictionlessSettingModel();
+            BeanUtils.copyProperties(entity, model);
+        }
+        return model;
+    }
+
 }