package com.malk.luyi.controller;


import com.alibaba.fastjson.JSON;
import com.malk.server.aliwork.YDConf;
import com.malk.server.aliwork.YDParam;
import com.malk.service.aliwork.YDClient;
import com.malk.utils.UtilMap;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@Slf4j
@Configuration
@EnableScheduling
public class KSJC_timer {
    @Autowired
    private KSJCController legalEntityService;
    @Autowired
    private YDClient ydClient;
    /*集晨判断是否能打卡*/
    //每天早晨7点05分同步数据
 @Scheduled(cron = "0 5 7 * * ?")
//  @Scheduled(fixedRate = 1000)
    public void LegalEntityList(){
        log.info("k");
        try{
           legalEntityService.insetTHXM_TMER();
//            String XMCSLID="FINST-3RB66I91VT5OZPGY8CWOD9237ZDD2KPZ5KH0MYK8";
//            if (true)
//            {
//                ydClient.operateData(YDParam.builder()
//                        .appType("APP_X89Y00KKTG36B8JYGZVR")
//                        .systemToken("QIA66091HJPLRHM3AUFJLCN24CUP2VNMO41XLW4")
//                        .formInstanceId(String.valueOf(XMCSLID))
//                        //data.get("shop_name")
//                        .updateFormDataJson(JSON.toJSONString(UtilMap.map("textField_m0hk58mb", "ceshi")))
//                        .build(), YDConf.FORM_OPERATION.update);
//            }
            System.out.println("集晨判断，同步完成");
        }catch (Exception e){
            //记录错误信息
            e.printStackTrace();
        }

    }



    //    @Scheduled(cron = "0 5 7 * * ?")
    public void LegalEntityList1(){
        log.info("k");
        try{
            legalEntityService.insetTHXM_TMER1();
            System.out.println("集晨判断，同步完成");
        }catch (Exception e){
            //记录错误信息
            e.printStackTrace();
        }

    }

}
