|
@@ -346,12 +346,18 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
|
|
|
public R startReport(StartRePortReq req) {
|
|
|
|
|
|
SysUserVo currentUser = CXCommonUtils.getCurrentUser();
|
|
|
- if (startWorkLock.containsKey(req.getUseDeviceId())) {
|
|
|
- log.error("该作业已被:{}开工", startWorkLock.get(req.getUseDeviceId()));
|
|
|
- return R.error("该作业已被开工");
|
|
|
- }
|
|
|
- startWorkLock.put(req.getUseDeviceId(), currentUser.getId());
|
|
|
+// if (startWorkLock.containsKey(req.getUseDeviceId())) {
|
|
|
+// log.error("该作业已被:{}开工", startWorkLock.get(req.getUseDeviceId()));
|
|
|
+// return R.error("该作业已被开工");
|
|
|
+// }
|
|
|
+// startWorkLock.put(req.getUseDeviceId(), currentUser.getId());
|
|
|
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());
|
|
@@ -940,13 +946,18 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
|
|
|
ApsReportRecordsDo apsReportRecordsDo = req.getApsReportRecordsDo();
|
|
|
|
|
|
SysUserVo currentUser = CXCommonUtils.getCurrentUser();
|
|
|
- if (reportWorkLock.containsKey(apsReportRecordsDo.getId())) {
|
|
|
- log.error("该作业已被:{}报工", reportWorkLock.get(apsReportRecordsDo.getId()));
|
|
|
- return R.error("该作业已被报工");
|
|
|
- }
|
|
|
- reportWorkLock.put(apsReportRecordsDo.getId(), currentUser.getId());
|
|
|
+// if (reportWorkLock.containsKey(apsReportRecordsDo.getId())) {
|
|
|
+// log.error("该作业已被:{}报工", reportWorkLock.get(apsReportRecordsDo.getId()));
|
|
|
+// return R.error("该作业已被报工");
|
|
|
+// }
|
|
|
+// reportWorkLock.put(apsReportRecordsDo.getId(), currentUser.getId());
|
|
|
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());
|
|
@@ -1615,13 +1626,18 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
|
|
|
}
|
|
|
|
|
|
SysUserVo currentUser = CXCommonUtils.getCurrentUser();
|
|
|
- if (startWorkLock.containsKey(req.getUseDeviceId())) {
|
|
|
- log.error("该小卷作业已被:{}开工", startWorkLock.get(req.getUseDeviceId()));
|
|
|
- return R.error("该作业已被开工");
|
|
|
- }
|
|
|
- startWorkLock.put(req.getUseDeviceId(), currentUser.getId());
|
|
|
+// if (startWorkLock.containsKey(req.getUseDeviceId())) {
|
|
|
+// log.error("该小卷作业已被:{}开工", startWorkLock.get(req.getUseDeviceId()));
|
|
|
+// return R.error("该作业已被开工");
|
|
|
+// }
|
|
|
+// startWorkLock.put(req.getUseDeviceId(), currentUser.getId());
|
|
|
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查询设备
|