From a069a12647ab551281091efb0f066163d1c8c156 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期一, 02 六月 2025 17:36:30 +0800 Subject: [PATCH] 首页待办事项 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInspectionReportController.java | 29 ++++++++++++++++++++++++----- 1 files changed, 24 insertions(+), 5 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInspectionReportController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInspectionReportController.java index eaecd3c..28591ff 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInspectionReportController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInspectionReportController.java @@ -11,10 +11,7 @@ import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.system.dto.TInspectionReportDTO; import com.ruoyi.system.mapper.SysUserMapper; -import com.ruoyi.system.model.TExperimentDispatch; -import com.ruoyi.system.model.TExperimentDispatchParticipants; -import com.ruoyi.system.model.TInspectionReport; -import com.ruoyi.system.model.TProjectProposal; +import com.ruoyi.system.model.*; import com.ruoyi.system.query.TInspectionReportQuery; import com.ruoyi.system.service.*; import com.ruoyi.system.vo.TInspectionReportVO; @@ -26,6 +23,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; /** @@ -48,8 +46,11 @@ private final TokenService tokenService; private final ISysUserService sysUserService; private final SysUserMapper sysUserMapper; + private final TNoticeService noticeService; + private final TProjectTeamService projectTeamService; + private final TProjectTeamStaffService projectTeamStaffService; @Autowired - public TInspectionReportController(TInspectionReportService inspectionReportService, TExperimentDispatchService experimentDispatchService, TProjectProposalService projectProposalService, TExperimentDispatchParticipantsService experimentDispatchParticipantsService, TokenService tokenService, ISysUserService sysUserService, SysUserMapper sysUserMapper) { + public TInspectionReportController(TInspectionReportService inspectionReportService, TExperimentDispatchService experimentDispatchService, TProjectProposalService projectProposalService, TExperimentDispatchParticipantsService experimentDispatchParticipantsService, TokenService tokenService, ISysUserService sysUserService, SysUserMapper sysUserMapper, TNoticeService noticeService, TProjectTeamService projectTeamService, TProjectTeamStaffService projectTeamStaffService) { this.inspectionReportService = inspectionReportService; this.experimentDispatchService = experimentDispatchService; this.projectProposalService = projectProposalService; @@ -57,6 +58,9 @@ this.tokenService = tokenService; this.sysUserService = sysUserService; this.sysUserMapper = sysUserMapper; + this.noticeService = noticeService; + this.projectTeamService = projectTeamService; + this.projectTeamStaffService = projectTeamStaffService; } /** @@ -80,6 +84,21 @@ public R<Boolean> add(@RequestBody String param) { TInspectionReportDTO dto = JSON.parseObject(param,TInspectionReportDTO.class); inspectionReportService.save(dto); + // 通过当前用户查询项目组 + Long userId = tokenService.getLoginUser().getUserId(); + TProjectTeamStaff projectTeamStaff = projectTeamStaffService.getOne(Wrappers.lambdaQuery(TProjectTeamStaff.class) + .eq(TProjectTeamStaff::getUserId, userId) + .last("LIMIT 1")); + // 查询项目组 + TProjectTeam projectTeam = projectTeamService.getById(projectTeamStaff.getTeamId()); + // MESSAGE 添加消息 + TProjectTeamStaff teamStaff = projectTeamStaffService.getOne(Wrappers.lambdaQuery(TProjectTeamStaff.class) + .eq(TProjectTeamStaff::getTeamId, projectTeam.getId()) + .eq(TProjectTeamStaff::getRoleType, 3) + .last("LIMIT 1")); + if(Objects.nonNull(teamStaff)){ + noticeService.saveNotice(teamStaff.getUserId(), "化验师已提交检验报告,请查收!", tokenService.getLoginUser().getUser().getNickName(),7); + } return R.ok(); } -- Gitblit v1.7.1