|
|
|
@ -9,6 +9,7 @@ import java.util.stream.Collectors; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.hxhq.business.domain.Study; |
|
|
|
import com.hxhq.business.dto.study.StudyListDto; |
|
|
|
import com.hxhq.business.enums.zykgl.JcgjlxEnum; |
|
|
|
import com.hxhq.business.enums.zykgl.JcmcysEnum; |
|
|
|
import com.hxhq.business.form.study.StudySubjectSaveForm; |
|
|
|
@ -129,19 +130,29 @@ public class StudySubjectServiceImpl extends ServiceImpl |
|
|
|
deleteNameList.add(old.getLeaderName()); |
|
|
|
} |
|
|
|
} |
|
|
|
if(addList.size()>0){ |
|
|
|
saveBatch(addList); |
|
|
|
} |
|
|
|
if(modifyList.size()>0){ |
|
|
|
updateBatchById(modifyList); |
|
|
|
} |
|
|
|
|
|
|
|
if(deleteList.size()>0){ |
|
|
|
//已有表单的学科不能删除(预填+填报) |
|
|
|
List<StudyListDto> formCountList = baseMapper.queryFormCountList(deleteList.stream().map(o->o.getId()).collect(Collectors.toList())); |
|
|
|
List<StudyListDto> preFormCountList = baseMapper.queryPreFormCountList(deleteList.stream().map(o->o.getId()).collect(Collectors.toList())); |
|
|
|
for(StudySubject del : deleteList){ |
|
|
|
if(formCountList.stream().filter(o->o.getId().equals(del.getId())).count()>0 || preFormCountList.stream().filter(o->o.getId().equals(del.getId())).count()>0){ |
|
|
|
throw new ServiceException(del.getDeptName()+"下已有表单,不能取消勾选"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
removeBatchByIds(deleteList); |
|
|
|
for(StudySubject del : deleteList){ |
|
|
|
studySubjectUserService.deleteByStudySubjectId(del.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(addList.size()>0){ |
|
|
|
saveBatch(addList); |
|
|
|
} |
|
|
|
if(modifyList.size()>0){ |
|
|
|
updateBatchById(modifyList); |
|
|
|
} |
|
|
|
if(deleteNameList.size()>0 || addNameList.size()>0){ |
|
|
|
Map<String, String> formData = new LinkedHashMap<>(); |
|
|
|
if(addNameList.size()>0){ |
|
|
|
|