Przeglądaj źródła

新增 性诱测报获取配置,下发配置功能

zhaiyifei 1 rok temu
rodzic
commit
641964a9da

+ 2 - 1
src/main/java/com/yunfeiyun/agmp/iotm/device/bzy/controller/IotDeviceBzyController.java

@@ -180,7 +180,8 @@ public class IotDeviceBzyController extends BaseController {
             throw new IotBizException(ErrorCode.INVALID_PARAMETER.getCode(),"设备不存在");
         }
         IotDeviceconfig iotDeviceconfig = iIotDeviceconfigService.selectIotDeviceConfigByDevBid(devBid);
-        return AjaxResult.success(iotDeviceconfig.getDevcfgContext());
+        JSONObject jsonObject = JSONObject.parseObject(iotDeviceconfig.getDevcfgContext());
+        return AjaxResult.success(jsonObject);
     }
 
     /**

+ 144 - 75
src/main/java/com/yunfeiyun/agmp/iotm/device/xycb/controller/IotXycbController.java

@@ -1,14 +1,30 @@
 package com.yunfeiyun.agmp.iotm.device.xycb.controller;
 
+import com.alibaba.fastjson2.JSONObject;
+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.TableDataInfo;
+import com.yunfeiyun.agmp.common.enums.BusinessType;
+import com.yunfeiyun.agmp.common.log.LogCore;
+import com.yunfeiyun.agmp.common.utils.JSONUtils;
+import com.yunfeiyun.agmp.common.utils.StringUtils;
+import com.yunfeiyun.agmp.common.utils.poi.ExcelUtil;
+import com.yunfeiyun.agmp.common.utils.uuid.IdUtils;
+import com.yunfeiyun.agmp.iot.common.constant.IotErrorCode;
 import com.yunfeiyun.agmp.iot.common.constant.devicetype.IotDeviceDictConst;
+import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
+import com.yunfeiyun.agmp.iot.common.domain.IotDeviceconfig;
+import com.yunfeiyun.agmp.iot.common.exception.IotBizException;
+import com.yunfeiyun.agmp.iot.common.model.cmd.CmdGroupModel;
 import com.yunfeiyun.agmp.iot.common.service.MongoService;
 import com.yunfeiyun.agmp.iotm.common.controller.BaseController;
-import com.yunfeiyun.agmp.iotm.device.xycb.domain.IotXycbInfoResVo;
-import com.yunfeiyun.agmp.iotm.device.xycb.domain.IotXycbPolylineResVo;
-import com.yunfeiyun.agmp.iotm.device.xycb.domain.IotXycbReqVo;
+import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceDataListReqVo;
+import com.yunfeiyun.agmp.iotm.device.common.service.IotDeviceCommonService;
+import com.yunfeiyun.agmp.iotm.device.common.service.IotDeviceRefreshService;
+import com.yunfeiyun.agmp.iotm.device.xycb.domain.*;
 import com.yunfeiyun.agmp.iotm.device.xycb.service.IIotXycbService;
+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;
@@ -17,12 +33,11 @@ import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceconfigService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.util.Arrays;
 import java.util.List;
 
@@ -51,6 +66,12 @@ public class IotXycbController extends BaseController
     @Autowired
     private IIotXycbService iIotXycbService;
 
+    @Resource
+    private IotDeviceRefreshService iotDeviceRefreshService;
+
+    @Resource
+    private IotDeviceCommonService iotDeviceCommonService;
+
     /**
      * 性诱测报列表
      * /list  所有性诱测报设备
@@ -111,27 +132,122 @@ public class IotXycbController extends BaseController
         IotXycbInfoResVo iotXycbInfoResVo = iIotXycbService.getXycbInfo(devBid);
         return AjaxResult.success(iotXycbInfoResVo);
     }
-//
-//    /**
-//     *
-//     * @param reqVo
-//     * @return
-//     */
-//    @PreAuthorize("@ss.hasPermi('iot:xycb:lure')")
-//    @PostMapping("/lure")
-//    public AjaxResult modifyLure(@RequestBody IotXycbModifyLureReqVo iotXycbModifyLureReqVo){
-//        return AjaxResult.success(iIotXycbService.modifyLure(iotXycbModifyLureReqVo));
-//    }
-//
-//    /**
-//     * 查询诱芯列表
-//     */
-//    @PreAuthorize("@ss.hasPermi('iot:xycb:lure:list')")
-//    @GetMapping("/lure/list")
-//    public TableDataInfo list(IotXycbLureListReqVo iotXycbLureListReqVo)
-//    {
-//        return getDataTable(iIotXycbService.getLureList(iotXycbLureListReqVo));
-//    }
+
+    @GetMapping("/refresh/{devBid}")
+    public AjaxResult refresh(@PathVariable("devBid") String devBid) {
+        String result = iotDeviceRefreshService.refresh(devBid);
+        return new AjaxResult(ErrorCode.SUCCESS.getCode(), result, null);
+    }
+
+    @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();
+        String[] params = {devBid, startTime, endTime};
+        for (String k : params) {
+            if (StringUtils.isEmpty(k)) {
+                throw new IotBizException(IotErrorCode.PARAM_INVALID.getCode(), "参数不能为空");
+            }
+        }
+
+        IotDevice iotDevice = iIotDeviceService.selectIotDeviceByDevBid(devBid);
+
+        //性诱III  数据导出
+        IotXycbReqVo reqVo1 = new IotXycbReqVo();
+        reqVo1.setDevBid(reqVo.getDevBid());
+        reqVo1.setStartDate(reqVo.getStartTime());
+        reqVo1.setEndDate(reqVo.getEndTime());
+        List<IotYfXycbDataListRspVo> list = iIotXycbService.exportXYIIIDataList(reqVo1,iotDevice);
+        ExcelUtil util = new ExcelUtil<>(IotYfXycbDataListRspVo.class);
+        util.exportExcel(response, list, "设备数据");
+    }
+
+
+    /**
+     * 下发测报灯配置指令
+     *
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/config/edit")
+    public AjaxResult sendConfigCmd(@RequestBody IotXYIIIConfigEditReqVo reqVo) {
+        log.info("【{}】【性诱III】【下发指令配置】客户id {}", LogCore.getSeq(), getCustomerId());
+        String devBid = reqVo.getDevBid();
+        if (StringUtils.isEmpty(devBid)) {
+            return AjaxResult.error(IotErrorCode.FAILURE.getCode(), "设备id不可为空");
+        }
+        IotDevice iotDevice = iIotDeviceService.selectIotDeviceByDevBid(devBid);
+        if (iotDevice == null) {
+            return AjaxResult.error(IotErrorCode.FAILURE.getCode(), "设备不存在");
+        }
+        IotDeviceconfig iotDeviceconfig = iIotDeviceconfigService.selectIotDeviceConfigByDevBid(devBid);
+        if (null == iotDeviceconfig) {
+            // 如果测报灯配置为空,则新增测报灯配置
+            iotDeviceconfig = new IotDeviceconfig();
+            iotDeviceconfig.setDevcfgBid(iotDeviceconfig.getUUId());
+            iotDeviceconfig.setTid(iotDevice.getTid());
+            iotDeviceconfig.setDevBid(devBid);
+            iotDeviceconfig.setDevcfgContext(JSONUtils.toJSONString(reqVo.getIotXyConfig()));
+            iotDeviceconfig.setDevcfgDelstatus("0");
+            iIotDeviceconfigService.insertIotDeviceconfig(iotDeviceconfig);
+        } else {
+            // 如果测报灯配置不为空,则更新测报灯配置
+            iotDeviceconfig.setDevcfgContext(JSONUtils.toJSONString(reqVo.getIotXyConfig()));
+            iIotDeviceconfigService.updateIotDeviceconfig(iotDeviceconfig);
+        }
+        CmdGroupModel cmdGroupModel = iIotDeviceconfigService.createConfigCmd(iotDeviceconfig);
+        log.info("【{}】【性诱III】【构建 cmdGroupModel】{}", LogCore.getSeq(), JSONUtils.toJSONString(cmdGroupModel));
+        cmdGroupModel.setRequestId(IdUtils.fastUUID());
+
+        // 适配增加详细日志使用
+        cmdGroupModel.setDevCode(iotDevice.getDevCode());
+        cmdGroupModel.setCtBiztitle(iotDevice.getDevtypeName() + ":" + iotDevice.getDevCode());
+        cmdGroupModel.setCtBiztype("3");
+        cmdGroupModel.setCtDevtype(iotDevice.getDevtypeBid());
+        cmdGroupModel.setCtParam(JSONUtils.toJSONString(reqVo));
+        iIotCmdtaskService.handInternalCmd(cmdGroupModel);
+        String taskId = cmdGroupModel.getTaskUuid();
+        return new AjaxResult(ErrorCode.SUCCESS.getCode(), "下发成功,等待设备响应结果", taskId);
+    }
+
+    @GetMapping("/config/info/{devBid}")
+    public AjaxResult configInfo(@PathVariable("devBid") String devBid){
+        if(StringUtils.isEmpty(devBid)){
+            throw new IotBizException(IotErrorCode.PARAM_INVALID.getCode(),"参数不能为空");
+        }
+        IotDevice iotDevice = iIotDeviceService.selectIotDeviceByDevBid(devBid);
+        if(iotDevice == null){
+            throw new IotBizException(ErrorCode.INVALID_PARAMETER.getCode(),"设备不存在");
+        }
+        IotDeviceconfig iotDeviceconfig = iIotDeviceconfigService.selectIotDeviceConfigByDevBid(devBid);
+        JSONObject jsonObject = JSONObject.parseObject(iotDeviceconfig.getDevcfgContext());
+        return AjaxResult.success(jsonObject);
+    }
+
+
+    /**
+     *
+     * @param reqVo
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('iot:xycb:lure')")
+    @PostMapping("/lure")
+    public AjaxResult modifyLure(@RequestBody IotXycbModifyLureReqVo iotXycbModifyLureReqVo){
+        return AjaxResult.success(iIotXycbService.modifyLure(iotXycbModifyLureReqVo));
+    }
+
+    /**
+     * 查询诱芯列表
+     */
+    @PreAuthorize("@ss.hasPermi('iot:xycb:lure:list')")
+    @GetMapping("/lure/list")
+    public TableDataInfo list(IotXycbLureListReqVo iotXycbLureListReqVo)
+    {
+        return getDataTable(iIotXycbService.getLureList(iotXycbLureListReqVo));
+    }
 //
 //    /**
 //     * 查询图片列表
