package com.zfire.jiasm.syncdata.sendmessage;

import com.zfire.jiasm.syncdata.service.impl.SMSSelfGetArrivedServiceImpl;
import com.zfire.jiasm.syncdata.utils.SMSSelfManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 查看评价短信回复信息 自建短信回复查询 + 同步回复内容信息
 */
@Slf4j
@Component
public class SMSGetArrived {

    @Autowired
    private SMSSelfManager smsSelfManager;

    @Autowired
    private SMSSelfGetArrivedServiceImpl smsSelfGetArrivedServiceImpl;


    @Scheduled(fixedDelay = 1 * 5 * 1000)
    private void process() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        if (1 == 1) {
            return;
        }

        try {
            log.info("开始查询短信状态报告: \uF0B7{}",sdf.format(new Date()));
            smsSelfGetArrivedServiceImpl.insertData(smsSelfManager.getArrived());
            log.info("查询短信状态报告结束: \uF0B7{}",sdf.format(new Date()));
        } catch (Exception ex) {
            log.error("查询短信状态报告失败", ex);
        }
    }

}
