|
@@ -92,10 +92,15 @@ public class ObjectDigitalServiceImpl extends ServiceImpl<ObjectDigitalMapper, O
|
|
|
|
|
|
@Override
|
|
|
public List<ObjectDigital> insert(List<ObjectDigital> voList) {
|
|
|
- validateOnSave(voList, false);
|
|
|
- if(CollUtil.isEmpty(voList)) {
|
|
|
+ //验证失败的数据
|
|
|
+ List<ObjectDigital> errorList = validateOnSave(voList, false);
|
|
|
+
|
|
|
+ if(CollUtil.isEmpty(voList) && CollUtil.isEmpty(errorList)) {
|
|
|
return null;
|
|
|
}
|
|
|
+ if(CollUtil.isEmpty(voList) && !CollUtil.isEmpty(errorList)) {
|
|
|
+ return errorList;
|
|
|
+ }
|
|
|
//获取对象类型
|
|
|
Map<String, String> typeMap = typeService.queryObjTypeMap();
|
|
|
voList.forEach(vo -> {
|
|
@@ -115,6 +120,8 @@ public class ObjectDigitalServiceImpl extends ServiceImpl<ObjectDigitalMapper, O
|
|
|
// 新增后消息
|
|
|
messageSender.sendMessage(DigitalMessageConstant.OPERATE_AFTER_INSERT, null, vo, false);
|
|
|
});
|
|
|
+ //返回总体数据
|
|
|
+ voList.addAll(errorList);
|
|
|
return voList;
|
|
|
}
|
|
|
|
|
@@ -679,18 +686,20 @@ public class ObjectDigitalServiceImpl extends ServiceImpl<ObjectDigitalMapper, O
|
|
|
* @param voList
|
|
|
* @param isUpdate
|
|
|
*/
|
|
|
- private void validateOnSave(List<ObjectDigital> voList, boolean isUpdate) {
|
|
|
- validateInfoCode(voList);
|
|
|
+ private List<ObjectDigital> validateOnSave(List<ObjectDigital> voList, boolean isUpdate) {
|
|
|
+ return validateInfoCode(voList);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 信息点值校验
|
|
|
* @param voList
|
|
|
+ * @return 对象类型不存在的需要返回
|
|
|
*/
|
|
|
- private void validateInfoCode(List<ObjectDigital> voList) {
|
|
|
+ private List<ObjectDigital> validateInfoCode(List<ObjectDigital> voList) {
|
|
|
if(CollUtil.isEmpty(voList)) {
|
|
|
- return;
|
|
|
+ return Collections.emptyList();
|
|
|
}
|
|
|
+ List<ObjectDigital> errorList = new ArrayList<>();
|
|
|
// 保存时,项目ID一定有,而且都是操作这个项目的数据。这是前提,若后续放开全集团保存,则应按项目分组后查询信息点
|
|
|
String projectId = AppContext.getContext().getProjectId();
|
|
|
//获取该信息点当前classCode
|
|
@@ -704,6 +713,8 @@ public class ObjectDigitalServiceImpl extends ServiceImpl<ObjectDigitalMapper, O
|
|
|
Map<String, ObjectInfoDefine> infoMap = typeInfoMap == null ? null : typeInfoMap.get(vo.getClassCode());
|
|
|
if(MapUtil.isEmpty(infoMap)) {
|
|
|
log.error(StrUtil.format("没有对象类型【{}】的信息点定义信息!", vo.getClassCode()));
|
|
|
+ vo.setMark(StrUtil.format("没有对象类型【{}】的信息点定义信息!", vo.getClassCode()));
|
|
|
+ errorList.add(vo);
|
|
|
continue;
|
|
|
}
|
|
|
// 只保留有对象类型的
|
|
@@ -727,7 +738,8 @@ public class ObjectDigitalServiceImpl extends ServiceImpl<ObjectDigitalMapper, O
|
|
|
InfoDataFactory.parse(infoMap.get(infoCode), infos.get(infoCode));
|
|
|
} catch (BusinessException e) {
|
|
|
// 校验不通过的移除
|
|
|
- infoKeys.remove();;
|
|
|
+ infoKeys.remove();
|
|
|
+
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
@@ -737,6 +749,7 @@ public class ObjectDigitalServiceImpl extends ServiceImpl<ObjectDigitalMapper, O
|
|
|
if(CollUtil.isNotEmpty(restList)) {
|
|
|
voList.addAll(restList);
|
|
|
}
|
|
|
+ return errorList;
|
|
|
}
|
|
|
|
|
|
/**
|