Bladeren bron

修改为独立服务

杨杰 4 jaren geleden
bovenliggende
commit
2af1d8d3b9

+ 0 - 16
pom.xml

@@ -13,7 +13,6 @@
 		<groupId>org.springframework.boot</groupId>
 		<artifactId>spring-boot-starter-parent</artifactId>
 		<version>2.0.3.RELEASE</version>
-		<relativePath />
 	</parent>
 
 	<properties>
@@ -25,10 +24,6 @@
 
 	<dependencies>
 		<dependency>
-			<groupId>org.springframework.cloud</groupId>
-			<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
-		</dependency>
-		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-web</artifactId>
 		</dependency>
@@ -41,11 +36,6 @@
 			<artifactId>spring-boot-starter-mail</artifactId>
 		</dependency>
 		<dependency>
-			<groupId>de.codecentric</groupId>
-			<artifactId>spring-boot-admin-starter-client</artifactId>
-			<version>2.0.1</version>
-		</dependency>
-		<dependency>
 			<groupId>com.aliyun</groupId>
 			<artifactId>aliyun-java-sdk-core</artifactId>
 			<version>4.4.2</version>
@@ -67,12 +57,6 @@
 		</dependency>
 
 		<dependency>
-			<groupId>com.llisoft</groupId>
-			<artifactId>mta-common</artifactId>
-			<version>3.9.1-SNAPSHOT</version>
-		</dependency>
-
-		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-test</artifactId>
 			<scope>test</scope>

+ 0 - 2
src/main/java/com/llisoft/sms/Application.java

@@ -4,11 +4,9 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
 import org.springframework.scheduling.annotation.EnableAsync;
 
 @EnableAsync // 启动异步任务
