|
@ -1,6 +1,8 @@ |
|
|
package com.iflytop.handacid.app.controller; |
|
|
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.core.state.DeviceState; |
|
|
|
|
|
import com.iflytop.handacid.app.model.bo.SyncOperationsChannel; |
|
|
import com.iflytop.handacid.app.model.dto.SyncOperationsDTO; |
|
|
import com.iflytop.handacid.app.model.dto.SyncOperationsDTO; |
|
|
import com.iflytop.handacid.common.result.Result; |
|
|
import com.iflytop.handacid.common.result.Result; |
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
@ -26,6 +28,12 @@ public class DeviceController { |
|
|
@Operation(summary = "同步用户操作") |
|
|
@Operation(summary = "同步用户操作") |
|
|
@PostMapping("/sync") |
|
|
@PostMapping("/sync") |
|
|
public Result<?> syncOperations(@RequestBody SyncOperationsDTO syncOperationsDTO) { |
|
|
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(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |