Commit b1936c9f by levphon

通知服务-新增发短信接口

1 parent 058263c8
...@@ -37,7 +37,7 @@ public class NotifyApiController implements NotifyCenterFeignClient { ...@@ -37,7 +37,7 @@ public class NotifyApiController implements NotifyCenterFeignClient {
@PostMapping(value = "/sendSms") @PostMapping(value = "/sendSms")
@ResponseBody @ResponseBody
public R sendSms(@RequestBody SmsMessageRequest messageRequest) { public R sendSms(@RequestBody SmsMessageRequest messageRequest) {
smsService.sendSms(messageRequest.getPhone(), messageRequest.getTemplate(), messageRequest.getArgs().values()); smsService.sendSms(messageRequest.getPhone(), messageRequest.getTemplate(), messageRequest.getArgs().values().toArray());
return R.ok(); return R.ok();
} }
...@@ -49,7 +49,7 @@ public class NotifyApiController implements NotifyCenterFeignClient { ...@@ -49,7 +49,7 @@ public class NotifyApiController implements NotifyCenterFeignClient {
args.put("arg1", "刘宇峰"); args.put("arg1", "刘宇峰");
args.put("arg2", "B73493098765"); args.put("arg2", "B73493098765");
args.put("arg3", 1234); args.put("arg3", 1234);
mailService.sendSimpleMail("liuyf@didihu.com.cn", "notifycenter test", "MAIL_TEMPLATE_ORDER_PAID_NOTIFY_OPERATOR", args.values()); mailService.sendSimpleMail("liuyf@didihu.com.cn", "notifycenter test", "MAIL_TEMPLATE_ORDER_PAID_NOTIFY_OPERATOR", args.values().toArray());
return R.ok(); return R.ok();
} }
......
...@@ -34,7 +34,7 @@ public class RopHttpUtil { ...@@ -34,7 +34,7 @@ public class RopHttpUtil {
paramsMap.add("method", method); paramsMap.add("method", method);
} }
public static <T> T get(MultiValueMap<String, String> paramsMap, Class<T> responseType, String baseurl, String method) throws Exception { public static <T> T get(MultiValueMap<String, String> paramsMap, Class<T> responseType, String baseurl, String method) {
addBaseParam(paramsMap, method); addBaseParam(paramsMap, method);
MultiValueMap<String, String> params = getSysParams(); MultiValueMap<String, String> params = getSysParams();
params.putAll(paramsMap); params.putAll(paramsMap);
...@@ -53,7 +53,7 @@ public class RopHttpUtil { ...@@ -53,7 +53,7 @@ public class RopHttpUtil {
return forObject; return forObject;
} }
public static <T> T post(MultiValueMap<String, String> paramsMap, Class<T> responseType, String baseurl, String method) throws Exception { public static <T> T post(MultiValueMap<String, String> paramsMap, Class<T> responseType, String baseurl, String method) {
addBaseParam(paramsMap, method); addBaseParam(paramsMap, method);
MultiValueMap<String, String> params = getSysParams(); MultiValueMap<String, String> params = getSysParams();
params.putAll(paramsMap); params.putAll(paramsMap);
...@@ -67,7 +67,7 @@ public class RopHttpUtil { ...@@ -67,7 +67,7 @@ public class RopHttpUtil {
return new RestTemplate().postForObject(baseurl, params, responseType); return new RestTemplate().postForObject(baseurl, params, responseType);
} }
public static <T> T postE(MultiValueMap<String, String> paramsMap, Class<T> responseType, String baseurl, String method) throws Exception { public static <T> T postE(MultiValueMap<String, String> paramsMap, Class<T> responseType, String baseurl, String method) {
addBaseParamE(paramsMap, method); addBaseParamE(paramsMap, method);
MultiValueMap<String, String> params = getSysParamsE(); MultiValueMap<String, String> params = getSysParamsE();
params.putAll(paramsMap); params.putAll(paramsMap);
......
...@@ -27,7 +27,7 @@ public class RopUtils { ...@@ -27,7 +27,7 @@ public class RopUtils {
* @return * @return
*/ */
public static String signByMd5(Map<String, String> paramValues, String secret) { public static String signByMd5(Map<String, String> paramValues, String secret) {
return sign(paramValues, null, secret); return signByMd5(paramValues, null, secret);
} }
/** /**
......
...@@ -3,6 +3,7 @@ package cn.com.glsx.test; ...@@ -3,6 +3,7 @@ package cn.com.glsx.test;
import cn.com.glsx.Application; import cn.com.glsx.Application;
import cn.com.glsx.notify.dto.request.WechatMessageRequest; import cn.com.glsx.notify.dto.request.WechatMessageRequest;
import cn.com.glsx.notify.modules.service.MailService; import cn.com.glsx.notify.modules.service.MailService;
import cn.com.glsx.notify.modules.service.SmsService;
import com.glsx.plat.common.utils.DateUtils; import com.glsx.plat.common.utils.DateUtils;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import org.assertj.core.util.Lists; import org.assertj.core.util.Lists;
...@@ -21,8 +22,8 @@ import java.util.Map; ...@@ -21,8 +22,8 @@ import java.util.Map;
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class NotifyApplicationTests { public class NotifyApplicationTests {
/*@Autowired @Autowired
private SmsService smsService;*/ private SmsService smsService;
@Autowired @Autowired
private MailService mailService; private MailService mailService;
...@@ -33,12 +34,12 @@ public class NotifyApplicationTests { ...@@ -33,12 +34,12 @@ public class NotifyApplicationTests {
// @Autowired // @Autowired
// private WeixinService weixinService; // private WeixinService weixinService;
/*@Test @Test
public void testSms() { public void testSms() {
Map<String, Object> args = new HashMap<>(); Map<String, Object> args = new HashMap<>();
args.put("code", 1234); args.put("code", 1234);
smsService.sendSms("18682185876", "SMS_TEMPLATE_VERIFY_CODE", args.values()); smsService.sendSms("18682185876", "SMS_TEMPLATE_VERIFY_CODE", args.values());
}*/ }
@Test @Test
public void testMail() throws Exception { public void testMail() throws Exception {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!