|
@@ -355,14 +355,13 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
|
|
|
// return R.error("该作业已被开工");
|
|
|
// }
|
|
|
// startWorkLock.put(req.getUseDeviceId(), currentUser.getId());
|
|
|
+ // 使用 putIfAbsent 实现原子性的检查+放入操作
|
|
|
+ String existingUser = startWorkLock.putIfAbsent(req.getUseDeviceId(), currentUser.getId());
|
|
|
+ if (existingUser != null) {
|
|
|
+ log.error("该作业已被:{}开工", existingUser);
|
|
|
+ return R.error("该作业已被开工");
|
|
|
+ }
|
|
|
try {
|
|
|
- // 使用 putIfAbsent 实现原子性的检查+放入操作
|
|
|
- String existingUser = startWorkLock.putIfAbsent(req.getUseDeviceId(), currentUser.getId());
|
|
|
- if (existingUser != null) {
|
|
|
- log.error("该作业已被:{}开工", existingUser);
|
|
|
- return R.error("该作业已被开工");
|
|
|
- }
|
|
|
-
|
|
|
//根据作业明细ID查询作业明细详情
|
|
|
ApsProcessOperationProcessEquDo apsProcessOperationProcessEquDo = apsProcessOperationProcessEquService.getById(req.getUseDeviceId());
|
|
|
//根据加工设备ID查询设备
|
|
@@ -955,14 +954,13 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
|
|
|
// return R.error("该作业已被报工");
|
|
|
// }
|
|
|
// reportWorkLock.put(apsReportRecordsDo.getId(), currentUser.getId());
|
|
|
+ // 使用 putIfAbsent 实现原子性的检查+放入操作
|
|
|
+ String existingUser = reportWorkLock.putIfAbsent(apsReportRecordsDo.getId(), currentUser.getId());
|
|
|
+ if (existingUser != null) {
|
|
|
+ log.error("该作业已被:{}报工", existingUser);
|
|
|
+ return R.error("该作业已被报工");
|
|
|
+ }
|
|
|
try {
|
|
|
- // 使用 putIfAbsent 实现原子性的检查+放入操作
|
|
|
- String existingUser = reportWorkLock.putIfAbsent(apsReportRecordsDo.getId(), currentUser.getId());
|
|
|
- if (existingUser != null) {
|
|
|
- log.error("该作业已被:{}报工", existingUser);
|
|
|
- return R.error("该作业已被报工");
|
|
|
- }
|
|
|
-
|
|
|
//防止同时报工
|
|
|
ApsReportRecordsDo recordsDo = this.getById(apsReportRecordsDo.getId());
|
|
|
if (ObjectUtil.isEmpty(recordsDo) || !recordsDo.getReportworkstatus().equals("已开工")) {
|
|
@@ -1635,13 +1633,13 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
|
|
|
// return R.error("该作业已被开工");
|
|
|
// }
|
|
|
// startWorkLock.put(req.getUseDeviceId(), currentUser.getId());
|
|
|
+ // 使用 putIfAbsent 实现原子性的检查+放入操作
|
|
|
+ String existingUser = startWorkLock.putIfAbsent(req.getUseDeviceId(), currentUser.getId());
|
|
|
+ if (existingUser != null) {
|
|
|
+ log.error("该小卷作业已被:{}开工", existingUser);
|
|
|
+ return R.error("该作业已被开工");
|
|
|
+ }
|
|
|
try {
|
|
|
- // 使用 putIfAbsent 实现原子性的检查+放入操作
|
|
|
- String existingUser = startWorkLock.putIfAbsent(req.getUseDeviceId(), currentUser.getId());
|
|
|
- if (existingUser != null) {
|
|
|
- log.error("该小卷作业已被:{}开工", existingUser);
|
|
|
- return R.error("该作业已被开工");
|
|
|
- }
|
|
|
//根据作业明细ID查询作业明细详情
|
|
|
ApsProcessOperationProcessEquDo apsProcessOperationProcessEquDo = apsProcessOperationProcessEquService.getById(req.getUseDeviceId());
|
|
|
//根据加工设备ID查询设备
|