Commit 48b3282e authored by qinxunjia's avatar qinxunjia

创建模板和发送短信相关编码

parent 7be8dd0d
2020-04-22 10:45:33,243 [INFO] [main] com.jz.Application [StartupInfoLogger.java : 55] Starting Application on DESKTOP-N870KLV with PID 2360 (D:\9zPro\plugin\target\classes started by qxj in D:\9zPro\plugin)
2020-04-22 10:45:33,247 [DEBUG] [main] com.jz.Application [StartupInfoLogger.java : 56] Running with Spring Boot v2.2.5.RELEASE, Spring v5.2.4.RELEASE
2020-04-22 10:45:33,247 [INFO] [main] com.jz.Application [SpringApplication.java : 655] The following profiles are active: test
2020-04-22 10:45:33,998 [WARN] [main] org.mybatis.spring.mapper.ClassPathMapperScanner [Logger.java : 44] No MyBatis mapper was found in '[com.jz]' package. Please check your configuration.
2020-04-22 10:45:34,128 [INFO] [main] o.s.data.repository.config.RepositoryConfigurationDelegate [RepositoryConfigurationDelegate.java : 249] Multiple Spring Data modules found, entering strict repository configuration mode!
2020-04-22 10:45:34,133 [INFO] [main] o.s.data.repository.config.RepositoryConfigurationDelegate [RepositoryConfigurationDelegate.java : 127] Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2020-04-22 10:45:34,180 [INFO] [main] o.s.data.repository.config.RepositoryConfigurationDelegate [RepositoryConfigurationDelegate.java : 187] Finished Spring Data repository scanning in 22ms. Found 0 Redis repository interfaces.
2020-04-22 10:45:34,323 [WARN] [main] org.mybatis.spring.mapper.ClassPathMapperScanner [Logger.java : 44] No MyBatis mapper was found in '[com.jz]' package. Please check your configuration.
2020-04-22 10:45:35,110 [INFO] [main] org.springframework.boot.web.embedded.tomcat.TomcatWebServer [TomcatWebServer.java : 92] Tomcat initialized with port(s): 19010 (http)
2020-04-22 10:45:35,123 [INFO] [main] org.apache.catalina.core.StandardService [DirectJDKLog.java : 173] Starting service [Tomcat]
2020-04-22 10:45:35,123 [INFO] [main] org.apache.catalina.core.StandardEngine [DirectJDKLog.java : 173] Starting Servlet engine: [Apache Tomcat/9.0.31]
2020-04-22 10:45:35,213 [INFO] [main] o.a.catalina.core.ContainerBase.[Tomcat].[localhost].[/] [DirectJDKLog.java : 173] Initializing Spring embedded WebApplicationContext
2020-04-22 10:45:35,214 [INFO] [main] org.springframework.web.context.ContextLoader [ServletWebServerApplicationContext.java : 284] Root WebApplicationContext: initialization completed in 1883 ms
2020-04-22 10:45:35,281 [INFO] [main] o.s.b.f.annotation.AutowiredAnnotationBeanPostProcessor [AutowiredAnnotationBeanPostProcessor.java : 496] Autowired annotation is not supported on static methods: public static void com.jz.sms.config.SMSConfig.setMarketingAccount(java.lang.String)
2020-04-22 10:45:35,282 [INFO] [main] o.s.b.f.annotation.AutowiredAnnotationBeanPostProcessor [AutowiredAnnotationBeanPostProcessor.java : 496] Autowired annotation is not supported on static methods: public static void com.jz.sms.config.SMSConfig.setMarketingPassword(java.lang.String)
2020-04-22 10:45:35,282 [INFO] [main] o.s.b.f.annotation.AutowiredAnnotationBeanPostProcessor [AutowiredAnnotationBeanPostProcessor.java : 496] Autowired annotation is not supported on static methods: public static void com.jz.sms.config.SMSConfig.setNotificationAccount(java.lang.String)
2020-04-22 10:45:35,282 [INFO] [main] o.s.b.f.annotation.AutowiredAnnotationBeanPostProcessor [AutowiredAnnotationBeanPostProcessor.java : 496] Autowired annotation is not supported on static methods: public static void com.jz.sms.config.SMSConfig.setNotificationPassword(java.lang.String)
2020-04-22 10:45:35,282 [INFO] [main] o.s.b.f.annotation.AutowiredAnnotationBeanPostProcessor [AutowiredAnnotationBeanPostProcessor.java : 496] Autowired annotation is not supported on static methods: public static void com.jz.sms.config.SMSConfig.setSendVariable(java.lang.String)
2020-04-22 10:45:35,282 [INFO] [main] o.s.b.f.annotation.AutowiredAnnotationBeanPostProcessor [AutowiredAnnotationBeanPostProcessor.java : 496] Autowired annotation is not supported on static methods: public static void com.jz.sms.config.SMSConfig.setSendFixed(java.lang.String)
2020-04-22 10:45:35,282 [INFO] [main] o.s.b.f.annotation.AutowiredAnnotationBeanPostProcessor [AutowiredAnnotationBeanPostProcessor.java : 496] Autowired annotation is not supported on static methods: public static void com.jz.sms.config.SMSConfig.setPullReport(java.lang.String)
2020-04-22 10:45:35,283 [INFO] [main] o.s.b.f.annotation.AutowiredAnnotationBeanPostProcessor [AutowiredAnnotationBeanPostProcessor.java : 496] Autowired annotation is not supported on static methods: public static void com.jz.sms.config.SMSConfig.setReportUrl(java.lang.String)
2020-04-22 10:45:35,499 [INFO] [main] o.s.scheduling.concurrent.ThreadPoolTaskExecutor [ExecutorConfigurationSupport.java : 181] Initializing ExecutorService 'applicationTaskExecutor'
2020-04-22 10:45:35,786 [INFO] [main] com.zaxxer.hikari.HikariDataSource [HikariDataSource.java : 110] HikariPool-1 - Starting...
2020-04-22 10:45:35,788 [WARN] [main] com.zaxxer.hikari.util.DriverDataSource [DriverDataSource.java : 70] Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
2020-04-22 10:45:36,041 [INFO] [main] com.zaxxer.hikari.HikariDataSource [HikariDataSource.java : 123] HikariPool-1 - Start completed.
2020-04-22 10:45:36,995 [INFO] [main] org.springframework.boot.web.embedded.tomcat.TomcatWebServer [TomcatWebServer.java : 204] Tomcat started on port(s): 19010 (http) with context path ''
2020-04-22 10:45:36,998 [INFO] [main] com.jz.Application [StartupInfoLogger.java : 61] Started Application in 4.629 seconds (JVM running for 8.652)
2020-04-22 10:47:03,046 [INFO] [http-nio-19010-exec-2] o.a.catalina.core.ContainerBase.[Tomcat].[localhost].[/] [DirectJDKLog.java : 173] Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-04-22 10:47:03,046 [INFO] [http-nio-19010-exec-2] org.springframework.web.servlet.DispatcherServlet [FrameworkServlet.java : 525] Initializing Servlet 'dispatcherServlet'
2020-04-22 10:47:03,053 [INFO] [http-nio-19010-exec-2] org.springframework.web.servlet.DispatcherServlet [FrameworkServlet.java : 547] Completed initialization in 6 ms
2020-04-22 10:47:03,072 [WARN] [http-nio-19010-exec-2] o.s.web.servlet.mvc.support.DefaultHandlerExceptionResolver [AbstractHandlerExceptionResolver.java : 199] Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported]
2020-04-22 10:47:31,718 [WARN] [http-nio-19010-exec-3] o.s.web.servlet.mvc.support.DefaultHandlerExceptionResolver [AbstractHandlerExceptionResolver.java : 199] Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported]
2020-04-22 10:47:48,056 [WARN] [http-nio-19010-exec-4] o.s.web.servlet.mvc.support.DefaultHandlerExceptionResolver [AbstractHandlerExceptionResolver.java : 199] Resolved [org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public com.jz.sms.dto.XfaceDmHubTemplateResponseDTO com.jz.sms.wrapper.maintenance.XfaceCreateTempLateWrapper.processRequest(com.jz.sms.dto.XfaceDmHubTemplateRequestDTO)]
2020-04-22 10:50:01,419 [INFO] [http-nio-19010-exec-6] com.jz.sms.api.BizController [BizController.java : 31] **********创建模板入参*******:{appId=qeifuieouioue, timestamp=2020102000000, signature=achldjkflajdoiocojioji}
...@@ -75,6 +75,10 @@ ...@@ -75,6 +75,10 @@
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>dmhub-plugin</finalName> <finalName>dmhub-plugin</finalName>
......
package com.jz.sms.api; package com.jz.sms.api;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jz.sms.chuanlan.service.ChuanLanSmsService; import com.jz.sms.dto.DmHubTemplateRequest;
import com.jz.sms.dto.XfaceDmHubTemplateRequestDTO; import com.jz.sms.dto.DmHubTemplateResponse;
import com.jz.sms.dto.XfaceDmHubTemplateResponseDTO;
import com.jz.sms.service.MessageService; import com.jz.sms.service.MessageService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.Map; import java.util.Map;
@RestController @RestController
...@@ -32,9 +28,9 @@ public class BizController { ...@@ -32,9 +28,9 @@ public class BizController {
* @return * @return
*/ */
@PostMapping("/sms/template") @PostMapping("/sms/template")
public String template(@RequestBody XfaceDmHubTemplateRequestDTO params) { public String template(@RequestBody DmHubTemplateRequest params) {
log.info("**********创建模板入参*******:{}", JSONObject.toJSONString(params)); log.info("**********创建模板入参*******:{}", JSONObject.toJSONString(params));
XfaceDmHubTemplateResponseDTO template = messageService.createTemplate(params); DmHubTemplateResponse template = messageService.createTemplate(params);
return "ok"; return "ok";
} }
......
package com.jz.sms.chuanlan.dto; package com.jz.sms.chuanlan.dto;
public class XfaceClSendFiexdRequestDTO { public class CLSendFixedRequest {
/** /**
* 创蓝API账号,必填 * 创蓝API账号,必填
...@@ -37,11 +37,11 @@ public class XfaceClSendFiexdRequestDTO { ...@@ -37,11 +37,11 @@ public class XfaceClSendFiexdRequestDTO {
*/ */
private String uid; private String uid;
public XfaceClSendFiexdRequestDTO() { public CLSendFixedRequest() {
} }
public XfaceClSendFiexdRequestDTO(String account, String password, String msg, String phone) { public CLSendFixedRequest(String account, String password, String msg, String phone) {
super(); super();
this.account = account; this.account = account;
this.password = password; this.password = password;
...@@ -49,7 +49,7 @@ public class XfaceClSendFiexdRequestDTO { ...@@ -49,7 +49,7 @@ public class XfaceClSendFiexdRequestDTO {
this.phone = phone; this.phone = phone;
} }
public XfaceClSendFiexdRequestDTO(String account, String password, String msg, String phone, String report) { public CLSendFixedRequest(String account, String password, String msg, String phone, String report) {
super(); super();
this.account = account; this.account = account;
this.password = password; this.password = password;
...@@ -58,7 +58,7 @@ public class XfaceClSendFiexdRequestDTO { ...@@ -58,7 +58,7 @@ public class XfaceClSendFiexdRequestDTO {
this.report = report; this.report = report;
} }
public XfaceClSendFiexdRequestDTO(String account, String password, String msg, String phone, String report, String uid) { public CLSendFixedRequest(String account, String password, String msg, String phone, String report, String uid) {
super(); super();
this.account = account; this.account = account;
this.password = password; this.password = password;
...@@ -68,7 +68,7 @@ public class XfaceClSendFiexdRequestDTO { ...@@ -68,7 +68,7 @@ public class XfaceClSendFiexdRequestDTO {
this.uid = uid; this.uid = uid;
} }
public XfaceClSendFiexdRequestDTO(String account, String password, String msg, String phone, String sendtime, String report, String uid) { public CLSendFixedRequest(String account, String password, String msg, String phone, String sendtime, String report, String uid) {
super(); super();
this.account = account; this.account = account;
this.password = password; this.password = password;
......
...@@ -4,7 +4,7 @@ import com.jz.sms.util.DateUtil; ...@@ -4,7 +4,7 @@ import com.jz.sms.util.DateUtil;
import java.text.DateFormat; import java.text.DateFormat;
public class XfaceClSendFiexdResponseDTO { public class CLSendFixedResponse {
/** /**
* 响应时间 * 响应时间
*/ */
...@@ -23,9 +23,9 @@ public class XfaceClSendFiexdResponseDTO { ...@@ -23,9 +23,9 @@ public class XfaceClSendFiexdResponseDTO {
private String code; private String code;
public XfaceClSendFiexdResponseDTO(){} public CLSendFixedResponse(){}
public XfaceClSendFiexdResponseDTO(String code,String errorMsg){ public CLSendFixedResponse(String code, String errorMsg){
this.code = code; this.code = code;
this.errorMsg = errorMsg; this.errorMsg = errorMsg;
} }
......
package com.jz.sms.chuanlan.dto; package com.jz.sms.chuanlan.dto;
public class XfaceClSendVariableRequestDTO { public class CLSendVariableRequest {
/** /**
...@@ -37,11 +37,11 @@ public class XfaceClSendVariableRequestDTO { ...@@ -37,11 +37,11 @@ public class XfaceClSendVariableRequestDTO {
*/ */
private String uid; private String uid;
public XfaceClSendVariableRequestDTO() { public CLSendVariableRequest() {
} }
public XfaceClSendVariableRequestDTO(String account, String password, String msg, String params) { public CLSendVariableRequest(String account, String password, String msg, String params) {
super(); super();
this.account = account; this.account = account;
this.password = password; this.password = password;
...@@ -49,7 +49,7 @@ public class XfaceClSendVariableRequestDTO { ...@@ -49,7 +49,7 @@ public class XfaceClSendVariableRequestDTO {
this.params = params; this.params = params;
} }
public XfaceClSendVariableRequestDTO(String account, String password, String msg, String params, String report) { public CLSendVariableRequest(String account, String password, String msg, String params, String report) {
super(); super();
this.account = account; this.account = account;
this.password = password; this.password = password;
......
package com.jz.sms.chuanlan.dto; package com.jz.sms.chuanlan.dto;
public class XfaceClSendVariableResponseDTO { public class CLSendVariableResponse {
/** /**
* 响应时间 * 响应时间
*/ */
......
package com.jz.sms.chuanlan.dto; package com.jz.sms.chuanlan.dto;
public class XfaceClTemplateRequestDTO { public class CLTemplateRequest {
} }
package com.jz.sms.chuanlan.dto; package com.jz.sms.chuanlan.dto;
public class XfaceClTemplateResponseDTO { public class CLTemplateResponse {
} }
package com.jz.sms.chuanlan.service; package com.jz.sms.chuanlan.service;
import com.jz.sms.chuanlan.dto.XfaceClSendFiexdResponseDTO; import com.jz.sms.chuanlan.dto.CLSendFixedResponse;
import com.jz.sms.chuanlan.dto.CLTemplateResponse;
import com.jz.sms.dto.*; import com.jz.sms.dto.*;
import java.util.List; import java.util.List;
...@@ -8,18 +9,18 @@ import java.util.List; ...@@ -8,18 +9,18 @@ import java.util.List;
public interface ChuanLanSmsService { public interface ChuanLanSmsService {
XfaceDmHubTemplateResponseDTO createTemplate(XfaceDmHubTemplateRequestDTO requestDTO); CLTemplateResponse createTemplate(String content, String type) throws Exception;
XfaceClSendFiexdResponseDTO sendByFixed(String batchId, String content, List<String> phoneList, String type) throws Exception; CLSendFixedResponse sendByFixed(String batchId, String content, List<String> phoneList, String type) throws Exception;
XfaceClSendFiexdResponseDTO sendByVariable(String batchId, String content, List<String> phoneList, String type) throws Exception; CLSendFixedResponse sendByVariable(String batchId, String content, List<String> phoneList, String type) throws Exception;
XfaceDmHubSendResponseDTO sendBatchByFixed(XfaceDmHubSendRequestDTO requestDTO); DmHubSendResponse sendBatchByFixed(DmHubSendRequest requestDTO);
XfaceDmHubBatchSendResponseDTO sendBatchByVariable(XfaceDmHubBatchSendRequestDTO requestDTO); DmHubBatchSendResponse sendBatchByVariable(DmHubBatchSendRequest requestDTO);
} }
...@@ -4,22 +4,24 @@ package com.jz.sms.chuanlan.service.impl; ...@@ -4,22 +4,24 @@ package com.jz.sms.chuanlan.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jz.sms.api.BizController; import com.jz.sms.api.BizController;
import com.jz.sms.chuanlan.dto.XfaceClSendFiexdRequestDTO; import com.jz.sms.chuanlan.dto.CLSendFixedRequest;
import com.jz.sms.chuanlan.dto.XfaceClSendFiexdResponseDTO; import com.jz.sms.chuanlan.dto.CLSendFixedResponse;
import com.jz.sms.chuanlan.dto.XfaceClTemplateRequestDTO; import com.jz.sms.chuanlan.dto.CLTemplateResponse;
import com.jz.sms.chuanlan.dto.XfaceClTemplateResponseDTO;
import com.jz.sms.chuanlan.service.ChuanLanSmsService; import com.jz.sms.chuanlan.service.ChuanLanSmsService;
import com.jz.sms.chuanlan.utils.ChuangLanSmsUtil; import com.jz.sms.chuanlan.utils.ChuangLanSmsUtil;
import com.jz.sms.config.SMSConfig; import com.jz.sms.config.SMSConfig;
import com.jz.sms.dto.*; import com.jz.sms.dto.*;
import com.jz.sms.util.HttpUtil;
import com.jz.sms.util.Md5Util;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import sun.swing.StringUIClientPropertyKey;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@SuppressWarnings("DuplicatedCode") @SuppressWarnings("DuplicatedCode")
...@@ -29,23 +31,41 @@ public class ChuanLanSmsServiceImpl implements ChuanLanSmsService { ...@@ -29,23 +31,41 @@ public class ChuanLanSmsServiceImpl implements ChuanLanSmsService {
private static final Logger log = LoggerFactory.getLogger(BizController.class); private static final Logger log = LoggerFactory.getLogger(BizController.class);
@Override @Override
public XfaceDmHubTemplateResponseDTO createTemplate(XfaceDmHubTemplateRequestDTO requestDTO) { public CLTemplateResponse createTemplate(String content, String type) throws Exception {
/** log.info("进入创蓝创建短信接口模板的逻辑:{}", content);
* 调用创蓝的业务逻辑..... Map<String, Object> requestMap = new HashMap<>();
* requestDTO.getXXX.... String appId;
*/ String username;
XfaceClTemplateRequestDTO clRequestDto = new XfaceClTemplateRequestDTO(); String password;
XfaceClTemplateResponseDTO clResponseDTO = new XfaceClTemplateResponseDTO(); if ("notification".equals(type)) {
/** appId = "49";
* 调用结果包装到DM Hub Response中 username = SMSConfig.notificationAccount;
*/ password = SMSConfig.notificationPassword;
XfaceDmHubTemplateResponseDTO responseDTO = new XfaceDmHubTemplateResponseDTO(); } else if ("marketing".equals(type)) {
appId = "52";
return responseDTO; username = SMSConfig.marketingAccount;
password = SMSConfig.notificationPassword;
} else {
// TODO 自定义异常
throw new Exception("");
}
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
String encrypt = Md5Util.encrypt(new StringBuffer(username).append(password).append(timestamp).toString());
requestMap.put("username", username);
requestMap.put("timestamp", timestamp);
requestMap.put("signature", encrypt);
requestMap.put("appid", appId);
requestMap.put("content", content);
log.info("请求创蓝创建短信模板的请求参数为:{}", requestMap);
String retStr = HttpUtil.doPost(SMSConfig.addTemplate, requestMap);
log.info("请求创蓝创建短信模板的返回数据为:{}", retStr);
return new CLTemplateResponse();
} }
@Override @Override
public XfaceClSendFiexdResponseDTO sendByFixed(String batchId, String content, List<String> phoneList, String type) throws Exception { public CLSendFixedResponse sendByFixed(String batchId, String content, List<String> phoneList, String type) throws Exception {
String account; String account;
String password; String password;
if ("notification".equals(type)) { if ("notification".equals(type)) {
...@@ -61,7 +81,7 @@ public class ChuanLanSmsServiceImpl implements ChuanLanSmsService { ...@@ -61,7 +81,7 @@ public class ChuanLanSmsServiceImpl implements ChuanLanSmsService {
throw new Exception("123"); throw new Exception("123");
} }
XfaceClSendFiexdRequestDTO request = new XfaceClSendFiexdRequestDTO(account, password, content, listToString(phoneList), "true", batchId); CLSendFixedRequest request = new CLSendFixedRequest(account, password, content, listToString(phoneList), "true", batchId);
String requestJson = JSONObject.toJSONString(request); String requestJson = JSONObject.toJSONString(request);
log.info("【{}】发送固定内容短信,请求上游数据为:{}", batchId, requestJson); log.info("【{}】发送固定内容短信,请求上游数据为:{}", batchId, requestJson);
...@@ -69,9 +89,9 @@ public class ChuanLanSmsServiceImpl implements ChuanLanSmsService { ...@@ -69,9 +89,9 @@ public class ChuanLanSmsServiceImpl implements ChuanLanSmsService {
log.info("【{}】发送固定内容短信,上游返回数据为:{}", batchId, requestJson); log.info("【{}】发送固定内容短信,上游返回数据为:{}", batchId, requestJson);
if (StringUtils.isBlank(responseStr)) { if (StringUtils.isBlank(responseStr)) {
return new XfaceClSendFiexdResponseDTO("500", "渠道同步响应为空"); return new CLSendFixedResponse("500", "渠道同步响应为空");
} }
XfaceClSendFiexdResponseDTO response = JSON.parseObject(responseStr, XfaceClSendFiexdResponseDTO.class); CLSendFixedResponse response = JSON.parseObject(responseStr, CLSendFixedResponse.class);
return response; return response;
} }
...@@ -87,7 +107,7 @@ public class ChuanLanSmsServiceImpl implements ChuanLanSmsService { ...@@ -87,7 +107,7 @@ public class ChuanLanSmsServiceImpl implements ChuanLanSmsService {
} }
@Override @Override
public XfaceClSendFiexdResponseDTO sendByVariable(String batchId, String content, List<String> params, String type) throws Exception { public CLSendFixedResponse sendByVariable(String batchId, String content, List<String> params, String type) throws Exception {
String account; String account;
String password; String password;
if ("notification".equals(type)) { if ("notification".equals(type)) {
...@@ -103,7 +123,7 @@ public class ChuanLanSmsServiceImpl implements ChuanLanSmsService { ...@@ -103,7 +123,7 @@ public class ChuanLanSmsServiceImpl implements ChuanLanSmsService {
throw new Exception("123"); throw new Exception("123");
} }
XfaceClSendFiexdRequestDTO request = new XfaceClSendFiexdRequestDTO(account, password, content, listToString(params), "true", batchId); CLSendFixedRequest request = new CLSendFixedRequest(account, password, content, listToString(params), "true", batchId);
String requestJson = JSONObject.toJSONString(request); String requestJson = JSONObject.toJSONString(request);
log.info("【{}】发送固定内容短信,请求上游数据为:{}", batchId, requestJson); log.info("【{}】发送固定内容短信,请求上游数据为:{}", batchId, requestJson);
...@@ -111,19 +131,19 @@ public class ChuanLanSmsServiceImpl implements ChuanLanSmsService { ...@@ -111,19 +131,19 @@ public class ChuanLanSmsServiceImpl implements ChuanLanSmsService {
log.info("【{}】发送固定内容短信,上游返回数据为:{}", batchId, requestJson); log.info("【{}】发送固定内容短信,上游返回数据为:{}", batchId, requestJson);
if (StringUtils.isBlank(responseStr)) { if (StringUtils.isBlank(responseStr)) {
return new XfaceClSendFiexdResponseDTO("500", "渠道同步响应为空"); return new CLSendFixedResponse("500", "渠道同步响应为空");
} }
XfaceClSendFiexdResponseDTO response = JSON.parseObject(responseStr, XfaceClSendFiexdResponseDTO.class); CLSendFixedResponse response = JSON.parseObject(responseStr, CLSendFixedResponse.class);
return response; return response;
} }
@Override @Override
public XfaceDmHubSendResponseDTO sendBatchByFixed(XfaceDmHubSendRequestDTO requestDTO) { public DmHubSendResponse sendBatchByFixed(DmHubSendRequest requestDTO) {
return null; return null;
} }
@Override @Override
public XfaceDmHubBatchSendResponseDTO sendBatchByVariable(XfaceDmHubBatchSendRequestDTO requestDTO) { public DmHubBatchSendResponse sendBatchByVariable(DmHubBatchSendRequest requestDTO) {
return null; return null;
} }
} }
...@@ -35,7 +35,7 @@ public class ChuangLanSmsUtil { ...@@ -35,7 +35,7 @@ public class ChuangLanSmsUtil {
httpURLConnection.setDoOutput(true); httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true); httpURLConnection.setDoInput(true);
httpURLConnection.setRequestProperty("Charset", "UTF-8"); httpURLConnection.setRequestProperty("Charset", "UTF-8");
httpURLConnection.setRequestProperty("Content-Type", "application/json"); // httpURLConnection.setRequestProperty("Content-Type", "application/json");
// PrintWriter printWriter = new PrintWriter(httpURLConnection.getOutputStream()); // PrintWriter printWriter = new PrintWriter(httpURLConnection.getOutputStream());
// printWriter.write(postContent); // printWriter.write(postContent);
......
...@@ -26,45 +26,52 @@ public class SMSConfig { ...@@ -26,45 +26,52 @@ public class SMSConfig {
public static String reportUrl; public static String reportUrl;
// 拉取短信报告地址 // 拉取短信报告地址
public static String pullReport; public static String pullReport;
// 创建短信模板
public static String addTemplate;
@Value("${system.config.chuanlan.notificationAccount}") @Value("${system.config.chuanlan.notificationAccount}")
public static void setNotificationAccount(String notificationAccount) { public void setNotificationAccount(String notificationAccount) {
SMSConfig.notificationAccount = notificationAccount; SMSConfig.notificationAccount = notificationAccount;
} }
@Value("${system.config.chuanlan.notificationPassword}") @Value("${system.config.chuanlan.notificationPassword}")
public static void setNotificationPassword(String notificationPassword) { public void setNotificationPassword(String notificationPassword) {
SMSConfig.notificationPassword = notificationPassword; SMSConfig.notificationPassword = notificationPassword;
} }
@Value("${system.config.chuanlan.marketingAccount}") @Value("${system.config.chuanlan.marketingAccount}")
public static void setMarketingAccount(String marketingAccount) { public void setMarketingAccount(String marketingAccount) {
SMSConfig.marketingAccount = marketingAccount; SMSConfig.marketingAccount = marketingAccount;
} }
@Value("${system.config.chuanlan.marketingPassword}") @Value("${system.config.chuanlan.marketingPassword}")
public static void setMarketingPassword(String marketingPassword) { public void setMarketingPassword(String marketingPassword) {
SMSConfig.marketingPassword = marketingPassword; SMSConfig.marketingPassword = marketingPassword;
} }
@Value("${system.config.chuanlan.sendFixed}") @Value("${system.config.chuanlan.sendFixed}")
public static void setSendFixed(String sendFixed) { public void setSendFixed(String sendFixed) {
SMSConfig.sendFixed = sendFixed; SMSConfig.sendFixed = sendFixed;
} }
@Value("${system.config.chuanlan.sendVariable}") @Value("${system.config.chuanlan.sendVariable}")
public static void setSendVariable(String sendVariable) { public void setSendVariable(String sendVariable) {
SMSConfig.sendVariable = sendVariable; SMSConfig.sendVariable = sendVariable;
} }
@Value("${system.config.chuanlan.reportUrl}") @Value("${system.config.chuanlan.reportUrl}")
public static void setReportUrl(String reportUrl) { public void setReportUrl(String reportUrl) {
SMSConfig.reportUrl = reportUrl; SMSConfig.reportUrl = reportUrl;
} }
@Value("${system.config.chuanlan.pullReport}") @Value("${system.config.chuanlan.pullReport}")
public static void setPullReport(String pullReport) { public void setPullReport(String pullReport) {
SMSConfig.pullReport = pullReport; SMSConfig.pullReport = pullReport;
} }
@Value("${system.config.chuanlan.addTemplate}")
public void setAddTemplate(String addTemplate) {
SMSConfig.addTemplate = addTemplate;
}
} }
...@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import java.util.List; import java.util.List;
public class XfaceDmHubBatchSendRequestDTO { public class DmHubBatchSendRequest {
// 批量发送短信的模板id // 批量发送短信的模板id
......
package com.jz.sms.dto; package com.jz.sms.dto;
public class XfaceDmHubSendResponseDTO { public class DmHubBatchSendResponse {
} }
...@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import java.util.List; import java.util.List;
public class XfaceDmHubSendRequestDTO { public class DmHubSendRequest {
// 发送短信的模板ID // 发送短信的模板ID
......
package com.jz.sms.dto; package com.jz.sms.dto;
public class XfaceDmHubTemplateResponseDTO { public class DmHubSendResponse {
} }
package com.jz.sms.dto; package com.jz.sms.dto;
public class XfaceDmHubTemplateRequestDTO { public class DmHubTemplateRequest {
private String tenantId; private String tenantId;
......
package com.jz.sms.dto;
public class DmHubTemplateResponse {
private String code;
private String msg;
public DmHubTemplateResponse() {
}
public DmHubTemplateResponse(String code, String msg) {
this.code = code;
this.msg = msg;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
package com.jz.sms.dto;
public class XfaceDmHubBatchSendResponseDTO {
}
package com.jz.sms.repository.domain; package com.jz.sms.repository.domain;
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date; import java.util.Date;
...@@ -17,20 +18,45 @@ public class SmsTemplateInfo { ...@@ -17,20 +18,45 @@ public class SmsTemplateInfo {
private String status; private String status;
// DM 模板内容
private String content; private String content;
// 上游模板内容
private String upContent;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date dateCreated; private Date dateCreated;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastUpdated; private Date lastUpdated;
private String signature; private String signature;
private String tenantId; private String tenantId;
private String templateName;
public SmsTemplateInfo() { public SmsTemplateInfo() {
} }
public String getUpContent() {
return upContent;
}
public void setUpContent(String upContent) {
this.upContent = upContent;
}
public String getTemplateName() {
return templateName;
}
public void setTemplateName(String templateName) {
this.templateName = templateName;
}
public SmsTemplateInfo(String dmTemplateId) { public SmsTemplateInfo(String dmTemplateId) {
this.dmTemplateId = dmTemplateId; this.dmTemplateId = dmTemplateId;
} }
......
...@@ -4,9 +4,27 @@ import com.jz.sms.dto.*; ...@@ -4,9 +4,27 @@ import com.jz.sms.dto.*;
public interface MessageService { public interface MessageService {
XfaceDmHubTemplateResponseDTO createTemplate(XfaceDmHubTemplateRequestDTO requestDTO); /**
* DM hub创建模板同步插件接口
*
* @param requestDTO
* @return
*/
DmHubTemplateResponse createTemplate(DmHubTemplateRequest requestDTO);
XfaceDmHubSendResponseDTO send(XfaceDmHubSendRequestDTO requestDTO); /**
* DM hub发送短信接口
*
* @param requestDTO
* @return
*/
DmHubSendResponse send(DmHubSendRequest requestDTO);
XfaceDmHubBatchSendResponseDTO batchSend(XfaceDmHubBatchSendRequestDTO requestDTO); /**
* DM hub批量发送短信接口
*
* @param requestDTO
* @return
*/
DmHubBatchSendResponse batchSend(DmHubBatchSendRequest requestDTO);
} }
...@@ -2,14 +2,12 @@ package com.jz.sms.service.impl; ...@@ -2,14 +2,12 @@ package com.jz.sms.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.jz.sms.api.BizController; import com.jz.sms.chuanlan.dto.CLSendFixedResponse;
import com.jz.sms.chuanlan.dto.XfaceClSendFiexdResponseDTO; import com.jz.sms.chuanlan.dto.CLTemplateResponse;
import com.jz.sms.chuanlan.service.ChuanLanSmsService; import com.jz.sms.chuanlan.service.ChuanLanSmsService;
import com.jz.sms.dto.*; import com.jz.sms.dto.*;
import com.jz.sms.repository.domain.SmsTemplateInfo; import com.jz.sms.repository.domain.SmsTemplateInfo;
import com.jz.sms.repository.domain.SysBatchInfo; import com.jz.sms.repository.domain.SysBatchInfo;
import com.jz.sms.repository.mapper.SysBatchMapper;
import com.jz.sms.repository.mapper.TemplateMapper;
import com.jz.sms.service.MessageService; import com.jz.sms.service.MessageService;
import com.jz.sms.service.SmsTemplateService; import com.jz.sms.service.SmsTemplateService;
import com.jz.sms.util.id.IdHandler; import com.jz.sms.util.id.IdHandler;
...@@ -20,9 +18,9 @@ import org.springframework.stereotype.Service; ...@@ -20,9 +18,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.*;
import java.util.Date; import java.util.regex.Matcher;
import java.util.List; import java.util.regex.Pattern;
@Service @Service
public class MessageServiceImpl implements MessageService { public class MessageServiceImpl implements MessageService {
...@@ -45,10 +43,10 @@ public class MessageServiceImpl implements MessageService { ...@@ -45,10 +43,10 @@ public class MessageServiceImpl implements MessageService {
* @return * @return
*/ */
@Override @Override
public XfaceDmHubTemplateResponseDTO createTemplate(XfaceDmHubTemplateRequestDTO requestDTO) { public DmHubTemplateResponse createTemplate(DmHubTemplateRequest requestDTO) {
log.info("进入创建短信模板业务逻辑,入参:{}", requestDTO); log.info("进入创建短信模板业务逻辑,入参:{}", requestDTO);
XfaceDmHubTemplateResponseDTO responseDTO = new XfaceDmHubTemplateResponseDTO(); DmHubTemplateResponse responseDTO = new DmHubTemplateResponse("200", "成功");
try { try {
String templateContent = requestDTO.getTemplateContent(); String templateContent = requestDTO.getTemplateContent();
String signature = requestDTO.getSignature(); String signature = requestDTO.getSignature();
...@@ -57,6 +55,8 @@ public class MessageServiceImpl implements MessageService { ...@@ -57,6 +55,8 @@ public class MessageServiceImpl implements MessageService {
String templateId = requestDTO.getTemplateId(); String templateId = requestDTO.getTemplateId();
String templateName = requestDTO.getTemplateName(); String templateName = requestDTO.getTemplateName();
// 替换模板格式,保存适合创蓝发送短信的模板,避免发送时修改模板格式
String upContent = dmHub2ChuanLan(templateContent);
SmsTemplateInfo info = new SmsTemplateInfo(); SmsTemplateInfo info = new SmsTemplateInfo();
info.setContent(templateContent); info.setContent(templateContent);
...@@ -64,25 +64,90 @@ public class MessageServiceImpl implements MessageService { ...@@ -64,25 +64,90 @@ public class MessageServiceImpl implements MessageService {
info.setDmTemplateId(templateId); info.setDmTemplateId(templateId);
info.setTenantId(tenantId); info.setTenantId(tenantId);
info.setId(IdHandler.nextId()); info.setId(IdHandler.nextId());
info.setSignature(signature);
info.setTemplateName(templateName);
info.setDateCreated(new Date());
info.setLastUpdated(new Date());
info.setUpContent(upContent);
boolean insert = smsTemplateService.insert(info); boolean insert = smsTemplateService.insert(info);
if (!insert) { if (!insert) {
//TODO 发送告警 //TODO 发送告警
} }
CLTemplateResponse template = chuanLanSmsService.createTemplate(templateContent, smsType);
} catch (Exception exception) { } catch (Exception exception) {
// 记录异常日志 log.error("错误信息", exception);
throw exception; responseDTO = new DmHubTemplateResponse("500", "系统异常");
} }
return responseDTO; return responseDTO;
} }
public String dmHub2ChuanLan(String content) {
// String content = "亲爱的${name@0!\"\"},您好!点击以下链接可以获取10元优惠券哦! ${surl!'https://www.baidu.com/?abcdesf=${name}&cl_sr=短消息'}";
// String content = "亲爱的${name@6!\"\"},您的手机号码:${mobile@12!\"\"}参与了优惠活动,详见: ${surl!'https://www.baidu.com/?cl_sr=短消息'} 回TD退订";
// String content = "感谢你的关注";
// String content = "亲爱的${name@0!\"\"},您好!点击以下链接可以获取10元优惠券哦! ${surl!'https://www.baidu.com/?abcdesf=${name}&cl_sr=短消息'}";
//
boolean flag = false;
if (content.contains("${surl!")) {
content = content.replaceAll("\\$\\{surl!'", "");
flag = true;
}
String upContent = content;
String regex = "\\$\\{[^}]+\\}";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(content);
List<String> groups = new ArrayList<>();
while (matcher.find()) {
String group = matcher.group();
groups.add(group);
}
for (String g : groups) {
String t = g;
g = Matcher.quoteReplacement(g);
g = escapeRegex(g);
if (g.contains("\\$\\{surl!")) {
int i = content.indexOf("${surl!");
String[] split = content.split(g);
StringBuilder sb = new StringBuilder();
String TmpContent = content.substring(i + "${surl!'".length(), i + t.length() - 2);
sb.append(split[0]).append(TmpContent).append(split[1]);
content = sb.toString();
}
content = content.replaceAll(g, "\\{\\$var\\}");
}
if (flag) {
content = content.replaceAll("'\\}", "");
}
// System.out.println(content);
return content;
}
public String escapeRegex(String s) {
String[] symbols = new String[]{"\\/", "\\[", "\\]", "\\(", "\\)", "\\{", "\\}", "\\?", "\\+", "\\*", "\\|", "\\.", "\\^", "\\-", "\\^"};
if (s != null) {
for (String sym : symbols) {
s = s.replaceAll(sym, "\\" + sym);
}
}
return s;
}
@Override @Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public XfaceDmHubSendResponseDTO send(XfaceDmHubSendRequestDTO requestDTO) { public DmHubSendResponse send(DmHubSendRequest requestDTO) {
try { try {
String dmHubBatchId = requestDTO.getBatchId(); String dmHubBatchId = requestDTO.getBatchId();
String templateId = requestDTO.getTemplateId(); String templateId = requestDTO.getTemplateId();
...@@ -115,10 +180,27 @@ public class MessageServiceImpl implements MessageService { ...@@ -115,10 +180,27 @@ public class MessageServiceImpl implements MessageService {
// 判断模板是固定短信还是变量短信 // 判断模板是固定短信还是变量短信
String content = templateInfo.getContent(); String content = templateInfo.getContent();
if (content.contains("${")) {// TODO 判断方式待定 // String content2 = "亲爱的${name@6!\"\"},您的手机号码:${mobile@12!\"\"}参与了优惠活动,详见: ${surl!'https://www.baidu.com/?cl_sr=短消息'} 回TD退订";
String regex = "\\$\\{[^}]+\\}";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(content);
List<String> list = new ArrayList<>();
while (matcher.find()) {
String group = matcher.group();
list.add(group);
}
log.info("模板变量参数为:{}", list.toString());
if (list.size() > 0) {
// 变量模板 // 变量模板
// 3、模板参数文本替换。获取模板中的动态参内容,替换成创蓝需要的格式${var}.将请求中的参数信息和模板中的变量名对应起来,封装创蓝请求参数 // 3、模板参数文本替换。获取模板中的动态参内容,替换成创蓝需要的格式${var}.将请求中的参数信息和模板中的变量名对应起来,封装创蓝请求参数
XfaceClSendFiexdResponseDTO chuanglanResponse = chuanLanSmsService.sendByFixed(dmHubBatchId, content, phoneList, type); for (String str : list) {
}
CLSendFixedResponse chuanglanResponse = chuanLanSmsService.sendByFixed(dmHubBatchId, content, phoneList, type);
} else { } else {
// 固定模板 // 固定模板
...@@ -135,7 +217,9 @@ public class MessageServiceImpl implements MessageService { ...@@ -135,7 +217,9 @@ public class MessageServiceImpl implements MessageService {
} }
@Override @Override
public XfaceDmHubBatchSendResponseDTO batchSend(XfaceDmHubBatchSendRequestDTO requestDTO) { public DmHubBatchSendResponse batchSend(DmHubBatchSendRequest requestDTO) {
return null; return null;
} }
} }
package com.jz.sms.util;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import sun.net.www.http.HttpClient;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class HttpUtil {
public static String sendPost(String url, String param) {
PrintWriter out = null;
BufferedReader in = null;
String result = "";
try {
URL realUrl = new URL(url);
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// 获取URLConnection对象对应的输出流
out = new PrintWriter(conn.getOutputStream());
// 发送请求参数
out.print(param);
// flush输出流的缓冲
out.flush();
// 定义BufferedReader输入流来读取URL的响应
in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
} catch (Exception e) {
System.out.println("发送 POST 请求出现异常!"+e);
e.printStackTrace();
}
//使用finally块来关闭输出流、输入流
finally{
try{
if(out!=null){
out.close();
}
if(in!=null){
in.close();
}
}
catch(IOException ex){
ex.printStackTrace();
}
}
return result;
}
public static String doPost(String url, Map params) {
BufferedReader in = null;
try {
// 定义HttpClient
CloseableHttpClient build = HttpClientBuilder.create().build();
// 实例化HTTP方法
HttpPost request = new HttpPost();
request.setURI( new URI( url ) );
//设置参数
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
for (Iterator iter = params.keySet().iterator(); iter.hasNext(); ) {
String name = (String) iter.next();
String value = String.valueOf( params.get( name ) );
nvps.add( new BasicNameValuePair( name, value ) );
//System.out.println(name +"-"+value);
}
request.setEntity( new UrlEncodedFormEntity( nvps, HTTP.UTF_8 ) );
HttpResponse response = build.execute( request );
int code = response.getStatusLine().getStatusCode();
if (code == 200) { //请求成功
in = new BufferedReader( new InputStreamReader( response.getEntity()
.getContent(), "utf-8" ) );
StringBuffer sb = new StringBuffer( "" );
String line = "";
String NL = System.getProperty( "line.separator" );
while ((line = in.readLine()) != null) {
sb.append( line + NL );
}
in.close();
return sb.toString();
} else { //
System.out.println( "状态码:" + code );
return null;
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
package com.jz.sms.util;
import java.security.MessageDigest;
public class Md5Util {
//盐,用于混交md5
public static String encrypt(String dataStr) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(dataStr.getBytes("UTF8"));
byte s[] = m.digest();
String result = "";
for (int i = 0; i < s.length; i++) {
result += Integer.toHexString((0x000000FF & s[i]) | 0xFFFFFF00).substring(6);
}
return result;
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
}
package com.jz.sms.wrapper.maintenance; package com.jz.sms.wrapper.maintenance;
import com.jz.sms.dto.XfaceDmHubTemplateRequestDTO; import com.jz.sms.dto.DmHubTemplateRequest;
import com.jz.sms.dto.XfaceDmHubTemplateResponseDTO; import com.jz.sms.dto.DmHubTemplateResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -20,7 +20,7 @@ public class XfaceCreateTempLateWrapper { ...@@ -20,7 +20,7 @@ public class XfaceCreateTempLateWrapper {
// @ApiOperation(value = "SMS0001 短信模板创建", httpMethod = "POST") // @ApiOperation(value = "SMS0001 短信模板创建", httpMethod = "POST")
@PostMapping(value = "/sms/template") @PostMapping(value = "/sms/template")
@ResponseBody @ResponseBody
public XfaceDmHubTemplateResponseDTO processRequest(@Valid @RequestBody XfaceDmHubTemplateRequestDTO requestDTO) { public DmHubTemplateResponse processRequest(@Valid @RequestBody DmHubTemplateRequest requestDTO) {
return xfaceCreateTempLateWrapperImpl.doProcessRequest(requestDTO); return xfaceCreateTempLateWrapperImpl.doProcessRequest(requestDTO);
} }
......
package com.jz.sms.wrapper.maintenance; package com.jz.sms.wrapper.maintenance;
import com.jz.sms.dto.XfaceDmHubTemplateRequestDTO; import com.jz.sms.dto.DmHubTemplateRequest;
import com.jz.sms.dto.XfaceDmHubTemplateResponseDTO; import com.jz.sms.dto.DmHubTemplateResponse;
import com.jz.sms.service.impl.MessageServiceImpl; import com.jz.sms.service.impl.MessageServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -12,7 +12,7 @@ public class XfaceCreateTempLateWrapperImpl { ...@@ -12,7 +12,7 @@ public class XfaceCreateTempLateWrapperImpl {
@Autowired @Autowired
private MessageServiceImpl messageService; private MessageServiceImpl messageService;
public XfaceDmHubTemplateResponseDTO doProcessRequest(XfaceDmHubTemplateRequestDTO requestDTO) { public DmHubTemplateResponse doProcessRequest(DmHubTemplateRequest requestDTO) {
return messageService.createTemplate(requestDTO); return messageService.createTemplate(requestDTO);
} }
......
...@@ -26,3 +26,4 @@ system: ...@@ -26,3 +26,4 @@ system:
sendVariable: http://smssh1.253.com/msg/variable/json # 变量短信下发接口 sendVariable: http://smssh1.253.com/msg/variable/json # 变量短信下发接口
reportUrl: http://test.9z.com/msg/report # 短信报告 reportUrl: http://test.9z.com/msg/report # 短信报告
pullReport: http://smssh1.253.com/msg/pull/report # 拉取短信报告 pullReport: http://smssh1.253.com/msg/pull/report # 拉取短信报告
addTemplate: https://zz.253.com/apis/template/add # 创建短信模板
\ No newline at end of file
...@@ -20,11 +20,12 @@ system: ...@@ -20,11 +20,12 @@ system:
config: config:
chuanlan: chuanlan:
notificationAccount: N0767543 # 通知类短信账号 notificationAccount: N0767543 # 通知类短信账号
notificationPassword: N0767543 # 通知类短信密码 notificationPassword: DaejS7P5ixaeee # 通知类短信密码
marketingAccount: M7603731 # 营销类短信账号 marketingAccount: M7603731 # 营销类短信账号
marketingPassword: N0767543 # 营销类短信密码 marketingPassword: N0767543 # 营销类短信密码
sendFixed: http://smssh1.253.com/msg/send/json # 短信下发接口 sendFixed: http://smssh1.253.com/msg/send/json # 短信下发接口
sendVariable: http://smssh1.253.com/msg/variable/json # 变量短信下发接口 sendVariable: http://smssh1.253.com/msg/variable/json # 变量短信下发接口
reportUrl: http://test.9z.com/msg/report # 短信报告 reportUrl: http://test.9z.com/msg/report # 短信报告
pullReport: http://smssh1.253.com/msg/pull/report # 拉取短信报告 pullReport: http://smssh1.253.com/msg/pull/report # 拉取短信报告
addTemplate: https://zz.253.com/apis/template/add # 创建短信模板
...@@ -22,4 +22,4 @@ logging: ...@@ -22,4 +22,4 @@ logging:
level.com.jz: debug # 单独指定包下的日志级别 level.com.jz: debug # 单独指定包下的日志级别
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
file: file:
path: logs path: logs.log
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment