| | |
| | | // 判断角色 |
| | | if (!userInfo.getRoleId().contains("1727864411451359233")){ |
| | | userInfo.setRoleId(userInfo.getRoleId() + ",1727864411451359233"); |
| | | // 更新机构 |
| | | setDeptId(userInfo,userExcel); |
| | | // 更新 |
| | | updateById(userInfo); |
| | | // 更新用户机构绑定 |
| | | submitUserDept(userInfo); |
| | | // 更新社区民警绑定信息 |
| | | updateGridBind(userInfo); |
| | | } |
| | | // 更新机构 |
| | | setDeptId(userInfo,userExcel); |
| | | // 更新 |
| | | updateById(userInfo); |
| | | // 更新用户机构绑定 |
| | | submitUserDept(userInfo); |
| | | // 更新社区民警绑定信息 |
| | | updateGridBind(userInfo); |
| | | }else { |
| | | // 插入用户角色 |
| | | User user = new User(); |
| | |
| | | Dept dept = SpringUtil.getBean(IDeptService.class).getOne(wrapper); |
| | | if (null!=dept){ |
| | | if (null!=user.getId()){ |
| | | // 更新设置机构 |
| | | if (!Strings.isBlank(user.getDeptId())){ |
| | | if (!user.getDeptId().contains(dept.getId().toString())){ |
| | | user.setDeptId(user.getDeptId() + "," + dept.getId()); |
| | | } |
| | | } |
| | | DeptNotHandle(user, dept); |
| | | }else { |
| | | user.setDeptId(dept.getId().toString()); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 机构不为空时处理 |
| | | * @param user |
| | | * @param dept |
| | | */ |
| | | public void DeptNotHandle(User user, Dept dept) { |
| | | // 更新设置机构 |
| | | if (!Strings.isBlank(user.getDeptId())){ |
| | | // 查询对应的派出所(去掉) |
| | | Dept deptPcs = SpringUtil.getBean(IDeptService.class).getDeptByDeptIds(user.getDeptId()); |
| | | if (null!=deptPcs) { |
| | | // 如果存在需要去掉派出所的机构id |
| | | List<String> list = new ArrayList<>(Arrays.asList(user.getDeptId().split(","))); |
| | | // 先删除派出所对应的机构ID |
| | | if (list.contains(deptPcs.getId().toString())){ |
| | | list.remove(deptPcs.getId().toString()); |
| | | user.setDeptId(String.join(",",list)); |
| | | } |
| | | if (!user.getDeptId().contains(dept.getId().toString())) { |
| | | user.setDeptId(user.getDeptId() + "," + dept.getId()); |
| | | } |
| | | }else { |
| | | if (!user.getDeptId().contains(dept.getId().toString())) { |
| | | user.setDeptId(user.getDeptId() + "," + dept.getId()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 更新社区民警绑定信息 |
| | | * @param userExcel |
| | | * @param user |