|
1
|
package com.qgutech.qgyun.apaas.sync.cps.service;
|
1
|
package com.qgutech.qgyun.apaas.sync.cps.service;
|
|
2
|
|
2
|
|
|
|
|
3
|
+import com.qgutech.qgyun.apaas.sync.cps.model.*;
|
|
3
|
import com.qgutech.qgyun.framework.database.mybatis.service.BaseServiceImpl;
|
4
|
import com.qgutech.qgyun.framework.database.mybatis.service.BaseServiceImpl;
|
|
4
|
import com.qgutech.qgyun.apaas.sync.base.BoErrorCode;
|
5
|
import com.qgutech.qgyun.apaas.sync.base.BoErrorCode;
|
|
5
|
import com.qgutech.qgyun.apaas.sync.base.BoException;
|
6
|
import com.qgutech.qgyun.apaas.sync.base.BoException;
|
|
@@ -10,13 +11,6 @@ import com.qgutech.qgyun.apaas.sync.cps.enums.GwxzEnum; |
|
@@ -10,13 +11,6 @@ import com.qgutech.qgyun.apaas.sync.cps.enums.GwxzEnum; |
|
10
|
import com.qgutech.qgyun.apaas.sync.cps.enums.PjoExecZtEnum;
|
11
|
import com.qgutech.qgyun.apaas.sync.cps.enums.PjoExecZtEnum;
|
|
11
|
import com.qgutech.qgyun.apaas.sync.cps.enums.ZyczdwtEnum;
|
12
|
import com.qgutech.qgyun.apaas.sync.cps.enums.ZyczdwtEnum;
|
|
12
|
import com.qgutech.qgyun.apaas.sync.cps.mapper.PjoExecMapper;
|
13
|
import com.qgutech.qgyun.apaas.sync.cps.mapper.PjoExecMapper;
|
|
13
|
-import com.qgutech.qgyun.apaas.sync.cps.model.Area;
|
|
|
|
14
|
-import com.qgutech.qgyun.apaas.sync.cps.model.PjoBatch;
|
|
|
|
15
|
-import com.qgutech.qgyun.apaas.sync.cps.model.PjoExec;
|
|
|
|
16
|
-import com.qgutech.qgyun.apaas.sync.cps.model.PjoWorkstationExec;
|
|
|
|
17
|
-import com.qgutech.qgyun.apaas.sync.cps.model.Team;
|
|
|
|
18
|
-import com.qgutech.qgyun.apaas.sync.cps.model.Workshop;
|
|
|
|
19
|
-import com.qgutech.qgyun.apaas.sync.cps.model.XtLine;
|
|
|
|
20
|
import com.qgutech.qgyun.apaas.sync.org.model.UcUser;
|
14
|
import com.qgutech.qgyun.apaas.sync.org.model.UcUser;
|
|
21
|
import com.qgutech.qgyun.apaas.sync.org.service.UcUserService;
|
15
|
import com.qgutech.qgyun.apaas.sync.org.service.UcUserService;
|
|
22
|
import com.qgutech.qgyun.apaas.sync.utils.DateDealUtils;
|
16
|
import com.qgutech.qgyun.apaas.sync.utils.DateDealUtils;
|
|
@@ -45,6 +39,8 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> { |
|
@@ -45,6 +39,8 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> { |
|
45
|
private PjoExecMapper pjoExecMapper;
|
39
|
private PjoExecMapper pjoExecMapper;
|
|
46
|
|
40
|
|
|
47
|
@Resource
|
41
|
@Resource
|
|
|
|
42
|
+ private ShiftService shiftService;
|
|
|
|
43
|
+ @Resource
|
|
48
|
private WorkshopService workshopService;
|
44
|
private WorkshopService workshopService;
|
|
49
|
|
45
|
|
|
50
|
@Resource
|
46
|
@Resource
|
|
@@ -330,6 +326,7 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> { |
|
@@ -330,6 +326,7 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> { |
|
330
|
}
|
326
|
}
|
|
331
|
|
327
|
|
|
332
|
// 3. 收集所有关联实体ID
|
328
|
// 3. 收集所有关联实体ID
|
|
|
|
329
|
+ Set<String> shiftIds = new HashSet<>();
|
|
333
|
Set<String> workshopIds = new HashSet<>();
|
330
|
Set<String> workshopIds = new HashSet<>();
|
|
334
|
Set<String> areaIds = new HashSet<>();
|
331
|
Set<String> areaIds = new HashSet<>();
|
|
335
|
Set<String> teamIds = new HashSet<>();
|
332
|
Set<String> teamIds = new HashSet<>();
|
|
@@ -338,6 +335,7 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> { |
|
@@ -338,6 +335,7 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> { |
|
338
|
Set<String> workstationIds = new HashSet<>();
|
335
|
Set<String> workstationIds = new HashSet<>();
|
|
339
|
Set<String> userIds = new HashSet<>();
|
336
|
Set<String> userIds = new HashSet<>();
|
|
340
|
for (PjoExec item : execList) {
|
337
|
for (PjoExec item : execList) {
|
|
|
|
338
|
+ if (StringUtils.isNotBlank(item.getDrscbc())) shiftIds.add(item.getDrscbc());
|
|
341
|
if (StringUtils.isNotBlank(item.getCj())) workshopIds.add(item.getCj());
|
339
|
if (StringUtils.isNotBlank(item.getCj())) workshopIds.add(item.getCj());
|
|
342
|
if (StringUtils.isNotBlank(item.getQy())) areaIds.add(item.getQy());
|
340
|
if (StringUtils.isNotBlank(item.getQy())) areaIds.add(item.getQy());
|
|
343
|
if (StringUtils.isNotBlank(item.getBz())) teamIds.add(item.getBz());
|
341
|
if (StringUtils.isNotBlank(item.getBz())) teamIds.add(item.getBz());
|
|
@@ -350,6 +348,8 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> { |
|
@@ -350,6 +348,8 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> { |
|
350
|
}
|
348
|
}
|
|
351
|
|
349
|
|
|
352
|
// 4. 批量查询关联实体
|
350
|
// 4. 批量查询关联实体
|
|
|
|
351
|
+ Map<String, Shift> shiftMap = CollectionUtils.isEmpty(shiftIds)
|
|
|
|
352
|
+ ? new HashMap<>(0) : shiftService.mapByIds(shiftIds);
|
|
353
|
Map<String, Workshop> workshopMap = CollectionUtils.isEmpty(workshopIds)
|
353
|
Map<String, Workshop> workshopMap = CollectionUtils.isEmpty(workshopIds)
|
|
354
|
? new HashMap<>(0) : workshopService.mapByIds(workshopIds);
|
354
|
? new HashMap<>(0) : workshopService.mapByIds(workshopIds);
|
|
355
|
Map<String, Area> areaMap = CollectionUtils.isEmpty(areaIds)
|
355
|
Map<String, Area> areaMap = CollectionUtils.isEmpty(areaIds)
|
|
@@ -366,7 +366,7 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> { |
|
@@ -366,7 +366,7 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> { |
|
366
|
? new HashMap<>(0) : ucUserService.mapByIds(userIds);
|
366
|
? new HashMap<>(0) : ucUserService.mapByIds(userIds);
|
|
367
|
|
367
|
|
|
368
|
// 5. 组装明细结果
|
368
|
// 5. 组装明细结果
|
|
369
|
- List<PjoExecDetailDTO> resultList = buildDetailList(execList, workshopMap, areaMap,
|
369
|
+ List<PjoExecDetailDTO> resultList = buildDetailList(execList, shiftMap, workshopMap, areaMap,
|
|
370
|
teamMap, xtLineMap, batchMap, workstationMap, userMap);
|
370
|
teamMap, xtLineMap, batchMap, workstationMap, userMap);
|
|
371
|
|
371
|
|
|
372
|
// 6. 按 PJO 开展日期降序排序,为空的排在最后
|
372
|
// 6. 按 PJO 开展日期降序排序,为空的排在最后
|
|
@@ -379,6 +379,7 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> { |
|
@@ -379,6 +379,7 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> { |
|
379
|
* 组装 PJO 计划执行记录明细 DTO 列表(含枚举名称、关联实体名称、各阶段问题标记)
|
379
|
* 组装 PJO 计划执行记录明细 DTO 列表(含枚举名称、关联实体名称、各阶段问题标记)
|
|
380
|
*/
|
380
|
*/
|
|
381
|
private List<PjoExecDetailDTO> buildDetailList(List<PjoExec> execList,
|
381
|
private List<PjoExecDetailDTO> buildDetailList(List<PjoExec> execList,
|
|
|
|
382
|
+ Map<String, Shift> shiftMap,
|
|
382
|
Map<String, Workshop> workshopMap,
|
383
|
Map<String, Workshop> workshopMap,
|
|
383
|
Map<String, Area> areaMap,
|
384
|
Map<String, Area> areaMap,
|
|
384
|
Map<String, Team> teamMap,
|
385
|
Map<String, Team> teamMap,
|
|
@@ -444,6 +445,14 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> { |
|
@@ -444,6 +445,14 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> { |
|
444
|
dto.setGwzx2Code(ws.getGwbh());
|
445
|
dto.setGwzx2Code(ws.getGwbh());
|
|
445
|
}
|
446
|
}
|
|
446
|
}
|
447
|
}
|
|
|
|
448
|
+ // 班次
|
|
|
|
449
|
+ if (item.getDrscbc() != null) {
|
|
|
|
450
|
+ Shift shift = shiftMap.get(item.getDrscbc());
|
|
|
|
451
|
+ if (shift != null) {
|
|
|
|
452
|
+ dto.setDrscbcName(shift.getBcmc());
|
|
|
|
453
|
+ dto.setDrscbcCode(shift.getBcbh());
|
|
|
|
454
|
+ }
|
|
|
|
455
|
+ }
|
|
447
|
// 车间
|
456
|
// 车间
|
|
448
|
if (item.getCj() != null) {
|
457
|
if (item.getCj() != null) {
|
|
449
|
Workshop workshop = workshopMap.get(item.getCj());
|
458
|
Workshop workshop = workshopMap.get(item.getCj());
|