package com.red.circle.console.adapter.app.sys;

import com.red.circle.console.app.dto.clienobject.sys.SysFeedbackCO;
import com.red.circle.console.app.service.app.sys.SysFeedbackService;
import com.red.circle.console.infra.annotations.OpsOperationReqLog;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.inner.model.cmd.sys.BatchProcessFeedbackCmd;
import com.red.circle.other.inner.model.cmd.sys.SysFeedbackQryCmd;
import com.red.circle.other.inner.model.cmd.sys.UpdateApprovalRemarksCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
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;

/**
 * <p>
 * 意见反馈 前端控制器.
 * </p>
 *
 * @author pengliang
 * @since 2019-11-08
 */
@RestController
@RequestMapping("/sys/feedback")
@RequiredArgsConstructor
public class SysFeedbackRestController extends BaseController {

  private final SysFeedbackService sysFeedbackService;

  /**
   * 意见反馈分页列表.
   */
  @GetMapping("/page")
  public PageResult<SysFeedbackCO> updateUserInfo(SysFeedbackQryCmd cmd) {
    return sysFeedbackService.pageSysFeedbackVO(cmd);
  }

  @OpsOperationReqLog(value = "反馈处理结果")
  @GetMapping("/process")
  public void processFeedback(UpdateApprovalRemarksCmd cmd) {
    sysFeedbackService.updateRemarksAndNotice(cmd.getReqUserId(), cmd.getUserId(), cmd.getId(),
        cmd.getRemarks());

  }

  @OpsOperationReqLog(value = "反馈处理结果")
  @PostMapping("/batchProcess")
  public void batchProcessFeedback(
      @RequestBody BatchProcessFeedbackCmd cmd) {
    sysFeedbackService.batchUpdateRemarksAndNotice(cmd);

  }

}
