|
@@ -113,14 +113,18 @@ public class ExtractByHandServiceImpl implements IExtractByHandService
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public int submitBySubTask(List<ExtractByHandDTO> extractByHandList) {
|
|
|
+ public List<ExtractByHandDTO> submitBySubTask(List<ExtractByHandDTO> extractByHandList, Boolean isApprove) {
|
|
|
List<ExtractByHand> extractByHands = ExtractByHandUtils.dto2Domain(extractByHandList);
|
|
|
- int returnValue = 0;
|
|
|
- if(CollectionUtils.isNotEmpty(extractByHands)){
|
|
|
+ // 每次进来先删除之前的数据
|
|
|
+ Long subTaskId = extractByHands.get(0).getSubTaskId();
|
|
|
+ deleteHandAndDetailBySubTaskId(subTaskId);
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(extractByHands)) {
|
|
|
for (ExtractByHand extractByHand : extractByHands) {
|
|
|
- returnValue = returnValue + insertExtractByHand(extractByHand);
|
|
|
+ extractByHand.setId(null);
|
|
|
+ insertExtractByHand(extractByHand);
|
|
|
List<ExtractByHandDetail> details = extractByHand.getDetails();
|
|
|
- if(CollectionUtils.isNotEmpty(details)){
|
|
|
+ if (CollectionUtils.isNotEmpty(details)) {
|
|
|
for (ExtractByHandDetail detail : details) {
|
|
|
detail.setHandId(extractByHand.getId());
|
|
|
extractByHandDetailService.insertExtractByHandDetail(detail);
|
|
@@ -128,9 +132,16 @@ public class ExtractByHandServiceImpl implements IExtractByHandService
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- subTaskService.updateSubTaskStatusById(extractByHands.get(0).getSubTaskId(), ExtractKnowledgeSubTask.DOWN,"");
|
|
|
- kgService.save2Neo4j(extractByHandList);
|
|
|
- return returnValue;
|
|
|
+ if (isApprove) {
|
|
|
+ subTaskService.updateSubTaskStatusById(subTaskId, ExtractKnowledgeSubTask.DOWN, "");
|
|
|
+ kgService.save2Neo4j(extractByHandList);
|
|
|
+ }
|
|
|
+
|
|
|
+ return getExtractByHandBySubtaskId(subTaskId);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void deleteHandAndDetailBySubTaskId(Long subTaskId) {
|
|
|
+ extractByHandMapper.deleteHandAndDetailBySubTaskId(subTaskId);
|
|
|
}
|
|
|
|
|
|
@Override
|