package com.engine.custom.audit.corn;

import com.engine.custom.audit.service.PushAuditService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import weaver.general.BaseBean;

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

public class OA2AuditCorn extends weaver.interfaces.schedule.BaseCronJob {
    public static Logger log = LoggerFactory.getLogger("Audit");
    public String filePath = "/opt/weaver/auditFile";

    PushAuditService service =  new PushAuditService();

    @Override
    public void execute() {
        log.info("OA2AuditCorn====Begin========");
        System.out.println("OA2AuditCorn====Begin========");
        Date date = new Date();
        // Calendar calendar = Calendar.getInstance();
        // calendar.setTime(date);
        // //把日期往后增加一天.整数往后推,负数往前移动(1:表示明天、-1：表示昨天，0：表示今天)
        // calendar.add(Calendar.DATE, -1);
        // date = calendar.getTime();
        SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyyMMdd");
        String format = yyyyMMdd.format(date);
        HashMap<String, String> param = new HashMap<>();
        param.put("filePath",filePath);
        service.initData(param);
        service.genDocTxt(format,"SJ");
    }
}
