
package com.tmerclub.cloud.flow.feign;

import com.tmerclub.cloud.api.flow.feign.FlowFeignClient;
import com.tmerclub.cloud.flow.service.FlowService;
import com.tmerclub.cloud.flow.service.ProductAnalyseService;
import org.apache.dubbo.config.annotation.DubboService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author YXF
 * @date 2021/07/01
 */
@DubboService
public class FlowFeignController implements FlowFeignClient {
    private static final Logger logger = LoggerFactory.getLogger(FlowFeignController.class);
    @Autowired
    private ProductAnalyseService productAnalyseService;
    @Autowired
    private FlowService flowService;


    @Override
    public void deleteSpuDataBySpuId(Long spuId) {
        try {
            productAnalyseService.deleteSpuDataBySpuId(spuId);
        } catch (Exception e) {
            logger.error("删除商品id:{}的统计数据失败", spuId);
        }
    }

    @Override
    public void paySuccessLog(Integer sysType, String orderIds, Long userId) {
        try {
            flowService.paySuccessLog(sysType, orderIds, userId);
        } catch (Exception e) {
            logger.error("记录支付日志失败，系统类型：{}，订单号：{}，用户id：{}", sysType, orderIds, userId);
        }
    }

}
