package com.hzs.system.tools.controller.api;

import com.hzs.common.core.web.domain.AjaxResult;
import com.hzs.system.tools.service.IIdempotentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @Author: sui q
 * @Time: 2022/8/29 9:35
 * @Classname: ApiIdempotentController
 * @PackageName: com.hzs.system.tools.controller.api
 */
@RestController
@RequestMapping("/api/idempotent")
@Slf4j
public class ApiIdempotentController {

    private IIdempotentService idempotentService;

    @Autowired
    public void setIdempotentService(IIdempotentService idempotentService) {
        this.idempotentService = idempotentService;
    }

    /**
    * @Description: 生成用于保证幂等的token
     * @param
    * @return: AjaxResult
    * @throws
    * @Author: sui q
    * @Date: 2022/8/29 9:36
    */
    @GetMapping("/generate")
    public AjaxResult generateIdempotentToken() {
        return AjaxResult.success(idempotentService.generateToken());
    }
}
