var sql = require('sql')

function main() {
    // 将前天 T+2 的日报已提交（1）状态更新为待审核(4)
    let stmt = `UPDATE oa_pm_time_consuming SET audit_status = 4 WHERE audit_status = 1 AND DATE_FORMAT(create_time, '%Y-%m-%d') < DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 2 DAY), '%Y-%m-%d')`
    sql.exec('system_sql', stmt)
    stmt = `UPDATE oa_pm_time_consuming SET audit_status = 6,audit_time = DATE(NOW()),outcome_assessment = 3,efficiency_score = 3 WHERE audit_status = 4 AND DATE_FORMAT(create_time, '%Y-%m-%d') < DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 3 DAY), '%Y-%m-%d')`
    sql.exec('system_sql', stmt)
    console.mod('Event').fn('System').proc('OA').info(`[AutoPassDaily] - Success`)
    return
}