|
|
@@ -20,6 +20,7 @@ import com.yunfeiyun.agmp.iot.common.service.YfCbdRecogeService;
|
|
|
import com.yunfeiyun.agmp.iot.common.util.tmn.cbd.CbdInsectIdentifyUtil;
|
|
|
import com.yunfeiyun.agmp.iots.service.IIotDeviceService;
|
|
|
import com.yunfeiyun.agmp.iots.service.IIotPestService;
|
|
|
+import com.yunfeiyun.agmp.iots.warn.service.WarnService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -43,15 +44,29 @@ public class IotCbdImgService {
|
|
|
@Resource
|
|
|
private IIotPestService iotPestService;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
@Autowired
|
|
|
private IIotDeviceService iIotDeviceService;
|
|
|
|
|
|
@Autowired
|
|
|
private YfCbdRecogeService yfCbdRecogeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private WarnService warnService;
|
|
|
+
|
|
|
+ private void sendWarn(IotDevice iotDevice, IotCbdrecog warnCbdrecog){
|
|
|
+ List<IotCbdPestrecog> warnCbdPestrecogList = null;
|
|
|
+ if (warnCbdrecog != null) {
|
|
|
+ warnCbdPestrecogList = warnCbdrecog.getPestrecog().get(EnumCbdMarkType.AUTO.getCode());
|
|
|
+ if(warnCbdPestrecogList != null && !warnCbdPestrecogList.isEmpty()){
|
|
|
+ // 预警
|
|
|
+ JSONObject extInfo = new JSONObject();
|
|
|
+ extInfo.put("data", warnCbdPestrecogList);
|
|
|
+
|
|
|
+// warnService.processWarningReportData(iotDevice, extInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private String getJsonData(String k, JSONObject jsonObject){
|
|
|
String v = jsonObject.getString(k);
|
|
|
return StringUtils.isNotEmpty(v) && !v.equals("0") ? v : "";
|
|
|
@@ -174,16 +189,13 @@ public class IotCbdImgService {
|
|
|
iotCbdimg.setCbdrecog(cbdrecog);
|
|
|
mongoService.saveOne(iotCbdimg);
|
|
|
|
|
|
-// if("3".equals(warnService.getWarnVer()) ){
|
|
|
-// //要求预警检查 V3
|
|
|
-// IotWarncheck warncheck = new IotWarncheck();
|
|
|
-// warncheck.setDevBid(iotDevice.getDevBid());
|
|
|
-// // TODO
|
|
|
-// // iotsMqService.sendMsg(IotMqConstant.TOPIC_WARNCHECK, IotMqConstant.TOPIC_WARNCHECK, warncheck);
|
|
|
-// }else{
|
|
|
-// //预警
|
|
|
-// warnService.checkCbdData("0","",iotDevice.getDevBid());
|
|
|
-// }
|
|
|
+ // 发送预警消息
|
|
|
+ IotCbdrecog warnCbdrecog = iotCbdrecogB;
|
|
|
+ if(Objects.equals(iotDevice.getDevCbdrecogtype(), EnumCbdRecogType.A.getCode())){
|
|
|
+ warnCbdrecog = iotCbdrecogA;
|
|
|
+ }
|
|
|
+ sendWarn(iotDevice, warnCbdrecog);
|
|
|
+
|
|
|
return iotCbdimg;
|
|
|
}
|
|
|
|