|
|
@ -1,6 +1,7 @@ |
|
|
package com.hxhq.business.service.impl; |
|
|
package com.hxhq.business.service.impl; |
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
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; |
|
|
@ -52,6 +53,9 @@ public class StudyMethodServiceImpl extends ServiceImpl |
|
|
public List<StudyMethod> queryList(StudyMethodSearchForm form) { |
|
|
public List<StudyMethod> queryList(StudyMethodSearchForm form) { |
|
|
QueryWrapper<StudyMethod> queryWrapper = new QueryWrapper<>(); |
|
|
QueryWrapper<StudyMethod> queryWrapper = new QueryWrapper<>(); |
|
|
queryWrapper.eq("m.del_flag", 0); |
|
|
queryWrapper.eq("m.del_flag", 0); |
|
|
|
|
|
if(form.getStudyId() != null) { |
|
|
|
|
|
queryWrapper.eq("m.study_id", form.getStudyId()); |
|
|
|
|
|
} |
|
|
if(form.getStudySubjectId() != null) { |
|
|
if(form.getStudySubjectId() != null) { |
|
|
queryWrapper.eq("m.study_subject_id", form.getStudySubjectId()); |
|
|
queryWrapper.eq("m.study_subject_id", form.getStudySubjectId()); |
|
|
} |
|
|
} |
|
|
@ -84,7 +88,7 @@ public class StudyMethodServiceImpl extends ServiceImpl |
|
|
@Override |
|
|
@Override |
|
|
public void save(StudyMethodForm form) { |
|
|
public void save(StudyMethodForm form) { |
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
// TODO |
|
|
|
|
|
|
|
|
sysUserService.checkPassword(qmr, form.getQmrmm(), false); |
|
|
StudyMethod studyMethod = new StudyMethod(); |
|
|
StudyMethod studyMethod = new StudyMethod(); |
|
|
BeanUtils.copyProperties(form, studyMethod); |
|
|
BeanUtils.copyProperties(form, studyMethod); |
|
|
studyMethod.setUserId(qmr.getUserId()); |
|
|
studyMethod.setUserId(qmr.getUserId()); |
|
|
@ -108,7 +112,8 @@ public class StudyMethodServiceImpl extends ServiceImpl |
|
|
@Override |
|
|
@Override |
|
|
public void read(StudyMethodReadForm form) { |
|
|
public void read(StudyMethodReadForm form) { |
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
// TODO |
|
|
|
|
|
|
|
|
sysUserService.checkPassword(qmr, form.getQmrmm(), false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StudyMethod studyMethod = this.getById(form.getStudyMethodId()); |
|
|
StudyMethod studyMethod = this.getById(form.getStudyMethodId()); |
|
|
if(studyMethod == null) { |
|
|
if(studyMethod == null) { |
|
|
@ -134,7 +139,7 @@ public class StudyMethodServiceImpl extends ServiceImpl |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Boolean getReadAllMethodStatus(Long userId, Long studyId, Long studySubjectId) { |
|
|
|
|
|
|
|
|
public void getReadAllMethodStatus(Long userId, Long studyId, Long studySubjectId) { |
|
|
LambdaQueryWrapper<StudyMethodRead> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
LambdaQueryWrapper<StudyMethodRead> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
queryWrapper.eq(StudyMethodRead::getQmrId, userId) |
|
|
queryWrapper.eq(StudyMethodRead::getQmrId, userId) |
|
|
.eq(StudyMethodRead::getStudyId, studyId); |
|
|
.eq(StudyMethodRead::getStudyId, studyId); |
|
|
@ -148,11 +153,11 @@ public class StudyMethodServiceImpl extends ServiceImpl |
|
|
if(studySubjectId != null) { |
|
|
if(studySubjectId != null) { |
|
|
studyMethodLambdaQueryWrapper.eq(StudyMethod::getStudySubjectId, studySubjectId); |
|
|
studyMethodLambdaQueryWrapper.eq(StudyMethod::getStudySubjectId, studySubjectId); |
|
|
} |
|
|
} |
|
|
long studyMethodCount = this.count(studyMethodLambdaQueryWrapper); |
|
|
|
|
|
if(readCount == studyMethodCount) { |
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
List<StudyMethod> list = this.list(studyMethodLambdaQueryWrapper); |
|
|
|
|
|
if(readCount != list.size()) { |
|
|
|
|
|
String ffmc = list.stream().map(StudyMethod::getFfmc).collect(Collectors.joining(",")); |
|
|
|
|
|
throw new ServiceException("[" + ffmc + "方案还未阅读,请先阅读后再进行试验操作]"); |
|
|
} |
|
|
} |
|
|
return false; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |