|
@@ -94,6 +94,7 @@ public class TMocController extends BaseController
|
|
|
List<SysDictData> mocAreaDict = iSysDictTypeService.selectDictDataByType("MOC_AREA");
|
|
|
List<SysDictData> mocTypeDict = iSysDictTypeService.selectDictDataByType("MOC_TYPE");
|
|
|
List<SysDictData> mcDetailDict = iSysDictTypeService.selectDictDataByType("MC_DETAIL");
|
|
|
+ List<SysDictData> mocRiskLevelDict = iSysDictTypeService.selectDictDataByType("MOC_RISKLEVEL");
|
|
|
List<SysDictData> yesNoEnDict = iSysDictTypeService.selectDictDataByType("YES_NO_EN");
|
|
|
// 遍历总表数据,插入永久MOC表
|
|
|
for (TMoc moc : mocList) {
|
|
@@ -102,9 +103,6 @@ public class TMocController extends BaseController
|
|
|
permanentMoc.setCompanyMocNo(moc.getCompanyMocNo());
|
|
|
permanentMoc.setProjectNo(moc.getProjectNo());
|
|
|
for (SysDictData sysDictData : mocAreaDict) {
|
|
|
- System.out.println("sysDictData.getDictValue():" + sysDictData.getDictValue());
|
|
|
- System.out.println("permanentMoc.getArea():" + permanentMoc.getArea());
|
|
|
- System.out.println("比对结果:" + sysDictData.getDictValue().equals(permanentMoc.getArea()));
|
|
|
if (sysDictData.getDictValue().equals(moc.getArea())) {
|
|
|
permanentMoc.setArea(sysDictData.getDictLabel());
|
|
|
}
|
|
@@ -124,7 +122,11 @@ public class TMocController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
permanentMoc.setRemarks(moc.getRemarks());
|
|
|
- permanentMoc.setRiskLevel(moc.getRiskLevel());
|
|
|
+ for (SysDictData sysDictData : mocRiskLevelDict) {
|
|
|
+ if (sysDictData.getDictValue().equals(moc.getRiskLevel())) {
|
|
|
+ permanentMoc.setRiskLevel(sysDictData.getDictLabel());
|
|
|
+ }
|
|
|
+ }
|
|
|
permanentMoc.setEhsCheck(moc.getEhsCheck());
|
|
|
permanentMoc.setTraining(moc.getTraining());
|
|
|
for (SysDictData sysDictData : yesNoEnDict) {
|
|
@@ -154,7 +156,7 @@ public class TMocController extends BaseController
|
|
|
* 批量导入MOC管理
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('process:moc:add')")
|
|
|
- @PostMapping("/importData")
|
|
|
+ @PostMapping("/permanent/importData")
|
|
|
public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException
|
|
|
{
|
|
|
//获取操作人员ID
|
|
@@ -166,114 +168,94 @@ public class TMocController extends BaseController
|
|
|
List<TMoc> list = new ArrayList<TMoc>();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
//字典查询
|
|
|
- List<SysDictData> plant = iSysDictTypeService.selectDictDataByType("PLANT_DIVIDE");
|
|
|
- List<SysDictData> state = iSysDictTypeService.selectDictDataByType("MOC_STATE");
|
|
|
- List<SysDictData> change = iSysDictTypeService.selectDictDataByType("MOC_CHANGE");
|
|
|
- List<SysDictData> risklevel = iSysDictTypeService.selectDictDataByType("MOC_RISKLEVEL");
|
|
|
- List<SysDictData> area = iSysDictTypeService.selectDictDataByType("MOC_AREA");
|
|
|
- List<SysDictData> temporarystate = iSysDictTypeService.selectDictDataByType("MOC_TEMPORARYSTATE");
|
|
|
- List<SysDictData> yesno = iSysDictTypeService.selectDictDataByType("YES_NO");
|
|
|
+ List<SysDictData> mocAreaDict = iSysDictTypeService.selectDictDataByType("MOC_AREA");
|
|
|
+ List<SysDictData> mocTypeDict = iSysDictTypeService.selectDictDataByType("MOC_TYPE");
|
|
|
+ List<SysDictData> mcDetailDict = iSysDictTypeService.selectDictDataByType("MC_DETAIL");
|
|
|
+ List<SysDictData> mocRiskLevelDict = iSysDictTypeService.selectDictDataByType("MOC_RISKLEVEL");
|
|
|
+ List<SysDictData> yesNoEnDict = iSysDictTypeService.selectDictDataByType("YES_NO_EN");
|
|
|
//部门查询
|
|
|
List<SysDept> dept = iSysDeptService.selectDeptList(new SysDept());
|
|
|
int rowNum = sheet.getPhysicalNumberOfRows();
|
|
|
int failNumber = 0;
|
|
|
- for (int i = 1; i < rowNum; i++) {
|
|
|
+ for (int i = 2; i <= rowNum; i++) {
|
|
|
try {
|
|
|
logger.info("读取行数:" + i);
|
|
|
Row row = sheet.getRow(i);
|
|
|
int cellNum = row.getPhysicalNumberOfCells();
|
|
|
TMoc entity = new TMoc();
|
|
|
+ entity.setTimeliness("1");
|
|
|
+ entity.setDeptId(userService.selectUserById(getUserId()).getDeptId());
|
|
|
for (int j = 0; j < cellNum; j++) {
|
|
|
Cell cell = row.getCell(j);
|
|
|
// cell.setCellType(CellType.STRING);
|
|
|
String cellValue = ExcelUtils.getCellValue(cell);
|
|
|
logger.info("cellValue:" + cellValue);
|
|
|
if (j == 0) {
|
|
|
- for (SysDictData p : plant) {
|
|
|
- if (p.getDictLabel().equals(cellValue.trim())) {
|
|
|
- entity.setPlantCode(p.getDictValue());//装置名称
|
|
|
- }
|
|
|
- }
|
|
|
+ entity.setMocNo(cellValue);
|
|
|
} else if (j == 1) {
|
|
|
- entity.setMocNo(cellValue);//MOC编号
|
|
|
+ entity.setCompanyMocNo(cellValue);
|
|
|
} else if (j == 2) {
|
|
|
- for (SysDictData a : area) {
|
|
|
- if (a.getDictLabel().equals(cellValue.trim())) {
|
|
|
- entity.setArea(a.getDictValue());//区域
|
|
|
+ entity.setProjectNo(cellValue);
|
|
|
+ } else if (j == 3) {
|
|
|
+ for (SysDictData sysDictData : mocAreaDict) {
|
|
|
+ if (sysDictData.getDictLabel().equals(cellValue.trim())) {
|
|
|
+ entity.setArea(sysDictData.getDictValue());
|
|
|
}
|
|
|
}
|
|
|
- } else if (j == 3) {
|
|
|
- entity.setTitle(cellValue);//标题
|
|
|
} else if (j == 4) {
|
|
|
- entity.setOwner(cellValue);//负责人
|
|
|
+ entity.setTitle(cellValue);
|
|
|
} else if (j == 5) {
|
|
|
- if (cellValue.length() > 3) {
|
|
|
- entity.setApproveTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));//申请时间
|
|
|
+ for (SysDictData sysDictData : mocTypeDict) {
|
|
|
+ if (sysDictData.getDictLabel().equals(cellValue.trim())) {
|
|
|
+ entity.setMocType(sysDictData.getDictValue());
|
|
|
+ }
|
|
|
}
|
|
|
} else if (j == 6) {
|
|
|
- if (cellValue.length() > 3) {
|
|
|
- entity.setEndtime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));//完成时间
|
|
|
- }
|
|
|
+ entity.setOwner(cellValue);
|
|
|
} else if (j == 7) {
|
|
|
- for (SysDictData s : state) {
|
|
|
- if (s.getDictLabel().equals(cellValue.trim())) {
|
|
|
- entity.setTrueState(s.getDictValue());//实施情况
|
|
|
- }
|
|
|
- }
|
|
|
+ entity.setApproveTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
} else if (j == 8) {
|
|
|
- for (SysDictData c : change) {
|
|
|
- if (c.getDictLabel().equals(cellValue.trim())) {
|
|
|
- entity.setChangeNature(c.getDictValue());//变更性质
|
|
|
- }
|
|
|
- }
|
|
|
+ entity.setMcTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
} else if (j == 9) {
|
|
|
- if (cellValue.length() > 3) {
|
|
|
- entity.setOverTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));//到期时间
|
|
|
- }
|
|
|
- } else if (j == 10) {
|
|
|
- for (SysDictData t : temporarystate) {
|
|
|
- if (t.getDictLabel().equals(cellValue.trim())) {
|
|
|
- entity.setTemporaryState(t.getDictValue());//临时moc状态
|
|
|
+ for (SysDictData sysDictData : mcDetailDict) {
|
|
|
+ if (sysDictData.getDictLabel().equals(cellValue.trim())) {
|
|
|
+ entity.setMcDetail(sysDictData.getDictValue());
|
|
|
}
|
|
|
}
|
|
|
+ } else if (j == 10) {
|
|
|
+ entity.setRemarks(cellValue);
|
|
|
} else if (j == 11) {
|
|
|
- entity.setRemarks(cellValue);//备注
|
|
|
- } else if (j == 12) {
|
|
|
- for (SysDictData r : risklevel) {
|
|
|
- if (r.getDictLabel().equals(cellValue.trim())) {
|
|
|
- entity.setRiskLevel(r.getDictValue());//风险等级
|
|
|
+ for (SysDictData sysDictData : mocRiskLevelDict) {
|
|
|
+ if (sysDictData.getDictLabel().equals(cellValue.trim())) {
|
|
|
+ entity.setRiskLevel(sysDictData.getDictValue());
|
|
|
}
|
|
|
}
|
|
|
+ } else if (j == 12) {
|
|
|
+ entity.setEhsCheck(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
} else if (j == 13) {
|
|
|
- if (cellValue.length() > 3) {
|
|
|
- entity.setEhsCheck(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));//EHS审查
|
|
|
- }
|
|
|
+ entity.setTraining(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
} else if (j == 14) {
|
|
|
- if (cellValue.length() > 3) {
|
|
|
- entity.setTraining(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));//培训
|
|
|
+ for (SysDictData sysDictData : yesNoEnDict) {
|
|
|
+ if (sysDictData.getDictLabel().equals(cellValue.trim())) {
|
|
|
+ entity.setSopUpdate(sysDictData.getDictValue());
|
|
|
+ }
|
|
|
}
|
|
|
} else if (j == 15) {
|
|
|
- if (cellValue.length() > 3) {
|
|
|
- entity.setPssr(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));//PSSR
|
|
|
+ for (SysDictData sysDictData : yesNoEnDict) {
|
|
|
+ if (sysDictData.getDictLabel().equals(cellValue.trim())) {
|
|
|
+ entity.setPidMaster(sysDictData.getDictValue());
|
|
|
+ }
|
|
|
}
|
|
|
} else if (j == 16) {
|
|
|
- for (SysDictData y : yesno) {
|
|
|
- if (y.getDictLabel().equals(cellValue.trim())) {
|
|
|
- entity.setSopUpdate(y.getDictValue());//SOP更新
|
|
|
+ for (SysDictData sysDictData : yesNoEnDict) {
|
|
|
+ if (sysDictData.getDictLabel().equals(cellValue.trim())) {
|
|
|
+ entity.setDocUpdate(sysDictData.getDictValue());
|
|
|
}
|
|
|
}
|
|
|
} else if (j == 17) {
|
|
|
- for (SysDictData y : yesno) {
|
|
|
- if (y.getDictLabel().equals(cellValue.trim())) {
|
|
|
- entity.setPidMaster(y.getDictValue());//PID更新
|
|
|
- }
|
|
|
- }
|
|
|
+ entity.setPssr(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
} else if (j == 18) {
|
|
|
- for (SysDept d : dept) {
|
|
|
- if (d.getDeptName().equals(cellValue.trim())) {
|
|
|
- entity.setDeptId(d.getDeptId());//部门编号
|
|
|
- }
|
|
|
- }
|
|
|
+ entity.setPssrNo(cellValue);
|
|
|
}
|
|
|
}
|
|
|
entity.setCreaterCode(userId.toString());
|