@@ -154,54 +270,7 @@ public class IotXycbController extends BaseController
 //        iIotXycbService.imageDelete(xycbimgBid);
 //        return AjaxResult.success();
 //    }
-//
-//    /**
-//     * 下发测报灯配置指令
-//     *
-//     * @return
-//     * @throws Exception
-//     */
-//    @PostMapping("/config/edit")
-//    public AjaxResult sendConfigCmd(@RequestBody IotXYIIIConfigEditReqVo iotXYIIIConfigEditReqVo) {
-//        log.info("【{}】【性诱III】【下发指令配置】客户id {}", LogCore.getSeq(), getCustomerId());
-//        if (StringUtils.isEmpty(iotXYIIIConfigEditReqVo.getXyDataBid())) {
-//            return AjaxResult.error(IotErrorCode.FAILURE.getCode(), "设备id不可为空");
-//        }
-//        IotDevice iotDevice = iIotDeviceService.findOneByBizId(iotXYIIIConfigEditReqVo.getXyDataBid());
-//        if (iotDevice == null) {
-//            return AjaxResult.error(IotErrorCode.FAILURE.getCode(), "设备不存在");
-//        }
-//        IotDeviceconfig iotDeviceconfig = iIotDeviceconfigService.selectIotDeviceConfigByDevBid(iotXYIIIConfigEditReqVo.getXyDataBid());
-//        if (null == iotDeviceconfig) {
-//            // 如果测报灯配置为空,则新增测报灯配置
-//            iotDeviceconfig = new IotDeviceconfig();
-//            iotDeviceconfig.setDevcfgBid(iotDeviceconfig.getUUId());
-//            iotDeviceconfig.setCId(getCustomerId());
-//            iotDeviceconfig.setDevBid(iotXYIIIConfigEditReqVo.getXyDataBid());
-//            iotDeviceconfig.setDevcfgContext(JSONUtils.toJSONString(iotXYIIIConfigEditReqVo.getIotXyConfig()));
-//            iotDeviceconfig.setDevcfgDelstatus("0");
-//            iIotDeviceconfigService.insertIotDeviceconfig(iotDeviceconfig);
-//        } else {
-//            // 如果测报灯配置不为空,则更新测报灯配置
-//            iotDeviceconfig.setDevcfgContext(JSONUtils.toJSONString(iotXYIIIConfigEditReqVo.getIotXyConfig()));
-//            iIotDeviceconfigService.updateIotDeviceconfig(iotDeviceconfig);
-//        }
-//        CmdGroupModel cmdGroupModel = iIotDeviceconfigService.createConfigCmd(iotDeviceconfig);
-//        log.info("【{}】【性诱III】【构建 cmdGroupModel】{}", LogCore.getSeq(), JSONUtils.toJSONString(cmdGroupModel));
-//        cmdGroupModel.setRequestId(IdUtils.fastUUID());
-//
-//        // 适配增加详细日志使用
-//        //cmdGroupModel.setOrignRequestParam(iotCbdConfigEditReqVo);
-//        cmdGroupModel.setDevCode(iotDevice.getDevCode());
-//        cmdGroupModel.setCtBiztitle(IotDeviceTypeLv1Enum.XYCB.getName() + ":" + iotDevice.getDevCode());
-//        cmdGroupModel.setCtBiztype("3");
-//        cmdGroupModel.setCtDevtype(iotDevice.getDevtypeBid());
-//        cmdGroupModel.setCtParam(deviceConfigurationTranslator.configTranslate(iotXYIIIConfigEditReqVo));
-//
-//
-//        iIotCmdtaskService.handInternalCmd(cmdGroupModel);
-//        return new AjaxResult(ErrorCode.SUCCESS.getCode(), "下发成功,等待设备响应结果", null);
-//    }
+
 
 
 

