|
|
@@ -13,10 +13,13 @@ import cn.iocoder.yudao.framework.common.util.object.PageUtils;
|
|
|
import cn.iocoder.yudao.framework.datapermission.core.util.DataPermissionUtils;
|
|
|
import cn.iocoder.yudao.module.pms.ThingsModelDTO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.TableDataInfo;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotdeviceallotlog.vo.IotDeviceAllotLogPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplateattrs.vo.IotDeviceProperty;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotdevicematerial.vo.IotDeviceMaterialRespVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotdeviceperson.vo.IotDevicePersonPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicepersonlog.vo.IotDevicePersonLogPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotdevicerunlog.vo.IotDeviceRunLogRespVO;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicestatuslog.vo.IotDeviceStatusLogPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotmodeltemplateattrs.vo.IotModelTemplateAttrsPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDevicePageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDeviceRespVO;
|
|
|
@@ -26,7 +29,10 @@ import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoClassifyDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotTreeDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotZHBD.DeviceZHBDDO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotdeviceallotlog.IotDeviceAllotLogDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotdeviceperson.IotDevicePersonDO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicepersonlog.IotDevicePersonLogDO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicestatuslog.IotDeviceStatusLogDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmodel.IotModelDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmodeltemplateattrs.IotModelTemplateAttrsDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.tdparams.IotTdParamsDO;
|
|
|
@@ -34,7 +40,10 @@ import cn.iocoder.yudao.module.pms.dal.mysql.IotDeviceMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.IotInfoClassifyMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.IotTreeMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.TDDeviceMapper;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.mysql.iotdeviceallotlog.IotDeviceAllotLogMapper;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.mysql.iotdevicepersonlog.IotDevicePersonLogMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotdevicerunlog.IotDeviceRunLogMapper;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.mysql.iotdevicestatuslog.IotDeviceStatusLogMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotmodel.IotModelMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.tdparams.IotTdParamsMapper;
|
|
|
@@ -74,6 +83,7 @@ import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
@@ -143,6 +153,13 @@ public class IotDeviceServiceImpl implements IotDeviceService {
|
|
|
@Autowired
|
|
|
private IotTdParamsMapper iotTdParamsMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IotDeviceAllotLogMapper iotDeviceAllotLogMapper;
|
|
|
+ @Autowired
|
|
|
+ private IotDevicePersonLogMapper iotDevicePersonLogMapper;
|
|
|
+ @Autowired
|
|
|
+ private IotDeviceStatusLogMapper iotDeviceStatusLogMapper;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public String getDeviceCompany(Long id) {
|
|
|
@@ -782,6 +799,24 @@ public class IotDeviceServiceImpl implements IotDeviceService {
|
|
|
ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
|
|
|
ids.add(pageReqVO.getDeptId());
|
|
|
}
|
|
|
+ // 调拨时间区间搜索 查询在指定时间区间内调拨过的设备
|
|
|
+ LocalDateTime[] allotDateTime = pageReqVO.getCreateTime();
|
|
|
+ Set<Long> timeDeviceIds = new HashSet<>();
|
|
|
+ if (ObjUtil.isNotEmpty(allotDateTime)) {
|
|
|
+ IotDevicePersonLogPageReqVO reqVO = new IotDevicePersonLogPageReqVO();
|
|
|
+ reqVO.setCreateTime(allotDateTime);
|
|
|
+ List<IotDevicePersonLogDO> deviceAllots = iotDevicePersonLogMapper.selectList(reqVO);
|
|
|
+ if (CollUtil.isNotEmpty(deviceAllots)) {
|
|
|
+ deviceAllots.forEach(allot -> {
|
|
|
+ timeDeviceIds.add(allot.getDeviceId());
|
|
|
+ });
|
|
|
+ if (CollUtil.isNotEmpty(timeDeviceIds)) {
|
|
|
+ pageReqVO.setDeviceIds(new ArrayList<>(timeDeviceIds));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return PageResult.empty();
|
|
|
+ }
|
|
|
+ }
|
|
|
// 根据用户昵称模糊搜索 已经设置过此人作为责任人的设备列表
|
|
|
Set<Long> deviceIds = new HashSet<>();
|
|
|
if (StrUtil.isNotBlank(pageReqVO.getNickname())) {
|
|
|
@@ -833,6 +868,24 @@ public class IotDeviceServiceImpl implements IotDeviceService {
|
|
|
ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
|
|
|
ids.add(pageReqVO.getDeptId());
|
|
|
}
|
|
|
+ // 调拨时间区间搜索 查询在指定时间区间内调拨过的设备
|
|
|
+ LocalDateTime[] allotDateTime = pageReqVO.getCreateTime();
|
|
|
+ Set<Long> deviceIds = new HashSet<>();
|
|
|
+ if (ObjUtil.isNotEmpty(allotDateTime)) {
|
|
|
+ IotDeviceStatusLogPageReqVO reqVO = new IotDeviceStatusLogPageReqVO();
|
|
|
+ reqVO.setCreateTime(allotDateTime);
|
|
|
+ List<IotDeviceStatusLogDO> deviceAllots = iotDeviceStatusLogMapper.selectList(reqVO);
|
|
|
+ if (CollUtil.isNotEmpty(deviceAllots)) {
|
|
|
+ deviceAllots.forEach(allot -> {
|
|
|
+ deviceIds.add(allot.getDeviceId());
|
|
|
+ });
|
|
|
+ if (CollUtil.isNotEmpty(deviceIds)) {
|
|
|
+ pageReqVO.setDeviceIds(new ArrayList<>(deviceIds));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return PageResult.empty();
|
|
|
+ }
|
|
|
+ }
|
|
|
try {
|
|
|
IPage<IotDeviceRespVO> page = iotDeviceMapper.deviceStatuses(
|
|
|
new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()), pageReqVO, ids);
|
|
|
@@ -852,6 +905,24 @@ public class IotDeviceServiceImpl implements IotDeviceService {
|
|
|
ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
|
|
|
ids.add(pageReqVO.getDeptId());
|
|
|
}
|
|
|
+ // 调拨时间区间搜索 查询在指定时间区间内调拨过的设备
|
|
|
+ LocalDateTime[] allotDateTime = pageReqVO.getCreateTime();
|
|
|
+ Set<Long> deviceIds = new HashSet<>();
|
|
|
+ if (ObjUtil.isNotEmpty(allotDateTime)) {
|
|
|
+ IotDeviceAllotLogPageReqVO reqVO = new IotDeviceAllotLogPageReqVO();
|
|
|
+ reqVO.setCreateTime(allotDateTime);
|
|
|
+ List<IotDeviceAllotLogDO> deviceAllots = iotDeviceAllotLogMapper.selectList(reqVO);
|
|
|
+ if (CollUtil.isNotEmpty(deviceAllots)) {
|
|
|
+ deviceAllots.forEach(allot -> {
|
|
|
+ deviceIds.add(allot.getDeviceId());
|
|
|
+ });
|
|
|
+ if (CollUtil.isNotEmpty(deviceIds)) {
|
|
|
+ pageReqVO.setDeviceIds(new ArrayList<>(deviceIds));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return PageResult.empty();
|
|
|
+ }
|
|
|
+ }
|
|
|
try {
|
|
|
IPage<IotDeviceRespVO> page = iotDeviceMapper.deviceAllots(
|
|
|
new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()), pageReqVO, ids);
|