|
|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
4
|
4
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
5
|
5
|
import com.sundot.airport.common.core.domain.entity.SysDept;
|
|
6
|
6
|
import com.sundot.airport.common.core.domain.entity.SysUser;
|
|
|
7
|
+import com.sundot.airport.common.enums.DeptType;
|
|
7
|
8
|
import com.sundot.airport.system.domain.SysPost;
|
|
8
|
9
|
import com.sundot.airport.system.domain.BasePosition;
|
|
9
|
10
|
import com.sundot.airport.ledger.domain.*;
|
|
|
@@ -172,8 +173,7 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
|
|
172
|
173
|
List<LedgerSupervisionProblem> list = new ArrayList<>();
|
|
173
|
174
|
for (Object[] c : dataRows(sheet, 2)) {
|
|
174
|
175
|
LedgerSupervisionProblem o = new LedgerSupervisionProblem();
|
|
175
|
|
-
|
|
176
|
|
- // 按导入顺序映射字段
|
|
|
176
|
+
|
|
177
|
177
|
o.setRecordDate(date(c, 0)); // 时间
|
|
178
|
178
|
o.setLocation(str(c, 1)); // 区域
|
|
179
|
179
|
o.setChannelNo(str(c, 2)); // 工作点
|
|
|
@@ -185,22 +185,11 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
|
|
185
|
185
|
o.setResultHandling(str(c, 7)); // 整改措施
|
|
186
|
186
|
o.setBasis(str(c, 8)); // 依据
|
|
187
|
187
|
o.setProblemLevel(str(c, 9)); // 问题层级
|
|
188
|
|
- o.setTeamName(str(c, 10)); // 班组
|
|
189
|
|
- o.setQualityOfficer(str(c, 11)); // 队室质控员
|
|
190
|
|
- o.setQualityPushLeader(str(c, 12)); // 质控推送队室负责人
|
|
191
|
|
- o.setEvidenceFile(str(c, 13)); // 附件
|
|
192
|
|
- o.setRectificationStatus(str(c, 14)); // 整改情况
|
|
193
|
|
- o.setEvidenceMaterial(str(c, 15)); // 佐证材料
|
|
194
|
|
- o.setSendToRelevant(str(c, 16)); // 发送至相关人员
|
|
195
|
|
- o.setMonthlyProblemCount(integer(c, 17)); // 本月内发生问题次数
|
|
196
|
|
- o.setLastMonthExceedThree(str(c, 18)); // 上月质控问题超过三次人员
|
|
197
|
|
- o.setCheckPersonnel(str(c, 19)); // 检查人员
|
|
198
|
|
- o.setManageQcManager(str(c, 20)); // 分管质控经理
|
|
199
|
|
- o.setInputTime(date(c, 21)); // 录入时间
|
|
200
|
|
- o.setDeptTrainingInstructor(str(c, 22)); // 部门培训教员
|
|
201
|
|
- o.setTeamInternalDuty(str(c, 23)); // 队室内勤
|
|
202
|
|
- o.setTeamLeader(str(c, 24)); // 队室负责人
|
|
203
|
|
-
|
|
|
188
|
+ o.setEvidenceFile(str(c, 10)); // 附件
|
|
|
189
|
+ o.setRectificationStatus(str(c, 11)); // 整改情况
|
|
|
190
|
+ o.setRectificationEvidence(str(c, 12)); // 整改佐证材料
|
|
|
191
|
+ o.setPatrolPersonnel(str(c, 13)); // 巡查人员
|
|
|
192
|
+
|
|
204
|
193
|
// 根据责任人名称查找组织ID和名称
|
|
205
|
194
|
if (inspectedName != null && !inspectedName.trim().isEmpty()) {
|
|
206
|
195
|
Map<String, Object> orgInfo = resolveOrgInfoByNameWithCache(inspectedName);
|
|
|
@@ -214,10 +203,9 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
|
|
214
|
203
|
o.setGroupName((String) orgInfo.get("groupName"));
|
|
215
|
204
|
}
|
|
216
|
205
|
}
|
|
217
|
|
-
|
|
|
206
|
+
|
|
218
|
207
|
// 根据岗位和区域查找对应ID
|
|
219
|
208
|
if (importCache != null) {
|
|
220
|
|
- // 岗位ID
|
|
221
|
209
|
String positionName = o.getPosition();
|
|
222
|
210
|
if (positionName != null && !positionName.trim().isEmpty()) {
|
|
223
|
211
|
Long positionId = importCache.getPositionIdByName(positionName.trim());
|
|
|
@@ -225,8 +213,7 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
|
|
225
|
213
|
o.setPositionId(positionId);
|
|
226
|
214
|
}
|
|
227
|
215
|
}
|
|
228
|
|
-
|
|
229
|
|
- // 区域ID
|
|
|
216
|
+
|
|
230
|
217
|
String areaName = o.getLocation();
|
|
231
|
218
|
if (areaName != null && !areaName.trim().isEmpty()) {
|
|
232
|
219
|
Long areaId = importCache.getAreaIdByName(areaName.trim());
|
|
|
@@ -235,7 +222,7 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
|
|
235
|
222
|
}
|
|
236
|
223
|
}
|
|
237
|
224
|
}
|
|
238
|
|
-
|
|
|
225
|
+
|
|
239
|
226
|
o.setImportBatch(batchNo);
|
|
240
|
227
|
o.setSourceType("1");
|
|
241
|
228
|
o.setCreateBy(username);
|
|
|
@@ -1412,8 +1399,9 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
|
|
1412
|
1399
|
|
|
1413
|
1400
|
/**
|
|
1414
|
1401
|
* 根据人员名称查找用户,并补充组织架构ID
|
|
|
1402
|
+ * 层级:STATION(机构站) → BRIGADE(部门) → MANAGER(班组) → TEAMS(小组)
|
|
1415
|
1403
|
* @param personName 人员名称
|
|
1416
|
|
- * @return Map包含: userId, deptId(BRIGADE), teamId(MANAGER), groupId(TEAMS)
|
|
|
1404
|
+ * @return Map包含: userId, stationId, stationName, deptId, deptName, teamId, teamName, groupId, groupName
|
|
1417
|
1405
|
*/
|
|
1418
|
1406
|
private Map<String, Object> resolveOrgInfoByNameWithCache(String personName) {
|
|
1419
|
1407
|
Map<String, Object> result = new HashMap<>();
|
|
|
@@ -1422,8 +1410,7 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
|
|
1422
|
1410
|
}
|
|
1423
|
1411
|
|
|
1424
|
1412
|
String name = personName.trim();
|
|
1425
|
|
-
|
|
1426
|
|
- // 1. 从缓存中查找用户
|
|
|
1413
|
+
|
|
1427
|
1414
|
SysUser user = importCache.getUserByNickName(name);
|
|
1428
|
1415
|
if (user == null || user.getDeptId() == null) {
|
|
1429
|
1416
|
return result;
|
|
|
@@ -1431,7 +1418,6 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
|
|
1431
|
1418
|
|
|
1432
|
1419
|
result.put("userId", user.getUserId());
|
|
1433
|
1420
|
|
|
1434
|
|
- // 2. 从缓存中获取用户部门信息
|
|
1435
|
1421
|
SysDept userDept = importCache.getDeptById(user.getDeptId());
|
|
1436
|
1422
|
if (userDept == null) {
|
|
1437
|
1423
|
return result;
|
|
|
@@ -1439,39 +1425,56 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
|
|
1439
|
1425
|
|
|
1440
|
1426
|
String deptType = userDept.getDeptType();
|
|
1441
|
1427
|
|
|
1442
|
|
- // 3. 根据部门类型递归获取各级组织ID和名称
|
|
1443
|
|
- if ("BRIGADE".equals(deptType)) {
|
|
1444
|
|
- // 用户部门是大队
|
|
|
1428
|
+ if (DeptType.STATION.getCode().equals(deptType)) {
|
|
|
1429
|
+ result.put("stationId", user.getDeptId());
|
|
|
1430
|
+ result.put("stationName", userDept.getDeptName());
|
|
|
1431
|
+ } else if (DeptType.BRIGADE.getCode().equals(deptType)) {
|
|
1445
|
1432
|
result.put("deptId", user.getDeptId());
|
|
1446
|
1433
|
result.put("deptName", userDept.getDeptName());
|
|
1447
|
|
- } else if ("MANAGER".equals(deptType)) {
|
|
1448
|
|
- // 用户部门是队室/班组,向上找大队
|
|
|
1434
|
+ if (userDept.getParentId() != null && userDept.getParentId() != 0) {
|
|
|
1435
|
+ SysDept parentDept = importCache.getDeptById(userDept.getParentId());
|
|
|
1436
|
+ if (parentDept != null) {
|
|
|
1437
|
+ result.put("stationId", parentDept.getDeptId());
|
|
|
1438
|
+ result.put("stationName", parentDept.getDeptName());
|
|
|
1439
|
+ }
|
|
|
1440
|
+ }
|
|
|
1441
|
+ } else if (DeptType.MANAGER.getCode().equals(deptType)) {
|
|
1449
|
1442
|
result.put("teamId", user.getDeptId());
|
|
1450
|
1443
|
result.put("teamName", userDept.getDeptName());
|
|
1451
|
1444
|
if (userDept.getParentId() != null && userDept.getParentId() != 0) {
|
|
1452
|
|
- result.put("deptId", userDept.getParentId());
|
|
1453
|
|
- // 从缓存中获取父级部门(大队)
|
|
1454
|
1445
|
SysDept parentDept = importCache.getDeptById(userDept.getParentId());
|
|
1455
|
1446
|
if (parentDept != null) {
|
|
|
1447
|
+ result.put("deptId", parentDept.getDeptId());
|
|
1456
|
1448
|
result.put("deptName", parentDept.getDeptName());
|
|
|
1449
|
+ if (parentDept.getParentId() != null && parentDept.getParentId() != 0) {
|
|
|
1450
|
+ SysDept grandParentDept = importCache.getDeptById(parentDept.getParentId());
|
|
|
1451
|
+ if (grandParentDept != null) {
|
|
|
1452
|
+ result.put("stationId", grandParentDept.getDeptId());
|
|
|
1453
|
+ result.put("stationName", grandParentDept.getDeptName());
|
|
|
1454
|
+ }
|
|
|
1455
|
+ }
|
|
1457
|
1456
|
}
|
|
1458
|
1457
|
}
|
|
1459
|
|
- } else if ("TEAMS".equals(deptType)) {
|
|
1460
|
|
- // 用户部门是小组,向上找队室和大队
|
|
|
1458
|
+ } else if (DeptType.TEAMS.getCode().equals(deptType)) {
|
|
1461
|
1459
|
result.put("groupId", user.getDeptId());
|
|
1462
|
1460
|
result.put("groupName", userDept.getDeptName());
|
|
1463
|
1461
|
if (userDept.getParentId() != null && userDept.getParentId() != 0) {
|
|
1464
|
|
- result.put("teamId", userDept.getParentId());
|
|
1465
|
|
- // 从缓存中获取父级部门(队室)
|
|
1466
|
1462
|
SysDept parentDept = importCache.getDeptById(userDept.getParentId());
|
|
1467
|
1463
|
if (parentDept != null) {
|
|
|
1464
|
+ result.put("teamId", parentDept.getDeptId());
|
|
1468
|
1465
|
result.put("teamName", parentDept.getDeptName());
|
|
1469
|
1466
|
if (parentDept.getParentId() != null && parentDept.getParentId() != 0) {
|
|
1470
|
|
- result.put("deptId", parentDept.getParentId());
|
|
1471
|
|
- // 从缓存中获取祖父级部门(大队)
|
|
1472
|
1467
|
SysDept grandParentDept = importCache.getDeptById(parentDept.getParentId());
|
|
1473
|
1468
|
if (grandParentDept != null) {
|
|
|
1469
|
+ result.put("deptId", grandParentDept.getDeptId());
|
|
1474
|
1470
|
result.put("deptName", grandParentDept.getDeptName());
|
|
|
1471
|
+ if (grandParentDept.getParentId() != null && grandParentDept.getParentId() != 0) {
|
|
|
1472
|
+ SysDept greatGrandParentDept = importCache.getDeptById(grandParentDept.getParentId());
|
|
|
1473
|
+ if (greatGrandParentDept != null) {
|
|
|
1474
|
+ result.put("stationId", greatGrandParentDept.getDeptId());
|
|
|
1475
|
+ result.put("stationName", greatGrandParentDept.getDeptName());
|
|
|
1476
|
+ }
|
|
|
1477
|
+ }
|
|
1475
|
1478
|
}
|
|
1476
|
1479
|
}
|
|
1477
|
1480
|
}
|