领料详情工程不显示问题bug
This commit is contained in:
parent
d54d79ea44
commit
579c0bf5b1
|
|
@ -83,6 +83,12 @@ public class TmTask implements Serializable {
|
||||||
@Excel(name = "领料工程",sort = 3)
|
@Excel(name = "领料工程",sort = 3)
|
||||||
private String proName;
|
private String proName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工程id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value="工程id")
|
||||||
|
private int proId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ import com.bonus.sgzb.system.api.domain.SysUser;
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class SysPasswordService
|
public class SysPasswordService {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
|
|
@ -34,51 +33,41 @@ public class SysPasswordService
|
||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
* @return 缓存键key
|
* @return 缓存键key
|
||||||
*/
|
*/
|
||||||
private String getCacheKey(String username)
|
private String getCacheKey(String username) {
|
||||||
{
|
|
||||||
return CacheConstants.PWD_ERR_CNT_KEY + username;
|
return CacheConstants.PWD_ERR_CNT_KEY + username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validate(SysUser user, String password)
|
public void validate(SysUser user, String password) {
|
||||||
{
|
|
||||||
String username = user.getUserName();
|
String username = user.getUserName();
|
||||||
|
|
||||||
Integer retryCount = redisService.getCacheObject(getCacheKey(username));
|
Integer retryCount = redisService.getCacheObject(getCacheKey(username));
|
||||||
|
|
||||||
if (retryCount == null)
|
if (retryCount == null) {
|
||||||
{
|
|
||||||
retryCount = 0;
|
retryCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retryCount >= Integer.valueOf(maxRetryCount).intValue())
|
if (retryCount >= Integer.valueOf(maxRetryCount).intValue()) {
|
||||||
{
|
|
||||||
String errMsg = String.format("密码输入错误%s次,帐户锁定%s分钟", maxRetryCount, lockTime);
|
String errMsg = String.format("密码输入错误%s次,帐户锁定%s分钟", maxRetryCount, lockTime);
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL,errMsg);
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, errMsg);
|
||||||
throw new ServiceException(errMsg);
|
throw new ServiceException(errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!matches(user, password))
|
if (!matches(user, password)) {
|
||||||
{
|
|
||||||
retryCount = retryCount + 1;
|
retryCount = retryCount + 1;
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", retryCount));
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", retryCount));
|
||||||
redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
|
redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
|
||||||
throw new ServiceException("用户不存在/密码错误");
|
throw new ServiceException("用户不存在/密码错误");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
clearLoginRecordCache(username);
|
clearLoginRecordCache(username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matches(SysUser user, String rawPassword)
|
public boolean matches(SysUser user, String rawPassword) {
|
||||||
{
|
|
||||||
return SecurityUtils.matchesPassword(rawPassword, user.getPassword());
|
return SecurityUtils.matchesPassword(rawPassword, user.getPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearLoginRecordCache(String loginName)
|
public void clearLoginRecordCache(String loginName) {
|
||||||
{
|
if (redisService.hasKey(getCacheKey(loginName))) {
|
||||||
if (redisService.hasKey(getCacheKey(loginName)))
|
|
||||||
{
|
|
||||||
redisService.deleteObject(getCacheKey(loginName));
|
redisService.deleteObject(getCacheKey(loginName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -533,7 +533,7 @@
|
||||||
<select id="getLeaseListTmTask" resultType="com.bonus.sgzb.base.api.domain.TmTask">
|
<select id="getLeaseListTmTask" resultType="com.bonus.sgzb.base.api.domain.TmTask">
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
|
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
|
||||||
bpi.pro_id as proId, bpi.pro_id as projectId,bpi.pro_name as proName,
|
bpi.lot_id as proId, bpi.pro_id as projectId,bpi.lot_name as proName,
|
||||||
bui.unit_id as unitId,bui.unit_name as unitName,
|
bui.unit_id as unitId,bui.unit_name as unitName,
|
||||||
tt.create_by as applyFor,d.`name` as taskName,
|
tt.create_by as applyFor,d.`name` as taskName,
|
||||||
|
|
||||||
|
|
@ -559,7 +559,7 @@
|
||||||
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
|
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
|
||||||
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
|
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
|
||||||
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
|
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
|
||||||
LEFT JOIN bm_project_info bpi ON bpi.pro_id = bai.project_id
|
LEFT JOIN bm_project_lot bpi ON bpi.lot_id = bai.project_id
|
||||||
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
||||||
LEFT JOIN sys_dic d ON d.id = tt.task_status
|
LEFT JOIN sys_dic d ON d.id = tt.task_status
|
||||||
LEFT JOIN lease_apply_info lai ON lai.task_id = tt.task_id
|
LEFT JOIN lease_apply_info lai ON lai.task_id = tt.task_id
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.bonus.sgzb.system.controller;
|
package com.bonus.sgzb.system.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
@ -33,8 +34,7 @@ import com.bonus.sgzb.system.service.ISysUserService;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/user/profile")
|
@RequestMapping("/user/profile")
|
||||||
public class SysProfileController extends BaseController
|
public class SysProfileController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserService userService;
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
|
@ -48,8 +48,7 @@ public class SysProfileController extends BaseController
|
||||||
* 个人信息
|
* 个人信息
|
||||||
*/
|
*/
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public AjaxResult profile()
|
public AjaxResult profile() {
|
||||||
{
|
|
||||||
String username = SecurityUtils.getUsername();
|
String username = SecurityUtils.getUsername();
|
||||||
SysUser user = userService.selectUserByUserName(username);
|
SysUser user = userService.selectUserByUserName(username);
|
||||||
AjaxResult ajax = AjaxResult.success(user);
|
AjaxResult ajax = AjaxResult.success(user);
|
||||||
|
|
@ -63,24 +62,20 @@ public class SysProfileController extends BaseController
|
||||||
*/
|
*/
|
||||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult updateProfile(@RequestBody SysUser user)
|
public AjaxResult updateProfile(@RequestBody SysUser user) {
|
||||||
{
|
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
SysUser currentUser = loginUser.getSysUser();
|
SysUser currentUser = loginUser.getSysUser();
|
||||||
currentUser.setNickName(user.getNickName());
|
currentUser.setNickName(user.getNickName());
|
||||||
currentUser.setEmail(user.getEmail());
|
currentUser.setEmail(user.getEmail());
|
||||||
currentUser.setPhonenumber(user.getPhonenumber());
|
currentUser.setPhonenumber(user.getPhonenumber());
|
||||||
currentUser.setSex(user.getSex());
|
currentUser.setSex(user.getSex());
|
||||||
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
|
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) {
|
||||||
{
|
|
||||||
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
|
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) {
|
||||||
{
|
|
||||||
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
if (userService.updateUserProfile(currentUser) > 0)
|
if (userService.updateUserProfile(currentUser) > 0) {
|
||||||
{
|
|
||||||
// 更新缓存用户信息
|
// 更新缓存用户信息
|
||||||
tokenService.setLoginUser(loginUser);
|
tokenService.setLoginUser(loginUser);
|
||||||
return success();
|
return success();
|
||||||
|
|
@ -93,21 +88,17 @@ public class SysProfileController extends BaseController
|
||||||
*/
|
*/
|
||||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/updatePwd")
|
@PutMapping("/updatePwd")
|
||||||
public AjaxResult updatePwd(String oldPassword, String newPassword)
|
public AjaxResult updatePwd(String oldPassword, String newPassword) {
|
||||||
{
|
|
||||||
String username = SecurityUtils.getUsername();
|
String username = SecurityUtils.getUsername();
|
||||||
SysUser user = userService.selectUserByUserName(username);
|
SysUser user = userService.selectUserByUserName(username);
|
||||||
String password = user.getPassword();
|
String password = user.getPassword();
|
||||||
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
if (!SecurityUtils.matchesPassword(oldPassword, password)) {
|
||||||
{
|
|
||||||
return error("修改密码失败,旧密码错误");
|
return error("修改密码失败,旧密码错误");
|
||||||
}
|
}
|
||||||
if (SecurityUtils.matchesPassword(newPassword, password))
|
if (SecurityUtils.matchesPassword(newPassword, password)) {
|
||||||
{
|
|
||||||
return error("新密码不能与旧密码相同");
|
return error("新密码不能与旧密码相同");
|
||||||
}
|
}
|
||||||
if (userService.resetUserPwd(username, SecurityUtils.encryptPassword(newPassword)) > 0)
|
if (userService.resetUserPwd(username, SecurityUtils.encryptPassword(newPassword)) > 0) {
|
||||||
{
|
|
||||||
// 更新缓存用户密码
|
// 更新缓存用户密码
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
loginUser.getSysUser().setPassword(SecurityUtils.encryptPassword(newPassword));
|
loginUser.getSysUser().setPassword(SecurityUtils.encryptPassword(newPassword));
|
||||||
|
|
@ -122,24 +113,19 @@ public class SysProfileController extends BaseController
|
||||||
*/
|
*/
|
||||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/avatar")
|
@PostMapping("/avatar")
|
||||||
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file)
|
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) {
|
||||||
{
|
if (!file.isEmpty()) {
|
||||||
if (!file.isEmpty())
|
|
||||||
{
|
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
String extension = FileTypeUtils.getExtension(file);
|
String extension = FileTypeUtils.getExtension(file);
|
||||||
if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION))
|
if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION)) {
|
||||||
{
|
|
||||||
return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式");
|
return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式");
|
||||||
}
|
}
|
||||||
R<SysFile> fileResult = remoteFileService.upload(file);
|
R<SysFile> fileResult = remoteFileService.upload(file);
|
||||||
if (StringUtils.isNull(fileResult) || StringUtils.isNull(fileResult.getData()))
|
if (StringUtils.isNull(fileResult) || StringUtils.isNull(fileResult.getData())) {
|
||||||
{
|
|
||||||
return error("文件服务异常,请联系管理员");
|
return error("文件服务异常,请联系管理员");
|
||||||
}
|
}
|
||||||
String url = fileResult.getData().getUrl();
|
String url = fileResult.getData().getUrl();
|
||||||
if (userService.updateUserAvatar(loginUser.getUsername(), url))
|
if (userService.updateUserAvatar(loginUser.getUsername(), url)) {
|
||||||
{
|
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
ajax.put("imgUrl", url);
|
ajax.put("imgUrl", url);
|
||||||
// 更新缓存用户头像
|
// 更新缓存用户头像
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue