认账-参数项收集-填写人导入-bug修改

This commit is contained in:
liyawei
2022-11-03 10:14:18 +08:00
parent c9fef8fc22
commit da1effd003
@@ -1887,13 +1887,20 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
stringBuilder.append("NIO编号为").append("<span style='color: red'>").append(nioNumber).append("</span>").append("工程接口人没有填写,请填写完工程接口人再进行下发收集。");
}
} else {
} else if ("2".equals(type)) {
if (CutEnum.EN.getValue().equals(cut)) {
stringBuilder.append("NIO number is ").append(nioNumber).append(",state is ").append("<span style='color: red'>").append(stateName).append("</span>").append(",no operation permission for this button.");
} else {
stringBuilder.append("NIO编号为").append(nioNumber).append(",状态为").append("<span style='color: red'>").append(stateName).append("</span>").append(",没有此按钮的操作权限。");
}
} else if ("3".equals(type)) {
if (CutEnum.EN.getValue().equals(cut)) {
stringBuilder.append("NIO number is ").append(nioNumber).append(",state is ").append("<span style='color: red'>").append(stateName).append("</span>").append(", fail to import.");
} else {
stringBuilder.append("NIO编号为").append(nioNumber).append(",状态为").append("<span style='color: red'>").append(stateName).append("</span>").append(",导入失败。");
}
}
msgList.add(stringBuilder.toString());
@@ -2687,24 +2694,24 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
List<Map<String, Object>> datas = result;
if(datas!=null &&!datas.isEmpty()){
try {
int i = 0 ;
List<Map<String, Object>> datasUpdate = new ArrayList<>();
// int i = 0 ;
// List<Map<String, Object>> datasUpdate = new ArrayList<>();
//处理空行数据,当读取exceL出现空行过多时,空行数为20以上时中断读取,将数据清洗为新的list
for(Map<String, Object> importDto :datas){
if(i>20){
break;
}
//判断此行数据是否全部为空
if(checkObjAllFieldsIsNull(importDto)){
i++;
//是则不读取
continue;
}
i = 0;
datasUpdate.add(importDto);
}
// for(Map<String, Object> importDto :datas){
// if(i>20){
// break;
// }
// //判断此行数据是否全部为空
// if(checkObjAllFieldsIsNull(importDto)){
// i++;
// //是则不读取
// continue;
// }
// i = 0;
// datasUpdate.add(importDto);
// }
String unzipfilepath = zipEntryName;
Result<?> message = importData(datasUpdate,unzipfilepath,cut,paramsManifestId);
Result<?> message = importData(datas,unzipfilepath,cut,paramsManifestId);
//删除原上传文件
FileUnZip.deleteDir(saveDirectory);
return message;
@@ -2771,6 +2778,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
}
//将导入数据循环合并整理后 新增至相应表
List<ParamsConfigDataEO> configDataList = (List<ParamsConfigDataEO>) map.get("configDataList");
List<Map<String, String>> notImportNioNumberList = (List<Map<String, String>>) map.get("notImportNioNumberList");
for (ParamsConfigDataEO importDto : configDataList) {
//判断此行数据是否全部为空,是则不读取
@@ -2809,13 +2817,19 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
String msg = "";
if (isSuccess) {
int countSuccess = configDataList.size();
if (CutEnum.CN.getValue().equals(cut)) {
msg = "成功导入" + countSuccess + "";
if (CollectionUtil.isNotEmpty(notImportNioNumberList)) {
List<String> msgList = getMsgOfIssueCollection(notImportNioNumberList, cut, "3");
return Result.OK(null, msgList);
} else {
msg = "import " + countSuccess + " datas successfully";
int countSuccess = configDataList.size();
if (CutEnum.CN.getValue().equals(cut)) {
msg = "成功导入" + countSuccess + "";
} else {
msg = "import " + countSuccess + " datas successfully";
}
return Result.OK(msg, null);
}
return Result.OK(msg, null);
} else {
if (CutEnum.CN.getValue().equals(cut)) {
msg = "导入失败";
@@ -3654,9 +3668,9 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
}
}
// 当前行所有单元格均不为空时
if (a != cellLength && row != null) {
// if (a != cellLength && row != null) {
list.add(map);
}
// }
}
return list;
}
@@ -3677,12 +3691,10 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
List<String> configIdList = paramsConfigEOList.stream().map(ParamsConfigEO::getId).collect(Collectors.toList());
List<ParamsConfigDataEO> paramsConfigDataEOList = paramsConfigDataEOService.queryListByConfigIdList(configIdList);
Map<String, String> controlTypeMap = ControlTypeEnum.toMapForImport(cut);
Map<String, String> controlVerifyMap = ControlVerifyEnum.toMapForImport(cut);
Map<String, String> paramsIsMustMap = ParamsIsMustEnum.toMapForImport(cut);
//存放数据验证结果信息
List<ParamsConfigDataEO> configDataList = new ArrayList<>();
List<String> verifyNioNumber = new ArrayList<>();
List<Map<String, String>> notImportNioNumberList = new ArrayList<>();
List<String> stringMessage = new ArrayList<>();
int i = 3; //记录行号
//循环验证数据
@@ -3698,10 +3710,50 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
Map<String, Object> resultMap = new HashMap<>();
String nioNumber = (String) dto.get("nio_number");
String controlType = controlTypeMap.get((String) dto.get("control_type"));
String controlVerify = controlVerifyMap.get((String) dto.get("control_verify"));
String controlValues = (String) dto.get("control_values");
String isMust = paramsIsMustMap.get((String) dto.get("is_must"));
if (StringUtils.isBlank(nioNumber)) {
continue;
}
List<ParamsCollectManifestEO> listPCM = paramsCollectManifestEOList.stream().filter(e-> nioNumber.equals(e.getNioNumber())).collect(Collectors.toList());
if (CollectionUtil.isEmpty(listPCM)) {
if (CutEnum.EN.getValue().equals(cut)) {
errorMsg += "NIO Number can not find; ";
} else{
errorMsg += "NIO编号不存在;";
}
countError++;
stringMessage.add(errorMsg);
continue;
}
if (!verifyNioNumber.contains(nioNumber)) {
verifyNioNumber.add(nioNumber);
} else{
if (CutEnum.EN.getValue().equals(cut)) {
errorMsg += "NIO Number is repeat; ";
} else{
errorMsg += "NIO编号重复;";
}
countError ++;
stringMessage.add(errorMsg);
continue;
}
ParamsCollectManifestEO paramsCollectManifestEO = listPCM.get(0);
String state = paramsCollectManifestEO.getState();
if (!CollectManifestStateEnum.WAIT_FILL.getValue().equals(state) && !CollectManifestStateEnum.CERT_BACK.getValue().equals(state)) {
Map<String, String> msgMap = new HashMap<>();
msgMap.put("nioNumber", nioNumber);
msgMap.put("state", state);
msgMap.put("type", "3");
notImportNioNumberList.add(msgMap);
continue;
}
String controlType = paramsCollectManifestEO.getControlType();
String controlVerify = paramsCollectManifestEO.getControlVerify();
String controlValues = paramsCollectManifestEO.getControlValues();
String isMust = paramsCollectManifestEO.getIsMust();
for (Map.Entry<String, Object> entry : dto.entrySet()) {
String key = entry.getKey();
String value = (String) entry.getValue();
@@ -3935,6 +3987,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
if (stringMessage.isEmpty()) {
map.put("result", true);
map.put("configDataList", configDataList);
map.put("notImportNioNumberList", notImportNioNumberList);
map.put("message", "");
} else {
map.put("result", false);