|
|
@@ -1,12 +1,20 @@
|
|
|
package com.yunfeiyun.agmp.iotm.device.pest.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.yunfeiyun.agmp.common.core.controller.BaseController;
|
|
|
import com.yunfeiyun.agmp.common.core.domain.AjaxResult;
|
|
|
+import com.yunfeiyun.agmp.common.core.page.PageDomain;
|
|
|
+import com.yunfeiyun.agmp.common.core.page.TableDataInfo;
|
|
|
+import com.yunfeiyun.agmp.common.core.page.TableSupport;
|
|
|
+import com.yunfeiyun.agmp.common.utils.StringUtils;
|
|
|
+import com.yunfeiyun.agmp.iot.common.domain.IotCbdimg;
|
|
|
import com.yunfeiyun.agmp.iot.common.service.MongoService;
|
|
|
+import com.yunfeiyun.agmp.iotm.device.pest.domain.IotCbdimgListResVo;
|
|
|
import com.yunfeiyun.agmp.iotm.device.pest.domain.IotCbdimgSumInfoResVo;
|
|
|
import com.yunfeiyun.agmp.iotm.device.pest.domain.IotPestRecogPeriodReqVo;
|
|
|
import com.yunfeiyun.agmp.iotm.device.pest.service.IIotCbdimgService;
|
|
|
import com.yunfeiyun.agmp.iotm.device.pest.service.IIotPestService;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
@@ -14,6 +22,11 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
/**
|
|
|
* 虫情识别信息表Controller
|
|
|
*
|
|
|
@@ -33,6 +46,26 @@ public class IotCbdimgController extends BaseController {
|
|
|
private IIotCbdimgService iotCbdimgService;
|
|
|
|
|
|
/**
|
|
|
+ * 对开始时间结束时间进行封装
|
|
|
+ *
|
|
|
+ * @param map
|
|
|
+ * @param column
|
|
|
+ * @param startTime
|
|
|
+ * @param endTime
|
|
|
+ */
|
|
|
+ private void timePackage(Map<String, Object> map, String column, String startTime, String endTime) {
|
|
|
+ if (StringUtils.isNotEmpty(startTime) && StringUtils.isEmpty(endTime)) {
|
|
|
+ map.put("gte_" + column, startTime);
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(startTime) && StringUtils.isNotEmpty(endTime)) {
|
|
|
+ map.put("lte_" + column, endTime);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime)) {
|
|
|
+ map.put("time_" + column, startTime + "," + endTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 识别数据列表
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('iot:cbdimg:sum:info')")
|
|
|
@@ -43,21 +76,30 @@ public class IotCbdimgController extends BaseController {
|
|
|
return AjaxResult.success(iotCbdimgSumInfoResVo);
|
|
|
}
|
|
|
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 识别数据列表
|
|
|
-// */
|
|
|
-// @PreAuthorize("@ss.hasPermi('iot:cbdimg:list')")
|
|
|
-// @GetMapping("/list")
|
|
|
-// public TableDataInfo list(IotPestRecogPeriodReqVo reqVo) {
|
|
|
-// Map<String, Object> map = new HashMap<>();
|
|
|
-// map.put("devBid", reqVo.getDevBid());
|
|
|
-// map.put("cbdimgDelstatus", "0");
|
|
|
-// timePackage(map, "cbdimgCreatedDate", reqVo.getStartTime(), reqVo.getEndTime());
|
|
|
-// PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
-// IPage listPage = mongoService.findListPage(IotCbdimg.class, map, pageDomain);
|
|
|
-// return getDataTable(listPage);
|
|
|
-// }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 识别数据列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('iot:cbdimg:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(IotPestRecogPeriodReqVo reqVo) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("devBid", reqVo.getDevBid());
|
|
|
+ map.put("cbdimgDelstatus", "0");
|
|
|
+ timePackage(map, "cbdimgCreatedDate", reqVo.getStartTime(), reqVo.getEndTime());
|
|
|
+ PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
+ IPage listPage = mongoService.findListPage(IotCbdimg.class, map, pageDomain);
|
|
|
+
|
|
|
+ List<IotCbdimg> cbdimgList = listPage.getRecords();
|
|
|
+ List<IotCbdimgListResVo> cbdimgListResVoList = new ArrayList<>();
|
|
|
+ for (IotCbdimg iotCbdimg : cbdimgList) {
|
|
|
+ IotCbdimgListResVo iotCbdimgListResVo = new IotCbdimgListResVo();
|
|
|
+ BeanUtils.copyProperties(iotCbdimg, iotCbdimgListResVo);
|
|
|
+ cbdimgListResVoList.add(iotCbdimgListResVo);
|
|
|
+ }
|
|
|
+ listPage.setRecords(cbdimgListResVoList);
|
|
|
+ return getDataTable(listPage);
|
|
|
+ }
|
|
|
//
|
|
|
//
|
|
|
//
|
|
|
@@ -92,23 +134,4 @@ public class IotCbdimgController extends BaseController {
|
|
|
// return rspData;
|
|
|
// }
|
|
|
//
|
|
|
-// /**
|
|
|
-// * 对开始时间结束时间进行封装
|
|
|
-// *
|
|
|
-// * @param map
|
|
|
-// * @param column
|
|
|
-// * @param startTime
|
|
|
-// * @param endTime
|
|
|
-// */
|
|
|
-// private void timePackage(Map<String, Object> map, String column, String startTime, String endTime) {
|
|
|
-// if (StringUtils.isNotEmpty(startTime) && StringUtils.isEmpty(endTime)) {
|
|
|
-// map.put("gte_" + column, startTime);
|
|
|
-// }
|
|
|
-// if (StringUtils.isEmpty(startTime) && StringUtils.isNotEmpty(endTime)) {
|
|
|
-// map.put("lte_" + column, endTime);
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime)) {
|
|
|
-// map.put("time_" + column, startTime + "," + endTime);
|
|
|
-// }
|
|
|
-// }
|
|
|
}
|