fix: 89218 法规符合性排查流程(法规工程师发起) --手动新增生成后,提交提示字段太长
This commit is contained in:
+2
@@ -19,6 +19,8 @@ public class SplitExcelVO {
|
||||
@Excel(name = "条款内容")
|
||||
private String termContent;
|
||||
|
||||
private String sort;
|
||||
|
||||
public boolean emptyRowOrNot() {
|
||||
SplitExcelVO excel = this;
|
||||
return excel.getTermNumber() == null && excel.getTermTitle() == null && excel.getTermContent() == null;
|
||||
|
||||
+43
@@ -1209,6 +1209,7 @@ public class ProcessStandardComplianceCheckServiceImpl extends ServiceImpl<Proce
|
||||
*/
|
||||
private List<ProcessStandardComplianceCheckDetail> getSplitExcelData(MultipartFile splitFile, String sccId) {
|
||||
// 获取Excel的header
|
||||
List<String> errorMsgs;
|
||||
List<String> headers;
|
||||
try {
|
||||
headers = ExcelUtils.getHeaderFromExcel(splitFile.getInputStream());
|
||||
@@ -1233,11 +1234,53 @@ public class ProcessStandardComplianceCheckServiceImpl extends ServiceImpl<Proce
|
||||
log.error("分解单文件导入异常:" + e.getMessage(), e);
|
||||
throw new JeroBootException(ResultCommon.SPLIT_IMPORT_TEMPLATE_ERROR);
|
||||
}
|
||||
// 批量检查数据是否有效
|
||||
errorMsgs = this.validationSplitList(splitExcelVOList);
|
||||
if (!errorMsgs.isEmpty()) {
|
||||
String errorMsg = "<br>" + String.join("<br>", errorMsgs);
|
||||
throw new JeroBootException(ResultCommon.MODEL_IMPORT_DATA_ERROR, errorMsg);
|
||||
}
|
||||
List<ProcessStandardComplianceCheckDetail> result = BeanCopyUtils.copyBeanList(splitExcelVOList, ProcessStandardComplianceCheckDetail.class);
|
||||
result.parallelStream().forEach(detail -> detail.setCheckId(sccId));
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<String> validationSplitList(List<SplitExcelVO> list) {
|
||||
List<String> errorMsgs = new ArrayList<>();
|
||||
Set<String> modelSet = new HashSet<>();
|
||||
Map<String, List<Integer>> duplicateModels = new HashMap<>();
|
||||
int i = 2;
|
||||
Iterator<SplitExcelVO> iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
SplitExcelVO data = iterator.next();
|
||||
if (ExcelUtils.isEmptyRow(data)) {
|
||||
iterator.remove();
|
||||
if (list.isEmpty()) {
|
||||
errorMsgs.add("文件暂无数据,请检查后重试。");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
String termNum = data.getTermNumber();
|
||||
String termTitle = data.getTermTitle();
|
||||
|
||||
StringBuilder errMsgHeader = new StringBuilder();
|
||||
StringBuilder errMsg = new StringBuilder();
|
||||
data.setSort(String.valueOf(i++));
|
||||
errMsgHeader.append("第").append(data.getSort()).append("行");
|
||||
|
||||
errMsg.append(excelUtils.validTermNum(termNum));
|
||||
errMsg.append(excelUtils.validTermTitle(termTitle));
|
||||
|
||||
// 如果数据有问题,则将提示信息添加到 errorMsgs 中
|
||||
if (errMsg.length() > 0) {
|
||||
errorMsgs.add(errMsgHeader.append(errMsg).toString());
|
||||
}
|
||||
}
|
||||
|
||||
return errorMsgs;
|
||||
}
|
||||
|
||||
private List<ModelExcelVO> getModelExcelData(MultipartFile file) {
|
||||
List<SysDictItemCore> listDict = commonAPI.getDictItemAll();
|
||||
List<String> errorMsgs;
|
||||
|
||||
@@ -634,4 +634,24 @@ public class ExcelUtils {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String validTermNum(String value) {
|
||||
if (StrUtil.isBlank(value)) {
|
||||
return "";
|
||||
}
|
||||
if (value.length() > 200) {
|
||||
return "'条款号'过长(最多200字)。";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String validTermTitle(String value) {
|
||||
if (StrUtil.isBlank(value)) {
|
||||
return "";
|
||||
}
|
||||
if (value.length() > 500) {
|
||||
return "'条款标题'过长(最多500字)。";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user