-@EnableEurekaClient // 注册中心客户端 同类注解 @EnableDiscoveryClient
 @SpringBootApplication
 public class Application {
 	

+ 2 - 3
src/main/java/com/llisoft/sms/config/ExceptionHandlerConfig.java

@@ -10,9 +10,8 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 import org.springframework.web.servlet.NoHandlerFoundException;
 
-import com.llisoft.common.constant.CodeEnum;
-import com.llisoft.common.exception.MtaException;
-import com.llisoft.common.vo.ResponseVo;
+import com.llisoft.sms.vo.CodeEnum;
+import com.llisoft.sms.vo.ResponseVo;
 
 /**
  * 统一处理业务异常 controller

+ 35 - 0
src/main/java/com/llisoft/sms/config/MtaException.java

@@ -0,0 +1,35 @@
+package com.llisoft.sms.config;
+
+import javax.servlet.ServletException;
+
+import com.llisoft.sms.vo.CodeEnum;
+
+/**
+ * 自定义业务异常
+ * @author YangJie [2019年1月4日]
+ */
+@SuppressWarnings("serial")
+public class MtaException extends ServletException {
+	
+	private CodeEnum codeEnum;
+
+	
+	public MtaException(String msg) {
+		super(msg);
+	}
+
+	public MtaException(CodeEnum codeEnum) {
+		super(codeEnum.getMsg());
+		this.codeEnum = codeEnum;
+	}
+
+	public static MtaException build(String msg) {
+		return new MtaException(msg);
+	}
+	
+
+	public CodeEnum getCodeEnum() {
+		return codeEnum;
+	}
+
+}

+ 10 - 3
src/main/java/com/llisoft/sms/controller/SmsController.java

@@ -8,12 +8,13 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
-import com.llisoft.common.exception.MtaException;
-import com.llisoft.common.util.ServletUtil;
-import com.llisoft.common.vo.ResponseVo;
+import com.llisoft.sms.config.MtaException;
 import com.llisoft.sms.service.SmsService;
+import com.llisoft.sms.util.ServletUtil;
 import com.llisoft.sms.vo.CheckCodeRequestVo;
+import com.llisoft.sms.vo.ResponseVo;
 import com.llisoft.sms.vo.SendCodeRequestVo;
+import com.llisoft.sms.vo.SendNoCodeRequestVo;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -32,6 +33,12 @@ public class SmsController {
 		return ResponseVo.success(smsService.sendCode(requestVo.getPhone(), requestVo.getAppkey(), requestVo.getScene(), requestVo.getToken(), 
 			requestVo.getSessionid(), requestVo.getSig(), ServletUtil.getIp(request), requestVo.getType()));
 	}
+
+	@ApiOperation(value="发送验证码-无参")
+	@PostMapping("/sendNosigCode")
+	public ResponseVo<Boolean> sendNoCode(@Valid @RequestBody SendNoCodeRequestVo requestVo) throws Exception{
+		return ResponseVo.success(smsService.sendNoCode(requestVo.getPhone()));
+	}
 	
 	@ApiOperation(value="发送消息")
 	@PostMapping("/sendMsg")

+ 0 - 37
src/main/java/com/llisoft/sms/controller/feign/FeignMailController.java

@@ -1,37 +0,0 @@
-package com.llisoft.sms.controller.feign;
-
-import java.util.Objects;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.llisoft.common.vo.feign.FeignMailSendRequestVo;
-import com.llisoft.sms.service.MailService;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-
-@Api(tags="【内部接口】邮件")
-@RestController
-@RequestMapping("/feign/mail")
-public class FeignMailController {
-	
-	@Autowired
-	private MailService mailService;
-	
-	
-	@ApiOperation(value="发送邮件")
-	@PostMapping("/send")
-	public void send(@RequestBody FeignMailSendRequestVo requestVo) {
-		String[] emails = requestVo.getEmails();
-		if (Objects.isNull(emails) || emails.length<=0) { // 发送到默认系统管理员
-			mailService.sendMail(requestVo.getSubject(), requestVo.getText());
-		}else {
-			mailService.sendMail(requestVo.getSubject(), requestVo.getText(), emails);
-		}
-	}
-	
-}

+ 0 - 29
src/main/java/com/llisoft/sms/controller/feign/FeignSmsController.java

@@ -1,29 +0,0 @@
-package com.llisoft.sms.controller.feign;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.llisoft.common.exception.MtaException;
-import com.llisoft.sms.service.SmsService;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-
-@Api(tags="【内部接口】短信")
-@RestController
-@RequestMapping("/feign/msg")
-public class FeignSmsController {
-	
-	@Autowired
-	private SmsService smsService;
-	
-	
-	@ApiOperation(value="核对验证码")
-	@PostMapping("/checkCode")
-	public boolean checkCode(String phone, String code) throws MtaException{
-		return smsService.checkCode(phone, code);
-	}
-	
-}

+ 5 - 5
src/main/java/com/llisoft/sms/service/AliyunService.java

@@ -19,7 +19,7 @@ import com.aliyuncs.afs.model.v20180112.AuthenticateSigResponse;
 import com.aliyuncs.exceptions.ClientException;
 import com.aliyuncs.http.MethodType;
 import com.aliyuncs.profile.DefaultProfile;
-import com.llisoft.common.util.JsonUtil;
+import com.llisoft.sms.util.JsonUtil;
 
 /**
  * 阿里云SMS接口调用
@@ -67,11 +67,11 @@ public class AliyunService {
         request.setSysVersion("2017-05-25"); // 固定字符串
         request.putQueryParameter("PhoneNumbers", phone);
         if (type == 0) { // 麦塔
-        	request.putQueryParameter("SignName", "麦塔考试系统"); // 签名
-        	request.putQueryParameter("TemplateCode", "SMS_174805689"); // 模板ID
+        	request.putQueryParameter("SignName", "麦塔"); // 签名
+        	request.putQueryParameter("TemplateCode", "SMS_216836530"); // 模板ID
 		}else if (type == 1) { // 青谷
-			request.putQueryParameter("SignName", "青谷考试系统"); // 签名
-			request.putQueryParameter("TemplateCode", "SMS_176533558"); // 模板ID
+			request.putQueryParameter("SignName", "麦塔带货云"); // 签名
+			request.putQueryParameter("TemplateCode", "SMS_216836530"); // 模板ID
 		}
         request.putQueryParameter("TemplateParam", "{\"code\":\""+code+"\"}");
         try {

+ 0 - 64
src/main/java/com/llisoft/sms/service/MailService.java

@@ -1,64 +0,0 @@
-package com.llisoft.sms.service;
-
-import java.util.Arrays;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.mail.SimpleMailMessage;
-import org.springframework.mail.javamail.JavaMailSenderImpl;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Service;
-
-/**
- * 邮件发送工具类
- * @author YangJie [2019年10月10日]
- */
-@Service
-public class MailService {
-	
-	private Logger logger = LoggerFactory.getLogger(MailService.class);
-	
-	@Value("${mta.debug}")
-	private boolean debug;
-	@Value("${mta.emails}")
-	private String[] emails;
-	
-	@Autowired
-	private JavaMailSenderImpl javaMailSender;
-
-	
-	/**
-	 * 发送邮件
-	 * @param subject 主题 	
-	 * @param text 邮件内容
-	 * 注意主线程结束后线程池中任务不会继续执行
-	 */
-	@Async // 此注解表示方法异步执行, 在同一个类中调用无效, 因为spring会生成动态代理类完成异步调用
-	public void sendMail(String subject, String text){
-		sendMail(subject, text, emails);
-	}
-	
-	/**
-	 * 发送邮件
-	 * @param subject 主题 	
-	 * @param text 邮件内容
-	 * @param tos 收件人列表
-	 */
-	@Async // 此注解表示方法异步执行, 在同一个类中调用无效, 因为spring会生成动态代理类完成异步调用
-	public void sendMail(String subject, String text, String... emails){
-		if (debug) { // 开发模式不发邮件
-			logger.info("开发模式不发邮件:{}", subject);
-			return;
-		}
-		SimpleMailMessage mailMessage = new SimpleMailMessage(); 
-		mailMessage.setFrom(javaMailSender.getUsername());
-		mailMessage.setTo(emails);
-		mailMessage.setSubject(subject);
-		mailMessage.setText(text==null ? "" : text);
-		javaMailSender.send(mailMessage);
-		logger.info("已向邮箱{}发送了主题为[{}]的邮件", Arrays.asList(emails), subject);
-	}
-	
-}

+ 27 - 2
src/main/java/com/llisoft/sms/service/SmsService.java

@@ -9,8 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
-import com.llisoft.common.exception.MtaException;
-import com.llisoft.common.util.CodeUtil;
+import com.llisoft.sms.config.MtaException;
+import com.llisoft.sms.util.CodeUtil;
 import com.llisoft.sms.util.RedisUtil;
 
 /**
@@ -61,6 +61,31 @@ public class SmsService {
 	}
 	
 	/**
+	 * 发送无参验证码
+	 * 同手机号 每分钟1条/每小时5条/每天10条
+	 * @param phone
+	 * @throws Exception 
+	 */
+	public boolean sendNoCode(String phone) throws Exception {
+		// 检查人机验证码
+		if (debug) {
+			logger.warn("开发模式:人机验证已跳过");
+		}
+		// 检查号码
+		logger.debug("检查手机号: {}", phone);
+		if(!this.checkSend(phone)) {
+			logger.warn("手机号被限制发送:{}", phone);
+			throw new MtaException("此号码被限制发送:" + phone);
+		}
+		// 发送短信
+		String code = String.valueOf(CodeUtil.ints(4));
+		RedisUtil.set(phone + "_" + code, "", 10, TimeUnit.MINUTES); // 有效期10分钟
+		logger.debug("发送验证码: {}", code);
+		aliyunService.sms(phone, code, 0); // 第三方发送短信(异步)
+		return true;
+	}
+	
+	/**
 	 * 检查发送
 	 * @param phone
 	 * @return

+ 58 - 0
src/main/java/com/llisoft/sms/util/CodeUtil.java

@@ -0,0 +1,58 @@
+package com.llisoft.sms.util;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Random;
+import java.util.UUID;
+
+/**
+ * 生成各种随机码/随机数等
+ * @author YangJie [2019年6月27日]
+ */
+public class CodeUtil {
+
+	/**
+	 * UUID
+	 * @return
+	 */
+	public static String uuid() {
+		return UUID.randomUUID().toString().replace("-", "").toLowerCase();
+	}
+	
+	/**
+	 * 当前时间精确到毫秒 + 5位随机数
+	 * @return
+	 */
+	public static String time() {
+		return new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + ints(5);
+	}
+	
+	/**
+	 * 随机数字 (支持[1-10]位)
+	 * @param n
+	 * @return
+	 */
+	public static String ints(int n) {
+		int min = (int)Math.pow(10, n-1);
+		int max = (int)Math.pow(10, n) - min - 1;
+		return String.valueOf(new Random().nextInt(max) + min);
+	}
+	
+	/**
+	 * 随机字符串 (支持[1-64]位)
+	 * @param n
+	 * @return
+	 */
+	public static String strs(int n) {
+		String str = UUID.randomUUID().toString().replace("-", "");
+		if (n>0 && n<=32) {
+			return str.substring(0, n);
+		}
+		str += UUID.randomUUID().toString().replace("-", "");
+		if (n>32 && n<=64) {
+			return str.substring(0, n);
+		}
+		return null;
+	}
+
+}

+ 100 - 0
src/main/java/com/llisoft/sms/util/JsonUtil.java

@@ -0,0 +1,100 @@
+package com.llisoft.sms.util;
+
+import java.util.Objects;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * Json处理工具类
+ * @author YangJie [2018年12月26日]
+ */
+public class JsonUtil {
+	
+	private static Logger logger = LoggerFactory.getLogger(JsonUtil.class);
+
+	public static ObjectMapper objectMapper = new ObjectMapper()
+			.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); // 忽略未知属性
+	
+	
+	/**
+	 * 对象转json
+	 * @param object
+	 * @return
+	 * @throws Exception 
+	 */
+	public static String toJson(Object object) throws Exception{
+		try {
+			if (Objects.nonNull(object)) {
+				return objectMapper.writeValueAsString(object);
+			}
+			return "";
+		} catch (Exception e) {
+			logger.error("object转json异常:" + object, e);
+			throw e;
+		}
+	}
+	
+	/**
+	 * json转对象
+	 * @param json
+	 * @param valueType
+	 * @return
+	 * @throws Exception 
+	 */
+	public static <T> T toObject(String json, Class<T> valueType) throws Exception {
+		try {
+			if(Objects.nonNull(json) && !json.trim().isEmpty()) {
+				return objectMapper.readValue(json, valueType);
+			}
+			return null;
+		} catch (Exception e) {
+			logger.error("json转object异常:" + json, e);
+			throw e;
+		}
+	}
+	
+	/**
+	 * json转对象(处理容器类型对象) 
+	 * List<bean> : json, List.class, Bean.class
+	 * Map<bean1, bean2> : json, Map.class, Bean1.class, Bean2.class
+	 * @param json
+	 * @param valueTypeRef
+	 * @return
+	 * @throws Exception 
+	 */
+	public static <T> T toObject(String json, Class<?> collectionClass, Class<?>... elementClasses) throws Exception {
+		try {
+			if(Objects.nonNull(json) && !json.trim().isEmpty()) {
+				return objectMapper.readValue(json, objectMapper.getTypeFactory().constructParametricType(collectionClass, elementClasses));
+			}
+			return null;
+		} catch (Exception e) {
+			logger.error("json转object异常:" + json, e);
+			throw e;
+		}
+	}
+	
+	/**
+	 * json转对象(处理复杂类型对象) 
+	 * List<List<Object>> : (json, new TypeReference<List<List<Object>>>(){})
+	 * Map<String, List<List<Object>>> : (json, new TypeReference<Map<String, List<List<Object>>>(){})
+	 * @param json
+	 * @param valueType
+	 * @return
+	 * @throws Exception 
+	 */
+	public static <T> T toObject(String json, TypeReference<T> typeReference) throws Exception {
+		try {
+			return objectMapper.readValue(json, typeReference);
+		} catch (Exception e) {
+			logger.error("json转object异常:" + json, e);
+			throw e;
+		}
+	}
+
+}

