|
@@ -2093,6 +2093,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
List<SbType> typeList = sbTypeMapper.selectAll(); // 设备类型集合
|
|
|
List<SbInfo> addList = new ArrayList<>(); // 待导入集合
|
|
|
List<SysUser> users = sysUserMapper.selectAll(); // 用户集合
|
|
|
+ List<String> addTypeList = new ArrayList<>();
|
|
|
try {
|
|
|
List<ExportSbInfoVO> list = ExcelUtil.importExcel(file.getInputStream(), ExportSbInfoVO.class, 1);
|
|
|
if(CollectionUtil.isNotEmpty(list)){
|
|
@@ -2101,12 +2102,16 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
i++;
|
|
|
// 如果有检定周期,就是需要检定
|
|
|
SbInfo tempInfo = BeanConverterUtil.copyObjectProperties(vo,SbInfo.class);
|
|
|
+ tempInfo.setSeatNumber(30);// 默认30天提醒
|
|
|
// 对必填字段进行判断
|
|
|
if(StringUtils.isBlank(vo.getPositionNo())){
|
|
|
throw new BusinessException("第" + i + "行,位号为空,位号为必填项目,请填写;");// 编号为空,复制位号
|
|
|
}
|
|
|
+ if(vo.getIsFinancing() == 1 && StringUtils.isBlank(vo.getFinancingNo())){
|
|
|
+ throw new BusinessException("第" + i + "行,是固定资产,但是资产编号为空,请填写;");// 编号为空,复制位号
|
|
|
+ }
|
|
|
if(StringUtils.isBlank(vo.getName())){
|
|
|
- throw new BusinessException("第" + i + "行,位号为空,请填写;");// 编号为空,复制位号
|
|
|
+ throw new BusinessException("第" + i + "行,名称为空,请填写;");// 编号为空,复制位号
|
|
|
}
|
|
|
if(StringUtils.isBlank(vo.getModel())){
|
|
|
throw new BusinessException("第" + i + "行,型号为空,请填写;");// 编号为空,复制位号
|
|
@@ -2118,8 +2123,9 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
throw new BusinessException("第" + i + "行,自定义类型为空,生产设备请填3,计量设备填4,特种设备填5;");// 编号为空,复制位号
|
|
|
}
|
|
|
if(vo.getStatus() == null || vo.getStatus()<1 || vo.getStatus()>2){
|
|
|
- throw new BusinessException("第" + i + "行,状态为空,在库请填3,使用中填4;");// 编号为空,复制位号
|
|
|
+ throw new BusinessException("第" + i + "行,状态为空,在库请填1,使用中填2;");// 编号为空,复制位号
|
|
|
}
|
|
|
+
|
|
|
if(StringUtils.isBlank(vo.getNo())){
|
|
|
tempInfo.setNo(vo.getPositionNo());// 编号为空,复制位号
|
|
|
}
|
|
@@ -2142,7 +2148,8 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
}
|
|
|
}
|
|
|
if (!findSbType) {
|
|
|
- throw new BusinessException("系统找不到该设备类型名称,请先添加设备类型, 设备类型名称" + vo.getTypeName());
|
|
|
+ addTypeList.add(vo.getTypeName());
|
|
|
+ // throw new BusinessException("系统找不到该设备类型名称,请先添加设备类型, 设备类型名称" + vo.getTypeName());
|
|
|
}
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(vo.getPositionName())){ // 设备位置匹配
|
|
@@ -2200,6 +2207,10 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
addList.add(tempInfo);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if(CollectionUtil.isNotEmpty(addTypeList)){
|
|
|
+ throw new BusinessException(addTypeList.size() + "个设备类型名称找不到,请先添加:" + addTypeList.toString());
|
|
|
+ }
|
|
|
// 导入数据
|
|
|
mapper.insertListforComplex(addList);
|
|
|
return "总计导入:" + (addList.size());
|