Parcourir la source

Merge remote-tracking branch 'origin/master' into test

tanbin il y a 1 an
Parent
commit
59428a4947

+ 4 - 2
sys-api-service/src/main/java/com/xy/service/AliSmsServiceImpl.java

@@ -14,6 +14,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.RequestBody;
 
+import java.util.Map;
+
 
 /**
  * 阿里短信服务
@@ -66,14 +68,14 @@ public class AliSmsServiceImpl implements AliSmsService {
     public R sendMsgCommon(SmsSendCommonDTO smsSendDTO) {
         String mobile = smsSendDTO.getMobile();
         Integer scene = smsSendDTO.getScene();
-        String paramValue = smsSendDTO.getParamValue();
+        Map<String, Object> templateParams = smsSendDTO.getTemplateParams();
         Long msgConfigId = smsSendDTO.getMsgConfigId();
         SmsSceneEnum smsSceneEnum = SmsSceneEnum.getCodeByScene(scene);
         if (smsSceneEnum == null) {
             throw new CommRuntimeException("发送场景有误!");
         }
         //发短信验证码
-        smsUtil.sendSmsCommon(mobile, msgConfigId, paramValue);
+        smsUtil.sendSmsCommon(mobile, msgConfigId, templateParams);
         return R.ok();
     }
 

+ 2 - 4
sys-api-service/src/main/java/com/xy/service/SmsUtilAliImplService.java

@@ -115,7 +115,7 @@ public class SmsUtilAliImplService implements SmsUtil {
     }
 
     @Override
-    public void sendSmsCommon(String mobile, Long configId, String paramValue) {
+    public void sendSmsCommon(String mobile, Long configId, Map<String, Object> templateParams) {
         MsgConfigDto.Vo msgConfig = R.feignCheckData(msgSendApiService.getMsgConfig(new MsgConfigDto.Vo().setId(configId)));
         List<MsgConfigTestDto.BizParam> bizParams = R.feignCheckData(msgSendApiService.getBizParamByMsgConfig(new MsgConfigTestDto.MsgConfig().setConfigId(configId)));
         if (CollUtil.isNotEmpty(bizParams) && msgConfig != null) {
@@ -124,10 +124,8 @@ public class SmsUtilAliImplService implements SmsUtil {
             for (MsgConfigTestDto.BizData b : bizDataList) {
                 String channelType = b.getChannelType();
                 if (Integer.valueOf(channelType).intValue() == ChannelType.SMS.getCode().intValue()) {
-                    Map<String, Object> params = MapUtil.newHashMap();
-                    params.put("data", paramValue);
                     b.setReceivers(CollUtil.newHashSet(mobile));
-                    b.setTemplateParams(params);
+                    b.setTemplateParams(templateParams);
                     sendList.add(b);
                 }
             }

+ 4 - 4
sys-api/src/main/java/com/xy/dto/SmsSendCommonDTO.java

@@ -6,6 +6,7 @@ import lombok.experimental.Accessors;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
+import java.util.Map;
 
 
 @Data
@@ -19,16 +20,15 @@ public class SmsSendCommonDTO {
     private Integer scene;
 
 
-    @NotBlank(message = "短信模板参数值")
-    @ApiModelProperty(value = "短信模板参数值")
-    private String paramValue;
-
     @NotNull(message = "手机号不能为空")
     @ApiModelProperty(value = "消息配置ID")
     private Long msgConfigId;
 
     @ApiModelProperty(value = "用户ID")
     private Long userInfoId;
+    @NotNull(message = "模板业务参数不可为空")
+    @ApiModelProperty("模板业务参数(消息中心-消息配置-列表查看)")
+    private Map<String, Object> templateParams;
 
 
 }

+ 1 - 1
sys-api/src/main/java/com/xy/service/AliSmsService.java

@@ -30,7 +30,7 @@ public interface AliSmsService {
     R<Boolean> verifyCode(@RequestBody @Validated SmsDTO.Validation smsDTO);
 
     /**
-     * 短信发送通用 (目前只支持阿里云短信,且占位参数名为 data
+     * 短信发送通用 (通知类短信 阿里云
      *
      * @param smsSendDTO
      * @return {@link R}

+ 4 - 2
sys-api/src/main/java/com/xy/service/SmsUtil.java

@@ -3,6 +3,8 @@ package com.xy.service;
 
 import com.xy.enums.SmsSceneEnum;
 
+import java.util.Map;
+
 
 /**
  * 短信接口
@@ -27,9 +29,9 @@ public interface SmsUtil {
      *
      * @param mobile
      * @param msgConfigId
-     * @param paramValue
+     * @param templateParams
      */
-    void sendSmsCommon(String mobile, Long msgConfigId, String paramValue);
+    void sendSmsCommon(String mobile, Long msgConfigId, Map<String, Object> templateParams);
 
     /**
      * 验证码验证