소스 검색

完成移动端登录功能

huhuhu 1 년 전
부모
커밋
6764bcd4d5
16개의 변경된 파일751개의 추가작업 그리고 31개의 파일을 삭제
  1. 9 1
      pom.xml
  2. 358 0
      unis-common/src/main/java/com/unis/common/util/RsaSecretUtils.java
  3. 2 0
      unis-plugin-api/unis-plugin-auth-api/src/main/java/com/unis/auth/api/SaBaseLoginUserApi.java
  4. 7 0
      unis-plugin/unis-plugin-auth/pom.xml
  5. 43 0
      unis-plugin/unis-plugin-auth/src/main/java/com/unis/auth/modular/login/controller/UserCollectLoginController.java
  6. 79 0
      unis-plugin/unis-plugin-auth/src/main/java/com/unis/auth/modular/login/entity/UserCollectLogin.java
  7. 15 0
      unis-plugin/unis-plugin-auth/src/main/java/com/unis/auth/modular/login/mapper/UserCollectLoginMapper.java
  8. 40 0
      unis-plugin/unis-plugin-auth/src/main/java/com/unis/auth/modular/login/param/UserCollectPasswordLoginParam.java
  9. 8 0
      unis-plugin/unis-plugin-auth/src/main/java/com/unis/auth/modular/login/service/AuthService.java
  10. 94 29
      unis-plugin/unis-plugin-auth/src/main/java/com/unis/auth/modular/login/service/impl/AuthServiceImpl.java
  11. 85 0
      unis-plugin/unis-plugin-auth/src/main/java/com/unis/auth/modular/login/utils/JwtTokenUtils.java
  12. 1 1
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/basic.info/modular/pricemonitor/param/PriceMonitorIdParam.java
  13. 6 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/basic.info/modular/pricemonitor/param/PriceMonitorPageParam.java
  14. 1 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/basic.info/modular/remindcycle/entity/RemindCycle.java
  15. 1 0
      unis-plugin/unis-plugin-client/src/main/java/com/unis/client/modular/user/provider/ClientLoginUserApiProvider.java
  16. 2 0
      unis-web-app/src/main/java/com/unis/core/config/GlobalConfigure.java

+ 9 - 1
pom.xml

@@ -84,6 +84,7 @@
84 84
         <ten.sdk.sms.version>3.1.455</ten.sdk.sms.version>
85 85
         <tomcat.embed.core.version>9.0.72</tomcat.embed.core.version>
86 86
         <jts.version>1.13</jts.version>
87
+        <pagehelper>1.3.0</pagehelper>
87 88
     </properties>
88 89
 
89 90
     <modules>
@@ -183,7 +184,7 @@
183 184
             <!-- snowy-plugin-dev -->
184 185
             <dependency>
185 186
                 <groupId>com.unis</groupId>
186
-            <artifactId>unis-plugin-dev</artifactId>
187
+                <artifactId>unis-plugin-dev</artifactId>
187 188
                 <version>${unis.version}</version>
188 189
             </dependency>
189 190
 
@@ -668,6 +669,13 @@
668 669
                 <version>${jts.version}</version>
669 670
             </dependency>
670 671
             <!--geo end-->
672
+
673
+            <dependency>
674
+                <groupId>com.github.pagehelper</groupId>
675
+                <artifactId>pagehelper-spring-boot-starter</artifactId>
676
+                <version>${pagehelper}</version>
677
+            </dependency>
678
+
671 679
         </dependencies>
672 680
     </dependencyManagement>
673 681
 

+ 358 - 0
unis-common/src/main/java/com/unis/common/util/RsaSecretUtils.java