+ 0 - 2
src/main/java/com/llisoft/sms/util/RedisUtil.java

@@ -8,8 +8,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Component;
 
-import com.llisoft.common.util.JsonUtil;
-
 /**
  * redis处理
  * @author YangJie [2018年12月26日]

+ 47 - 0
src/main/java/com/llisoft/sms/util/ServletUtil.java

@@ -0,0 +1,47 @@
+package com.llisoft.sms.util;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import javax.servlet.http.HttpServletRequest;
+
+import com.llisoft.sms.config.MtaException;
+
+public class ServletUtil {
+	
+	/**
+	 * 获取客户端IP
+	 * @param request
+	 * @return
+	 * @throws MtaException 
+	 */
+	public static String getIp(HttpServletRequest request) throws MtaException {
+	    String ip = request.getHeader("X-Real-IP");
+	    if (Objects.isNull(ip) || ip.trim().isEmpty()) {
+	    	ip = request.getHeader("X-Forwarded-For");
+	    	if (Objects.isNull(ip) || ip.trim().isEmpty()) {
+	    		throw new MtaException("无法获取客户端真实IP");
+	    	}
+		}
+	    return ip.contains(",") ? ip.split(",")[0] : ip;
+	}
+	
+	/**
+	 * 获取参数Map<String, String>
+	 * @param request
+	 * @return
+	 */
+	public static Map<String, String> getParamMap(HttpServletRequest request){
+		Map<String, String> returnMap = new HashMap<String, String>();
+		Map<String, String[]> paramMap = request.getParameterMap();
+		for (String key: paramMap.keySet()) {
+			String[] values = paramMap.get(key);
+			if (values!=null && values.length>0) {
+				returnMap.put(key, values[0]);
+			}
+		}
+		return returnMap;
+	}
+
+}

+ 45 - 0
src/main/java/com/llisoft/sms/vo/CodeEnum.java

@@ -0,0 +1,45 @@
+package com.llisoft.sms.vo;
+
+/**
+ * 返回状态枚举
+ * @author YangJie [2018年12月27日]
+ */
+public enum CodeEnum {
+	
+	SUCCESS(0, "请求成功"),
+	FAIL(1001, "请求失败"),
+	
+	// 全局异常
+	C400(400, "参数错误"),
+	C401(401, "登录超时"),
+	C402(402, "签名错误"),
+	C403(403, "无权访问"),
+	C404(404, "请求无效"),
+	C500(500, "系统错误");
+
+	
+	private int code;
+	private String msg; 
+	
+	CodeEnum(int code, String msg) {
+		this.code = code;
+		this.msg = msg;
+	}
+
+	public int getCode() {
+		return code;
+	}
+
+	public void setCode(int code) {
+		this.code = code;
+	}
+
+	public String getMsg() {
+		return msg;
+	}
+
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+
+}

+ 122 - 0
src/main/java/com/llisoft/sms/vo/ResponseVo.java

@@ -0,0 +1,122 @@
+package com.llisoft.sms.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel("公共返回实体")
+public class ResponseVo<T> {
+
+	@ApiModelProperty(value="代码", required=true)
+	private int code;
+	@ApiModelProperty(value="信息", required=true)
+	private String msg; 
+	@ApiModelProperty("数据")
+    private T data;
+
+    
+    /**
+     * 默认成功方法
+     * @param data
+     * @return
+     */
+    public static <T> ResponseVo<T> success(T data){
+    	return ResponseVo.build(data, CodeEnum.SUCCESS); 
+    }
+
+    /**
+     * 默认成功方法
+     * @param data
+     * @return 
+     * @return
+     */
+    public static <T> ResponseVo<T> success(T data, String msg){
+    	return ResponseVo.build(data, CodeEnum.SUCCESS.getCode(), msg); 
+    }
+    
+    /**
+     * 默认失败方法
+     * @param data
+     * @return
+     */
+    public static <T> ResponseVo<T> fail(T data){
+    	return ResponseVo.build(data, CodeEnum.FAIL); 
+    }
+    
+    /**
+     * 默认失败方法
+     * @param data
+     * @return
+     */
+    public static <T> ResponseVo<T> fail(String msg){
+    	return ResponseVo.build(null, CodeEnum.FAIL.getCode(), msg); 
+    }
+    
+    /**
+     * 默认失败方法
+     * @param data
+     * @return
+     */
+    public static <T> ResponseVo<T> fail(T data, String msg){
+    	return ResponseVo.build(data, CodeEnum.FAIL.getCode(), msg); 
+    }
+	
+    /**
+     * 默认构建方法
+     * @param data
+     * @return
+     */
+    public static <T> ResponseVo<T> build(CodeEnum codeEnum){
+    	return ResponseVo.build(null, codeEnum); 
+    }
+    
+    /**
+     * 默认构建方法
+     * @param data
+     * @return
+     */
+    public static <T> ResponseVo<T> build(T data, CodeEnum codeEnum){
+    	return ResponseVo.build(data, codeEnum.getCode(), codeEnum.getMsg()); 
+    }
+    
+    /**
+     * 默认构建方法
+     * @param data
+     * @return
+     */
+    public static <T> ResponseVo<T> build(int code, String msg){
+    	return build(null, code, msg); 
+    }
+    
+    /**
+     * 默认构建方法
+     * @param data
+     * @return
+     */
+    public static <T> ResponseVo<T> build(T data, int code, String msg){
+    	ResponseVo<T> responseBean = new ResponseVo<>();
+    	responseBean.setCode(code);
+    	responseBean.setMsg(msg);
+    	responseBean.setData(data);
+    	return responseBean; 
+    }
+    
+	public int getCode() {
+		return code;
+	}
+	public void setCode(int code) {
+		this.code = code;
+	}
+	public String getMsg() {
+		return msg;
+	}
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+	public T getData() {
+		return data;
+	}
+	public void setData(T data) {
+		this.data = data;
+	}
+
+}

