package com.chinacreator.video.restful.controller;

import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.chinacreator.video.bean.OrderInfo;
import com.chinacreator.video.restful.bean.AlertUrl;
import com.chinacreator.video.restful.bean.FlowBean;
import com.chinacreator.video.restful.dao.FlowAlertCpDao;
import com.chinacreator.video.restful.service.FlowAlertCpService;
import com.chinacreator.video.util.URLUtil;
import com.chinacreator.video.validate.IpValidate;
import org.bouncycastle.cms.PasswordRecipient;
import org.jboss.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * cp流量推送，由科创发起，铂源转发
 */
@RestController
public class FlowAlertCpController {

    @Autowired
    private FlowAlertCpService flowAlertCpService;

    private static Logger logger = Logger.getLogger("flowAlertCp");

    @RequestMapping("/flowAlertCp")
    public String flowAlertCp(FlowBean bean) throws Exception {
        HashMap<String,String> logmap = new HashMap<>();
        logmap.put("请求参数", JSON.toJSONString(bean));
        try {
            flowAlertCpService.checkip();
            return flowAlertCpService.process(bean,logmap);
        }finally {

            logger.info(logmap);
        }
    }
}
