|
@@ -49,6 +49,7 @@ import com.zd.model.entity.InventoryTag;
|
|
|
import com.zd.model.entity.SysUser;
|
|
import com.zd.model.entity.SysUser;
|
|
|
import com.zd.system.api.entity.SysDictData;
|
|
import com.zd.system.api.entity.SysDictData;
|
|
|
import com.zd.system.api.feign.RemoteUserService;
|
|
import com.zd.system.api.feign.RemoteUserService;
|
|
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -476,7 +477,13 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
logger.info("化学品违规带离发送短信打电话消息推送完成!");
|
|
logger.info("化学品违规带离发送短信打电话消息推送完成!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ //声光报警
|
|
|
if (hardwareRfidDto != null && illegalRemoval.contains("3")) {
|
|
if (hardwareRfidDto != null && illegalRemoval.contains("3")) {
|
|
|
|
|
+ List<Map<String, Object>> terminalList = hxpSmartTerminalMapper.selectTerminalBySubId(8, hxpStock.getSubId());
|
|
|
|
|
+ Map<String, Object> smartTerminal = terminalList.get(0);
|
|
|
|
|
+ String terminalNum = String.valueOf(smartTerminal.get("hardwareNum"));
|
|
|
|
|
+ //Integer dealTime = (Integer) smartTerminal.get("dealTime");
|
|
|
|
|
+ terminalList.get(0).get("ringTime");
|
|
|
ResultData<LabHardwareDto> hardwareByType = remoteLabHardwareService.findHardwareByType(hxpStock.getSubId(), 8, null, null);
|
|
ResultData<LabHardwareDto> hardwareByType = remoteLabHardwareService.findHardwareByType(hxpStock.getSubId(), 8, null, null);
|
|
|
if (HttpStatus.SUCCESS == hardwareByType.getCode()) {
|
|
if (HttpStatus.SUCCESS == hardwareByType.getCode()) {
|
|
|
warningNoticeLogDto.setId(logId);
|
|
warningNoticeLogDto.setId(logId);
|
|
@@ -484,12 +491,60 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
remoteLaboratoryService.updateWarningNoticeLog(warningNoticeLogDto);
|
|
remoteLaboratoryService.updateWarningNoticeLog(warningNoticeLogDto);
|
|
|
Long id = hardwareByType.getData().getId();
|
|
Long id = hardwareByType.getData().getId();
|
|
|
remoteLaboratoryService.controlDevice(id, 1);
|
|
remoteLaboratoryService.controlDevice(id, 1);
|
|
|
|
|
+
|
|
|
|
|
+ // 默认一个实验室只触发一个报警器
|
|
|
|
|
+ HxpAlarmRecord hxpAlarmRecord = new HxpAlarmRecord();
|
|
|
|
|
+ hxpAlarmRecord.setAlarmContent(text);
|
|
|
|
|
+ hxpAlarmRecord.setAlarmType(2);
|
|
|
|
|
+ hxpAlarmRecord.setHasValid(1);
|
|
|
|
|
+ hxpAlarmRecord.setAlarmMode(2);
|
|
|
|
|
+ hxpAlarmRecord.setAlarmTime(DateUtils.getNowDate());
|
|
|
|
|
+ hxpAlarmRecord.setSubId(hxpStock.getSubId());
|
|
|
|
|
+ hxpAlarmRecord.setTerminalNum(terminalNum == null ? tag.getSerialNumber() : terminalNum);
|
|
|
|
|
+ hxpAlarmRecord.setHandlingStatus(1);
|
|
|
|
|
+ // TODO 请在此处新增图片路径字段并使用 fileR 中的返回值url作为图片路径以供前端调用,具体实现方式可参考 com.zd.bottle.service.impl.AlarmRecordServiceImpl.remoteAdd#155 行代码,默认配置为空,具体配置可参考zd-bottle-dev.yml#113行到115行
|
|
|
|
|
+ hxpAlarmRecordMapper.insertHxpAlarmRecord(hxpAlarmRecord);
|
|
|
|
|
+ Long recordId = hxpAlarmRecord.getId();
|
|
|
scheduledExecutorService.schedule(new TimerTask() {
|
|
scheduledExecutorService.schedule(new TimerTask() {
|
|
|
@Override
|
|
@Override
|
|
|
public void run() {
|
|
public void run() {
|
|
|
remoteLaboratoryService.controlDevice(id, 0);
|
|
remoteLaboratoryService.controlDevice(id, 0);
|
|
|
|
|
+ // 自动处理声光报警状态
|
|
|
|
|
+ HxpAlarmRecord hxpAlarmRecord1 = new HxpAlarmRecord();
|
|
|
|
|
+ hxpAlarmRecord1.setId(recordId);
|
|
|
|
|
+ hxpAlarmRecord1.setHandlingStatus(2);
|
|
|
|
|
+ hxpAlarmRecord1.setHandlingTime(DateUtils.getNowDate());
|
|
|
|
|
+ hxpAlarmRecord1.setHandlingUserId(-2L);
|
|
|
|
|
+ hxpAlarmRecordMapper.updateHxpAlarmRecord(hxpAlarmRecord1);
|
|
|
}
|
|
}
|
|
|
- }, 30, TimeUnit.SECONDS);
|
|
|
|
|
|
|
+ }, Long.parseLong(terminalList.get(0).get("ringTime") + ""), TimeUnit.SECONDS);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 需求变动内容:未领用即携带化学品离开房间报警时,如实验室安全责任人通过化学品终端或PC管理后台操作处理,状态更改为已处理,报警流程终止
|
|
|
|
|
+ // 保证逻辑严谨,数据必须进行强关联
|
|
|
|
|
+ // 1.查询标签所属实验室院系报警配置流程处理
|
|
|
|
|
+ // 查询电话通知配置
|
|
|
|
|
+ List<HxpAlarmConfig> hxpAlarmConfigList = hxpAlarmConfigMapper.selectBySubId(4, hxpStock.getSubId());
|
|
|
|
|
+ // 2.最多五个步骤分别执行
|
|
|
|
|
+ if(CollectionUtils.isNotEmpty(hxpAlarmConfigList)){
|
|
|
|
|
+ logger.info("执行用户电话通知!");
|
|
|
|
|
+ DateTime date = DateUtil.date();
|
|
|
|
|
+ for (HxpAlarmConfig hxpAlarmConfig : hxpAlarmConfigList) {
|
|
|
|
|
+ date = DateUtil.offsetMinute(date, Optional.ofNullable(hxpAlarmConfig.getTimeInterval()).orElse(1));
|
|
|
|
|
+ HxpAlarmRecord hxpAlarmRecord = new HxpAlarmRecord();
|
|
|
|
|
+ hxpAlarmRecord.setAlarmContent(text);
|
|
|
|
|
+ hxpAlarmRecord.setAlarmType(2);
|
|
|
|
|
+ hxpAlarmRecord.setAlarmMode(4);
|
|
|
|
|
+ hxpAlarmRecord.setHasValid(0);
|
|
|
|
|
+ hxpAlarmRecord.setAlarmTime(date);
|
|
|
|
|
+ hxpAlarmRecord.setSubId(hxpStock.getSubId());
|
|
|
|
|
+ hxpAlarmRecord.setStockId(hxpStock.getId());
|
|
|
|
|
+ //hxpAlarmRecord.setParentId(recordId);
|
|
|
|
|
+ //hxpAlarmRecord.setTerminalNum();
|
|
|
|
|
+ hxpAlarmRecord.setHandlingStatus(1);
|
|
|
|
|
+ hxpAlarmRecord.setLiableUserIds(hxpAlarmConfig.getAlarmPhone());
|
|
|
|
|
+ hxpAlarmRecordMapper.insertHxpAlarmRecord(hxpAlarmRecord);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -971,6 +1026,7 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
* @Return void
|
|
* @Return void
|
|
|
**/
|
|
**/
|
|
|
// @Scheduled(cron = "0 0 0 * * ?")
|
|
// @Scheduled(cron = "0 0 0 * * ?")
|
|
|
|
|
+// @Scheduled(cron = "0 0/5 * * * ?")
|
|
|
public void hxpTimeOut() {
|
|
public void hxpTimeOut() {
|
|
|
logger.info("化学品超时未归还定时任务!");
|
|
logger.info("化学品超时未归还定时任务!");
|
|
|
// 查询配置
|
|
// 查询配置
|
|
@@ -1070,6 +1126,75 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
logger.info("化学品超时未归还发送短信打电话消息推送完成!");
|
|
logger.info("化学品超时未归还发送短信打电话消息推送完成!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ //声光报警
|
|
|
|
|
+ if (timeout.contains("3")) {
|
|
|
|
|
+ List<Map<String, Object>> terminalList = hxpSmartTerminalMapper.selectTerminalBySubId(8, hxpStock.getSubId());
|
|
|
|
|
+ Map<String, Object> smartTerminal = terminalList.get(0);
|
|
|
|
|
+ String terminalNum = String.valueOf(smartTerminal.get("hardwareNum"));
|
|
|
|
|
+ //Integer dealTime = (Integer) smartTerminal.get("dealTime");
|
|
|
|
|
+ terminalList.get(0).get("ringTime");
|
|
|
|
|
+ ResultData<LabHardwareDto> hardwareByType = remoteLabHardwareService.findHardwareByType(hxpStock.getSubId(), 8, null, null);
|
|
|
|
|
+ if (HttpStatus.SUCCESS == hardwareByType.getCode()) {
|
|
|
|
|
+ warningNoticeLogDto.setId(logId);
|
|
|
|
|
+ warningNoticeLogDto.setVoiceBroadcast(1);
|
|
|
|
|
+ remoteLaboratoryService.updateWarningNoticeLog(warningNoticeLogDto);
|
|
|
|
|
+ Long id = hardwareByType.getData().getId();
|
|
|
|
|
+ remoteLaboratoryService.controlDevice(id, 1);
|
|
|
|
|
+
|
|
|
|
|
+ // 默认一个实验室只触发一个报警器
|
|
|
|
|
+ HxpAlarmRecord hxpAlarmRecord = new HxpAlarmRecord();
|
|
|
|
|
+ hxpAlarmRecord.setAlarmContent(text);
|
|
|
|
|
+ hxpAlarmRecord.setAlarmType(2);
|
|
|
|
|
+ hxpAlarmRecord.setHasValid(1);
|
|
|
|
|
+ hxpAlarmRecord.setAlarmMode(2);
|
|
|
|
|
+ hxpAlarmRecord.setAlarmTime(DateUtils.getNowDate());
|
|
|
|
|
+ hxpAlarmRecord.setSubId(hxpStock.getSubId());
|
|
|
|
|
+ hxpAlarmRecord.setTerminalNum(terminalNum);
|
|
|
|
|
+ hxpAlarmRecord.setHandlingStatus(1);
|
|
|
|
|
+ hxpAlarmRecordMapper.insertHxpAlarmRecord(hxpAlarmRecord);
|
|
|
|
|
+ Long recordId = hxpAlarmRecord.getId();
|
|
|
|
|
+ scheduledExecutorService.schedule(new TimerTask() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void run() {
|
|
|
|
|
+ remoteLaboratoryService.controlDevice(id, 0);
|
|
|
|
|
+ // 自动处理声光报警状态
|
|
|
|
|
+ HxpAlarmRecord hxpAlarmRecord1 = new HxpAlarmRecord();
|
|
|
|
|
+ hxpAlarmRecord1.setId(recordId);
|
|
|
|
|
+ hxpAlarmRecord1.setHandlingStatus(2);
|
|
|
|
|
+ hxpAlarmRecord1.setHandlingTime(DateUtils.getNowDate());
|
|
|
|
|
+ hxpAlarmRecord1.setHandlingUserId(-2L);
|
|
|
|
|
+ hxpAlarmRecordMapper.updateHxpAlarmRecord(hxpAlarmRecord1);
|
|
|
|
|
+ }
|
|
|
|
|
+ }, Long.parseLong(terminalList.get(0).get("ringTime") + ""), TimeUnit.SECONDS);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 需求变动内容:未领用即携带化学品离开房间报警时,如实验室安全责任人通过化学品终端或PC管理后台操作处理,状态更改为已处理,报警流程终止
|
|
|
|
|
+ // 保证逻辑严谨,数据必须进行强关联
|
|
|
|
|
+ // 1.查询标签所属实验室院系报警配置流程处理
|
|
|
|
|
+ // 查询电话通知配置
|
|
|
|
|
+ List<HxpAlarmConfig> hxpAlarmConfigList = hxpAlarmConfigMapper.selectBySubId(4, hxpStock.getSubId());
|
|
|
|
|
+ // 2.最多五个步骤分别执行
|
|
|
|
|
+ if(CollectionUtils.isNotEmpty(hxpAlarmConfigList)){
|
|
|
|
|
+ logger.info("执行用户电话通知!");
|
|
|
|
|
+ DateTime date = DateUtil.date();
|
|
|
|
|
+ for (HxpAlarmConfig hxpAlarmConfig : hxpAlarmConfigList) {
|
|
|
|
|
+ date = DateUtil.offsetMinute(date, Optional.ofNullable(hxpAlarmConfig.getTimeInterval()).orElse(1));
|
|
|
|
|
+ HxpAlarmRecord hxpAlarmRecord = new HxpAlarmRecord();
|
|
|
|
|
+ hxpAlarmRecord.setAlarmContent(text);
|
|
|
|
|
+ hxpAlarmRecord.setAlarmType(2);
|
|
|
|
|
+ hxpAlarmRecord.setAlarmMode(4);
|
|
|
|
|
+ hxpAlarmRecord.setHasValid(0);
|
|
|
|
|
+ hxpAlarmRecord.setAlarmTime(date);
|
|
|
|
|
+ hxpAlarmRecord.setSubId(hxpStock.getSubId());
|
|
|
|
|
+ hxpAlarmRecord.setStockId(hxpStock.getId());
|
|
|
|
|
+ //hxpAlarmRecord.setParentId(recordId);
|
|
|
|
|
+ //hxpAlarmRecord.setTerminalNum();
|
|
|
|
|
+ hxpAlarmRecord.setHandlingStatus(1);
|
|
|
|
|
+ hxpAlarmRecord.setLiableUserIds(hxpAlarmConfig.getAlarmPhone());
|
|
|
|
|
+ hxpAlarmRecordMapper.insertHxpAlarmRecord(hxpAlarmRecord);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
hxpUserecordMapper.updateUserecordOvertimeByIds(hxpIds);
|
|
hxpUserecordMapper.updateUserecordOvertimeByIds(hxpIds);
|