重庆用户加解密
This commit is contained in:
parent
84299f69af
commit
a5f7806154
|
|
@ -8,6 +8,7 @@ import com.bonus.sgzb.auth.service.NwRegisterService;
|
|||
import com.bonus.sgzb.auth.service.NwUserLoginService;
|
||||
import com.bonus.sgzb.auth.utils.RsaUtil;
|
||||
import com.bonus.sgzb.common.core.constant.CacheConstants;
|
||||
import com.bonus.sgzb.common.core.constant.Constants;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.redis.service.RedisService;
|
||||
import com.bonus.sgzb.system.api.RemoteUserService;
|
||||
|
|
@ -35,7 +36,6 @@ import java.util.Map;
|
|||
@Slf4j
|
||||
public class TokenController {
|
||||
|
||||
private final String privateKey = "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKNPuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gAkM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWowcSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99EcvDQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthhYhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3UP8iWi1Qw0Y=";
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ public class TokenController {
|
|||
//web端登录
|
||||
@PostMapping("login")
|
||||
public R<?> login(@RequestBody LoginBody form) throws Exception {
|
||||
String decryptedData = RsaUtil.decryptByPrivateKey(form.getPassword(), privateKey);
|
||||
String decryptedData = RsaUtil.decryptByPrivateKey(form.getPassword(), Constants.privateKey);
|
||||
// 用户登录
|
||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), decryptedData);
|
||||
String uuid = form.getUuid();
|
||||
|
|
|
|||
|
|
@ -132,4 +132,25 @@ public class Constants
|
|||
*/
|
||||
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
|
||||
"org.springframework", "org.apache", "com.bonus.sgzb.common.core.utils.file" };
|
||||
|
||||
/**
|
||||
* 系统初始密码
|
||||
*/
|
||||
public static final String USER_PASSWORD = "CqCc@2024*";
|
||||
|
||||
/**
|
||||
* 系统初始密码
|
||||
*/
|
||||
public static final String CONFIG_KEY = "sys.user.initPassword";
|
||||
|
||||
/**
|
||||
* 加密公钥
|
||||
*/
|
||||
public static final String publicKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ==";
|
||||
|
||||
/**
|
||||
* 解密私钥
|
||||
*/
|
||||
public static final String privateKey = "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKNPuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gAkM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWowcSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99EcvDQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthhYhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3UP8iWi1Qw0Y=";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ public class FieldGenerator {
|
|||
String currentDate = today.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
// 生成UUID并取后4位,转换为纯数字类型
|
||||
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
String uuidLast4Digits = uuid.substring(uuid.length() - 4);
|
||||
String uuidLast4Digits = uuid.substring(uuid.length() - 7);
|
||||
int uuidLast4DigitsNumeric = Integer.parseInt(uuidLast4Digits, 16);
|
||||
return currentDate + "-" + String.format("%04d", uuidLast4DigitsNumeric % 10000);
|
||||
return currentDate + "-" + String.format("%07d", uuidLast4DigitsNumeric % 10000);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ public class MachIneDto {
|
|||
@ApiModelProperty(value = "设备编号")
|
||||
private String maCode;
|
||||
|
||||
/** 二维码 */
|
||||
@ApiModelProperty(value = "二维码")
|
||||
private String qrCode;
|
||||
|
||||
|
||||
/**
|
||||
* 类型id
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -72,4 +72,6 @@ public interface InventoryAndWarehousingMapper {
|
|||
* @return
|
||||
*/
|
||||
int selectTaskNumByMonth(@Param("date") Date nowDate);
|
||||
|
||||
int selectByCode(String code);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.bonus.sgzb.common.core.utils.DateUtils;
|
|||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import com.bonus.sgzb.material.config.ExceptionEnum;
|
||||
import com.bonus.sgzb.material.config.FieldGenerator;
|
||||
import com.bonus.sgzb.material.domain.MachIneDto;
|
||||
import com.bonus.sgzb.material.domain.PutInStorageBean;
|
||||
import com.bonus.sgzb.material.domain.SavePutInfoDto;
|
||||
|
|
@ -11,6 +12,7 @@ import com.bonus.sgzb.material.mapper.InventoryAndWarehousingMapper;
|
|||
import com.bonus.sgzb.material.service.InventoryAndWarehousingService;
|
||||
import com.bonus.sgzb.material.vo.GlobalContants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -18,6 +20,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author hay
|
||||
|
|
@ -72,13 +75,23 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
|
|||
log.info("新增入库盘点入参dto:{}", dto);
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
dto.setCreator(userId);
|
||||
List<String> codeList = new ArrayList<>();
|
||||
if (dto.getNum() != null) {
|
||||
while (codeList.size() < dto.getNum()) {
|
||||
String code = FieldGenerator.generateField();
|
||||
int count = selectByCode(code);
|
||||
if (count == 0 && !codeList.contains(code)) {
|
||||
codeList.add(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
String code = genderBackCode();
|
||||
int res;
|
||||
try {
|
||||
//1. 判断是数量还是编号入库,保存到不同表
|
||||
//1.1 如果是编号入库
|
||||
if (dto.getIsCode()) {
|
||||
res = insertMaMachineInfo(dto, code);
|
||||
res = insertMaMachineInfo(dto, codeList, code);
|
||||
if (res == 0) {
|
||||
log.error("insertMaMachineInfo方法插入异常");
|
||||
throw new RuntimeException("insertMaMachineInfo方法插入异常");
|
||||
|
|
@ -106,17 +119,38 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
|
|||
return AjaxResult.success(res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code从ma_machine表查询是否有数据,去重
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
private int selectByCode(String code) {
|
||||
return inventoryAndWarehousingMapper.selectByCode(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编号新增,插入ma_machine、ma_machine_label和ma_label_bind
|
||||
* @param dto
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
private int insertMaMachineInfo(SavePutInfoDto dto, String code) {
|
||||
private int insertMaMachineInfo(SavePutInfoDto dto, List<String> codeList, String code) {
|
||||
int res = 0;
|
||||
if (dto.getNum() != null) {
|
||||
MachIneDto machIneDto = dto.getMachIneDtoList().get(0);
|
||||
machIneDto.setCode(code);
|
||||
machIneDto.setPutInType(dto.getPutInType());
|
||||
machIneDto.setCreator(dto.getCreator());
|
||||
machIneDto.setNum(dto.getNum());
|
||||
machIneDto.setIsCode(dto.getIsCode());
|
||||
res += insertInfo(machIneDto);
|
||||
machIneDto.setInfoId(machIneDto.getId());
|
||||
}
|
||||
for (int i = 0; i < dto.getMachIneDtoList().size(); i++) {
|
||||
MachIneDto machIneDto = dto.getMachIneDtoList().get(i);
|
||||
machIneDto.setCode(code);
|
||||
String qrCode = codeList.get(i);
|
||||
machIneDto.setQrCode(qrCode);
|
||||
machIneDto.setIsCode(dto.getIsCode());
|
||||
machIneDto.setTypeId(dto.getTypeId());
|
||||
machIneDto.setCreator(dto.getCreator());
|
||||
|
|
@ -126,11 +160,17 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
|
|||
machIneDto.setCheckMan(dto.getCheckMan());
|
||||
machIneDto.setUnitId(dto.getUnitId());
|
||||
machIneDto.setProId(dto.getProId());
|
||||
machIneDto.setInfoId(dto.getMachIneDtoList().get(0).getInfoId());
|
||||
res += insertMachineInfo(machIneDto);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//插入ma_type_put_in_storage_info表,返回主键id
|
||||
private int insertInfo(MachIneDto machIneDto) {
|
||||
return inventoryAndWarehousingMapper.saveInfo(machIneDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法抽取,保持到ma_machine、ma_machine_label和ma_label_bind
|
||||
* @param machIneDto
|
||||
|
|
@ -150,11 +190,8 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
|
|||
* @return
|
||||
*/
|
||||
private int insertTypePutInStorageInfo(MachIneDto machIneDto) {
|
||||
//插入ma_type_put_in_storage_info表,返回主键id
|
||||
int res = inventoryAndWarehousingMapper.saveInfo(machIneDto);
|
||||
//ma_type_put_in_storage_details表
|
||||
res += inventoryAndWarehousingMapper.saveDetails(machIneDto);
|
||||
return res;
|
||||
return inventoryAndWarehousingMapper.saveDetails(machIneDto);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -176,6 +213,20 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
|
|||
*/
|
||||
private int insertPutInfo(SavePutInfoDto dto, String code) {
|
||||
int res = 0;
|
||||
Double total = dto.getMachIneDtoList().stream()
|
||||
.map(MachIneDto::getPutInStoreNum)
|
||||
.filter(num -> num != null)
|
||||
.collect(Collectors.summingDouble(Double::doubleValue));
|
||||
if (CollectionUtils.isNotEmpty(dto.getMachIneDtoList())) {
|
||||
MachIneDto machIneDto = dto.getMachIneDtoList().get(0);
|
||||
machIneDto.setCode(code);
|
||||
machIneDto.setPutInType(dto.getPutInType());
|
||||
machIneDto.setCreator(dto.getCreator());
|
||||
machIneDto.setIsCode(dto.getIsCode());
|
||||
machIneDto.setTotalNum(total);
|
||||
res += insertInfo(machIneDto);
|
||||
machIneDto.setInfoId(machIneDto.getId());
|
||||
}
|
||||
for (int i = 0; i < dto.getMachIneDtoList().size(); i++) {
|
||||
MachIneDto machIneDto = dto.getMachIneDtoList().get(i);
|
||||
machIneDto.setCreator(dto.getCreator());
|
||||
|
|
@ -184,6 +235,7 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
|
|||
machIneDto.setUnitId(dto.getUnitId());
|
||||
machIneDto.setProId(dto.getProId());
|
||||
machIneDto.setCode(code);
|
||||
machIneDto.setInfoId(dto.getMachIneDtoList().get(0).getInfoId());
|
||||
res += insertTypePutInStorageInfo(machIneDto);
|
||||
//根据类型追加ma_type表里面的num
|
||||
res += updateMaTypeInfo(machIneDto.getTypeId(), machIneDto.getPutInStoreNum());
|
||||
|
|
|
|||
|
|
@ -4,9 +4,19 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.sgzb.material.mapper.InventoryAndWarehousingMapper">
|
||||
<insert id="saveDetails" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO ma_type_put_in_storage_details (NUM,
|
||||
INSERT INTO ma_type_put_in_storage_details (
|
||||
<trim prefix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''">
|
||||
<choose>
|
||||
<when test="isCode and num != null and num != 0">
|
||||
NUM,
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="putInStoreNum != null and putInStoreNum != 0">
|
||||
NUM,
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="infoId != null and infoId != ''">
|
||||
INFO,
|
||||
</if>
|
||||
<if test="typeId != null and typeId != ''">
|
||||
|
|
@ -23,10 +33,20 @@
|
|||
</if>
|
||||
</trim>
|
||||
)
|
||||
VALUES (1,
|
||||
VALUES (
|
||||
<choose>
|
||||
<when test="isCode and num != null and num != 0">
|
||||
1,
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="putInStoreNum != null and putInStoreNum != 0">
|
||||
#{putInStoreNum},
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<trim prefix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''">
|
||||
#{id},
|
||||
<if test="infoId != null and infoId != ''">
|
||||
#{infoId},
|
||||
</if>
|
||||
<if test="typeId != null and typeId != ''">
|
||||
#{typeId},
|
||||
|
|
@ -52,7 +72,7 @@
|
|||
NUM,
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="putInStoreNum != null and putInStoreNum != 0">
|
||||
<if test="totalNum != null and totalNum != 0">
|
||||
NUM,
|
||||
</if>
|
||||
</otherwise>
|
||||
|
|
@ -81,8 +101,8 @@
|
|||
#{num},
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="putInStoreNum != null and putInStoreNum != 0">
|
||||
#{putInStoreNum},
|
||||
<if test="totalNum != null and totalNum != 0">
|
||||
#{totalNum},
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
|
@ -108,7 +128,7 @@
|
|||
<if test="typeId != null and typeId != '' ">type_id,</if>
|
||||
<if test="maCode != null and maCode != '' ">ma_code,</if>
|
||||
ma_status,
|
||||
<if test="code != null and code != ''">qr_code,</if>
|
||||
<if test="qrCode != null and qrCode != ''">qr_code,</if>
|
||||
<if test="buyPrice != null and buyPrice != ''">buy_price,</if>
|
||||
<if test="maVender != null and maVender != ''">ma_vender,</if>
|
||||
<if test="checkMan != null and checkMan != ''">check_man,</if>
|
||||
|
|
@ -120,7 +140,7 @@
|
|||
<if test="typeId != null and typeId != ''">#{typeId},</if>
|
||||
<if test="maCode != null and maCode != ''">#{maCode},</if>
|
||||
15,
|
||||
<if test="code != null and code != ''">#{code},</if>
|
||||
<if test="qrCode != null and qrCode != ''">#{qrCode},</if>
|
||||
<if test="buyPrice != null and buyPrice != ''">#{buyPrice},</if>
|
||||
<if test="maVender != null and maVender != ''">#{maVender},</if>
|
||||
<if test="checkMan != null and checkMan != ''">#{checkMan},</if>
|
||||
|
|
@ -133,14 +153,14 @@
|
|||
<insert id="insertMachineLabel">
|
||||
insert into ma_machine_label
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="code != null">label_code,</if>
|
||||
<if test="qrCode != null">label_code,</if>
|
||||
<if test="maId != null">ma_id,</if>
|
||||
is_bind,
|
||||
label_type,
|
||||
create_time
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="code != null">#{code},</if>
|
||||
<if test="qrCode != null">#{qrCode},</if>
|
||||
<if test="maId != null">#{maId},</if>
|
||||
1,
|
||||
9,
|
||||
|
|
@ -151,7 +171,7 @@
|
|||
insert into ma_label_bind
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="maId != null">ma_id,</if>
|
||||
<if test="code != null">label_code,</if>
|
||||
<if test="qrCode != null">label_code,</if>
|
||||
<if test="typeId != null">type_id,</if>
|
||||
<if test="creator != null">binder,</if>
|
||||
label_type,
|
||||
|
|
@ -160,7 +180,7 @@
|
|||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="maId != null">#{maId},</if>
|
||||
<if test="code != null">#{code},</if>
|
||||
<if test="qrCode != null">#{qrCode},</if>
|
||||
<if test="typeId != null">#{typeId},</if>
|
||||
<if test="creator != null">#{creator},</if>
|
||||
9,
|
||||
|
|
@ -211,4 +231,11 @@
|
|||
<select id="selectTaskNumByMonth" resultType="java.lang.Integer">
|
||||
select count(*) from ma_type_put_in_storage_info where DATE_FORMAT(CREATE_DATE,'%y%m') = DATE_FORMAT(#{date},'%y%m')
|
||||
</select>
|
||||
<select id="selectByCode" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from ma_machine
|
||||
<where>
|
||||
<if test="code != null ">and qr_code = #{code}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -6,9 +6,11 @@ import java.io.InputStream;
|
|||
import java.util.Arrays;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.bonus.sgzb.common.core.constant.Constants;
|
||||
import com.bonus.sgzb.common.core.domain.R;
|
||||
import com.bonus.sgzb.common.core.utils.DateTimeHelper;
|
||||
import com.bonus.sgzb.system.api.domain.SysFile;
|
||||
import com.bonus.sgzb.system.config.RsaUtil;
|
||||
import com.bonus.sgzb.system.domain.FileInfo;
|
||||
import com.bonus.sgzb.system.service.SysFileService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
|
@ -98,20 +100,22 @@ public class SysProfileController extends BaseController {
|
|||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updatePwd")
|
||||
public AjaxResult updatePwd(String oldPassword, String newPassword) {
|
||||
public AjaxResult updatePwd(String oldPassword, String newPassword) throws Exception {
|
||||
String oldDecrypt = RsaUtil.decryptByPrivateKey(oldPassword, Constants.privateKey);
|
||||
String newDecrypt = RsaUtil.decryptByPrivateKey(newPassword, Constants.privateKey);
|
||||
String username = SecurityUtils.getUsername();
|
||||
SysUser user = userService.selectUserByUserName(username);
|
||||
String password = user.getPassword();
|
||||
if (!SecurityUtils.matchesPassword(oldPassword, password)) {
|
||||
if (!SecurityUtils.matchesPassword(oldDecrypt, password)) {
|
||||
return error("修改密码失败,旧密码错误");
|
||||
}
|
||||
if (SecurityUtils.matchesPassword(newPassword, password)) {
|
||||
if (SecurityUtils.matchesPassword(newDecrypt, password)) {
|
||||
return error("新密码不能与旧密码相同");
|
||||
}
|
||||
if (userService.resetUserPwd(username, SecurityUtils.encryptPassword(newPassword)) > 0) {
|
||||
if (userService.resetUserPwd(username, SecurityUtils.encryptPassword(newDecrypt)) > 0) {
|
||||
// 更新缓存用户密码
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
loginUser.getSysUser().setPassword(SecurityUtils.encryptPassword(newPassword));
|
||||
loginUser.getSysUser().setPassword(SecurityUtils.encryptPassword(newDecrypt));
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return success();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.bonus.sgzb.system.api.domain.SysDept;
|
|||
import com.bonus.sgzb.system.api.domain.SysRole;
|
||||
import com.bonus.sgzb.system.api.domain.SysUser;
|
||||
import com.bonus.sgzb.system.api.model.LoginUser;
|
||||
import com.bonus.sgzb.system.config.RsaUtil;
|
||||
import com.bonus.sgzb.system.domain.po.UrgentProcessingUser;
|
||||
import com.bonus.sgzb.system.service.*;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -264,10 +265,11 @@ public class SysUserController extends BaseController {
|
|||
@RequiresPermissions("system:user:edit")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/resetPwd")
|
||||
public AjaxResult resetPwd(@RequestBody SysUser user) {
|
||||
public AjaxResult resetPwd(@RequestBody SysUser user) throws Exception {
|
||||
String decrypt = RsaUtil.decryptByPrivateKey(user.getPassword(), Constants.privateKey);
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
user.setPassword(SecurityUtils.encryptPassword(decrypt));
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.resetPwd(user));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue