|
|
@ -5,14 +5,19 @@ import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
import com.hxhq.business.domain.Study; |
|
|
import com.hxhq.business.domain.StudyMethodRead; |
|
|
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.StudyMethodStatusEnum; |
|
|
|
|
|
import com.hxhq.business.enums.study.StudyTypeEnum; |
|
|
import com.hxhq.business.form.study.StudyMethodForm; |
|
|
import com.hxhq.business.form.study.StudyMethodForm; |
|
|
import com.hxhq.business.form.study.StudyMethodReadForm; |
|
|
import com.hxhq.business.form.study.StudyMethodReadForm; |
|
|
import com.hxhq.business.form.study.StudyMethodSearchForm; |
|
|
import com.hxhq.business.form.study.StudyMethodSearchForm; |
|
|
import com.hxhq.business.service.INoticeService; |
|
|
import com.hxhq.business.service.INoticeService; |
|
|
import com.hxhq.business.service.IStudyMethodReadService; |
|
|
import com.hxhq.business.service.IStudyMethodReadService; |
|
|
|
|
|
import com.hxhq.business.service.IStudyService; |
|
|
import com.hxhq.common.core.exception.ServiceException; |
|
|
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.common.security.utils.SecurityUtils; |
|
|
import com.hxhq.system.api.domain.SysUser; |
|
|
import com.hxhq.system.api.domain.SysUser; |
|
|
import com.hxhq.system.service.ISysUserService; |
|
|
import com.hxhq.system.service.ISysUserService; |
|
|
@ -42,6 +47,8 @@ public class StudyMethodServiceImpl extends ServiceImpl |
|
|
private IStudyMethodReadService studyMethodReadService; |
|
|
private IStudyMethodReadService studyMethodReadService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private INoticeService noticeService; |
|
|
private INoticeService noticeService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IStudyService studyService; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询试验-试验方法列表 |
|
|
* 查询试验-试验方法列表 |
|
|
@ -140,23 +147,33 @@ public class StudyMethodServiceImpl extends ServiceImpl |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void checkAllMethodReadStatus(Long userId, Long studyId, Long studySubjectId) { |
|
|
public void checkAllMethodReadStatus(Long userId, Long studyId, Long studySubjectId) { |
|
|
LambdaQueryWrapper<StudyMethodRead> 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<StudyMethod> 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<StudyMethod> list = this.list(studyMethodLambdaQueryWrapper); |
|
|
|
|
|
if(readCount != list.size()) { |
|
|
|
|
|
String ffmc = list.stream().map(StudyMethod::getFfmc).collect(Collectors.joining(",")); |
|
|
|
|
|
throw new ServiceException("[" + ffmc + "方案还未阅读,请先阅读后再进行试验操作]"); |
|
|
|
|
|
|
|
|
//试验学科内部的人+非试验部门内的人 |
|
|
|
|
|
List<DeptUserTreeDto> 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<StudyMethodRead> 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<StudyMethod> studyMethodLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
studyMethodLambdaQueryWrapper.eq(StudyMethod::getStudyId, studyId); |
|
|
|
|
|
if(studySubjectId != null) { |
|
|
|
|
|
studyMethodLambdaQueryWrapper.eq(StudyMethod::getStudySubjectId, studySubjectId); |
|
|
|
|
|
} |
|
|
|
|
|
List<StudyMethod> list = this.list(studyMethodLambdaQueryWrapper); |
|
|
|
|
|
if(readCount != list.size()) { |
|
|
|
|
|
String ffmc = list.stream().map(StudyMethod::getFfmc).collect(Collectors.joining(",")); |
|
|
|
|
|
throw new ServiceException("[" + ffmc + "方案还未阅读,请先阅读后再进行试验操作]"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|