Ver Fonte

1.1.0 版本

1811872455@163.com há 4 dias atrás
pai
commit
29dc032a3e

+ 0 - 6
.idea/ant.xml

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="AntConfiguration">
-    <buildFile url="file://$PROJECT_DIR$/pom.xml" />
-  </component>
-</project>

+ 4 - 2
.idea/compiler.xml

@@ -7,13 +7,14 @@
         <sourceOutputDir name="target/generated-sources/annotations" />
         <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
         <outputRelativeToContentRoot value="true" />
-        <module name="storlead-centre-api" />
         <module name="storlead-auth" />
+        <module name="storlead-centre-api" />
         <module name="storlead-common" />
         <module name="storlead-core" />
         <module name="storlead-redis" />
-        <module name="storlead-centre-service" />
         <module name="storlead-web" />
+        <module name="storlead-centre-service" />
+        <module name="storlead-mail" />
         <module name="storlead-user" />
         <module name="storlead-wx" />
         <module name="storlead-mybatis" />
@@ -38,6 +39,7 @@
       <module name="storlead-common" options="-parameters" />
       <module name="storlead-core" options="-parameters" />
       <module name="storlead-framework" options="" />
+      <module name="storlead-mail" options="-parameters" />
       <module name="storlead-mybatis" options="-parameters" />
       <module name="storlead-redis" options="-parameters" />
       <module name="storlead-sms" options="-parameters" />

+ 2 - 2
.idea/encodings.xml

@@ -21,8 +21,8 @@
     <file url="file://$PROJECT_DIR$/storlead-framework/storlead-redis/src/main/resources" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/storlead-framework/storlead-web/src/main/java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/storlead-framework/storlead-web/src/main/resources" charset="UTF-8" />
-    <file url="file://$PROJECT_DIR$/storlead-sms/src/main/java" charset="UTF-8" />
-    <file url="file://$PROJECT_DIR$/storlead-sms/src/main/resources" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/storlead-mail/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/storlead-mail/src/main/resources" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/storlead-user/src/main/java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/storlead-user/src/main/resources" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/storlead-wx/src/main/java" charset="UTF-8" />

+ 13 - 7
pom.xml

@@ -22,7 +22,7 @@
         <module>storlead-centre-service</module>
         <module>storlead-wx</module>
         <module>storlead-user</module>
-        <module>storlead-sms</module>
+        <module>storlead-mail</module>
     </modules>
 
     <properties>
@@ -148,15 +148,21 @@
             <version>1.0</version>
         </dependency>
 
-        <dependency>
-            <groupId>com.storlead.boot</groupId>
-            <artifactId>storlead-web</artifactId>
-            <version>1.0</version>
-        </dependency>
 
+            <dependency>
+                <groupId>com.sun.mail</groupId>
+                <artifactId>javax.mail</artifactId>
+                <version>1.6.2</version>
+            </dependency>
+
+
+            <dependency>
+                <groupId>org.projectlombok</groupId>
+                <artifactId>lombok</artifactId>
+            </dependency>
         <dependency>
             <groupId>com.storlead.boot</groupId>
-            <artifactId>storlead-sms</artifactId>
+            <artifactId>storlead-web</artifactId>
             <version>1.0</version>
         </dependency>
 

+ 0 - 4
storlead-centre-api/pom.xml

@@ -33,10 +33,6 @@
             <artifactId>storlead-user</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>com.storlead.boot</groupId>
-            <artifactId>storlead-sms</artifactId>
-        </dependency>
 
         <dependency>
             <groupId>com.storlead.boot</groupId>

+ 0 - 59
storlead-sms/pom.xml

@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>com.storlead.boot</groupId>
-        <artifactId>storlead-centre-platform</artifactId>
-        <version>1.0</version>
-        <relativePath>../pom.xml</relativePath> <!-- 或者默认 -->
-    </parent>
-
-    <artifactId>storlead-sms</artifactId>
-    <packaging>jar</packaging>
-
-    <dependencies>
-
-        <dependency>
-            <groupId>com.storlead.boot</groupId>
-            <artifactId>storlead-web</artifactId>
-            <version>1.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.storlead.boot</groupId>
-            <artifactId>storlead-common</artifactId>
-            <version>1.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.storlead.boot</groupId>
-            <artifactId>storlead-redis</artifactId>
-            <version>1.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.storlead.boot</groupId>
-            <artifactId>storlead-mybatis</artifactId>
-            <version>1.0</version>
-        </dependency>
-
-        <!--阿里短信 SDK start -->
-        <dependency>
-            <groupId>com.aliyun</groupId>
-            <artifactId>aliyun-java-sdk-core</artifactId>
-            <version>4.4.9</version>
-        </dependency>
-
-        <!-- https://mvnrepository.com/artifact/com.aliyun/aliyun-java-sdk-dysmsapi -->
-        <dependency>
-            <groupId>com.aliyun</groupId>
-            <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
-            <version>2.1.0</version>
-        </dependency>
-
-
-    </dependencies>
-
-</project>

+ 0 - 37
storlead-sms/src/main/java/com/storlead/sms/constants/SmsTemplateConstants.java

@@ -1,37 +0,0 @@
-package com.storlead.sms.constants;
-
-import com.storlead.framework.common.util.encryptor.AccessKeyEncryptor;
-
-/**
- * 短信模板常量类
- * ˚
- *
- * @author blank
- * @since 2018/5/17 下午3:02
- */
-public class SmsTemplateConstants {
-
-    /**
-     * 阿里短信KeyId
-     * LTAINcIoMlgLFqYA
-     */
-    public final static String SMS_ACCESS_KEY = AccessKeyEncryptor.getAccessKeyEncryptor("").decrypt("oR84iMcKamMRyLUYSK9oT6RtfW6g8/J/Z7SZl6bSpa0=");
-
-    /**
-     * 阿里短信密钥
-     * IEOhX7cztq1Iakb9eUmBcSLjU2mpZf
-     */
-    public static String SMS_ACCESS_KEY_SECRET = "8XFM6wbjkLqkhO5BSD3FcbD7EviWv9";
-
-    /**
-     * 阿里短信 验证码模板
-     * SMS_70175033
-     */
-    public static String SMS_CHECK_CODE_TEMPLATE = "SMS_70175033";
-
-    /**
-     * 单用户当日最大次数
-     */
-    public static Integer SEND_MAXIMIZE  = 10;
-
-}

+ 0 - 47
storlead-sms/src/main/java/com/storlead/sms/controller/SmsLogApiController.java

@@ -1,47 +0,0 @@
-package com.storlead.sms.controller;//package com.storlead.sms.controller;
-//
-//import cn.hutool.core.util.StrUtil;
-//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-//import com.storlead.frame.core.assemble.Result;
-//import com.storlead.sms.service.SmsLogService;
-//import io.swagger.annotations.Api;
-//import io.swagger.annotations.ApiOperation;
-//import org.springframework.web.bind.annotation.PostMapping;
-//import org.springframework.web.bind.annotation.RequestMapping;
-//import org.springframework.web.bind.annotation.RestController;
-//
-//import javax.annotation.Resource;
-//
-///**
-// * @program: sp-cloud
-// * @description: 短信发送
-// * @author: chenkq
-// * @create: 2022-05-27 10:08
-// */
-//
-//
-//@Api(tags = "系统: 企业微信管理")
-//@RestController
-//@RequestMapping("/sys/sms")
-//public class SmsLogApiController {
-//
-//    @Resource
-//    private SmsLogService smsLogService;
-//
-//    @ApiOperation("获取AccessToken")
-//    @PostMapping("/sendLoginVerifyCode")
-//    public Result sendLoginVerifyCode(String mobile) {
-//        if (StrUtil.isBlank(mobile)) {
-//            return Result.error("参数错误");
-//        }
-//        //UserEn userAccount = userAccountService.getOne(new LambdaQueryWrapper<UserAccount>().eq(UserAccount::getAccount,mobile));
-////      if (userAccount == null) {
-////          return Result.error("手机号错误,该手机号用户不存在");
-////      }
-//        try {
-//            return  smsLogService.sendLoginSmsCode(mobile);
-//        }catch (Exception e) {
-//            return  Result.error(e.getMessage());
-//        }
-//    }
-//}

+ 0 - 452
storlead-sms/src/main/java/com/storlead/sms/exception/SMSException.java

@@ -1,452 +0,0 @@
-package com.storlead.sms.exception;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.security.PrivilegedActionException;
-
-/**
- * 短信异常类
- *
- * @author blank
- * @since 2018/6/29 上午10:37
- */
-public class SMSException extends Exception {
-    /**
-     * Constructs a new exception with {@code null} as its detail message.
-     * The cause is not initialized, and may subsequently be initialized by a
-     * call to {@link #initCause}.
-     */
-    public SMSException() {
-        super();
-    }
-
-    /**
-     * Constructs a new exception with the specified detail message.  The
-     * cause is not initialized, and may subsequently be initialized by
-     * a call to {@link #initCause}.
-     *
-     * @param message the detail message. The detail message is saved for
-     *                later retrieval by the {@link #getMessage()} method.
-     */
-    public SMSException(String message) {
-        super(message);
-    }
-
-    /**
-     * Constructs a new exception with the specified detail message and
-     * cause.  <p>Note that the detail message associated with
-     * {@code cause} is <i>not</i> automatically incorporated in
-     * this exception's detail message.
-     *
-     * @param message the detail message (which is saved for later retrieval
-     *                by the {@link #getMessage()} method).
-     * @param cause   the cause (which is saved for later retrieval by the
-     *                {@link #getCause()} method).  (A <tt>null</tt> value is
-     *                permitted, and indicates that the cause is nonexistent or
-     *                unknown.)
-     * @since 1.4
-     */
-    public SMSException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    /**
-     * Constructs a new exception with the specified cause and a detail
-     * message of <tt>(cause==null ? null : cause.toString())</tt> (which
-     * typically contains the class and detail message of <tt>cause</tt>).
-     * This constructor is useful for exceptions that are little more than
-     * wrappers for other throwables (for example, {@link
-     * PrivilegedActionException}).
-     *
-     * @param cause the cause (which is saved for later retrieval by the
-     *              {@link #getCause()} method).  (A <tt>null</tt> value is
-     *              permitted, and indicates that the cause is nonexistent or
-     *              unknown.)
-     * @since 1.4
-     */
-    public SMSException(Throwable cause) {
-        super(cause);
-    }
-
-    /**
-     * Constructs a new exception with the specified detail message,
-     * cause, suppression enabled or disabled, and writable stack
-     * trace enabled or disabled.
-     *
-     * @param message            the detail message.
-     * @param cause              the cause.  (A {@code null} value is permitted,
-     *                           and indicates that the cause is nonexistent or unknown.)
-     * @param enableSuppression  whether or not suppression is enabled
-     *                           or disabled
-     * @param writableStackTrace whether or not the stack trace should
-     *                           be writable
-     * @since 1.7
-     */
-    protected SMSException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-
-    /**
-     * Returns the detail message string of this throwable.
-     *
-     * @return the detail message string of this {@code Throwable} instance
-     * (which may be {@code null}).
-     */
-    @Override
-    public String getMessage() {
-        return super.getMessage();
-    }
-
-    /**
-     * Creates a localized description of this throwable.
-     * Subclasses may override this method in order to produce a
-     * locale-specific message.  For subclasses that do not override this
-     * method, the default implementation returns the same result as
-     * {@code getMessage()}.
-     *
-     * @return The localized description of this throwable.
-     * @since JDK1.1
-     */
-    @Override
-    public String getLocalizedMessage() {
-        return super.getLocalizedMessage();
-    }
-
-    /**
-     * Returns the cause of this throwable or {@code null} if the
-     * cause is nonexistent or unknown.  (The cause is the throwable that
-     * caused this throwable to get thrown.)
-     *
-     * <p>This implementation returns the cause that was supplied via one of
-     * the constructors requiring a {@code Throwable}, or that was set after
-     * creation with the {@link #initCause(Throwable)} method.  While it is
-     * typically unnecessary to override this method, a subclass can override
-     * it to return a cause set by some other means.  This is appropriate for
-     * a "legacy chained throwable" that predates the addition of chained
-     * exceptions to {@code Throwable}.  Note that it is <i>not</i>
-     * necessary to override any of the {@code PrintStackTrace} methods,
-     * all of which invoke the {@code getCause} method to determine the
-     * cause of a throwable.
-     *
-     * @return the cause of this throwable or {@code null} if the
-     * cause is nonexistent or unknown.
-     * @since 1.4
-     */
-    @Override
-    public synchronized Throwable getCause() {
-        return super.getCause();
-    }
-
-    /**
-     * Initializes the <i>cause</i> of this throwable to the specified value.
-     * (The cause is the throwable that caused this throwable to get thrown.)
-     *
-     * <p>This method can be called at most once.  It is generally called from
-     * within the constructor, or immediately after creating the
-     * throwable.  If this throwable was created
-     * with  or
-     * , this method cannot be called
-     * even once.
-     *
-     * <p>An example of using this method on a legacy throwable type
-     * without other support for setting the cause is:
-     *
-     * <pre>
-     * try {
-     *     lowLevelOp();
-     * } catch (LowLevelException le) {
-     *     throw (HighLevelException)
-     *           new HighLevelException().initCause(le); // Legacy constructor
-     * }
-     * </pre>
-     *
-     * @param cause the cause (which is saved for later retrieval by the
-     *              {@link #getCause()} method).  (A {@code null} value is
-     *              permitted, and indicates that the cause is nonexistent or
-     *              unknown.)
-     * @return a reference to this {@code Throwable} instance.
-     * @throws IllegalArgumentException if {@code cause} is this
-     *                                  throwable.  (A throwable cannot be its own cause.)
-     * @throws IllegalStateException    if this throwable was
-     *                                  created with  or
-     *                                  , or this method has already
-     *                                  been called on this throwable.
-     * @since 1.4
-     */
-    @Override
-    public synchronized Throwable initCause(Throwable cause) {
-        return super.initCause(cause);
-    }
-
-    /**
-     * Returns a short description of this throwable.
-     * The result is the concatenation of:
-     * <ul>
-     * <li> the {@linkplain Class#getName() name} of the class of this object
-     * <li> ": " (a colon and a space)
-     * <li> the result of invoking this object's {@link #getLocalizedMessage}
-     * method
-     * </ul>
-     * If {@code getLocalizedMessage} returns {@code null}, then just
-     * the class name is returned.
-     *
-     * @return a string representation of this throwable.
-     */
-    @Override
-    public String toString() {
-        return super.toString();
-    }
-
-    /**
-     * Prints this throwable and its backtrace to the
-     * standard error stream. This method prints a stack trace for this
-     * {@code Throwable} object on the error output stream that is
-     * the value of the field {@code System.err}. The first line of
-     * output contains the result of the {@link #toString()} method for
-     * this object.  Remaining lines represent data previously recorded by
-     * the method {@link #fillInStackTrace()}. The format of this
-     * information depends on the implementation, but the following
-     * example may be regarded as typical:
-     * <blockquote><pre>
-     * java.lang.NullPointerException
-     *         at MyClass.mash(MyClass.java:9)
-     *         at MyClass.crunch(MyClass.java:6)
-     *         at MyClass.main(MyClass.java:3)
-     * </pre></blockquote>
-     * This example was produced by running the program:
-     * <pre>
-     * class MyClass {
-     *     public static void main(String[] args) {
-     *         crunch(null);
-     *     }
-     *     static void crunch(int[] a) {
-     *         mash(a);
-     *     }
-     *     static void mash(int[] b) {
-     *         System.out.println(b[0]);
-     *     }
-     * }
-     * </pre>
-     * The backtrace for a throwable with an initialized, non-null cause
-     * should generally include the backtrace for the cause.  The format
-     * of this information depends on the implementation, but the following
-     * example may be regarded as typical:
-     * <pre>
-     * HighLevelException: MidLevelException: LowLevelException
-     *         at Junk.a(Junk.java:13)
-     *         at Junk.main(Junk.java:4)
-     * Caused by: MidLevelException: LowLevelException
-     *         at Junk.c(Junk.java:23)
-     *         at Junk.b(Junk.java:17)
-     *         at Junk.a(Junk.java:11)
-     *         ... 1 more
-     * Caused by: LowLevelException
-     *         at Junk.e(Junk.java:30)
-     *         at Junk.d(Junk.java:27)
-     *         at Junk.c(Junk.java:21)
-     *         ... 3 more
-     * </pre>
-     * Note the presence of lines containing the characters {@code "..."}.
-     * These lines indicate that the remainder of the stack trace for this
-     * exception matches the indicated number of frames from the bottom of the
-     * stack trace of the exception that was caused by this exception (the
-     * "enclosing" exception).  This shorthand can greatly reduce the length
-     * of the output in the common case where a wrapped exception is thrown
-     * from same method as the "causative exception" is caught.  The above
-     * example was produced by running the program:
-     * <pre>
-     * public class Junk {
-     *     public static void main(String args[]) {
-     *         try {
-     *             a();
-     *         } catch(HighLevelException e) {
-     *             e.printStackTrace();
-     *         }
-     *     }
-     *     static void a() throws HighLevelException {
-     *         try {
-     *             b();
-     *         } catch(MidLevelException e) {
-     *             throw new HighLevelException(e);
-     *         }
-     *     }
-     *     static void b() throws MidLevelException {
-     *         c();
-     *     }
-     *     static void c() throws MidLevelException {
-     *         try {
-     *             d();
-     *         } catch(LowLevelException e) {
-     *             throw new MidLevelException(e);
-     *         }
-     *     }
-     *     static void d() throws LowLevelException {
-     *        e();
-     *     }
-     *     static void e() throws LowLevelException {
-     *         throw new LowLevelException();
-     *     }
-     * }
-     *
-     * class HighLevelException extends Exception {
-     *     HighLevelException(Throwable cause) { super(cause); }
-     * }
-     *
-     * class MidLevelException extends Exception {
-     *     MidLevelException(Throwable cause)  { super(cause); }
-     * }
-     *
-     * class LowLevelException extends Exception {
-     * }
-     * </pre>
-     * As of release 7, the platform supports the notion of
-     * <i>suppressed exceptions</i> (in conjunction with the {@code
-     * try}-with-resources statement). Any exceptions that were
-     * suppressed in order to deliver an exception are printed out
-     * beneath the stack trace.  The format of this information
-     * depends on the implementation, but the following example may be
-     * regarded as typical:
-     *
-     * <pre>
-     * Exception in thread "main" java.lang.Exception: Something happened
-     *  at Foo.bar(Foo.java:10)
-     *  at Foo.main(Foo.java:5)
-     *  Suppressed: Resource$CloseFailException: Resource ID = 0
-     *          at Resource.close(Resource.java:26)
-     *          at Foo.bar(Foo.java:9)
-     *          ... 1 more
-     * </pre>
-     * Note that the "... n more" notation is used on suppressed exceptions
-     * just at it is used on causes. Unlike causes, suppressed exceptions are
-     * indented beyond their "containing exceptions."
-     *
-     * <p>An exception can have both a cause and one or more suppressed
-     * exceptions:
-     * <pre>
-     * Exception in thread "main" java.lang.Exception: Main block
-     *  at Foo3.main(Foo3.java:7)
-     *  Suppressed: Resource$CloseFailException: Resource ID = 2
-     *          at Resource.close(Resource.java:26)
-     *          at Foo3.main(Foo3.java:5)
-     *  Suppressed: Resource$CloseFailException: Resource ID = 1
-     *          at Resource.close(Resource.java:26)
-     *          at Foo3.main(Foo3.java:5)
-     * Caused by: java.lang.Exception: I did it
-     *  at Foo3.main(Foo3.java:8)
-     * </pre>
-     * Likewise, a suppressed exception can have a cause:
-     * <pre>
-     * Exception in thread "main" java.lang.Exception: Main block
-     *  at Foo4.main(Foo4.java:6)
-     *  Suppressed: Resource2$CloseFailException: Resource ID = 1
-     *          at Resource2.close(Resource2.java:20)
-     *          at Foo4.main(Foo4.java:5)
-     *  Caused by: java.lang.Exception: Rats, you caught me
-     *          at Resource2$CloseFailException.&lt;init&gt;(Resource2.java:45)
-     *          ... 2 more
-     * </pre>
-     */
-    @Override
-    public void printStackTrace() {
-        super.printStackTrace();
-    }
-
-    /**
-     * Prints this throwable and its backtrace to the specified print stream.
-     *
-     * @param s {@code PrintStream} to use for output
-     */
-    @Override
-    public void printStackTrace(PrintStream s) {
-        super.printStackTrace(s);
-    }
-
-    /**
-     * Prints this throwable and its backtrace to the specified
-     * print writer.
-     *
-     * @param s {@code PrintWriter} to use for output
-     * @since JDK1.1
-     */
-    @Override
-    public void printStackTrace(PrintWriter s) {
-        super.printStackTrace(s);
-    }
-
-    /**
-     * Fills in the execution stack trace. This method records within this
-     * {@code Throwable} object information about the current state of
-     * the stack frames for the current thread.
-     *
-     * <p>If the stack trace of this {@code Throwable} {@linkplain
-     * Throwable#Throwable(String, Throwable, boolean, boolean) is not
-     * writable}, calling this method has no effect.
-     *
-     * @return a reference to this {@code Throwable} instance.
-     * @see Throwable#printStackTrace()
-     */
-    @Override
-    public synchronized Throwable fillInStackTrace() {
-        return super.fillInStackTrace();
-    }
-
-    /**
-     * Provides programmatic access to the stack trace information printed by
-     * {@link #printStackTrace()}.  Returns an array of stack trace elements,
-     * each representing one stack frame.  The zeroth element of the array
-     * (assuming the array's length is non-zero) represents the top of the
-     * stack, which is the last method invocation in the sequence.  Typically,
-     * this is the point at which this throwable was created and thrown.
-     * The last element of the array (assuming the array's length is non-zero)
-     * represents the bottom of the stack, which is the first method invocation
-     * in the sequence.
-     *
-     * <p>Some virtual machines may, under some circumstances, omit one
-     * or more stack frames from the stack trace.  In the extreme case,
-     * a virtual machine that has no stack trace information concerning
-     * this throwable is permitted to return a zero-length array from this
-     * method.  Generally speaking, the array returned by this method will
-     * contain one element for every frame that would be printed by
-     * {@code printStackTrace}.  Writes to the returned array do not
-     * affect future calls to this method.
-     *
-     * @return an array of stack trace elements representing the stack trace
-     * pertaining to this throwable.
-     * @since 1.4
-     */
-    @Override
-    public StackTraceElement[] getStackTrace() {
-        return super.getStackTrace();
-    }
-
-    /**
-     * Sets the stack trace elements that will be returned by
-     * {@link #getStackTrace()} and printed by {@link #printStackTrace()}
-     * and related methods.
-     * <p>
-     * This method, which is designed for use by RPC frameworks and other
-     * advanced systems, allows the client to override the default
-     * stack trace that is either generated by {@link #fillInStackTrace()}
-     * when a throwable is constructed or deserialized when a throwable is
-     * read from a serialization stream.
-     *
-     * <p>If the stack trace of this {@code Throwable} {@linkplain
-     * Throwable#Throwable(String, Throwable, boolean, boolean) is not
-     * writable}, calling this method has no effect other than
-     * validating its argument.
-     *
-     * @param stackTrace the stack trace elements to be associated with
-     *                   this {@code Throwable}.  The specified array is copied by this
-     *                   call; changes in the specified array after the method invocation
-     *                   returns will have no affect on this {@code Throwable}'s stack
-     *                   trace.
-     * @throws NullPointerException if {@code stackTrace} is
-     *                              {@code null} or if any of the elements of
-     *                              {@code stackTrace} are {@code null}
-     * @since 1.4
-     */
-    @Override
-    public void setStackTrace(StackTraceElement[] stackTrace) {
-        super.setStackTrace(stackTrace);
-    }
-}

+ 0 - 16
storlead-sms/src/main/java/com/storlead/sms/mapper/SmsLogMapper.java

@@ -1,16 +0,0 @@
-package com.storlead.sms.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.storlead.sms.pojo.entity.SmsLogEntity;
-
-/**
- * <p>
- * 短信日志 Mapper 接口
- * </p>
- *
- * @author chenkq
- * @since 2022-05-27
- */
-public interface SmsLogMapper extends BaseMapper<SmsLogEntity> {
-
-}

+ 0 - 73
storlead-sms/src/main/java/com/storlead/sms/pojo/entity/SmsLogEntity.java

@@ -1,73 +0,0 @@
-package com.storlead.sms.pojo.entity;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.storlead.framework.mybatis.entity.SysBaseField;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.util.Date;
-
-/**
- * <p>
- * 短信日志
- * </p>
- *
- * @author chenkq
- * @since 2022-05-27
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class SmsLogEntity extends SysBaseField {
-
-    /**
-     * ID
-     */
-    private Long smsLogId;
-
-    /**
-     * 发送用户
-     */
-    private Long userId;
-
-    /**
-     * 发送账号
-     */
-    private String mobile;
-
-    /**
-     * 校验码
-     */
-    private String verifyCode;
-
-    /**+
-     * 短信内容
-     */
-    private String message;
-
-    /**
-     * 0:未发送,1:成功,2:失败
-     */
-    private Integer status;
-
-    /**
-     * 0:短信验证码
-     */
-    private Integer type;
-
-    /**
-     * 发送时间
-     */
-    private Date sendTime;
-
-    /**
-     * 有效时间(分钟)
-     */
-    private Integer validTime;
-
-    /**
-     * 是否使用
-     */
-    @TableField(exist = false)
-    private Boolean isUsed = false;
-
-}

+ 0 - 23
storlead-sms/src/main/java/com/storlead/sms/service/SmsLogService.java

@@ -1,23 +0,0 @@
-package com.storlead.sms.service;
-
-import com.aliyuncs.exceptions.ClientException;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.storlead.framework.web.assemble.Result;
-import com.storlead.sms.exception.SMSException;
-import com.storlead.sms.pojo.entity.SmsLogEntity;
-
-/**
- * <p>
- * 短信日志 服务类
- * </p>
- *
- * @author chenkq
- * @since 2022-05-27
- */
-public interface SmsLogService extends IService<SmsLogEntity> {
-
-    /**
-     * 发送登录短信code
-     */
-    public Result sendLoginSmsCode(String mobile) throws ClientException, SMSException;
-}

+ 0 - 91
storlead-sms/src/main/java/com/storlead/sms/service/impl/SmsLogServiceImpl.java

@@ -1,91 +0,0 @@
-package com.storlead.sms.service.impl;
-
-import com.aliyuncs.exceptions.ClientException;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.storlead.framework.common.constant.RedisKeySaltConstant;
-import com.storlead.framework.common.util.RandomCodeUtil;
-import com.storlead.framework.redis.RedisService;
-import com.storlead.framework.web.assemble.Result;
-import com.storlead.framework.web.enums.ErrorMsgCode;
-import com.storlead.sms.constants.SmsTemplateConstants;
-import com.storlead.sms.exception.SMSException;
-import com.storlead.sms.mapper.SmsLogMapper;
-import com.storlead.sms.pojo.entity.SmsLogEntity;
-import com.storlead.sms.service.SmsLogService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.Date;
-import java.util.Objects;
-import java.util.concurrent.TimeUnit;
-
-/**
- * <p>
- * 短信日志 服务实现类
- * </p>
- *
- * @author chenkq
- * @since 2022-05-27
- */
-@Service
-public class SmsLogServiceImpl extends ServiceImpl<SmsLogMapper, SmsLogEntity> implements SmsLogService {
-
-    @Autowired
-    private RedisService redisService;
-
-
-
-    @Override
-    public Result sendLoginSmsCode(String mobile) throws ClientException, SMSException {
-        //
-        int count = this.count(new LambdaQueryWrapper<SmsLogEntity>().eq(SmsLogEntity::getMobile,mobile).eq(SmsLogEntity::getType,Integer.valueOf(10)).apply(" TO_DAYS(send_time) = TO_DAYS(NOW()) "));
-        if (count >= SmsTemplateConstants.SEND_MAXIMIZE) {
-            return Result.error(ErrorMsgCode.D_400001);
-        }
-        Object var1 = redisService.getCacheObject(RedisKeySaltConstant.REDIS_LOGIN_VALID_CODE_KEY+mobile);
-        if (Objects.nonNull(var1)) {
-            SmsLogEntity smsLog = (SmsLogEntity) var1;
-            Long currentTime = System.currentTimeMillis();
-            Long sendTime = smsLog.getSendTime().getTime();
-            if ((currentTime - sendTime) / 1000 < smsLog.getValidTime()) {
-                return Result.error(ErrorMsgCode.D_400002);
-            }
-        }
-        int checkCode = RandomCodeUtil.RandomCheckCode();
-
-        try {
-            boolean res = sendMobileVerifyCode(mobile, checkCode);
-            if (!res) {
-                return Result.error(ErrorMsgCode.D_400003);
-            }
-            log.error("SmsLog ---- = "+checkCode);
-            SmsLogEntity smsLog = new SmsLogEntity();
-            smsLog.setVerifyCode(String.valueOf(checkCode));
-            smsLog.setMobile(mobile);
-            smsLog.setType(Integer.valueOf(10));
-            //无需关注id  验证的是手机号码
-            smsLog.setUserId(null);
-            smsLog.setValidTime(60);
-            smsLog.setSendTime(new Date());
-            smsLog.setStatus(1);
-            this.baseMapper.insert(smsLog);
-            redisService.setCacheObject(RedisKeySaltConstant.REDIS_LOGIN_VALID_CODE_KEY+mobile,smsLog,120L, TimeUnit.MINUTES);
-        } catch (ClientException e) {
-            return Result.error(e.getMessage());
-        }
-        return Result.ok();
-    }
-
-
-    /**
-     * 发送手机验证码短信
-     *
-     * @param mobile    手机
-     * @param checkCode 验证码
-     */
-    public boolean sendMobileVerifyCode(String mobile, Integer checkCode) throws ClientException {
-        return true;
-        // return SmsUtil.sendSms(smsProperties.getSmsCheckCodeTemplate(), JSON.toJSONString(ImmutableMap.of("number", checkCode)), mobile,smsProperties.getSmsAccessKeyId(),smsProperties.getSmsAccessKeyIdSecret());
-    }
-}

