package com.yuchen.saas.park.service.controller.property;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yuchen.saas.park.api.dto.property.SaasParkPropertyReceivableManageDto;
import com.yuchen.saas.park.api.vo.property.SaasParkPropertyReceivableManageTotalVo;
import com.yuchen.saas.park.api.vo.property.SaasParkPropertyReceivableManageVo;
import com.yuchen.saas.park.service.service.property.ISaasParkPropertyReceivableManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nest.springwrap.core.mp.support.Query;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 物业-收费-应收管理-应收账单 前端控制器
 * </p>
 *
 * @author baichaojie
 * @since 2024-09-12
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@Api(value = "物业-收费-应收管理-应收账单 前端控制器", tags = "物业-收费-应收管理-应收账单 前端控制器")
@RequestMapping("/saasParkPropertyReceivableManage")
public class SaasParkPropertyReceivableManageController {

    private final ISaasParkPropertyReceivableManageService baseService;


    /**
     * 物业-收费-应收管理-应收账单-统计
     */
    @GetMapping("/getTotal")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "物业-收费-应收管理-应收账单-统计 ", notes = "物业-收费-应收管理-应收账单-统计 ")
    public R<SaasParkPropertyReceivableManageTotalVo> getTotal() {
        SaasParkPropertyReceivableManageTotalVo total = baseService.getTotal();
        return R.data(total);
    }


    /**
     * 物业-收费-应收管理-应收账单-未出账  列表查询
     */
    @GetMapping("/getWeiChuZhangList")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "物业-收费-应收管理-应收账单-未出账  列表查询", notes = "物业-收费-应收管理-应收账单-未出账  列表查询")
    public R<IPage<SaasParkPropertyReceivableManageVo>> getWeiChuZhangList(@Valid SaasParkPropertyReceivableManageDto saasParkPropertyReceivableManageDto, Query query) {
        R<IPage<SaasParkPropertyReceivableManageVo>> pages = baseService.getWeiChuZhangList(saasParkPropertyReceivableManageDto, query);
        return pages;
    }

    /**
     * 物业-收费-应收管理-应收账单-非未出账(已出账)  列表查询
     */
    @GetMapping("/getYiChuZhangList")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "物业-收费-应收管理-应收账单-非未出账(已出账)  列表查询", notes = "物业-收费-应收管理-应收账单-非未出账(已出账)  列表查询")
    public R<IPage<SaasParkPropertyReceivableManageVo>> getYiChuZhangList(@Valid SaasParkPropertyReceivableManageDto saasParkPropertyReceivableManageDto, Query query) {
        R<IPage<SaasParkPropertyReceivableManageVo>> pages = baseService.getYiChuZhangList(saasParkPropertyReceivableManageDto, query);
        return pages;
    }


    /**
     * 冻结saveOrUpdate
     */

    /**
     * 解冻saveOrUpdate
     */

    /**
     * 账单拆分
     */
    public  R splitOrder(@Valid @RequestBody SaasParkPropertyReceivableManageDto req) {
        return R.data(baseService.splitOrder(req));
    }


    /**
     *撤回收费
     */

    /**
     * 出账saveOrUpdate
     */


    /**
     * 物业-收费-应收管理-应收账单  新增或修改
     */
    @PostMapping("/saveOrUpdate")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "物业-收费-应收管理-应收账单  新增或修改", notes = "物业-收费-应收管理-应收账单  新增或修改")
    public R saveOrUpdate(@Valid @RequestBody SaasParkPropertyReceivableManageDto req) {
        return R.data(baseService.saveOrUpdateByParam(req));
    }


    /**
     * 物业-收费-应收管理-应收账单  删除
     *
     * @param saasParkPropertyReceivableManageDto
     * @return
     */
    @PostMapping("/removeId")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "物业-收费-应收管理-应收账单 删除", notes = "物业-收费-应收管理-应收账单  删除")
    public R removeId(@RequestBody SaasParkPropertyReceivableManageDto saasParkPropertyReceivableManageDto) {
        return R.data(baseService.removeById(saasParkPropertyReceivableManageDto.getId()));
    }


}
