|
@@ -153,6 +153,8 @@ public class TBasePointController extends BaseController {
|
|
|
public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException {
|
|
|
//获取操作人员ID
|
|
|
Long userId = getUserId();
|
|
|
+
|
|
|
+ List<SysDictData> mediumTypeDict = isysDictTypeService.selectDictDataByType("medium_type");
|
|
|
//报错行数统计
|
|
|
CopyOnWriteArrayList<Integer> failRow = new CopyOnWriteArrayList<>();
|
|
|
Workbook workbook = ExcelUtils.getWorkBook(file);
|
|
@@ -201,7 +203,7 @@ public class TBasePointController extends BaseController {
|
|
|
entity.setDevName(cellValue);
|
|
|
} else if (j == 8) {
|
|
|
// 设备编号
|
|
|
- entity.setDevCode(cellValue);// 设备id
|
|
|
+ entity.setDevCode(cellValue);
|
|
|
} else if (j == 9) {
|
|
|
// 群组位置
|
|
|
entity.setGroupPosition(cellValue);
|
|
@@ -236,7 +238,7 @@ public class TBasePointController extends BaseController {
|
|
|
// 介质
|
|
|
entity.setMedium(cellValue);
|
|
|
} else if (j == 20) {
|
|
|
- for (SysDictData dictData : isysDictTypeService.selectDictDataByType("medium_type")) {
|
|
|
+ for (SysDictData dictData : mediumTypeDict) {
|
|
|
if (dictData.getDictLabel().equals(cellValue)) {
|
|
|
// 介质状态
|
|
|
entity.setMediumType(dictData.getDictValue());
|
|
@@ -263,7 +265,9 @@ public class TBasePointController extends BaseController {
|
|
|
entity.setPicNo(cellValue);
|
|
|
} else if (j == 27) {
|
|
|
// 运行时间
|
|
|
- entity.setRunTime(sdf.parse(cellValue));
|
|
|
+ if (cellValue.length() > 3) {//下次年度检验日期
|
|
|
+ entity.setRunTime(new SimpleDateFormat("yyyy-MM-dd").parse(cellValue));
|
|
|
+ }
|
|
|
} else if (j == 28) {
|
|
|
// 备注
|
|
|
entity.setRemarks(cellValue);
|
|
@@ -285,12 +289,11 @@ public class TBasePointController extends BaseController {
|
|
|
TBasePoint tBasePoint = tBasePointService.selectTBasePointByGroupCodeAndExtendCode(entity);
|
|
|
if (tBasePoint == null) {
|
|
|
entity.setUpdatedate(new Date());
|
|
|
- entity.setUpdaterCode(getUserId());
|
|
|
+ entity.setUpdaterCode(userId);
|
|
|
tBasePointService.insertTBasePoint(entity);
|
|
|
successNumber.getAndIncrement();
|
|
|
}else {
|
|
|
logger.info("重复数据");
|
|
|
- failNumber.getAndIncrement();
|
|
|
failRow.add(finalI + 1);
|
|
|
throw new InterruptedException();//中止线程
|
|
|
}
|
|
@@ -298,7 +301,6 @@ public class TBasePointController extends BaseController {
|
|
|
}catch (InterruptedException e) {
|
|
|
logger.info("中止线程"+ Thread.currentThread().getName());
|
|
|
}catch (Exception e) {
|
|
|
- failNumber.getAndIncrement();
|
|
|
failRow.add(finalI + 1);
|
|
|
e.printStackTrace();
|
|
|
} finally {
|
|
@@ -315,7 +317,7 @@ public class TBasePointController extends BaseController {
|
|
|
|
|
|
logger.info("list:" + JSON.toJSONString(list));
|
|
|
logger.info("successNumber:" + successNumber);
|
|
|
- logger.info("failNumber:" + failNumber);
|
|
|
+ logger.info("failNumber:" + failRow.size());
|
|
|
logger.info("failRow:" + failRow);
|
|
|
return AjaxResult.success(String.valueOf(successNumber.get()), failRow);
|
|
|
}
|