|
@@ -1,11 +1,13 @@
|
1
|
1
|
package com.liang.controller;
|
2
|
2
|
|
|
3
|
+import cn.hutool.crypto.digest.MD5;
|
3
|
4
|
import com.github.pagehelper.PageHelper;
|
4
|
5
|
import com.github.pagehelper.PageInfo;
|
5
|
6
|
import com.liang.common.base.BaseResult;
|
6
|
7
|
import com.liang.common.JsonTool;
|
7
|
8
|
import com.liang.common.annotation.LogAround;
|
8
|
9
|
import com.liang.common.base.BaseController;
|
|
10
|
+import com.liang.common.config.SFTYProperties;
|
9
|
11
|
import com.liang.common.utils.ExcelPoiUtil;
|
10
|
12
|
import com.liang.common.utils.SHA256Utils;
|
11
|
13
|
import com.liang.common.utils.StringUtils;
|
|
@@ -22,6 +24,7 @@ import org.apache.poi.xssf.usermodel.XSSFCell;
|
22
|
24
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
23
|
25
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
24
|
26
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
27
|
+import org.bouncycastle.jce.provider.JDKMessageDigest;
|
25
|
28
|
import org.slf4j.Logger;
|
26
|
29
|
import org.slf4j.LoggerFactory;
|
27
|
30
|
import org.springframework.core.io.ResourceLoader;
|
|
@@ -32,6 +35,7 @@ import org.springframework.stereotype.Controller;
|
32
|
35
|
import org.springframework.ui.Model;
|
33
|
36
|
import org.springframework.web.bind.annotation.*;
|
34
|
37
|
import org.springframework.web.multipart.MultipartFile;
|
|
38
|
+import sun.misc.BASE64Encoder;
|
35
|
39
|
|
36
|
40
|
import javax.annotation.Resource;
|
37
|
41
|
import javax.servlet.ServletOutputStream;
|
|
@@ -41,6 +45,7 @@ import java.io.IOException;
|
41
|
45
|
import java.io.InputStream;
|
42
|
46
|
import java.net.URLEncoder;
|
43
|
47
|
import java.nio.charset.StandardCharsets;
|
|
48
|
+import java.security.MessageDigest;
|
44
|
49
|
import java.util.*;
|
45
|
50
|
|
46
|
51
|
/**
|
|
@@ -54,7 +59,7 @@ import java.util.*;
|
54
|
59
|
@Api(value = "系统用户管理控制器", tags = "系统用户管理控制器")
|
55
|
60
|
public class SysUserInfoController extends BaseController {
|
56
|
61
|
final static Logger logger = LoggerFactory.getLogger(SysUserInfoController.class);
|
57
|
|
-
|
|
62
|
+ final static String salt = "323@#@$1234da";
|
58
|
63
|
/**
|
59
|
64
|
* 服务对象
|
60
|
65
|
*/
|
|
@@ -173,6 +178,9 @@ public class SysUserInfoController extends BaseController {
|
173
|
178
|
return "userinfo/add";
|
174
|
179
|
}
|
175
|
180
|
|
|
181
|
+ @Resource
|
|
182
|
+ private SFTYProperties sftyProperties;
|
|
183
|
+
|
176
|
184
|
/**
|
177
|
185
|
* 新增
|
178
|
186
|
*
|
|
@@ -185,7 +193,8 @@ public class SysUserInfoController extends BaseController {
|
185
|
193
|
public BaseResult doAdd(SysUserInfo userInfo,
|
186
|
194
|
@RequestParam(required = false, defaultValue = "", value = "postStr") String postStr) {
|
187
|
195
|
// 再进行加密两次,才是正确密码
|
188
|
|
- String password = SHA256Utils.SHA256Encode(userInfo.getPassword());
|
|
196
|
+ String digestHex = MD5.create().digestHex(salt + sftyProperties.getInitPassword());
|
|
197
|
+ String password = SHA256Utils.SHA256Encode(digestHex);
|
189
|
198
|
userInfo.setPassword(password);
|
190
|
199
|
userInfo.setCreateUser(getSysUserId());
|
191
|
200
|
int num = sysUserInfoService.insert(userInfo);
|