@@ -0,0 +1,358 @@
1
+package com.unis.common.util;
2
+ 
3
+import javax.crypto.Cipher;
4
+import java.io.ByteArrayOutputStream;
5
+import java.nio.charset.StandardCharsets;
6
+import java.security.*;
7
+import java.security.interfaces.RSAPrivateKey;
8
+import java.security.interfaces.RSAPublicKey;
9
+import java.security.spec.InvalidKeySpecException;
10
+import java.security.spec.PKCS8EncodedKeySpec;
11
+import java.security.spec.X509EncodedKeySpec;
12
+import java.util.Base64;
13
+ 
14
+/**
15
+ * @description: Rsa非对称加密算法工具类
16
+ * @author: chenwenrui
17
+ * @date: 2023/7/14 15:14
18
+ */
19
+public final class RsaSecretUtils {
20
+    private RsaSecretUtils() {
21
+    }
22
+ 
23
+    private static final String RSA = "RSA";
24
+ 
25
+    private static final String SIGN_ALGORITHMS = "SHA1WithRSA";
26
+ 
27
+    private static final Base64.Decoder DECODER = Base64.getDecoder();
28
+ 
29
+    private static final Base64.Encoder ENCODER = Base64.getEncoder();
30
+ 
31
+ 
32
+    public static void main(String[] args) throws NoSuchAlgorithmException {
33
+        String plaintext = "de123";
34
+
35
+        // 生成密钥对
36
+        KeyPair keyPair = getKeyPair();
37
+        // 公匙
38
+        String publicKey = getPublicKeyBase64(keyPair);
39
+        System.out.println("公匙 -> " + publicKey);
40
+        // 私匙
41
+        String privateKey = getPrivateKeyBase64(keyPair);
42
+        System.out.println("私匙 -> " + privateKey);
43
+        // 明文
44
+
45
+        System.out.println("明文 -> " + plaintext);
46
+        // 密文base64(公匙加密)
47
+        String ciphertext = publicKeyEncrypt(plaintext, publicKey);
48
+        System.out.println("密文base64 -> " + ciphertext);
49
+        // 解密后明文(私匙解密)
50
+        String decryptString = privateKeyDecrypt(ciphertext, privateKey);
51
+        System.out.println("解密后明文 -> " + decryptString);
52
+     /*   // 数字签名
53
+        String sign = sign(ciphertext, privateKey);
54
+        System.out.println("数字签名 -> " + decryptString);
55
+        // 验证签名
56
+        boolean pass = verify(ciphertext, sign, publicKey);
57
+        System.out.println("验证签名 -> " + pass);*/
58
+    }
59
+ 
60
+ 
61
+    /**
62
+     * 生成秘钥对
63
+     *
64
+     * @return
65
+     * @throws Exception
66
+     */
67
+    public static KeyPair getKeyPair() throws NoSuchAlgorithmException {
68
+        KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(RSA);
69
+        keyPairGenerator.initialize(2048);
70
+        return keyPairGenerator.generateKeyPair();
71
+    }
72
+ 
73
+    /**
74
+     * 获取公钥(Base64编码)
75
+     *
76
+     * @param keyPair 秘钥对
77
+     * @return
78
+     */
79
+    public static String getPublicKeyBase64(KeyPair keyPair) {
80
+        PublicKey publicKey = keyPair.getPublic();
81
+        byte[] bytes = publicKey.getEncoded();
82
+        // 先用base64编码,再转换为字符串
83
+        return new String(ENCODER.encode(bytes), StandardCharsets.UTF_8);
84
+    }
85
+ 
86
+    /**
87
+     * 获取私钥(Base64编码)
88
+     *
89
+     * @param keyPair 秘钥对
90
+     * @return
91
+     */
92
+    public static String getPrivateKeyBase64(KeyPair keyPair) {
93
+        PrivateKey privateKey = keyPair.getPrivate();
94
+        byte[] bytes = privateKey.getEncoded();
95
+        // 先用base64编码,再转换为字符串
96
+        return new String(ENCODER.encode(bytes), StandardCharsets.UTF_8);
97
+    }
98
+ 
99
+    /**
100
+     * 将Base64编码后的公钥转换成PublicKey对象
101
+     *
102
+     * @param publicKeyBase64 公钥base64
103
+     * @return
104
+     */
105
+    public static PublicKey getPublicKey(String publicKeyBase64) throws NoSuchAlgorithmException, InvalidKeySpecException {
106
+        byte[] keyBytes = DECODER.decode(publicKeyBase64);
107
+        X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
108
+        KeyFactory keyFactory = KeyFactory.getInstance(RSA);
109
+        return keyFactory.generatePublic(keySpec);
110
+    }
111
+ 
112
+    /**
113
+     * 将Base64编码后的私钥转换成PrivateKey对象
114
+     *
115
+     * @param privateKeyBase64 私钥base64
116
+     * @return
117
+     * @throws Exception
118
+     */
119
+    public static PrivateKey getPrivateKey(String privateKeyBase64) throws NoSuchAlgorithmException, InvalidKeySpecException {
120
+        byte[] keyBytes = DECODER.decode((privateKeyBase64));
121
+        PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
122
+        KeyFactory keyFactory = KeyFactory.getInstance(RSA);
123
+        return keyFactory.generatePrivate(keySpec);
124
+    }
125
+ 
126
+    /**
127
+     * 公钥加密
128
+     *
129
+     * @param plaintext       明文
130
+     * @param publicKeyBase64 公钥base64
131
+     * @return 密文数组base64编码后的字符串
132
+     */
133
+    public static String publicKeyEncrypt(String plaintext, String publicKeyBase64) {
134
+        try {
135
+            // 获取明文字节数组
136
+            byte[] bytes = plaintext.getBytes(StandardCharsets.UTF_8);
137
+            Cipher cipher = Cipher.getInstance(RSA);
138
+            // 编码前设定编码方式及密钥
139
+            PublicKey publicKey = getPublicKey(publicKeyBase64);
140
+            cipher.init(Cipher.ENCRYPT_MODE, publicKey);
141
+            int keyBit = getKeySize(publicKey);
142
+            int inputLen = bytes.length;
143
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
144
+            int offSet = 0;
145
+            int step = keyBit / 8 - 11;
146
+            for (int i = 0; inputLen - offSet > 0; offSet = i * step) {
147
+                byte[] cache;
148
+                if (inputLen - offSet > step) {
149
+                    cache = cipher.doFinal(bytes, offSet, step);
150
+                } else {
151
+                    cache = cipher.doFinal(bytes, offSet, inputLen - offSet);
152
+                }
153
+                out.write(cache, 0, cache.length);
154
+                ++i;
155
+            }
156
+            // 密文字节数组
157
+            byte[] ciphertextBytes = out.toByteArray();
158
+            out.close();
159
+            // 返回密文字节数组base64编码后的字符串
160
+            return new String(ENCODER.encode(ciphertextBytes), StandardCharsets.UTF_8);
161
+        } catch (Exception e) {
162
+            e.printStackTrace();
163
+            return null;
164
+        }
165
+    }
166
+ 
167
+    /**
168
+     * 公钥解密
169
+     *
170
+     * @param ciphertext      密文
171
+     * @param publicKeyBase64 公钥base64
172
+     * @return 明文
173
+     */
174
+    public static String publicKeyDecrypt(String ciphertext, String publicKeyBase64) {
175
+        try {
176
+            // 密文base64解码字节数组
177
+            byte[] bytes = DECODER.decode(ciphertext.getBytes(StandardCharsets.UTF_8));
178
+            Cipher cipher = Cipher.getInstance(RSA);
179
+            PublicKey publicKey = getPublicKey(publicKeyBase64);
180
+            cipher.init(Cipher.DECRYPT_MODE, publicKey);
181
+            int keyBit = getKeySize(publicKey);
182
+            int inputLen = bytes.length;
183
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
184
+            int offSet = 0;
185
+            int step = keyBit / 8;
186
+ 
187
+            for (int i = 0; inputLen - offSet > 0; offSet = i * step) {
188
+                byte[] cache;
189
+                if (inputLen - offSet > step) {
190
+                    cache = cipher.doFinal(bytes, offSet, step);
191
+                } else {
192
+                    cache = cipher.doFinal(bytes, offSet, inputLen - offSet);
193
+                }
194
+                out.write(cache, 0, cache.length);
195
+                ++i;
196
+            }
197
+            // 明文字节数组
198
+            byte[] plaintextBytes = out.toByteArray();
199
+            out.close();
200
+            return new String(plaintextBytes, StandardCharsets.UTF_8);
201
+        } catch (Exception e) {
202
+            return null;
203
+        }
204
+    }
205
+ 
206
+    /**
207
+     * 私钥加密
208
+     *
209
+     * @param plaintext        明文
210
+     * @param privateKeyBase64 私钥base64
211
+     * @return
212
+     */
213
+    public static String privateKeyEncrypt(String plaintext, String privateKeyBase64) {
214
+        try {
215
+            // 获取明文字节数组
216
+            byte[] bytes = plaintext.getBytes(StandardCharsets.UTF_8);
217
+            Cipher cipher = Cipher.getInstance(RSA);
218
+            // 编码前设定编码方式及密钥
219
+            PrivateKey privateKey = getPrivateKey(privateKeyBase64);
220
+            cipher.init(Cipher.ENCRYPT_MODE, privateKey);
221
+            int keyBit = getKeySize(privateKey);
222
+            int inputLen = bytes.length;
223
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
224
+            int offSet = 0;
225
+            int step = keyBit / 8 - 11;
226
+ 
227
+            for (int i = 0; inputLen - offSet > 0; offSet = i * step) {
228
+                byte[] cache;
229
+                if (inputLen - offSet > step) {
230
+                    cache = cipher.doFinal(bytes, offSet, step);
231
+                } else {
232
+                    cache = cipher.doFinal(bytes, offSet, inputLen - offSet);
233
+                }
234
+                out.write(cache, 0, cache.length);
235
+                ++i;
236
+            }
237
+            // 密文字节数组
238
+            byte[] ciphertextBytes = out.toByteArray();
239
+            out.close();
240
+            // 返回密文字节数组base64编码后的字符串
241
+            return new String(ENCODER.encode(ciphertextBytes), StandardCharsets.UTF_8);
242
+        } catch (Exception e) {
243
+            e.printStackTrace();
244
+            return null;
245
+        }
246
+    }
247
+ 
248
+    /**
249
+     * 私钥解密
250
+     *
251
+     * @param ciphertext       密文
252
+     * @param privateKeyBase64 私钥base64
253
+     * @return 明文
254
+     */
255
+    public static String privateKeyDecrypt(String ciphertext, String privateKeyBase64) {
256
+        try {
257
+            // 密文base64解码字节数组
258
+            byte[] bytes = DECODER.decode(ciphertext.getBytes(StandardCharsets.UTF_8));
259
+            Cipher cipher = Cipher.getInstance(RSA);
260
+            PrivateKey privateKey = getPrivateKey(privateKeyBase64);
261
+            cipher.init(Cipher.DECRYPT_MODE, privateKey);
262
+            int keyBit = getKeySize(privateKey);
263
+            int inputLen = bytes.length;
264
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
265
+            int offSet = 0;
266
+            int step = keyBit / 8;
267
+ 
268
+            for (int i = 0; inputLen - offSet > 0; offSet = i * step) {
269
+                byte[] cache;
270
+                if (inputLen - offSet > step) {
271
+                    cache = cipher.doFinal(bytes, offSet, step);
272
+                } else {
273
+                    cache = cipher.doFinal(bytes, offSet, inputLen - offSet);
274
+                }
275
+                out.write(cache, 0, cache.length);
276
+                ++i;
277
+            }
278
+            // 明文字节数组
279
+            byte[] plaintextBytes = out.toByteArray();
280
+            out.close();
281
+            return new String(plaintextBytes, StandardCharsets.UTF_8);
282
+        } catch (Exception e) {
283
+            e.printStackTrace();
284
+            return null;
285
+        }
286
+    }
287
+ 
288
+    /**
289
+     * 使用私钥对数据进行数字签名
290
+     *
291
+     * @param ciphertext       密文
292
+     * @param privateKeyBase64 私钥Base64
293
+     * @return 加密后的base64签名
294
+     */
295
+    public static String sign(String ciphertext, String privateKeyBase64) {
296
+        try {
297
+            // 密文字节数组
298
+            byte[] ciphertextBytes = DECODER.decode(ciphertext.getBytes(StandardCharsets.UTF_8));
299
+            PrivateKey privateKey = getPrivateKey(privateKeyBase64);
300
+            Signature signature = Signature.getInstance(SIGN_ALGORITHMS);
301
+            signature.initSign(privateKey);
302
+            signature.update(ciphertextBytes);
303
+            byte[] signed = signature.sign();
304
+            return new String(ENCODER.encode(signed), StandardCharsets.UTF_8);
305
+        } catch (Exception e) {
306
+            e.printStackTrace();
307
+        }
308
+        return null;
309
+    }
310
+ 
311
+    /**
312
+     * 使用公钥验证数字签名
313
+     *
314
+     * @param ciphertext      密文
315
+     * @param sign            签名
316
+     * @param publicKeyBase64 公钥base64
317
+     * @return 是否篡改了数据
318
+     */
319
+    public static boolean verify(String ciphertext, String sign, String publicKeyBase64) {
320
+        try {
321
+            // 密文base64解码字节数组
322
+            byte[] ciphertextBytes = DECODER.decode(ciphertext.getBytes(StandardCharsets.UTF_8));
323
+            // 签名base64解码字节数组
324
+            byte[] signBytes = DECODER.decode(sign.getBytes(StandardCharsets.UTF_8));
325
+            PublicKey publicKey = getPublicKey(publicKeyBase64);
326
+            Signature signature = Signature.getInstance(SIGN_ALGORITHMS);
327
+            signature.initVerify(publicKey);
328
+            signature.update(ciphertextBytes);
329
+            return signature.verify(signBytes);
330
+        } catch (Exception e) {
331
+            e.printStackTrace();
332
+        }
333
+        return false;
334
+    }
335
+ 
336
+    /**
337
+     * 获取公钥长度
338
+     *
339
+     * @param publicKey 公钥
340
+     * @return
341
+     */
342
+    public static int getKeySize(PublicKey publicKey) {
343
+        RSAPublicKey rsaPublicKey = (RSAPublicKey) publicKey;
344
+        return rsaPublicKey.getModulus().bitLength();
345
+    }
346
+ 
347
+    /**
348
+     * 获取私钥长度
349
+     *
350
+     * @param privateKey 私钥
351
+     * @return
352
+     */
353
+    public static int getKeySize(PrivateKey privateKey) {
354
+        RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) privateKey;
355
+        return rsaPrivateKey.getModulus().bitLength();
356
+    }
357
+ 
358
+}

