package com.willalp.web.controller.yiqing;

import com.willalp.common.core.controller.BaseController;
import com.willalp.common.core.domain.AjaxResult;
import com.willalp.yiqing.domain.vo.UserQueResultVo;
import com.willalp.yiqing.service.HsYiQingService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author xian
 */
@RestController
@RequestMapping("api/yq/")
public class YiQingSubminController extends BaseController {

    @Resource
    private HsYiQingService yiQingService;

    @GetMapping("list")
    public AjaxResult getQueList(@RequestParam String queGroupId) {
        return AjaxResult.success(yiQingService.getQueTableLabel(queGroupId));
    }

    @PostMapping("save")
    public AjaxResult submit(@RequestBody UserQueResultVo userQueResultVo) {
        return toAjax(yiQingService.saveQueResult(userQueResultVo));
    }

    @GetMapping("notRead")
    public AjaxResult getUserNotRead(@RequestParam String userNo,
                                     @RequestParam String orgNo) {
        return AjaxResult.success(yiQingService.getUserNotRead(userNo,orgNo));
    }

    @GetMapping("readTask")
    public AjaxResult readTask(@RequestParam String userNo,
                               @RequestParam String orgNo) {
        return AjaxResult.success(yiQingService.readTask(userNo, orgNo));
    }

    @GetMapping("clickTaskRead")
    public AjaxResult clickTaskRead(@RequestParam String taskId, @RequestParam String userNo) {
        return AjaxResult.success(yiQingService.clickTaskRead(taskId, userNo));
    }

    @GetMapping("uuStatus")
    public AjaxResult upDateUserTaskStatus(@RequestParam String taskId,
                                           @RequestParam String userNo,
                                           @RequestParam Integer status) {
        return toAjax(yiQingService.upDateUserTaskStatus(taskId, userNo, status));
    }

    @GetMapping("uOrder")
    public AjaxResult upDateUserIsOrder(@RequestParam String taskId,
                                           @RequestParam String userNo,
                                           @RequestParam Integer status) {
        return toAjax(yiQingService.upDateUserIsOrder(taskId, userNo, status));
    }
}