+ 10 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/xycb/domain/IotXYIIIConfigEditReqVo.java

@@ -0,0 +1,10 @@
+package com.yunfeiyun.agmp.iotm.device.xycb.domain;
+
+import lombok.Data;
+
+@Data
+public class IotXYIIIConfigEditReqVo {
+    private String devBid;
+    private IotXyIIIConfig iotXyConfig;
+
+}

+ 14 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/xycb/domain/IotXyIIIConfig.java

@@ -0,0 +1,14 @@
+package com.yunfeiyun.agmp.iotm.device.xycb.domain;
+
+import lombok.Data;
+
+@Data
+public class IotXyIIIConfig {
+    private String timctrl; // work_tim.时控开关,1开,0关
+    private String st; // work_tim.开始时间
+    private String et; // work_tim.结束
+    private String dat_f; // 数据频率
+    private String ds; // 开关,1开,0关
+    private String clt_t; // 自清虫定时
+
+}

+ 16 - 17
src/main/java/com/yunfeiyun/agmp/iotm/device/xycb/service/IIotXycbService.java

@@ -1,10 +1,8 @@
 package com.yunfeiyun.agmp.iotm.device.xycb.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.yunfeiyun.agmp.iotm.device.xycb.domain.IotXycbInfoResVo;
-import com.yunfeiyun.agmp.iotm.device.xycb.domain.IotXycbPolylineResVo;
-import com.yunfeiyun.agmp.iotm.device.xycb.domain.IotXycbReqVo;
-import com.yunfeiyun.agmp.iotm.device.xycb.domain.IotYfXycbDataListRspVo;
+import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
+import com.yunfeiyun.agmp.iotm.device.xycb.domain.*;
 
 import java.util.List;
 
