Commit 7d2b5627 by 杨伟程
parents 91fcb0d7 3c272028
Showing with 264 additions and 28 deletions
...@@ -387,6 +387,10 @@ CREATE TABLE `plat_elder_report_month` ...@@ -387,6 +387,10 @@ CREATE TABLE `plat_elder_report_month`
) ENGINE = InnoDB ) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='长者月报'; DEFAULT CHARSET = utf8mb4 COMMENT ='长者月报';
ALTER TABLE `dev_iot_yanglao_platform`.`plat_elder_sleep_analysis`
ADD COLUMN `action_count` int(4) COMMENT '体动次数' AFTER `happen_date`,
ADD COLUMN `turned_count` int(4) COMMENT '翻身次数' AFTER `action_count`;
CREATE TABLE `plat_elder_breathe_day_stat` CREATE TABLE `plat_elder_breathe_day_stat`
( (
`id` varchar(64) NOT NULL COMMENT 'id', `id` varchar(64) NOT NULL COMMENT 'id',
......
...@@ -96,5 +96,6 @@ CREATE TABLE `plat_region_setting` ...@@ -96,5 +96,6 @@ CREATE TABLE `plat_region_setting`
`update_date` datetime DEFAULT NULL COMMENT '更新时间', `update_date` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` int(1) DEFAULT '0' COMMENT '删除标记', `del_flag` int(1) DEFAULT '0' COMMENT '删除标记',
`tenant_id` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT ' 租户id ', `tenant_id` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT ' 租户id ',
`background` varchar(64) DEFAULT NULL COMMENT '背景色',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='区域设置'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='区域设置';
...@@ -9,7 +9,9 @@ import lombok.Getter; ...@@ -9,7 +9,9 @@ import lombok.Getter;
public enum DeviceState { public enum DeviceState {
notActive("notActive","禁用"), notActive("notActive","禁用"),
offline("offline","离线"), offline("offline","离线"),
online("online","在线"); online("online","在线"),
abnormal("abnormal","故障");
private final String value; private final String value;
private final String name; private final String name;
......
...@@ -9,6 +9,7 @@ import com.makeit.dto.platform.space.PlatBedEditDTO; ...@@ -9,6 +9,7 @@ import com.makeit.dto.platform.space.PlatBedEditDTO;
import com.makeit.dto.platform.space.PlatBedQueryDTO; import com.makeit.dto.platform.space.PlatBedQueryDTO;
import com.makeit.entity.platform.space.PlatBed; import com.makeit.entity.platform.space.PlatBed;
import com.makeit.service.platform.space.PlatBedService; import com.makeit.service.platform.space.PlatBedService;
import com.makeit.vo.platform.space.PlatBedVo;
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;
...@@ -35,8 +36,8 @@ public class PlatBedController { ...@@ -35,8 +36,8 @@ public class PlatBedController {
@ApiOperation("列表") @ApiOperation("列表")
@PostMapping("page") @PostMapping("page")
public ApiResponseEntity<PageVO<PlatBed>> page(@RequestBody PageReqDTO<PlatBedQueryDTO> page) { public ApiResponseEntity<PageVO<PlatBedVo>> page(@RequestBody PageReqDTO<PlatBedQueryDTO> page) {
PageVO<PlatBed> data = platBedService.page(page); PageVO<PlatBedVo> data = platBedService.page(page);
return ApiResponseUtils.success(data); return ApiResponseUtils.success(data);
} }
......
...@@ -3,8 +3,11 @@ package com.makeit.module.controller.space; ...@@ -3,8 +3,11 @@ package com.makeit.module.controller.space;
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.space.PlatRegionSettingDTO; import com.makeit.dto.platform.space.PlatRegionSettingDTO;
import com.makeit.dto.platform.space.PlatRegionSettingListDTO;
import com.makeit.dto.platform.space.PlatRegionSettingLocateDTO;
import com.makeit.dto.platform.space.PlatRegionSettingQueryDTO; import com.makeit.dto.platform.space.PlatRegionSettingQueryDTO;
import com.makeit.service.platform.space.PlatRegionSettingService; import com.makeit.service.platform.space.PlatRegionSettingService;
import com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO;
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;
...@@ -42,4 +45,18 @@ public class PlatRegionSettingController { ...@@ -42,4 +45,18 @@ public class PlatRegionSettingController {
return ApiResponseUtils.success(); return ApiResponseUtils.success();
} }
@ApiOperation("批量编辑")
@PostMapping("batchEdit")
public ApiResponseEntity<?> batchEdit(@RequestBody PlatRegionSettingListDTO dto) {
platRegionSettingService.batchEdit(dto.getList());
return ApiResponseUtils.success();
}
@ApiOperation("定位")
@PostMapping("locate")
public ApiResponseEntity<List<PlatElderCoordinateVO>> locate(@RequestBody PlatRegionSettingLocateDTO dto) {
List<PlatElderCoordinateVO> list = platRegionSettingService.locate(dto);
return ApiResponseUtils.success(list);
}
} }
...@@ -9,6 +9,7 @@ import com.makeit.dto.platform.space.PlatBedEditDTO; ...@@ -9,6 +9,7 @@ import com.makeit.dto.platform.space.PlatBedEditDTO;
import com.makeit.dto.platform.space.PlatBedQueryDTO; import com.makeit.dto.platform.space.PlatBedQueryDTO;
import com.makeit.entity.platform.space.PlatBed; import com.makeit.entity.platform.space.PlatBed;
import com.makeit.service.platform.space.PlatBedService; import com.makeit.service.platform.space.PlatBedService;
import com.makeit.vo.platform.space.PlatBedVo;
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;
...@@ -36,8 +37,8 @@ public class PlatBedWechatController { ...@@ -36,8 +37,8 @@ public class PlatBedWechatController {
@ApiOperation("列表") @ApiOperation("列表")
@PostMapping("page") @PostMapping("page")
public ApiResponseEntity<PageVO<PlatBed>> page(@RequestBody PageReqDTO<PlatBedQueryDTO> page) { public ApiResponseEntity<PageVO<PlatBedVo>> page(@RequestBody PageReqDTO<PlatBedQueryDTO> page) {
PageVO<PlatBed> data = platBedService.page(page); PageVO<PlatBedVo> data = platBedService.page(page);
return ApiResponseUtils.success(data); return ApiResponseUtils.success(data);
} }
......
...@@ -3,8 +3,11 @@ package com.makeit.module.controller.wechat.space; ...@@ -3,8 +3,11 @@ package com.makeit.module.controller.wechat.space;
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.space.PlatRegionSettingDTO; import com.makeit.dto.platform.space.PlatRegionSettingDTO;
import com.makeit.dto.platform.space.PlatRegionSettingListDTO;
import com.makeit.dto.platform.space.PlatRegionSettingLocateDTO;
import com.makeit.dto.platform.space.PlatRegionSettingQueryDTO; import com.makeit.dto.platform.space.PlatRegionSettingQueryDTO;
import com.makeit.service.platform.space.PlatRegionSettingService; import com.makeit.service.platform.space.PlatRegionSettingService;
import com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO;
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;
...@@ -42,4 +45,18 @@ public class PlatRegionSettingWechatController { ...@@ -42,4 +45,18 @@ public class PlatRegionSettingWechatController {
platRegionSettingService.edit(dto); platRegionSettingService.edit(dto);
return ApiResponseUtils.success(); return ApiResponseUtils.success();
} }
@ApiOperation("批量编辑")
@PostMapping("batchEdit")
public ApiResponseEntity<?> batchEdit(@RequestBody PlatRegionSettingListDTO dto) {
platRegionSettingService.batchEdit(dto.getList());
return ApiResponseUtils.success();
}
@ApiOperation("定位")
@PostMapping("locate")
public ApiResponseEntity<List<PlatElderCoordinateVO>> locate(@RequestBody PlatRegionSettingLocateDTO dto) {
List<PlatElderCoordinateVO> list = platRegionSettingService.locate(dto);
return ApiResponseUtils.success(list);
}
} }
...@@ -29,6 +29,9 @@ public class PlatRegionSettingDTO extends BaseIdDTO { ...@@ -29,6 +29,9 @@ public class PlatRegionSettingDTO extends BaseIdDTO {
@ApiModelProperty("房间门定位") @ApiModelProperty("房间门定位")
private String roomRange; private String roomRange;
@ApiModelProperty("背景色")
private String background;
@ApiModelProperty("设备ID") @ApiModelProperty("设备ID")
private String deviceId; private String deviceId;
......
package com.makeit.dto.platform.space;
import com.makeit.common.dto.BaseIdDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @Author:lzy
* @Date:2023/9/8 14:51
* @Describe:
*/
@Data
@ApiModel("PlatRegionSettingListDTO")
public class PlatRegionSettingListDTO{
private List<PlatRegionSettingDTO> list;
}
package com.makeit.dto.platform.space;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.makeit.common.dto.BaseIdDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @Author:lzy
* @Date:2023/9/8 14:51
* @Describe:
*/
@Data
@ApiModel("PlatRegionSettingLocateDTO")
public class PlatRegionSettingLocateDTO{
@ApiModelProperty("原始设备ID")
private String deviceId;
@ApiModelProperty("开始时间(yyyy-MM-dd HH:mm:ss)")
private String startTime;
@ApiModelProperty("结束时间(yyyy-MM-dd HH:mm:ss)")
private String endTime;
}
...@@ -42,4 +42,7 @@ public class PlatRegionSetting extends BaseBusEntity { ...@@ -42,4 +42,7 @@ public class PlatRegionSetting extends BaseBusEntity {
@ApiModelProperty("房间ID") @ApiModelProperty("房间ID")
private String roomId; private String roomId;
@ApiModelProperty("背景色")
private String background;
} }
package com.makeit.mapper.platform.space; package com.makeit.mapper.platform.space;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.makeit.dto.platform.space.PlatBedPanoramaDTO; import com.makeit.dto.platform.space.PlatBedPanoramaDTO;
import com.makeit.dto.platform.space.PlatBedQueryDTO;
import com.makeit.dto.platform.workstation.WorkStationQueryDTO; import com.makeit.dto.platform.workstation.WorkStationQueryDTO;
import com.makeit.dto.saas.SaasOperationLogDTO;
import com.makeit.entity.platform.space.PlatBed; import com.makeit.entity.platform.space.PlatBed;
import com.makeit.vo.platform.space.PlatBedPanoramaVO; import com.makeit.vo.platform.space.PlatBedPanoramaVO;
import com.makeit.vo.platform.space.PlatBedVo;
import com.makeit.vo.platform.workstation.WorkStationHomeBedVO; import com.makeit.vo.platform.workstation.WorkStationHomeBedVO;
import com.makeit.vo.platform.workstation.WorkStationInstitutionBedVO; import com.makeit.vo.platform.workstation.WorkStationInstitutionBedVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -26,4 +30,6 @@ public interface PlatBedMapper extends BaseMapper<PlatBed> { ...@@ -26,4 +30,6 @@ public interface PlatBedMapper extends BaseMapper<PlatBed> {
List<WorkStationInstitutionBedVO> selectByRoomIds(@Param("roomIds")List<String> roomIds); List<WorkStationInstitutionBedVO> selectByRoomIds(@Param("roomIds")List<String> roomIds);
List<WorkStationHomeBedVO> selectByCondition(@Param("dto")WorkStationQueryDTO dto); List<WorkStationHomeBedVO> selectByCondition(@Param("dto")WorkStationQueryDTO dto);
Page<PlatBedVo> getPage(Page<PlatBedQueryDTO> page, @Param("params")PlatBedQueryDTO data);
} }
...@@ -13,6 +13,7 @@ import com.makeit.entity.platform.auth.PlatOrg; ...@@ -13,6 +13,7 @@ import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.auth.PlatRole; import com.makeit.entity.platform.auth.PlatRole;
import com.makeit.entity.platform.auth.PlatRoleOrg; import com.makeit.entity.platform.auth.PlatRoleOrg;
import com.makeit.entity.platform.auth.PlatUserRole; import com.makeit.entity.platform.auth.PlatUserRole;
import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.enums.CodeMessageEnum; import com.makeit.enums.CodeMessageEnum;
import com.makeit.enums.CommonEnum; import com.makeit.enums.CommonEnum;
import com.makeit.enums.id.TreeConst; import com.makeit.enums.id.TreeConst;
...@@ -25,6 +26,7 @@ import com.makeit.service.platform.auth.PlatRoleOrgService; ...@@ -25,6 +26,7 @@ import com.makeit.service.platform.auth.PlatRoleOrgService;
import com.makeit.service.platform.auth.PlatRoleService; import com.makeit.service.platform.auth.PlatRoleService;
import com.makeit.service.platform.auth.PlatUserRoleService; import com.makeit.service.platform.auth.PlatUserRoleService;
import com.makeit.service.platform.auth.PlatUserService; import com.makeit.service.platform.auth.PlatUserService;
import com.makeit.service.platform.space.PlatSpaceService;
import com.makeit.utils.data.convert.PageUtil; import com.makeit.utils.data.convert.PageUtil;
import com.makeit.utils.data.convert.StreamUtil; import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.user.plat.PlatUserUtil; import com.makeit.utils.user.plat.PlatUserUtil;
...@@ -70,6 +72,8 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -70,6 +72,8 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
@Autowired @Autowired
private PlatAlarmConfigService platAlarmConfigService; private PlatAlarmConfigService platAlarmConfigService;
@Autowired
private PlatSpaceService platSpaceService;
@Override @Override
public List<PlatOrg> filter(List<PlatOrg> deptList, PlatOrgQueryDTO dto) { public List<PlatOrg> filter(List<PlatOrg> deptList, PlatOrgQueryDTO dto) {
...@@ -299,12 +303,22 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -299,12 +303,22 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
@Override @Override
public void edit(PlatOrg dto) { public void edit(PlatOrg dto) {
check(dto); check(dto);
PlatOrg platOrg = this.getById(dto.getId());
if (StringUtils.isBlank(dto.getParentId())||StringUtils.equals(dto.getParentId(),"1")) { if (StringUtils.isBlank(dto.getParentId())||StringUtils.equals(dto.getParentId(),"1")) {
} else { } else {
PlatOrg parent = getById(dto.getParentId()); PlatOrg parent = getById(dto.getParentId());
dto.setPath(parent.getPath() + "," + parent.getId()); dto.setPath(parent.getPath() + "," + parent.getId());
} }
if(!StringUtils.equals(dto.getType(),platOrg.getType())){
LambdaUpdateWrapper<PlatSpace> platSpaceLambdaUpdateWrapper = Wrappers.lambdaUpdate(PlatSpace.class)
.set(PlatSpace::getAttribute, dto.getType())
.eq(PlatSpace::getOrgId, dto.getId());
platSpaceService.update(platSpaceLambdaUpdateWrapper);
}
updateById(dto); updateById(dto);
} }
......
...@@ -387,11 +387,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -387,11 +387,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_AUTH_USER_PASSWORD); throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_AUTH_USER_PASSWORD);
} }
/**
* 校验机场
*/
//checkUserOrg(platUser);
PlatUserLoginVO userLoginVO = BeanDtoVoUtils.convert(platUser, PlatUserLoginVO.class); PlatUserLoginVO userLoginVO = BeanDtoVoUtils.convert(platUser, PlatUserLoginVO.class);
String token = IdGen.getUUID(); String token = IdGen.getUUID();
...@@ -404,14 +399,14 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -404,14 +399,14 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
return userLoginVO; return userLoginVO;
} }
@Override
public void checkTenantOrgStatus(PlatUser platUser) { public void checkTenantOrgStatus(PlatUser platUser) {
PlatTenant platTenant = platTenantService.getById(platUser.getTenantId()); PlatTenant platTenant = platTenantService.getById(platUser.getTenantId());
if(platTenant == null || StringUtils.equals(platTenant.getStatus(),CommonEnum.NO.getValue())){ if(platTenant == null || StringUtils.equals(platTenant.getStatus(),CommonEnum.NO.getValue())){
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_TENANT_FORBIDDEN); throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_TENANT_FORBIDDEN);
} }
PlatOrg platOrg = platOrgService.getById(platUser.getOrgId()); if(StringUtils.equals(platUser.getIsTenant(),CommonEnum.NO.getValue())) {
if(platOrg == null || StringUtils.equals(platOrg.getStatus(),CommonEnum.NO.getValue())){ checkUserOrg(platUser);
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_ORG_FORBIDDEN);
} }
} }
...@@ -434,7 +429,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -434,7 +429,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.eq(PlatOrg::getStatus, CommonEnum.NO.getValue()); .eq(PlatOrg::getStatus, CommonEnum.NO.getValue());
long count = platOrgService.count(platOrgLambdaQueryWrapper); long count = platOrgService.count(platOrgLambdaQueryWrapper);
if (count > 0) { if (count > 0) {
throw new BusinessException("禁用的子公司其下属账号无法登录"); throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_ORG_FORBIDDEN);
} }
} }
......
...@@ -9,6 +9,7 @@ import com.makeit.dto.platform.workstation.WorkStationQueryDTO; ...@@ -9,6 +9,7 @@ import com.makeit.dto.platform.workstation.WorkStationQueryDTO;
import com.makeit.entity.platform.space.PlatBed; import com.makeit.entity.platform.space.PlatBed;
import com.makeit.entity.platform.space.PlatRoom; import com.makeit.entity.platform.space.PlatRoom;
import com.makeit.vo.platform.space.PlatBedPanoramaVO; import com.makeit.vo.platform.space.PlatBedPanoramaVO;
import com.makeit.vo.platform.space.PlatBedVo;
import com.makeit.vo.platform.workstation.WorkStationHomeBedVO; import com.makeit.vo.platform.workstation.WorkStationHomeBedVO;
import com.makeit.vo.platform.workstation.WorkStationInstitutionBedVO; import com.makeit.vo.platform.workstation.WorkStationInstitutionBedVO;
...@@ -32,7 +33,7 @@ public interface PlatBedService extends IService<PlatBed> { ...@@ -32,7 +33,7 @@ public interface PlatBedService extends IService<PlatBed> {
* @param pageReqDTO * @param pageReqDTO
* @return * @return
*/ */
PageVO<PlatBed> page(PageReqDTO<PlatBedQueryDTO> pageReqDTO); PageVO<PlatBedVo> page(PageReqDTO<PlatBedQueryDTO> pageReqDTO);
/** /**
* *
......
...@@ -2,8 +2,10 @@ package com.makeit.service.platform.space; ...@@ -2,8 +2,10 @@ 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.space.PlatRegionSettingDTO; import com.makeit.dto.platform.space.PlatRegionSettingDTO;
import com.makeit.dto.platform.space.PlatRegionSettingLocateDTO;
import com.makeit.dto.platform.space.PlatRegionSettingQueryDTO; import com.makeit.dto.platform.space.PlatRegionSettingQueryDTO;
import com.makeit.entity.platform.space.PlatRegionSetting; import com.makeit.entity.platform.space.PlatRegionSetting;
import com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO;
import java.util.List; import java.util.List;
...@@ -40,4 +42,8 @@ public interface PlatRegionSettingService extends IService<PlatRegionSetting> { ...@@ -40,4 +42,8 @@ public interface PlatRegionSettingService extends IService<PlatRegionSetting> {
* @param dto * @param dto
*/ */
void edit(PlatRegionSettingDTO dto); void edit(PlatRegionSettingDTO dto);
void batchEdit(List<PlatRegionSettingDTO> dtos);
List<PlatElderCoordinateVO> locate(PlatRegionSettingLocateDTO dto);
} }
...@@ -21,6 +21,7 @@ import com.makeit.service.platform.space.PlatRoomBedDeviceService; ...@@ -21,6 +21,7 @@ import com.makeit.service.platform.space.PlatRoomBedDeviceService;
import com.makeit.service.platform.space.PlatRoomService; import com.makeit.service.platform.space.PlatRoomService;
import com.makeit.utils.data.convert.PageUtil; import com.makeit.utils.data.convert.PageUtil;
import com.makeit.vo.platform.space.PlatBedPanoramaVO; import com.makeit.vo.platform.space.PlatBedPanoramaVO;
import com.makeit.vo.platform.space.PlatBedVo;
import com.makeit.vo.platform.workstation.WorkStationHomeBedVO; import com.makeit.vo.platform.workstation.WorkStationHomeBedVO;
import com.makeit.vo.platform.workstation.WorkStationInstitutionBedVO; import com.makeit.vo.platform.workstation.WorkStationInstitutionBedVO;
import jodd.util.StringUtil; import jodd.util.StringUtil;
...@@ -81,15 +82,12 @@ public class PlatBedServiceImpl extends ServiceImpl<PlatBedMapper, PlatBed> impl ...@@ -81,15 +82,12 @@ public class PlatBedServiceImpl extends ServiceImpl<PlatBedMapper, PlatBed> impl
} }
@Override @Override
public PageVO<PlatBed> page(PageReqDTO<PlatBedQueryDTO> pageReqDTO) { public PageVO<PlatBedVo> page(PageReqDTO<PlatBedQueryDTO> pageReqDTO) {
Page<PlatBedVo> pages = baseMapper.getPage(
new Page<>(pageReqDTO.getPage(),pageReqDTO.getLimit()), pageReqDTO.getData());
return PageUtil.toPageVO(pages);
PlatBedQueryDTO dto = pageReqDTO.getData();
Page<PlatBed> p = PageUtil.toMpPage(pageReqDTO);
LambdaQueryWrapper<PlatBed> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.like(StringUtil.isNotEmpty(dto.getName()), PlatBed::getName, dto.getName());
queryWrapper.eq(StringUtil.isNotEmpty(dto.getRoomId()), PlatBed::getRoomId, dto.getRoomId());
Page<PlatBed> pages = page(p, queryWrapper);
return PageUtil.toPageVO(pages.getRecords(), pages);
} }
@Override @Override
......
...@@ -4,24 +4,34 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -4,24 +4,34 @@ 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.space.PlatRegionSettingDTO; import com.makeit.dto.platform.space.PlatRegionSettingDTO;
import com.makeit.dto.platform.space.PlatRegionSettingLocateDTO;
import com.makeit.dto.platform.space.PlatRegionSettingQueryDTO; import com.makeit.dto.platform.space.PlatRegionSettingQueryDTO;
import com.makeit.entity.platform.device.PlatDevice; import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.entity.platform.device.PlatDeviceOther; import com.makeit.entity.platform.device.PlatDeviceOther;
import com.makeit.entity.platform.space.PlatRegionSetting; import com.makeit.entity.platform.space.PlatRegionSetting;
import com.makeit.enums.platform.device.PlatDeviceEnum; import com.makeit.enums.platform.device.PlatDeviceEnum;
import com.makeit.mapper.platform.space.PlatRegionSettingMapper; import com.makeit.mapper.platform.space.PlatRegionSettingMapper;
import com.makeit.module.iot.service.IotProductDeviceService;
import com.makeit.module.iot.vo.DeviceOperationLogEntity;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe;
import com.makeit.module.iot.vo.space.DeviceInfoContentSpace;
import com.makeit.service.platform.device.PlatDeviceOtherService; import com.makeit.service.platform.device.PlatDeviceOtherService;
import com.makeit.service.platform.device.PlatDeviceService; import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.space.PlatRegionSettingService; import com.makeit.service.platform.space.PlatRegionSettingService;
import com.makeit.utils.data.convert.BeanDtoVoUtils; import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.JsonUtil;
import com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -36,6 +46,8 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM ...@@ -36,6 +46,8 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
private PlatDeviceService platDeviceService; private PlatDeviceService platDeviceService;
@Autowired @Autowired
private PlatDeviceOtherService platDeviceOtherService; private PlatDeviceOtherService platDeviceOtherService;
@Autowired
private IotProductDeviceService iotProductDeviceService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -119,6 +131,50 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM ...@@ -119,6 +131,50 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
platRegionSetting.setRegionRange(dto.getRegionRange()); platRegionSetting.setRegionRange(dto.getRegionRange());
platRegionSetting.setDeviceId(dto.getDeviceId()); platRegionSetting.setDeviceId(dto.getDeviceId());
platRegionSetting.setRoomId(dto.getRoomId()); platRegionSetting.setRoomId(dto.getRoomId());
platRegionSetting.setBackground(dto.getBackground());
updateById(platRegionSetting); updateById(platRegionSetting);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void batchEdit(List<PlatRegionSettingDTO> dtos) {
List<String> ids = dtos.stream().map(PlatRegionSettingDTO::getId).collect(Collectors.toList());
List<PlatRegionSetting> platRegionSettings = list(new QueryWrapper<PlatRegionSetting>().lambda()
.in(PlatRegionSetting::getId, ids));
Map<String, PlatRegionSetting> map = platRegionSettings.stream().collect(Collectors.toMap(PlatRegionSetting::getId, Function.identity()));
List<PlatRegionSetting> updateData = new ArrayList<>();
for(PlatRegionSettingDTO dto : dtos){
if(map.containsKey(dto.getId())){
PlatRegionSetting platRegionSetting = map.get(dto.getId());
platRegionSetting.setInstallType(dto.getInstallType());
platRegionSetting.setToward(dto.getToward());
platRegionSetting.setRegionName(dto.getRegionName());
platRegionSetting.setRegionRange(dto.getRegionRange());
platRegionSetting.setDeviceId(dto.getDeviceId());
platRegionSetting.setRoomId(dto.getRoomId());
platRegionSetting.setBackground(dto.getBackground());
updateData.add(platRegionSetting);
}
}
updateBatchById(updateData);
}
@Override
public List<PlatElderCoordinateVO> locate(PlatRegionSettingLocateDTO dto) {
List<PlatElderCoordinateVO> vos = new ArrayList<>();
List<DeviceOperationLogEntity> list = iotProductDeviceService.getDeviceLogByTimeRange(dto.getDeviceId(), "reportProperty", 10, dto.getStartTime(), dto.getEndTime());
for(DeviceOperationLogEntity log : list){
DeviceInfoContentSpace space = JsonUtil.toObj((String) log.getContent(), DeviceInfoContentSpace.class);
if(space.getProperties()!=null){
PlatElderCoordinateVO vo = new PlatElderCoordinateVO();
vo.setX(new BigDecimal(space.getProperties().getDistance()).multiply(new BigDecimal(Math.cos(space.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
vo.setY(new BigDecimal(space.getProperties().getDistance()).multiply(new BigDecimal(Math.sin(space.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
vos.add(vo);
}
}
return vos;
}
} }
package com.makeit.vo.platform.space;
import com.makeit.common.entity.BaseBusEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* Controller
*
* @author zm
* @version 2023/9/19
*/
@Data
public class PlatBedVo extends BaseBusEntity {
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "房间ID")
private String roomId;
@ApiModelProperty(value = "空间Id")
private String spaceId;
@ApiModelProperty(value = "是否空闲 1 是 0 否")
private String status;
@ApiModelProperty(value = "序号")
private int sort;
@ApiModelProperty(value = "绑定设备")
private String deviceName;
}
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
SELECT pb.id,pb.`status`,pb.name bedName ,pm.`name` roomName,pm.space_path,pe.name as elderName,pe.id as elderId SELECT pb.id,pb.`status`,pb.name bedName ,pm.`name` roomName,pm.space_path,pe.name as elderName,pe.id as elderId
FROM `plat_bed` pb FROM `plat_bed` pb
LEFT JOIN plat_room pm on pb.room_id = pm.id LEFT JOIN plat_room pm on pb.room_id = pm.id
LEFT JOIN plat_elder pe on pe.bed_id = pb.id LEFT JOIN plat_elder pe on pe.bed_id = pb.id and pe.del_flag = 0
<where> <where>
pb.del_flag = 0 pb.del_flag = 0
AND pm.id = #{dto.id} AND pm.id = #{dto.id}
...@@ -52,8 +52,8 @@ ...@@ -52,8 +52,8 @@
<select id="selectByRoomIds" resultType="com.makeit.vo.platform.workstation.WorkStationInstitutionBedVO"> <select id="selectByRoomIds" resultType="com.makeit.vo.platform.workstation.WorkStationInstitutionBedVO">
SELECT pb.`name` as bedName, pb.id as bedId, pb.room_id as roomId , pe.id as elderId, pb.name as elderName, prbd.device_id as deviceId,pb.status SELECT pb.`name` as bedName, pb.id as bedId, pb.room_id as roomId , pe.id as elderId, pb.name as elderName, prbd.device_id as deviceId,pb.status
FROM plat_bed pb FROM plat_bed pb
LEFT JOIN plat_elder pe ON pe.bed_id = pb.id LEFT JOIN plat_elder pe ON pe.bed_id = pb.id and pe.del_flag = 0
LEFT JOIN plat_room_bed_device prbd ON prbd.bed_id = pb.id LEFT JOIN plat_room_bed_device prbd ON prbd.bed_id = pb.id and prbd.del_flag = 0
<where> <where>
pb.del_flag = 0 pb.del_flag = 0
<if test="roomIds != null and roomIds.size() > 0 "> <if test="roomIds != null and roomIds.size() > 0 ">
...@@ -71,9 +71,9 @@ ...@@ -71,9 +71,9 @@
LEFT JOIN plat_room pm ON pm.id = pb.room_id LEFT JOIN plat_room pm ON pm.id = pb.room_id
LEFT JOIN plat_space ps ON ps.id = pm.space_id LEFT JOIN plat_space ps ON ps.id = pm.space_id
LEFT JOIN plat_elder pe ON pe.bed_id = pb.id LEFT JOIN plat_elder pe ON pe.bed_id = pb.id
LEFT JOIN plat_room_bed_device prbd ON prbd.bed_id = pb.id LEFT JOIN plat_room_bed_device prbd ON prbd.bed_id = pb.id and prbd.del_flag = 0
<where> <where>
pb.del_flag = 0 and pe.del_flag = 0 and pb.status = 0 pb.del_flag = 0 and pb.status = 0
<if test="dto.elderName != null and dto.elderName != ''"> <if test="dto.elderName != null and dto.elderName != ''">
AND pe.naem LIKE CONCAT('%',#{dto.elderName},'%') AND pe.naem LIKE CONCAT('%',#{dto.elderName},'%')
</if> </if>
...@@ -93,5 +93,34 @@ ...@@ -93,5 +93,34 @@
order by pb.room_id order by pb.room_id
</select> </select>
<select id="getPage" resultType="com.makeit.vo.platform.space.PlatBedVo">
select
pb.id as id,
pb.name as name,
pb.tenant_id as tenantId,
pb.room_id as roomId,
pb.space_id as spaceId,
pb.status as status,
pb.create_by as createBy,
pb.create_date as createDate,
pb.update_by as updateBy,
pb.update_date as updateDate,
pb.sort as sort,
d.name as deviceName
from plat_bed pb
left join plat_room_bed_device prbd on prbd.bed_id = pb.id and prbd.del_flag = 0
left join plat_device d on d.id = prbd.device_id and d.del_flag = 0
<where>
and pb.del_flag = 0
<if test="params.name != null and params.name != ''">
and pb.name like CONCAT('%',#{params.name},'%')
</if>
<if test="params.roomId != null and params.roomId != ''">
and pb.room_id = #{params.roomId}
</if>
</where>
</select>
</mapper> </mapper>
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