TRX vor 1 Jahr
Ursprung
Commit
b8ca05229e

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

@@ -1,6 +1,7 @@
 package com.zhongshu.card.client.model.paySetting.paySetting;
 
 import com.github.microservice.types.payment.PaymentType;
+import com.zhongshu.card.client.model.projectAbout.PayChannelConfigModel;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.AllArgsConstructor;
 import lombok.Data;
@@ -35,4 +36,7 @@ public class ProjectPaySettingModel {
 
     @Schema(description = "支付渠道的参数配置")
     private Object payConfig;
+
+    @Schema(description = "关联的支付产品信息")
+    private PayChannelConfigModel payChannelConfigModel;
 }

+ 13 - 5
FullCardClient/src/main/java/com/zhongshu/card/client/model/projectAbout/PayChannelConfigModel.java

@@ -27,8 +27,21 @@ public class PayChannelConfigModel extends SuperModel {
     @Schema(description = "支付产品名称")
     private String name;
 
+    @Schema(description = "logo")
     private String logo;
 
+    @Schema(description = "支付类型")
+    private PaymentType paymentType;
+
+    private String paymentTypeStr;
+
+    public String getPaymentTypeStr() {
+        if (paymentType != null) {
+            return paymentType.getRemark();
+        }
+        return "";
+    }
+
     private String paymentChannelTypeName;
 
     public String getPaymentChannelTypeName() {
@@ -65,9 +78,4 @@ public class PayChannelConfigModel extends SuperModel {
         return "";
     }
 
-    /**
-     * 可用的对应支付渠道
-     */
-    private List<PaymentTypeModel> canUseAblePaymentTypes = new ArrayList<>();
-
 }

+ 4 - 5
FullCardClient/src/main/java/com/zhongshu/card/client/model/projectAbout/PayChannelConfigParam.java

@@ -32,8 +32,10 @@ public class PayChannelConfigParam extends SuperParam {
     @Schema(description = "支付产品名称")
     private String name;
 
-    @NotNull
-    @Schema(description = "支付类型")
+    @Schema(description = "支付渠道类型")
+    private PaymentType paymentType;
+
+    @Schema(description = "支付类型", hidden = true)
     private PaymentChannelType paymentChannelType;
 
     @Schema(description = "汇率说明")
@@ -42,7 +44,4 @@ public class PayChannelConfigParam extends SuperParam {
     @Schema(description = "数据状态")
     private DataState state = DataState.Enable;
 
-    @Schema(description = "渠道支持的支付方式")
-    private List<PaymentType> paymentTypes = new ArrayList<>();
-
 }

+ 8 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/devices/DevicePermissController.java

@@ -7,6 +7,7 @@ import com.zhongshu.card.client.model.base.IDParam;
 import com.zhongshu.card.client.model.base.IDsParam;
 import com.zhongshu.card.client.model.devices.*;
 import com.zhongshu.card.client.service.school.DeviceInfoService;
+import com.zhongshu.card.client.type.DataState;
 import com.zhongshu.card.server.core.service.devices.DevicePermissService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
@@ -67,6 +68,13 @@ public class DevicePermissController {
         return this.devicePermissService.deleteInfo(param.getId());
     }
 
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @Operation(summary = "启用设备权限", description = "启用设备权限")
+    @RequestMapping(value = "enablePermiss", method = {RequestMethod.POST})
+    public ResultContent enablePermiss(@RequestBody IDParam param) {
+        return this.devicePermissService.changeState(param.getId(), DataState.Enable);
+    }
+
     @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "删除设备权限(多个)", description = "删除设备权限(多个)")
     @RequestMapping(value = "deleteByIds", method = {RequestMethod.POST})

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

@@ -2,6 +2,7 @@ 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.client.type.DataState;
 import com.zhongshu.card.server.core.dao.projectAbout.extend.PayChannelConfigDaoExtend;
 import com.zhongshu.card.server.core.domain.paySetting.PayChannelConfig;
@@ -17,6 +18,8 @@ public interface PayChannelConfigDao extends MongoDao<PayChannelConfig>, PayChan
 
     PayChannelConfig findTopByPaymentChannelType(PaymentChannelType paymentChannelType);
 
+    PayChannelConfig findTopByPaymentType(PaymentType paymentType);
+
     List<PayChannelConfig> findByState(DataState state);
 
 }

