|
|
@@ -1,713 +1,12 @@
|
|
|
-//package com.yunfeiyun.agmp.iotm.device.xycb.service.impl;
|
|
|
-//
|
|
|
-//import com.alibaba.fastjson2.JSONObject;
|
|
|
-//import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-//import com.yunfeiyun.agmp.common.core.page.PageDomain;
|
|
|
-//import com.yunfeiyun.agmp.common.core.page.TableSupport;
|
|
|
-//import com.yunfeiyun.agmp.common.utils.DateUtils;
|
|
|
-//import com.yunfeiyun.agmp.common.utils.SecurityUtils;
|
|
|
-//import com.yunfeiyun.agmp.common.utils.StringUtils;
|
|
|
-//import com.yunfeiyun.agmp.iot.common.constant.IotErrorCode;
|
|
|
-//import com.yunfeiyun.agmp.iot.common.constant.devicetype.IotDeviceDictConst;
|
|
|
-//import com.yunfeiyun.agmp.iot.common.domain.*;
|
|
|
-//import com.yunfeiyun.agmp.iot.common.domain.resvo.IotDeviceResVo;
|
|
|
-//import com.yunfeiyun.agmp.iot.common.domain.resvo.IotXycbimgListResVo;
|
|
|
-//import com.yunfeiyun.agmp.iot.common.exception.IotBizException;
|
|
|
-//import com.yunfeiyun.agmp.iot.common.service.IotWeatherService;
|
|
|
-//import com.yunfeiyun.agmp.iot.common.service.MongoService;
|
|
|
-//import com.yunfeiyun.agmp.iotm.device.domain.dtovo.IotXyinfoDto;
|
|
|
-//import com.yunfeiyun.agmp.iotm.device.domain.dtovo.IotXyinfoPestTotalDto;
|
|
|
-//import com.yunfeiyun.agmp.iotm.device.domain.reqvo.IotXycbLureListReqVo;
|
|
|
-//import com.yunfeiyun.agmp.iotm.device.domain.reqvo.IotXycbModifyLureReqVo;
|
|
|
-//import com.yunfeiyun.agmp.iotm.device.domain.reqvo.IotXycbReqVo;
|
|
|
-//import com.yunfeiyun.agmp.iotm.device.domain.resvo.*;
|
|
|
-//import com.yunfeiyun.agmp.iotm.device.service.*;
|
|
|
-//import lombok.extern.slf4j.Slf4j;
|
|
|
-//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-//import org.springframework.data.domain.Sort;
|
|
|
-//import org.springframework.data.mongodb.core.aggregation.*;
|
|
|
-//import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
-//import org.springframework.data.mongodb.core.query.Query;
|
|
|
-//import org.springframework.stereotype.Service;
|
|
|
-//
|
|
|
-//import java.util.*;
|
|
|
-//
|
|
|
-//import static com.yunfeiyun.agmp.common.utils.PageUtils.startPage;
|
|
|
-//
|
|
|
-//@Slf4j
|
|
|
-//@Service
|
|
|
-//public class IotXycbIIIServiceImpl implements IIotXycbIIIService {
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private IIotDeviceService iIotDeviceService;
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private MongoService mongoService;
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private IotWeatherService iotWeatherService;
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private IIotXyinfoService iIotXyinfoService;
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private IIotPestrecogService iIotPestrecogService;
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private IIotPestService iotPestService;
|
|
|
-//
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 性诱测报2.0
|
|
|
-// * @param reqVo
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// private IPage<IotYfXycbDataListRspVo> getYfXycb2DataList(IotXycbReqVo reqVo){
|
|
|
-// String devBid = reqVo.getDevBid();
|
|
|
-//
|
|
|
-// Map<String, Object> cases = new HashMap<>();
|
|
|
-// cases.put("devBid", devBid);
|
|
|
-//
|
|
|
-// if (StringUtils.isNotEmpty(reqVo.getStartDate()) && StringUtils.isEmpty(reqVo.getEndDate())) {
|
|
|
-// cases.put("gte_xycb2dataCreatedDate", reqVo.getStartDate());
|
|
|
-// }
|
|
|
-// if (StringUtils.isEmpty(reqVo.getStartDate()) && StringUtils.isNotEmpty(reqVo.getEndDate())) {
|
|
|
-// cases.put("lte_xycb2dataCreatedDate", reqVo.getEndDate());
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(reqVo.getStartDate()) && StringUtils.isNotEmpty(reqVo.getEndDate())) {
|
|
|
-// cases.put("time_xycb2dataCreatedDate", reqVo.getStartDate() + "," + reqVo.getEndDate());
|
|
|
-// }
|
|
|
-// cases.remove("startDate");
|
|
|
-// cases.remove("endDate");
|
|
|
-//
|
|
|
-// PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
-// if(Objects.equals(pageDomain.getOrderByColumn(), "xycbdataCreatedDate")){
|
|
|
-// pageDomain.setOrderByColumn("xycb2dataCreatedDate");
|
|
|
-// }
|
|
|
-//
|
|
|
-// IPage listPage = mongoService.findListPage(IotYfXycb2data.class, cases, pageDomain);
|
|
|
-// List<IotYfXycb2data> iotYfXycb2dataList = listPage.getRecords();
|
|
|
-// List<IotYfXycbDataListRspVo> iotYfXycbDataListRspVoList = new ArrayList<>();
|
|
|
-// for(IotYfXycb2data iotYfXycb2data: iotYfXycb2dataList){
|
|
|
-// JSONObject jsonObject = iotYfXycb2data.getXycb2dataContent();
|
|
|
-// String cs = "0";
|
|
|
-// if(!Objects.equals(jsonObject.getInteger("b_c"), 0)){
|
|
|
-// cs = "1";
|
|
|
-// }
|
|
|
-// IotYfXycbDataListRspVo xycbDataListRspVo = new IotYfXycbDataListRspVo();
|
|
|
-// xycbDataListRspVo.setDevBid(devBid);
|
|
|
-// xycbDataListRspVo.setDs("1");
|
|
|
-// xycbDataListRspVo.setWs("1");
|
|
|
-// xycbDataListRspVo.setAt(jsonObject.getString("at"));
|
|
|
-// xycbDataListRspVo.setAh(jsonObject.getString("ah"));
|
|
|
-// xycbDataListRspVo.setBs("0");
|
|
|
-// xycbDataListRspVo.setCs(cs);
|
|
|
-// xycbDataListRspVo.setCv("0");
|
|
|
-// xycbDataListRspVo.setBv(jsonObject.getString("b_v"));
|
|
|
-// xycbDataListRspVo.setCt((String) jsonObject.getOrDefault("ct", "0"));
|
|
|
-// xycbDataListRspVo.setCreatedDate(iotYfXycb2data.getXycb2dataCreatedDate());
|
|
|
-//
|
|
|
-// iotYfXycbDataListRspVoList.add(xycbDataListRspVo);
|
|
|
-// }
|
|
|
-// listPage.setRecords(iotYfXycbDataListRspVoList);
|
|
|
-//
|
|
|
-// return listPage;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 性诱测报2.0
|
|
|
-// * @param reqVo
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// private IPage<IotYfXycbDataListRspVo> getZjsfXycbDataList(IotXycbReqVo reqVo){
|
|
|
-// String devBid = reqVo.getDevBid();
|
|
|
-//
|
|
|
-// Map<String, Object> cases = new HashMap<>();
|
|
|
-// cases.put("devBid", devBid);
|
|
|
-//
|
|
|
-// if (StringUtils.isNotEmpty(reqVo.getStartDate()) && StringUtils.isEmpty(reqVo.getEndDate())) {
|
|
|
-// cases.put("gte_xycbdataCreatedDate", reqVo.getStartDate());
|
|
|
-// }
|
|
|
-// if (StringUtils.isEmpty(reqVo.getStartDate()) && StringUtils.isNotEmpty(reqVo.getEndDate())) {
|
|
|
-// cases.put("lte_xycbdataCreatedDate", reqVo.getEndDate());
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(reqVo.getStartDate()) && StringUtils.isNotEmpty(reqVo.getEndDate())) {
|
|
|
-// cases.put("time_xycbdataCreatedDate", reqVo.getStartDate() + "," + reqVo.getEndDate());
|
|
|
-// }
|
|
|
-// cases.remove("startDate");
|
|
|
-// cases.remove("endDate");
|
|
|
-//
|
|
|
-// PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
-// if(Objects.equals(pageDomain.getOrderByColumn(), "xycbdataCreatedDate")){
|
|
|
-// pageDomain.setOrderByColumn("xycbdataCreatedDate");
|
|
|
-// }
|
|
|
-//
|
|
|
-// IPage listPage = mongoService.findListPage(IotZjsfXycbdata.class, cases, pageDomain);
|
|
|
-// List<IotZjsfXycbdata> iotZjsfXycbdataList = listPage.getRecords();
|
|
|
-//
|
|
|
-// List<IotYfXycbDataListRspVo> iotYfXycbDataListRspVoList = new ArrayList<>();
|
|
|
-// for(IotZjsfXycbdata iotZjsfXycbdata: iotZjsfXycbdataList){
|
|
|
-// JSONObject jsonObject = iotZjsfXycbdata.getXycbdataContent();
|
|
|
-// String cs = "0";
|
|
|
-// if(Objects.equals(jsonObject.getInteger("cs"), 2)){
|
|
|
-// cs = "1";
|
|
|
-// }
|
|
|
-// IotZjsfXycbDataListRspVo xycbDataListRspVo = new IotZjsfXycbDataListRspVo();
|
|
|
-// xycbDataListRspVo.setDevBid(devBid);
|
|
|
-// xycbDataListRspVo.setDs("1");
|
|
|
-// xycbDataListRspVo.setWs("1");
|
|
|
-// xycbDataListRspVo.setAt(jsonObject.getString("at"));
|
|
|
-// xycbDataListRspVo.setAh(jsonObject.getString("ah"));
|
|
|
-// xycbDataListRspVo.setBs("0");
|
|
|
-// xycbDataListRspVo.setCs(cs);
|
|
|
-// xycbDataListRspVo.setCv("0");
|
|
|
-// xycbDataListRspVo.setBv(jsonObject.getString("b_v"));
|
|
|
-// xycbDataListRspVo.setLp(jsonObject.getString("lp"));
|
|
|
-// xycbDataListRspVo.setLt(jsonObject.getString("lt"));
|
|
|
-// xycbDataListRspVo.setSs(jsonObject.getString("ss"));
|
|
|
-// xycbDataListRspVo.setWin(jsonObject.getString("win"));
|
|
|
-// xycbDataListRspVo.setWin_speed(jsonObject.getString("win_speed"));
|
|
|
-// xycbDataListRspVo.setCt((String) jsonObject.getOrDefault("ct", "0"));
|
|
|
-//
|
|
|
-//
|
|
|
-// xycbDataListRspVo.setCreatedDate(iotZjsfXycbdata.getXycbdataCreatedDate());
|
|
|
-//
|
|
|
-// iotYfXycbDataListRspVoList.add(xycbDataListRspVo);
|
|
|
-// }
|
|
|
-// listPage.setRecords(iotYfXycbDataListRspVoList);
|
|
|
-//
|
|
|
-// return listPage;
|
|
|
-// }
|
|
|
-//
|
|
|
-// private IPage<IotYfXycbDataListRspVo> getZjsfXycbIIIDataList(IotXycbReqVo reqVo){
|
|
|
-// String devBid = reqVo.getDevBid();
|
|
|
-//
|
|
|
-// Map<String, Object> cases = new HashMap<>();
|
|
|
-// cases.put("devBid", devBid);
|
|
|
-//
|
|
|
-// if (StringUtils.isNotEmpty(reqVo.getStartDate()) && StringUtils.isEmpty(reqVo.getEndDate())) {
|
|
|
-// cases.put("gte_xycbdataCreatedDate", reqVo.getStartDate());
|
|
|
-// }
|
|
|
-// if (StringUtils.isEmpty(reqVo.getStartDate()) && StringUtils.isNotEmpty(reqVo.getEndDate())) {
|
|
|
-// cases.put("lte_xycbdataCreatedDate", reqVo.getEndDate());
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(reqVo.getStartDate()) && StringUtils.isNotEmpty(reqVo.getEndDate())) {
|
|
|
-// cases.put("time_xycbdataCreatedDate", reqVo.getStartDate() + "," + reqVo.getEndDate());
|
|
|
-// }
|
|
|
-// cases.remove("startDate");
|
|
|
-// cases.remove("endDate");
|
|
|
-//
|
|
|
-// PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
-// if(Objects.equals(pageDomain.getOrderByColumn(), "xycbdataCreatedDate")){
|
|
|
-// pageDomain.setOrderByColumn("xycbdataCreatedDate");
|
|
|
-// }
|
|
|
-//
|
|
|
-// IPage listPage = mongoService.findListPage(IotZjsfXycbdata.class, cases, pageDomain);
|
|
|
-// List<IotZjsfXycbdata> iotZjsfXycbdataList = listPage.getRecords();
|
|
|
-//
|
|
|
-// List<IotYfXycbDataListRspVo> iotYfXycbDataListRspVoList = new ArrayList<>();
|
|
|
-// for(IotZjsfXycbdata iotZjsfXycbdata: iotZjsfXycbdataList){
|
|
|
-// JSONObject jsonObject = iotZjsfXycbdata.getXycbdataContent();
|
|
|
-// String cs = "0";
|
|
|
-// if(Objects.equals(jsonObject.getInteger("cs"), 2)){
|
|
|
-// cs = "1";
|
|
|
-// }
|
|
|
-// IotZjsfXycbDataListRspVo xycbDataListRspVo = new IotZjsfXycbDataListRspVo();
|
|
|
-// xycbDataListRspVo.setDevBid(devBid);
|
|
|
-// xycbDataListRspVo.setDs("1");
|
|
|
-// xycbDataListRspVo.setWs("1");
|
|
|
-// xycbDataListRspVo.setAt(jsonObject.getString("at"));
|
|
|
-// xycbDataListRspVo.setAh(jsonObject.getString("ah"));
|
|
|
-// xycbDataListRspVo.setBs("0");
|
|
|
-// xycbDataListRspVo.setCs(cs);
|
|
|
-// xycbDataListRspVo.setCv("0");
|
|
|
-// xycbDataListRspVo.setBv(jsonObject.getString("b_v"));
|
|
|
-// xycbDataListRspVo.setLp(jsonObject.getString("lp"));
|
|
|
-// xycbDataListRspVo.setLt(jsonObject.getString("lt"));
|
|
|
-// xycbDataListRspVo.setSs(jsonObject.getString("ss"));
|
|
|
-// xycbDataListRspVo.setWin(jsonObject.getString("win"));
|
|
|
-// xycbDataListRspVo.setWin_speed(jsonObject.getString("win_speed"));
|
|
|
-// xycbDataListRspVo.setCt((String) jsonObject.getOrDefault("ct", "0"));
|
|
|
-//
|
|
|
-//
|
|
|
-// xycbDataListRspVo.setCreatedDate(iotZjsfXycbdata.getXycbdataCreatedDate());
|
|
|
-//
|
|
|
-// iotYfXycbDataListRspVoList.add(xycbDataListRspVo);
|
|
|
-// }
|
|
|
-// listPage.setRecords(iotYfXycbDataListRspVoList);
|
|
|
-//
|
|
|
-// return listPage;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 性诱测报2.0 工作数据导出
|
|
|
-// * @param reqVo
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public List<IotYfXycbDataListRspVo> exportDataList(IotXycbReqVo reqVo ,IotDeviceResVo device){
|
|
|
-// String devBid = reqVo.getDevBid();
|
|
|
-//
|
|
|
-// Map<String, Object> cases = new HashMap<>();
|
|
|
-// cases.put("devBid", devBid);
|
|
|
-//
|
|
|
-// if (StringUtils.isNotEmpty(reqVo.getStartDate()) && StringUtils.isEmpty(reqVo.getEndDate())) {
|
|
|
-// cases.put("gte_xycb2dataCreatedDate", reqVo.getStartDate());
|
|
|
-// }
|
|
|
-// if (StringUtils.isEmpty(reqVo.getStartDate()) && StringUtils.isNotEmpty(reqVo.getEndDate())) {
|
|
|
-// cases.put("lte_xycb2dataCreatedDate", reqVo.getEndDate());
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(reqVo.getStartDate()) && StringUtils.isNotEmpty(reqVo.getEndDate())) {
|
|
|
-// cases.put("time_xycb2dataCreatedDate", reqVo.getStartDate() + "," + reqVo.getEndDate());
|
|
|
-// }
|
|
|
-// cases.remove("startDate");
|
|
|
-// cases.remove("endDate");
|
|
|
-//
|
|
|
-// List<IotYfXycb2data> iotYfXycb2dataList = mongoService.findAll(IotYfXycb2data.class, cases, "xycb2dataCreatedDate desc");
|
|
|
-// List<IotYfXycbDataListRspVo> iotYfXycbDataListRspVoList = new ArrayList<>();
|
|
|
-// int i=0;
|
|
|
-// for(IotYfXycb2data iotYfXycb2data: iotYfXycb2dataList){
|
|
|
-// i++;
|
|
|
-// JSONObject jsonObject = iotYfXycb2data.getXycb2dataContent();
|
|
|
-// String cs = "0";
|
|
|
-// if(!Objects.equals(jsonObject.getInteger("b_c"), 0)){
|
|
|
-// cs = "1";
|
|
|
-// }
|
|
|
-// IotYfXycbDataListRspVo xycbDataListRspVo = new IotYfXycbDataListRspVo();
|
|
|
-// xycbDataListRspVo.setDevBid(devBid);
|
|
|
-// xycbDataListRspVo.setDs("1");
|
|
|
-// xycbDataListRspVo.setWs("1");
|
|
|
-// xycbDataListRspVo.setAt(jsonObject.getString("at"));
|
|
|
-// xycbDataListRspVo.setAh(jsonObject.getString("ah"));
|
|
|
-// xycbDataListRspVo.setBs("0");
|
|
|
-// xycbDataListRspVo.setCs(cs);
|
|
|
-// xycbDataListRspVo.setCv("0");
|
|
|
-// xycbDataListRspVo.setBv(jsonObject.getString("b_v"));
|
|
|
-// xycbDataListRspVo.setCt((String) jsonObject.getOrDefault("ct", "0"));
|
|
|
-// xycbDataListRspVo.setCreatedDate(iotYfXycb2data.getXycb2dataCreatedDate());
|
|
|
-//
|
|
|
-// xycbDataListRspVo.setId(""+i);
|
|
|
-// xycbDataListRspVo.setDevCode(device.getDevCode());
|
|
|
-//
|
|
|
-// iotYfXycbDataListRspVoList.add(xycbDataListRspVo);
|
|
|
-// }
|
|
|
-//
|
|
|
-// return iotYfXycbDataListRspVoList;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * @param iotXycbReqVo
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// @Override
|
|
|
-// public IPage getImageList(IotXycbReqVo reqVo) {
|
|
|
-// String devBid = reqVo.getDevBid();
|
|
|
-// 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(), "设备不存在");
|
|
|
-// }
|
|
|
-//
|
|
|
-// Map<String, Object> cases = new HashMap<>();
|
|
|
-// cases.put("devBid", devBid);
|
|
|
-// cases.put("xycbimgDelstatus", "0");
|
|
|
-//
|
|
|
-// if (StringUtils.isNotEmpty(reqVo.getStartDate()) && StringUtils.isEmpty(reqVo.getEndDate())) {
|
|
|
-// cases.put("gte_xycbimgCreatedDate", reqVo.getStartDate());
|
|
|
-// }
|
|
|
-// if (StringUtils.isEmpty(reqVo.getStartDate()) && StringUtils.isNotEmpty(reqVo.getEndDate())) {
|
|
|
-// cases.put("lte_xycbimgCreatedDate", reqVo.getEndDate());
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(reqVo.getStartDate()) && StringUtils.isNotEmpty(reqVo.getEndDate())) {
|
|
|
-// cases.put("time_xycbimgCreatedDate", reqVo.getStartDate() + "," + reqVo.getEndDate());
|
|
|
-// }
|
|
|
-// cases.remove("startDate");
|
|
|
-// cases.remove("endDate");
|
|
|
-//
|
|
|
-// PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
-// pageDomain.setOrderByColumn("xycbimgCreatedDate");
|
|
|
-// pageDomain.setIsAsc("desc");
|
|
|
-//
|
|
|
-// IPage listPage = mongoService.findListPage(IotXycbimg.class, cases, pageDomain);
|
|
|
-// List records = listPage.getRecords();
|
|
|
-// List<IotXycbimgListResVo> iotXycbimgListResVoList = new ArrayList<>();
|
|
|
-// for (Object obj : records) {
|
|
|
-// IotXycbimg iotXycbimg = (IotXycbimg) obj;
|
|
|
-// IotXycbimgListResVo iotXycbimgListResVo = new IotXycbimgListResVo();
|
|
|
-// iotXycbimgListResVo.setDevBid(iotXycbimg.getDevBid());
|
|
|
-// iotXycbimgListResVo.setXycbimgBid(iotXycbimg.getXycbimgBid());
|
|
|
-// iotXycbimgListResVo.setXycbimgAddr(iotXycbimg.getXycbimgAddr());
|
|
|
-// iotXycbimgListResVo.setXycbimgCreatedDate(iotXycbimg.getXycbimgCreatedDate());
|
|
|
-//
|
|
|
-// iotXycbimgListResVoList.add(iotXycbimgListResVo);
|
|
|
-// }
|
|
|
-// listPage.setRecords(iotXycbimgListResVoList);
|
|
|
-//
|
|
|
-// return listPage;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * @param xycbimgBid
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// @Override
|
|
|
-// public void imageDelete(String xycbimgBid) {
|
|
|
-// Map<String, String> selectMap = new HashMap<>();
|
|
|
-// selectMap.put("xycbimgBid", xycbimgBid);
|
|
|
-// IotXycbimg iotXycbimg = (IotXycbimg) mongoService.findOne(IotXycbimg.class, selectMap, null, null);
|
|
|
-// if(iotXycbimg == null){
|
|
|
-// throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "图片不存在");
|
|
|
-// }
|
|
|
-//
|
|
|
-// Criteria criteria = Criteria.where("xycbimgBid").is(xycbimgBid);
|
|
|
-// Query query = new Query(criteria);
|
|
|
-//
|
|
|
-// Map<String, Object> updateField = new HashMap<>();
|
|
|
-// updateField.put("xycbimgDelstatus", "1");
|
|
|
-// updateField.put("xycbimgModifieddate", DateUtils.dateTimeNow());
|
|
|
-//
|
|
|
-// mongoService.update(IotXycbimg.class, query, updateField);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 获取性诱设备数据列表
|
|
|
-// *
|
|
|
-// * @param iotXycbReqVo
|
|
|
-// */
|
|
|
-// @Override
|
|
|
-// public IPage<IotYfXycbDataListRspVo> getXycbDataList(IotXycbReqVo iotXycbReqVo) {
|
|
|
-// String devBid = iotXycbReqVo.getDevBid();
|
|
|
-// IPage<IotYfXycbDataListRspVo> iPage = new Page<>();
|
|
|
-//
|
|
|
-// IotDevice iotDevice = iIotDeviceService.findOneByBizId(devBid);
|
|
|
-// if(iotDevice == null){
|
|
|
-// throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备不存在");
|
|
|
-// }
|
|
|
-// String devtypeBid = iotDevice.getDevtypeBid();
|
|
|
-// if (IotDeviceDictConst.TYPE_YF_XYCB_2.equals(devtypeBid)) {
|
|
|
-// iPage = getYfXycb2DataList(iotXycbReqVo);
|
|
|
-// }else if (IotDeviceDictConst.TYPE_ZJSF_XYCB.equals(devtypeBid)) {
|
|
|
-// iPage = getZjsfXycbDataList(iotXycbReqVo);
|
|
|
-// }
|
|
|
-// return iPage;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 性诱测报2.0
|
|
|
-// * @param
|
|
|
-// */
|
|
|
-// public List<IotXycbPolylineResVo> getXycb2Polyline(IotXycbReqVo reqVo){
|
|
|
-// String devBid = reqVo.getDevBid();
|
|
|
-// String startDate = reqVo.getStartDate();
|
|
|
-// String endDate = reqVo.getEndDate();
|
|
|
-//
|
|
|
-// String unit = "day";
|
|
|
-// Criteria criteria = new Criteria().and("devBid").is(devBid);
|
|
|
-// if (StringUtils.isNotEmpty(startDate) && StringUtils.isNotEmpty(endDate)) {
|
|
|
-// criteria = criteria.andOperator(
|
|
|
-// Criteria.where("xycb2dataCreatedDate").gte(startDate),
|
|
|
-// Criteria.where("xycb2dataCreatedDate").lte(endDate)
|
|
|
-// );
|
|
|
-// long diffTime = DateUtils.parseDate(endDate).getTime() - DateUtils.parseDate(startDate).getTime();
|
|
|
-// if (diffTime <= 48 * 60 * 60 * 1000) {
|
|
|
-// unit = "minute";
|
|
|
-// } else if (diffTime <= 30L * 24 * 60 * 60 * 1000) {
|
|
|
-// unit = "hour";
|
|
|
-// }
|
|
|
-// } else if (StringUtils.isNotEmpty(startDate)) {
|
|
|
-// criteria = criteria.and("xycb2dataCreatedDate").gte(startDate);
|
|
|
-// } else if (StringUtils.isNotEmpty(endDate)) {
|
|
|
-// criteria = criteria.and("xycb2dataCreatedDate").lte(endDate);
|
|
|
-// }
|
|
|
-// MatchOperation matchOperation = Aggregation.match(criteria);
|
|
|
-//
|
|
|
-// ProjectionOperation projectionOperation = Aggregation.project()
|
|
|
-// .and("xycb2dataContent.ah").as("ah")
|
|
|
-// .and("xycb2dataContent.at").as("at")
|
|
|
-// .and("xycb2dataContent.ct").as("ct")
|
|
|
-// .and("xycb2dataCreatedDate").as("createDate");
|
|
|
-//
|
|
|
-// ProjectionOperation projectionOperation2 = Aggregation.project()
|
|
|
-// .andExpression("{$convert: {input: '$ct', to: 'int', onError: 0, onNull: 0}}").as("ct")
|
|
|
-// .andExpression("{$convert: {input: '$at', to: 'double', onError: -99, onNull: -99}}").as("at")
|
|
|
-// .andExpression("{$convert: {input: '$ah', to: 'double', onError: -99, onNull: -99}}").as("ah")
|
|
|
-// .andExpression("{$dateTrunc: {date: {$toDate: '$createDate'}, unit:'" + unit + "'}}").as("createDate");
|
|
|
-//
|
|
|
-// GroupOperation groupOperation = Aggregation.group("createDate")
|
|
|
-// .avg("ah").as("ah")
|
|
|
-// .avg("at").as("at")
|
|
|
-// .sum("ct").as("ct");
|
|
|
-//
|
|
|
-// ProjectionOperation projectionOperation3 = Aggregation.project("ct")
|
|
|
-// .andExpression("{$trunc: {'$ah', 1}}").as("ah")
|
|
|
-// .andExpression("{$trunc: {'$at', 1}}").as("at")
|
|
|
-// .andExpression("{$dateToString: {format: '%Y-%m-%d %H:%M:%S', date: '$_id'}}").as("createDate");
|
|
|
-//
|
|
|
-// SortOperation sortOperation = Aggregation.sort(Sort.Direction.ASC, "createDate");
|
|
|
-//
|
|
|
-// Aggregation aggregation = Aggregation.newAggregation(
|
|
|
-// matchOperation,
|
|
|
-// projectionOperation,
|
|
|
-// projectionOperation2,
|
|
|
-// groupOperation,
|
|
|
-// projectionOperation3,
|
|
|
-// sortOperation
|
|
|
-// );
|
|
|
-//
|
|
|
-// List<IotXycbPolylineResVo> iotXycbPolylineResVos = mongoService.aggregate(
|
|
|
-// IotYfXycb2data.class, aggregation, IotXycbPolylineResVo.class
|
|
|
-// );
|
|
|
-// return iotXycbPolylineResVos;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 性诱测报2.0
|
|
|
-// * @param
|
|
|
-// */
|
|
|
-// public List<IotXycbPolylineResVo> getZjsfXycbPolyline(IotXycbReqVo reqVo){
|
|
|
-// String devBid = reqVo.getDevBid();
|
|
|
-// String startDate = reqVo.getStartDate();
|
|
|
-// String endDate = reqVo.getEndDate();
|
|
|
-//
|
|
|
-// String unit = "day";
|
|
|
-// Criteria criteria = new Criteria().and("devBid").is(devBid);
|
|
|
-// if (StringUtils.isNotEmpty(startDate) && StringUtils.isNotEmpty(endDate)) {
|
|
|
-// criteria = criteria.andOperator(
|
|
|
-// Criteria.where("xycbdataCreatedDate").gte(startDate),
|
|
|
-// Criteria.where("xycbdataCreatedDate").lte(endDate)
|
|
|
-// );
|
|
|
-// long diffTime = DateUtils.parseDate(endDate).getTime() - DateUtils.parseDate(startDate).getTime();
|
|
|
-// if (diffTime <= 48 * 60 * 60 * 1000) {
|
|
|
-// unit = "minute";
|
|
|
-// } else if (diffTime <= 30L * 24 * 60 * 60 * 1000) {
|
|
|
-// unit = "hour";
|
|
|
-// }
|
|
|
-// } else if (StringUtils.isNotEmpty(startDate)) {
|
|
|
-// criteria = criteria.and("xycbdataCreatedDate").gte(startDate);
|
|
|
-// } else if (StringUtils.isNotEmpty(endDate)) {
|
|
|
-// criteria = criteria.and("xycbdataCreatedDate").lte(endDate);
|
|
|
-// }
|
|
|
-// MatchOperation matchOperation = Aggregation.match(criteria);
|
|
|
-//
|
|
|
-// ProjectionOperation projectionOperation = Aggregation.project()
|
|
|
-// .and("xycbdataContent.ah").as("ah")
|
|
|
-// .and("xycbdataContent.at").as("at")
|
|
|
-// .and("xycbdataContent.ct").as("ct")
|
|
|
-// .and("xycbdataCreatedDate").as("createDate");
|
|
|
-//
|
|
|
-// ProjectionOperation projectionOperation2 = Aggregation.project()
|
|
|
-// .andExpression("{$convert: {input: '$ct', to: 'int', onError: 0, onNull: 0}}").as("ct")
|
|
|
-// .andExpression("{$convert: {input: '$at', to: 'double', onError: -99, onNull: -99}}").as("at")
|
|
|
-// .andExpression("{$convert: {input: '$ah', to: 'double', onError: -99, onNull: -99}}").as("ah")
|
|
|
-// .andExpression("{$dateTrunc: {date: {$toDate: '$createDate'}, unit:'" + unit + "'}}").as("createDate");
|
|
|
-//
|
|
|
-// GroupOperation groupOperation = Aggregation.group("createDate")
|
|
|
-// .avg("ah").as("ah")
|
|
|
-// .avg("at").as("at")
|
|
|
-// .sum("ct").as("ct");
|
|
|
-//
|
|
|
-// ProjectionOperation projectionOperation3 = Aggregation.project("ct")
|
|
|
-// .andExpression("{$trunc: {'$ah', 1}}").as("ah")
|
|
|
-// .andExpression("{$trunc: {'$at', 1}}").as("at")
|
|
|
-// .andExpression("{$dateToString: {format: '%Y-%m-%d %H:%M:%S', date: '$_id'}}").as("createDate");
|
|
|
-//
|
|
|
-// SortOperation sortOperation = Aggregation.sort(Sort.Direction.ASC, "createDate");
|
|
|
-//
|
|
|
-// Aggregation aggregation = Aggregation.newAggregation(
|
|
|
-// matchOperation,
|
|
|
-// projectionOperation,
|
|
|
-// projectionOperation2,
|
|
|
-// groupOperation,
|
|
|
-// projectionOperation3,
|
|
|
-// sortOperation
|
|
|
-// );
|
|
|
-//
|
|
|
-// List<IotXycbPolylineResVo> iotXycbPolylineResVos = mongoService.aggregate(
|
|
|
-// IotZjsfXycbdata.class, aggregation, IotXycbPolylineResVo.class
|
|
|
-// );
|
|
|
-// return iotXycbPolylineResVos;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 获取性诱测报折线图数据
|
|
|
-// *
|
|
|
-// * @param iotXycbReqVo
|
|
|
-// */
|
|
|
-// @Override
|
|
|
-// public List<IotXycbPolylineResVo> getXycbPolyline(IotXycbReqVo iotXycbReqVo) {
|
|
|
-// String devBid = iotXycbReqVo.getDevBid();
|
|
|
-// 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(), "设备不存在");
|
|
|
-// }
|
|
|
-//
|
|
|
-// List<IotXycbPolylineResVo> iotXycbPolylineResVoList = new ArrayList<>();
|
|
|
-// if (IotDeviceDictConst.TYPE_YF_XYCB_2.equals(iotDevice.getDevtypeBid())) {
|
|
|
-// iotXycbPolylineResVoList = getXycb2Polyline(iotXycbReqVo);
|
|
|
-// }else if (IotDeviceDictConst.TYPE_ZJSF_XYCB.equals(iotDevice.getDevtypeBid())) {
|
|
|
-// iotXycbPolylineResVoList = getZjsfXycbPolyline(iotXycbReqVo);
|
|
|
-// }
|
|
|
-// return iotXycbPolylineResVoList;
|
|
|
-// }
|
|
|
-//
|
|
|
-// private IotXycbInfoResVo getXycb2Info(String devBid, IotXycbInfoResVo iotXycbInfoResVo){
|
|
|
-// HashMap<String, String> params = new HashMap<>();
|
|
|
-// params.put("devBid", devBid);
|
|
|
-//
|
|
|
-// IotYfXycb2data iotYfXycb2data = (IotYfXycb2data) mongoService.findOne(IotYfXycb2data.class, params, "xycb2dataCreatedDate", "desc");
|
|
|
-// if(iotYfXycb2data != null){
|
|
|
-// JSONObject xyData = iotYfXycb2data.getXycb2dataContent();
|
|
|
-// 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);
|
|
|
-// 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);
|
|
|
-// }
|
|
|
-// return iotXycbInfoResVo;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 修改诱芯信息
|
|
|
-// *
|
|
|
-// * @param iotXycbModifyLureReqVo
|
|
|
-// */
|
|
|
-// @Override
|
|
|
-// public int modifyLure(IotXycbModifyLureReqVo iotXycbModifyLureReqVo) {
|
|
|
-// String devBid = iotXycbModifyLureReqVo.getDevBid();
|
|
|
-// String pestBusid = iotXycbModifyLureReqVo.getPestBusid();
|
|
|
-// IotPest iotPest = iotPestService.selectIotPestByPestBid(pestBusid);
|
|
|
-// if(iotPest == null){
|
|
|
-// throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "诱芯不存在");
|
|
|
-// }
|
|
|
-// IotXyinfoDto iotXyinfoDto = iIotXyinfoService.selectIotXyinfoByDevBid(devBid);
|
|
|
-//
|
|
|
-// IotXyinfo iotXyinfo = new IotXyinfo();
|
|
|
-// iotXyinfo.setDevBid(iotXycbModifyLureReqVo.getDevBid());
|
|
|
-// iotXyinfo.setPestBusid(iotPest.getPestBid());
|
|
|
-// iotXyinfo.setXyinfoLurename(iotPest.getPestName());
|
|
|
-// iotXyinfo.setXyinfoLureexpireddate(iotXycbModifyLureReqVo.getXyinfoLureexpireddate());
|
|
|
-// iotXyinfo.setXyinfoModifier(SecurityUtils.getUserId());
|
|
|
-// iotXyinfo.setXyinfoModifieddate(DateUtils.dateTimeNow());
|
|
|
-//
|
|
|
-// int status = 0;
|
|
|
-// if(iotXyinfoDto == null){
|
|
|
-// iotXyinfo.setXyinfoBid(iotXyinfo.getUUId());
|
|
|
-// iotXyinfo.setXyinfoCreator(SecurityUtils.getUserId());
|
|
|
-// iotXyinfo.setXyinfoCreatedDate(DateUtils.dateTimeNow());
|
|
|
-// iotXyinfo.setXyinfoDelstatus("0");
|
|
|
-//
|
|
|
-// status = iIotXyinfoService.insertIotXyinfo(iotXyinfo);
|
|
|
-// }else{
|
|
|
-// status = iIotXyinfoService.updateIotXyinfo(iotXyinfo);
|
|
|
-// }
|
|
|
-//
|
|
|
-// return status;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 获取诱芯列表
|
|
|
-// *
|
|
|
-// * @param iotXycbLureListReqVo
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// @Override
|
|
|
-// public List<IotXycbLureListRspVo> getLureList(IotXycbLureListReqVo iotXycbLureListReqVo) {
|
|
|
-// IotPest selectIotPest = new IotPest();
|
|
|
-// selectIotPest.setPestName(iotXycbLureListReqVo.getPestName());
|
|
|
-//
|
|
|
-// startPage();
|
|
|
-// List<IotPest> iotPestList = iotPestService.selectIotPestList(selectIotPest);
|
|
|
-// List<IotXycbLureListRspVo> iotXycbLureListRspVoList = new ArrayList<>();
|
|
|
-// for(IotPest iotPest: iotPestList){
|
|
|
-// IotXycbLureListRspVo iotXycbLureListRspVo = new IotXycbLureListRspVo();
|
|
|
-// iotXycbLureListRspVo.setPestName(iotPest.getPestName());
|
|
|
-// iotXycbLureListRspVo.setPestBusid(iotPest.getPestBid());
|
|
|
-//
|
|
|
-// iotXycbLureListRspVoList.add(iotXycbLureListRspVo);
|
|
|
-// }
|
|
|
-// return iotXycbLureListRspVoList;
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-//}
|
|
|
+package com.yunfeiyun.agmp.iotm.device.xycb.service.impl;
|
|
|
+
|
|
|
+import com.yunfeiyun.agmp.iot.common.constant.devicetype.ServiceNameConst;
|
|
|
+import com.yunfeiyun.agmp.iotm.device.xycb.service.IIotXycbCommService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Service(value = ServiceNameConst.SERVICE_YF_XYCB_III)
|
|
|
+public class IotXycbIIIServiceImpl extends IIotXycbCommService {
|
|
|
+
|
|
|
+}
|