SystemController.java 1.27 KB
package com.objecteye.controller;

import com.objecteye.handle.viid.CommonHandle;
import com.objecteye.pojo.DeviceIdParams;
import com.objecteye.pojo.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: liuhaoyu
 * @date: 2023/7/6
 */
@RestController
@RequestMapping("system")
@RequiredArgsConstructor
public class SystemController {

    private final CommonHandle commonHandle;

    @PostMapping("register")
    public Result<Boolean> register(@RequestBody @Validated DeviceIdParams params) {
        return Result.success(commonHandle.register(params.getDeviceId()));
    }

    @PostMapping("unregister")
    public Result<Boolean> unregister(@RequestBody @Validated DeviceIdParams params) {
        return Result.success(commonHandle.unregister(params.getDeviceId()));
    }

    @PostMapping("keepalive")
    public Result<Boolean> keepalive(@RequestBody @Validated DeviceIdParams params) {
        return Result.success(commonHandle.keepalive(params.getDeviceId()));
    }
}