|
|
@@ -4,10 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
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.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.vo.AlarmRecordVo;
|
|
|
import com.zd.bottle.vo.BottleStorageVo;
|
|
|
import com.zd.common.core.constant.HttpStatus;
|
|
|
@@ -69,6 +71,11 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
|
|
@Resource
|
|
|
private RemoteSubQueryService remoteSubQueryService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private RfidTagService tagService;
|
|
|
+
|
|
|
+ private static final String MSG_MATCH="==================>{},{}";
|
|
|
+
|
|
|
@Override
|
|
|
public void getRecordInfo(List<AlarmRecordVo> recordVos) {
|
|
|
List<Long> masterIds = recordVos.stream().filter(alarmRecordVo -> alarmRecordVo.getProductType() == 1).map(AlarmRecordVo::getMasterId).collect(Collectors.toList());
|
|
|
@@ -105,15 +112,21 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
|
|
public boolean remoteAdd(InventoryTag tag) {
|
|
|
String electronicTag = tag.getEpc();
|
|
|
RemoteLabHardware hardware = tag.getRemoteLabHardware();
|
|
|
- LambdaQueryWrapper<BottleStorage> queryWrapper = Wrappers.lambdaQuery(BottleStorage.class);
|
|
|
- queryWrapper.eq(BottleStorage::getElectronicTag,electronicTag);
|
|
|
-
|
|
|
- BottleStorage bottleStorage = storageService.getOne(queryWrapper);
|
|
|
+ LambdaQueryWrapper<RfidTag> queryWrapper = Wrappers.lambdaQuery(RfidTag.class);
|
|
|
+ queryWrapper.eq(RfidTag::getTagCode,electronicTag);
|
|
|
+ RfidTag rfidTag = tagService.getOne(queryWrapper);
|
|
|
+ if (rfidTag==null){
|
|
|
+ log.info(MSG_MATCH,electronicTag,"标签未录入");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<BottleStorage> wrapper = Wrappers.lambdaQuery(BottleStorage.class);
|
|
|
+ wrapper.eq(BottleStorage::getElectronicTag,rfidTag.getId());
|
|
|
+ BottleStorage bottleStorage = storageService.getOne(wrapper);
|
|
|
if (bottleStorage != null) {
|
|
|
if (hardware!=null){
|
|
|
//RFID设备报警
|
|
|
R<Boolean> alarm = remoteNettyService.alarm(hardware);
|
|
|
- log.info("==================>{},{}",alarm.getCode(),alarm.getMsg());
|
|
|
+ log.info(MSG_MATCH,alarm.getCode(),alarm.getMsg());
|
|
|
}
|
|
|
Long id = bottleStorage.getId();
|
|
|
String key = FRID_CODE + electronicTag + id;
|
|
|
@@ -133,7 +146,7 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
|
|
return save(alarmRecord);
|
|
|
}else {
|
|
|
if (hardware!=null){
|
|
|
- log.info("==================>{},{}",electronicTag,"标签无数据");
|
|
|
+ log.info(MSG_MATCH,electronicTag,"标签未绑定气瓶");
|
|
|
}
|
|
|
return false;
|
|
|
}
|