Commit cbd791d9 by 杨伟程
parents 832ac43e 7c9e4dad
...@@ -3,16 +3,10 @@ package com.makeit.module.controller.wechat.space; ...@@ -3,16 +3,10 @@ package com.makeit.module.controller.wechat.space;
import com.makeit.common.dto.BaseIdDTO; import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.response.ApiResponseEntity; import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils; import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.auth.PlatOrgDTO;
import com.makeit.dto.platform.space.PlatSpaceAddDTO; import com.makeit.dto.platform.space.PlatSpaceAddDTO;
import com.makeit.dto.platform.space.PlatSpaceQueryDTO; import com.makeit.dto.platform.space.PlatSpaceQueryDTO;
import com.makeit.dto.platform.space.PlatSpaceVO; import com.makeit.dto.platform.space.PlatSpaceVO;
import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.service.platform.space.PlatSpaceService; import com.makeit.service.platform.space.PlatSpaceService;
import com.makeit.utils.user.plat.PlatUserVO;
import com.makeit.utils.user.wechat.WechatUserInfo;
import com.makeit.utils.user.wechat.WechatUserUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -74,9 +68,9 @@ public class PlatSpaceWechatController { ...@@ -74,9 +68,9 @@ public class PlatSpaceWechatController {
} }
@ApiOperation("一级空间列表(该账号权限下)") @ApiOperation("一级空间列表")
@PostMapping("oneLevelList") @PostMapping("oneLevelList")
public ApiResponseEntity<List<PlatSpaceAddDTO>> oneLevelList(@RequestBody PlatOrgDTO dto) { public ApiResponseEntity<List<PlatSpaceAddDTO>> oneLevelList(@RequestBody BaseIdDTO dto) {
List<PlatSpaceAddDTO> data = spaceService.oneLevelList(dto); List<PlatSpaceAddDTO> data = spaceService.oneLevelList(dto);
return ApiResponseUtils.success(data); return ApiResponseUtils.success(data);
} }
......
...@@ -83,6 +83,9 @@ public class PlatAlarmRecord extends BaseBusEntity { ...@@ -83,6 +83,9 @@ public class PlatAlarmRecord extends BaseBusEntity {
//异常值 //异常值
private String abnormalValue; private String abnormalValue;
@ApiModelProperty("区域名称")
private String regionName;
} }
......
...@@ -322,6 +322,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -322,6 +322,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice(); PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice();
List<String> param = platAlarmCheckDTO.getParam(); List<String> param = platAlarmCheckDTO.getParam();
List<PlatElder> elderList = platAlarmCheckDTO.getPlatElderList(); List<PlatElder> elderList = platAlarmCheckDTO.getPlatElderList();
PlatRegionSetting platRegionSetting = platAlarmCheckDTO.getPlatRegionSetting();
PlatAlarmRecord platAlarmRecord = new PlatAlarmRecord(); PlatAlarmRecord platAlarmRecord = new PlatAlarmRecord();
platAlarmRecord.setAlarmId(config.getId()); platAlarmRecord.setAlarmId(config.getId());
...@@ -339,6 +340,9 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -339,6 +340,9 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
platAlarmRecord.setTenantId(config.getTenantId()); platAlarmRecord.setTenantId(config.getTenantId());
platAlarmRecord.setRemark(platAlarmCheckDTO.getRemark()); platAlarmRecord.setRemark(platAlarmCheckDTO.getRemark());
platAlarmRecord.setAbnormalValue(platAlarmCheckDTO.getAbnormalValue()); platAlarmRecord.setAbnormalValue(platAlarmCheckDTO.getAbnormalValue());
if(platRegionSetting!=null) {
platAlarmRecord.setRegionName(platRegionSetting.getRegionName());
}
return platAlarmRecord; return platAlarmRecord;
} }
......
...@@ -386,6 +386,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -386,6 +386,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
//如果是租户账号 则有所有权限 //如果是租户账号 则有所有权限
if (StringUtils.equals(isTenant, CommonEnum.YES.getValue())) { if (StringUtils.equals(isTenant, CommonEnum.YES.getValue())) {
List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>() List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>()
.eq(StringUtils.isNotEmpty(param.getType()), PlatOrg::getType, param.getType())
.eq(PlatOrg::getStatus, CommonEnum.YES.getValue()) .eq(PlatOrg::getStatus, CommonEnum.YES.getValue())
); );
return getOrgTree(orgList, Collections.singletonList(TenantIdUtil.getTenantId())); return getOrgTree(orgList, Collections.singletonList(TenantIdUtil.getTenantId()));
...@@ -393,7 +394,9 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -393,7 +394,9 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
//平台账号 //平台账号
Set<String> orgIdList = getOrgIdListByUserId(userVO.getId()); Set<String> orgIdList = getOrgIdListByUserId(userVO.getId());
List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>().in(BaseEntity::getId, orgIdList).eq(PlatOrg::getStatus, CommonEnum.YES.getValue())); List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>()
.eq(StringUtils.isNotEmpty(param.getType()), PlatOrg::getType, param.getType())
.in(BaseEntity::getId, orgIdList).eq(PlatOrg::getStatus, CommonEnum.YES.getValue()));
if (CollectionUtils.isEmpty(orgList)) { if (CollectionUtils.isEmpty(orgList)) {
return new ArrayList<>(); return new ArrayList<>();
} }
...@@ -464,6 +467,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -464,6 +467,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
//如果是租户账号 则有所有权限 //如果是租户账号 则有所有权限
if (StringUtils.equals(isTenant, CommonEnum.YES.getValue())) { if (StringUtils.equals(isTenant, CommonEnum.YES.getValue())) {
List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>() List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>()
.eq(StringUtils.isNotEmpty(param.getType()), PlatOrg::getType, param.getType())
.eq(PlatOrg::getStatus, CommonEnum.YES.getValue()) .eq(PlatOrg::getStatus, CommonEnum.YES.getValue())
); );
return orgList; return orgList;
...@@ -471,7 +475,9 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -471,7 +475,9 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
//平台账号 //平台账号
Set<String> orgIdList = getOrgIdListByUserId(userVO.getId()); Set<String> orgIdList = getOrgIdListByUserId(userVO.getId());
List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>().in(BaseEntity::getId, orgIdList).eq(PlatOrg::getStatus, CommonEnum.YES.getValue())); List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>()
.eq(StringUtils.isNotEmpty(param.getType()), PlatOrg::getType, param.getType())
.in(BaseEntity::getId, orgIdList).eq(PlatOrg::getStatus, CommonEnum.YES.getValue()));
if (CollectionUtils.isEmpty(orgList)) { if (CollectionUtils.isEmpty(orgList)) {
return new ArrayList<>(); return new ArrayList<>();
} }
......
package com.makeit.service.platform.space; package com.makeit.service.platform.space;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.dto.platform.auth.PlatOrgDTO; import com.makeit.common.dto.BaseIdDTO;
import com.makeit.dto.platform.space.PlatSpaceAddDTO; import com.makeit.dto.platform.space.PlatSpaceAddDTO;
import com.makeit.dto.platform.space.PlatSpaceQueryDTO; import com.makeit.dto.platform.space.PlatSpaceQueryDTO;
import com.makeit.dto.platform.space.PlatSpaceVO; import com.makeit.dto.platform.space.PlatSpaceVO;
import com.makeit.entity.platform.space.PlatSpace; import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.utils.user.wechat.WechatUserInfo;
import com.makeit.vo.platform.space.PlatSpaceAndRoomVO; import com.makeit.vo.platform.space.PlatSpaceAndRoomVO;
import java.util.List; import java.util.List;
...@@ -62,7 +61,7 @@ public interface PlatSpaceService extends IService<PlatSpace> { ...@@ -62,7 +61,7 @@ public interface PlatSpaceService extends IService<PlatSpace> {
List<PlatSpace> listChild(List<String> spaceIds); List<PlatSpace> listChild(List<String> spaceIds);
List<PlatSpaceAddDTO> oneLevelList(PlatOrgDTO dtom); List<PlatSpaceAddDTO> oneLevelList(BaseIdDTO dto);
PlatSpaceVO child(PlatSpaceVO vo, Map<String,List<PlatSpace>> map); PlatSpaceVO child(PlatSpaceVO vo, Map<String,List<PlatSpace>> map);
......
...@@ -3,7 +3,7 @@ package com.makeit.service.platform.space.impl; ...@@ -3,7 +3,7 @@ package com.makeit.service.platform.space.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.dto.platform.auth.PlatOrgDTO; import com.makeit.common.dto.BaseIdDTO;
import com.makeit.dto.platform.space.PlatSpaceAddDTO; import com.makeit.dto.platform.space.PlatSpaceAddDTO;
import com.makeit.dto.platform.space.PlatSpaceQueryDTO; import com.makeit.dto.platform.space.PlatSpaceQueryDTO;
import com.makeit.dto.platform.space.PlatSpaceVO; import com.makeit.dto.platform.space.PlatSpaceVO;
...@@ -21,8 +21,6 @@ import com.makeit.service.platform.space.PlatSpaceService; ...@@ -21,8 +21,6 @@ import com.makeit.service.platform.space.PlatSpaceService;
import com.makeit.utils.data.convert.BeanDtoVoUtils; import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.user.plat.PlatUserUtil; import com.makeit.utils.user.plat.PlatUserUtil;
import com.makeit.utils.user.plat.PlatUserVO; import com.makeit.utils.user.plat.PlatUserVO;
import com.makeit.utils.user.wechat.WechatUserInfo;
import com.makeit.utils.user.wechat.WechatUserUtil;
import com.makeit.vo.platform.space.PlatSpaceAndRoomVO; import com.makeit.vo.platform.space.PlatSpaceAndRoomVO;
import jodd.util.StringUtil; import jodd.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -208,19 +206,11 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -208,19 +206,11 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
} }
@Override @Override
public List<PlatSpaceAddDTO> oneLevelList(PlatOrgDTO dto) { public List<PlatSpaceAddDTO> oneLevelList(BaseIdDTO dto) {
//获取该账号的权限组织
PlatOrg param = new PlatOrg();
param.setType(dto.getType());
List<PlatOrg> orgs = platOrgService.belongToScopeList(param);
if(orgs.isEmpty()){
return new ArrayList<>();
}
List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
List<PlatSpace> spaces = list(new QueryWrapper<PlatSpace>().lambda() List<PlatSpace> spaces = list(new QueryWrapper<PlatSpace>().lambda()
.isNull(PlatSpace::getParentId) .isNull(PlatSpace::getParentId)
.in(PlatSpace::getOrgId, orgIds)); .eq(PlatSpace::getOrgId, dto.getId()));
return BeanDtoVoUtils.listVo(spaces, PlatSpaceAddDTO.class); return BeanDtoVoUtils.listVo(spaces, PlatSpaceAddDTO.class);
} }
......
...@@ -25,7 +25,6 @@ import com.makeit.service.platform.workstation.WorkStationService; ...@@ -25,7 +25,6 @@ import com.makeit.service.platform.workstation.WorkStationService;
import com.makeit.utils.data.convert.StreamUtil; import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.sql.join.JoinUtil; import com.makeit.utils.sql.join.JoinUtil;
import com.makeit.vo.platform.elder.realtime.PlatElderRealTimeNowVO; import com.makeit.vo.platform.elder.realtime.PlatElderRealTimeNowVO;
import com.makeit.vo.platform.space.PlatBedPanoramaVO;
import com.makeit.vo.platform.workstation.*; import com.makeit.vo.platform.workstation.*;
import jodd.util.StringUtil; import jodd.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -254,7 +253,7 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -254,7 +253,7 @@ public class WorkStationServiceImpl implements WorkStationService {
WorkStationHomeStatisticsVO vo = new WorkStationHomeStatisticsVO(); WorkStationHomeStatisticsVO vo = new WorkStationHomeStatisticsVO();
if (dto.getOrgIds().isEmpty()) { if (dto.getOrgIds().isEmpty()) {
//获取该账号的权限组织 //获取该账号的权限组织
List<PlatOrg> orgs = belongToScopeList(PlatOrgEnum.OrgTypeEnum.INSTITUTION.getValue()); List<PlatOrg> orgs = belongToScopeList(PlatOrgEnum.OrgTypeEnum.HOME.getValue());
if (orgs.isEmpty()) { if (orgs.isEmpty()) {
return vo; return vo;
} }
...@@ -293,7 +292,7 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -293,7 +292,7 @@ public class WorkStationServiceImpl implements WorkStationService {
public List<WorkStationHomeBedVO> homeList(WorkStationQueryDTO dto) { public List<WorkStationHomeBedVO> homeList(WorkStationQueryDTO dto) {
List<PlatSpace> spaces = new ArrayList<>(); List<PlatSpace> spaces = new ArrayList<>();
//获取该账号的权限组织 //获取该账号的权限组织
List<PlatOrg> orgs = belongToScopeList(PlatOrgEnum.OrgTypeEnum.INSTITUTION.getValue()); List<PlatOrg> orgs = belongToScopeList(PlatOrgEnum.OrgTypeEnum.HOME.getValue());
if (orgs.isEmpty()) { if (orgs.isEmpty()) {
return new ArrayList<>(); return new ArrayList<>();
} }
......
...@@ -50,7 +50,7 @@ public class IotSyncTask { ...@@ -50,7 +50,7 @@ public class IotSyncTask {
* 启用状态的租户才同步 * 启用状态的租户才同步
* 新增和更新平台端设备表 * 新增和更新平台端设备表
*/ */
// @Scheduled(cron = "0 0 */1 * * ?") //@Scheduled(cron = "0 0 */1 * * ?")
@TenantIdIgnore @TenantIdIgnore
public void syncEquipmentInfo() { public void syncEquipmentInfo() {
log.info("开始执行同步设备信息接口"); log.info("开始执行同步设备信息接口");
...@@ -109,8 +109,10 @@ public class IotSyncTask { ...@@ -109,8 +109,10 @@ public class IotSyncTask {
platDevice.setName(iotDevice.getName()); platDevice.setName(iotDevice.getName());
platDevice.setProductName(iotDevice.getProductName()); platDevice.setProductName(iotDevice.getProductName());
platDevice.setProductId(iotDevice.getProductId()); platDevice.setProductId(iotDevice.getProductId());
LocalDateTime registryTime = LocalDateTime.ofEpochSecond(iotDevice.getRegistryTime() / 1000, 0, ZoneOffset.ofHours(8)); if(iotDevice.getRegistryTime()!=null) {
platDevice.setRegistrationDate(registryTime); LocalDateTime registryTime = LocalDateTime.ofEpochSecond(iotDevice.getRegistryTime() / 1000, 0, ZoneOffset.ofHours(8));
platDevice.setRegistrationDate(registryTime);
}
platDevice.setDescription(iotDevice.getDescribe()); platDevice.setDescription(iotDevice.getDescribe());
String state = iotDevice.getState(); String state = iotDevice.getState();
DeviceState deviceState = JSON.parseObject(state, DeviceState.class); DeviceState deviceState = JSON.parseObject(state, DeviceState.class);
......
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