+ 2 - 0
unis-plugin-api/unis-plugin-auth-api/src/main/java/com/unis/auth/api/SaBaseLoginUserApi.java

@@ -121,4 +121,6 @@ public interface SaBaseLoginUserApi {
121 121
      * @date 2022/4/27 22:57
122 122
      */
123 123
     void updateUserLoginInfo(String userId, String device);
124
+
125
+
124 126
 }

+ 7 - 0
unis-plugin/unis-plugin-auth/pom.xml

@@ -57,5 +57,12 @@
57 57
             <groupId>me.zhyd.oauth</groupId>
58 58
             <artifactId>JustAuth</artifactId>
59 59
         </dependency>
60
+
61
+        <dependency>
62
+            <groupId>io.jsonwebtoken</groupId>
63
+            <artifactId>jjwt</artifactId>
64
+            <version>0.9.1</version>
65
+        </dependency>
66
+
60 67
     </dependencies>
61 68
 </project>

+ 43 - 0
unis-plugin/unis-plugin-auth/src/main/java/com/unis/auth/modular/login/controller/UserCollectLoginController.java

@@ -0,0 +1,43 @@
1
+package com.unis.auth.modular.login.controller;
2
+
3
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
4
+import com.github.xiaoymin.knife4j.annotations.ApiSupport;
5
+import com.unis.auth.core.enums.SaClientTypeEnum;
6
+import com.unis.auth.modular.login.param.AuthAccountPasswordLoginParam;
7
+import com.unis.auth.modular.login.param.UserCollectPasswordLoginParam;
8
+import com.unis.auth.modular.login.service.AuthService;
9
+import com.unis.common.pojo.CommonResult;
10
+import io.swagger.annotations.Api;
11
+import io.swagger.annotations.ApiOperation;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.validation.annotation.Validated;
14
+import org.springframework.web.bind.annotation.PostMapping;
15
+import org.springframework.web.bind.annotation.RequestBody;
16
+import org.springframework.web.bind.annotation.RestController;
17
+
18
+import javax.validation.Valid;
19
+
20
+/**
21
+ * 移动端登录管理
22
+ *
23
+ * @author weiyinbin
24
+ * @date 2024/04/02 15:40
25
+ */
26
+@Api(tags = "移动端登录管理")
27
+@ApiSupport(author = "UNIS_TEAM", order = 1)
28
+@RestController
29
+@Validated
30
+public class UserCollectLoginController {
31
+
32
+    @Autowired
33
+    private AuthService authService;
34
+
35
+    @ApiOperationSupport(order = 1)
36
+    @ApiOperation("移动端登录密码登录")
37
+    @PostMapping("/auth/c/userCollect/login")
38
+    public CommonResult<String> doLogin(@RequestBody @Valid UserCollectPasswordLoginParam userCollectPasswordLoginParam) {
39
+        return CommonResult.data(authService.userLogin(userCollectPasswordLoginParam));
40
+    }
41
+
42
+
43
+}

+ 79 - 0
unis-plugin/unis-plugin-auth/src/main/java/com/unis/auth/modular/login/entity/UserCollectLogin.java

@@ -0,0 +1,79 @@
1
+/*
2
+ * Copyright [2022] [https://www.xiaonuo.vip]
3
+ *
4
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
5
+ *
6
+ * 1.请不要删除和修改根目录下的LICENSE文件。
7
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
8
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
9
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
10
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
11
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
12
+ */
13
+package com.unis.auth.modular.login.entity;
14
+
15
+import com.baomidou.mybatisplus.annotation.*;
16
+import io.swagger.annotations.ApiModelProperty;
17
+import lombok.Getter;
18
+import lombok.Setter;
19
+
20
+import java.util.Date;
21
+
22
+/**
23
+ * C端用户-采集人员实体
24
+ *
25
+ * @author hujinachun
26
+ * @date  2024/04/10 14:17
27
+ **/
28
+@Getter
29
+@Setter
30
+@TableName("biz_user_collect")
31
+public class UserCollectLogin {
32
+
33
+    /** ID */
34
+    @TableId
35
+    @ApiModelProperty(value = "ID", position = 1)
36
+    private Long id;
37
+
38
+    /** 删除标志 */
39
+    @ApiModelProperty(value = "删除标志", position = 2)
40
+    @TableLogic
41
+    @TableField(fill = FieldFill.INSERT)
42
+    private String deleteFlag;
43
+
44
+    /** 创建时间 */
45
+    @ApiModelProperty(value = "创建时间", position = 3)
46
+    @TableField(fill = FieldFill.INSERT)
47
+    private Date createTime;
48
+
49
+    /** 创建用户 */
50
+    @ApiModelProperty(value = "创建用户", position = 4)
51
+    @TableField(fill = FieldFill.INSERT)
52
+    private String createUser;
53
+
54
+    /** 修改时间 */
55
+    @ApiModelProperty(value = "修改时间", position = 5)
56
+    @TableField(fill = FieldFill.UPDATE)
57
+    private Date updateTime;
58
+
59
+    /** 修改用户 */
60
+    @ApiModelProperty(value = "修改用户", position = 6)
61
+    @TableField(fill = FieldFill.UPDATE)
62
+    private String updateUser;
63
+
64
+    /** 人员姓名 */
65
+    @ApiModelProperty(value = "人员姓名", position = 7)
66
+    private String name;
67
+
68
+    /** 手机号 */
69
+    @ApiModelProperty(value = "手机号", position = 8)
70
+    private String phone;
71
+
72
+    /** 联系地址 */
73
+    @ApiModelProperty(value = "联系地址", position = 9)
74
+    private String address;
75
+
76
+    /** 密码 */
77
+    @ApiModelProperty(value = "密码", position = 10)
78
+    private String password;
79
+}

+ 15 - 0
unis-plugin/unis-plugin-auth/src/main/java/com/unis/auth/modular/login/mapper/UserCollectLoginMapper.java

@@ -0,0 +1,15 @@
1
+package com.unis.auth.modular.login.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.unis.auth.modular.login.entity.UserCollectLogin;
5
+
6
+/**
7
+ * @author hujiangchun
8
+ * @version 1.0
9
+ * @Title
10
+ * @ProjectName
11
+ * @Description
12
+ * @date 2024/4/10 16:29
13
+ */
14
+public interface UserCollectLoginMapper extends BaseMapper<UserCollectLogin> {
15
+}

+ 40 - 0
unis-plugin/unis-plugin-auth/src/main/java/com/unis/auth/modular/login/param/UserCollectPasswordLoginParam.java

@@ -0,0 +1,40 @@
1
+package com.unis.auth.modular.login.param;
2
+
3
+import com.baomidou.mybatisplus.annotation.FieldFill;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableLogic;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Getter;
8
+import lombok.Setter;
9
+
10
+import javax.validation.constraints.NotBlank;
11
+import java.util.Date;
12
+
13
+/**
14
+ * @author hujiangchun
15
+ * @version 1.0
16
+ * @Title
17
+ * @ProjectName
18
+ * @Description
19
+ * @date 2024/4/10 15:04
20
+ */
21
+@Getter
22
+@Setter
23
+public class UserCollectPasswordLoginParam {
24
+
25
+    /**
26
+     * 密码
27
+     */
28
+    @ApiModelProperty(value = "密码", position = 10)
29
+    @NotBlank(message = "密码不能为空")
30
+    private String password;
31
+
32
+    /**
33
+     * 手机号
34
+     */
35
+    @ApiModelProperty(value = "手机号", position = 8)
36
+    @NotBlank(message = "手机号不能为空")
37
+    private String phone;
38
+
39
+
40
+}

+ 8 - 0
unis-plugin/unis-plugin-auth/src/main/java/com/unis/auth/modular/login/service/AuthService.java

@@ -19,6 +19,7 @@ import com.unis.auth.core.pojo.SaBaseLoginUser;
19 19
 import com.unis.auth.modular.login.param.AuthAccountPasswordLoginParam;
20 20
 import com.unis.auth.modular.login.param.AuthGetPhoneValidCodeParam;
21 21
 import com.unis.auth.modular.login.param.AuthPhoneValidCodeLoginParam;
22
+import com.unis.auth.modular.login.param.UserCollectPasswordLoginParam;
22 23
 import com.unis.auth.modular.login.result.AuthPicValidCodeResult;
23 24
 
24 25
 /**
@@ -84,4 +85,11 @@ public interface AuthService {
84 85
      * @date 2022/7/9 14:44
85 86
      */
86 87
     String doLoginById(String userId, String device, String type);
88
+/**
89
+ * @author: hujianchun
90
+ * @Description:
91
+ * @param:
92
+ * @return: 移动端手机号密码登录
93
+*/
94
+    String userLogin(UserCollectPasswordLoginParam userCollectPasswordLoginParam);
87 95
 }

+ 94 - 29
unis-plugin/unis-plugin-auth/src/main/java/com/unis/auth/modular/login/service/impl/AuthServiceImpl.java

@@ -23,6 +23,7 @@ import cn.hutool.core.util.PhoneUtil;
23 23
 import cn.hutool.core.util.RandomUtil;
24 24
 import cn.hutool.core.util.StrUtil;
25 25
 import cn.hutool.json.JSONObject;
26
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
26 27
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
27 28
 import com.unis.auth.api.SaBaseLoginUserApi;
28 29
 import com.unis.auth.core.enums.SaClientTypeEnum;
@@ -31,6 +32,12 @@ import com.unis.auth.core.pojo.SaBaseLoginUser;
31 32
 import com.unis.auth.core.util.StpClientLoginUserUtil;
32 33
 import com.unis.auth.core.util.StpClientUtil;
33 34
 import com.unis.auth.core.util.StpLoginUserUtil;
35
+import com.unis.auth.modular.login.entity.UserCollectLogin;
36
+import com.unis.auth.modular.login.mapper.UserCollectLoginMapper;
37
+import com.unis.auth.modular.login.param.UserCollectPasswordLoginParam;
38
+import com.unis.auth.modular.login.utils.JwtTokenUtils;
39
+import lombok.extern.slf4j.Slf4j;
40
+import org.springframework.beans.factory.annotation.Autowired;
34 41
 import org.springframework.stereotype.Service;
35 42
 import com.unis.auth.api.SaBaseLoginUserApi;
36 43
 import com.unis.auth.core.enums.SaClientTypeEnum;
@@ -55,6 +62,7 @@ import com.unis.dev.api.DevSmsApi;
55 62
 
56 63
 import javax.annotation.Resource;
57 64
 import java.util.List;
65
+import java.util.Objects;
58 66
 import java.util.stream.Collectors;
59 67
 
60 68
 /**
@@ -63,6 +71,7 @@ import java.util.stream.Collectors;
63 71
  * @author xuyuxiang
64 72
  * @date 2021/12/23 21:52
65 73
  */
74
+@Slf4j
66 75
 @Service
67 76
 public class AuthServiceImpl implements AuthService {
68 77
 
@@ -78,6 +87,9 @@ public class AuthServiceImpl implements AuthService {
78 87
     @Resource(name = "clientLoginUserApi")
79 88
     private SaBaseLoginUserApi clientLoginUserApi;
80 89
 
90
+    @Autowired
91
+    private UserCollectLoginMapper userCollectLoginMapper;
92
+
81 93
     @Resource
82 94
     private DevConfigApi devConfigApi;
83 95
 
@@ -124,7 +136,6 @@ public class AuthServiceImpl implements AuthService {
124 136
         String phoneValidCodeReqNo = IdWorker.getIdStr();
125 137
 
126 138
 
127
-
128 139
         // TODO 使用阿里云执行发送验证码,将验证码作为短信内容的参数变量放入,
129 140
         // TODO 签名不传则使用系统默认配置的签名,支持传入多个参数,示例:{"name":"张三","number":"15038****76"}
130 141
         //devSmsApi.sendSmsAliyun(phone, null, "验证码模板号", JSONUtil.toJsonStr(JSONUtil.createObj().set("validCode", phoneValidCode)));
@@ -148,17 +159,17 @@ public class AuthServiceImpl implements AuthService {
148 159
     private void validValidCode(String phoneOrEmail, String validCode, String validCodeReqNo) {
149 160
         // 依据请求号,取出缓存中的验证码进行校验
150 161
         Object existValidCode;
151
-        if(ObjectUtil.isEmpty(phoneOrEmail)) {
162
+        if (ObjectUtil.isEmpty(phoneOrEmail)) {
152 163
             existValidCode = commonCacheOperator.get(AUTH_VALID_CODE_CACHE_KEY + validCodeReqNo);
153 164
         } else {
154 165
             existValidCode = commonCacheOperator.get(AUTH_VALID_CODE_CACHE_KEY + phoneOrEmail + StrUtil.UNDERLINE + validCodeReqNo);
155 166
         }
156 167
         // 为空则直接验证码错误
157
-        if(ObjectUtil.isEmpty(existValidCode)) {
168
+        if (ObjectUtil.isEmpty(existValidCode)) {
158 169
             throw new CommonException(AuthExceptionEnum.VALID_CODE_ERROR.getValue());
159 170
         }
160 171
         // 移除该验证码
161
-        if(ObjectUtil.isEmpty(phoneOrEmail)) {
172
+        if (ObjectUtil.isEmpty(phoneOrEmail)) {
162 173
             commonCacheOperator.remove(AUTH_VALID_CODE_CACHE_KEY + validCodeReqNo);
163 174
         } else {
164 175
             commonCacheOperator.remove(AUTH_VALID_CODE_CACHE_KEY + phoneOrEmail + StrUtil.UNDERLINE + validCodeReqNo);
@@ -177,23 +188,23 @@ public class AuthServiceImpl implements AuthService {
177 188
      **/
178 189
     private void validPhoneValidCodeParam(String phoneOrEmail, String validCode, String validCodeReqNo, String type) {
179 190
         // 验证码正确则校验手机号格式
180
-        if(ObjectUtil.isEmpty(phoneOrEmail)) {
191
+        if (ObjectUtil.isEmpty(phoneOrEmail)) {
181 192
             // 执行校验验证码
182 193
             validValidCode(null, validCode, validCodeReqNo);
183 194
         } else {
184
-            if(!PhoneUtil.isMobile(phoneOrEmail) && !CommonEmailUtil.isEmail(phoneOrEmail)) {
195
+            if (!PhoneUtil.isMobile(phoneOrEmail) && !CommonEmailUtil.isEmail(phoneOrEmail)) {
185 196
                 throw new CommonException(AuthExceptionEnum.PHONE_FORMAT_ERROR.getValue());
186 197
             }
187 198
             // 执行校验验证码
188 199
             validValidCode(phoneOrEmail, validCode, validCodeReqNo);
189 200
 
190 201
             // 根据手机号获取用户信息,判断用户是否存在,根据B端或C端判断
191
-            if(SaClientTypeEnum.B.getValue().equals(type)) {
192
-                if(ObjectUtil.isEmpty(loginUserApi.getUserByPhone(phoneOrEmail))) {
202
+            if (SaClientTypeEnum.B.getValue().equals(type)) {
203
+                if (ObjectUtil.isEmpty(loginUserApi.getUserByPhone(phoneOrEmail))) {
193 204
                     throw new CommonException(AuthExceptionEnum.PHONE_ERROR.getValue());
194 205
                 }
195 206
             } else {
196
-                if(ObjectUtil.isEmpty(clientLoginUserApi.getClientUserByPhone(phoneOrEmail))) {
207
+                if (ObjectUtil.isEmpty(clientLoginUserApi.getClientUserByPhone(phoneOrEmail))) {
197 208
                     throw new CommonException(AuthExceptionEnum.PHONE_ERROR.getValue());
198 209
                 }
199 210
             }
@@ -211,25 +222,25 @@ public class AuthServiceImpl implements AuthService {
211 222
         // 获取设备
212 223
         String device = authAccountPasswordLoginParam.getDevice();
213 224
         // 默认指定为PC,如在小程序跟移动端的情况下,自行指定即可
214
-        if(ObjectUtil.isEmpty(device)) {
225
+        if (ObjectUtil.isEmpty(device)) {
215 226
             device = AuthDeviceTypeEnum.PC.getValue();
216 227
         } else {
217 228
             AuthDeviceTypeEnum.validate(device);
218 229
         }
219 230
         // 校验验证码
220 231
         String defaultCaptchaOpen = devConfigApi.getValueByKey(SNOWY_SYS_DEFAULT_CAPTCHA_OPEN_KEY);
221
-        if(ObjectUtil.isNotEmpty(defaultCaptchaOpen)) {
222
-            if(Convert.toBool(defaultCaptchaOpen)) {
232
+        if (ObjectUtil.isNotEmpty(defaultCaptchaOpen)) {
233
+            if (Convert.toBool(defaultCaptchaOpen)) {
223 234
                 // 获取验证码
224 235
                 String validCode = authAccountPasswordLoginParam.getValidCode();
225 236
                 // 获取验证码请求号
226 237
                 String validCodeReqNo = authAccountPasswordLoginParam.getValidCodeReqNo();
227 238
                 // 开启验证码则必须传入验证码
228
-                if(ObjectUtil.isEmpty(validCode)) {
239
+                if (ObjectUtil.isEmpty(validCode)) {
229 240
                     throw new CommonException(AuthExceptionEnum.VALID_CODE_EMPTY.getValue());
230 241
                 }
231 242
                 // 开启验证码则必须传入验证码请求号
232
-                if(ObjectUtil.isEmpty(validCodeReqNo)) {
243
+                if (ObjectUtil.isEmpty(validCodeReqNo)) {
233 244
                     throw new CommonException(AuthExceptionEnum.VALID_CODE_REQ_NO_EMPTY.getValue());
234 245
                 }
235 246
                 // 执行校验验证码
@@ -245,9 +256,9 @@ public class AuthServiceImpl implements AuthService {
245 256
             throw new CommonException(AuthExceptionEnum.PWD_DECRYPT_ERROR.getValue());
246 257
         }
247 258
         // 根据账号获取用户信息,根据B端或C端判断
248
-        if(SaClientTypeEnum.B.getValue().equals(type)) {
259
+        if (SaClientTypeEnum.B.getValue().equals(type)) {
249 260
             SaBaseLoginUser saBaseLoginUser = loginUserApi.getUserByAccount(account);
250
-            if(ObjectUtil.isEmpty(saBaseLoginUser)) {
261
+            if (ObjectUtil.isEmpty(saBaseLoginUser)) {
251 262
                 throw new CommonException(AuthExceptionEnum.ACCOUNT_ERROR.getValue());
252 263
             }
253 264
             if (!saBaseLoginUser.getPassword().equals(passwordHash)) {
@@ -261,7 +272,7 @@ public class AuthServiceImpl implements AuthService {
261 272
             return execLoginB(saBaseLoginUser, device);
262 273
         } else {
263 274
             SaBaseClientLoginUser saBaseClientLoginUser = clientLoginUserApi.getClientUserByAccount(account);
264
-            if(ObjectUtil.isEmpty(saBaseClientLoginUser)) {
275
+            if (ObjectUtil.isEmpty(saBaseClientLoginUser)) {
265 276
                 throw new CommonException(AuthExceptionEnum.ACCOUNT_ERROR.getValue());
266 277
             }
267 278
             if (!saBaseClientLoginUser.getPassword().equals(passwordHash)) {
@@ -281,22 +292,22 @@ public class AuthServiceImpl implements AuthService {
281 292
         // 设备
282 293
         String device = authPhoneValidCodeLoginParam.getDevice();
283 294
         // 默认指定为PC,如在小程序跟移动端的情况下,自行指定即可
284
-        if(ObjectUtil.isEmpty(device)) {
295
+        if (ObjectUtil.isEmpty(device)) {
285 296
             device = AuthDeviceTypeEnum.PC.getValue();
286 297
         } else {
287 298
             AuthDeviceTypeEnum.validate(device);
288 299
         }
289 300
         // 根据手机号获取用户信息,根据B端或C端判断
290
-        if(SaClientTypeEnum.B.getValue().equals(type)) {
301
+        if (SaClientTypeEnum.B.getValue().equals(type)) {
291 302
             SaBaseLoginUser saBaseLoginUser = loginUserApi.getUserByPhone(phone);
292
-            if(ObjectUtil.isEmpty(saBaseLoginUser)) {
303
+            if (ObjectUtil.isEmpty(saBaseLoginUser)) {
293 304
                 throw new CommonException(AuthExceptionEnum.ACCOUNT_ERROR.getValue());
294 305
             }
295 306
             // 执行B端登录
296 307
             return execLoginB(saBaseLoginUser, device);
297 308
         } else {
298 309
             SaBaseClientLoginUser saBaseClientLoginUser = clientLoginUserApi.getClientUserByPhone(phone);
299
-            if(ObjectUtil.isEmpty(saBaseClientLoginUser)) {
310
+            if (ObjectUtil.isEmpty(saBaseClientLoginUser)) {
300 311
                 throw new CommonException(AuthExceptionEnum.ACCOUNT_ERROR.getValue());
301 312
             }
302 313
             // 执行C端登录
@@ -313,25 +324,25 @@ public class AuthServiceImpl implements AuthService {
313 324
         long disableTime = StpUtil.getDisableTime(userAccount);
314 325
         if (disableTime > 0) {
315 326
             if (disableTime > 60) {
316
-                throw new CommonException(userAccount + "账号已被封禁, 请再"+ disableTime/60+ "分钟后重新尝试登录!!");
327
+                throw new CommonException(userAccount + "账号已被封禁, 请再" + disableTime / 60 + "分钟后重新尝试登录!!");
317 328
             }
318
-            throw new CommonException(userAccount + "账号已被封禁, 请再"+ disableTime+ "秒后重新尝试登录!!");
329
+            throw new CommonException(userAccount + "账号已被封禁, 请再" + disableTime + "秒后重新尝试登录!!");
319 330
         }
320 331
     }
321 332
 
322 333
     // redis中保存登录错误次数
323
-    private void saveLoginTimes(String userAccount){
334
+    private void saveLoginTimes(String userAccount) {
324 335
         String loginErrorKey = LOGIN_ERROR_TIMES_KEY_PREFIX + userAccount;
325 336
         Integer number = (Integer) commonCacheOperator.get(loginErrorKey);
326 337
         if (number == null) {
327 338
             // 如果redis中没有保存,代表失败第一次
328 339
             number = 2;
329
-            commonCacheOperator.put(loginErrorKey, number,5 * 60);
340
+            commonCacheOperator.put(loginErrorKey, number, 5 * 60);
330 341
             return;
331 342
         }
332 343
         if (number < 5) {
333 344
             number++;
334
-            commonCacheOperator.put(loginErrorKey, number,5 * 60);
345
+            commonCacheOperator.put(loginErrorKey, number, 5 * 60);
335 346
             return;
336 347
         }
337 348
         // 第五次封禁账号,第六次进入isDisableTime方法,返回用户还需等待时间
@@ -343,6 +354,7 @@ public class AuthServiceImpl implements AuthService {
343 354
 
344 355
     /**
345 356
      * 登录成功、清空登录次数
357
+     *
346 358
      * @param userAccount 账号
347 359
      */
348 360
     private void clearLoginErrorTimes(String userAccount) {
@@ -359,7 +371,7 @@ public class AuthServiceImpl implements AuthService {
359 371
      **/
360 372
     private String execLoginB(SaBaseLoginUser saBaseLoginUser, String device) {
361 373
         // 校验状态
362
-        if(!saBaseLoginUser.getEnabled()) {
374
+        if (!saBaseLoginUser.getEnabled()) {
363 375
             throw new CommonException(AuthExceptionEnum.ACCOUNT_DISABLED.getValue());
364 376
         }
365 377
 
@@ -399,7 +411,7 @@ public class AuthServiceImpl implements AuthService {
399 411
      **/
400 412
     private String execLoginC(SaBaseClientLoginUser saBaseClientLoginUser, String device) {
401 413
         // 校验状态
402
-        if(!saBaseClientLoginUser.getEnabled()) {
414
+        if (!saBaseClientLoginUser.getEnabled()) {
403 415
             throw new CommonException(AuthExceptionEnum.ACCOUNT_DISABLED.getValue());
404 416
         }
405 417
         // 执行登录
@@ -463,7 +475,7 @@ public class AuthServiceImpl implements AuthService {
463 475
     @Override
464 476
     public String doLoginById(String userId, String device, String type) {
465 477
         // 根据id获取用户信息,根据B端或C端判断
466
-        if(SaClientTypeEnum.B.getValue().equals(type)) {
478
+        if (SaClientTypeEnum.B.getValue().equals(type)) {
467 479
             SaBaseLoginUser saBaseLoginUser = loginUserApi.getUserById(userId);
468 480
             if (ObjectUtil.isEmpty(saBaseLoginUser)) {
469 481
                 throw new CommonException(AuthExceptionEnum.ACCOUNT_ERROR.getValue());
@@ -479,4 +491,57 @@ public class AuthServiceImpl implements AuthService {
479 491
             return execLoginC(saBaseClientLoginUser, device);
480 492
         }
481 493
     }
494
+
495
+    /**
496
+     * @author: hujianchun
497
+     * @Description:
498
+     * @param:
499
+     * @return: 移动端手机号密码登录
500
+     */
501
+    @Override
502
+    public String userLogin(UserCollectPasswordLoginParam userCollectPasswordLoginParam) {
503
+
504
+        // 手机号
505
+        String phone = userCollectPasswordLoginParam.getPhone();
506
+        //加密的密码
507
+        String password = userCollectPasswordLoginParam.getPassword();
508
+        //SM2密码解密
509
+        String passwordStr;
510
+        try {
511
+            passwordStr = CommonCryptogramUtil.doSm2Decrypt(password);
512
+
513
+        } catch (Exception e) {
514
+            log.error("SM2密码解密失败,请检查前端公钥,堆栈信息[{}]", e.getMessage());
515
+            throw new CommonException(AuthExceptionEnum.PWD_DECRYPT_ERROR.getValue());
516
+        }
517
+
518
+        List<UserCollectLogin> userCollectLogins = userCollectLoginMapper.selectList(new LambdaQueryWrapper<UserCollectLogin>()
519
+                .eq(UserCollectLogin::getPhone, phone));
520
+        if (CollectionUtil.isEmpty(userCollectLogins)) {
521
+            //返回用户信息
522
+            throw new CommonException(AuthExceptionEnum.PHONE_ERROR.getValue());
523
+        }
524
+
525
+        //有手机号,就进行密码校验
526
+        UserCollectLogin userCollectLogin = userCollectLogins.get(0);
527
+        if (!Objects.equals(userCollectLogin.getPassword(), passwordStr)) {
528
+            return AuthExceptionEnum.PWD_ERROR.getValue();
529
+
530
+        }
531
+      /*  try {
532
+            //执行登录
533
+            // 缓存用户信息,此处使用TokenSession为了指定时间内无操作则自动下线
534
+            StpClientUtil.login(userCollectLogin.getId(), new SaLoginModel().setExtra("name", userCollectLogin.getName()));
535
+            StpClientUtil.getTokenSession().set("loginUserToken", userCollectLogins);
536
+        } catch (Exception e) {
537
+            log.error("缓存失败");
538
+            throw new RuntimeException(e);
539
+        }*/
540
+
541
+        // 返回token
542
+        return JwtTokenUtils.createToken(userCollectLogin,50000);
543
+
544
+
545
+
546
+    }
482 547
 }

+ 85 - 0
unis-plugin/unis-plugin-auth/src/main/java/com/unis/auth/modular/login/utils/JwtTokenUtils.java

@@ -0,0 +1,85 @@
1
+package com.unis.auth.modular.login.utils;
2
+
3
+import cn.hutool.jwt.Claims;
4
+import com.unis.auth.modular.login.entity.UserCollectLogin;
5
+import com.unis.auth.modular.login.param.UserCollectPasswordLoginParam;
6
+import io.jsonwebtoken.*;
7
+import java.util.Date;
8
+import java.util.HashMap;
9
+import java.util.Map;
10
+
11
+public class JwtTokenUtils {
12
+
13
+    //用于签名的私钥
14
+    private static final String PRIVATE_KEY = "17CS3Flight";
15
+    //签发者
16
+    private static final String ISS = "qinghailiangshi";
17
+
18
+    //过期时间1小时
19
+    private static final long EXPIRATION_ONE_HOUR = 3600L;
20
+    //过期时间1天
21
+    private static final long EXPIRATION_ONE_DAY = 604800L;
22
+
23
+    /**
24
+     * 生成Token
25
+     * @param user
26
+     * @return
27
+     */
28
+    public static String createToken(UserCollectLogin user, int expireTimeType){
29
+        //过期时间
30
+        long expireTime = 0;
31
+        if (expireTimeType == 0){
32
+            expireTime = EXPIRATION_ONE_HOUR;
33
+        }else {
34
+            expireTime = EXPIRATION_ONE_DAY;
35
+        }
36
+
37
+        //Jwt头
38
+        Map<String,Object> header = new HashMap<>();
39
+        header.put("typ","JWT");
40
+        header.put("alg","HS256");
41
+        Map<String,Object> claims = new HashMap<>();
42
+        //自定义有效载荷部分
43
+        claims.put("id",user.getId());
44
+        claims.put("userName",user.getName());
45
+
46
+        return Jwts.builder()
47
+                //发证人
48
+                .setIssuer(ISS)
49
+                //Jwt头
50
+                .setHeader(header)
51
+                //有效载荷
52
+                .setClaims(claims)
53
+                //设定签发时间
54
+                .setIssuedAt(new Date())
55
+                //设定过期时间
56
+                .setExpiration(new Date(System.currentTimeMillis() + expireTime * 1000))
57
+                //使用HS256算法签名,PRIVATE_KEY为签名密钥
58
+                .signWith(SignatureAlgorithm.HS256,PRIVATE_KEY)
59
+                .compact();
60
+    }
61
+
62
+
63
+    /**
64
+     * 获取有效载荷
65
+     * @param token
66
+     * @return
67
+     */
68
+    public static Claims getClaimsFromToken(String token){
69
+        Claims claims = null;
70
+        try {
71
+            claims = (Claims) Jwts.parser()
72
+                    //设定解密私钥
73
+                    .setSigningKey(PRIVATE_KEY)
74
+                    //传入Token
75
+                    .parseClaimsJws(token)
76
+                    //获取载荷类
77
+                    .getBody();
78
+        }catch (Exception e){
79
+            return null;
80
+        }
81
+        return claims;
82
+    }
83
+
84
+
85
+}

+ 1 - 1
unis-plugin/unis-plugin-biz/src/main/java/com/unis/basic.info/modular/pricemonitor/param/PriceMonitorIdParam.java

@@ -30,6 +30,6 @@ public class PriceMonitorIdParam {
30 30
 
31 31
     /** ID */
32 32
     @ApiModelProperty(value = "ID", required = true)
33
-    @NotBlank(message = "id不能为空")
33
+   // @NotBlank(message = "id不能为空")
34 34
     private String id;
35 35
 }

+ 6 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/basic.info/modular/pricemonitor/param/PriceMonitorPageParam.java

@@ -48,4 +48,10 @@ public class PriceMonitorPageParam {
48 48
     @ApiModelProperty(value = "关键词")
49 49
     private String searchKey;
50 50
 
51
+    @ApiModelProperty(value = "监测点名称")
52
+    private String name;
53
+
54
+    @ApiModelProperty(value = "所属行政部门")
55
+    private String sysOrgId;
56
+
51 57
 }

+ 1 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/basic.info/modular/remindcycle/entity/RemindCycle.java

@@ -17,6 +17,7 @@ import io.swagger.annotations.ApiModelProperty;
17 17
 import lombok.Getter;
18 18
 import lombok.Setter;
19 19
 import java.math.BigDecimal;
20
+import java.time.LocalTime;
20 21
 import java.util.Date;
21 22
 
22 23
 /**

+ 1 - 0
unis-plugin/unis-plugin-client/src/main/java/com/unis/client/modular/user/provider/ClientLoginUserApiProvider.java

@@ -173,4 +173,5 @@ public class ClientLoginUserApiProvider implements SaBaseLoginUserApi {
173 173
     public void updateUserLoginInfo(String userId, String device) {
174 174
         clientUserService.updateUserLoginInfo(userId, device);
175 175
     }
176
+
176 177
 }

+ 2 - 0
unis-web-app/src/main/java/com/unis/core/config/GlobalConfigure.java

@@ -122,6 +122,8 @@ public class GlobalConfigure implements WebMvcConfigurer {
122 122
             "/auth/c/getPhoneValidCode",
123 123
             "/auth/c/doLogin",
124 124
             "/auth/c/doLoginByPhone",
125
+            "/auth/c/userCollect/login",
126
+
125 127
 
126 128
             "/auth/b/getPicCaptcha",
127 129
             "/auth/b/getPhoneValidCode",