|
@@ -218,11 +218,16 @@ public class PaperGroupServiceImpl extends ServiceImpl<PaperGroupDao, PaperGroup
|
|
if (!paper.getStructFinish()) {
|
|
if (!paper.getStructFinish()) {
|
|
throw new StatusException("试卷结构未提交,不能设置分组");
|
|
throw new StatusException("试卷结构未提交,不能设置分组");
|
|
}
|
|
}
|
|
- groupDelete(domain.getPaperId(), domain.getNumber(), user);
|
|
|
|
- PaperGroupEntity g = new PaperGroupEntity();
|
|
|
|
|
|
+ PaperGroupEntity g;
|
|
|
|
+ if(domain.getGroupId()!=null) {
|
|
|
|
+ g=this.getById(domain.getGroupId());
|
|
|
|
+ paperGroupUnitService.removeByGroupId(domain.getGroupId());
|
|
|
|
+ }else {
|
|
|
|
+ g = new PaperGroupEntity();
|
|
|
|
+ g.setPaperId(domain.getPaperId());
|
|
|
|
+ }
|
|
g.setNumber(domain.getNumber());
|
|
g.setNumber(domain.getNumber());
|
|
- g.setPaperId(domain.getPaperId());
|
|
|
|
- this.save(g);
|
|
|
|
|
|
+ this.saveOrUpdate(g);
|
|
List<PaperDetail> pds = paperDetailService.getStructInfo(domain.getPaperId());
|
|
List<PaperDetail> pds = paperDetailService.getStructInfo(domain.getPaperId());
|
|
if (CollectionUtils.isEmpty(pds)) {
|
|
if (CollectionUtils.isEmpty(pds)) {
|
|
throw new StatusException("试卷结构小题信息为空");
|
|
throw new StatusException("试卷结构小题信息为空");
|
|
@@ -258,20 +263,20 @@ public class PaperGroupServiceImpl extends ServiceImpl<PaperGroupDao, PaperGroup
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
- public void groupDelete(Long paperId, Integer groupNumber, User user) {
|
|
|
|
- PaperEntity paper = paperService.getById(paperId);
|
|
|
|
|
|
+ public void groupDelete(Long groupId, User user) {
|
|
|
|
+ PaperGroupEntity group=this.getById(groupId);
|
|
|
|
+ if (group == null) {
|
|
|
|
+ throw new StatusException("未找到分组信息");
|
|
|
|
+ }
|
|
|
|
+ PaperEntity paper = paperService.getById(group.getPaperId());
|
|
if (paper == null) {
|
|
if (paper == null) {
|
|
throw new StatusException("未找到试卷结构");
|
|
throw new StatusException("未找到试卷结构");
|
|
}
|
|
}
|
|
if (!user.getRole().equals(Role.SUPER_ADMIN) && !user.getSchoolId().equals(paper.getSchoolId())) {
|
|
if (!user.getRole().equals(Role.SUPER_ADMIN) && !user.getSchoolId().equals(paper.getSchoolId())) {
|
|
throw new StatusException("没有权限");
|
|
throw new StatusException("没有权限");
|
|
}
|
|
}
|
|
- PaperGroupEntity old = getByPaperIdAndNumber(paperId, groupNumber);
|
|
|
|
- if (old == null) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- this.removeById(old.getId());
|
|
|
|
- paperGroupUnitService.removeByPaperIdAndGroup(paperId, old.getId());
|
|
|
|
|
|
+ this.removeById(groupId);
|
|
|
|
+ paperGroupUnitService.removeByGroupId(groupId);
|
|
paper.setGroupFinish(false);
|
|
paper.setGroupFinish(false);
|
|
paperService.updateById(paper);
|
|
paperService.updateById(paper);
|
|
}
|
|
}
|