| | |
| | | import org.jeecg.common.util.*; |
| | | import org.jeecg.modules.base.service.BaseCommonService; |
| | | 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.SysUserSysDepartModel; |
| | | import org.jeecg.modules.system.model.*; |
| | | import org.jeecg.modules.system.service.*; |
| | | import org.jeecg.modules.system.vo.SysDepartUsersVO; |
| | | import org.jeecg.modules.system.vo.SysUserRoleVO; |
| | |
| | | @Resource |
| | | private IMdcUserProductionService userProductionService; |
| | | |
| | | @Resource |
| | | private IEamBaseRepairDepartUserService eamBaseRepairDepartUserService; |
| | | |
| | | @Resource |
| | | private IBaseFactoryUserService iBaseFactoryUserService; |
| | | |
| | | /** |
| | | * 获取用户列表数据 |
| | | * |
| | |
| | | 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())); |
| | | item.setEamFactoryIds( String.join(",",iBaseFactoryUserService.queryEamCenterIdsByUserId(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"); |
| | | String factoryIds=jsonObject.getString("selectedBaseFactory"); |
| | | 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); |
| | | if (oConvertUtils.isNotEmpty(factoryIds)) { |
| | | iBaseFactoryUserService.addUserFactory(user.getId(), factoryIds); |
| | | } |
| | | 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"); |
| | | String factoryIds=jsonObject.getString("selectedBaseFactory"); |
| | | if (oConvertUtils.isEmpty(departs)) { |
| | | //vue3.0前端只传递了departIds |
| | | departs = user.getDepartIds(); |
| | |
| | | if (oConvertUtils.isNotEmpty(productions)) { |
| | | productions = user.getProductionIds(); |
| | | } |
| | | if (oConvertUtils.isNotEmpty(repairDeparts)) { |
| | | repairDeparts = user.getRepairDepartIds(); |
| | | } |
| | | if (oConvertUtils.isNotEmpty(factoryIds)) { |
| | | iBaseFactoryUserService.addUserFactory(user.getId(), factoryIds); |
| | | } |
| | | //用户表字段org_code不能在这里设置他的值 |
| | | user.setOrgCode(null); |
| | | // 修改用户走一个service 保证事务 |
| | | sysUserService.editUser(user, roles, departs, productions); |
| | | sysUserService.editUser(user, roles, departs, productions, repairDeparts); |
| | | result.success("修改成功!"); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | } |
| | | |
| | | @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; |
| | | } |
| | | } |
| | | |
| | | @AutoLog(value = "用户表-查询指定用户和EAM中心关联的数据") |
| | | @ApiOperation(value = "用户表-查询指定用户和EAM中心关联的数据", notes = "用户表-查询指定用户和EAM中心关联的数据") |
| | | @GetMapping(value = "/userBaseFactoryList") |
| | | public Result<List<EamBaseFactoryIdModel>> userBaseFactoryList(@RequestParam(name = "userId", required = true) String userId) { |
| | | Result<List<EamBaseFactoryIdModel>> result = new Result<>(); |
| | | try { |
| | | List<EamBaseFactoryIdModel> repDepIdModelList = this.iBaseFactoryUserService.queryEamBaseFactoryIdsOfUser(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绑定部门数据 |
| | | * |