| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.authz.annotation.RequiresRoles; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.aspect.annotation.PermissionData; |
| | |
| | | import org.jeecg.modules.system.entity.*; |
| | | import org.jeecg.modules.system.model.DepartIdModel; |
| | | import org.jeecg.modules.system.model.ProductionIdModel; |
| | | import org.jeecg.modules.system.model.RepairDepartIdModel; |
| | | import org.jeecg.modules.system.model.SysUserSysDepartModel; |
| | | import org.jeecg.modules.system.service.*; |
| | | import org.jeecg.modules.system.vo.SysDepartUsersVO; |
| | |
| | | @Resource |
| | | private IMdcUserProductionService userProductionService; |
| | | |
| | | @Resource |
| | | private IEamBaseRepairDepartUserService eamBaseRepairDepartUserService; |
| | | |
| | | /** |
| | | * 获取用户列表数据 |
| | | * |
| | |
| | | if (userIds != null && userIds.size() > 0) { |
| | | Map<String, String> useDepNames = sysUserService.getDepNamesByUserIds(userIds); |
| | | Map<String, String> useProNames = sysUserService.getProNamesByUserIds(userIds); |
| | | Map<String, String> useRepDepNames = sysUserService.getRepDepNamesByUserIds(userIds); |
| | | pageList.getRecords().forEach(item -> { |
| | | item.setOrgCodeTxt(useDepNames.get(item.getId())); |
| | | item.setProductionName(useProNames.get(item.getId())); |
| | | item.setRepairDepartName(useRepDepNames.get(item.getId())); |
| | | }); |
| | | } |
| | | result.setSuccess(true); |
| | |
| | | String selectedRoles = jsonObject.getString("selectedroles"); |
| | | String selectedDeparts = jsonObject.getString("selecteddeparts"); |
| | | String selectedProductions = jsonObject.getString("selectedProduction"); |
| | | String selectedRepairDeparts = jsonObject.getString("selectedRepairDeparts"); |
| | | try { |
| | | SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class); |
| | | user.setCreateTime(new Date());//设置创建时间 |
| | |
| | | //用户表字段org_code不能在这里设置他的值 |
| | | user.setOrgCode(null); |
| | | // 保存用户走一个service 保证事务 |
| | | sysUserService.saveUser(user, selectedRoles, selectedDeparts, selectedProductions); |
| | | sysUserService.saveUser(user, selectedRoles, selectedDeparts, selectedProductions, selectedRepairDeparts); |
| | | baseCommonService.addLog("添加用户,username: " + user.getUsername(), CommonConstant.LOG_TYPE_2, 2); |
| | | result.success("添加成功!"); |
| | | } catch (Exception e) { |
| | |
| | | String roles = jsonObject.getString("selectedroles"); |
| | | String departs = jsonObject.getString("selecteddeparts"); |
| | | String productions = jsonObject.getString("selectedProduction"); |
| | | String repairDeparts = jsonObject.getString("selectedRepairDeparts"); |
| | | if (oConvertUtils.isEmpty(departs)) { |
| | | //vue3.0前端只传递了departIds |
| | | departs = user.getDepartIds(); |
| | |
| | | if (oConvertUtils.isNotEmpty(productions)) { |
| | | productions = user.getProductionIds(); |
| | | } |
| | | if (oConvertUtils.isNotEmpty(repairDeparts)) { |
| | | repairDeparts = user.getRepairDepartIds(); |
| | | } |
| | | //用户表字段org_code不能在这里设置他的值 |
| | | user.setOrgCode(null); |
| | | // 修改用户走一个service 保证事务 |
| | | sysUserService.editUser(user, roles, departs, productions); |
| | | sysUserService.editUser(user, roles, departs, productions, repairDeparts); |
| | | result.success("修改成功!"); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | /** |
| | | * 修改密码 |
| | | */ |
| | | //@RequiresRoles({"admin"}) |
| | | @RequiresRoles({"admin"}) |
| | | @RequestMapping(value = "/changePassword", method = RequestMethod.PUT) |
| | | public Result<?> changePassword(@RequestBody SysUser sysUser) { |
| | | SysUser u = this.sysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, sysUser.getUsername())); |
| | |
| | | } |
| | | } |
| | | |
| | | @AutoLog(value = "用户表-查询指定用户和维修部门关联的数据") |
| | | @ApiOperation(value = "用户表-查询指定用户和维修部门关联的数据", notes = "用户表-查询指定用户和维修部门关联的数据") |
| | | @GetMapping(value = "/userRepairDepartList") |
| | | public Result<List<RepairDepartIdModel>> userRepairDepartList(@RequestParam(name = "userId", required = true) String userId) { |
| | | Result<List<RepairDepartIdModel>> result = new Result<>(); |
| | | try { |
| | | List<RepairDepartIdModel> repDepIdModelList = this.eamBaseRepairDepartUserService.queryRepairDepartIdsOfUser(userId); |
| | | if (repDepIdModelList != null && !repDepIdModelList.isEmpty()) { |
| | | result.setSuccess(true); |
| | | result.setMessage("查找成功"); |
| | | result.setResult(repDepIdModelList); |
| | | } else { |
| | | result.setSuccess(false); |
| | | result.setMessage("查找失败"); |
| | | } |
| | | return result; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | result.setSuccess(false); |
| | | result.setMessage("查找过程中出现了异常: " + e.getMessage()); |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成在添加用户情况下没有主键的问题,返回给前端,根据该id绑定部门数据 |
| | | * |