|
@@ -2,7 +2,9 @@ package cn.com.qmth.mps.service.impl;
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
+import cn.com.qmth.mps.bean.*;
|
|
|
import cn.com.qmth.mps.enums.ArbitrateMethod;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -14,11 +16,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.boot.core.exception.StatusException;
|
|
|
|
|
|
-import cn.com.qmth.mps.bean.PaperDetail;
|
|
|
-import cn.com.qmth.mps.bean.PaperDetailUnit;
|
|
|
-import cn.com.qmth.mps.bean.PaperGroup;
|
|
|
-import cn.com.qmth.mps.bean.PaperGroupUnit;
|
|
|
-import cn.com.qmth.mps.bean.User;
|
|
|
import cn.com.qmth.mps.dao.PaperGroupDao;
|
|
|
import cn.com.qmth.mps.entity.PaperDetailEntity;
|
|
|
import cn.com.qmth.mps.entity.PaperEntity;
|
|
@@ -224,7 +221,8 @@ public class PaperGroupServiceImpl extends ServiceImpl<PaperGroupDao, PaperGroup
|
|
|
if (Objects.isNull(arbitrateMethod)) {
|
|
|
throw new StatusException("仲裁方式未设置");
|
|
|
}
|
|
|
- if (ArbitrateMethod.GROUP_ARBITRATE.equals(arbitrateMethod) && (Objects.isNull(arbitrateThreshold) || (arbitrateThreshold < 0))) {
|
|
|
+ if (ArbitrateMethod.GROUP_ARBITRATE.equals(arbitrateMethod) && (Objects.isNull(arbitrateThreshold) || (
|
|
|
+ arbitrateThreshold < 0))) {
|
|
|
throw new StatusException("仲裁阈值未正确设置");
|
|
|
}
|
|
|
}
|
|
@@ -240,7 +238,7 @@ public class PaperGroupServiceImpl extends ServiceImpl<PaperGroupDao, PaperGroup
|
|
|
throw new StatusException("仲裁阈值未正确设置");
|
|
|
}
|
|
|
}
|
|
|
- if (!doubleEnable || ArbitrateMethod.GROUP_ARBITRATE.equals(arbitrateMethod)){
|
|
|
+ if (!doubleEnable || ArbitrateMethod.GROUP_ARBITRATE.equals(arbitrateMethod)) {
|
|
|
u.setArbitrateThreshold(null);
|
|
|
}
|
|
|
}
|
|
@@ -298,6 +296,11 @@ public class PaperGroupServiceImpl extends ServiceImpl<PaperGroupDao, PaperGroup
|
|
|
paperGroupUnitService.saveUnit(groupId, paperId, domain.getGroupUnits());
|
|
|
paper.setGroupFinish(
|
|
|
paperGroupUnitService.countByPaperId(paperId).equals(paperDetailUnitService.countByPaperId(paperId)));
|
|
|
+
|
|
|
+ DefaultDoubleSet defaultDoubleSet = domain.getDefaultDoubleSet();
|
|
|
+ if (Objects.nonNull(defaultDoubleSet)) {
|
|
|
+ paper.setDefaultDoubleSet(JSON.toJSONString(defaultDoubleSet));
|
|
|
+ }
|
|
|
paperService.updateById(paper);
|
|
|
}
|
|
|
|
|
@@ -324,7 +327,7 @@ public class PaperGroupServiceImpl extends ServiceImpl<PaperGroupDao, PaperGroup
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public void groupDelete(Long groupId, User user) {
|
|
|
- PaperGroupEntity group=this.getById(groupId);
|
|
|
+ PaperGroupEntity group = this.getById(groupId);
|
|
|
if (group == null) {
|
|
|
throw new StatusException("未找到分组信息");
|
|
|
}
|
|
@@ -338,8 +341,14 @@ public class PaperGroupServiceImpl extends ServiceImpl<PaperGroupDao, PaperGroup
|
|
|
}
|
|
|
this.removeById(groupId);
|
|
|
paperGroupUnitService.removeByGroupId(groupId);
|
|
|
- paper.setGroupFinish(false);
|
|
|
- paperService.updateById(paper);
|
|
|
+
|
|
|
+ UpdateWrapper<PaperEntity> paperEntityUpdateWrapper = new UpdateWrapper<>();
|
|
|
+ paperEntityUpdateWrapper.lambda().set(PaperEntity::getGroupFinish, false).eq(PaperEntity::getId, paper.getId());
|
|
|
+ if (this.count(new QueryWrapper<PaperGroupEntity>().lambda().eq(PaperGroupEntity::getPaperId, paper.getId()))
|
|
|
+ == 0) {
|
|
|
+ paperEntityUpdateWrapper.lambda().set(PaperEntity::getDefaultDoubleSet, null);
|
|
|
+ }
|
|
|
+ paperService.update(paperEntityUpdateWrapper);
|
|
|
}
|
|
|
|
|
|
@Override
|