Przeglądaj źródła

修复主题报错,mongo数据查询无校验设备id

yf_zn 1 rok temu
rodzic
commit
ddcbe9d2bd

+ 13 - 25
src/main/java/com/yunfeiyun/agmp/iotm/common/controller/BaseController.java

@@ -7,8 +7,6 @@ import com.yunfeiyun.agmp.common.core.domain.AjaxResult;
 import com.yunfeiyun.agmp.common.core.domain.model.LoginUser;
 import com.yunfeiyun.agmp.common.core.page.TableDataInfo;
 import com.yunfeiyun.agmp.common.utils.PageUtils;
-import com.yunfeiyun.agmp.common.utils.SecurityUtils;
-import com.yunfeiyun.agmp.iot.common.util.tmn.CustomerIdUtil;
 import com.yunfeiyun.agmp.iotm.util.LoginUtil;
 import org.springframework.stereotype.Controller;
 
@@ -43,11 +41,11 @@ public class BaseController {
 
     /**
      * mysql
+     *
      * @param list
      * @return
      */
-    protected TableDataInfo getDataTable(List<?> list)
-    {
+    protected TableDataInfo getDataTable(List<?> list) {
         TableDataInfo rspData = new TableDataInfo();
         rspData.setCode(ErrorCode.SUCCESS.getCode());
         rspData.setMsg(ErrorCode.SUCCESS.getMessage());
@@ -82,24 +80,21 @@ public class BaseController {
     /**
      * 返回成功
      */
-    public AjaxResult success()
-    {
+    public AjaxResult success() {
         return AjaxResult.success();
     }
 
     /**
      * 返回成功消息
      */
-    public AjaxResult success(String message)
-    {
+    public AjaxResult success(String message) {
         return AjaxResult.success(message);
     }
 
     /**
      * 返回成功消息
      */
-    public AjaxResult success(Object data)
-    {
+    public AjaxResult success(Object data) {
         return AjaxResult.success(data);
     }
 
@@ -107,23 +102,20 @@ public class BaseController {
     /**
      * 返回失败消息
      */
-    public AjaxResult error()
-    {
+    public AjaxResult error() {
         return AjaxResult.error(ErrorCode.FAILURE.getCode());
     }
 
     /**
      * 返回失败消息
      */
-    public AjaxResult error(String code)
-    {
+    public AjaxResult error(String code) {
         return AjaxResult.error(code);
     }
 
 
-    public AjaxResult error(String code, String msg)
-    {
-        return AjaxResult.error(code,msg);
+    public AjaxResult error(String code, String msg) {
+        return AjaxResult.error(code, msg);
     }
 
 
@@ -133,8 +125,7 @@ public class BaseController {
      * @param rows 影响行数
      * @return 操作结果
      */
-    protected AjaxResult toAjax(int rows)
-    {
+    protected AjaxResult toAjax(int rows) {
         return rows > 0 ? AjaxResult.success() : AjaxResult.error();
     }
 
@@ -144,24 +135,21 @@ public class BaseController {
      * @param result 结果
      * @return 操作结果
      */
-    protected AjaxResult toAjax(boolean result)
-    {
+    protected AjaxResult toAjax(boolean result) {
         return result ? success() : error();
     }
 
     /**
      * 清理分页的线程变量
      */
-    protected void clearPage()
-    {
+    protected void clearPage() {
         PageUtils.clearPage();
     }
 
     /**
      * 设置请求分页数据
      */
-    protected void startPage()
-    {
+    protected void startPage() {
         PageUtils.startPage();
     }
 }

+ 2 - 24
src/main/java/com/yunfeiyun/agmp/iotm/device/pest/controller/IotCbdimgController.java

@@ -16,6 +16,7 @@ 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 com.yunfeiyun.agmp.iotm.util.ValidateUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.mongodb.core.MongoTemplate;
@@ -82,6 +83,7 @@ public class IotCbdimgController extends BaseController {
     @PreAuthorize("@ss.hasPermi('iot:cbdimg:list')")
     @GetMapping("/list")
     public TableDataInfo list(IotPestRecogPeriodReqVo reqVo) {
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
         Map<String, Object> map = new HashMap<>();
         map.put("devBid", reqVo.getDevBid());
         map.put("cbdimgDelstatus", "0");
@@ -109,29 +111,5 @@ public class IotCbdimgController extends BaseController {
     public AjaxResult remove(@RequestParam("ids") String[] ids) {
         return toAjax(iotCbdimgService.remove(ids));
     }
-//
-//
-//
-//    /**
-//     * 图片识别率
-//     */
-//    @PreAuthorize("@ss.hasPermi('iot:cbdimg:group:date:list')")
-//    @GetMapping("/group/date/list")
-//    public AjaxResult groupDateList(IotPestRecogPeriodReqVo reqVo) {
-//
-//        List<IotCbdimgGroupDateListResVo> iotCbdimgGroupDateListResVoList = iotCbdimgService.groupDateList(reqVo);
-//        return AjaxResult.success(iotCbdimgGroupDateListResVoList);
-//    }
-//
 
-//
-//    protected TableDataInfo getDataTable(IPage page) {
-//        TableDataInfo rspData = new TableDataInfo();
-//        rspData.setCode(ErrorCode.SUCCESS.getCode());
-//        rspData.setMsg(ErrorCode.SUCCESS.getMessage());
-//        rspData.setData(page.getRecords());
-//        rspData.setTotal(page.getTotal());
-//        return rspData;
-//    }
-//
 }

+ 0 - 35
src/main/java/com/yunfeiyun/agmp/iotm/device/pest/controller/IotCbdrecogController.java

@@ -66,39 +66,4 @@ public class IotCbdrecogController extends BaseController
         return toAjax(iotCbdrecogService.artificialReset(reqVo));
     }
 
-//    /**
-//     * 识别数据列表
-//     */
-//    @PreAuthorize("@ss.hasPermi('iot:cbdrecog:list')")
-//    @GetMapping("/list")
-//    public TableDataInfo list(IotPestRecogPeriodReqVo reqVo) {
-//        Map<String, Object> map = new HashMap<>();
-//        map.put("devBid", reqVo.getDevBid());
-//        map.put("cbdrecogType",reqVo.getCbdRecogType());
-//        if (StringUtils.isNotEmpty(reqVo.getStartTime()) && StringUtils.isEmpty(reqVo.getEndTime())) {
-//            map.put("gte_cbdrecogCreatedDate", reqVo.getStartTime());
-//        }
-//        if (StringUtils.isEmpty(reqVo.getStartTime()) && StringUtils.isNotEmpty(reqVo.getEndTime())) {
-//            map.put("lte_cbdrecogCreatedDate", reqVo.getEndTime());
-//        }
-//        if (StringUtils.isNotEmpty(reqVo.getStartTime()) && StringUtils.isNotEmpty(reqVo.getEndTime())) {
-//            map.put("time_cbdrecogCreatedDate", reqVo.getStartTime() + "," + reqVo.getEndTime());
-//        }
-//
-//        PageDomain pageDomain = TableSupport.buildPageRequest();
-//        IPage listPage = mongoService.findListPage(IotCbdrecog.class, map, pageDomain);
-//        return getDataTable(listPage);
-//    }
-//
-//
-//
-//    protected TableDataInfo getDataTable(IPage page) {
-//        TableDataInfo rspData = new TableDataInfo();
-//        rspData.setCode(ErrorCode.SUCCESS.getCode());
-//        rspData.setMsg(ErrorCode.SUCCESS.getMessage());
-//        rspData.setData(page.getRecords());
-//        rspData.setTotal(page.getTotal());
-//        return rspData;
-//    }
-//
 }

+ 4 - 46
src/main/java/com/yunfeiyun/agmp/iotm/device/pest/controller/IotDeviceCbdController.java

@@ -27,6 +27,7 @@ import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceDataListResVo;
 import com.yunfeiyun.agmp.iotm.device.common.service.IotDeviceRefreshService;
 import com.yunfeiyun.agmp.iotm.device.pest.domain.IotCbdimgCountResVo;
 import com.yunfeiyun.agmp.iotm.device.pest.service.IotCbdService;
+import com.yunfeiyun.agmp.iotm.util.ValidateUtil;
 import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceListReqVo;
 import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotDeviceListResVo;
 import com.yunfeiyun.agmp.iotm.web.service.IIotCmdtaskService;
@@ -170,6 +171,7 @@ public class IotDeviceCbdController extends BaseController {
 
     @GetMapping("/data/list")
     public TableDataInfo getList(IotDeviceDataListReqVo reqVo) {
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
         Map<String, Object> map = new HashMap<>();
         map.put("devBid", reqVo.getDevBid());
         if (StringUtils.isNotEmpty(reqVo.getStartTime()) && StringUtils.isEmpty(reqVo.getEndTime())) {
@@ -205,6 +207,7 @@ public class IotDeviceCbdController extends BaseController {
     @Log(title = "设备数据", businessType = BusinessType.EXPORT)
     @PostMapping("/data/export")
     public void dataExport(HttpServletResponse response, @RequestBody IotDeviceDataListReqVo reqVo) {
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
         String devBid = reqVo.getDevBid();
         String startTime = reqVo.getStartTime();
         String endTime = reqVo.getEndTime();
@@ -254,50 +257,5 @@ public class IotDeviceCbdController extends BaseController {
         return new AjaxResult(ErrorCode.SUCCESS.getCode(), result, null);
     }
 
-    /**
-     * 测报灯列表
-     * @param reqVo
-     * @return
-     */
-//    @GetMapping("/list")
-//    public TableDataInfo list(IotDeviceListReqVo reqVo) {
-//        startPage();
-//        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");
-//            long count = mongoService.count(IotCbdimg.class, map);
-//            resVo.setImgCount(count);
-//
-//        }
-//        return getDataTable(list);
-//    }
-
-//
-//    /**
-//     * 水稻测报灯列表
-//     * @param reqVo
-//     * @return
-//     */
-//    @GetMapping("/sd/list")
-//    public TableDataInfo sdList(IotDeviceListReqVo reqVo) {
-//        startPage();
-//        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");
-//            long count = mongoService.count(IotCbdimg.class, map);
-//            resVo.setImgCount(count);
-//
-//        }
-//        return getDataTable(list);
-//    }
+
 }

+ 0 - 99
src/main/java/com/yunfeiyun/agmp/iotm/device/pest/controller/IotPestController.java

@@ -39,103 +39,4 @@ public class IotPestController extends BaseController
         return success(iotPestService.selectIotPestByPestBid(pestBid));
     }
 
-//    /**
-//     * 查询害虫信息列表
-//     */
-//    @PreAuthorize("@ss.hasPermi('iot:pest:list')")
-//    @GetMapping("/list")
-//    public TableDataInfo list(IotPest iotPest)
-//    {
-//        startPage();
-//        List<IotPest> list = iotPestService.selectIotPestList(iotPest);
-//        return getDataTable(list);
-//    }
-//
-//    /**
-//     * 导出害虫信息列表
-//     */
-//    @PreAuthorize("@ss.hasPermi('iot:pest:export')")
-//    @Log(title = "害虫信息", businessType = BusinessType.EXPORT)
-//    @PostMapping("/export")
-//    public void export(HttpServletResponse response, IotPest iotPest)
-//    {
-//        List<IotPest> list = iotPestService.selectIotPestList(iotPest);
-//        ExcelUtil<IotPest> util = new ExcelUtil<IotPest>(IotPest.class);
-//        util.exportExcel(response, list, "害虫信息数据");
-//    }
-//
-//
-//    /**
-//     * 获取害虫信息详细信息
-//     */
-//    @PreAuthorize("@ss.hasPermi('iot:pest:plug:query')")
-//    @GetMapping(value = "/plug/info")
-//    public AjaxResult getPlugInfo(@RequestParam("pestBid") String pestBid)
-//    {
-//        Criteria criteria = new Criteria();
-//        criteria.and("pestBusid").is(pestBid);
-//        Query query = new Query(criteria);
-//        query.with(Sort.by(Sort.Direction.DESC, "pestrecogCreatedDate"));
-//        IotPestrecog iotPestrecog = mongoTemplate.findOne(query, IotPestrecog.class, "IotPestrecog");
-//        IotPest iotPest = iotPestService.selectIotPestByPestBid(pestBid);
-//        if (iotPestrecog != null) {
-//            Criteria criteria2 = new Criteria();
-//            criteria2.and("pestrecogBid").is(iotPestrecog.getPestrecogBid());
-//            IotCbdpest iotCbdpest = mongoTemplate.findOne(new Query(criteria2), IotCbdpest.class, "IotCbdpest");
-//            if (iotCbdpest != null) {
-//                Criteria criteria3 = new Criteria();
-//                criteria3.and("cbdrecogBid").is(iotCbdpest.getCbdrecogBid());
-//                IotCbdrecog iotCbdrecog = mongoTemplate.findOne(new Query(criteria3), IotCbdrecog.class, "IotCbdrecog");
-//                if (iotCbdrecog != null) {
-//                    Criteria criteria4 = new Criteria();
-//                    criteria4.and("cbdimgBid").is(iotCbdrecog.getCbdimgBid());
-//                    IotCbdimg iotCbdimg = mongoTemplate.findOne(new Query(criteria4), IotCbdimg.class, "IotCbdimg");
-//                    iotPest.setPestImgUrl(iotCbdimg.getCbdimgAddr());
-//                }
-//            }
-//        }
-//
-//        try {
-//            JSONArray preventiveMeasuresInfo = iotAidispestService.getPreventiveMeasuresInfo(iotPest.getPestName());
-//            if (preventiveMeasuresInfo.size() > 0) {
-//                iotPest.setPestInfo(preventiveMeasuresInfo.getJSONObject(0).toJSONString());
-//            }
-//        } catch (Exception e) {
-//            logger.error("获得防治措施异常", e);
-//        }
-//        return success(iotPest);
-//    }
-//
-//    /**
-//     * 新增害虫信息
-//     */
-//    @PreAuthorize("@ss.hasPermi('iot:pest:add')")
-//    @Log(title = "害虫信息", businessType = BusinessType.INSERT)
-//    @PostMapping("/add")
-//    public AjaxResult add(@RequestBody IotPest iotPest)
-//    {
-//        return toAjax(iotPestService.insertIotPest(iotPest));
-//    }
-//
-//    /**
-//     * 修改害虫信息
-//     */
-//    @PreAuthorize("@ss.hasPermi('iot:pest:edit')")
-//    @Log(title = "害虫信息", businessType = BusinessType.UPDATE)
-//    @PutMapping("/edit")
-//    public AjaxResult edit(@RequestBody IotPest iotPest)
-//    {
-//        return toAjax(iotPestService.updateIotPest(iotPest));
-//    }
-//
-//    /**
-//     * 删除害虫信息
-//     */
-//    @PreAuthorize("@ss.hasPermi('iot:pest:remove')")
-//    @Log(title = "害虫信息", businessType = BusinessType.DELETE)
-//	@DeleteMapping("/delete")
-//    public AjaxResult remove(@RequestParam("ids") Long[] ids)
-//    {
-//        return toAjax(iotPestService.deleteIotPestByIds(ids));
-//    }
 }

+ 1 - 170
src/main/java/com/yunfeiyun/agmp/iotm/device/pest/controller/IotPestrecogController.java

@@ -116,174 +116,5 @@ public class IotPestrecogController extends BaseController {
         IotPestRecogPeriodInfoResVo infoResVo = iIotPestrecogService.period(reqVo);
         return AjaxResult.success(infoResVo);
     }
-//
-//    public List<IotPest> getIotPestList(List<IotPestrecog> list) {
-//        Map<String, IotPest> pestMap = iotPestService.selectIotPestMapAllInfo();
-//        List<IotPest> iotPests2 = new ArrayList<>();
-//        Set<String> set = new HashSet<>();
-//        for (IotPestrecog iotPestrecog : list) {
-//            set.add(iotPestrecog.getPestBusid());
-//        }
-//        for (String s : set) {
-//            IotPest iotPest1 = new IotPest();
-//            iotPest1.setPestBid(s);
-//            IotPest pest = pestMap.get(s);
-//            if (pest != null) {
-//                iotPest1.setPestName(pest.getPestName());
-//                iotPest1.setPestId(pest.getPestId());
-//            }
-//            iotPests2.add(iotPest1);
-//        }
-//        return iotPests2;
-//    }
-//
-//    protected TableDataInfo getDataTable(IPage page) {
-//        TableDataInfo rspData = new TableDataInfo();
-//        rspData.setCode(ErrorCode.SUCCESS.getCode());
-//        rspData.setMsg(ErrorCode.SUCCESS.getMessage());
-//        rspData.setData(page.getRecords());
-//        rspData.setTotal(page.getTotal());
-//        return rspData;
-//    }
-//
-//    /**
-//     * 对列表与导出的参数进行封装
-//     *
-//     * @param reqVo
-//     * @return
-//     */
-//    private Map<String, Object> getParamMap(IotPestRecogPeriodReqVo reqVo) {
-//        Map<String, Object> map = new HashMap<>();
-//        map.put("devBid", reqVo.getDevBid());
-//
-//        if (StringUtils.isNotEmpty(reqVo.getPestrecogMarktype())) {
-//            map.put("pestrecogMarktype", reqVo.getPestrecogMarktype());
-//        }
-//        if (StringUtils.isNotEmpty(reqVo.getPestBids())) {
-//            map.put("newList_pestBusid", reqVo.getPestBids());
-//        }
-//        if (StringUtils.isNotEmpty(reqVo.getStartTime()) && StringUtils.isEmpty(reqVo.getEndTime())) {
-//            map.put("gte_pestrecogCreatedDate", reqVo.getStartTime());
-//        }
-//        if (StringUtils.isEmpty(reqVo.getStartTime()) && StringUtils.isNotEmpty(reqVo.getEndTime())) {
-//            map.put("lte_pestrecogCreatedDate", reqVo.getEndTime());
-//        }
-//        if (StringUtils.isNotEmpty(reqVo.getStartTime()) && StringUtils.isNotEmpty(reqVo.getEndTime())) {
-//            map.put("time_pestrecogCreatedDate", reqVo.getStartTime() + "," + reqVo.getEndTime());
-//        }
-//        return map;
-//    }
-//
-//    /**
-//     * 对返回数据进行封装
-//     *
-//     * @param records
-//     * @return
-//     */
-//    private List<IotPestrecogResVo> getIotPestrecogResVoList(List<IotPestrecog> records) {
-//        Map<String, IotPest> pestMap = iotPestService.selectIotPestMapAllInfo();
-//        List<IotPestrecogResVo> list = new ArrayList<>();
-//        for (IotPestrecog record : records) {
-//            IotPestrecogResVo resVo = new IotPestrecogResVo();
-//            BeanUtils.copyProperties(record, resVo);
-//            AggregationOperation lookupOperation = LookupOperation.newLookup()
-//                    .from("IotCbdrecog")
-//                    .localField("cbdrecogBid")
-//                    .foreignField("cbdrecogBid")
-//                    .as("IotCbdrecog");
-//            Criteria criteria = new Criteria();
-//            criteria.and("pestrecogBid").is(record.getPestrecogBid());
-//            Aggregation aggregation = Aggregation.newAggregation(lookupOperation, Aggregation.match(criteria));
-////            Aggregation aggregation= Aggregation.newAggregation(
-////                    Aggregation.lookup("IotCbdrecog", "cbdrecogBid", "cbdrecogBid", "IotCbdrecog"),
-////                    Aggregation.match(criteria));
-//            AggregationResults<Document> result = mongoTemplate.aggregate(aggregation, "IotCbdpest", Document.class);
-//            List<Document> objs = result.getMappedResults();
-//            if (objs.size() > 0) {
-//                Document document = objs.get(0);
-//                JSONObject from = JSONObject.from(document);
-//                JSONArray array = from.getJSONArray("IotCbdrecog");
-//                if (array.size() > 0) {
-//                    JSONObject jsonObject = array.getJSONObject(0);
-//                    resVo.setCbdrecogAddr(jsonObject.getString("cbdrecogAddr"));
-//                    resVo.setCbdrecogManualaddr(jsonObject.getString("cbdrecogManualaddr"));
-//                    resVo.setCbdrecogMarktype(jsonObject.getString("cbdrecogMarktype"));
-//                    resVo.setCbdrecogManualmark(jsonObject.getString("cbdrecogManualmark"));
-//                    resVo.setCbdrecogMachinemark(jsonObject.getString("cbdrecogMachinemark"));
-//                }
-//            }
-//            if (!StringUtils.isEmpty(record.getPestBusid())) {
-//                IotPest pest = pestMap.get(record.getPestBusid());
-//                if (pest != null) {
-//                    resVo.setPestName(pest.getPestName());
-//                    resVo.setPestId(pest.getPestId());
-//                    list.add(resVo);
-//                } else {
-//                    // 手动识别的名字,待完善
-//                    resVo.setPestName("-");
-//                    list.add(resVo);
-//                }
-//
-//            }
-//
-//        }
-//        return list;
-//    }
-//
-//
-//    /**
-//     * 对返回数据进行封装
-//     *
-//     * @param records
-//     * @return
-//     */
-//    private List<IotPestrecogResVo> getIotPestrecogResVoList2(List<IotPestrecog> records) {
-//        Map<String, IotPest> pestMap = iotPestService.selectIotPestMapAllInfo();
-//        List<IotPestrecogResVo> list = new ArrayList<>();
-//        for (IotPestrecog record : records) {
-//            IotPestrecogResVo resVo = new IotPestrecogResVo();
-//            BeanUtils.copyProperties(record, resVo);
-//            AggregationOperation lookupOperation = LookupOperation.newLookup()
-//                    .from("IotCbdrecog")
-//                    .localField("cbdrecogBid")
-//                    .foreignField("cbdrecogBid")
-//                    .as("IotCbdrecog");
-//            Criteria criteria = new Criteria();
-//            criteria.and("pestrecogBid").is(record.getPestrecogBid());
-//            Aggregation aggregation = Aggregation.newAggregation(lookupOperation, Aggregation.match(criteria));
-////            Aggregation aggregation= Aggregation.newAggregation(
-////                    Aggregation.lookup("IotCbdrecog", "cbdrecogBid", "cbdrecogBid", "IotCbdrecog"),
-////                    Aggregation.match(criteria));
-//            AggregationResults<Document> result = mongoTemplate.aggregate(aggregation, "IotCbdpest", Document.class);
-//            List<Document> objs = result.getMappedResults();
-//            if (objs.size() > 0) {
-//                Document document = objs.get(0);
-//                JSONObject from = JSONObject.from(document);
-//                JSONArray array = from.getJSONArray("IotCbdrecog");
-//                if (array.size() > 0) {
-//                    JSONObject jsonObject = array.getJSONObject(0);
-//                    resVo.setCbdrecogAddr(jsonObject.getString("cbdrecogAddr"));
-//                    resVo.setCbdrecogManualaddr(jsonObject.getString("cbdrecogManualaddr"));
-//                    resVo.setCbdrecogMarktype(jsonObject.getString("cbdrecogMarktype"));
-//                    resVo.setCbdrecogManualmark(jsonObject.getString("cbdrecogManualmark"));
-//                    resVo.setCbdrecogMachinemark(jsonObject.getString("cbdrecogMachinemark"));
-//                }
-//            }
-//            if (!StringUtils.isEmpty(record.getPestBusid())) {
-//                IotPest pest = pestMap.get(record.getPestBusid());
-//                if (pest != null) {
-//                    resVo.setPestName(pest.getPestName());
-//                    resVo.setPestId(pest.getPestId());
-//                    list.add(resVo);
-//                } else {
-//                    // 手动识别的名字,待完善
-//                    resVo.setPestName("-");
-//                    list.add(resVo);
-//                }
-//
-//            }
-//
-//        }
-//        return list;
-//    }
+
 }

+ 4 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/qxsqz/controller/IotDeviceQxzController.java

@@ -22,6 +22,7 @@ import com.yunfeiyun.agmp.iotm.device.common.service.IotDeviceRefreshService;
 import com.yunfeiyun.agmp.iotm.device.qxsqz.domain.IotQxzConfigDto;
 import com.yunfeiyun.agmp.iotm.device.qxsqz.domain.IotQxzConfigEditReqVo;
 import com.yunfeiyun.agmp.iotm.device.qxsqz.domain.QxzExportDataDto;
+import com.yunfeiyun.agmp.iotm.util.ValidateUtil;
 import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceListReqVo;
 import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotDeviceListResVo;
 import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceService;
@@ -95,6 +96,7 @@ public class IotDeviceQxzController extends BaseController {
      */
     @GetMapping("/data/list")
     public TableDataInfo dataList(IotDeviceDataListReqVo reqVo) {
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
         IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
         iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
         iotDeviceBaseFunReqVo.setMethodName("dataList");
@@ -109,6 +111,7 @@ public class IotDeviceQxzController extends BaseController {
      */
     @GetMapping("/chart/list")
     public AjaxResult chartList(IotDeviceDataListReqVo reqVo) {
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
         IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
         iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
         iotDeviceBaseFunReqVo.setMethodName("chartList");
@@ -235,6 +238,7 @@ public class IotDeviceQxzController extends BaseController {
     public AjaxResult sendConfigCmd(@RequestBody IotQxzConfigEditReqVo reqVo) {
         log.info("【{}】【气象墒情】【下发指令配置】客户id {}", LogCore.getSeq(), getCustomerId());
         String devBid = reqVo.getDevBid();
+        ValidateUtil.validateDevBid(devBid);
         IotQxzConfigDto devConfig = reqVo.getDevConfig();
         if(StringUtils.isEmpty(devBid) || devConfig == null){
             throw new IotBizException(IotErrorCode.PARAM_INVALID.getCode(),"参数不能为空");

+ 6 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/scd/controller/IotDeviceScdController.java

@@ -21,6 +21,7 @@ import com.yunfeiyun.agmp.iotm.device.common.service.IotDeviceRefreshService;
 import com.yunfeiyun.agmp.iotm.device.scd.domain.IotScdClearPestDto;
 import com.yunfeiyun.agmp.iotm.device.scd.domain.IotScdConfig;
 import com.yunfeiyun.agmp.iotm.device.scd.domain.IotScdConfigEditReqVo;
+import com.yunfeiyun.agmp.iotm.util.ValidateUtil;
 import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceListReqVo;
 import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotDeviceListResVo;
 import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceService;
@@ -91,6 +92,7 @@ public class IotDeviceScdController extends BaseController {
      */
     @GetMapping("/data/list")
     public TableDataInfo dataList(IotDeviceDataListReqVo reqVo) {
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
         IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
         iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
         iotDeviceBaseFunReqVo.setMethodName("dataList");
@@ -105,6 +107,7 @@ public class IotDeviceScdController extends BaseController {
      */
     @GetMapping("/chart/list")
     public AjaxResult chartList(IotDeviceDataListReqVo reqVo) {
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
         IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
         iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
         iotDeviceBaseFunReqVo.setMethodName("chartList");
@@ -121,6 +124,7 @@ public class IotDeviceScdController extends BaseController {
 
     @PostMapping("/data/export")
     public void dataExport(HttpServletResponse response, @RequestBody IotDeviceDataListReqVo reqVo){
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
         IotDeviceExportReqVo iotDeviceExportReqVo = new IotDeviceExportReqVo();
         iotDeviceExportReqVo.setResponse(response);
         iotDeviceExportReqVo.setReqVo(reqVo);
@@ -134,6 +138,7 @@ public class IotDeviceScdController extends BaseController {
 
     @PostMapping("/status/export")
     public void statusExport(HttpServletResponse response, @RequestBody IotDeviceDataListReqVo reqVo){
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
         IotDeviceExportReqVo iotDeviceExportReqVo = new IotDeviceExportReqVo();
         iotDeviceExportReqVo.setResponse(response);
         iotDeviceExportReqVo.setReqVo(reqVo);
@@ -166,6 +171,7 @@ public class IotDeviceScdController extends BaseController {
      */
     @PostMapping("/config/edit")
     public AjaxResult sendConfigCmd(@RequestBody IotScdConfigEditReqVo reqVo) {
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
         log.info("【{}】【杀虫灯】【下发指令配置】客户id {}", LogCore.getSeq(), getCustomerId());
         String devBid = reqVo.getDevBid();
         IotScdConfig iotScdConfig = reqVo.getIotScdConfig();

+ 19 - 0
src/main/java/com/yunfeiyun/agmp/iotm/util/ValidateUtil.java

@@ -0,0 +1,19 @@
+package com.yunfeiyun.agmp.iotm.util;
+
+import com.yunfeiyun.agmp.common.constant.ErrorCode;
+import com.yunfeiyun.agmp.common.exception.BizException;
+import com.yunfeiyun.agmp.common.utils.StringUtils;
+
+public class ValidateUtil {
+
+    /**
+     * 统一校验设备id
+     *
+     * @param devBid
+     */
+    public static void validateDevBid(String devBid) {
+        if (StringUtils.isEmpty(devBid)) {
+            throw new BizException(ErrorCode.FAILURE.getCode(), "设备id不可为空");
+        }
+    }
+}