|
@@ -18,7 +18,6 @@ import com.hfln.portal.common.dto.data.room.RoomDTO;
|
|
import com.hfln.portal.common.dto.data.room.SubRegionDTO;
|
|
import com.hfln.portal.common.dto.data.room.SubRegionDTO;
|
|
import com.hfln.portal.common.dto.data.share.ShareDto;
|
|
import com.hfln.portal.common.dto.data.share.ShareDto;
|
|
import com.hfln.portal.common.request.device.*;
|
|
import com.hfln.portal.common.request.device.*;
|
|
-import com.hfln.portal.common.request.event.EventListParams;
|
|
|
|
import com.hfln.portal.common.request.room.RoomParam;
|
|
import com.hfln.portal.common.request.room.RoomParam;
|
|
import com.hfln.portal.common.request.room.SubRegionInfo;
|
|
import com.hfln.portal.common.request.room.SubRegionInfo;
|
|
import com.hfln.portal.common.request.share.ShareConfirmParam;
|
|
import com.hfln.portal.common.request.share.ShareConfirmParam;
|
|
@@ -297,18 +296,6 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
- public PageRecord<EventListDTO> queryEventByPage(EventListParams request) {
|
|
|
|
- Integer pageNo = Optional.ofNullable(request.getPageNo()).orElse(1);
|
|
|
|
- Integer pageSize = Optional.ofNullable(request.getPageSize()).orElse(10);
|
|
|
|
-
|
|
|
|
- // 执行分页查询
|
|
|
|
- Page<EventList> eventPage = eventService.queryEventListByDevId(request.getDevId(),
|
|
|
|
- request.getStartTime(), request.getEndTime(), pageNo, pageSize);
|
|
|
|
- // 换为目标VO
|
|
|
|
- List<EventListDTO> targets = convertToTargetVO(eventPage.getRecords());
|
|
|
|
- return getEventListDTOPageRecord(eventPage, targets);
|
|
|
|
- }
|
|
|
|
|
|
|
|
// 填充PageRecord
|
|
// 填充PageRecord
|
|
private PageRecord<EventListDTO> getEventListDTOPageRecord(Page<EventList> eventPage, List<EventListDTO> targets) {
|
|
private PageRecord<EventListDTO> getEventListDTOPageRecord(Page<EventList> eventPage, List<EventListDTO> targets) {
|
|
@@ -439,23 +426,23 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
- public Boolean statusLight(Long devId, Integer statusLight) {
|
|
|
|
|
|
+ public Boolean statusLight(StatusLightParams params) {
|
|
//1.校验设备是否存在
|
|
//1.校验设备是否存在
|
|
- DevInfo devInfo = devInfoService.getById(devId);
|
|
|
|
|
|
+ DevInfo devInfo = devInfoService.getById(params.getDevId());
|
|
if(devInfo == null){
|
|
if(devInfo == null){
|
|
throw new BizException(ErrorEnum.DEVICE_IS_NOT_EXIST.getErrorCode(), ErrorEnum.DEVICE_IS_NOT_EXIST.getErrorMessage());
|
|
throw new BizException(ErrorEnum.DEVICE_IS_NOT_EXIST.getErrorCode(), ErrorEnum.DEVICE_IS_NOT_EXIST.getErrorMessage());
|
|
}
|
|
}
|
|
|
|
|
|
//2.校验status_light值,只能传 0 与 1
|
|
//2.校验status_light值,只能传 0 与 1
|
|
- if (statusLight == null || statusLight != 0 && statusLight != 1){
|
|
|
|
|
|
+ if (params.getStatusLight() == null || params.getStatusLight() != 0 && params.getStatusLight() != 1){
|
|
throw new BizException(ErrorEnum.STATUS_LIGHT_IS_NOT_EXIST.getErrorCode(), ErrorEnum.STATUS_LIGHT_IS_NOT_EXIST.getErrorMessage());
|
|
throw new BizException(ErrorEnum.STATUS_LIGHT_IS_NOT_EXIST.getErrorCode(), ErrorEnum.STATUS_LIGHT_IS_NOT_EXIST.getErrorMessage());
|
|
}
|
|
}
|
|
|
|
|
|
//3.更新设备指示灯状态
|
|
//3.更新设备指示灯状态
|
|
boolean updateResult = devInfoService.update(
|
|
boolean updateResult = devInfoService.update(
|
|
Wrappers.<DevInfo>lambdaUpdate()
|
|
Wrappers.<DevInfo>lambdaUpdate()
|
|
- .set(DevInfo::getStatusLight, statusLight)
|
|
|
|
- .eq(DevInfo::getDevId, devId)
|
|
|
|
|
|
+ .set(DevInfo::getStatusLight, params.getStatusLight())
|
|
|
|
+ .eq(DevInfo::getDevId, params.getDevId())
|
|
);
|
|
);
|
|
|
|
|
|
//4.通过MQTT把信息参数发送到设备
|
|
//4.通过MQTT把信息参数发送到设备
|
|
@@ -463,7 +450,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
JSONObject msg = new JSONObject();
|
|
JSONObject msg = new JSONObject();
|
|
int indicatorLed = 0;
|
|
int indicatorLed = 0;
|
|
|
|
|
|
- if (statusLight == 0){
|
|
|
|
|
|
+ if (params.getStatusLight() == 0){
|
|
indicatorLed = 1;
|
|
indicatorLed = 1;
|
|
}
|
|
}
|
|
msg.put("indicator_led", indicatorLed);
|
|
msg.put("indicator_led", indicatorLed);
|