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