| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.SysUserUpdateStatusDTO; |
| | | import com.ruoyi.system.model.TProjectTeamStaff; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.SysUserQuery; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.SysUserVO; |
| | |
| | | private TProjectTeamService projectTeamService; |
| | | @Autowired |
| | | private TProjectTeamStaffService projectTeamStaffService; |
| | | |
| | | @Autowired |
| | | private TClinicalTrialPointsService clinicalTrialPointsService; |
| | | @Autowired |
| | | private TExperimentDispatchParticipantsService experimentDispatchParticipantsService; |
| | | @Autowired |
| | | private TExperimentSchemePersonService experimentSchemePersonService; |
| | | @Autowired |
| | | private TNoticeService noticeService; |
| | | @Autowired |
| | | private TProjectProposalService projectProposalService; |
| | | @Autowired |
| | | private TQaProduceReportService qaProduceReportService; |
| | | @Autowired |
| | | private TQaTestItemService qaTestItemService; |
| | | @Autowired |
| | | private TResultWorkEvaluateService resultWorkEvaluateService; |
| | | @Autowired |
| | | private TSamplingRecordOperationService samplingRecordOperationService; |
| | | @Autowired |
| | | private TTestMethodConfirmSheetService testMethodConfirmSheetService; |
| | | @Autowired |
| | | private TTesterOtherTaskService testerOtherTaskService; |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | |
| | | if (Objects.isNull(oldUser)){ |
| | | return R.fail("原始账号不存在"); |
| | | } |
| | | if ("0".equals(oldUser.getStatus())){ |
| | | return R.fail("原始账号未停用,无法继承"); |
| | | } |
| | | SysUser user = userService.selectUserById(userId); |
| | | if (Objects.isNull(user)){ |
| | | return R.fail("继承账号不存在"); |
| | | } |
| | | Long oldUserUserId = oldUser.getUserId(); |
| | | List<SysUser> oldUserList = userService.selectOldList(); |
| | | // oldUser.setUserId(); |
| | | // userService.updateUserOldUser(oldUser); |
| | | user.setParentId(oldUser.getUserId()); |
| | | user.setParentAccount(oldUser.getUserName()); |
| | | if(!oldUser.getRoleType().equals(user.getRoleType())){ |
| | | return R.fail("原始账号和继承账号角色不一致"); |
| | | } |
| | | |
| | | // userService.updateUserInherit(user); |
| | | Integer roleType = oldUser.getRoleType(); |
| | | Long oldUserUserId = oldUser.getUserId(); |
| | | switch (roleType){ |
| | | case 3: |
| | | // 工艺工程师 |
| | | // 临床试验积分 |
| | | clinicalTrialPointsService.update(Wrappers.lambdaUpdate(TClinicalTrialPoints.class) |
| | | .eq(TClinicalTrialPoints::getProcessEngineerId,oldUserUserId) |
| | | .set(TClinicalTrialPoints::getProcessEngineerId,userId)); |
| | | // QA检测项 |
| | | qaTestItemService.update(Wrappers.lambdaUpdate(TQaTestItem.class) |
| | | .eq(TQaTestItem::getCommitPersonId,oldUserUserId) |
| | | .set(TQaTestItem::getCommitPersonId,userId)); |
| | | break; |
| | | case 4: |
| | | // 化验师 |
| | | // 中试、生产验证分析报告;辅料;产品报告 |
| | | qaProduceReportService.update(Wrappers.lambdaUpdate(TQaProduceReport.class) |
| | | .eq(TQaProduceReport::getCommitPersonId,oldUserUserId) |
| | | .set(TQaProduceReport::getCommitPersonId,userId)); |
| | | break; |
| | | case 5: |
| | | // 实验员 |
| | | // 实验方案实验人员管理 |
| | | experimentSchemePersonService.update(Wrappers.lambdaUpdate(TExperimentSchemePerson.class) |
| | | .eq(TExperimentSchemePerson::getUserId,oldUserUserId) |
| | | .set(TExperimentSchemePerson::getUserId,userId)); |
| | | // 实验员其他任务 |
| | | testerOtherTaskService.update(Wrappers.lambdaUpdate(TTesterOtherTask.class) |
| | | .eq(TTesterOtherTask::getTesterId,oldUserUserId) |
| | | .set(TTesterOtherTask::getTesterId,userId)); |
| | | break; |
| | | } |
| | | // 实验调度参与人员 |
| | | experimentDispatchParticipantsService.update(Wrappers.lambdaUpdate(TExperimentDispatchParticipants.class) |
| | | .eq(TExperimentDispatchParticipants::getUserId,oldUserUserId) |
| | | .set(TExperimentDispatchParticipants::getUserId,userId)); |
| | | // 公告 |
| | | noticeService.update(Wrappers.lambdaUpdate(TNotice.class) |
| | | .eq(TNotice::getUserId,oldUserUserId) |
| | | .set(TNotice::getUserId,userId)); |
| | | // 项目课题 |
| | | projectProposalService.update(Wrappers.lambdaUpdate(TProjectProposal.class) |
| | | .eq(TProjectProposal::getCommitUserId,oldUserUserId) |
| | | .set(TProjectProposal::getCommitUserId,userId)); |
| | | // 项目组 |
| | | projectTeamStaffService.update(Wrappers.lambdaUpdate(TProjectTeamStaff.class) |
| | | .eq(TProjectTeamStaff::getUserId,oldUserUserId) |
| | | .set(TProjectTeamStaff::getUserId,userId)); |
| | | // 实验结果汇报 |
| | | resultWorkEvaluateService.update(Wrappers.lambdaUpdate(TResultWorkEvaluate.class) |
| | | .eq(TResultWorkEvaluate::getUserId,oldUserUserId) |
| | | .set(TResultWorkEvaluate::getUserId,userId)); |
| | | // 取样操作管理 |
| | | samplingRecordOperationService.update(Wrappers.lambdaUpdate(TSamplingRecordOperation.class) |
| | | .eq(TSamplingRecordOperation::getHandlePersonId,oldUserUserId) |
| | | .set(TSamplingRecordOperation::getHandlePersonId,userId)); |
| | | samplingRecordOperationService.update(Wrappers.lambdaUpdate(TSamplingRecordOperation.class) |
| | | .eq(TSamplingRecordOperation::getSendPersonId,oldUserUserId) |
| | | .set(TSamplingRecordOperation::getSendPersonId,userId)); |
| | | samplingRecordOperationService.update(Wrappers.lambdaUpdate(TSamplingRecordOperation.class) |
| | | .eq(TSamplingRecordOperation::getReceiptsPersonId,oldUserUserId) |
| | | .set(TSamplingRecordOperation::getReceiptsPersonId,userId)); |
| | | // 检验方法确认单 |
| | | testMethodConfirmSheetService.update(Wrappers.lambdaUpdate(TTestMethodConfirmSheet.class) |
| | | .eq(TTestMethodConfirmSheet::getCommitUserId,oldUserUserId) |
| | | .set(TTestMethodConfirmSheet::getCommitUserId,userId)); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |