package com.yida.data.system.controller;

import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.system.service.QywxService;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;

/**
 * 企业微信初始化数据API
 *
 * @author ZYJ
 * @date 2021/11/25
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/qywx")
public class QywxController {

    private final QywxService qywxService;

    @ApiOperation("初始化家校部门信息")
    @GetMapping("/initSchoolDept")
    public ResultBean initSchoolDept(@ApiParam @RequestParam Long schoolId) {
        qywxService.initSchoolDept(schoolId);
        return ResultBean.buildSuccess();
    }

    @ApiOperation("初始化通讯录部门信息")
    @GetMapping("/initDept")
    public ResultBean initDept(@ApiParam @RequestParam Long schoolId) {
        qywxService.initDept(schoolId);
        return ResultBean.buildSuccess();
    }

    @ApiOperation("初始化职工信息")
    @GetMapping("/initStaff")
    public ResultBean initStaff(@ApiParam @RequestParam Long schoolId) {
        qywxService.initStaff(schoolId, FebsUtil.getCurrentUser());
        return ResultBean.buildSuccess();
    }

    @ApiOperation("初始化学生和家长信息")
    @GetMapping("/initUser")
    public ResultBean initUser(@ApiParam @RequestParam Long schoolId) {
        qywxService.initUser(schoolId, FebsUtil.getCurrentUser());
        return ResultBean.buildSuccess();
    }
}
