|
|
@@ -11,8 +11,10 @@ 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.IotXycbimg;
|
|
|
import com.yunfeiyun.agmp.iot.common.enums.IotDeviceStatusTypeEnum;
|
|
|
import com.yunfeiyun.agmp.iot.common.exception.IotBizException;
|
|
|
+import com.yunfeiyun.agmp.iot.common.service.MongoService;
|
|
|
import com.yunfeiyun.agmp.iotm.common.controller.BaseController;
|
|
|
import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceBaseFunReqVo;
|
|
|
import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceDataListReqVo;
|
|
|
@@ -31,6 +33,8 @@ import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceService;
|
|
|
import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceconfigService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
+import org.springframework.data.mongodb.core.query.Query;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
@@ -73,34 +77,8 @@ public class IotXycbController extends BaseController
|
|
|
@Autowired
|
|
|
private IIotXycbUtilService iIotXycbUtilService;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 查询图片列表
|
|
|
-// */
|
|
|
-// @PreAuthorize("@ss.hasPermi('iot:xycb:image:list')")
|
|
|
-// @GetMapping("/image/list")
|
|
|
-// public TableDataInfo imageList(IotXycbReqVo iotXycbReqVo)
|
|
|
-// {
|
|
|
-// return getDataTable(iIotXycbService.getImageList(iotXycbReqVo));
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// *
|
|
|
-// * @param reqVo
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// @PreAuthorize("@ss.hasPermi('iot:xycb:image:delete')")
|
|
|
-// @DeleteMapping("/image/delete/{xycbimgBid}")
|
|
|
-// public AjaxResult imageDelete(@PathVariable String xycbimgBid){
|
|
|
-// iIotXycbService.imageDelete(xycbimgBid);
|
|
|
-// return AjaxResult.success();
|
|
|
-// }
|
|
|
+ @Autowired
|
|
|
+ private MongoService mongoService;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -209,16 +187,18 @@ public class IotXycbController extends BaseController
|
|
|
* /pt/list 普通性诱测报设备
|
|
|
* /2/list 性诱测报2.0设备 宁录性诱测报设备
|
|
|
* /III/list 性诱测报III设备
|
|
|
+ * /zj/list 中捷四方性诱测报设备
|
|
|
* @param reqVo
|
|
|
* @return
|
|
|
*/
|
|
|
- @GetMapping({"/list", "/pt/list", "/2/list", "/III/list"})
|
|
|
+ @GetMapping({"/list", "/pt/list", "/2/list", "/III/list", "/zj/list"})
|
|
|
public TableDataInfo list(HttpServletRequest request, IotDeviceListReqVo reqVo) {
|
|
|
startPage();
|
|
|
String reqUri = request.getRequestURI();
|
|
|
String[] devTypeList = new String[]{
|
|
|
IotDeviceDictConst.TYPE_YF_XYCB_III,
|
|
|
- IotDeviceDictConst.TYPE_YF_XYCB_2
|
|
|
+ IotDeviceDictConst.TYPE_YF_XYCB_2,
|
|
|
+ IotDeviceDictConst.TYPE_ZJSF_XYCB
|
|
|
};
|
|
|
|
|
|
if(reqUri.endsWith("/pt/list")){
|
|
|
@@ -227,6 +207,8 @@ public class IotXycbController extends BaseController
|
|
|
devTypeList = new String[]{IotDeviceDictConst.TYPE_YF_XYCB_III};
|
|
|
} else if (reqUri.endsWith("/2/list")) {
|
|
|
devTypeList = new String[]{IotDeviceDictConst.TYPE_YF_XYCB_2};
|
|
|
+ } else if (reqUri.endsWith("/zj/list")) {
|
|
|
+ devTypeList = new String[]{IotDeviceDictConst.TYPE_ZJSF_XYCB};
|
|
|
}
|
|
|
reqVo.setDevtypeBidList(Arrays.asList(devTypeList));
|
|
|
List<IotDeviceListResVo> list = iIotDeviceService.selectIotDeviceListByType(reqVo);
|
|
|
@@ -404,4 +386,46 @@ public class IotXycbController extends BaseController
|
|
|
}
|
|
|
return getDataTable(iotXycbLureListRspVoList);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询图片列表
|
|
|
+ */
|
|
|
+ @GetMapping("/image/list")
|
|
|
+ public TableDataInfo imageList(IotDeviceDataListReqVo reqVo)
|
|
|
+ {
|
|
|
+ ValidateUtil.validateDevBid(reqVo.getDevBid());
|
|
|
+ IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
|
|
|
+ iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
|
|
|
+ iotDeviceBaseFunReqVo.setMethodName("imageList");
|
|
|
+ iotDeviceBaseFunReqVo.setParam(reqVo);
|
|
|
+ return iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * 删除图片
|
|
|
+ */
|
|
|
+ @DeleteMapping("/image/delete/{xycbimgBid}")
|
|
|
+ public AjaxResult imageDelete(@PathVariable String xycbimgBid){
|
|
|
+ // 调用通用方法必须有设备devBid, 否则无法定位到具体是那个实现类
|
|
|
+ // 没有devBid 的情况下,实现可以写道Controller层
|
|
|
+ Map<String, String> selectMap = new HashMap<>();
|
|
|
+ selectMap.put("xycbimgBid", xycbimgBid);
|
|
|
+ IotXycbimg iotXycbimg = (IotXycbimg) mongoService.findOne(IotXycbimg.class, selectMap, null, null);
|
|
|
+ if(iotXycbimg == null){
|
|
|
+ throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "图片不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ Criteria criteria = Criteria.where("xycbimgBid").is(xycbimgBid);
|
|
|
+ Query query = new Query(criteria);
|
|
|
+
|
|
|
+ Map<String, Object> updateField = new HashMap<>();
|
|
|
+ updateField.put("xycbimgDelstatus", "1");
|
|
|
+ updateField.put("xycbimgModifieddate", DateUtils.dateTimeNow());
|
|
|
+
|
|
|
+ mongoService.update(IotXycbimg.class, query, updateField);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
}
|