package cn.com.ty.lift.system.user.controller;

import cn.com.ty.lift.system.user.dao.entity.model.MtCompanyUserRequest;
import cn.com.ty.lift.system.user.service.IMtCompanyUserService;
import cn.com.xwy.boot.web.dto.RestResponse;
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;

import javax.annotation.Resource;

/**
 * @author huangyuan
 * @date 2019-12-04
 * @description 企业设置
 */
@RestController
@RequestMapping("/companyuser")
public class MtCompanyUserController {

    @Resource
    private IMtCompanyUserService mtCompanyUserService;

    /**
     * @param
     * @return
     * @description 获取当前企业用户列表
     * @date 2019-12-23 14:11
     */
    @RequestMapping("/list")
    public RestResponse list(@RequestBody MtCompanyUserRequest mtCompanyUserRequest) {
        return mtCompanyUserService.getCompanyUserList(mtCompanyUserRequest);
    }

    /**
     * @param mtCompanyUserRequest userId:用户id, companyId:公司id, job:职业, roleId:角色id
     * @return
     * @description 企业分配角色
     * @date 2019/11/27 10:03 AM
     */
    @RequestMapping("/assignRole")
    public RestResponse assignRole(@RequestBody MtCompanyUserRequest mtCompanyUserRequest) {
        return mtCompanyUserService.assignRole(mtCompanyUserRequest);
    }

    /**
     * @param mtCompanyUserRequest 公司id
     * @return
     * @description 获取团队成员信息
     * @date 2019/11/27 10:03 AM
     */
    @RequestMapping("/getCompanyMembers")
    public RestResponse getCompanyUser(@RequestBody MtCompanyUserRequest mtCompanyUserRequest) {
        return mtCompanyUserService.getCompanyMembers(mtCompanyUserRequest);
    }

    /**
     * @param
     * @return
     * @description 获取急修工
     * @date 2020-01-06 15:19
     */
    @RequestMapping("/getUrgentRepairs")
    public RestResponse getUrgentRepairs(@RequestBody MtCompanyUserRequest mtCompanyUserRequest) {
        return mtCompanyUserService.getUrgentRepairs(mtCompanyUserRequest);
    }

    @RequestMapping("/app/getCompanyMembers")
    public RestResponse appGetCompanyMembers(@RequestBody MtCompanyUserRequest mtCompanyUserRequest) {
        return mtCompanyUserService.appGetCompanyMembers(mtCompanyUserRequest);
    }

    /***
     * @description 踢出团队
     * @date 2019-12-17 10:10
     * @param mtCompanyUserRequest companyId:公司id, userId:用户id
     * @return
     */
    @PostMapping("/kickOutTeam")
    public RestResponse kickOutTeam(@RequestBody MtCompanyUserRequest mtCompanyUserRequest) {
        return mtCompanyUserService.kickOutTeam(mtCompanyUserRequest);
    }

    /**
     * @param
     * @return
     * @description 设置急修信息
     * @date 2019-12-26 17:58
     */
    @PostMapping("/setRepair")
    public RestResponse setRepair(@RequestBody MtCompanyUserRequest mtCompanyUserRequest) {
        return mtCompanyUserService.setRepair(mtCompanyUserRequest);
    }
}