+ 4 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/devices/DevicePermiss.java

@@ -2,6 +2,7 @@ package com.zhongshu.card.server.core.domain.devices;
 
 import com.github.microservice.auth.security.type.AuthType;
 import com.github.microservice.models.type.DeviceType;
+import com.zhongshu.card.client.type.DataState;
 import com.zhongshu.card.client.type.UserState;
 import com.zhongshu.card.server.core.domain.base.SuperMain;
 import com.zhongshu.card.server.core.domain.org.Department;
@@ -98,4 +99,7 @@ public class DevicePermiss extends SuperMain {
     @Schema(description = "权限是否下发")
     private Boolean isUsed = Boolean.FALSE;
 
+    @Schema(description = "是否可用")
+    private DataState dataState = DataState.Enable;
+
 }

+ 4 - 4
FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/paySetting/PayChannelConfig.java

@@ -36,7 +36,10 @@ public class PayChannelConfig extends SuperMain {
     @Schema(description = "支付产品名称")
     private String name;
 
-    @Schema(description = "支付类型")
+    @Schema(description = "支付渠道类型")
+    private PaymentType paymentType;
+
+    @Schema(description = "支付产品类型")
     private PaymentChannelType paymentChannelType;
 
     @Schema(description = "汇率说明")
@@ -45,7 +48,4 @@ public class PayChannelConfig extends SuperMain {
     @Schema(description = "数据状态")
     private DataState state = DataState.Enable;
 
-    @Schema(description = "渠道支持的支付方式")
-    private List<PaymentType> paymentTypes = new ArrayList<>();
-
 }

+ 3 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/devices/DevicePermissIotService.java

@@ -114,7 +114,10 @@ public class DevicePermissIotService {
      */
     public ResultContent queryDevicePermiss(DevicePerQuery query) {
         DeviceAboutPermiss deviceAboutPermiss = new DeviceAboutPermiss();
+        List<String> deviceIds = query.getDeviceIds();
+        if (ObjectUtils.isNotEmpty(deviceIds)) {
 
+        }
         return ResultContent.buildSuccess(JSONUtil.toJsonStr(deviceAboutPermiss));
     }
 

+ 11 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/devices/DevicePermissService.java

@@ -9,6 +9,7 @@ import com.zhongshu.card.client.model.devices.DevicePermissParam;
 import com.zhongshu.card.client.model.devices.DevicePermissSearch;
 import com.zhongshu.card.client.model.org.OrganizationUserModel;
 import com.zhongshu.card.client.type.DataOperationType;
+import com.zhongshu.card.client.type.DataState;
 import com.zhongshu.card.server.core.dao.devices.DeviceInfoDao;
 import com.zhongshu.card.server.core.dao.devices.DevicePermissDao;
 import com.zhongshu.card.server.core.dao.org.OrganizationDao;
@@ -202,6 +203,16 @@ public class DevicePermissService extends SuperService {
         return ResultContent.buildSuccess();
     }
 
+    public ResultContent changeState(String id, DataState dataState) {
+        DevicePermiss entity = devicePermissDao.findTopById(id);
+        if (ObjectUtils.isEmpty(entity)) {
+            return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, id));
+        }
+        entity.setDataState(dataState);
+        devicePermissDao.save(entity);
+        return ResultContent.buildSuccess();
+    }
+
     public ResultContent deleteByIds(IDsParam param) {
         if (ObjectUtils.isNotEmpty(param.getIds())) {
             devicePermissDao.deleteAllById(param.getIds());

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

@@ -55,9 +55,8 @@ public class ProjectChannelConfigService extends SuperService {
         if (StringUtils.isEmpty(oid)) {
             oid = getCurrentOid();
         }
-        Organization orgInfo = organizationDao.findTopByOid(oid);
         PayChannelConfig entity = null;
-        PayChannelConfig nameTemp = payChannelConfigDao.findTopByPaymentChannelType(param.getPaymentChannelType());
+        PayChannelConfig nameTemp = payChannelConfigDao.findTopByPaymentType(param.getPaymentType());
 
         if (ObjectUtils.isNotEmpty(param.getId())) {
             entity = payChannelConfigDao.findTopById(param.getId());
@@ -77,11 +76,7 @@ public class ProjectChannelConfigService extends SuperService {
             entity.setIsDelete(Boolean.FALSE);
             initEntityNoOid(entity);
         }
-        BeanUtils.copyProperties(param, entity);
-        if (ObjectUtils.isNotEmpty(orgInfo)) {
-            entity.setProjectOid(orgInfo.getOid());
-            entity.setAboutAuthType(orgInfo.getAuthType());
-        }
+        BeanUtils.copyPropertiesWithoutNull(param, entity);
         entity.setOid(oid);
         entity.setAboutOid(oid);
         payChannelConfigDao.save(entity);
@@ -92,30 +87,30 @@ public class ProjectChannelConfigService extends SuperService {
         if (StringUtils.isEmpty(param.getId())) {
             return ResultContent.buildFail("id不能为空");
         }
-        PayChannelConfig channelConfig = payChannelConfigDao.findTopByPaymentChannelType(param.getPaymentChannelType());
+        PayChannelConfig channelConfig = payChannelConfigDao.findTopByPaymentType(param.getPaymentType());
         if (ObjectUtils.isEmpty(channelConfig)) {
             return ResultContent.buildFail("数据不存在");
         }
-
-        BeanUtils.copyProperties(param, channelConfig, "paymentChannelType");
+        BeanUtils.copyProperties(param, channelConfig, "paymentChannelType", "paymentType");
         initUpdateEntity(channelConfig);
         payChannelConfigDao.save(channelConfig);
         return ResultContent.buildSuccess();
     }
 
     public ResultContent initAllChannel() {
-        // 免密支付
+        // 免密支付 拉卡拉
         PayChannelConfigParam param = new PayChannelConfigParam();
         param.setName("免密支付");
         param.setPaymentChannelType(PaymentChannelType.SecretFreePayment);
-        param.setPaymentTypes(List.of(PaymentType.LakalaFrictionlessPay));
+        param.setPaymentType(PaymentType.LakalaFrictionlessPay);
         savePayChannelConfig(param);
 
+        // 余额支付  微信充值
         PayChannelConfigParam balanceParam = new PayChannelConfigParam();
         balanceParam.setName("余额支付");
         balanceParam.setPaymentChannelType(PaymentChannelType.BalancePayment);
         balanceParam.setSort(2L);
-        balanceParam.setPaymentTypes(List.of(PaymentType.WeChat));
+        balanceParam.setPaymentType(PaymentType.WeChat);
         savePayChannelConfig(balanceParam);
 
         return ResultContent.buildSuccess();
@@ -163,25 +158,18 @@ public class ProjectChannelConfigService extends SuperService {
         return ResultContent.buildSuccess(toModel(entity));
     }
 
-    /**
-     * 得到项目渠道配置
-     *
-     * @param paymentChannelType
-     * @return
-     */
-    public PayChannelConfig getProjectPayChannel(PaymentChannelType paymentChannelType) {
-        PayChannelConfig entity = payChannelConfigDao.findTopByPaymentChannelType(paymentChannelType);
-        return entity;
-    }
-
     public PayChannelConfig getProjectPayChannel(PaymentType paymentType) {
         if (paymentType == null) {
             return null;
         }
-        PayChannelConfig entity = payChannelConfigDao.findTopByPaymentChannelType(paymentType.getChannelType());
+        PayChannelConfig entity = payChannelConfigDao.findTopByPaymentType(paymentType);
         return entity;
     }
 
+    public PayChannelConfigModel getProjectPayChannelModel(PaymentType paymentType) {
+        return toModel(getProjectPayChannel(paymentType));
+    }
+
     public ResultContent changeState(String id, DataState state) {
         PayChannelConfig entity = payChannelConfigDao.findTopById(id);
         if (ObjectUtils.isEmpty(entity)) {
@@ -215,24 +203,6 @@ public class ProjectChannelConfigService extends SuperService {
         if (ObjectUtils.isNotEmpty(entity)) {
             model = new PayChannelConfigModel();
             BeanUtils.copyProperties(entity, model);
-
-            List<PaymentType> paymentTypes = entity.getPaymentTypes();
-            if (ObjectUtils.isEmpty(paymentTypes)) {
-                paymentTypes = new ArrayList<>(paymentTypes);
-            }
-            // 可用的支付渠道
-            List<PaymentTypeModel> canUseAblePaymentTypes = new ArrayList<>();
-            for (PaymentType paymentType : PaymentType.values()) {
-                if (paymentType.getChannelType() != null && entity.getPaymentChannelType() == paymentType.getChannelType()) {
-                    PaymentTypeModel typeModel = new PaymentTypeModel();
-                    typeModel.setPaymentType(paymentType);
-                    if (paymentTypes.contains(paymentType)) {
-                        typeModel.setIsChecked(Boolean.TRUE);
-                    }
-                    canUseAblePaymentTypes.add(typeModel);
-                }
-            }
-            model.setCanUseAblePaymentTypes(canUseAblePaymentTypes);
         }
         return model;
     }

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

@@ -7,6 +7,7 @@ import com.github.microservice.net.ResultContent;
 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.projectAbout.PayChannelConfigModel;
 import com.zhongshu.card.client.type.DataState;
 import com.zhongshu.card.server.core.dao.org.OrganizationDao;
 import com.zhongshu.card.server.core.dao.projectAbout.ProjectPaySettingDao;
@@ -211,6 +212,7 @@ public class ProjectPaySettingServiceImpl extends SuperService {
         if (ObjectUtils.isNotEmpty(entity)) {
             model = new ProjectPaySettingModel();
             BeanUtils.copyProperties(entity, model);
+            model.setPayChannelConfigModel(projectChannelConfigService.getProjectPayChannelModel(entity.getChannelType()));
         }
         return model;
     }
@@ -229,21 +231,18 @@ public class ProjectPaySettingServiceImpl extends SuperService {
         if (ObjectUtils.isEmpty(payChannelConfig)) {
             ResultContent.buildFail(String.format("平台未配置%s", paymentType.getChannelType().getRemark()));
         }
-        List<PaymentType> paymentTypes = payChannelConfig.getPaymentTypes();
-        if (ObjectUtils.isEmpty(paymentTypes) || !paymentTypes.contains(paymentType)) {
+        if (ObjectUtils.isEmpty(payChannelConfig)) {
             return ResultContent.buildFail(String.format("%s支付产品不支持%s", payChannelConfig.getName(),
                     paymentType.getRemark()));
         }
         if (payChannelConfig.getState() != DataState.Enable) {
             return ResultContent.buildFail(String.format("支付产品%s%s", payChannelConfig.getName(), payChannelConfig.getState().getRemark()));
         }
-
         // 检查项目配置参数没
         ProjectPaySetting paySetting = getProjectPaySetting(projectOid, paymentType);
         if (ObjectUtils.isEmpty(paySetting)) {
             return ResultContent.buildFail(String.format("项目为配置%s参数", paymentType.getRemark()));
         }
-
         return ResultContent.buildSuccess();
     }