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

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.thinkunion.park.service.common.baseentity.MenuTypeEnum;
import com.yuchen.saas.park.api.entity.park.PmgBatParkXCPayInfo;
import com.yuchen.saas.park.service.service.XCPayInfoService;
import com.yuchen.saas.park.service.annotation.LogAnnotation;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author 张逸飞
 * @Date 2021/9/30 00:05
 * @Description 厦门银行 xcpay 支付信息配置
 */
@RestController
@AllArgsConstructor
@RequestMapping("/xcPayInfo")
@Api(value = "厦门银行 xcpay 支付信息配置", tags = "厦门银行 xcpay 支付信息配置")
public class XCPayInfoController {

    /**
     * 厦门银行 XCPay 支付信息操作接口
     */
    @Resource
    private XCPayInfoService xcPayInfoService;

    /**
     * 保存或者更新厦门银行支付配置信息
     * @return
     */
    @LogAnnotation(value = MenuTypeEnum.CHARGE_MERCHANTS,desc = "收费商户编辑")
    @PostMapping("/save")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "保存或者更新厦门银行支付配置信息", notes = "保存或者更新厦门银行支付配置信息")
    public R save(@RequestBody PmgBatParkXCPayInfo pmgBatParkXCPayInfo) {
        return xcPayInfoService.addOrUpdate(pmgBatParkXCPayInfo);
    }

    /**
     * 根据园区ID获取厦门银行支付配置信息
     * @param parkId 园区ID
     * @return
     */
    @GetMapping("/get")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "根据园区ID获取厦门银行支付配置信息", notes = "根据园区ID获取厦门银行支付配置信息")
    public R getByParkId(@RequestParam Long parkId) {
        return R.data(xcPayInfoService.getByParkId(parkId));
    }

    /**
     * 根据商户编号获取厦门银行支付信息
     * @param oidPartner 商户编号
     * @return
     */
    @GetMapping("/getByOidPartner")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "根据商户编号获取厦门银行支付信息", notes = "根据商户编号获取厦门银行支付信息")
    public R getByOidPartner(@RequestParam String oidPartner) {
        return R.data(xcPayInfoService.getByOidPartner(oidPartner));
    }
}
