|
@@ -96,6 +96,15 @@ public class IotPestrecogController extends BaseController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据害虫分组统计数量
|
|
|
|
|
+ */
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('iot:pestrecog:group:pest:list')")
|
|
|
|
|
+ @GetMapping("/group/pest/list")
|
|
|
|
|
+ public AjaxResult groupByPestList(IotDeviceDataListReqVo reqVo) {
|
|
|
|
|
+ List<IotPestrecogGroupPestListResVo> results = iIotPestrecogService.groupByPestList(reqVo);
|
|
|
|
|
+ return AjaxResult.success(results);
|
|
|
|
|
+ }
|
|
|
//
|
|
//
|
|
|
// /**
|
|
// /**
|
|
|
// * 根据害虫分组统计数量
|
|
// * 根据害虫分组统计数量
|
|
@@ -173,99 +182,7 @@ public class IotPestrecogController extends BaseController {
|
|
|
// return AjaxResult.success(results);
|
|
// return AjaxResult.success(results);
|
|
|
// }
|
|
// }
|
|
|
//
|
|
//
|
|
|
-//// /**
|
|
|
|
|
-//// * 虫情趋势矩阵
|
|
|
|
|
-//// */
|
|
|
|
|
-//// @PreAuthorize("@ss.hasPermi('iot:pestrecog:group:date:name')")
|
|
|
|
|
-//// @GetMapping("/group/date/name")
|
|
|
|
|
-//// public AjaxResult groupByDateName(IotDeviceDataListReqVo reqVo) {
|
|
|
|
|
-//// if (StringUtils.isEmpty(reqVo.getStartTime()) || StringUtils.isEmpty(reqVo.getEndTime())) {
|
|
|
|
|
-//// return AjaxResult.error(ErrorCode.INVALID_PARAMETER.getCode(), "时间不能为空");
|
|
|
|
|
-//// }
|
|
|
|
|
-////
|
|
|
|
|
-////
|
|
|
|
|
-//// Criteria criteria = new Criteria();
|
|
|
|
|
-//// criteria.and("devBid").is(reqVo.getDevBid());
|
|
|
|
|
-//// if (StringUtils.isNotEmpty(reqVo.getPestrecogMarktype())) {
|
|
|
|
|
-//// criteria.and("pestrecogMarktype").is(reqVo.getPestrecogMarktype());
|
|
|
|
|
-//// }
|
|
|
|
|
-//// if (StringUtils.isNotEmpty(reqVo.getStartTime()) && StringUtils.isEmpty(reqVo.getEndTime())) {
|
|
|
|
|
-//// criteria.and("pestrecogCreatedDate").is(reqVo.getPestrecogMarktype());
|
|
|
|
|
-//// }
|
|
|
|
|
-//// if (StringUtils.isEmpty(reqVo.getStartTime()) && StringUtils.isNotEmpty(reqVo.getEndTime())) {
|
|
|
|
|
-//// criteria.and("pestrecogCreatedDate").is(reqVo.getPestrecogMarktype());
|
|
|
|
|
-//// }
|
|
|
|
|
-//// if (StringUtils.isNotEmpty(reqVo.getStartTime()) && StringUtils.isNotEmpty(reqVo.getEndTime())) {
|
|
|
|
|
-//// criteria.and("pestrecogCreatedDate").gte(reqVo.getStartTime()).lte(reqVo.getEndTime());
|
|
|
|
|
-//// }
|
|
|
|
|
-//// MatchOperation matchOperation = Aggregation.match(criteria);
|
|
|
|
|
-////
|
|
|
|
|
-//// ProjectionOperation projectionOperation = Aggregation.project()
|
|
|
|
|
-//// .andExclude("_id")
|
|
|
|
|
-//// .and("$$ROOT").as("c");
|
|
|
|
|
-////
|
|
|
|
|
-//// LookupOperation lookupOperationIotCbdpest = Aggregation.lookup(
|
|
|
|
|
-//// "IotCbdpest", "c.pestrecogBid", "pestrecogBid", "cp"
|
|
|
|
|
-//// );
|
|
|
|
|
-//// UnwindOperation unwindOperationCp = Aggregation.unwind("cp", true);
|
|
|
|
|
-////
|
|
|
|
|
-////
|
|
|
|
|
-//// LookupOperation lookupOperationIotCbdrecog = Aggregation.lookup(
|
|
|
|
|
-//// "IotCbdrecog", "cp.cbdrecogBid", "cbdrecogBid", "ce"
|
|
|
|
|
-//// );
|
|
|
|
|
-//// UnwindOperation unwindOperationCe = Aggregation.unwind("ce", true);
|
|
|
|
|
-//// Criteria criteria2 = new Criteria()
|
|
|
|
|
-//// .and("ce.cbdrecogType").is(reqVo.getCbdRecogType());
|
|
|
|
|
-//// MatchOperation matchOperation2 = Aggregation.match(criteria2);
|
|
|
|
|
-////
|
|
|
|
|
-//// GroupOperation group = Aggregation.group("c.pestBusid")
|
|
|
|
|
-//// .first("c.pestBusid").as("pestBusid")
|
|
|
|
|
-//// .first("c.pestrecogCreatedDate").as("pestrecogCreatedDate")
|
|
|
|
|
-//// .sum("c.pestrecogNum").as("pestrecogNum");// fieldName为要分组的字段名称,totalField为需要求和的字段名称
|
|
|
|
|
-////
|
|
|
|
|
-////
|
|
|
|
|
-//// Aggregation aggregation = Aggregation.newAggregation(
|
|
|
|
|
-//// matchOperation,
|
|
|
|
|
-//// projectionOperation,
|
|
|
|
|
-//// lookupOperationIotCbdpest,
|
|
|
|
|
-//// unwindOperationCp,
|
|
|
|
|
-//// lookupOperationIotCbdrecog,
|
|
|
|
|
-//// unwindOperationCe,
|
|
|
|
|
-//// matchOperation2,
|
|
|
|
|
-//// group
|
|
|
|
|
-//// );
|
|
|
|
|
-//// List<IotPestrecog> results = mongoService.aggregate(IotPestrecog.class, aggregation, IotPestrecog.class);
|
|
|
|
|
-////
|
|
|
|
|
-//// //获取存在识别害虫集合
|
|
|
|
|
-//// List<IotPest> iotPests2 = getIotPestList(results);
|
|
|
|
|
-////
|
|
|
|
|
-//// List<Map<String, Object>> list1 = new ArrayList<>();
|
|
|
|
|
-//// //获取日期集合
|
|
|
|
|
-//// List<String> dateList = DatePlugUtil.getTwoDaysDayDes(reqVo.getStartTime(), reqVo.getEndTime());
|
|
|
|
|
-//// for (String s : dateList) {
|
|
|
|
|
-//// Map<String, Object> dateMap = new HashMap<>();
|
|
|
|
|
-//// dateMap.put("date", s);
|
|
|
|
|
-//// List<Map<String, Object>> list2 = new ArrayList<>();
|
|
|
|
|
-//// dateMap.put("data", list2);
|
|
|
|
|
-//// for (IotPest iotPest : iotPests2) {
|
|
|
|
|
-//// String pestBid = iotPest.getPestBid();
|
|
|
|
|
-//// Map<String, Object> pestMap = new HashMap<>();
|
|
|
|
|
-//// pestMap.put("pestName", iotPest.getPestName());
|
|
|
|
|
-//// pestMap.put("pestBid", iotPest.getPestBid());
|
|
|
|
|
-//// int sum = 0;
|
|
|
|
|
-//// for (IotPestrecog iotPestrecog : results) {
|
|
|
|
|
-//// if (s.equals(iotPestrecog.getPestrecogCreatedDate().substring(0, 10))
|
|
|
|
|
-//// && pestBid != null && pestBid.equals(iotPestrecog.getPestBusid())) {
|
|
|
|
|
-//// sum += iotPestrecog.getPestrecogNum();
|
|
|
|
|
-//// }
|
|
|
|
|
-//// }
|
|
|
|
|
-//// pestMap.put("sum", sum);
|
|
|
|
|
-//// list2.add(pestMap);
|
|
|
|
|
-//// }
|
|
|
|
|
-//// list1.add(dateMap);
|
|
|
|
|
-//// }
|
|
|
|
|
-//// return AjaxResult.success(list1);
|
|
|
|
|
-//// }
|
|
|
|
|
|
|
+
|
|
|
//
|
|
//
|
|
|
//
|
|
//
|
|
|
//
|
|
//
|