|
|
@@ -16,9 +16,7 @@ import com.yunfeiyun.agmp.iot.common.service.IotWeatherService;
|
|
|
import com.yunfeiyun.agmp.iot.common.service.MongoService;
|
|
|
import com.yunfeiyun.agmp.iotm.device.pest.service.IIotPestService;
|
|
|
import com.yunfeiyun.agmp.iotm.device.pest.service.IIotPestrecogService;
|
|
|
-import com.yunfeiyun.agmp.iotm.device.xycb.domain.IotXycbPolylineResVo;
|
|
|
-import com.yunfeiyun.agmp.iotm.device.xycb.domain.IotXycbReqVo;
|
|
|
-import com.yunfeiyun.agmp.iotm.device.xycb.domain.IotYfXycbDataListRspVo;
|
|
|
+import com.yunfeiyun.agmp.iotm.device.xycb.domain.*;
|
|
|
import com.yunfeiyun.agmp.iotm.device.xycb.service.IIotXycbService;
|
|
|
import com.yunfeiyun.agmp.iotm.device.xycb.service.IIotXyinfoService;
|
|
|
import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceService;
|
|
|
@@ -227,6 +225,105 @@ public class IotXycbServiceImpl implements IIotXycbService {
|
|
|
return iotXycbPolylineResVoList;
|
|
|
}
|
|
|
|
|
|
+ private IotXycbInfoResVo getXycbIIIInfo(String devBid, IotXycbInfoResVo iotXycbInfoResVo){
|
|
|
+ HashMap<String, String> params = new HashMap<>();
|
|
|
+ params.put("devBid", devBid);
|
|
|
+
|
|
|
+ IotYfXycbIIIdata iotYfXycb2data = (IotYfXycbIIIdata) mongoService.findOne(IotYfXycbIIIdata.class, params, "xycbdataCreatedDate", "desc");
|
|
|
+ if(iotYfXycb2data != null){
|
|
|
+ JSONObject xyData = iotYfXycb2data.getXycbdataContent();
|
|
|
+ iotXycbInfoResVo.setAt(xyData.getString("at"));
|
|
|
+ iotXycbInfoResVo.setAh(xyData.getString("ah"));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> devBidList = new ArrayList<>();
|
|
|
+ devBidList.add(devBid);
|
|
|
+
|
|
|
+ Map<String, IotXyinfoPestTotalDto> iotXyinfoPestTotalDtoMap = iIotPestrecogService.getIotXyIIIinfoPestTotalMap(devBidList);
|
|
|
+ if(iotXyinfoPestTotalDtoMap.containsKey(devBid)){
|
|
|
+ iotXycbInfoResVo.setPestTotal(String.valueOf(iotXyinfoPestTotalDtoMap.get(devBid).getPestTotal()));
|
|
|
+ }
|
|
|
+ return iotXycbInfoResVo;
|
|
|
+ }
|
|
|
+// private IotXycbInfoResVo getZjsfXycbInfo(String devBid, IotXycbInfoResVo iotXycbInfoResVo){
|
|
|
+// HashMap<String, String> params = new HashMap<>();
|
|
|
+// params.put("devBid", devBid);
|
|
|
+//
|
|
|
+// IotZjsfXycbdata iotZjsfXycbdata = (IotZjsfXycbdata) mongoService.findOne(
|
|
|
+// IotZjsfXycbdata.class, params, "xycbdataCreatedDate", "desc");
|
|
|
+// if(iotZjsfXycbdata != null){
|
|
|
+// JSONObject xyData = iotZjsfXycbdata.getXycbdataContent();
|
|
|
+// iotXycbInfoResVo.setAt(xyData.getString("at"));
|
|
|
+// iotXycbInfoResVo.setAh(xyData.getString("ah"));
|
|
|
+// }
|
|
|
+//
|
|
|
+// List<String> devBidList = new ArrayList<>();
|
|
|
+// devBidList.add(devBid);
|
|
|
+//
|
|
|
+// Map<String, IotXyinfoPestTotalDto> iotXyinfoPestTotalDtoMap = iIotPestrecogService.getIotXyinfoPestTotalMap(devBidList);
|
|
|
+// iotXycbInfoResVo.setPestTotal("0");
|
|
|
+// if(iotXyinfoPestTotalDtoMap.containsKey(devBid)){
|
|
|
+// Integer pestTotal = iotXyinfoPestTotalDtoMap.get(devBid).getPestTotal();
|
|
|
+// if(pestTotal == null){
|
|
|
+// pestTotal = 0;
|
|
|
+// }
|
|
|
+// iotXycbInfoResVo.setPestTotal(String.valueOf(pestTotal));
|
|
|
+// }
|
|
|
+// return iotXycbInfoResVo;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取性诱测报信息
|
|
|
+ *
|
|
|
+ * @param devBid
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public IotXycbInfoResVo getXycbInfo(String devBid) {
|
|
|
+ if (StringUtils.isEmpty(devBid)) {
|
|
|
+ throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备标识不能为空");
|
|
|
+ }
|
|
|
+ IotDevice iotDevice = iIotDeviceService.selectIotDeviceByDevBid(devBid);
|
|
|
+ if(iotDevice == null){
|
|
|
+ throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ IotXycbInfoResVo iotXycbInfoResVo = new IotXycbInfoResVo();
|
|
|
+ iotXycbInfoResVo.setDevStatus(iotDevice.getDevStatus());
|
|
|
+
|
|
|
+ IotXyinfoDto iotXyinfoDto = iIotXyinfoService.selectIotXyinfoByDevBid(devBid);
|
|
|
+ if(iotXyinfoDto != null){
|
|
|
+ iotXycbInfoResVo.setXyinfoLurename(iotXyinfoDto.getXyinfoLurename());
|
|
|
+ iotXycbInfoResVo.setXyinfoLureexpireddate(iotXyinfoDto.getXyinfoLureexpireddate());
|
|
|
+ }
|
|
|
+
|
|
|
+ String province = StringUtils.isEmpty(iotDevice.getDevProvincealign()) ? iotDevice.getDevProvince(): iotDevice.getDevProvincealign();
|
|
|
+ String city = StringUtils.isEmpty(iotDevice.getDevCityalign()) ? iotDevice.getDevCity(): iotDevice.getDevCityalign();
|
|
|
+ String district = StringUtils.isEmpty(iotDevice.getDevDistrictalign()) ? iotDevice.getDevDistrict(): iotDevice.getDevDistrictalign();
|
|
|
+ if(StringUtils.isNotEmpty(province) && StringUtils.isNotEmpty(city)){
|
|
|
+ JSONObject weatherInfo = iotWeatherService.getWeatherByAddress(province, city, district);
|
|
|
+ iotXycbInfoResVo.setWea(weatherInfo.getString("wea"));
|
|
|
+ iotXycbInfoResVo.setWin(weatherInfo.getString("win"));
|
|
|
+ iotXycbInfoResVo.setWin_speed(weatherInfo.getString("win_speed"));
|
|
|
+ String rainStatusName = !Objects.equals(weatherInfo.getString("rain_pcpn"), "0") ? "是" : "否";
|
|
|
+ iotXycbInfoResVo.setRainStatusName(rainStatusName);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (IotDeviceDictConst.TYPE_YF_XYCB_III.equals(iotDevice.getDevtypeBid())){
|
|
|
+ iotXycbInfoResVo = getXycbIIIInfo(devBid, iotXycbInfoResVo);
|
|
|
+ }
|
|
|
+
|
|
|
+// if (IotDeviceDictConst.TYPE_YF_XYCB_2.equals(iotDevice.getDevtypeBid())) {
|
|
|
+// iotXycbInfoResVo = getXycb2Info(devBid, iotXycbInfoResVo);
|
|
|
+// }else if (IotDeviceDictConst.TYPE_ZJSF_XYCB.equals(iotDevice.getDevtypeBid())){
|
|
|
+// iotXycbInfoResVo = getZjsfXycbInfo(devBid, iotXycbInfoResVo);
|
|
|
+// }else if (IotDeviceDictConst.TYPE_YF_XYCB_III.equals(iotDevice.getDevtypeBid())){
|
|
|
+// iotXycbInfoResVo = getXycbIIIInfo(devBid, iotXycbInfoResVo);
|
|
|
+// }
|
|
|
+ return iotXycbInfoResVo;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// /**
|
|
|
// * 性诱测报2.0
|
|
|
@@ -696,98 +793,8 @@ public class IotXycbServiceImpl implements IIotXycbService {
|
|
|
// }
|
|
|
// return iotXycbInfoResVo;
|
|
|
// }
|
|
|
-// private IotXycbInfoResVo getXycbIIIInfo(String devBid, IotXycbInfoResVo iotXycbInfoResVo){
|
|
|
-// HashMap<String, String> params = new HashMap<>();
|
|
|
-// params.put("devBid", devBid);
|
|
|
-//
|
|
|
-// IotYfXycbIIIdata iotYfXycb2data = (IotYfXycbIIIdata) mongoService.findOne(IotYfXycbIIIdata.class, params, "xycbdataCreatedDate", "desc");
|
|
|
-// if(iotYfXycb2data != null){
|
|
|
-// JSONObject xyData = iotYfXycb2data.getXycbdataContent();
|
|
|
-// iotXycbInfoResVo.setAt(xyData.getString("at"));
|
|
|
-// iotXycbInfoResVo.setAh(xyData.getString("ah"));
|
|
|
-// }
|
|
|
-//
|
|
|
-// List<String> devBidList = new ArrayList<>();
|
|
|
-// devBidList.add(devBid);
|
|
|
-//
|
|
|
-// Map<String, IotXyinfoPestTotalDto> iotXyinfoPestTotalDtoMap = iIotPestrecogService.getIotXyIIIinfoPestTotalMap(devBidList);
|
|
|
-// if(iotXyinfoPestTotalDtoMap.containsKey(devBid)){
|
|
|
-// iotXycbInfoResVo.setPestTotal(String.valueOf(iotXyinfoPestTotalDtoMap.get(devBid).getPestTotal()));
|
|
|
-// }
|
|
|
-// return iotXycbInfoResVo;
|
|
|
-// }
|
|
|
-// private IotXycbInfoResVo getZjsfXycbInfo(String devBid, IotXycbInfoResVo iotXycbInfoResVo){
|
|
|
-// HashMap<String, String> params = new HashMap<>();
|
|
|
-// params.put("devBid", devBid);
|
|
|
-//
|
|
|
-// IotZjsfXycbdata iotZjsfXycbdata = (IotZjsfXycbdata) mongoService.findOne(
|
|
|
-// IotZjsfXycbdata.class, params, "xycbdataCreatedDate", "desc");
|
|
|
-// if(iotZjsfXycbdata != null){
|
|
|
-// JSONObject xyData = iotZjsfXycbdata.getXycbdataContent();
|
|
|
-// iotXycbInfoResVo.setAt(xyData.getString("at"));
|
|
|
-// iotXycbInfoResVo.setAh(xyData.getString("ah"));
|
|
|
-// }
|
|
|
-//
|
|
|
-// List<String> devBidList = new ArrayList<>();
|
|
|
-// devBidList.add(devBid);
|
|
|
-//
|
|
|
-// Map<String, IotXyinfoPestTotalDto> iotXyinfoPestTotalDtoMap = iIotPestrecogService.getIotXyinfoPestTotalMap(devBidList);
|
|
|
-// iotXycbInfoResVo.setPestTotal("0");
|
|
|
-// if(iotXyinfoPestTotalDtoMap.containsKey(devBid)){
|
|
|
-// Integer pestTotal = iotXyinfoPestTotalDtoMap.get(devBid).getPestTotal();
|
|
|
-// if(pestTotal == null){
|
|
|
-// pestTotal = 0;
|
|
|
-// }
|
|
|
-// iotXycbInfoResVo.setPestTotal(String.valueOf(pestTotal));
|
|
|
-// }
|
|
|
-// return iotXycbInfoResVo;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 获取性诱测报信息
|
|
|
-// *
|
|
|
-// * @param devBid
|
|
|
-// */
|
|
|
-// @Override
|
|
|
-// public IotXycbInfoResVo getXycbInfo(String devBid) {
|
|
|
-// if (StringUtils.isEmpty(devBid)) {
|
|
|
-// throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备标识不能为空");
|
|
|
-// }
|
|
|
-// IotDevice iotDevice = iIotDeviceService.findOneByBizId(devBid);
|
|
|
-// if(iotDevice == null){
|
|
|
-// throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备不存在");
|
|
|
-// }
|
|
|
-//
|
|
|
-// IotXycbInfoResVo iotXycbInfoResVo = new IotXycbInfoResVo();
|
|
|
-// iotXycbInfoResVo.setDevStatus(iotDevice.getDevStatus());
|
|
|
-//
|
|
|
-// IotXyinfoDto iotXyinfoDto = iIotXyinfoService.selectIotXyinfoByDevBid(devBid);
|
|
|
-// if(iotXyinfoDto != null){
|
|
|
-// iotXycbInfoResVo.setXyinfoLurename(iotXyinfoDto.getXyinfoLurename());
|
|
|
-// iotXycbInfoResVo.setXyinfoLureexpireddate(iotXyinfoDto.getXyinfoLureexpireddate());
|
|
|
-// }
|
|
|
-//
|
|
|
-// String province = StringUtils.isEmpty(iotDevice.getDevProvincealign()) ? iotDevice.getDevProvince(): iotDevice.getDevProvincealign();
|
|
|
-// String city = StringUtils.isEmpty(iotDevice.getDevCityalign()) ? iotDevice.getDevCity(): iotDevice.getDevCityalign();
|
|
|
-// String district = StringUtils.isEmpty(iotDevice.getDevDistrictalign()) ? iotDevice.getDevDistrict(): iotDevice.getDevDistrictalign();
|
|
|
-// if(StringUtils.isNotEmpty(province) && StringUtils.isNotEmpty(city)){
|
|
|
-// JSONObject weatherInfo = iotWeatherService.getWeatherByAddress(province, city, district);
|
|
|
-// iotXycbInfoResVo.setWea(weatherInfo.getString("wea"));
|
|
|
-// iotXycbInfoResVo.setWin(weatherInfo.getString("win"));
|
|
|
-// iotXycbInfoResVo.setWin_speed(weatherInfo.getString("win_speed"));
|
|
|
-// String rainStatusName = !Objects.equals(weatherInfo.getString("rain_pcpn"), "0") ? "是" : "否";
|
|
|
-// iotXycbInfoResVo.setRainStatusName(rainStatusName);
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (IotDeviceDictConst.TYPE_YF_XYCB_2.equals(iotDevice.getDevtypeBid())) {
|
|
|
-// iotXycbInfoResVo = getXycb2Info(devBid, iotXycbInfoResVo);
|
|
|
-// }else if (IotDeviceDictConst.TYPE_ZJSF_XYCB.equals(iotDevice.getDevtypeBid())){
|
|
|
-// iotXycbInfoResVo = getZjsfXycbInfo(devBid, iotXycbInfoResVo);
|
|
|
-// }else if (IotDeviceDictConst.TYPE_YF_XYCB_III.equals(iotDevice.getDevtypeBid())){
|
|
|
-// iotXycbInfoResVo = getXycbIIIInfo(devBid, iotXycbInfoResVo);
|
|
|
-// }
|
|
|
-// return iotXycbInfoResVo;
|
|
|
-// }
|
|
|
+
|
|
|
+
|
|
|
//
|
|
|
// /**
|
|
|
// * 修改诱芯信息
|