|
|
@@ -1,24 +1,24 @@
|
|
|
package com.yunfeiyun.agmp.iotm.device.pest.service.impl;
|
|
|
|
|
|
-import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.yunfeiyun.agmp.common.core.page.PageDomain;
|
|
|
import com.yunfeiyun.agmp.common.utils.StringUtils;
|
|
|
-import com.yunfeiyun.agmp.iot.common.domain.*;
|
|
|
+import com.yunfeiyun.agmp.iot.common.domain.IotCbdimg;
|
|
|
+import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
|
|
|
+import com.yunfeiyun.agmp.iot.common.domain.IotPest;
|
|
|
+import com.yunfeiyun.agmp.iot.common.domain.IotYfXycb2data;
|
|
|
import com.yunfeiyun.agmp.iot.common.domain.resvo.IoPestResVo;
|
|
|
import com.yunfeiyun.agmp.iot.common.enums.EnumCbdMarkType;
|
|
|
import com.yunfeiyun.agmp.iot.common.service.MongoService;
|
|
|
import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceDataListReqVo;
|
|
|
-import com.yunfeiyun.agmp.iotm.device.pest.domain.IotPestRecogPeriodReqVo;
|
|
|
-import com.yunfeiyun.agmp.iotm.device.pest.domain.IotPestrecogGroupByNameResVo;
|
|
|
-import com.yunfeiyun.agmp.iotm.device.pest.domain.IotPestrecogListExportResVo;
|
|
|
-import com.yunfeiyun.agmp.iotm.device.pest.domain.IotPestrecogListResVo;
|
|
|
+import com.yunfeiyun.agmp.iotm.device.pest.domain.*;
|
|
|
import com.yunfeiyun.agmp.iotm.device.pest.service.IIotPestService;
|
|
|
import com.yunfeiyun.agmp.iotm.device.pest.service.IIotPestrecogService;
|
|
|
import com.yunfeiyun.agmp.iotm.device.xy.domain.IotXyinfoPestTotalDto;
|
|
|
import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.mongodb.core.aggregation.*;
|
|
|
@@ -302,91 +302,144 @@ public class IotPestrecogServiceImpl implements IIotPestrecogService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<IotPestrecog> groupByDateName(IotDeviceDataListReqVo reqVo) {
|
|
|
+ public List<IotPestrecogGroupByNameListResVo> groupByDateName(IotDeviceDataListReqVo reqVo) {
|
|
|
String startTime = reqVo.getStartTime();
|
|
|
String endTime = reqVo.getEndTime();
|
|
|
String devBid = reqVo.getDevBid();
|
|
|
- String cbdRecogType = "";
|
|
|
- String pestrecogMarktype = "";
|
|
|
-// String cbdRecogType = reqVo.getCbdRecogType();
|
|
|
-// String pestrecogMarktype = reqVo.getPestrecogMarktype();
|
|
|
+ String cbdrecogType = reqVo.getCbdrecogType();
|
|
|
+ String cbdrecogMarktype = reqVo.getCbdrecogMarktype();
|
|
|
+ String unit = "day";
|
|
|
|
|
|
Criteria criteria = new Criteria()
|
|
|
.and("devBid").is(devBid)
|
|
|
.and("cbdimgDelstatus").is("0");
|
|
|
+
|
|
|
if (StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime)) {
|
|
|
criteria = criteria.andOperator(
|
|
|
- Criteria.where("cbdimgCreatedDate").gte(startTime),
|
|
|
- Criteria.where("cbdimgCreatedDate").lte(endTime)
|
|
|
+ Criteria.where("cbdrecog." + cbdrecogType + ".cbdrecogModifieddate").gte(startTime),
|
|
|
+ Criteria.where("cbdrecog." + cbdrecogType + ".cbdrecogModifieddate").lte(endTime)
|
|
|
);
|
|
|
} else if (StringUtils.isNotEmpty(startTime)) {
|
|
|
- criteria = criteria.and("cbdimgCreatedDate").gte(startTime);
|
|
|
+ criteria = criteria.and("cbdrecog." + cbdrecogType + ".cbdrecogModifieddate").gte(startTime);
|
|
|
} else if (StringUtils.isNotEmpty(endTime)) {
|
|
|
- criteria = criteria.and("cbdimgCreatedDate").lte(endTime);
|
|
|
+ criteria = criteria.and("cbdrecog." + cbdrecogType + ".cbdrecogModifieddate").lte(endTime);
|
|
|
}
|
|
|
+ criteria = criteria.and("cbdrecog." + cbdrecogType + ".pestrecog." + cbdrecogMarktype + ".pestBusid").exists(true);
|
|
|
+
|
|
|
MatchOperation matchOperation = Aggregation.match(criteria);
|
|
|
|
|
|
ProjectionOperation projectionOperation = Aggregation.project()
|
|
|
- .andExclude("_id")
|
|
|
- .and("$$ROOT").as("c");
|
|
|
+ .and("cbdrecog." + cbdrecogType + ".pestrecog." + cbdrecogMarktype).as("pestrecog");
|
|
|
|
|
|
- LookupOperation lookupOperationIotCbdrecog = Aggregation.lookup(
|
|
|
- "IotCbdrecog", "c.cbdimgBid", "cbdimgBid", "ce"
|
|
|
- );
|
|
|
- Criteria cbdRecogCriteria = new Criteria()
|
|
|
- .and("ce.cbdrecogType").is(cbdRecogType)
|
|
|
- .and("ce.cbdrecogMarktype").is(pestrecogMarktype);
|
|
|
- MatchOperation cbdRecogMatchOperation = Aggregation.match(cbdRecogCriteria);
|
|
|
- UnwindOperation unwindOperationCe = Aggregation.unwind("ce", false);
|
|
|
-
|
|
|
- LookupOperation lookupOperationIotCbdpest = Aggregation.lookup(
|
|
|
- "IotCbdpest", "ce.cbdrecogBid", "cbdrecogBid", "cp"
|
|
|
+ UnwindOperation unwindOperation = Aggregation.unwind("pestrecog", false);
|
|
|
+
|
|
|
+ ProjectionOperation projectionOperation2 = Aggregation.project()
|
|
|
+ .and("pestrecog.pestBusid").as("pestBusid")
|
|
|
+ .and("pestrecog.pestName").as("pestName")
|
|
|
+ .and("pestrecog.pestrecogNum").as("pestrecogNum")
|
|
|
+ .andExpression(
|
|
|
+ "{$dateTrunc: {date: {$dateFromString: {dateString: '$pestrecog.pestrecogCreatedDate', format: '%Y-%m-%d %H:%M:%S'}}, unit:'" + unit + "'}}").as("date");
|
|
|
+ GroupOperation groupOperation = Aggregation.group("date", "pestBusid")
|
|
|
+ .sum("pestrecogNum").as("pestrecogNum")
|
|
|
+ .first("pestName").as("pestName");
|
|
|
+
|
|
|
+ Map<String, String> sumMap = new HashMap<>();
|
|
|
+ sumMap.put("$toInt", "$pestrecogNum");
|
|
|
+
|
|
|
+ Map<String, Object> dateMap = new HashMap<>();
|
|
|
+ dateMap.put("sum", "$pestrecogNum");
|
|
|
+ dateMap.put("pestName", "$pestName");
|
|
|
+ dateMap.put("pestBid", "$_id.pestBusid");
|
|
|
+
|
|
|
+ GroupOperation groupOperation2 = Aggregation.group("$_id.date")
|
|
|
+ .push(dateMap).as("data");
|
|
|
+ SortOperation sortOperation = Aggregation.sort(Sort.Direction.ASC, "_id");
|
|
|
+
|
|
|
+ ProjectionOperation projectionOperationResult = Aggregation.project()
|
|
|
+ .and("data").as("data")
|
|
|
+ .andExpression("{'$dateToString':{'date': '$_id', 'format': '%Y-%m-%d'}}").as("date");
|
|
|
+
|
|
|
+ Aggregation aggregation = Aggregation.newAggregation(
|
|
|
+ matchOperation,
|
|
|
+ projectionOperation,
|
|
|
+ unwindOperation,
|
|
|
+ projectionOperation2,
|
|
|
+ groupOperation,
|
|
|
+ groupOperation2,
|
|
|
+ sortOperation,
|
|
|
+ projectionOperationResult
|
|
|
);
|
|
|
- UnwindOperation unwindOperationCp = Aggregation.unwind("cp", false);
|
|
|
|
|
|
- LookupOperation lookupOperationIotPestrecog = Aggregation.lookup(
|
|
|
- "IotPestrecog", "cp.pestrecogBid", "pestrecogBid", "pr"
|
|
|
+ List<IotPestrecogGroupByNameListResVo> iotPestrecogGroupByNameResVoList = mongoService.aggregate(
|
|
|
+ IotCbdimg.class, aggregation, IotPestrecogGroupByNameListResVo.class
|
|
|
);
|
|
|
- UnwindOperation unwindOperationPr = Aggregation.unwind("pr", false);
|
|
|
- Criteria pestRecogCriteria = new Criteria()
|
|
|
- .and("pr.pestrecogMarktype").is(pestrecogMarktype);
|
|
|
- MatchOperation pestRecogMatchOperation = Aggregation.match(pestRecogCriteria);
|
|
|
+ return iotPestrecogGroupByNameResVoList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<IotPestrecogGroupPestListResVo> groupByPestList(IotDeviceDataListReqVo reqVo) {
|
|
|
+ String startTime = reqVo.getStartTime();
|
|
|
+ String endTime = reqVo.getEndTime();
|
|
|
+ String devBid = reqVo.getDevBid();
|
|
|
+ String cbdrecogType = reqVo.getCbdrecogType();
|
|
|
+ String cbdrecogMarktype = reqVo.getCbdrecogMarktype();
|
|
|
+
|
|
|
+ Criteria criteria = new Criteria()
|
|
|
+ .and("devBid").is(devBid)
|
|
|
+ .and("cbdimgDelstatus").is("0");
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime)) {
|
|
|
+ criteria = criteria.andOperator(
|
|
|
+ Criteria.where("cbdrecog." + cbdrecogType + ".cbdrecogModifieddate").gte(startTime),
|
|
|
+ Criteria.where("cbdrecog." + cbdrecogType + ".cbdrecogModifieddate").lte(endTime)
|
|
|
+ );
|
|
|
+ } else if (StringUtils.isNotEmpty(startTime)) {
|
|
|
+ criteria = criteria.and("cbdrecog." + cbdrecogType + ".cbdrecogModifieddate").gte(startTime);
|
|
|
+ } else if (StringUtils.isNotEmpty(endTime)) {
|
|
|
+ criteria = criteria.and("cbdrecog." + cbdrecogType + ".cbdrecogModifieddate").lte(endTime);
|
|
|
+ }
|
|
|
+ criteria = criteria.and("cbdrecog." + cbdrecogType + ".pestrecog." + cbdrecogMarktype + ".pestBusid").exists(true);
|
|
|
+
|
|
|
+ MatchOperation matchOperation = Aggregation.match(criteria);
|
|
|
+
|
|
|
+ ProjectionOperation projectionOperation = Aggregation.project()
|
|
|
+ .and("cbdrecog." + cbdrecogType + ".pestrecog." + cbdrecogMarktype).as("pestrecog");
|
|
|
+
|
|
|
+ UnwindOperation unwindOperation = Aggregation.unwind("pestrecog", false);
|
|
|
|
|
|
ProjectionOperation projectionOperation2 = Aggregation.project()
|
|
|
- .and("pr.pestBusid").as("pestBusid")
|
|
|
- .and("pr.pestrecogNum").as("pestrecogNum")
|
|
|
- .andExpression(
|
|
|
- "{$dateTrunc: {date: {$dateFromString: {dateString: '$pr.pestrecogCreatedDate', format: '%Y-%m-%d %H:%M:%S'}}, unit:'day'}}").as("pestrecogCreatedDate");
|
|
|
+ .and("pestrecog.pestBusid").as("pestBusid")
|
|
|
+ .and("pestrecog.pestName").as("pestName")
|
|
|
+ .and("pestrecog.pestrecogNum").as("pestrecogNum");
|
|
|
+
|
|
|
+ GroupOperation groupOperation = Aggregation.group("pestBusid")
|
|
|
+ .sum("pestrecogNum").as("pestrecogNum")
|
|
|
+ .first("pestName").as("pestName");
|
|
|
+
|
|
|
+ SortOperation sortOperation = Aggregation.sort(Sort.Direction.DESC, "pestrecogNum");
|
|
|
|
|
|
- GroupOperation groupOperation = Aggregation.group("pestrecogCreatedDate", "pestBusid")
|
|
|
- .sum("pestrecogNum").as("pestrecogNum");
|
|
|
- ProjectionOperation projectionOperation3 = Aggregation.project()
|
|
|
- .and("_id.pestBusid").as("pestBusid")
|
|
|
+ ProjectionOperation projectionOperationResult = Aggregation.project()
|
|
|
+ .and("_id").as("pestBusid")
|
|
|
.and("pestrecogNum").as("pestrecogNum")
|
|
|
- .andExpression(
|
|
|
- "{$dateToString: { format: '%Y-%m-%d', date: '$_id.pestrecogCreatedDate'}}").as("pestrecogCreatedDate");
|
|
|
+ .and("pestName").as("pestName");
|
|
|
|
|
|
Aggregation aggregation = Aggregation.newAggregation(
|
|
|
matchOperation,
|
|
|
projectionOperation,
|
|
|
- lookupOperationIotCbdrecog,
|
|
|
- unwindOperationCe,
|
|
|
- cbdRecogMatchOperation,
|
|
|
- lookupOperationIotCbdpest,
|
|
|
- unwindOperationCp,
|
|
|
- lookupOperationIotPestrecog,
|
|
|
- unwindOperationPr,
|
|
|
- pestRecogMatchOperation,
|
|
|
+ unwindOperation,
|
|
|
projectionOperation2,
|
|
|
groupOperation,
|
|
|
- projectionOperation3
|
|
|
+ sortOperation,
|
|
|
+ projectionOperationResult
|
|
|
);
|
|
|
- List<IotPestrecog> iotPestrecogList = mongoService.aggregate(
|
|
|
- IotCbdimg.class, aggregation, IotPestrecog.class
|
|
|
+
|
|
|
+ List<IotPestrecogGroupPestListResVo> iotPestrecogGroupPestListResVoList = mongoService.aggregate(
|
|
|
+ IotCbdimg.class, aggregation, IotPestrecogGroupPestListResVo.class
|
|
|
);
|
|
|
- return iotPestrecogList;
|
|
|
+ return iotPestrecogGroupPestListResVoList;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 获取性诱设备虫情识别总数
|
|
|
* @param devBidList
|
|
|
@@ -442,101 +495,89 @@ public class IotPestrecogServiceImpl implements IIotPestrecogService {
|
|
|
* @param reqVo
|
|
|
*/
|
|
|
@Override
|
|
|
- public Map<String, Object> period(IotPestRecogPeriodReqVo reqVo) {
|
|
|
- String devBid = reqVo.getDevBid();
|
|
|
+ public IotPestRecogPeriodInfoResVo period(IotPestRecogPeriodReqVo reqVo) {
|
|
|
String startTime = reqVo.getStartTime();
|
|
|
String endTime = reqVo.getEndTime();
|
|
|
+ String devBid = reqVo.getDevBid();
|
|
|
+ String cbdrecogType = reqVo.getCbdrecogType();
|
|
|
+ String cbdrecogMarktype = reqVo.getCbdrecogMarktype();
|
|
|
String pestBusid = reqVo.getPestBid();
|
|
|
+ String pestName = reqVo.getPestName();
|
|
|
+
|
|
|
+ Criteria criteria = new Criteria()
|
|
|
+ .and("devBid").is(devBid)
|
|
|
+ .and("cbdimgDelstatus").is("0")
|
|
|
+ .and("cbdrecog." + cbdrecogType + ".pestrecog." + cbdrecogMarktype + ".pestBusid").is(pestBusid);
|
|
|
|
|
|
- Criteria criteria = new Criteria().and("devBid").is(devBid).and("pestBusid").is(pestBusid);
|
|
|
- if(StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime)){
|
|
|
+ if (StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime)) {
|
|
|
criteria = criteria.andOperator(
|
|
|
- Criteria.where("pestrecogCreatedDate").gte(startTime),
|
|
|
- Criteria.where("pestrecogCreatedDate").lte(endTime)
|
|
|
+ Criteria.where("cbdrecog." + cbdrecogType + ".cbdrecogModifieddate").gte(startTime),
|
|
|
+ Criteria.where("cbdrecog." + cbdrecogType + ".cbdrecogModifieddate").lte(endTime)
|
|
|
);
|
|
|
} else if (StringUtils.isNotEmpty(startTime)) {
|
|
|
- criteria = criteria.and("pestrecogCreatedDate").gte(startTime);
|
|
|
+ criteria = criteria.and("cbdrecog." + cbdrecogType + ".cbdrecogModifieddate").gte(startTime);
|
|
|
} else if (StringUtils.isNotEmpty(endTime)) {
|
|
|
- criteria = criteria.and("pestrecogCreatedDate").lte(endTime);
|
|
|
+ criteria = criteria.and("cbdrecog." + cbdrecogType + ".cbdrecogModifieddate").lte(endTime);
|
|
|
}
|
|
|
|
|
|
MatchOperation matchOperation = Aggregation.match(criteria);
|
|
|
|
|
|
- ProjectionOperation projectionOperation = Aggregation.project("_id")
|
|
|
- .and("pestrecogNum").as("pestrecogNum")
|
|
|
- .andExpression("{$dateTrunc: {date: {$dateFromString: {dateString: '$pestrecogCreatedDate', format: '%Y-%m-%d %H:%M:%S'}}, unit:'day'}}").as("date");
|
|
|
-
|
|
|
- GroupOperation groupOperation = Aggregation.group("date")
|
|
|
- .sum("pestrecogNum").as("pestrecogNum");
|
|
|
-
|
|
|
- ProjectionOperation projectionOperation2 = Aggregation.project("_id")
|
|
|
- .and("_id").as("date")
|
|
|
- .and("pestrecogNum").as("pestrecogNum")
|
|
|
- .andExpression("{$dateToString: {'date': '$_id', 'format': '%Y-%m-%d %H:%M:%S'}}").as("dataStr");
|
|
|
+ ProjectionOperation projectionOperation = Aggregation.project()
|
|
|
+ .and("cbdrecog." + cbdrecogType + ".pestrecog." + cbdrecogMarktype).as("pestrecog");
|
|
|
|
|
|
- SortOperation sortOperation = Aggregation.sort(Sort.Direction.ASC, "date");
|
|
|
+ UnwindOperation unwindOperation = Aggregation.unwind("pestrecog", false);
|
|
|
|
|
|
- GroupOperation groupOperation2 = Aggregation.group()
|
|
|
- .push("$$ROOT").as("dataList");
|
|
|
+ Criteria criteria2 = new Criteria().and("pestrecog.pestBusid").is(pestBusid);
|
|
|
+ MatchOperation matchOperation2 = Aggregation.match(criteria2);
|
|
|
|
|
|
- ProjectionOperation projectionOperation3 = Aggregation.project()
|
|
|
- .and("dataList").as("dataList")
|
|
|
- .andExpression("{'$first': '$dataList'}").as("seeTimeInfo")
|
|
|
- .andExpression("{'$last': '$dataList'}").as("endInPeriodInfo");
|
|
|
+ ProjectionOperation projectionOperation2 = Aggregation.project()
|
|
|
+ .and("pestrecog.pestBusid").as("pestBusid")
|
|
|
+ .and("pestrecog.pestName").as("pestName")
|
|
|
+ .and("pestrecog.pestrecogNum").as("pestrecogNum")
|
|
|
+ .and("pestrecog.pestrecogCreatedDate").as("pestrecogCreatedDate");
|
|
|
|
|
|
- UnwindOperation unwindOperation = Aggregation.unwind("dataList");
|
|
|
+ SortOperation sortOperation = Aggregation.sort(Sort.Direction.ASC, "pestrecogCreatedDate");
|
|
|
|
|
|
- SortOperation sortOperation2 = Aggregation.sort(Sort.Direction.DESC, "dataList.pestrecogNum");
|
|
|
+ Map<String, String> dataMap = new HashMap<>();
|
|
|
+ dataMap.put("pestrecogNum", "$pestrecogNum");
|
|
|
+ dataMap.put("pestrecogCreatedDate", "$pestrecogCreatedDate");
|
|
|
|
|
|
- LimitOperation limitOperation = Aggregation.limit(1);
|
|
|
+ GroupOperation groupOperation = Aggregation.group()
|
|
|
+ .first("pestName").as("pestName")
|
|
|
+ .push(dataMap).as("dataList");
|
|
|
|
|
|
- ProjectionOperation projectionOperation4 = Aggregation.project()
|
|
|
- .and("seeTimeInfo").as("seeTimeInfo")
|
|
|
- .and("endInPeriodInfo").as("endInPeriodInfo")
|
|
|
- .and("dataList").as("fastigiumInfo");
|
|
|
+ ProjectionOperation projectionOperationResult = Aggregation.project()
|
|
|
+ .and("pestName").as("pestName")
|
|
|
+ .andExpression("{'$substrBytes': {{'$first': '$dataList.pestrecogCreatedDate'}, 0, 10}}").as("seeTimes")
|
|
|
+ .andExpression("{'$substrBytes': {{'$last': '$dataList.pestrecogCreatedDate'}, 0, 10}}").as("endInPeriod")
|
|
|
+ .andExpression("{'$substrBytes': {{'$max': '$dataList.pestrecogCreatedDate'}, 0, 10}}").as("fastigium");
|
|
|
|
|
|
Aggregation aggregation = Aggregation.newAggregation(
|
|
|
matchOperation,
|
|
|
projectionOperation,
|
|
|
- groupOperation,
|
|
|
+ unwindOperation,
|
|
|
+ matchOperation2,
|
|
|
projectionOperation2,
|
|
|
sortOperation,
|
|
|
- groupOperation2,
|
|
|
- projectionOperation3,
|
|
|
- unwindOperation,
|
|
|
- sortOperation2,
|
|
|
- limitOperation,
|
|
|
- projectionOperation4
|
|
|
+ groupOperation,
|
|
|
+ projectionOperationResult
|
|
|
);
|
|
|
- List<JSONObject> jsonObjectList = mongoService.aggregate(
|
|
|
- IotPestrecog.class, aggregation, JSONObject.class
|
|
|
+ List<IotPestRecogPeriodInfoResVo> infoResVoList = mongoService.aggregate(
|
|
|
+ IotCbdimg.class, aggregation, IotPestRecogPeriodInfoResVo.class
|
|
|
);
|
|
|
-
|
|
|
- Map<String, Object> resultMap = new HashMap<>();
|
|
|
- resultMap.put("seeTimes", "");
|
|
|
- resultMap.put("fastigium", "");
|
|
|
- resultMap.put("fastigiumaNum", "");
|
|
|
- resultMap.put("endInPeriod", "");
|
|
|
-
|
|
|
- if(jsonObjectList.size() > 0){
|
|
|
- JSONObject result = jsonObjectList.get(0);
|
|
|
- resultMap.put("seeTimes", result.getJSONObject("seeTimeInfo").getString("dataStr"));
|
|
|
- resultMap.put("fastigium", result.getJSONObject("fastigiumInfo").getString("dataStr"));
|
|
|
- resultMap.put("fastigiumaNum", result.getJSONObject("fastigiumInfo").getInteger("pestrecogNum"));
|
|
|
- resultMap.put("endInPeriod", result.getJSONObject("endInPeriodInfo").getString("dataStr"));
|
|
|
- }
|
|
|
-
|
|
|
- IoPestResVo ioPestResVo = iotPestService.selectIotPestDetailByPestBid(reqVo.getPestBid());
|
|
|
- if (ioPestResVo == null) {
|
|
|
- ioPestResVo = new IoPestResVo();
|
|
|
+ IotPestRecogPeriodInfoResVo result = new IotPestRecogPeriodInfoResVo();
|
|
|
+ if(infoResVoList != null && !infoResVoList.isEmpty()){
|
|
|
+ result = infoResVoList.get(0);
|
|
|
+ IoPestResVo ioPestResVo = null;
|
|
|
+ if(Objects.equals(cbdrecogMarktype, EnumCbdMarkType.AUTO.getCode())){
|
|
|
+ ioPestResVo = iotPestService.selectIotPestDetailByPestBid(pestBusid);
|
|
|
+ }else{
|
|
|
+ ioPestResVo = iotPestService.selectIotPestDetailByPestName(pestName);
|
|
|
+ }
|
|
|
+ if(ioPestResVo != null){
|
|
|
+ BeanUtils.copyProperties(ioPestResVo, result);
|
|
|
+ }
|
|
|
}
|
|
|
- resultMap.put("pic", ioPestResVo.getPic());
|
|
|
- resultMap.put("course", ioPestResVo.getCourse());
|
|
|
- resultMap.put("calamRemark",ioPestResVo.getCalamRemark());
|
|
|
- resultMap.put("alias", "");
|
|
|
- String cropsList = iotPestService.selectIotPestCropsByCalarmId(ioPestResVo.getCalarmId());
|
|
|
- resultMap.put("crops", cropsList);
|
|
|
-
|
|
|
- return resultMap;
|
|
|
+ return result;
|
|
|
}
|
|
|
}
|