From 2dc8aaad4996850cb8c8285da8edbc1cbfd82fb2 Mon Sep 17 00:00:00 2001 From: ZhiJian <18625010203@163.com> Date: Wed, 24 Jul 2024 00:29:31 +0800 Subject: [PATCH] =?UTF-8?q?=C3=A6=C2=B7fix=E5=AF=BC=E5=85=A5,=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=A0=A1=E6=96=87=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/web/CxxmUserController.java | 10 +- .../com/ruoyi/cxxm/domain/vo/UserGroup.java | 4 + .../service/impl/CxxmUserServiceImpl.java | 77 ++++++- .../service/impl/ZftkTaskServiceImpl.java | 31 +-- .../cxxm/service/impl/ZtTaskServiceImpl.java | 31 +-- .../service/impl/ZttbTaskServiceImpl.java | 34 +-- .../filter/JwtAuthenticationTokenFilter.java | 2 + .../web/service/SysLoginService.java | 76 +++--- ruoyi-ui/src/permission.js | 2 +- .../src/views/cxxm/zftkTask/assign/index.vue | 164 +++++++------ .../src/views/cxxm/zftkTask/check/index.vue | 8 + .../src/views/cxxm/zftkTask/detail/index.vue | 4 +- .../views/cxxm/zftkTask/distribute/index.vue | 167 +++++++------- .../src/views/cxxm/zftkTask/import/index.vue | 44 +++- .../src/views/cxxm/ztTask/assign/index.vue | 216 ++++++++++-------- .../src/views/cxxm/ztTask/check/index.vue | 8 + .../src/views/cxxm/ztTask/detail/index.vue | 5 +- .../views/cxxm/ztTask/distribute/index.vue | 6 +- .../src/views/cxxm/ztTask/import/index.vue | 42 +++- .../src/views/cxxm/zttbTask/assign/index.vue | 83 +++---- .../src/views/cxxm/zttbTask/check/index.vue | 8 + .../src/views/cxxm/zttbTask/detail/index.vue | 5 +- .../views/cxxm/zttbTask/distribute/index.vue | 6 +- .../src/views/cxxm/zttbTask/import/index.vue | 122 ++++++---- ruoyi-ui/src/views/system/user/authRole.vue | 42 ++-- ruoyi-ui/src/views/system/user/index.vue | 29 ++- 26 files changed, 727 insertions(+), 499 deletions(-) diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/controller/web/CxxmUserController.java b/cxxm/src/main/java/com/ruoyi/cxxm/controller/web/CxxmUserController.java index 310ba3d2..00e23b94 100644 --- a/cxxm/src/main/java/com/ruoyi/cxxm/controller/web/CxxmUserController.java +++ b/cxxm/src/main/java/com/ruoyi/cxxm/controller/web/CxxmUserController.java @@ -45,7 +45,15 @@ public class CxxmUserController { @PostMapping("/importData") public AjaxResult importData(@ApiParam(value = "用户数据文件") @RequestPart MultipartFile file,@ApiParam(value = "是否更新已经存在的用户数据") @RequestParam(required = false) boolean updateSupport) throws Exception { ExcelUtil util = new ExcelUtil(CxxmUserZJ.class); - List userList = util.importExcel(file.getInputStream()); + List userList; + try { + userList = util.importExcel("用户数据",file.getInputStream(),0); + if (userList.contains(null)) { + return AjaxResult.error("数据解析失败,请严格按照导入模板填写数据!"); + } + }catch (Exception e) { + return AjaxResult.error("数据解析失败,请严格按照导入模板填写数据!"); + } String operName = getUsername(); String message = userService.importCxxmUser(userList, updateSupport, operName); return success(message); diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/UserGroup.java b/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/UserGroup.java index 6f847d02..8a778d85 100644 --- a/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/UserGroup.java +++ b/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/UserGroup.java @@ -10,4 +10,8 @@ public class UserGroup { private Integer userCount; private Integer taskCount; + + private Integer yzpCount; + + private Integer wzpCount; } diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/CxxmUserServiceImpl.java b/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/CxxmUserServiceImpl.java index 18e7e8b6..1940229a 100644 --- a/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/CxxmUserServiceImpl.java +++ b/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/CxxmUserServiceImpl.java @@ -97,6 +97,9 @@ public class CxxmUserServiceImpl implements ICxxmUserService { if (user.getGroupName() == null || Objects.equals(user.getGroupName(), "")) { user.setGroupName(""); } + if (user.getSex() == null || Objects.equals(user.getSex(), "")) { + user.setSex("2"); // 设置性别未知 + } // 验证是否存在这个用户 SysUser u = userMapper.selectUserByUserName(user.getUserName()); if (StringUtils.isNull(u)) { @@ -119,17 +122,26 @@ public class CxxmUserServiceImpl implements ICxxmUserService { successMsg.append("
" + successNum + "、账号 " + user.getUserName() + " 更新成功"); } else { failureNum++; - failureMsg.append("
" + failureNum + "、账号 " + user.getUserName() + " 已存在"); + int row = userList.indexOf(user) + 1; + failureMsg.append("
" + failureNum + "、第" + row + "行:账号 " + user.getUserName() + " 已存在"); } } catch (Exception e) { failureNum++; - String msg = "
" + failureNum + "、账号 " + user.getUserName() + " 导入失败:"; - failureMsg.append(msg + e.getMessage()); + String msg; + int row = userList.indexOf(user) + 1; + if (user.getUserName() == null || Objects.equals(user.getUserName(), "")) { + msg = "
" + failureNum + "、第" + row + "行:登录账号不能为空"; + } else { + msg = "
" + failureNum + "、第" + row + "行:账号 " + user.getUserName() + " 导入失败。"; + msg += e.getMessage(); + } + + failureMsg.append(msg); log.error(msg, e); } } if (failureNum > 0) { - failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + failureMsg.insert(0, "共 " + failureNum + " 条数据导入失败,错误如下:"); throw new ServiceException(failureMsg.toString()); } else { successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); @@ -139,6 +151,7 @@ public class CxxmUserServiceImpl implements ICxxmUserService { /** * 根据部门id获取部门下所有用户组 + * * @param deptId * @return */ @@ -150,16 +163,31 @@ public class CxxmUserServiceImpl implements ICxxmUserService { .eq(ZftkTask::getGroupName, userGroup.getGroupName()) .count(); userGroup.setTaskCount(count.intValue()); +// Long count = zftkTaskService.lambdaQuery() +// .eq(ZftkTask::getXzmc, userGroup.getGroupName()) +// .count(); +// userGroup.setTaskCount(count.intValue()); +// Long yzp = zftkTaskService.lambdaQuery() +// .eq(ZftkTask::getXzmc, userGroup.getGroupName()) +// .eq(ZftkTask::getXzxfqk, "1") +// .count(); +// userGroup.setYzpCount(yzp.intValue()); +// Long wzp = zftkTaskService.lambdaQuery() +// .eq(ZftkTask::getXzmc, userGroup.getGroupName()) +// .eq(ZftkTask::getXzxfqk, "0") +// .count(); +// userGroup.setWzpCount(wzp.intValue()); } return userGroups; } /** * 根据用户组名获取用户组下的所有用户 + * * @param groupName * @return */ - public List getZftkUserListByGroupName(String groupName,Long deptId){ + public List getZftkUserListByGroupName(String groupName, Long deptId) { SysUser user = new SysUser(); user.setGroupName(groupName); user.setDeptId(deptId); @@ -190,10 +218,11 @@ public class CxxmUserServiceImpl implements ICxxmUserService { /** * 根据用户组名获取用户组下的所有用户 + * * @param groupName * @return */ - public List getZttbUserListByGroupName(String groupName,Long deptId){ + public List getZttbUserListByGroupName(String groupName, Long deptId) { SysUser user = new SysUser(); user.setGroupName(groupName); user.setDeptId(deptId); @@ -207,6 +236,7 @@ public class CxxmUserServiceImpl implements ICxxmUserService { /** * 根据部门id获取部门下所有用户组 + * * @param deptId * @return */ @@ -214,20 +244,35 @@ public class CxxmUserServiceImpl implements ICxxmUserService { public List getZttbGroupNameByDeptId(Long deptId) { List userGroups = cxxmUserMapper.getGroupNameByDeptId(deptId); for (UserGroup userGroup : userGroups) { +// Long count = zttbTaskService.lambdaQuery() +// .eq(ZttbTask::getGroupName, userGroup.getGroupName()) +// .count(); +// userGroup.setTaskCount(count.intValue()); Long count = zttbTaskService.lambdaQuery() - .eq(ZttbTask::getGroupName, userGroup.getGroupName()) + .eq(ZttbTask::getXzmc, userGroup.getGroupName()) .count(); userGroup.setTaskCount(count.intValue()); + Long yzp = zttbTaskService.lambdaQuery() + .eq(ZttbTask::getXzmc, userGroup.getGroupName()) + .eq(ZttbTask::getXzxfqk, "1") + .count(); + userGroup.setYzpCount(yzp.intValue()); + Long wzp = zttbTaskService.lambdaQuery() + .eq(ZttbTask::getXzmc, userGroup.getGroupName()) + .eq(ZttbTask::getXzxfqk, "0") + .count(); + userGroup.setWzpCount(wzp.intValue()); } return userGroups; } /** * 根据用户组名获取用户组下的所有用户 + * * @param groupName * @return */ - public List getZtUserListByGroupName(String groupName,Long deptId){ + public List getZtUserListByGroupName(String groupName, Long deptId) { SysUser user = new SysUser(); user.setGroupName(groupName); user.setDeptId(deptId); @@ -241,6 +286,7 @@ public class CxxmUserServiceImpl implements ICxxmUserService { /** * 根据部门id获取部门下所有用户组 + * * @param deptId * @return */ @@ -248,10 +294,23 @@ public class CxxmUserServiceImpl implements ICxxmUserService { public List getZtGroupNameByDeptId(Long deptId) { List userGroups = cxxmUserMapper.getGroupNameByDeptId(deptId); for (UserGroup userGroup : userGroups) { +// Long count = ztTaskService.lambdaQuery() +// .eq(ZtTask::getGroupName, userGroup.getGroupName()) +// .count(); Long count = ztTaskService.lambdaQuery() - .eq(ZtTask::getGroupName, userGroup.getGroupName()) + .eq(ZtTask::getXzmc, userGroup.getGroupName()) .count(); userGroup.setTaskCount(count.intValue()); + Long yzp = ztTaskService.lambdaQuery() + .eq(ZtTask::getXzmc, userGroup.getGroupName()) + .eq(ZtTask::getXzxfqk, "1") + .count(); + userGroup.setYzpCount(yzp.intValue()); + Long wzp = ztTaskService.lambdaQuery() + .eq(ZtTask::getXzmc, userGroup.getGroupName()) + .eq(ZtTask::getXzxfqk, "0") + .count(); + userGroup.setWzpCount(wzp.intValue()); } return userGroups; } diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/ZftkTaskServiceImpl.java b/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/ZftkTaskServiceImpl.java index 3abde649..d91f324d 100644 --- a/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/ZftkTaskServiceImpl.java +++ b/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/ZftkTaskServiceImpl.java @@ -207,18 +207,23 @@ public class ZftkTaskServiceImpl extends ServiceImpl i // 根据部门ID查询该部门及其所有父部门的任务 queryWrapper.in(Objects.nonNull(task.getDeptId()), ZftkTask::getDeptId, deptMapper.getAllAncestorsByDeptId(task.getDeptId())); - // 根据年份进行模糊查询 - queryWrapper.like(Objects.nonNull(task.getNian()), ZftkTask::getNian, task.getNian()); - // 根据任务所在县进行模糊查询 - queryWrapper.or().like(Objects.nonNull(task.getXian()), ZftkTask::getXian, task.getXian()); - // 根据任务项目名称进行模糊查询 - queryWrapper.or().like(Objects.nonNull(task.getXmmc()), ZftkTask::getXmmc, task.getXmmc()); - // 根据任务地块号进行模糊查询 - queryWrapper.or().like(Objects.nonNull(task.getDkh()), ZftkTask::getDkh, task.getDkh()); - // 根据功能分区进行模糊查询 - queryWrapper.or().like(Objects.nonNull(task.getGnfq()), ZftkTask::getGnfq, task.getGnfq()); - // 根据任务动工状态进行模糊查询 - queryWrapper.or().like(Objects.nonNull(task.getDgzt()), ZftkTask::getDgzt, task.getDgzt()); + + queryWrapper.and( + Objects.nonNull(task.getNian()), + // 根据年份进行模糊查询 + qw -> qw.like(Objects.nonNull(task.getNian()), ZftkTask::getNian, task.getNian()) + // 根据任务所在县进行模糊查询 + .or().like(Objects.nonNull(task.getXian()), ZftkTask::getXian, task.getXian()) + // 根据任务项目名称进行模糊查询 + .or().like(Objects.nonNull(task.getXmmc()), ZftkTask::getXmmc, task.getXmmc()) + // 根据任务地块号进行模糊查询 + .or().like(Objects.nonNull(task.getDkh()), ZftkTask::getDkh, task.getDkh()) + // 根据功能分区进行模糊查询 + .or().like(Objects.nonNull(task.getGnfq()), ZftkTask::getGnfq, task.getGnfq()) + // 根据任务动工状态进行模糊查询 + .or().like(Objects.nonNull(task.getDgzt()), ZftkTask::getDgzt, task.getDgzt()) + ); + // 根据处理时间进行区间查询 List drsjQuery = task.getDrsjQuery(); @@ -326,7 +331,7 @@ public class ZftkTaskServiceImpl extends ServiceImpl i // 获取图斑信息 ZftkTask task = this.getById(taskId); - if(task == null){ + if (task == null) { throw new RuntimeException("Id=" + taskId + "的任务不存在!"); } TaskGis taskGis = this.selectTaskGisById(taskId); diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/ZtTaskServiceImpl.java b/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/ZtTaskServiceImpl.java index 21180ca6..022ba8ac 100644 --- a/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/ZtTaskServiceImpl.java +++ b/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/ZtTaskServiceImpl.java @@ -117,7 +117,7 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme Map taskMap = JSONObject.parseObject(properties.toString(), Map.class); // 校验必填字段是否存在 - String[] requiredFields = new String[]{"NF", "XMC", "XZMC", "CJDCQ", "JCBH", "XFSJ", "JCMJ", "GDMJ", "XMMC"}; + String[] requiredFields = new String[]{"NF", "XMC", "XZMC", "CJDCQ", "JCBH", "XFSJ", "JCMJ", "GDMJ", "XMMC"}; for (String field : requiredFields) { if (taskMap.get(field) == null) { throw new RuntimeException(StringUtils.format("缺少必须字段:{},请检查导入数据!", field)); @@ -175,6 +175,7 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme /** * 构造查询条件对象 + * * @param task * @return */ @@ -190,6 +191,7 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme // 构建查询条件 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + // 根据任务类型进行精确查询 queryWrapper.eq(Objects.nonNull(task.getRwlx()), ZtTask::getRwlx, task.getRwlx()); // 根据州级下发情况进行精确查询 @@ -208,17 +210,20 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme queryWrapper.in(Objects.nonNull(task.getDeptId()), ZtTask::getDeptId, deptMapper.getAllAncestorsByDeptId(task.getDeptId())); // 根据年份进行模糊查询 - queryWrapper.like(Objects.nonNull(task.getNian()), ZtTask::getNian, task.getNian()); - // 根据任务所在县进行模糊查询 - queryWrapper.or().like(Objects.nonNull(task.getXian()), ZtTask::getXian, task.getXian()); - // 根据任务所在乡镇进行模糊查询 - queryWrapper.or().like(Objects.nonNull(task.getXzmc()), ZtTask::getXzmc, task.getXzmc()); - queryWrapper.or().like(Objects.nonNull(task.getCsmc()), ZtTask::getCsmc, task.getCsmc()); - queryWrapper.or().like(Objects.nonNull(task.getTblx()), ZtTask::getTblx, task.getTblx()); - queryWrapper.or().like(Objects.nonNull(task.getTbbh()), ZtTask::getTbbh, task.getTbbh()); - queryWrapper.or().like(Objects.nonNull(task.getCzwt()), ZtTask::getCzwt, task.getCzwt()); - // 根据任务项目名称进行模糊查询 - queryWrapper.or().like(Objects.nonNull(task.getXmmc()), ZtTask::getXmmc, task.getXmmc()); + queryWrapper.and( + Objects.nonNull(task.getNian()), + qw -> qw.like(Objects.nonNull(task.getNian()), ZtTask::getNian, task.getNian()) + // 根据任务所在县进行模糊查询 + .or().like(Objects.nonNull(task.getXian()), ZtTask::getXian, task.getXian()) + // 根据任务所在乡镇进行模糊查询 + .or().like(Objects.nonNull(task.getXzmc()), ZtTask::getXzmc, task.getXzmc()) + .or().like(Objects.nonNull(task.getCsmc()), ZtTask::getCsmc, task.getCsmc()) + .or().like(Objects.nonNull(task.getTblx()), ZtTask::getTblx, task.getTblx()) + .or().like(Objects.nonNull(task.getTbbh()), ZtTask::getTbbh, task.getTbbh()) + .or().like(Objects.nonNull(task.getCzwt()), ZtTask::getCzwt, task.getCzwt()) + // 根据任务项目名称进行模糊查询 + .or().like(Objects.nonNull(task.getXmmc()), ZtTask::getXmmc, task.getXmmc()) + ); // 根据处理时间进行区间查询 List drsjQuery = task.getDrsjQuery(); @@ -326,7 +331,7 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme // 获取图斑信息 ZtTask task = this.getById(taskId); - if(task == null){ + if (task == null) { throw new RuntimeException("Id=" + taskId + "的任务不存在!"); } TaskGis taskGis = this.selectTaskGisById(taskId); diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/ZttbTaskServiceImpl.java b/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/ZttbTaskServiceImpl.java index dccf0a00..e2ad7c3e 100644 --- a/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/ZttbTaskServiceImpl.java +++ b/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/ZttbTaskServiceImpl.java @@ -114,7 +114,7 @@ public class ZttbTaskServiceImpl extends ServiceImpl i Object properties = item.get("properties"); Map taskMap = JSONObject.parseObject(properties.toString(), Map.class); // 校验必填字段是否存在 - String[] requiredFields = new String[]{"NF", "XMC", "XZMC", "CJDCQ", "JCBH", "XFSJ", "JCMJ", "GDMJ", "XMMC"}; + String[] requiredFields = new String[]{"NF", "XMC", "XZMC", "CJDCQ", "JCBH", "XFSJ", "JCMJ", "GDMJ", "XMMC"}; for (String field : requiredFields) { if (taskMap.get(field) == null) { throw new RuntimeException(StringUtils.format("缺少必须字段:{},请检查导入数据!", field)); @@ -173,6 +173,7 @@ public class ZttbTaskServiceImpl extends ServiceImpl i /** * 构造查询条件对象 + * * @param task * @return */ @@ -205,18 +206,23 @@ public class ZttbTaskServiceImpl extends ServiceImpl i // 根据部门ID查询该部门及其所有父部门的任务 queryWrapper.in(Objects.nonNull(task.getDeptId()), ZttbTask::getDeptId, deptMapper.getAllAncestorsByDeptId(task.getDeptId())); - // 根据年份进行模糊查询 - queryWrapper.like(Objects.nonNull(task.getNian()), ZttbTask::getNian, task.getNian()); - // 根据任务所在县进行模糊查询 - queryWrapper.or().like(Objects.nonNull(task.getXian()), ZttbTask::getXian, task.getXian()); - // 根据任务所在乡镇进行模糊查询 - queryWrapper.or().like(Objects.nonNull(task.getXzmc()), ZttbTask::getXzmc, task.getXzmc()); - queryWrapper.or().like(Objects.nonNull(task.getCsmc()), ZttbTask::getCsmc, task.getCsmc()); - queryWrapper.or().like(Objects.nonNull(task.getTbly()), ZttbTask::getTbly, task.getTbly()); - queryWrapper.or().like(Objects.nonNull(task.getTbbh()), ZttbTask::getTbbh, task.getTbbh()); - queryWrapper.or().like(Objects.nonNull(task.getCzwt()), ZttbTask::getCzwt, task.getCzwt()); - // 根据任务项目名称进行模糊查询 - queryWrapper.or().like(Objects.nonNull(task.getXmmc()), ZttbTask::getXmmc, task.getXmmc()); + queryWrapper.and( + Objects.nonNull(task.getNian()), + // 根据年份进行模糊查询 + qw -> qw.like(Objects.nonNull(task.getNian()), ZttbTask::getNian, task.getNian()) + // 根据任务所在县进行模糊查询 + .or().like(Objects.nonNull(task.getXian()), ZttbTask::getXian, task.getXian()) + // 根据任务所在乡镇进行模糊查询 + .or().like(Objects.nonNull(task.getXzmc()), ZttbTask::getXzmc, task.getXzmc()) + .or().like(Objects.nonNull(task.getCsmc()), ZttbTask::getCsmc, task.getCsmc()) + .or().like(Objects.nonNull(task.getTbly()), ZttbTask::getTbly, task.getTbly()) + .or().like(Objects.nonNull(task.getTbbh()), ZttbTask::getTbbh, task.getTbbh()) + .or().like(Objects.nonNull(task.getCzwt()), ZttbTask::getCzwt, task.getCzwt()) + // 根据任务项目名称进行模糊查询 + .or().like(Objects.nonNull(task.getXmmc()), ZttbTask::getXmmc, task.getXmmc()) + + ); + // 根据处理时间进行区间查询 List drsjQuery = task.getDrsjQuery(); @@ -324,7 +330,7 @@ public class ZttbTaskServiceImpl extends ServiceImpl i // 获取图斑信息 ZttbTask task = this.getById(taskId); - if(task == null){ + if (task == null) { throw new RuntimeException("Id=" + taskId + "的任务不存在!"); } TaskGis taskGis = this.selectTaskGisById(taskId); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java index 75fd00d1..03a1f587 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java @@ -5,6 +5,8 @@ import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.entity.SysUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.context.SecurityContextHolder; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index 4831849d..88cf40d5 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -1,6 +1,7 @@ package com.ruoyi.framework.web.service; import javax.annotation.Resource; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; @@ -29,14 +30,17 @@ import com.ruoyi.framework.security.context.AuthenticationContextHolder; import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysUserService; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + /** * 登录校验方法 - * + * * @author ruoyi */ @Component -public class SysLoginService -{ +public class SysLoginService { @Autowired private TokenService tokenService; @@ -45,7 +49,7 @@ public class SysLoginService @Autowired private RedisCache redisCache; - + @Autowired private ISysUserService userService; @@ -54,43 +58,34 @@ public class SysLoginService /** * 登录验证 - * + * * @param username 用户名 * @param password 密码 - * @param code 验证码 - * @param uuid 唯一标识 + * @param code 验证码 + * @param uuid 唯一标识 * @return 结果 */ - public String login(String username, String password, String code, String uuid) - { + public String login(String username, String password, String code, String uuid) { // 验证码校验 validateCaptcha(username, code, uuid); // 登录前置校验 loginPreCheck(username, password); // 用户验证 Authentication authentication = null; - try - { + try { UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password); AuthenticationContextHolder.setContext(authenticationToken); // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername authentication = authenticationManager.authenticate(authenticationToken); - } - catch (Exception e) - { - if (e instanceof BadCredentialsException) - { + } catch (Exception e) { + if (e instanceof BadCredentialsException) { AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); throw new UserPasswordNotMatchException(); - } - else - { + } else { AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage())); throw new ServiceException(e.getMessage()); } - } - finally - { + } finally { AuthenticationContextHolder.clearContext(); } AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); @@ -102,27 +97,23 @@ public class SysLoginService /** * 校验验证码 - * + * * @param username 用户名 - * @param code 验证码 - * @param uuid 唯一标识 + * @param code 验证码 + * @param uuid 唯一标识 * @return 结果 */ - public void validateCaptcha(String username, String code, String uuid) - { + public void validateCaptcha(String username, String code, String uuid) { boolean captchaEnabled = configService.selectCaptchaEnabled(); - if (captchaEnabled) - { + if (captchaEnabled) { String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, ""); String captcha = redisCache.getCacheObject(verifyKey); redisCache.deleteObject(verifyKey); - if (captcha == null) - { + if (captcha == null) { AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"))); throw new CaptchaExpireException(); } - if (!code.equalsIgnoreCase(captcha)) - { + if (!code.equalsIgnoreCase(captcha)) { AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"))); throw new CaptchaException(); } @@ -131,35 +122,31 @@ public class SysLoginService /** * 登录前置校验 + * * @param username 用户名 * @param password 用户密码 */ - public void loginPreCheck(String username, String password) - { + public void loginPreCheck(String username, String password) { // 用户名或密码为空 错误 - if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) - { + if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) { AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("not.null"))); throw new UserNotExistsException(); } // 密码如果不在指定范围内 错误 if (password.length() < UserConstants.PASSWORD_MIN_LENGTH - || password.length() > UserConstants.PASSWORD_MAX_LENGTH) - { + || password.length() > UserConstants.PASSWORD_MAX_LENGTH) { AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); throw new UserPasswordNotMatchException(); } // 用户名不在指定范围内 错误 if (username.length() < UserConstants.USERNAME_MIN_LENGTH - || username.length() > UserConstants.USERNAME_MAX_LENGTH) - { + || username.length() > UserConstants.USERNAME_MAX_LENGTH) { AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); throw new UserPasswordNotMatchException(); } // IP黑名单校验 String blackStr = configService.selectConfigByKey("sys.login.blackIPList"); - if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) - { + if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) { AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("login.blocked"))); throw new BlackListException(); } @@ -170,8 +157,7 @@ public class SysLoginService * * @param userId 用户ID */ - public void recordLoginInfo(Long userId) - { + public void recordLoginInfo(Long userId) { SysUser sysUser = new SysUser(); sysUser.setUserId(userId); sysUser.setLoginIp(IpUtils.getIpAddr()); diff --git a/ruoyi-ui/src/permission.js b/ruoyi-ui/src/permission.js index c5689790..5776ea8c 100644 --- a/ruoyi-ui/src/permission.js +++ b/ruoyi-ui/src/permission.js @@ -24,7 +24,7 @@ router.beforeEach((to, from, next) => { if (store.getters.roles.length === 0) { isRelogin.show = true // 判断当前用户是否已拉取完user_info信息 - store.dispatch('GetInfo').then(() => { + store.dispatch('GetInfo').then((res) => { isRelogin.show = false store.dispatch('GenerateRoutes').then(accessRoutes => { // 根据roles权限生成可访问的路由表 diff --git a/ruoyi-ui/src/views/cxxm/zftkTask/assign/index.vue b/ruoyi-ui/src/views/cxxm/zftkTask/assign/index.vue index 9f2c6d13..9a2220ab 100644 --- a/ruoyi-ui/src/views/cxxm/zftkTask/assign/index.vue +++ b/ruoyi-ui/src/views/cxxm/zftkTask/assign/index.vue @@ -1,47 +1,32 @@ @@ -196,9 +189,6 @@ :limit.sync="queryParams.pageSize" @pagination="getList" /> - - - @@ -256,7 +246,7 @@ @@ -264,22 +254,24 @@ - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/ruoyi-ui/src/views/cxxm/zftkTask/check/index.vue b/ruoyi-ui/src/views/cxxm/zftkTask/check/index.vue index 285054db..0e6eec82 100644 --- a/ruoyi-ui/src/views/cxxm/zftkTask/check/index.vue +++ b/ruoyi-ui/src/views/cxxm/zftkTask/check/index.vue @@ -75,6 +75,14 @@ + + + + + + diff --git a/ruoyi-ui/src/views/cxxm/zftkTask/detail/index.vue b/ruoyi-ui/src/views/cxxm/zftkTask/detail/index.vue index 37238f9f..079d77f2 100644 --- a/ruoyi-ui/src/views/cxxm/zftkTask/detail/index.vue +++ b/ruoyi-ui/src/views/cxxm/zftkTask/detail/index.vue @@ -257,7 +257,9 @@ template diff --git a/ruoyi-ui/src/views/cxxm/zftkTask/distribute/index.vue b/ruoyi-ui/src/views/cxxm/zftkTask/distribute/index.vue index 7790f815..5e018eee 100644 --- a/ruoyi-ui/src/views/cxxm/zftkTask/distribute/index.vue +++ b/ruoyi-ui/src/views/cxxm/zftkTask/distribute/index.vue @@ -18,30 +18,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -170,7 +170,7 @@ type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" - v-if="form.zjxfqk==0" + v-if="scope.row.zjxfqk==0" >删除 - + - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - + + + +