|
@@ -10,6 +10,7 @@ import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.file.ExcelUtils;
|
|
|
import com.ruoyi.project.production.controller.vo.SaiQueryVO;
|
|
|
import com.ruoyi.project.system.domain.SysDept;
|
|
|
+import com.ruoyi.project.system.mapper.SysDeptMapper;
|
|
|
import com.ruoyi.project.system.service.ISysDeptService;
|
|
|
import com.ruoyi.project.system.service.ISysDictTypeService;
|
|
|
import com.ruoyi.project.system.service.ISysUserService;
|
|
@@ -52,6 +53,9 @@ public class TSaiController extends BaseController
|
|
|
@Autowired
|
|
|
private ISysDeptService iSysDeptService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysDeptMapper sysDeptMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询SAI信息列表
|
|
|
*/
|
|
@@ -94,7 +98,7 @@ public class TSaiController extends BaseController
|
|
|
//字典查询
|
|
|
// List<SysDictData> tempStateDict = iSysDictTypeService.selectDictDataByType("TEMP_STATE");
|
|
|
//部门查询
|
|
|
- List<SysDept> dept = iSysDeptService.selectDeptList(new SysDept());
|
|
|
+ List<SysDept> sysDeptList = iSysDeptService.selectDeptList(new SysDept());
|
|
|
int rowNum = sheet.getPhysicalNumberOfRows();
|
|
|
int failNumber = 0;
|
|
|
for (int i = 2; i <= rowNum; i++) {
|
|
@@ -104,14 +108,18 @@ public class TSaiController extends BaseController
|
|
|
int cellNum = row.getPhysicalNumberOfCells();
|
|
|
TSai entity = new TSai();
|
|
|
entity.setDelFlag("0");
|
|
|
-// entity.setDeptId(userService.selectUserById(userId).getDeptId());
|
|
|
+ entity.setDeptId(userService.selectUserById(userId).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) {
|
|
|
- entity.setPlantId(cellValue);
|
|
|
+ for (SysDept sysDept : sysDeptList) {
|
|
|
+ if (sysDept.getDeptName().equals(cellValue)) {
|
|
|
+ entity.setPlantId(sysDept.getDeptId().toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
} else if (j == 1) {
|
|
|
if (cellValue.length() > 3) {
|
|
|
entity.setInspectionDate(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
@@ -125,7 +133,11 @@ public class TSaiController extends BaseController
|
|
|
} else if (j == 5) {
|
|
|
entity.setActions(cellValue);
|
|
|
} else if (j == 6) {
|
|
|
- entity.setUserDept(cellValue);
|
|
|
+ for (SysDept sysDept : sysDeptList) {
|
|
|
+ if (sysDept.getDeptName().equals(cellValue)) {
|
|
|
+ entity.setUserDept(sysDept.getDeptId().toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
} else if (j == 7) {
|
|
|
entity.setSource(cellValue);
|
|
|
}
|
|
@@ -168,6 +180,17 @@ public class TSaiController extends BaseController
|
|
|
public AjaxResult export(TSai tSai)
|
|
|
{
|
|
|
List<TSai> list = tSaiService.selectTSaiList(tSai);
|
|
|
+ List<SysDept> sysDepts = sysDeptMapper.selectDeptList(new SysDept());
|
|
|
+ for (TSai sai : list) {
|
|
|
+ for (SysDept sysDept : sysDepts) {
|
|
|
+ if (sysDept.getDeptId().toString().equals(sai.getPlantId())) {
|
|
|
+ sai.setPlantName(sysDept.getDeptName());
|
|
|
+ }
|
|
|
+ if (sysDept.getDeptId().toString().equals(sai.getUserDept())) {
|
|
|
+ sai.setUserDeptName(sysDept.getDeptName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
ExcelUtil<TSai> util = new ExcelUtil<TSai>(TSai.class);
|
|
|
return util.exportExcel(list, "sai");
|
|
|
}
|