+ 33 - 0
src/main/java/com/llisoft/sms/vo/SendNoCodeRequestVo.java

@@ -0,0 +1,33 @@
+package com.llisoft.sms.vo;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Pattern;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel("发送验证码无参请求实体")
+public class SendNoCodeRequestVo {
+	
+	@ApiModelProperty(value="手机号码", example=" ")
+	@NotBlank(message="手机号码不能为空")
+	@Pattern(regexp="1[0-9]{10}", message="手机号码格式不正确")
+	private String phone;
+
+	@ApiModelProperty(value="类型(0麦塔、1青谷)")
+	private int type;
+
+	public String getPhone() {
+		return phone;
+	}
+	public void setPhone(String phone) {
+		this.phone = phone;
+	}
+	public int getType() {
+		return type;
+	}
+	public void setType(int type) {
+		this.type = type;
+	}
+
+}

+ 0 - 44
src/main/resources/application.yml

@@ -1,7 +1,6 @@
 ##自定义配置
 mta: 
   debug: true #是否测试(测试模式不发邮件)
-  emails: sunlin@mtavip.com, yangjie@mtavip.com #管理员邮箱
 
 ##端口配置
 server.port: 8002 #监听端口
@@ -11,18 +10,6 @@ sms:
   accessKeyId: LTAIuurtY1J93Uj4
   accessKeySecret: IUkNMatSHLaiTIu674ALR7Q0wUtmkT
   
