package com.diagbot.web;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.RenewalsInfosDTO;
import com.diagbot.dto.RespDTO;
import com.diagbot.facade.UserRenewalsFacade;
import com.diagbot.vo.DeleteRenewalsInfoVO;
import com.diagbot.vo.RenewalsInfosVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
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 gaodm
 * @since 2018-10-12
 */
@RestController
@Api(value = "续费API", tags = { "续费API" })
@RequestMapping("/userRenewals")
public class UserRenewalsController {
    @Autowired
    private UserRenewalsFacade userRenewalsFacade;

    @ApiOperation(value = "续费管理——显示[by:wangyu]",
            notes = "orgName：机构名称 <br>" +
                    "renewalsStutas：续费状态 <br>" +
                    "startTime：开始时间<br>" +
                    "endTime：结束时间<br>" +
                    "size：每页显示的条数 <br>" +
                    "curent：页数 <br>")
    @PostMapping("/renewalsInfos")
    @SysLogger("renewalsInfos")
    public RespDTO<IPage<RenewalsInfosDTO>> renewalsInfos(@RequestBody RenewalsInfosVO renewalsInfosVO) {
        return RespDTO.onSuc(userRenewalsFacade.renewalsInfo(renewalsInfosVO));
    }

    @ApiOperation(value = "续费管理——删除[by:wangyu]",
            notes = "id：续费id，必填<br>")
    @PostMapping("/deleteRenewalsInfos")
    @SysLogger("deleteRenewalsInfos")
    @Transactional
    public RespDTO<Boolean> deleteRenewalsInfos(@RequestBody DeleteRenewalsInfoVO deleteRenewalsInfoVO) {
        return RespDTO.onSuc(userRenewalsFacade.deleteRenewalsInfo(deleteRenewalsInfoVO));
    }

    @ApiOperation(value = "续费管理——取消续费[by:wangyu]",
            notes = "id：续费id，必填<br>")
    @PostMapping("/cancelRenewalsInfos")
    @SysLogger("cancelRenewalsInfos")
    @Transactional
    public RespDTO<Boolean> cancelRenewalsInfos(@RequestBody DeleteRenewalsInfoVO deleteRenewalsInfoVO) {
        return RespDTO.onSuc(userRenewalsFacade.cancelRenewalsInfo(deleteRenewalsInfoVO));
    }


}