@@ -26,21 +24,22 @@ public interface IIotXycbService {
      * @param
      */
     public IotXycbInfoResVo getXycbInfo(String devBid);
-//
-//    /**
-//     * 修改诱芯信息
-//     * @param
-//     */
-//    public int modifyLure(IotXycbModifyLureReqVo iotXycbModifyLureReqVo);
-//
-//    /**
-//     * 获取诱芯列表
-//     * @return
-//     */
-//    public List<IotXycbLureListRspVo> getLureList(IotXycbLureListReqVo iotXycbLureListReqVo);
+
+    public List<IotYfXycbDataListRspVo> exportXYIIIDataList(IotXycbReqVo iotXycbReqVo, IotDevice device);
+
+    /**
+     * 修改诱芯信息
+     * @param
+     */
+    public int modifyLure(IotXycbModifyLureReqVo iotXycbModifyLureReqVo);
+
+    /**
+     * 获取诱芯列表
+     * @return
+     */
+    public List<IotXycbLureListRspVo> getLureList(IotXycbLureListReqVo iotXycbLureListReqVo);
 //
 //    public List<IotYfXycbDataListRspVo> exportDataList(IotXycbReqVo iotXycbReqVo, IotDeviceResVo device);
-//    public List<IotYfXycbDataListRspVo> exportXYIIIDataList(IotXycbReqVo iotXycbReqVo, IotDeviceResVo device);
 //
 //    public IPage getImageList(IotXycbReqVo iotXycbReqVo);
 //

+ 127 - 112
src/main/java/com/yunfeiyun/agmp/iotm/device/xycb/service/impl/IotXycbServiceImpl.java

@@ -6,10 +6,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.yunfeiyun.agmp.common.core.page.PageDomain;
 import com.yunfeiyun.agmp.common.core.page.TableSupport;
 import com.yunfeiyun.agmp.common.utils.DateUtils;
+import com.yunfeiyun.agmp.common.utils.SecurityUtils;
 import com.yunfeiyun.agmp.common.utils.StringUtils;
 import com.yunfeiyun.agmp.iot.common.constant.IotErrorCode;
 import com.yunfeiyun.agmp.iot.common.constant.devicetype.IotDeviceDictConst;
 import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
+import com.yunfeiyun.agmp.iot.common.domain.IotPest;
+import com.yunfeiyun.agmp.iot.common.domain.IotXyinfo;
 import com.yunfeiyun.agmp.iot.common.domain.IotYfXycbIIIdata;
 import com.yunfeiyun.agmp.iot.common.exception.IotBizException;
 import com.yunfeiyun.agmp.iot.common.service.IotWeatherService;
@@ -29,6 +32,8 @@ import org.springframework.stereotype.Service;
 
 import java.util.*;
 
+import static com.yunfeiyun.agmp.common.utils.PageUtils.startPage;
+
 @Slf4j
 @Service
 public class IotXycbServiceImpl implements IIotXycbService {
@@ -324,6 +329,126 @@ public class IotXycbServiceImpl implements IIotXycbService {
         return iotXycbInfoResVo;
     }
 
+    @Override
+    public List<IotYfXycbDataListRspVo> exportXYIIIDataList(IotXycbReqVo reqVo , IotDevice device){
+        String devBid = reqVo.getDevBid();
+
+        Map<String, Object> cases = new HashMap<>();
+        cases.put("devBid", devBid);
+
+        if (StringUtils.isNotEmpty(reqVo.getStartDate()) && StringUtils.isEmpty(reqVo.getEndDate())) {
+            cases.put("gte_xycbdataCreatedDate", reqVo.getStartDate());
+        }
+        if (StringUtils.isEmpty(reqVo.getStartDate()) && StringUtils.isNotEmpty(reqVo.getEndDate())) {
+            cases.put("lte_xycbdataCreatedDate", reqVo.getEndDate());
+        }
+        if (StringUtils.isNotEmpty(reqVo.getStartDate()) && StringUtils.isNotEmpty(reqVo.getEndDate())) {
+            cases.put("time_xycbdataCreatedDate", reqVo.getStartDate() + "," + reqVo.getEndDate());
+        }
+        cases.remove("startDate");
+        cases.remove("endDate");
+
+        List<IotYfXycbIIIdata> iotYfXycb2dataList = mongoService.findAll(IotYfXycbIIIdata.class, cases, "xycbdataCreatedDate desc");
+        List<IotYfXycbDataListRspVo> iotYfXycbDataListRspVoList = new ArrayList<>();
+        int i=0;
+        for(IotYfXycbIIIdata iotYfXycb2data: iotYfXycb2dataList){
+            i++;
+            JSONObject jsonObject = iotYfXycb2data.getXycbdataContent();
+            String cs = jsonObject.getString("cs");
+            if(jsonObject.containsKey("b_c") && !Objects.equals(jsonObject.getInteger("b_c"), 0)){
+                cs = "1";
+            }
+            String bv = jsonObject.getString("bv");
+            if(jsonObject.containsKey("b_v")){
+                bv = jsonObject.getString("b_v");
+            }
+            IotYfXycbDataListRspVo xycbDataListRspVo = new IotYfXycbDataListRspVo();
+            xycbDataListRspVo.setDevBid(devBid);
+            xycbDataListRspVo.setDs("1");
+            xycbDataListRspVo.setWs("1");
+            xycbDataListRspVo.setAt(jsonObject.getString("at"));
+            xycbDataListRspVo.setAh(jsonObject.getString("ah"));
+            xycbDataListRspVo.setBs("0");
+            xycbDataListRspVo.setCs(cs);
+            xycbDataListRspVo.setCv("0");
+            xycbDataListRspVo.setBv(bv);
+            xycbDataListRspVo.setCt((String) jsonObject.getOrDefault("infr_ct", "0"));
+            xycbDataListRspVo.setCreatedDate(iotYfXycb2data.getXycbdataCreatedDate());
+
+            xycbDataListRspVo.setId(""+i);
+            xycbDataListRspVo.setDevCode(device.getDevCode());
+
+            iotYfXycbDataListRspVoList.add(xycbDataListRspVo);
+        }
+
+        return iotYfXycbDataListRspVoList;
+    }
+
+
+    /**
+     * 修改诱芯信息
+     *
+     * @param iotXycbModifyLureReqVo
+     */
+    @Override
+    public int modifyLure(IotXycbModifyLureReqVo iotXycbModifyLureReqVo) {
+        String devBid = iotXycbModifyLureReqVo.getDevBid();
+        String pestBusid = iotXycbModifyLureReqVo.getPestBusid();
+        IotPest iotPest = iotPestService.selectIotPestByPestBid(pestBusid);
+        if(iotPest == null){
+            throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "诱芯不存在");
+        }
+        IotXyinfoDto iotXyinfoDto = iIotXyinfoService.selectIotXyinfoByDevBid(devBid);
+
+        IotXyinfo iotXyinfo = new IotXyinfo();
+        iotXyinfo.setDevBid(iotXycbModifyLureReqVo.getDevBid());
+        iotXyinfo.setPestBusid(iotPest.getPestBid());
+        iotXyinfo.setXyinfoLurename(iotPest.getPestName());
+        iotXyinfo.setXyinfoLureexpireddate(iotXycbModifyLureReqVo.getXyinfoLureexpireddate());
+        iotXyinfo.setXyinfoModifier(SecurityUtils.getUserId());
+        iotXyinfo.setXyinfoModifieddate(DateUtils.dateTimeNow());
+
+        int status = 0;
+        if(iotXyinfoDto == null){
+            iotXyinfo.setXyinfoBid(iotXyinfo.getUUId());
+            iotXyinfo.setXyinfoCreator(SecurityUtils.getUserId());
+            iotXyinfo.setXyinfoCreatedDate(DateUtils.dateTimeNow());
+            iotXyinfo.setXyinfoDelstatus("0");
+
+            status = iIotXyinfoService.insertIotXyinfo(iotXyinfo);
+        }else{
+            status = iIotXyinfoService.updateIotXyinfo(iotXyinfo);
+        }
+
+        return status;
+    }
+
+
+
+    /**
+     * 获取诱芯列表
+     *
+     * @param iotXycbLureListReqVo
+     * @return
+     */
+    @Override
+    public List<IotXycbLureListRspVo> getLureList(IotXycbLureListReqVo iotXycbLureListReqVo) {
+        IotPest selectIotPest = new IotPest();
+        selectIotPest.setPestName(iotXycbLureListReqVo.getPestName());
+
+        startPage();
+        List<IotPest> iotPestList = iotPestService.selectIotPestList(selectIotPest);
+        List<IotXycbLureListRspVo> iotXycbLureListRspVoList = new ArrayList<>();
+        for(IotPest iotPest: iotPestList){
+            IotXycbLureListRspVo iotXycbLureListRspVo = new IotXycbLureListRspVo();
+            iotXycbLureListRspVo.setPestName(iotPest.getPestName());
+            iotXycbLureListRspVo.setPestBusid(iotPest.getPestBid());
+
+            iotXycbLureListRspVoList.add(iotXycbLureListRspVo);
+        }
+        return iotXycbLureListRspVoList;
+    }
+
 
 //    /**
 //     * 性诱测报2.0
@@ -505,56 +630,7 @@ public class IotXycbServiceImpl implements IIotXycbService {
 //        return iotYfXycbDataListRspVoList;
 //    }
 //
-//    @Override
-//    public List<IotYfXycbDataListRspVo> exportXYIIIDataList(IotXycbReqVo reqVo ,IotDeviceResVo device){
-//        String devBid = reqVo.getDevBid();
-//
-//        Map<String, Object> cases = new HashMap<>();
-//        cases.put("devBid", devBid);
-//
-//        if (StringUtils.isNotEmpty(reqVo.getStartDate()) && StringUtils.isEmpty(reqVo.getEndDate())) {
-//            cases.put("gte_xycbdataCreatedDate", reqVo.getStartDate());
-//        }
-//        if (StringUtils.isEmpty(reqVo.getStartDate()) && StringUtils.isNotEmpty(reqVo.getEndDate())) {
-//            cases.put("lte_xycbdataCreatedDate", reqVo.getEndDate());
-//        }
-//        if (StringUtils.isNotEmpty(reqVo.getStartDate()) && StringUtils.isNotEmpty(reqVo.getEndDate())) {
-//            cases.put("time_xycbdataCreatedDate", reqVo.getStartDate() + "," + reqVo.getEndDate());
-//        }
-//        cases.remove("startDate");
-//        cases.remove("endDate");
-//
-//        List<IotYfXycbIIIdata> iotYfXycb2dataList = mongoService.findAll(IotYfXycbIIIdata.class, cases, "xycbdataCreatedDate desc");
-//        List<IotYfXycbDataListRspVo> iotYfXycbDataListRspVoList = new ArrayList<>();
-//        int i=0;
-//        for(IotYfXycbIIIdata iotYfXycb2data: iotYfXycb2dataList){
-//            i++;
-//            JSONObject jsonObject = iotYfXycb2data.getXycbdataContent();
-//            String cs = "0";
-//            if(!Objects.equals(jsonObject.getInteger("b_c"), 0)){
-//                cs = "1";
-//            }
-//            IotYfXycbDataListRspVo xycbDataListRspVo = new IotYfXycbDataListRspVo();
-//            xycbDataListRspVo.setDevBid(devBid);
-//            xycbDataListRspVo.setDs("1");
-//            xycbDataListRspVo.setWs("1");
-//            xycbDataListRspVo.setAt(jsonObject.getString("at"));
-//            xycbDataListRspVo.setAh(jsonObject.getString("ah"));
-//            xycbDataListRspVo.setBs("0");
-//            xycbDataListRspVo.setCs(cs);
-//            xycbDataListRspVo.setCv("0");
-//            xycbDataListRspVo.setBv(jsonObject.getString("b_v"));
-//            xycbDataListRspVo.setCt((String) jsonObject.getOrDefault("infr_ct", "0"));
-//            xycbDataListRspVo.setCreatedDate(iotYfXycb2data.getXycbdataCreatedDate());
-//
-//            xycbDataListRspVo.setId(""+i);
-//            xycbDataListRspVo.setDevCode(device.getDevCode());
-//
-//            iotYfXycbDataListRspVoList.add(xycbDataListRspVo);
-//        }
-//
-//        return iotYfXycbDataListRspVoList;
-//    }
+
 //    /**
 //     * @param
 //     * @return
@@ -795,68 +871,7 @@ public class IotXycbServiceImpl implements IIotXycbService {
 //    }
 
 
-//
-//    /**
-//     * 修改诱芯信息
-//     *
-//     * @param iotXycbModifyLureReqVo
-//     */
-//    @Override
-//    public int modifyLure(IotXycbModifyLureReqVo iotXycbModifyLureReqVo) {
-//        String devBid = iotXycbModifyLureReqVo.getDevBid();
-//        String pestBusid = iotXycbModifyLureReqVo.getPestBusid();
-//        IotPest iotPest = iotPestService.selectIotPestByPestBid(pestBusid);
-//        if(iotPest == null){
-//            throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "诱芯不存在");
-//        }
-//        IotXyinfoDto iotXyinfoDto = iIotXyinfoService.selectIotXyinfoByDevBid(devBid);
-//
-//        IotXyinfo iotXyinfo = new IotXyinfo();
-//        iotXyinfo.setDevBid(iotXycbModifyLureReqVo.getDevBid());
-//        iotXyinfo.setPestBusid(iotPest.getPestBid());
-//        iotXyinfo.setXyinfoLurename(iotPest.getPestName());
-//        iotXyinfo.setXyinfoLureexpireddate(iotXycbModifyLureReqVo.getXyinfoLureexpireddate());
-//        iotXyinfo.setXyinfoModifier(SecurityUtils.getUserId());
-//        iotXyinfo.setXyinfoModifieddate(DateUtils.dateTimeNow());
-//
-//        int status = 0;
-//        if(iotXyinfoDto == null){
-//            iotXyinfo.setXyinfoBid(iotXyinfo.getUUId());
-//            iotXyinfo.setXyinfoCreator(SecurityUtils.getUserId());
-//            iotXyinfo.setXyinfoCreatedDate(DateUtils.dateTimeNow());
-//            iotXyinfo.setXyinfoDelstatus("0");
-//
-//            status = iIotXyinfoService.insertIotXyinfo(iotXyinfo);
-//        }else{
-//            status = iIotXyinfoService.updateIotXyinfo(iotXyinfo);
-//        }
-//
-//        return status;
-//    }
-//
-//    /**
-//     * 获取诱芯列表
-//     *
-//     * @param iotXycbLureListReqVo
-//     * @return
-//     */
-//    @Override
-//    public List<IotXycbLureListRspVo> getLureList(IotXycbLureListReqVo iotXycbLureListReqVo) {
-//        IotPest selectIotPest = new IotPest();
-//        selectIotPest.setPestName(iotXycbLureListReqVo.getPestName());
-//
-//        startPage();
-//        List<IotPest> iotPestList = iotPestService.selectIotPestList(selectIotPest);
-//        List<IotXycbLureListRspVo> iotXycbLureListRspVoList = new ArrayList<>();
-//        for(IotPest iotPest: iotPestList){
-//            IotXycbLureListRspVo iotXycbLureListRspVo = new IotXycbLureListRspVo();
-//            iotXycbLureListRspVo.setPestName(iotPest.getPestName());
-//            iotXycbLureListRspVo.setPestBusid(iotPest.getPestBid());
-//
-//            iotXycbLureListRspVoList.add(iotXycbLureListRspVo);
-//        }
-//        return iotXycbLureListRspVoList;
-//    }
+
 
 
 }