-##邮件配置
-spring.mail: 
-  host: smtp.exmail.qq.com
-  username: saas-timer@mtavip.com
-  password: Timer@2019
-  properties: 
-    mail.smtp: 
-      auth: true
-      socketFactory: ##阿里云默认禁用25端口
-        class: javax.net.ssl.SSLSocketFactory
-        port: 465
- 
 ##REDIS配置
 spring.redis: 
   host: 192.168.0.172
@@ -31,41 +18,10 @@ spring.redis:
   password: 
   timeout: 1000
            
-##服务名称
-spring.application.name: mta-service-sms #服务名称
-  
-##注册中心配置
-eureka:
-  instance: 
-    preferIpAddress: true #使用ip注册服务
-    ipAddress: localhost #配置ip地址
-    instanceId: ${eureka.instance.ipAddress}:${server.port} #实例显示名称
-    leaseRenewalIntervalInSeconds: 30 #表示eureka client发送心跳给server端的频率 默认30秒
-    leaseExpirationDurationInSeconds: 90 #表示eureka server等待心跳的超时时间,在这个时间内若没收到下一次心跳,则将移除该instance, 默认为90秒
-  client:
-    healthcheck.enabled: true #开启健康检测
-    serviceUrl.defaultZone: http://192.168.0.179:8761/eureka #配置中心地址
-
-##监控端点配置    
-management:
-  server.port: 1${server.port} #监控端口
-  endpoints.web.exposure.include: "*" #开启所有端点
-  endpoint.health.show-details: always #显示健康详情
-
-##监控服务配置
-spring.boot.admin.client: 
-  url: http://localhost:1111 #监控服务地址
-  instance: #监控实例地址配置
-    serviceUrl: http://${eureka.instance.ipAddress}:${server.port}
-    healthUrl: http://${eureka.instance.ipAddress}:${management.server.port}/actuator/health
-    managementUrl: http://${eureka.instance.ipAddress}:${management.server.port}/actuator
-  
-
 ##系统异常配置
 spring.resources.addMappings: false #不为工程中的资源文件建立映射
 spring.mvc.throwExceptionIfNoHandlerFound: true #出现异常时直接抛出,使@RestControllerAdvice可以处理404等异常(需要上面配置false才能生效)
   
-  
 ##日志配置
 logging: 
   level: