package org.springblade.system.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.system.service.IMKPushService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *  mk数据推送
 * @author bfhuange
 * @date 2024/9/24
 */
@Tag(name = "mk数据推送", description = "mk数据推送")
@RequestMapping("/mk")
@RestController
@RequiredArgsConstructor
public class MKPushController {

    private final IMKPushService mkPushService;

    /**
     *  推送公司和部门
     * @return
     */
    @Operation(summary = "推送公司和部门")
    @PostMapping("/pushCompanyAndDept")
    @PreAuth(RoleConstant.HAS_ROLE_ADMIN)
    public R<Boolean> pushCompanyAndDept() {
        mkPushService.pushOrgAndRecord(null);
        return R.data(true);
    }

    /**
     *  推送人员
     * @return
     */
    @Operation(summary = "推送人员")
    @PostMapping("/pushPerson")
    @PreAuth(RoleConstant.HAS_ROLE_ADMIN)
    public R<Boolean> pushPerson() {
        mkPushService.pushPersonAndRecord(null);
        return R.data(true);
    }
}