+ 0 - 160
storlead-sms/src/main/java/com/storlead/util/SmsUtil.java

@@ -1,160 +0,0 @@
-package com.storlead.util;
-
-import com.alibaba.fastjson.JSON;
-import com.aliyuncs.DefaultAcsClient;
-import com.aliyuncs.IAcsClient;
-import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
-import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
-import com.aliyuncs.exceptions.ClientException;
-import com.aliyuncs.http.MethodType;
-import com.aliyuncs.profile.DefaultProfile;
-import com.aliyuncs.profile.IClientProfile;
-import com.google.common.collect.ImmutableMap;
-import com.storlead.sms.constants.SmsTemplateConstants;
-import com.storlead.sms.exception.SMSException;
-import lombok.extern.log4j.Log4j2;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- * 短信工具类
- *
- * @author blank
- * @since 2018/5/17 上午11:11
- */
-@Log4j2
-public class SmsUtil {
-
-    /**
-     * 转账对象为 json 字符串
-     *
-     * @param obj 要转换的对象
-     * @return 转换后的 json 字符串
-     */
-    private static String mapToJSONString(Object obj) {
-        return JSON.toJSONString(obj);
-    }
-
-    /**
-     * 发送手机验证码短信
-     *
-     * @param mobile    手机
-     * @param checkCode 验证码
-     */
-    public static boolean sendCheckCode(String mobile, Integer checkCode) throws ClientException,SMSException {
-        return sendSms(SmsTemplateConstants.SMS_CHECK_CODE_TEMPLATE, mapToJSONString(ImmutableMap.of("number", checkCode)), mobile);
-    }
-
-    /**
-     * 通过阿里短信向指定手机发送指定模板 ID 的短信
-     *
-     * @param templateCode  短信模板 ID
-     * @param templateParam 短信模板参数
-     * @param phoneNum      短信发送手机号
-     * @return true 短信接口请求成功(!不是发送结果 是否成功 发送结果需要重新写短信发送查询接口来查询) / false 短信接口请求失败
-     * @author blank 2017/10/30 上午11:31
-     */
-    public static boolean sendSms(String templateCode, String templateParam, String phoneNum) throws ClientException,SMSException {
-
-        if (!StringUtils.isEmpty(templateParam)) {
-            Map<String, Object> strMap = JSON.parseObject(templateParam, HashMap.class);
-            strMap.forEach((k,v)->{
-                String temp = v.toString();
-                if (StringUtils.isNotBlank(temp)) {
-                    if (temp.length() > 20) {
-                        String s  = temp.substring(0, 18) + "..";
-                        strMap.put(k, s);
-                    }
-                }
-            });
-            templateParam = JSON.toJSONString(strMap);
-        }
-        //设置超时时间-可自行调整
-        System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
-        System.setProperty("sun.net.client.defaultReadTimeout", "10000");
-        //初始化ascClient需要的几个参数
-        //短信API产品名称(短信产品名固定,无需修改)
-        final String product = "Dysmsapi";
-        //短信API产品域名(接口地址固定,无需修改)
-        final String domain = "dysmsapi.aliyuncs.com";
-        //替换成你的AK
-        //        final String accessKeyId = mns_accesskeyid;//你的accessKeyId,参考本文档步骤2
-        //        final String accessKeySecret = mns_accesskeysecret;//你的accessKeySecret,参考本文档步骤2
-        //初始化ascClient,暂时不支持多region(请勿修改)
-        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", SmsTemplateConstants.SMS_ACCESS_KEY, SmsTemplateConstants.SMS_ACCESS_KEY_SECRET);
-        DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
-        IAcsClient acsClient = new DefaultAcsClient(profile);
-        //组装请求对象
-        SendSmsRequest request = new SendSmsRequest();
-        //使用post提交
-        request.setMethod(MethodType.POST);
-        //必填:待发送手机号。支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式
-        request.setPhoneNumbers(phoneNum);
-        //必填:短信签名-可在短信控制台中找到
-        request.setSignName("领存技术");
-        //必填:短信模板-可在短信控制台中找到
-        request.setTemplateCode(templateCode);
-        //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
-        //友情提示:如果JSON中需要带换行符,请参照标准的JSON协议对换行符的要求,比如短信内容中包含\r\n的情况在JSON中需要表示成\\r\\n,否则会导致JSON在服务端解析失败
-//        request.setTemplateParam("{\"store\":\"Tom\", \"code\":\"123\"}");
-        request.setTemplateParam(templateParam);
-        //可选-上行短信扩展码(扩展码字段控制在7位或以下,无特殊需求用户请忽略此字段)
-        //request.setSmsUpExtendCode("90997");
-        //可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
-//        request.setOutId("callback");
-        //请求失败这里会抛ClientException异常
-        SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
-        if (sendSmsResponse.getCode() != null && "OK".equals(sendSmsResponse.getCode())) {
-            //请求成功
-            log.info("短信发送成功 对应模板 ID ----> {}, 对应手机---> {}", templateCode, phoneNum);
-            return true;
-        } else {
-            throw new SMSException("短信发送失败:" + sendSmsResponse.getMessage());
-//            log.error("短信发送失败 " + sendSmsResponse.getMessage());
-//            return false;
-        }
-
-    }
-
-
-    /**
-     * @param userName    订单通知的用户
-     * @param mobile      订单通知的手机号码
-     * @param orderNumber 订单号
-     * @param duetime     尾款最后支付时间
-     * @Author: timo
-     * @Date: 2018/11/25 17:48
-     * @Description: 客户尾款支付提醒
-     * <p>
-     *
-     * 模版类型: 短信通知
-     * 模版名称: 客户尾款支付提醒
-     * 模版CODE: SMS_152513457
-     * 模版内容: 尊敬的${usename},尾号为${ordernumber}的订单已完成生产,请您在${duetime}内支付尾款。领存将在尾款到账后发货。
-     * 申请说明: 通知用户支付尾款
-     *
-     */
-    public static void leftAmtPaymentSmsNotice(String userName, String mobile, String orderNumber, String duetime) throws ClientException, SMSException {
-        Map<String, String> paramMap = new HashMap<>();
-        paramMap.put("usename", userName);
-        paramMap.put("ordernumber", orderNumber.substring(orderNumber.length() - 4));
-        paramMap.put("duetime", duetime+"天");
-        sendSms("SMS_152513457", JSON.toJSONString(paramMap), mobile);
-    }
-
-    public static void main(String[] args) {
-        try {
-            sendSms(SmsTemplateConstants.SMS_CHECK_CODE_TEMPLATE, mapToJSONString(ImmutableMap.of("number", 123456)), "18118724055");
-            String s = "11112222333344445555";
-            System.out.println(s.substring(0,18));
-
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-
-}

+ 0 - 23
storlead-sms/src/main/resources/mapper/SmsLogMapper.xml

@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.storlead.user.sms.mapper.SmsLogMapper">
-
-    <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" extends="com.storlead.framework.mybatis.mapper.SysBaseFieldMapper.BaseResultMap" type="com.storlead.sms.pojo.entity.SmsLogEntity">
-        <id column="sms_log_id" property="smsLogId" />
-        <result column="user_id" property="userId" />
-        <result column="mobile" property="mobile" />
-        <result column="verify_code" property="verifyCode" />
-        <result column="message" property="message" />
-        <result column="status" property="status" />
-        <result column="type" property="type" />
-        <result column="send_time" property="sendTime" />
-        <result column="valid_time" property="validTime" />
-    </resultMap>
-
-    <!-- 通用查询结果列 -->
-    <sql id="Base_Column_List">
-        id, user_id, mobile, verify_code, message, `type` ,status, send_time, valid_time, <include refid="com.storlead.framework.mybatis.mapper.SysBaseFieldMapper.Base_Column_List"></include>
-    </sql>
-
-</mapper>