|
@@ -107,6 +107,7 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
public Future<String> computeMaintenanceData(Date todayDate, ProjectDTO projectDTO, CountDownLatch latch) throws Exception {
|
|
|
long time = System.currentTimeMillis() + (20 * 1000);
|
|
|
try {
|
|
|
+ SaasContext.setContextGroupCode(projectDTO.getGroupCode());
|
|
|
if (!lockUtil.lock(projectDTO.getProjectId() + "_computeMaintenance", String.valueOf(time))) {
|
|
|
// 获取不到锁,略过
|
|
|
return new AsyncResult<>("【监测维保数据计算线程】项目:" + projectDTO.getProjectId() + "被占用");
|
|
@@ -131,6 +132,7 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
public Future<String> sendMaintenanceData(Date todayDate,ProjectDTO projectDTO, CountDownLatch latch) throws Exception {
|
|
|
long time = System.currentTimeMillis() + (20 * 1000);
|
|
|
try {
|
|
|
+ SaasContext.setContextGroupCode(projectDTO.getGroupCode());
|
|
|
if (!lockUtil.lock(projectDTO.getProjectId() + "_sendMaintenance", String.valueOf(time))) {
|
|
|
// 获取不到锁,略过
|
|
|
return new AsyncResult<>("【监测维保数据推送线程】:项目:" + projectDTO.getProjectId() + "被占用");
|
|
@@ -147,19 +149,20 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
|
|
|
@Override
|
|
|
@Async("asyncGoingDestroyEquipExecutor")
|
|
|
- public Future<String> syncGoingDestroyEquip(String projectId, CountDownLatch latch) {
|
|
|
+ public Future<String> syncGoingDestroyEquip(ProjectDTO projectDTO, CountDownLatch latch) {
|
|
|
long time = System.currentTimeMillis() + (20 * 1000);
|
|
|
try {
|
|
|
- if (!lockUtil.lock(projectId + "_syncEquip", String.valueOf(time))) {
|
|
|
+ SaasContext.setContextGroupCode(projectDTO.getGroupCode());
|
|
|
+ if (!lockUtil.lock(projectDTO.getProjectId() + "_syncEquip", String.valueOf(time))) {
|
|
|
// 获取不到锁,略过
|
|
|
- return new AsyncResult<>("【监测同步即将报废设备线程】:项目:" + projectId + "被占用");
|
|
|
+ return new AsyncResult<>("【监测同步即将报废设备线程】:项目:" + projectDTO.getProjectId() + "被占用");
|
|
|
}
|
|
|
long start = System.currentTimeMillis();
|
|
|
- syncProjectGoingDestroyEquip(projectId);
|
|
|
+ syncProjectGoingDestroyEquip(projectDTO);
|
|
|
long end = System.currentTimeMillis();
|
|
|
- return new AsyncResult<>("【监测同步即将报废设备线程】同步项目即将报废设备用时:" + projectId + ";" + (end - start));
|
|
|
+ return new AsyncResult<>("【监测同步即将报废设备线程】同步项目即将报废设备用时:" + projectDTO.getProjectId() + ";" + (end - start));
|
|
|
} finally {
|
|
|
- lockUtil.unlock(projectId + "_syncEquip", String.valueOf(time));
|
|
|
+ lockUtil.unlock(projectDTO.getProjectId() + "_syncEquip", String.valueOf(time));
|
|
|
latch.countDown();
|
|
|
}
|
|
|
}
|
|
@@ -167,8 +170,10 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
/**
|
|
|
* 同步即将报废设备 更新更换设备报警信息
|
|
|
*/
|
|
|
- private void syncProjectGoingDestroyEquip(String projectId) {
|
|
|
+ private void syncProjectGoingDestroyEquip(ProjectDTO projectDTO) {
|
|
|
try {
|
|
|
+ SaasContext.setContextGroupCode(projectDTO.getGroupCode());
|
|
|
+ String projectId = projectDTO.getProjectId();
|
|
|
//获取该项目的更换设备类型的 报警集合
|
|
|
Map<String, AlarmRecordItem> alarmRecordItemMap = getAlarmRecordItemMap(projectId);
|
|
|
List<String> alarmEquipList = new ArrayList<>(alarmRecordItemMap.keySet());
|
|
@@ -269,6 +274,7 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
* 推送维保数据
|
|
|
*/
|
|
|
private void sendProjectMaintenanceData(Date todayDate,ProjectDTO projectDTO) throws Exception {
|
|
|
+ SaasContext.setContextGroupCode(projectDTO.getGroupCode());
|
|
|
List<String> itemCodeList = new ArrayList<>();
|
|
|
itemCodeList.add(EnumAlarmItem.CondAbnormal.getCode());
|
|
|
itemCodeList.add(EnumAlarmItem.EvapAbnormal.getCode());
|
|
@@ -401,6 +407,7 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
*/
|
|
|
private AsyncResult<String> computeProjectMaintenanceData(Date todayDate, ProjectDTO projectDTO) {
|
|
|
try {
|
|
|
+ SaasContext.setContextGroupCode(projectDTO.getGroupCode());
|
|
|
//通过报警服务查询报警规则
|
|
|
List<String> itemCodeList = new ArrayList<>();
|
|
|
itemCodeList.add(EnumAlarmItem.CondAbnormal.getCode());
|