|
@@ -1,33 +1,37 @@
|
|
|
package com.ruoyi.project.training.controller;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
+import com.ruoyi.common.utils.file.ExcelUtils;
|
|
|
+import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
|
|
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
|
|
+import com.ruoyi.framework.web.controller.BaseController;
|
|
|
+import com.ruoyi.framework.web.domain.AjaxResult;
|
|
|
+import com.ruoyi.framework.web.page.TableDataInfo;
|
|
|
+import com.ruoyi.project.system.domain.SysDept;
|
|
|
import com.ruoyi.project.system.domain.SysDictData;
|
|
|
+import com.ruoyi.project.system.service.ISysDeptService;
|
|
|
import com.ruoyi.project.system.service.ISysDictTypeService;
|
|
|
import com.ruoyi.project.training.domain.TTrainingCompanylevel;
|
|
|
+import com.ruoyi.project.training.domain.TTrainingMatrix;
|
|
|
import com.ruoyi.project.training.domain.TTrainingRegular;
|
|
|
import com.ruoyi.project.training.service.ITTrainingCompanylevelService;
|
|
|
+import com.ruoyi.project.training.service.ITTrainingMatrixService;
|
|
|
import com.ruoyi.project.training.service.ITTrainingRegularService;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.apache.poi.ss.usermodel.Cell;
|
|
|
+import org.apache.poi.ss.usermodel.Row;
|
|
|
+import org.apache.poi.ss.usermodel.Sheet;
|
|
|
+import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
|
|
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
|
|
-import com.ruoyi.project.training.domain.TTrainingMatrix;
|
|
|
-import com.ruoyi.project.training.service.ITTrainingMatrixService;
|
|
|
-import com.ruoyi.framework.web.controller.BaseController;
|
|
|
-import com.ruoyi.framework.web.domain.AjaxResult;
|
|
|
-import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
-import com.ruoyi.framework.web.page.TableDataInfo;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Calendar;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 培训矩阵Controller
|
|
@@ -37,30 +41,32 @@ import com.ruoyi.framework.web.page.TableDataInfo;
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/training/matrix")
|
|
|
-public class TTrainingMatrixController extends BaseController
|
|
|
-{
|
|
|
+public class TTrainingMatrixController extends BaseController {
|
|
|
@Autowired
|
|
|
private ITTrainingMatrixService tTrainingMatrixService;
|
|
|
|
|
|
@Autowired
|
|
|
private ISysDictTypeService iSysDictTypeService;
|
|
|
+ @Autowired
|
|
|
+ private ISysDeptService iSysDeptService;
|
|
|
|
|
|
@Autowired
|
|
|
private ITTrainingRegularService tTrainingRegularService;
|
|
|
@Autowired
|
|
|
private ITTrainingCompanylevelService tTrainingCompanylevelService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询培训矩阵列表
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('training:matrix:list')")
|
|
|
@GetMapping("/list")
|
|
|
- public TableDataInfo list(TTrainingMatrix tTrainingMatrix)
|
|
|
- {
|
|
|
+ public TableDataInfo list(TTrainingMatrix tTrainingMatrix) {
|
|
|
startPage();
|
|
|
List<TTrainingMatrix> list = tTrainingMatrixService.selectTTrainingMatrixList(tTrainingMatrix);
|
|
|
List<SysDictData> actualpost = iSysDictTypeService.selectDictDataByType("ACTUALPOST");
|
|
|
for (TTrainingMatrix t : list) {
|
|
|
- String[] actualpostId = new String[0];;
|
|
|
+ String[] actualpostId = new String[0];
|
|
|
+ ;
|
|
|
if (t.getActualpostId() != null) {
|
|
|
actualpostId = t.getActualpostId().split(",");
|
|
|
}
|
|
@@ -82,9 +88,9 @@ public class TTrainingMatrixController extends BaseController
|
|
|
}
|
|
|
if (i == 1) {
|
|
|
postStatu.add("M");
|
|
|
- }else if (i == 2) {
|
|
|
+ } else if (i == 2) {
|
|
|
postStatu.add("|");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
postStatu.add("-");
|
|
|
}
|
|
|
}
|
|
@@ -93,13 +99,13 @@ public class TTrainingMatrixController extends BaseController
|
|
|
String[] designatedOther = t.getDesignatedOther().split(",");
|
|
|
for (String d : designatedOther) {
|
|
|
if (d.equals("28")) {
|
|
|
- postStatu.set(postStatu.size() - 3, "(M)");
|
|
|
+ postStatu.set(postStatu.size() - 5, "(M)");
|
|
|
}
|
|
|
if (d.equals("30")) {
|
|
|
- postStatu.set(postStatu.size() - 2, "(M)");
|
|
|
+ postStatu.set(postStatu.size() - 4, "(M)");
|
|
|
}
|
|
|
if (d.equals("32")) {
|
|
|
- postStatu.set(postStatu.size() - 1, "(M)");
|
|
|
+ postStatu.set(postStatu.size() - 3, "(M)");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -115,8 +121,7 @@ public class TTrainingMatrixController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('training:matrix:export')")
|
|
|
@Log(title = "培训矩阵", businessType = BusinessType.EXPORT)
|
|
|
@GetMapping("/export")
|
|
|
- public AjaxResult export(TTrainingMatrix tTrainingMatrix)
|
|
|
- {
|
|
|
+ public AjaxResult export(TTrainingMatrix tTrainingMatrix) {
|
|
|
List<TTrainingMatrix> list = tTrainingMatrixService.selectTTrainingMatrixList(tTrainingMatrix);
|
|
|
ExcelUtil<TTrainingMatrix> util = new ExcelUtil<TTrainingMatrix>(TTrainingMatrix.class);
|
|
|
return util.exportExcel(list, "matrix");
|
|
@@ -127,8 +132,7 @@ public class TTrainingMatrixController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('training:matrix:query')")
|
|
|
@GetMapping(value = "/{id}")
|
|
|
- public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
- {
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
|
return AjaxResult.success(tTrainingMatrixService.selectTTrainingMatrixById(id));
|
|
|
}
|
|
|
|
|
@@ -138,8 +142,7 @@ public class TTrainingMatrixController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('training:matrix:add')")
|
|
|
@Log(title = "培训矩阵", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
- public AjaxResult add(@RequestBody TTrainingMatrix tTrainingMatrix)
|
|
|
- {
|
|
|
+ public AjaxResult add(@RequestBody TTrainingMatrix tTrainingMatrix) {
|
|
|
return toAjax(tTrainingMatrixService.insertTTrainingMatrix(tTrainingMatrix));
|
|
|
}
|
|
|
|
|
@@ -149,8 +152,7 @@ public class TTrainingMatrixController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('training:matrix:add')")
|
|
|
@Log(title = "批量添加装置培训", businessType = BusinessType.INSERT)
|
|
|
@GetMapping("batchAddTraining/{ids}")
|
|
|
- public AjaxResult batchAddTraining(@PathVariable Long[] ids)
|
|
|
- {
|
|
|
+ public AjaxResult batchAddTraining(@PathVariable Long[] ids) {
|
|
|
for (int i = 0; i < ids.length; i++) {
|
|
|
TTrainingMatrix tm = tTrainingMatrixService.selectTTrainingMatrixById(ids[i]);
|
|
|
TTrainingRegular tr = new TTrainingRegular();
|
|
@@ -174,8 +176,7 @@ public class TTrainingMatrixController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('training:matrix:add')")
|
|
|
@Log(title = "批量添加公司培训", businessType = BusinessType.INSERT)
|
|
|
@GetMapping("batchAddCompany/{ids}")
|
|
|
- public AjaxResult batchAddCompany(@PathVariable Long[] ids)
|
|
|
- {
|
|
|
+ public AjaxResult batchAddCompany(@PathVariable Long[] ids) {
|
|
|
for (int i = 0; i < ids.length; i++) {
|
|
|
TTrainingMatrix tm = tTrainingMatrixService.selectTTrainingMatrixById(ids[i]);
|
|
|
TTrainingCompanylevel tr = new TTrainingCompanylevel();
|
|
@@ -195,8 +196,7 @@ public class TTrainingMatrixController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('training:matrix:edit')")
|
|
|
@Log(title = "培训矩阵", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
- public AjaxResult edit(@RequestBody TTrainingMatrix tTrainingMatrix)
|
|
|
- {
|
|
|
+ public AjaxResult edit(@RequestBody TTrainingMatrix tTrainingMatrix) {
|
|
|
return toAjax(tTrainingMatrixService.updateTTrainingMatrix(tTrainingMatrix));
|
|
|
}
|
|
|
|
|
@@ -205,9 +205,321 @@ public class TTrainingMatrixController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('training:matrix:remove')")
|
|
|
@Log(title = "培训矩阵", businessType = BusinessType.DELETE)
|
|
|
- @DeleteMapping("/{ids}")
|
|
|
- public AjaxResult remove(@PathVariable Long[] ids)
|
|
|
- {
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public AjaxResult remove(@PathVariable Long[] ids) {
|
|
|
return toAjax(tTrainingMatrixService.deleteTTrainingMatrixByIds(ids));
|
|
|
}
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermi('training:byxWorklicense:add')")
|
|
|
+ @Log(title = "培训矩阵", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("/importData")
|
|
|
+ public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException {
|
|
|
+ //获取操作人员ID
|
|
|
+ Long userId = getUserId();
|
|
|
+ //报错行数统计
|
|
|
+ List<Integer> failRow = new ArrayList<Integer>();
|
|
|
+ Workbook workbook = ExcelUtils.getWorkBook(file);
|
|
|
+ Sheet sheet = workbook.getSheetAt(0);
|
|
|
+ List<TTrainingMatrix> list = new ArrayList<>();
|
|
|
+ //字典查询
|
|
|
+ List<SysDictData> levels = iSysDictTypeService.selectDictDataByType("TRAINING_LEVEL");
|
|
|
+ List<SysDictData> responsDepts = iSysDictTypeService.selectDictDataByType("RESPONS_DEPT");
|
|
|
+ List<SysDictData> actualposts = iSysDictTypeService.selectDictDataByType("ACTUALPOST");
|
|
|
+ //部门查询
|
|
|
+ List<SysDept> dept = iSysDeptService.selectDeptList(new SysDept());
|
|
|
+ int rowNum = sheet.getPhysicalNumberOfRows();
|
|
|
+ int failNumber = 0;
|
|
|
+ for (int i = 1; i < rowNum; i++) {
|
|
|
+ try {
|
|
|
+ logger.info("读取行数:" + i);
|
|
|
+ Row row = sheet.getRow(i);
|
|
|
+ int cellNum = row.getLastCellNum();
|
|
|
+ TTrainingMatrix entity = new TTrainingMatrix();
|
|
|
+ StringBuilder actualpostId = new StringBuilder();
|
|
|
+ StringBuilder designatedPosition = new StringBuilder();
|
|
|
+ StringBuilder designatedOther = new StringBuilder();
|
|
|
+ for (int j = 0; j < cellNum; j++) {
|
|
|
+ Cell cell = row.getCell(j);
|
|
|
+ String cellValue = ExcelUtils.getCellValue(cell);
|
|
|
+ logger.info("cellValue:" + cellValue);
|
|
|
+ if (j == 0) {
|
|
|
+ for (SysDictData level : levels) {
|
|
|
+ if (level.getDictLabel().equals(cellValue.trim())) {
|
|
|
+ entity.setTrainingLevel(level.getDictValue());//培训级别
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 1) {
|
|
|
+ entity.setItem(cellValue);
|
|
|
+ } else if (j == 2) {
|
|
|
+ entity.setCourseCode(cellValue);
|
|
|
+ } else if (j == 3) {
|
|
|
+ entity.setFrequency(cellValue);
|
|
|
+ } else if (j == 4) {
|
|
|
+ for (SysDictData responsDept : responsDepts) {
|
|
|
+ if (responsDept.getDictLabel().equals(cellValue.trim())) {
|
|
|
+ entity.setResponsDept(responsDept.getDictValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 5) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals(cellValue.trim())) {
|
|
|
+ entity.setLecturer(actualpost.getDictValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 6) {
|
|
|
+ entity.setHour(cellValue);
|
|
|
+ } else if (j == 7) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("装置经理")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 8) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("装置副经理")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 9) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("资深工程师")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 10) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("生产主管")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 11) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("片区工长")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 12) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("职员")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 13) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("EHS督导")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 14) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("倒班班长")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 15) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("倒班副班长")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 16) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("主操")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 17) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("副操")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 18) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("主操(白班)")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 19) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("机械维修人员")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 20) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("电仪维修人员")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 21) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("实验室人员")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 22) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("见习生")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 23) {
|
|
|
+ for (SysDictData actualpost : actualposts) {
|
|
|
+ if (actualpost.getDictLabel().equals("工程师")) {
|
|
|
+ if ("M".equals(cellValue) || "X".equals(cellValue) || "m".equals(cellValue) || "x".equals(cellValue)) {
|
|
|
+ actualpostId.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)||"(M)".equals(cellValue) || "(X)".equals(cellValue) || "(m)".equals(cellValue) || "(x)".equals(cellValue)) {
|
|
|
+ designatedOther.append(actualpost.getDictValue()).append(",");
|
|
|
+ } else if ("I".equals(cellValue) || "i".equals(cellValue)) {
|
|
|
+ designatedPosition.append(actualpost.getDictValue()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 24) {
|
|
|
+ entity.setRemarks(cellValue);
|
|
|
+ } else if (j == 25) {
|
|
|
+ for (SysDept d : dept) {
|
|
|
+ if (d.getDeptName().equals(cellValue.trim())) {
|
|
|
+ entity.setDeptId(d.getDeptId());//部门编号
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ entity.setCreaterCode(userId.toString());
|
|
|
+ if (StringUtils.isNotEmpty(actualpostId)) {
|
|
|
+ entity.setActualpostId(actualpostId.substring(0, actualpostId.lastIndexOf(",")));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(designatedOther)) {
|
|
|
+ entity.setInvolvedMoc("true");
|
|
|
+ entity.setDesignatedOther(designatedOther.substring(0, designatedOther.lastIndexOf(",")));
|
|
|
+ } else {
|
|
|
+ entity.setInvolvedMoc("false");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(designatedPosition)) {
|
|
|
+ entity.setDesignatedPosition(designatedPosition.substring(0, designatedPosition.lastIndexOf(",")));
|
|
|
+ }
|
|
|
+ logger.info("entity:" + entity);
|
|
|
+ list.add(entity);
|
|
|
+ } catch (Exception e) {
|
|
|
+ failNumber++;
|
|
|
+ failRow.add(i + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ int successNumber = 0;
|
|
|
+ int failNum = 0;
|
|
|
+ for (TTrainingMatrix t : list
|
|
|
+ ) {
|
|
|
+ failNum++;
|
|
|
+ try {
|
|
|
+ tTrainingMatrixService.insertTTrainingMatrix(t);
|
|
|
+ successNumber++;
|
|
|
+ } catch (Exception e) {
|
|
|
+ failNumber++;
|
|
|
+ failRow.add(failNum + 1);
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ logger.info("list:" + JSON.toJSONString(list));
|
|
|
+ logger.info("successNumber:" + successNumber);
|
|
|
+ logger.info("failNumber:" + failNumber);
|
|
|
+ logger.info("failRow:" + failRow);
|
|
|
+ return AjaxResult.success(String.valueOf(successNumber), failRow);
|
|
|
+ }
|
|
|
}
|