|
|
@@ -3,9 +3,11 @@ package com.yunfeiyun.agmp.iotm.device.pest.controller;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.yunfeiyun.agmp.common.annotation.Log;
|
|
|
import com.yunfeiyun.agmp.common.constant.ErrorCode;
|
|
|
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.enums.BusinessType;
|
|
|
@@ -93,9 +95,38 @@ public class IotDeviceCbdController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("/data/list")
|
|
|
- public TableDataInfo getList(IotCbddataReqVo reqVo) {
|
|
|
- Map<String, Object> cases = BeanUtil.beanToMap(reqVo);
|
|
|
- return getDataTable(mongoService.findListPage(IotCbddata.class, cases, TableSupport.buildPageRequest()));
|
|
|
+ public TableDataInfo getList(IotDeviceDataListReqVo reqVo) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("devBid", reqVo.getDevBid());
|
|
|
+ if (StringUtils.isNotEmpty(reqVo.getStartTime()) && StringUtils.isEmpty(reqVo.getEndTime())) {
|
|
|
+ map.put("gte_cbddataCreatedDate", reqVo.getStartTime());
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(reqVo.getStartTime()) && StringUtils.isNotEmpty(reqVo.getEndTime())) {
|
|
|
+ map.put("lte_cbddataCreatedDate", reqVo.getEndTime());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(reqVo.getStartTime()) && StringUtils.isNotEmpty(reqVo.getEndTime())) {
|
|
|
+ map.put("time_cbddataCreatedDate", reqVo.getStartTime() + "," + reqVo.getEndTime());
|
|
|
+ }
|
|
|
+
|
|
|
+ PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
+ String orderByColumn = pageDomain.getOrderByColumn();
|
|
|
+ if (Objects.equals(orderByColumn, "cdbdataContent.stamp")){
|
|
|
+ pageDomain.setOrderByColumn("cbddataCreatedDate");
|
|
|
+ }
|
|
|
+
|
|
|
+ IPage page = mongoService.findListPage(IotCbddata.class, map, pageDomain);
|
|
|
+ List<?> data = page.getRecords();
|
|
|
+ List<JSONObject> list = new ArrayList<>();
|
|
|
+ for (Object datum : data) {
|
|
|
+ JSONObject jsonObject = JSONObject.from(datum);
|
|
|
+ JSONObject cdbdataContent = jsonObject.getJSONObject("cdbdataContent");
|
|
|
+ jsonObject.putAll(cdbdataContent);
|
|
|
+ jsonObject.remove("cdbdataContent");
|
|
|
+ list.add(jsonObject);
|
|
|
+ }
|
|
|
+ page.setRecords(list);
|
|
|
+
|
|
|
+ return getDataTable(page);
|
|
|
}
|
|
|
@Log(title = "设备数据", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/data/export")
|
|
|
@@ -159,6 +190,16 @@ public class IotDeviceCbdController extends BaseController {
|
|
|
TosDevicetype tosDevicetype= typeCacheService.getCacheObjectByDevTypeCode(IotDeviceDictConst.TYPE_YF_CBD);
|
|
|
reqVo.setDevtypeBid(tosDevicetype.getDevtypeBid());
|
|
|
List<IotDeviceListResVo> list = iIotDeviceService.selectIotDeviceListByType(reqVo);
|
|
|
+ for (IotDeviceListResVo resVo : list) {
|
|
|
+ //查询图片数量
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("devBid", resVo.getDevBid());
|
|
|
+ map.put("cbdimgDelstatus", "0");
|
|
|
+ System.out.println(resVo.getDevBid()+"xxxxxxxxxxx");
|
|
|
+ long count = mongoService.count(IotCbdimg.class, map);
|
|
|
+ resVo.setImgCount(count);
|
|
|
+
|
|
|
+ }
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
}
|