From 4b6a5942d6584642e553f0c651c04de2e641fdbf Mon Sep 17 00:00:00 2001 From: memorylkf <312904636@qq.com> Date: Thu, 22 Jan 2026 10:04:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20[=E8=AF=95=E9=AA=8C=E7=AE=A1=E7=90=86]?= =?UTF-8?q?=20=E5=88=A4=E6=96=AD=E6=96=B9=E6=B3=95=E9=98=85=E8=AF=BB?= =?UTF-8?q?=E6=8E=92=E9=99=A4sd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/StudyMethodServiceImpl.java | 49 +++++++++++++++------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java index 20936ad..5edf8ac 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java @@ -5,14 +5,19 @@ import java.util.stream.Collectors; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.hxhq.business.domain.Study; import com.hxhq.business.domain.StudyMethodRead; +import com.hxhq.business.dto.select.DeptUserTreeDto; import com.hxhq.business.enums.study.StudyMethodStatusEnum; +import com.hxhq.business.enums.study.StudyTypeEnum; import com.hxhq.business.form.study.StudyMethodForm; import com.hxhq.business.form.study.StudyMethodReadForm; import com.hxhq.business.form.study.StudyMethodSearchForm; import com.hxhq.business.service.INoticeService; import com.hxhq.business.service.IStudyMethodReadService; +import com.hxhq.business.service.IStudyService; import com.hxhq.common.core.exception.ServiceException; +import com.hxhq.common.core.web.domain.AjaxResult; import com.hxhq.common.security.utils.SecurityUtils; import com.hxhq.system.api.domain.SysUser; import com.hxhq.system.service.ISysUserService; @@ -42,6 +47,8 @@ public class StudyMethodServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(StudyMethodRead::getQmrId, userId) - .eq(StudyMethodRead::getStudyId, studyId); - if(studySubjectId != null) { - queryWrapper.eq(StudyMethodRead::getStudySubjectId, studySubjectId); - } - long readCount = studyMethodReadService.count(queryWrapper); - - LambdaQueryWrapper studyMethodLambdaQueryWrapper = new LambdaQueryWrapper<>(); - studyMethodLambdaQueryWrapper.eq(StudyMethod::getStudyId, studyId); - if(studySubjectId != null) { - studyMethodLambdaQueryWrapper.eq(StudyMethod::getStudySubjectId, studySubjectId); + Study study = studyService.getById(studyId); + if(study==null){ + throw new ServiceException("信息不存在"); } - List list = this.list(studyMethodLambdaQueryWrapper); - if(readCount != list.size()) { - String ffmc = list.stream().map(StudyMethod::getFfmc).collect(Collectors.joining(",")); - throw new ServiceException("[" + ffmc + "方案还未阅读,请先阅读后再进行试验操作]"); + //试验学科内部的人+非试验部门内的人 + List depts = sysUserService.selectStudyUser(study.getType().equals(StudyTypeEnum.sy.getValue())?studyId:null,study.getType().equals(StudyTypeEnum.sy.getValue())?studySubjectId:null,study.getType().equals(StudyTypeEnum.fsy.getValue())?study.getDeptId():null,null); + if(depts.stream().map(o->o.getId()).collect(Collectors.toList()).contains(userId) && !study.getLeader().equals(userId)){ + //排除sd + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(StudyMethodRead::getQmrId, userId) + .eq(StudyMethodRead::getStudyId, studyId); + if(studySubjectId != null) { + queryWrapper.eq(StudyMethodRead::getStudySubjectId, studySubjectId); + } + long readCount = studyMethodReadService.count(queryWrapper); + + LambdaQueryWrapper studyMethodLambdaQueryWrapper = new LambdaQueryWrapper<>(); + studyMethodLambdaQueryWrapper.eq(StudyMethod::getStudyId, studyId); + if(studySubjectId != null) { + studyMethodLambdaQueryWrapper.eq(StudyMethod::getStudySubjectId, studySubjectId); + } + List list = this.list(studyMethodLambdaQueryWrapper); + if(readCount != list.size()) { + String ffmc = list.stream().map(StudyMethod::getFfmc).collect(Collectors.joining(",")); + throw new ServiceException("[" + ffmc + "方案还未阅读,请先阅读后再进行试验操作]"); + } } }