
package com.tmerclub.cloud.multishop.feign;

import com.tmerclub.cloud.api.multishop.bo.OrderChangeShopWalletAmountBO;
import com.tmerclub.cloud.api.multishop.feign.ShopWalletFeignClient;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.multishop.service.ShopRechargeService;
import com.tmerclub.cloud.multishop.service.ShopWalletService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author chiley
 * @date 2022/6/30 16:55
 */
@DubboService
public class ShopWalletFeignController implements ShopWalletFeignClient {

    @Autowired
    private ShopWalletService shopWalletService;
    @Autowired
    private ShopRechargeService shopRechargeService;

    @Override
    public ServerResponseEntity<Long> getSettlementAmountByShopId(Long shopId, Integer paySysType) {
        return ServerResponseEntity.success(shopWalletService.getSettlementAmountByShopId(shopId, paySysType));
    }

    @Override
    public void subSettlementAmount(OrderChangeShopWalletAmountBO orderChangeShopWalletAmountBO) {
        shopWalletService.subSettlementAmount(orderChangeShopWalletAmountBO.getActualTotal(), orderChangeShopWalletAmountBO, null, false);
    }

    @Override
    public ServerResponseEntity<Void> rechargeBack(String bizOrderNo, String payStatus, String bizUserId) {
        shopRechargeService.rechargeBack(bizOrderNo, payStatus, bizUserId);
        return ServerResponseEntity.success();
    }
}
