feat: 企标0级权限导入
This commit is contained in:
+21
-5
@@ -224,6 +224,7 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
|
||||
|
||||
@Override
|
||||
public void importOldESAuthAllExcel(MultipartFile file, HttpServletResponse response) {
|
||||
List<ESAuthAll> errImportList = new ArrayList<>();
|
||||
// 验证文件是否为压缩格式file.getContentType()).contains("xls")
|
||||
if (!Objects.requireNonNull(file.getOriginalFilename()).contains("xls")) {
|
||||
throw new JeroBootException("文件格式不正确,请上传Excel。");
|
||||
@@ -248,7 +249,11 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
|
||||
i--;
|
||||
}
|
||||
}
|
||||
log.info("获取数据成功,数据条数:{}", datalist.size());
|
||||
// 只取用企标数据
|
||||
// 区分数据
|
||||
log.info("获取数据成功,总数据条数:{}", datalist.size());
|
||||
datalist = datalist.stream().filter(data -> data.getStandardType().startsWith("企业标准")).collect(Collectors.toList());
|
||||
log.info("企标相关数据条数:{}", datalist.size());
|
||||
// 获取当前时间戳(毫秒)
|
||||
long endTime = System.currentTimeMillis();
|
||||
// 计算执行时间(毫秒)
|
||||
@@ -263,10 +268,16 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
|
||||
// 遍历dataList 并且构造Update语句
|
||||
List<LawsEnterpriseStandard> updateList = new ArrayList<>();
|
||||
for (ESAuthAll data : datalist) {
|
||||
LawsEnterpriseStandard es = esMap.get(data.getStandardId());
|
||||
if (es != null) {
|
||||
es.setGradeClassification("1");
|
||||
updateList.add(es);
|
||||
try {
|
||||
LawsEnterpriseStandard es = esMap.get(data.getStandardId());
|
||||
if (es != null) {
|
||||
es.setGradeClassification("1");
|
||||
updateList.add(es);
|
||||
} else {
|
||||
throw new JeroBootException("未找到该企标,标准编号:" + data.getStandardNumber() + ",标准名称:" + data.getStandardName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
errImportList.add(data);
|
||||
}
|
||||
}
|
||||
// 批量更新
|
||||
@@ -275,6 +286,11 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
|
||||
} catch (Exception e) {
|
||||
log.error("导入失败;{}", e.getMessage());
|
||||
}
|
||||
if (!errImportList.isEmpty()) {
|
||||
log.info("导入失败数据条数:{}", errImportList.size());
|
||||
this.exportWithExcel(response, errImportList, "ESAuthAllErrorData.xls");
|
||||
}
|
||||
log.info("企标所有人权限全部导入成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user