bug修复
This commit is contained in:
parent
452e24f83f
commit
97d67712b7
@ -3,11 +3,14 @@ package com.zhgd.xmgl.async;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.mqtt.bean.PushPayload;
|
||||
import com.zhgd.mqtt.server.IMqttSender;
|
||||
import com.zhgd.xmgl.modules.basicdata.constant.DictionaryConstant;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.CompanyConfig;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.DictionaryItem;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ICompanyConfigService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.impl.DictionaryItemServiceImpl;
|
||||
import com.zhgd.xmgl.modules.video.entity.AiAnalyseHardWareAlarmRecord;
|
||||
import com.zhgd.xmgl.push.service.UniPushService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -16,7 +19,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -38,6 +44,8 @@ public class AsyncAiAnalyse {
|
||||
private ICompanyConfigService companyConfigService;
|
||||
@Autowired
|
||||
private UniPushService uniPushService;
|
||||
@Autowired
|
||||
private DictionaryItemServiceImpl dictionaryItemService;
|
||||
|
||||
@Value("${mqtt-scope}")
|
||||
private String scope;
|
||||
@ -47,8 +55,8 @@ public class AsyncAiAnalyse {
|
||||
try {
|
||||
String title = getTitleByAlarmType(aiAnalyseHardWareAlarmRecord.getAlarmType());
|
||||
String msg = title + ",位置" + aiAnalyseHardWareAlarmRecord.getLocation();
|
||||
List<SystemUser> systemUserList = systemUserService.list(Wrappers.<SystemUser>lambdaQuery().eq(SystemUser::getSn, aiAnalyseHardWareAlarmRecord.getProjectSn()).eq(SystemUser::getAccountType, 5));
|
||||
// List<SystemUser> systemUserList=systemUserMapper.selectProjectSystemUserList(aiAnalyseHardWareAlarmRecord.getProjectSn());
|
||||
List<SystemUser> systemUserList = systemUserService.list(Wrappers.<SystemUser>lambdaQuery().eq(SystemUser::getSn, aiAnalyseHardWareAlarmRecord.getProjectSn())
|
||||
.in(SystemUser::getAccountType, Arrays.asList(5, 6)));
|
||||
title = "AI分析" + title;
|
||||
//向项目管理员和子账号推送通知
|
||||
if (systemUserList.size() > 0) {
|
||||
@ -70,36 +78,8 @@ public class AsyncAiAnalyse {
|
||||
}
|
||||
|
||||
public String getTitleByAlarmType(Integer alarmType) {
|
||||
//1-烟感、2-明火、3-人员倒地、4-未戴安全帽、5-区域入侵、6-越界入侵、7-人员聚集衣 8-反光衣、9-裸土覆盖,13口罩识别,14徘徊预警,15物体滞留监测,16绊线监测
|
||||
String title = "";
|
||||
if (alarmType == 1) {
|
||||
title = "烟感报警";
|
||||
} else if (alarmType == 2) {
|
||||
title = "明火报警";
|
||||
} else if (alarmType == 3) {
|
||||
title = "人员倒地报警";
|
||||
} else if (alarmType == 4) {
|
||||
title = "未戴安全帽报警";
|
||||
} else if (alarmType == 5) {
|
||||
title = "区域入侵报警";
|
||||
} else if (alarmType == 6) {
|
||||
title = "越界入侵报警";
|
||||
} else if (alarmType == 7) {
|
||||
title = "人员聚集衣报警";
|
||||
} else if (alarmType == 8) {
|
||||
title = "反光衣报警";
|
||||
} else if (alarmType == 9) {
|
||||
title = "裸土覆盖报警";
|
||||
} else if (alarmType == 13) {
|
||||
title = "口罩识别报警";
|
||||
} else if (alarmType == 14) {
|
||||
title = "徘徊预警";
|
||||
} else if (alarmType == 15) {
|
||||
title = "物体滞留监测";
|
||||
} else if (alarmType == 16) {
|
||||
title = "绊线监测";
|
||||
}
|
||||
return title;
|
||||
DictionaryItem dict = dictionaryItemService.getDict(DictionaryConstant.AI_ANALYSE_HARD_WARE_ALARM_RECORD_TYPE, alarmType + "");
|
||||
return dict != null ? dict.getName() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.DictionariesRecord;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.DictionaryItem;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -17,6 +16,15 @@ public interface IDictionaryItemService extends IService<DictionaryItem> {
|
||||
*/
|
||||
List<DictionaryItem> getDictList(String dictionaryEncoding);
|
||||
|
||||
/**
|
||||
* 查询基础字典信息,根据数值
|
||||
*
|
||||
* @param dictionaryEncoding
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
DictionaryItem getDict(String dictionaryEncoding, String data);
|
||||
|
||||
void add(DictionaryItem dictionaryItem);
|
||||
|
||||
List<DictionaryItem> listEnableByConstructionStage(String projectConstructionStage);
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.enums.ParamEnum;
|
||||
import com.zhgd.xmgl.modules.basicdata.constant.DictionaryConstant;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.Dictionary;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.DictionaryItem;
|
||||
@ -42,6 +42,16 @@ public class DictionaryItemServiceImpl extends ServiceImpl<DictionaryItemMapper,
|
||||
return queryList(di, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictionaryItem getDict(String dictionaryEncoding, String data) {
|
||||
List<DictionaryItem> dictionaryItems = dictionaryItemMapper.selectList(new LambdaQueryWrapper<DictionaryItem>()
|
||||
.eq(DictionaryItem::getDictionaryEncoding, dictionaryEncoding)
|
||||
.eq(DictionaryItem::getIsEnable, 1)
|
||||
.eq(DictionaryItem::getData, data)
|
||||
);
|
||||
return CollUtil.isNotEmpty(dictionaryItems) ? dictionaryItems.get(0) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(DictionaryItem dictionaryItem) {
|
||||
Long dictionaryId = dictionaryItem.getDictionaryId();
|
||||
|
||||
@ -37,6 +37,9 @@ public class PressureTestMachineManageBlockData implements Serializable {
|
||||
@Excel(name = "试验检测管理-试块编号id", width = 15)
|
||||
@ApiModelProperty(value = "试验检测管理-试块编号id")
|
||||
private java.lang.Long pressureTestMachineManageBlockNumberId;
|
||||
//@ApiModelProperty(value = "试验检测管理id")
|
||||
//private java.lang.Long pressureTestMachineManageId;
|
||||
|
||||
/**
|
||||
* code
|
||||
*/
|
||||
|
||||
@ -263,6 +263,9 @@ public class AiAnalyseHardWareAlarmRecordController {
|
||||
}
|
||||
|
||||
@ApiOperation(value = "宁波隧道推送ai报警消息", notes = "宁波隧道推送ai报警消息", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = false, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/callback")
|
||||
public Result callback(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
|
||||
aiAnalyseHardWareAlarmRecordService.callback(paramMap);
|
||||
|
||||
@ -404,12 +404,21 @@ public class AiAnalyseHardWareAlarmRecordServiceImpl extends ServiceImpl<AiAnaly
|
||||
Integer algorithmId = MapUtils.getInteger(paramMap, "algorithmId");
|
||||
String cameraDeviceName = MapUtils.getString(paramMap, "cameraDeviceName");
|
||||
Long timestamp = MapUtils.getLong(paramMap, "timestamp");
|
||||
FileInfo fileInfo = uploadFileService.uploadFileBase64Image(alarmPicData);
|
||||
AiAnalyseHardWareAlarmRecord alarmRecord = new AiAnalyseHardWareAlarmRecord();
|
||||
alarmRecord.setProjectSn("230F8CCA4A6A407AB0DC56E294DC35AD");
|
||||
try {
|
||||
FileInfo fileInfo = uploadFileService.uploadFileBase64Image(alarmPicData);
|
||||
alarmRecord.setImageUrl(fileInfo.getUrl());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//alarmRecord.setHardwareName();
|
||||
//alarmRecord.setHardwareId();
|
||||
alarmRecord.setImageUrl(fileInfo.getUrl());
|
||||
String projectSn = MapUtils.getString(paramMap, "projectSn");
|
||||
if (StringUtils.isNotBlank(projectSn)) {
|
||||
alarmRecord.setProjectSn(projectSn);
|
||||
} else {
|
||||
alarmRecord.setProjectSn("230F8CCA4A6A407AB0DC56E294DC35AD");
|
||||
}
|
||||
alarmRecord.setAlarmType(getAlarmType(algorithmId));
|
||||
alarmRecord.setLocation(cameraDeviceName);
|
||||
alarmRecord.setCreateTime(DateUtil.formatDateTime(new Date(timestamp * 1000)));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user