package com.fs.app.controller;

import com.fs.common.core.domain.R;
import com.fs.course.service.IFsUserCourseComplaintTypeService;
import com.fs.course.vo.FsUserCourseComplaintTypeListVO;
import com.fs.qw.param.QwUserComplaintRecordParam;
import com.fs.qw.service.IQwUserComplainRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api("企微员工投诉接口")
@RestController
@RequestMapping(value="/app/record")
public class QwUserComplainRecordController {


    @Autowired
    private IQwUserComplainRecordService qwUserComplainRecordService;

    @Autowired
    private IFsUserCourseComplaintTypeService fsUserCourseComplaintTypeService;


    @ApiOperation("获取投诉类型")
    @GetMapping("/getTypeTree")
    public R getTypeTree() {
        List<FsUserCourseComplaintTypeListVO> allComplaintTypeTree = fsUserCourseComplaintTypeService.getAllComplaintTypeTree();
        return R.ok().put("data", allComplaintTypeTree);
    }


    @ApiOperation("提交企微员工反馈记录")
    @PostMapping("/recordByQwUser")
    public R submitByQwUser(@RequestBody QwUserComplaintRecordParam param) {
        int i = qwUserComplainRecordService.submitRecordByQwUser(param);
        if (i > 0) {
            return R.ok("提交成功");
        } else {
            return R.error("提交失败");
        }
    }
}
