feat: 短信渠道/支付渠道新增渠道编码Mation

This commit is contained in:
weizhiqiang 2024-10-08 20:55:53 +08:00
parent e38b0a69ae
commit 55122ab6c1
6 changed files with 44 additions and 0 deletions

View file

@ -18,6 +18,8 @@ import com.skyeye.common.entity.features.OperatorUserInfo;
import com.skyeye.pay.core.PayClientConfig;
import lombok.Data;
import java.util.Map;
/**
* @ClassName: PayChannel
* @Description: 支付渠道实体类
@ -41,6 +43,10 @@ public class PayChannel extends OperatorUserInfo {
@ApiModelProperty(value = "渠道编码,参考#PayType", required = "required")
private String codeNum;
@TableField(exist = false)
@Property("渠道编码对应的信息")
private Map<String, Object> codeNumMation;
@TableField("enabled")
@ApiModelProperty(value = "启用状态", required = "required")
private Integer enabled;

View file

@ -14,6 +14,9 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import java.util.HashMap;
import java.util.Map;
/**
* @ClassName: PayType
* @Description: 付款类型
@ -62,4 +65,12 @@ public enum PayType implements SkyeyeEnumClass {
return channelCode != null && channelCode.startsWith("alipay");
}
public static Map<String, Object> getMation(String code) {
PayType type = getByCode(code);
Map<String, Object> result = new HashMap<>();
result.put("id", type.getKey());
result.put("name", type.getValue());
return result;
}
}

View file

@ -60,6 +60,7 @@ public class PayChannelServiceImpl extends SkyeyeBusinessServiceImpl<PayChannelD
public PayChannel selectById(String id) {
PayChannel payChannel = super.selectById(id);
payAppService.setDataMation(payChannel, PayChannel::getAppId);
payChannel.setCodeNumMation(PayType.getMation(payChannel.getCodeNum()));
return payChannel;
}

View file

@ -10,6 +10,9 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import java.util.HashMap;
import java.util.Map;
/**
* @ClassName: SmsChannelEnum
* @Description: 短信渠道枚举
@ -40,4 +43,12 @@ public enum SmsChannelEnum implements SkyeyeEnumClass {
return ArrayUtil.firstMatch(o -> o.getKey().equals(code), values());
}
public static Map<String, Object> getMation(String code) {
SmsChannelEnum type = getByCode(code);
Map<String, Object> result = new HashMap<>();
result.put("id", type.getKey());
result.put("name", type.getValue());
return result;
}
}

View file

@ -8,12 +8,15 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.skyeye.annotation.api.ApiModel;
import com.skyeye.annotation.api.ApiModelProperty;
import com.skyeye.annotation.api.Property;
import com.skyeye.annotation.cache.RedisCacheField;
import com.skyeye.common.constans.RedisConstants;
import com.skyeye.common.entity.features.BaseGeneralInfo;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Map;
/**
* @ClassName: SmsChannel
* @Description: 短信渠道
@ -33,6 +36,10 @@ public class SmsChannel extends BaseGeneralInfo {
@ApiModelProperty(value = "渠道编码,参考#SmsChannelEnum", required = "required", fuzzyLike = true)
private String codeNum;
@TableField(exist = false)
@Property("渠道编码对应的信息")
private Map<String, Object> codeNumMation;
@TableField("enabled")
@ApiModelProperty(value = "状态,参考#EnableEnum枚举类", required = "required,num")
private Integer enabled;

View file

@ -14,6 +14,7 @@ import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.mybatisplus.MybatisPlusUtil;
import com.skyeye.exception.CustomException;
import com.skyeye.sms.classenum.SmsChannelEnum;
import com.skyeye.sms.core.service.SmsClient;
import com.skyeye.sms.core.service.SmsClientFactory;
import com.skyeye.sms.dao.SmsChannelDao;
@ -63,6 +64,13 @@ public class SmsChannelServiceImpl extends SkyeyeBusinessServiceImpl<SmsChannelD
return smsClientFactory.getSmsClientById(channelId);
}
@Override
public SmsChannel selectById(String id) {
SmsChannel smsChannel = super.selectById(id);
smsChannel.setCodeNumMation(SmsChannelEnum.getMation(smsChannel.getCodeNum()));
return smsChannel;
}
@Override
public SmsClient getSmsClient(String channelCode) {
SmsChannel smsChannel = selectByCodeNum(channelCode);