tq
parent
1d1a59e290
commit
baf68c9585
|
@ -4,6 +4,8 @@ import com.jepsoninfo.req.*;
|
|||
import com.jepsoninfo.service.HardService;
|
||||
import com.jepsoninfo.util.ConstUtil;
|
||||
import com.jepsoninfo.util.ReturnCode;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -14,6 +16,9 @@ public class HardController {
|
|||
@Autowired
|
||||
private HardService hardService;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger("HardController.class");// Logger.getLogger("HardService.class");
|
||||
|
||||
|
||||
@PostMapping(value = "/plateRecognize")
|
||||
public ReturnCode plateRecognize(@RequestBody RecognizeAlarmInfoPlate req) {
|
||||
ReturnCode status = new ReturnCode();
|
||||
|
@ -23,9 +28,8 @@ public class HardController {
|
|||
status.setCode(ConstUtil.CODE_SUCCESS[0]);
|
||||
status.setMsg(ConstUtil.CODE_SUCCESS[1]);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("处理失败", e);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,8 @@ public class HardService {
|
|||
private MessageConfigDao messageConfigDao;
|
||||
|
||||
public void plateRecognize(RecognizeAlarmInfoPlate req) {
|
||||
logger.info("车牌识别结果:{}", JSONObject.toJSONString(req));
|
||||
|
||||
ReturnCode result;
|
||||
ReportCarPassRes ret;
|
||||
String strRet = "";
|
||||
|
@ -53,8 +55,14 @@ public class HardService {
|
|||
String carNo = req.getAlarmInfoPlate().getResult().getPlateResult().getLicense();
|
||||
String devNo = req.getAlarmInfoPlate().getSerialno();
|
||||
|
||||
if (carNo == null || carNo.isEmpty() || carNo.contains("无")) {
|
||||
logger.error("车牌识别失败, 车牌为空");
|
||||
return;
|
||||
}
|
||||
|
||||
printDate(carNo, devNo, laneName, optName, "收到车牌识别推送");
|
||||
|
||||
|
||||
IntegratedMachineConfig integratedCond = new IntegratedMachineConfig();
|
||||
integratedCond.setDevNo(devNo);
|
||||
// 获取一体机配置
|
||||
|
@ -68,28 +76,38 @@ public class HardService {
|
|||
String dirName = createLocalImgDir(carNo, devNo, laneName);
|
||||
String PhotoFrontFileName = RandomUtil.getRandomUuid() + ".jpg";
|
||||
String PhotoFrontFilePath = saveFrontImage(req.getAlarmInfoPlate().getResult().getPlateResult().getImageFile(), carNo, dirName, devNo, laneName, PhotoFrontFileName);
|
||||
logger.info("播放语音: {}", integratedCfg.getIpVoiceId());
|
||||
try {
|
||||
if (integratedCfg != null) {
|
||||
if (integratedCfg.getIsFront() == 1) {
|
||||
// 获取音柱配置
|
||||
IpVoiceboxConfigEx ipVoiceboxConfig = ipVoiceboxConfigDao.selectByPrimaryKey(integratedCfg.getIpVoiceId());
|
||||
if (ipVoiceboxConfig != null) {
|
||||
MessageConfig messageConfig = messageConfigDao.selectByPrimaryKey(3L);
|
||||
|
||||
if (integratedCfg != null) {
|
||||
if (integratedCfg.getIsFront() == 1) {
|
||||
// 获取音柱配置
|
||||
IpVoiceboxConfigEx ipVoiceboxConfig = ipVoiceboxConfigDao.selectByPrimaryKey(integratedCfg.getIpVoiceId());
|
||||
if (ipVoiceboxConfig != null) {
|
||||
MessageConfig messageConfig = messageConfigDao.selectByPrimaryKey(3L);
|
||||
|
||||
PlayVoiceReq playVoice = new PlayVoiceReq();
|
||||
playVoice.setCarNo(carNo);
|
||||
playVoice.setDeviceNo(ipVoiceboxConfig.getDevNo());
|
||||
playVoice.setText(messageConfig.getContent());
|
||||
playVoice(playVoice);
|
||||
PlayVoiceReq playVoice = new PlayVoiceReq();
|
||||
playVoice.setCarNo(carNo);
|
||||
playVoice.setDeviceNo(ipVoiceboxConfig.getDevNo());
|
||||
playVoice.setText(messageConfig.getContent());
|
||||
playVoice(playVoice);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printDate(carNo, devNo, laneName, optName, "not find integrated");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
printDate(carNo, devNo, laneName, optName, "not find integrated");
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
logger.error("播放语音失败", e);
|
||||
}
|
||||
|
||||
String PhotoBodyUrl = UploadToAliUtil.uploadFile(dirName, new File(PhotoFrontFilePath), PhotoFrontFileName,
|
||||
ConstUtil.OSS_ENDPOINT, ConstUtil.OSS_BUCKET, ConstUtil.OSS_SECRET_ID, ConstUtil.OSS_SECRET_KEY);
|
||||
String PhotoBodyUrl = null;
|
||||
try {
|
||||
PhotoBodyUrl = UploadToAliUtil.uploadFile(dirName, new File(PhotoFrontFilePath), PhotoFrontFileName,
|
||||
ConstUtil.OSS_ENDPOINT, ConstUtil.OSS_BUCKET, ConstUtil.OSS_SECRET_ID, ConstUtil.OSS_SECRET_KEY);
|
||||
} catch (Exception e) {
|
||||
logger.error("图片上传失败", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
ReportUnifyReq reportUnifyReq = new ReportUnifyReq();
|
||||
|
@ -422,6 +440,8 @@ public class HardService {
|
|||
}
|
||||
|
||||
public int playVoice(PlayVoiceReq req) {
|
||||
logger.info("播放语音请求:{}", JSONObject.toJSONString(req));
|
||||
|
||||
String carNo = req.getCarNo();
|
||||
String devNo = req.getDeviceNo();
|
||||
String laneName = "";
|
||||
|
@ -464,7 +484,7 @@ public class HardService {
|
|||
|
||||
// printDate(carNo, devNo, laneName, optName, "播放语音结束");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("语音播放异常", e);
|
||||
}
|
||||
} else {
|
||||
printDate(carNo, devNo, laneName, optName, "device not fount");
|
||||
|
@ -515,7 +535,7 @@ public class HardService {
|
|||
}
|
||||
|
||||
public int mqttOpenDoor(DoorReq req) {
|
||||
logger.info("开门请求: {}", req);
|
||||
logger.info("开门请求: {}", JSONObject.toJSONString(req));
|
||||
|
||||
// String[] TOPIC_ARRAY = {"/message/down/gpio_out"};
|
||||
String carNo = req.getCarNo();
|
||||
|
|
Loading…
Reference in New Issue