package cn.superdesk.uniorder.dubbo.consumer.operationCenter.customer;

import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.common.security.JwtUtil;
import cn.superdesk.uniorder.common.security.dto.LoginSysUser;
import cn.superdesk.uniorder.dto.param.operationCenter.customer.OperationCenterCustomerParam;
import cn.superdesk.uniorder.dto.param.operationCenter.customer.settlement.UnifiedSettlementParam;
import cn.superdesk.uniorder.dto.vo.operationCenter.customer.OperationCenterCustomerVo;
import cn.superdesk.uniorder.dto.vo.operationCenter.customer.settlement.UnifiedSettlementVo;
import cn.superdesk.uniorder.dubbo.facade.unified.settlement.DubboUnifiedSettlementProgrammeService;
import com.alibaba.dubbo.config.annotation.Reference;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author : zx
 * @Create : 2023/5/10 16:29
 * Description :
 */
@Slf4j
@Component
public class UnifiedSettlementDubboService {
    @Reference(version = "1.0.1", timeout = 30000, retries = -1)
    private DubboUnifiedSettlementProgrammeService dubboUnifiedSettlementProgrammeService;


    public R<String> saveUnifiedSettlement(UnifiedSettlementParam param, String token) {
        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
        return dubboUnifiedSettlementProgrammeService.saveUnifiedSettlement(param, loginSysUser.getSysUserId());
    }

    public R<String> updateUnifiedSettlement(UnifiedSettlementParam param, String token) {
        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
        return dubboUnifiedSettlementProgrammeService.updateUnifiedSettlement(param, loginSysUser.getSysUserId());
    }

    public R<List<UnifiedSettlementVo>> list(OperationCenterCustomerParam param) {
        return dubboUnifiedSettlementProgrammeService.list(param);
    }

    public R<UnifiedSettlementParam> get(Long id) {
        return dubboUnifiedSettlementProgrammeService.get(id);
    }
}
