|
@@ -58,6 +58,20 @@ public class IndexController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private ISysDeptService deptService;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * app新增用户
|
|
|
+ */
|
|
|
+ @PostMapping("/checkPhoneUnique")
|
|
|
+ public AjaxResult CheckUserNameUnique(@Validated @RequestBody SysUser user) {
|
|
|
+ if (StringUtils.isNotEmpty(user.getPhonenumber())
|
|
|
+ && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
|
|
+ return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
|
|
+ }
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* app新增用户
|
|
|
*/
|
|
@@ -69,7 +83,7 @@ public class IndexController extends BaseController {
|
|
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
|
|
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
|
|
}
|
|
|
- if (!user.getCode().equals(redisCache.getCacheObject(CacheConstants.SMS_CODE_KEY+user.getPhonenumber()))) {
|
|
|
+ if (!user.getCode().equals(redisCache.getCacheObject(CacheConstants.SMS_CODE_KEY + user.getPhonenumber()))) {
|
|
|
return error("新增用户'" + user.getUserName() + "'失败,短信验证码错误");
|
|
|
}
|
|
|
/* else if ("1".equals(checkStrongPwd(user.getPassword()))) {
|
|
@@ -81,11 +95,11 @@ public class IndexController extends BaseController {
|
|
|
user.setCreateBy(user.getUserName());
|
|
|
//生成一个密码
|
|
|
//String password = randomPassword();
|
|
|
- String password = user.getUserName()+"Abc#";
|
|
|
+ String password = user.getUserName() + "Abc#";
|
|
|
user.setPassword(password);
|
|
|
//todo 密码 要发送短信给用户
|
|
|
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
|
|
- if (userService.insertUser(user) > 0){
|
|
|
+ if (userService.insertUser(user) > 0) {
|
|
|
String token = loginService.loginZhuCe(user.getUserName(), password);
|
|
|
ajax.put(Constants.TOKEN, token);
|
|
|
return ajax;
|
|
@@ -139,7 +153,7 @@ public class IndexController extends BaseController {
|
|
|
public AjaxResult backstage(@RequestBody KaoqinRecord kaoQinRecord) {
|
|
|
//查询我部门和我部门下所有部门 去部门表中找到所有祖籍列表包含我的的部门id+自己组成
|
|
|
Long deptId = SecurityUtils.getDeptId();
|
|
|
- SysDept sysDept= new SysDept();
|
|
|
+ SysDept sysDept = new SysDept();
|
|
|
sysDept.setDeptId(deptId);
|
|
|
String ancestors = deptService.selectDeptListById(sysDept);
|
|
|
kaoQinRecord.setAncestors(ancestors);
|
|
@@ -188,22 +202,22 @@ public class IndexController extends BaseController {
|
|
|
Map yMpa = new HashMap(2);
|
|
|
List<Integer> normal = new ArrayList();
|
|
|
List<Integer> abnormal = new ArrayList();
|
|
|
- yMpa.put("normal",normal);
|
|
|
- yMpa.put("abnormal",abnormal);
|
|
|
+ yMpa.put("normal", normal);
|
|
|
+ yMpa.put("abnormal", abnormal);
|
|
|
|
|
|
for (String date : dates) {
|
|
|
kaoQinRecord.setKaTime(date);
|
|
|
List<KaoqinRecord> kaoqinRecords = kaoqinRecordService.selectKaoqinRecordList(kaoQinRecord);
|
|
|
Map<String, List<KaoqinRecord>> collect = kaoqinRecords.stream().collect(Collectors.groupingBy(KaoqinRecord::getKaStatus));
|
|
|
- if (collect != null){
|
|
|
+ if (collect != null) {
|
|
|
//正常
|
|
|
List<KaoqinRecord> kaoqinRecordsNormal = collect.get("1");
|
|
|
//异常
|
|
|
List<KaoqinRecord> kaoqinRecordsAbnormal = collect.get("2");
|
|
|
- if (kaoqinRecordsNormal != null){
|
|
|
+ if (kaoqinRecordsNormal != null) {
|
|
|
normal.add(kaoqinRecordsNormal.size());
|
|
|
}
|
|
|
- if (kaoqinRecordsAbnormal != null){
|
|
|
+ if (kaoqinRecordsAbnormal != null) {
|
|
|
abnormal.add(kaoqinRecordsAbnormal.size());
|
|
|
}
|
|
|
}
|
|
@@ -213,26 +227,36 @@ public class IndexController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /** 随机出用户输入的密码位数的密码,从大小写字母,数字中取值 */
|
|
|
- public static String randomPassword(){
|
|
|
+ /**
|
|
|
+ * 随机出用户输入的密码位数的密码,从大小写字母,数字中取值
|
|
|
+ */
|
|
|
+ public static String randomPassword() {
|
|
|
char[] password = new char[8];//创建char数组接收每一位随机出来的密码
|
|
|
Random rand = new Random();
|
|
|
//在ASCII码表中,48-57 数字,65-90 大写字母,97-122 小写字母
|
|
|
- for (int i = 0; i <password.length ; i++) {
|
|
|
+ for (int i = 0; i < password.length; i++) {
|
|
|
int choice = rand.nextInt(4);
|
|
|
- int lowercase = rand.nextInt(26)+65;//小写字母ASCII码表范围
|
|
|
- int uppercase = rand.nextInt(26)+97;//大写字母ASCII码表范围
|
|
|
- int figure = rand.nextInt(10)+48;//数字ASCII码表范围
|
|
|
+ int lowercase = rand.nextInt(26) + 65;//小写字母ASCII码表范围
|
|
|
+ int uppercase = rand.nextInt(26) + 97;//大写字母ASCII码表范围
|
|
|
+ int figure = rand.nextInt(10) + 48;//数字ASCII码表范围
|
|
|
int special = rand.nextInt(15) + 33;
|
|
|
//将 " 和 ' 替换成#
|
|
|
if (special == 34 || special == 39) {
|
|
|
special = 35;
|
|
|
}
|
|
|
- switch (choice){//从大写字母.小写字母.数字中随机取值
|
|
|
- case 0:password[i]=(char)lowercase;break;
|
|
|
- case 1:password[i]=(char)uppercase;break;
|
|
|
- case 2:password[i]=(char)figure;break;
|
|
|
- case 3:password[i] = (char) special;break;
|
|
|
+ switch (choice) {//从大写字母.小写字母.数字中随机取值
|
|
|
+ case 0:
|
|
|
+ password[i] = (char) lowercase;
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ password[i] = (char) uppercase;
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ password[i] = (char) figure;
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ password[i] = (char) special;
|
|
|
+ break;
|
|
|
default:
|
|
|
}
|
|
|
}
|