部分疑问问题修改
This commit is contained in:
+1
-7
@@ -208,13 +208,7 @@ public class SysPermissionController {
|
||||
return Result.error("请登录系统!");
|
||||
}
|
||||
List<SysPermission> metaList = sysPermissionService.queryByUser(loginUser.getUsername());
|
||||
//添加首页路由
|
||||
//update-begin-author:taoyan date:20200211 for: TASK #3368 【路由缓存】首页的缓存设置有问题,需要根据后台的路由配置来实现是否缓存
|
||||
// if(!PermissionDataUtil.hasIndexPage(metaList)){
|
||||
// SysPermission indexMenu = sysPermissionService.list(new LambdaQueryWrapper<SysPermission>().eq(SysPermission::getName,"首页")).get(0);
|
||||
// metaList.add(0,indexMenu);
|
||||
// }
|
||||
//update-end-author:taoyan date:20200211 for: TASK #3368 【路由缓存】首页的缓存设置有问题,需要根据后台的路由配置来实现是否缓存
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
JSONArray menujsonArray = new JSONArray();
|
||||
this.getPermissionJsonArray(menujsonArray, metaList, null);
|
||||
|
||||
+21
-23
@@ -144,33 +144,31 @@ public class SysUserController {
|
||||
String rsaPublicKey = jsonObject.getString("rsaPublicKey");
|
||||
String rsaPrivateKey = String.valueOf(redisUtil.get(rsaPublicKey));
|
||||
SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
|
||||
String email;
|
||||
String phone;
|
||||
|
||||
try {
|
||||
//1:先用私钥解密数据
|
||||
email = CommonUtils.decryptBtRsaPriKey(user.getEmail(), rsaPrivateKey);
|
||||
phone = CommonUtils.decryptBtRsaPriKey(user.getPhone(), rsaPrivateKey);
|
||||
String email = CommonUtils.decryptBtRsaPriKey(user.getEmail(), rsaPrivateKey);
|
||||
String phone = CommonUtils.decryptBtRsaPriKey(user.getPhone(), rsaPrivateKey);
|
||||
|
||||
//3:把数据加密在放回来
|
||||
email = PasswordUtil.encrypt(email);
|
||||
phone = PasswordUtil.encrypt(phone);
|
||||
user.setEmail(email);
|
||||
user.setPhone(phone);
|
||||
|
||||
// 密码加盐
|
||||
String password = CommonUtils.decryptBtRsaPriKey(user.getPassword(), rsaPrivateKey);
|
||||
user.setCreateTime(new Date());//设置创建时间
|
||||
String salt = oConvertUtils.randomGen(8);
|
||||
user.setSalt(salt);
|
||||
String passwordEncode = PasswordUtil.encrypt(user.getUsername(), password, salt);
|
||||
user.setPassword(passwordEncode);
|
||||
user.setStatus(1);
|
||||
user.setDelFlag(CommonConstant.DEL_FLAG_0);
|
||||
} catch (Exception e) {
|
||||
throw new JeroBootException("解密失败!", e);
|
||||
throw new JeroBootException("邮箱和手机号解密失败!", e);
|
||||
}
|
||||
//3:把数据加密在放回来
|
||||
email = PasswordUtil.encrypt(email);
|
||||
phone = PasswordUtil.encrypt(phone);
|
||||
user.setEmail(email);
|
||||
user.setPhone(phone);
|
||||
String password;
|
||||
try {
|
||||
password = CommonUtils.decryptBtRsaPriKey(user.getPassword(), rsaPrivateKey);
|
||||
} catch (Exception e) {
|
||||
throw new JeroBootException("解密失败!", e);
|
||||
}
|
||||
user.setCreateTime(new Date());//设置创建时间
|
||||
String salt = oConvertUtils.randomGen(8);
|
||||
user.setSalt(salt);
|
||||
String passwordEncode = PasswordUtil.encrypt(user.getUsername(), password, salt);
|
||||
user.setPassword(passwordEncode);
|
||||
user.setStatus(1);
|
||||
user.setDelFlag(CommonConstant.DEL_FLAG_0);
|
||||
|
||||
sysUserService.addUserWithRole(user, selectedRoles);
|
||||
sysUserService.addUserWithDepart(user, selectedDeparts);
|
||||
result.success("添加成功!");
|
||||
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
package com.jero.modules.system.util;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
|
||||
import java.time.*;
|
||||
import java.util.Date;
|
||||
|
||||
public class DateUtils extends DateUtil {
|
||||
|
||||
/**
|
||||
* LocalDate转Date
|
||||
* @param localDate
|
||||
* @return Date
|
||||
*/
|
||||
public static Date localDate2Date(LocalDate localDate) {
|
||||
if (null == localDate) {
|
||||
return null;
|
||||
}
|
||||
ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
|
||||
return Date.from(zonedDateTime.toInstant());
|
||||
}
|
||||
|
||||
/**
|
||||
* Date转LocalDate
|
||||
* @param date
|
||||
*/
|
||||
public static LocalDate date2LocalDate(Date date) {
|
||||
if(null == date) {
|
||||
return null;
|
||||
}
|
||||
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
}
|
||||
|
||||
/**
|
||||
* LocalDateTime转Date
|
||||
* @param localDateTime
|
||||
* @return Date
|
||||
*/
|
||||
public static Date localDateTime2Date(LocalDateTime localDateTime){
|
||||
ZoneId zoneId = ZoneId.systemDefault();
|
||||
ZonedDateTime zonedDateTime = localDateTime.atZone(zoneId);
|
||||
Instant instant = zonedDateTime.toInstant();
|
||||
return Date.from(instant);
|
||||
}
|
||||
|
||||
/**
|
||||
* Date转LocalDateTime
|
||||
* @param date
|
||||
* @return LocalDateTime
|
||||
*/
|
||||
public static LocalDateTime date2LocalDateTime(Date date){
|
||||
Instant instant = date.toInstant();
|
||||
ZoneId zoneId = ZoneId.systemDefault();
|
||||
ZonedDateTime zonedDateTime = instant.atZone(zoneId);
|
||||
return zonedDateTime.toLocalDateTime();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user