Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -214,4 +214,6 @@ public class ResultCommon {
|
||||
|
||||
public static final String CAN_NOT_FIND_FIELD = "can_not_find_field";
|
||||
|
||||
public static final String TREE_NODE_EXISTS = "tree.node.exists";
|
||||
|
||||
}
|
||||
|
||||
+45
-21
@@ -85,8 +85,10 @@ import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static com.jero.modules.activiti.common.ActivitiCommon.*;
|
||||
import static com.jero.modules.activiti.process.standardComplianceCheck.common.ProcessStandardComplianceCheckConstants.UNALLOCATED_QUANTITY;
|
||||
@@ -625,6 +627,9 @@ public class ProcessStandardComplianceCheckServiceImpl extends ServiceImpl<Proce
|
||||
|
||||
@Override
|
||||
public Map<String, Object> importExcelWithData(MultipartFile file, String taskId) throws IOException {
|
||||
// 异步获取 handleData
|
||||
CompletableFuture<ProcessInfoVO<ProcessSccVO>> handleDataFuture = CompletableFuture.supplyAsync(() -> this.getHandleData(taskId));
|
||||
|
||||
List<SysDictItemCore> listDict = commonAPI.getDictItemAll();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
List<String> errorMsgs = new ArrayList<>();
|
||||
@@ -715,8 +720,9 @@ public class ProcessStandardComplianceCheckServiceImpl extends ServiceImpl<Proce
|
||||
resultMap.put("flag", YesOrNoEnum.YES.getValue());
|
||||
// 转换为字典值
|
||||
this.transToDictValue(list, listDict, fileMap);
|
||||
// 等待异步获取的数据返回
|
||||
ProcessInfoVO<ProcessSccVO> handleData = handleDataFuture.join();
|
||||
// 清洗
|
||||
ProcessInfoVO<ProcessSccVO> handleData = this.getHandleData(taskId);
|
||||
this.cleanData(list, handleData.getBusinessInfoDTO().getDetailInfoList());
|
||||
resultMap.put("dataList", list);
|
||||
}
|
||||
@@ -760,37 +766,55 @@ public class ProcessStandardComplianceCheckServiceImpl extends ServiceImpl<Proce
|
||||
}
|
||||
|
||||
private void cleanData(List<WithoutDistributeExcelTemplate> list, List<ProcessStandardComplianceCheckDetail> existDataList) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
IntStream.range(0, list.size()).parallel().forEach(i -> {
|
||||
WithoutDistributeExcelTemplate item = list.get(i);
|
||||
item.setId(existDataList.get(i).getId());
|
||||
item.setProcessInstanceId(existDataList.get(i).getProcessInstanceId());
|
||||
item.setCheckId(existDataList.get(i).getCheckId());
|
||||
ProcessStandardComplianceCheckDetail existingData = existDataList.get(i);
|
||||
|
||||
// 设置基础属性
|
||||
item.setId(existingData.getId());
|
||||
item.setProcessInstanceId(existingData.getProcessInstanceId());
|
||||
item.setCheckId(existingData.getCheckId());
|
||||
|
||||
// 根据 result 进行条件清理
|
||||
String result = item.getResult();
|
||||
if (StrUtil.isBlank(result)) {
|
||||
item.setUnsatisfiedRequire(null);
|
||||
item.setCorrectionSolution(null);
|
||||
item.setCorrectionCost(null);
|
||||
item.setCommonality(null);
|
||||
item.setCommonalityCost(null);
|
||||
item.setRemark(null);
|
||||
item.setMaterial(null);
|
||||
clearFieldsForBlankResult(item);
|
||||
} else {
|
||||
switch (result) {
|
||||
case CONFORM_TO:
|
||||
case NOT_INVOLVE:
|
||||
item.setUnsatisfiedRequire(null);
|
||||
item.setCorrectionSolution(null);
|
||||
item.setCorrectionCost(null);
|
||||
item.setCommonality(null);
|
||||
item.setCommonalityCost(null);
|
||||
clearFieldsForConformOrNotInvolve(item);
|
||||
break;
|
||||
case DISCREPANCY:
|
||||
case TO_BE_VERIFIED:
|
||||
item.setRemark(null);
|
||||
item.setMaterial(null);
|
||||
clearFieldsForDiscrepancyOrToBeVerified(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void clearFieldsForBlankResult(WithoutDistributeExcelTemplate item) {
|
||||
item.setUnsatisfiedRequire(null);
|
||||
item.setCorrectionSolution(null);
|
||||
item.setCorrectionCost(null);
|
||||
item.setCommonality(null);
|
||||
item.setCommonalityCost(null);
|
||||
item.setRemark(null);
|
||||
item.setMaterial(null);
|
||||
}
|
||||
|
||||
private void clearFieldsForConformOrNotInvolve(WithoutDistributeExcelTemplate item) {
|
||||
item.setUnsatisfiedRequire(null);
|
||||
item.setCorrectionSolution(null);
|
||||
item.setCorrectionCost(null);
|
||||
item.setCommonality(null);
|
||||
item.setCommonalityCost(null);
|
||||
}
|
||||
|
||||
private void clearFieldsForDiscrepancyOrToBeVerified(WithoutDistributeExcelTemplate item) {
|
||||
item.setRemark(null);
|
||||
item.setMaterial(null);
|
||||
}
|
||||
|
||||
private void transToDictValue(List<WithoutDistributeExcelTemplate> list, List<SysDictItemCore> listDict, Map<String, File> fileMap) {
|
||||
@@ -802,7 +826,7 @@ public class ProcessStandardComplianceCheckServiceImpl extends ServiceImpl<Proce
|
||||
|
||||
private List<String> validationList(List<WithoutDistributeExcelTemplate> list, List<SysDictItemCore> listDict, Map<String, File> fileMap) {
|
||||
List<String> errorMsgs = new ArrayList<>();
|
||||
int i = 4;
|
||||
int i = 2;
|
||||
Iterator<WithoutDistributeExcelTemplate> iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
WithoutDistributeExcelTemplate data = iterator.next();
|
||||
|
||||
+3
-4
@@ -3,6 +3,7 @@ package com.jero.modules.laws.standard.service.impl;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.constant.FillRuleConstant;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
@@ -161,8 +162,7 @@ public class LawsTreeNodeServiceImpl extends ServiceImpl<LawsTreeNodeMapper, Law
|
||||
query.eq(LawsTreeNode::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
|
||||
List<LawsTreeNode> lawsTreeNodes = this.list(query);
|
||||
if (lawsTreeNodes != null && !lawsTreeNodes.isEmpty()) {
|
||||
//TODO 翻译
|
||||
throw new JeroBootException("已存在名为" + lawsTreeNode.getNodeName() + "的节点");
|
||||
throw new JeroBootException(ResultCommon.TREE_NODE_EXISTS, lawsTreeNode.getNodeName());
|
||||
}
|
||||
String s = UUID.randomUUID().toString().replace("-", "");
|
||||
lawsTreeNode.setId(s);
|
||||
@@ -196,8 +196,7 @@ public class LawsTreeNodeServiceImpl extends ServiceImpl<LawsTreeNodeMapper, Law
|
||||
query.ne(LawsTreeNode::getId,lawsTreeNode.getId());
|
||||
List<LawsTreeNode> lawsTreeNodes = this.list(query);
|
||||
if (lawsTreeNodes != null && !lawsTreeNodes.isEmpty()) {
|
||||
//TODO 翻译
|
||||
throw new JeroBootException("已存在名为" + lawsTreeNode.getNodeName() + "的节点");
|
||||
throw new JeroBootException(ResultCommon.TREE_NODE_EXISTS, lawsTreeNode.getNodeName());
|
||||
}
|
||||
this.updateById(lawsTreeNode);
|
||||
return true;
|
||||
|
||||
@@ -87,3 +87,4 @@ model.import.data.error=\u8F66\u578B\u9879\u76EE\u6587\u4EF6\u4E0A\u4F20\u6570\u
|
||||
file.empty.import.error=\u6587\u4EF6\u4E3A\u7A7A\uFF0C\u8BF7\u68C0\u67E5\u540E\u91CD\u8BD5
|
||||
can_not_find_template_file=\u627E\u4E0D\u5230\u540D\u4E3A{0}\u7684\u6A21\u677F\u6587\u4EF6
|
||||
can_not_find_field=\u627E\u4E0D\u5230\u540D\u4E3A{0}\u7684\u5B57\u6BB5
|
||||
tree.node.exists=\u5DF2\u5B58\u5728\u540D\u4E3A"{0}"\u7684\u8282\u70B9"
|
||||
@@ -105,3 +105,4 @@ row.size.too.large=Row size too large
|
||||
can_not_find_template_file=Can not find template file name {0}
|
||||
can_not_find_field=Can not find field {0}
|
||||
tag.add.error.1=The attribute name is too long
|
||||
tree.node.exists=Name {0} tree node exists
|
||||
@@ -104,3 +104,4 @@ row.size.too.large=\u884C\u5927\u5C0F\u592A\u5927
|
||||
can_not_find_template_file=\u627E\u4E0D\u5230\u540D\u4E3A{0}\u7684\u6A21\u677F\u6587\u4EF6
|
||||
can_not_find_field=\u627E\u4E0D\u5230\u540D\u4E3A{0}\u7684\u5B57\u6BB5
|
||||
tag.add.error.1=\u5C5E\u6027\u540D\u79F0\u592A\u957F
|
||||
tree.node.exists=\u5DF2\u5B58\u5728\u540D\u4E3A"{0}"\u7684\u8282\u70B9"
|
||||
Reference in New Issue
Block a user