package com.zfire.jiasm.syncdata.download.basedata;

import lombok.extern.slf4j.Slf4j;

/**
 * 格力品牌用户属性、信息渠道 基础资料下载（用户属性、用户等级、信息渠道、信息来源）
 */
@Slf4j
// @Component
public class GLPPYHSXXXQD {
   /* @Value("${baseurl}")
    private String baseurl = "";
    @Value("${yhsxc}")
    private String yhsxc = "";
    @Value("${yhdjc}")
    private String yhdjc = "";
    @Value("${xxqdc}")
    private String xxqdc = "";
    @Value("${xxlyc}")
    private String xxlyc = "";


    @Resource
    TokenCenter tokenCenter;
    @Resource
    GLPPYHSXXXQDService glppyhsxxxqdService;


    *//**
     * 格力品牌用户属性信息同步
     * @return
     *//*
    @Scheduled(fixedDelayString = "${yhsx}")
    public void process() throws Exception {
        if (yhsxc.equals(TaskConfigEnum.FALSE.getCode())){
            return;
        }

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Map<String, String> paramMap = new HashMap<String, String>();
        List<String> req = new ArrayList<>();

        req.add(InterFaceTypeEnum.GLPP_YHSX.getCode());
        req.add(InterFaceTypeEnum.GLPP_YHDJ.getCode());
        req.add(InterFaceTypeEnum.GLPP_XXQD.getCode());
        req.add(InterFaceTypeEnum.GLPP_XXLY.getCode());


        log.info("开始下载格力品牌用户属性信息: \uF0B7{}",sdf.format(new Date()));

        Token token = tokenCenter.getCurrentToken();
        for (String bc :req){
            try {
                String url = baseurl + bc + "/querylist";
                String paramJson= JSON.toJSONString(paramMap);

                JSONResult jsonResult = HttpUtil.httpRequestWithToken(url, "POST", paramJson, token);
                if (jsonResult.getStatus() == null || !jsonResult.getStatus().toString().equals("200")) {
                    log.info("下载格力品牌用户属性信息失败！: {}",jsonResult.getMessage());
                    continue;
                }

                JSONArray jsonArray = (JSONArray) jsonResult.getData();
                if (jsonArray != null) {
                    log.info("下载了{}条数据",jsonArray.size());

                    if (bc.equals(InterFaceTypeEnum.GLPP_YHSX.getCode())){
                        glppyhsxxxqdService.extractedYHSX(jsonArray);
                    } else if (bc.equals(InterFaceTypeEnum.GLPP_YHDJ.getCode())){
                        glppyhsxxxqdService.extractedYHDJ(jsonArray);
                    } else if (bc.equals(InterFaceTypeEnum.GLPP_XXQD.getCode())){
                        glppyhsxxxqdService.extractedXXQD(jsonArray);
                    } else if (bc.equals(InterFaceTypeEnum.GLPP_XXLY.getCode())){
                        glppyhsxxxqdService.extractedXXLY(jsonArray);
                    }
                    jsonArray.clear();
                }else {
                    log.info("["+url+"]无数据");
                }
            } catch (Exception ex) {
                log.info("格力品牌用户属性信息处理失败");
                ex.printStackTrace();
            }
        }

        log.info("格力品牌用户属性信息处理完成: \uF0B7{}",sdf.format(new Date()));
    }*/

}
