package weaver.interfaces.organization.cronjob;

import com.engine.organization.service.impl.ChartServiceImpl;
import com.engine.organization.util.OrganizationDateUtil;
import weaver.hrm.User;
import weaver.interfaces.schedule.BaseCronJob;

import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author liang.cheng
 * @Date 2024/8/2 9:39 AM
 * @Description: 组织架构图定时版本保存
 * @Version 1.0
 */
public class OrgVersionRecordCron extends BaseCronJob {

    @Override
    public void execute() {

        ChartServiceImpl chartService = new ChartServiceImpl();
        User user = new User();
        user.setUid(1);

        // 获取当前日期
        LocalDate today = LocalDate.now();
        String example = OrganizationDateUtil.dateExample(today);
        String description = "版本自动记录"+example;

        Map<String, Object> params = new HashMap<String, Object>(){
            {
                put("description",description);
            }};

        chartService.versionRecord(params,user);
    }
}
