|
|
@@ -5,11 +5,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.zd.bottle.domain.AlarmRecord;
|
|
|
import com.zd.bottle.domain.BottleStorage;
|
|
|
import com.zd.bottle.domain.RfidTag;
|
|
|
+import com.zd.bottle.domain.UsegasApply;
|
|
|
import com.zd.bottle.mapper.AlarmRecordMapper;
|
|
|
import com.zd.bottle.service.AlarmRecordService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.zd.bottle.service.BottleStorageService;
|
|
|
import com.zd.bottle.service.RfidTagService;
|
|
|
+import com.zd.bottle.service.UsegasApplyService;
|
|
|
import com.zd.bottle.vo.AlarmRecordVo;
|
|
|
import com.zd.bottle.vo.BottleStorageVo;
|
|
|
import com.zd.common.core.constant.HttpStatus;
|
|
|
@@ -74,6 +76,9 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
|
|
@Resource
|
|
|
private RfidTagService tagService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private UsegasApplyService applyService;
|
|
|
+
|
|
|
private static final String MSG_MATCH = "==================>{},{}";
|
|
|
|
|
|
@Override
|
|
|
@@ -119,29 +124,36 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
|
|
wrapper.eq(BottleStorage::getElectronicTag, rfidTag.getId());
|
|
|
BottleStorage bottleStorage = storageService.getOne(wrapper);
|
|
|
if (bottleStorage != null) {
|
|
|
- Long id = bottleStorage.getId();
|
|
|
- String key = FRID_CODE + electronicTag + id;
|
|
|
- String frid = redisService.getCacheObject(key);
|
|
|
- if (frid != null) {
|
|
|
- return true;
|
|
|
+ String airName = bottleStorage.getAirName();
|
|
|
+ LambdaQueryWrapper<UsegasApply> lambdaQuery = Wrappers.lambdaQuery(UsegasApply.class);
|
|
|
+ lambdaQuery.eq(UsegasApply::getUseGasName,airName)
|
|
|
+ .eq(UsegasApply::getEndTime,Calendar.getInstance().getTime()).eq(UsegasApply::getLeadAuditStaus,1);
|
|
|
+ List<UsegasApply> applies = applyService.list(lambdaQuery);
|
|
|
+ if (applies.isEmpty()){
|
|
|
+ Long id = bottleStorage.getId();
|
|
|
+ String key = FRID_CODE + electronicTag + id;
|
|
|
+ String frid = redisService.getCacheObject(key);
|
|
|
+ if (frid != null) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ // 发送报警消息
|
|
|
+ sendAlarm(bottleStorage);
|
|
|
+ redisService.setCacheObject(key, electronicTag, 300L, TimeUnit.SECONDS);
|
|
|
+ AlarmRecord alarmRecord = new AlarmRecord();
|
|
|
+ alarmRecord.setElectronicTag(electronicTag)
|
|
|
+ .setAlarmTime(Calendar.getInstance().getTime())
|
|
|
+ .setMasterId(id)
|
|
|
+ .setType(1)
|
|
|
+ .setProductType(1)
|
|
|
+ .setDeptId(bottleStorage.getDeptId());
|
|
|
+ return save(alarmRecord);
|
|
|
}
|
|
|
- // 发送报警消息
|
|
|
- sendAlarm(bottleStorage);
|
|
|
- redisService.setCacheObject(key, electronicTag, 300L, TimeUnit.SECONDS);
|
|
|
- AlarmRecord alarmRecord = new AlarmRecord();
|
|
|
- alarmRecord.setElectronicTag(electronicTag)
|
|
|
- .setAlarmTime(Calendar.getInstance().getTime())
|
|
|
- .setMasterId(id)
|
|
|
- .setType(1)
|
|
|
- .setProductType(1)
|
|
|
- .setDeptId(bottleStorage.getDeptId());
|
|
|
- return save(alarmRecord);
|
|
|
} else {
|
|
|
if (hardware != null) {
|
|
|
log.info(MSG_MATCH, electronicTag, "标签未绑定气瓶");
|
|
|
}
|
|
|
- return false;
|
|
|
}
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
private void sendAlarm(BottleStorage storage) {
|