Browse Source

fix:完善同步状态接口

master
白凤吉 5 days ago
parent
commit
e6c577bf44
  1. 10
      src/main/java/com/iflytop/handacid/app/controller/DeviceController.java

10
src/main/java/com/iflytop/handacid/app/controller/DeviceController.java

@ -1,6 +1,8 @@
package com.iflytop.handacid.app.controller;
import com.iflytop.handacid.app.core.state.ChannelState;
import com.iflytop.handacid.app.core.state.DeviceState;
import com.iflytop.handacid.app.model.bo.SyncOperationsChannel;
import com.iflytop.handacid.app.model.dto.SyncOperationsDTO;
import com.iflytop.handacid.common.result.Result;
import io.swagger.v3.oas.annotations.Operation;
@ -26,6 +28,12 @@ public class DeviceController {
@Operation(summary = "同步用户操作")
@PostMapping("/sync")
public Result<?> syncOperations(@RequestBody SyncOperationsDTO syncOperationsDTO) {
return Result.success(deviceState.toJSON());
deviceState.setMode(syncOperationsDTO.getMode());
for (SyncOperationsChannel syncOperationsChannel : syncOperationsDTO.getChannels()) {
ChannelState channelState = deviceState.getChannelStateMap().get(syncOperationsChannel.getChannelCode());
channelState.setSelected(syncOperationsChannel.isSelected());
channelState.setTargetVolume(syncOperationsChannel.getTargetVolume());
}
return Result.success();
}
}
Loading…
Cancel
Save