Commit 46bf6023 by 朱淼

fix bug

parent 22c51a83
......@@ -5,11 +5,13 @@ import com.makeit.common.page.PageVO;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.dataScreen.PlatDataScreenQueryDTO;
import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
import com.makeit.dto.platform.space.PlatBedQueryDTO;
import com.makeit.module.system.entity.ChinaArea;
import com.makeit.service.platform.dataScreen.DataScreenService;
import com.makeit.utils.area.ChinaAreaVO;
import com.makeit.vo.platform.dataScreen.*;
import com.makeit.vo.platform.device.PlatDeviceListVO;
import com.makeit.vo.platform.space.PlatBedVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -83,4 +85,10 @@ public class DataScreenController {
return ApiResponseUtils.success(dataScreenService.mapList(dto));
}
@ApiOperation("设备分页列表")
@PostMapping("devicePage")
public ApiResponseEntity<PageVO<PlatDeviceListVO>> devicePage(@RequestBody PageReqDTO<PlatDataScreenQueryDTO> pageReqDTO) {
return ApiResponseUtils.success(dataScreenService.devicePage(pageReqDTO));
}
}
......@@ -31,4 +31,7 @@ public class PlatDataScreenQueryDTO {
@ApiModelProperty("类型 1-居家 2-机构")
private String type;
@ApiModelProperty("设备状态")
private String deviceStatus;
}
......@@ -3,8 +3,10 @@ package com.makeit.service.platform.dataScreen;
import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO;
import com.makeit.dto.platform.dataScreen.PlatDataScreenQueryDTO;
import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
import com.makeit.utils.area.ChinaAreaVO;
import com.makeit.vo.platform.dataScreen.*;
import com.makeit.vo.platform.device.PlatDeviceListVO;
import java.util.List;
......@@ -30,4 +32,6 @@ public interface DataScreenService {
List<ChinaAreaVO> mapList(PlatDataScreenQueryDTO dto);
PageVO<PlatAlarmStatisticsListVo> alarmPage(PageReqDTO<PlatDataScreenQueryDTO> page);
PageVO<PlatDeviceListVO> devicePage(PageReqDTO<PlatDataScreenQueryDTO> pageReqDTO);
}
package com.makeit.service.platform.dataScreen.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.makeit.common.entity.BaseEntity;
import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO;
import com.makeit.dto.platform.dataScreen.PlatDataScreenQueryDTO;
import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
import com.makeit.entity.platform.alarm.PlatAlarmRecord;
import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.auth.PlatUser;
......@@ -32,8 +35,10 @@ import com.makeit.utils.area.ChinaAreaVO;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.PageUtil;
import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.old.StringUtils;
import com.makeit.utils.sql.join.JoinUtil;
import com.makeit.vo.platform.dataScreen.*;
import com.makeit.vo.platform.device.PlatDeviceListVO;
import com.makeit.vo.platform.elder.PlatElderListVO;
import jodd.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -470,6 +475,52 @@ public class DataScreenServiceImpl implements DataScreenService {
return PageUtil.toPageVO(list, pages);
}
@Override
public PageVO<PlatDeviceListVO> devicePage(PageReqDTO<PlatDataScreenQueryDTO> pageReqDTO) {
PlatDataScreenQueryDTO dto = pageReqDTO.getData();
if(dto.getOrgIds().isEmpty()){
//获取该账号的权限组织
List<PlatOrg> orgs = belongToScopeList(dto.getType());
if(orgs.isEmpty()){
return new PageVO<>();
}
List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
dto.setOrgIds(orgIds);
}else {
//根据类型过滤数据
List<PlatOrg> platOrgs = platOrgService.list(new QueryWrapper<PlatOrg>().lambda()
.in(PlatOrg::getId, dto.getOrgIds())
.eq(PlatOrg::getType, dto.getType()));
if(platOrgs.isEmpty()){
return new PageVO<>();
}
List<String> orgIdList = platOrgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
dto.setOrgIds(orgIdList);
}
Page<PlatDevice> p = PageUtil.toMpPage(pageReqDTO);
LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<PlatDevice>()
.eq(StringUtils.isNotBlank(dto.getDeviceStatus()), PlatDevice::getStatus, dto.getDeviceStatus())
.in(PlatDevice::getOrgId, dto.getOrgIds())
.orderByDesc(BaseEntity::getUpdateDate);
Page<PlatDevice> page = platDeviceService.page(p, queryWrapper);
List<PlatDeviceListVO> voList = BeanDtoVoUtils.listVo(page.getRecords(), PlatDeviceListVO.class);
JoinUtil.join(voList, platOrgService, PlatDeviceListVO::getOrgId, PlatOrg::getId, (d, o) -> {
d.setOrgName(o.getName());
});
JoinUtil.joinSplit(voList, platOrgService, PlatDeviceListVO::getOrgPath, PlatOrg::getId, (d, o) -> {
d.setOrgPathName(StreamUtil.join(o, PlatOrg::getName));
});
return PageUtil.toPageVO(voList, page);
}
private List<PlatOrg> getAncestorsOrgList(List<PlatOrg> orgs, Set<String> parentOrgIds) {
orgs = orgs.stream().filter(t->parentOrgIds.contains(t.getId())).collect(Collectors.toList());
Set<String> ancestorsOrgIdList = new HashSet<>();
......
......@@ -35,6 +35,7 @@ import com.makeit.service.platform.space.PlatRegionSettingService;
import com.makeit.service.saas.PlatTenantService;
import com.makeit.utils.DeviceCacheUtil;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.JsonUtil;
import com.makeit.utils.data.convert.PageUtil;
import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.old.StringUtils;
......@@ -210,12 +211,16 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
platDeviceOtherService.saveOrUpdate(other);
if(StringUtils.isNotEmpty(other.getAttribute())){
PlatDeviceAttrWechatDTO deviceAttrWechatDTO = JsonUtil.toObj(other.getAttribute(),PlatDeviceAttrWechatDTO.class);
//更新区域设置设备安装方式
platRegionSettingService.update(new UpdateWrapper<PlatRegionSetting>().lambda()
.set(PlatRegionSetting::getInstallType, other.getInstallation())
.set(PlatRegionSetting::getInstallType, deviceAttrWechatDTO.getRadarMount())
.eq(PlatRegionSetting::getDeviceId, other.getDeviceId()));
}
}
@Override
public PageVO<PlatDeviceListVO> pageSaas(PageReqDTO<PlatDevice> pageReqDTO) {
PlatDevice param = pageReqDTO.getData();
......@@ -292,6 +297,11 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
public void editDeviceProperties(PlatDeviceAttrWechatDTO dto) {
devicePropertiesOperateService.deviceWrite(dto.getDeviceId(),dto.getRadarMount(),dto.getRadarMode(),dto.getRadarHight());
//更新区域设置设备安装方式
platRegionSettingService.update(new UpdateWrapper<PlatRegionSetting>().lambda()
.set(PlatRegionSetting::getInstallType, dto.getRadarMount())
.eq(PlatRegionSetting::getDeviceId, dto.getDeviceId()));
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment