|
@@ -1,18 +1,18 @@
|
|
|
package cn.cslg.pas.service.business.invalidReport;
|
|
|
|
|
|
+import cn.cslg.pas.common.dto.DomainFieldDTO;
|
|
|
import cn.cslg.pas.common.dto.QueryFeatureHistoryDTO;
|
|
|
-import cn.cslg.pas.common.dto.invalidDTO.AddEvidenceReasonDTO;
|
|
|
-import cn.cslg.pas.common.dto.invalidDTO.AddEvidenceReasonsDTO;
|
|
|
-import cn.cslg.pas.common.dto.invalidDTO.QueryEvidenceReasonDTO;
|
|
|
-import cn.cslg.pas.common.dto.invalidDTO.QueryInvalidHistoryDTO;
|
|
|
+import cn.cslg.pas.common.dto.invalidDTO.*;
|
|
|
import cn.cslg.pas.common.model.cronModel.PersonnelVO;
|
|
|
import cn.cslg.pas.common.model.cronModel.Records;
|
|
|
import cn.cslg.pas.common.utils.CacheUtils;
|
|
|
+import cn.cslg.pas.common.utils.GenerateObjectUtil;
|
|
|
import cn.cslg.pas.common.utils.LoginUtils;
|
|
|
import cn.cslg.pas.common.vo.invalidVO.GroupFeatureHistoryVO;
|
|
|
import cn.cslg.pas.common.vo.invalidVO.QueryEvidenceReasonVO;
|
|
|
import cn.cslg.pas.common.vo.invalidVO.QueryInvalidHistoryVO;
|
|
|
import cn.cslg.pas.domain.business.*;
|
|
|
+import cn.cslg.pas.exception.XiaoShiException;
|
|
|
import cn.cslg.pas.mapper.InvalidReport.EvidenceReasonMapper;
|
|
|
import cn.cslg.pas.service.business.CompareLiteratureService;
|
|
|
import cn.cslg.pas.service.business.FeatureService;
|
|
@@ -54,119 +54,95 @@ public class EvidenceReasonService extends ServiceImpl<EvidenceReasonMapper, Evi
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean addEvidenceReason(AddEvidenceReasonDTO addEvidenceReasonDTO) {
|
|
|
+
|
|
|
PersonnelVO personnelVO = new PersonnelVO();
|
|
|
personnelVO.setId("1");
|
|
|
Integer groupId = addEvidenceReasonDTO.getGroupId();
|
|
|
+ Integer gen = addEvidenceReasonDTO.getGen();
|
|
|
List<AddEvidenceReasonsDTO> addEvidenceReasonsDTOs = addEvidenceReasonDTO.getEvidenceReasonList();
|
|
|
- // 遍历装载
|
|
|
+
|
|
|
List<AddEvidenceReasonsDTO> addEvidenceReasonsDTOList = new ArrayList<>();
|
|
|
- addEvidenceReasonsDTOs.forEach(item -> {
|
|
|
- AddEvidenceReasonsDTO tem = addEvidenceReasonsDTOList.stream().filter(i -> i.getFeatureOrder().equals(item.getFeatureOrder())).findFirst().orElse(null);
|
|
|
- if (tem == null) {
|
|
|
- addEvidenceReasonsDTOList.add(item);
|
|
|
- }
|
|
|
|
|
|
- });
|
|
|
+ if (gen.equals(0)) {
|
|
|
+ // 遍历装载不同的特征
|
|
|
+ addEvidenceReasonsDTOs.forEach(item -> {
|
|
|
+ AddEvidenceReasonsDTO tem = addEvidenceReasonsDTOList.stream().filter(i -> i.getFeatureOrder().equals(item.getFeatureOrder())).findFirst().orElse(null);
|
|
|
+ if (tem == null) {
|
|
|
+ addEvidenceReasonsDTOList.add(item);
|
|
|
+ }
|
|
|
|
|
|
- //遍历插入无id特征
|
|
|
- addEvidenceReasonsDTOList.forEach(item -> {
|
|
|
- if (item.getFeatureId() == null) {
|
|
|
- Feature feature = new Feature();
|
|
|
- feature.setContent(item.getFeatureText());
|
|
|
- feature.insert();
|
|
|
- item.setFeatureId(feature.getId());
|
|
|
- }
|
|
|
+ });
|
|
|
|
|
|
- });
|
|
|
- //获得所有的特征id
|
|
|
- List<Integer> featureIds = addEvidenceReasonsDTOs.stream()
|
|
|
- .filter(item -> item.getFeatureId() != null)
|
|
|
- .map(AddEvidenceReasonsDTO::getFeatureId).collect(Collectors.toList());
|
|
|
- this.deleteAssoByFeatureIds(featureIds, groupId);
|
|
|
+ //遍历插入无id特征
|
|
|
+ addEvidenceReasonsDTOList.forEach(item -> {
|
|
|
+ if (item.getFeatureId() == null) {
|
|
|
+ Feature feature = new Feature();
|
|
|
+ feature.setContent(item.getFeatureText());
|
|
|
+ feature.insert();
|
|
|
+ item.setFeatureId(feature.getId());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
for (AddEvidenceReasonsDTO addEvidenceReasonsDTO : addEvidenceReasonsDTOs) {
|
|
|
//获得特征信息
|
|
|
Integer featureId = addEvidenceReasonsDTO.getFeatureId();
|
|
|
Integer featureOrder = addEvidenceReasonsDTO.getFeatureOrder();
|
|
|
- //判断
|
|
|
- AddEvidenceReasonsDTO tem = addEvidenceReasonsDTOList.stream()
|
|
|
- .filter(item -> addEvidenceReasonsDTO.getFeatureOrder().equals(item.getFeatureOrder())).findFirst().orElse(null);
|
|
|
- if (tem == null) {
|
|
|
- featureId = tem.getFeatureId();
|
|
|
- }
|
|
|
-
|
|
|
+ Integer featureGroupId = addEvidenceReasonsDTO.getFeatureGroupId();
|
|
|
+ if(gen.equals(0)) {
|
|
|
+ //判断
|
|
|
+ AddEvidenceReasonsDTO tem = addEvidenceReasonsDTOList.stream()
|
|
|
+ .filter(item -> addEvidenceReasonsDTO.getFeatureOrder().equals(item.getFeatureOrder())).findFirst().orElse(null);
|
|
|
+ if (tem == null) {
|
|
|
+ featureId = tem.getFeatureId();
|
|
|
+ }
|
|
|
|
|
|
+ //当特征和证据组合关联id未存在时
|
|
|
+ if (featureGroupId == null) {
|
|
|
+ AssoGroupFeature assoGroupFeature = new AssoGroupFeature();
|
|
|
+ assoGroupFeature.setFeatureId(featureId);
|
|
|
+ assoGroupFeature.setFeatureOrder(featureOrder);
|
|
|
+ assoGroupFeature.setGroupId(groupId);
|
|
|
+ assoGroupFeature.setFeatureGen(0);
|
|
|
+ assoGroupFeature.insert();
|
|
|
+ featureGroupId = assoGroupFeature.getId();
|
|
|
+ }
|
|
|
+ }
|
|
|
//添加无效理由
|
|
|
Integer reasonId = this.addEvidenceReason(addEvidenceReasonsDTO, personnelVO.getId());
|
|
|
- //添加无效理由和特征关联
|
|
|
+ //根据特征证据组合关联id 删除和无效理由关联
|
|
|
+ LambdaQueryWrapper<AssoFeatureReason> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(AssoFeatureReason::getGFeatureId, featureGroupId)
|
|
|
+ .eq(AssoFeatureReason::getGen, gen);
|
|
|
+ assoFeatureReasonService.remove(queryWrapper);
|
|
|
+ //添加特征和证据组合关联
|
|
|
AssoFeatureReason assoFeatureReason = new AssoFeatureReason();
|
|
|
assoFeatureReason.setReasonId(reasonId);
|
|
|
- assoFeatureReason.setFeatureId(featureId);
|
|
|
+ assoFeatureReason.setGFeatureId(featureGroupId);
|
|
|
+ assoFeatureReason.setGen(gen);
|
|
|
assoFeatureReason.insert();
|
|
|
-
|
|
|
- //添加特征和证据组合关联
|
|
|
- AssoGroupFeature assoGroupFeature = new AssoGroupFeature();
|
|
|
- assoGroupFeature.setFeatureId(featureId);
|
|
|
- assoGroupFeature.setFeatureOrder(featureOrder);
|
|
|
- assoGroupFeature.setGroupId(groupId);
|
|
|
- assoGroupFeature.insert();
|
|
|
}
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
- public Boolean deleteAssoByFeatureIds(List<Integer> featureIds, Integer groupId) {
|
|
|
- //根据groupId 删除特征和group关联
|
|
|
- LambdaQueryWrapper<AssoGroupFeature> assoWrapper = new LambdaQueryWrapper<>();
|
|
|
- assoWrapper.eq(AssoGroupFeature::getGroupId, groupId);
|
|
|
- List<AssoGroupFeature> assoGroupFeatures = assoGroupFeatureService.list(assoWrapper);
|
|
|
- List<Integer> inFeatureIds = assoGroupFeatures.stream().map(AssoGroupFeature::getFeatureId).collect(Collectors.toList());
|
|
|
-
|
|
|
- if (inFeatureIds != null && inFeatureIds.size() > 0) {
|
|
|
-
|
|
|
- //根据特征id 查询无效理由
|
|
|
- LambdaQueryWrapper<AssoFeatureReason> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.in(AssoFeatureReason::getFeatureId, inFeatureIds);
|
|
|
-
|
|
|
- List<AssoFeatureReason> assoFeatureReasons = assoFeatureReasonService.list(queryWrapper);
|
|
|
- //获得无效理由id
|
|
|
- if (assoFeatureReasons.size() > 0) {
|
|
|
- //删除无效理由和证据文献关联
|
|
|
- List<Integer> reasonIds = assoFeatureReasons.stream().map(AssoFeatureReason::getReasonId).collect(Collectors.toList());
|
|
|
- //根据无效理由id删除和证据文献关联
|
|
|
- LambdaQueryWrapper<AssoReasonLiterature> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper1.in(AssoReasonLiterature::getReasonId, reasonIds);
|
|
|
- assoReasonLiteratureService.remove(queryWrapper1);
|
|
|
-
|
|
|
- //删除无效理由和特征关联
|
|
|
- assoFeatureReasonService.remove(queryWrapper);
|
|
|
-
|
|
|
- this.removeBatchByIds(reasonIds);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- //删除证据组合和特征关联
|
|
|
- LambdaQueryWrapper<AssoGroupFeature> queryWrapper3 = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper3.eq(AssoGroupFeature::getGroupId, groupId);
|
|
|
- assoGroupFeatureService.remove(queryWrapper3);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- return true;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
private Integer addEvidenceReason(AddEvidenceReasonsDTO addEvidenceReasonsDTO, String createId) {
|
|
|
+ Integer id = addEvidenceReasonsDTO.getEvidenceReasonId();
|
|
|
//添加无效理由
|
|
|
- EvidenceReason evidenceReason = new EvidenceReason();
|
|
|
- evidenceReason.setEvidenceText(addEvidenceReasonsDTO.getEvidenceText());
|
|
|
- evidenceReason.setCreateId(createId);
|
|
|
- evidenceReason.setDescription(addEvidenceReasonsDTO.getEvidenceDescription());
|
|
|
- evidenceReason.insert();
|
|
|
- Integer id = evidenceReason.getId();
|
|
|
+ if (id == null) {
|
|
|
+ EvidenceReason evidenceReason = new EvidenceReason();
|
|
|
+ evidenceReason.setEvidenceText(addEvidenceReasonsDTO.getEvidenceText());
|
|
|
+ evidenceReason.setCreateId(createId);
|
|
|
+ evidenceReason.setDescription(addEvidenceReasonsDTO.getEvidenceDescription());
|
|
|
+ evidenceReason.insert();
|
|
|
+ } else {
|
|
|
+ EvidenceReason evidenceReason = this.getById(id);
|
|
|
+ evidenceReason.setEvidenceText(addEvidenceReasonsDTO.getEvidenceText());
|
|
|
+ evidenceReason.setDescription(addEvidenceReasonsDTO.getEvidenceDescription());
|
|
|
+ }
|
|
|
//添加无效理由和证据关联
|
|
|
this.addAssoReasonLiterature(addEvidenceReasonsDTO.getLiteratureId(), id);
|
|
|
return id;
|
|
@@ -177,6 +153,10 @@ public class EvidenceReasonService extends ServiceImpl<EvidenceReasonMapper, Evi
|
|
|
if (literatureIds == null || literatureIds.size() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
+ LambdaQueryWrapper<AssoReasonLiterature> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper1.eq(AssoReasonLiterature::getReasonId, reasonId);
|
|
|
+ assoReasonLiteratureService.remove(queryWrapper1);
|
|
|
+
|
|
|
literatureIds.forEach(item -> {
|
|
|
AssoReasonLiterature assoReasonLiterature = new AssoReasonLiterature();
|
|
|
assoReasonLiterature.setLiteratureId(item);
|
|
@@ -191,11 +171,11 @@ public class EvidenceReasonService extends ServiceImpl<EvidenceReasonMapper, Evi
|
|
|
//查询无效理由
|
|
|
public List<QueryEvidenceReasonVO> queryEvidenceReason(@RequestBody QueryEvidenceReasonDTO queryEvidenceReasonDTO) {
|
|
|
Integer groupId = queryEvidenceReasonDTO.getGroupId();
|
|
|
+ Integer gen = queryEvidenceReasonDTO.getGen();
|
|
|
//根据证据组合id 查询特征
|
|
|
- LambdaQueryWrapper<AssoGroupFeature> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(AssoGroupFeature::getGroupId, groupId);
|
|
|
- queryWrapper.eq(AssoGroupFeature::getFeatureGen, 0);
|
|
|
- List<AssoGroupFeature> assoGroupFeatures = assoGroupFeatureService.list(queryWrapper);
|
|
|
+
|
|
|
+ List<AssoGroupFeature> assoGroupFeatures = assoGroupFeatureService.getBaseMapper().selectLastGroupFeature(groupId, null, gen);
|
|
|
+
|
|
|
List<QueryEvidenceReasonVO> queryEvidenceReasonVOS = new ArrayList<>();
|
|
|
if (assoGroupFeatures != null && assoGroupFeatures.size() != 0) {
|
|
|
assoGroupFeatures.forEach(item -> {
|
|
@@ -212,7 +192,7 @@ public class EvidenceReasonService extends ServiceImpl<EvidenceReasonMapper, Evi
|
|
|
|
|
|
//根据特征id 查询无效理由
|
|
|
LambdaQueryWrapper<AssoFeatureReason> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper1.eq(AssoFeatureReason::getFeatureId, featureId);
|
|
|
+ queryWrapper1.eq(AssoFeatureReason::getGFeatureId, featureId);
|
|
|
List<AssoFeatureReason> assoFeatureReasons = assoFeatureReasonService.list(queryWrapper1);
|
|
|
|
|
|
if (assoFeatureReasons.size() != 0) {
|
|
@@ -277,7 +257,7 @@ public class EvidenceReasonService extends ServiceImpl<EvidenceReasonMapper, Evi
|
|
|
Long size = queryInvalidHistoryDTO.getSize();
|
|
|
//根据featureId 查询无效理由
|
|
|
LambdaQueryWrapper<AssoFeatureReason> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(AssoFeatureReason::getFeatureId, featureId);
|
|
|
+ queryWrapper.eq(AssoFeatureReason::getGFeatureId, featureId);
|
|
|
Page<AssoFeatureReason> page = assoFeatureReasonService.page(new Page<>(current, size), queryWrapper);
|
|
|
Long total = page.getTotal();
|
|
|
List<AssoFeatureReason> assoFeatureReasons = page.getRecords();
|
|
@@ -329,4 +309,30 @@ public class EvidenceReasonService extends ServiceImpl<EvidenceReasonMapper, Evi
|
|
|
return records;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ //更新信息
|
|
|
+ public Boolean updateMessage(UpdateMessageDTO updateMessageDTO) {
|
|
|
+ Integer id = updateMessageDTO.getId();
|
|
|
+ List<DomainFieldDTO> domainFieldDTOS = updateMessageDTO.getFieldList();
|
|
|
+ EvidenceReason evidenceReason = this.getById(id);
|
|
|
+ if (evidenceReason == null) {
|
|
|
+ throw new XiaoShiException("证据不存在");
|
|
|
+
|
|
|
+ }
|
|
|
+ if (domainFieldDTOS == null || domainFieldDTOS.size() == 0) {
|
|
|
+ throw new XiaoShiException("请输入值");
|
|
|
+ }
|
|
|
+ domainFieldDTOS.forEach(item -> {
|
|
|
+ try {
|
|
|
+ if (item.getValue() != null) {
|
|
|
+ GenerateObjectUtil.setObjectProperty(evidenceReason, item.getField(), item.getValue());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new XiaoShiException("装载失败");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ evidenceReason.updateById();
|
|
|
+ return true;
|
|
|
+
|
|
|
+ }
|
|
|
}
|