package com.chinaweal.aiccs.aiccs.punishment.job;

//import com.chinaweal.aiccs.aiccs.punishment.entity.EntLock;
//import com.chinaweal.aiccs.aiccs.punishment.entity.Tolockentlist;
//import com.chinaweal.aiccs.aiccs.punishment.mapper.TaskMapper;
//import com.chinaweal.aiccs.aiccs.punishment.service.EntlockService;
//import com.chinaweal.aiccs.aiccs.punishment.service.TolockentlistService;
//import com.chinaweal.aiccs.aiccs.punishment.service.TsbizPunishLockService;
//import com.chinaweal.aiccs.aiccs.punishment.service.impl.TsbizPunishUnlockServiceImpl;
//import com.chinaweal.aiccs.aiccs.punishment.service.impl.TsbizpunishlockServiceImpl;
//import com.chinaweal.aiccs.common.util.StringUtils;
//import com.chinaweal.youfool.framework.springboot.exception.custom.BusinessException;
//import lombok.extern.slf4j.Slf4j;
//import org.quartz.Job;
//import org.quartz.JobExecutionContext;
//import org.quartz.JobExecutionException;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import java.time.LocalDateTime;
//import java.util.UUID;

/**
 * 6月7日
 */
//@Slf4j
//@Component
//public class AutoUnlock implements Job {
//    @Autowired
//    private EntlockService entlockService;
//    @Autowired
//    private TolockentlistService tolockentlistService;
//    @Resource
//    private TaskMapper taskMapper;
//    @Autowired
//    private TsbizpunishlockServiceImpl tsbizPunishLockService;
//
//
//    @Override
//    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
//        String entName = (String) jobExecutionContext.getJobDetail().getJobDataMap().get("entName");
//        EntLock entLock=taskMapper.query(entName);
//        EntLock e=new EntLock();
//        e.setElid(UUID.randomUUID().toString());
//        e.setIsdelete("0");
//        e.setState("0");
//        e.setLockstate("0");
//        e.setLocktype("001");
//        e.setRegno(entLock.getRegno());
//        e.setPripid(entLock.getPripid());
//        e.setUniscid(entLock.getUniscid());
//        e.setEntname(entName);
//        e.setLockusername("自动锁定");
//        e.setLockstartdate(LocalDateTime.now());
//        e.setLockTime(LocalDateTime.now());
//        e.setRegorg(entLock.getRegorg());
//        e.setRepresentative(entLock.getRepresentative());
//        e.setCertype(entLock.getCertype());
//        e.setCerno(entLock.getCerno());
//        entLock.setLockuserid(bizPunishLockModel.getLockuserid());
//        entLock.setLockuserunitid(bizPunishLockModel.getLockuserunitid());
//
//        entLock.setRegorg(eBaseinfo.getRegorg());
//        entLock.setRepresentative(eBaseinfo.getName());
//        entLock.setElid(bizPunishLockModel.getLockId());
//        entLock.setUniscid(bizPunishLockModel.getUniscid());
//        entLock.setPripid(bizPunishLockModel.getPripid());
//        entLock.setEntname(bizPunishLockModel.getEntname());
//        entLock.setRegno(bizPunishLockModel.getRegno());
//        entLock.setLockreason(bizPunishLockModel.getLockreason());
//        entLock.setLockusername(bizPunishLockModel.getLockusername());
//        entLock.setInputdate(LocalDateTime.now());
//        entLock.setLaupTime(LocalDateTime.now());
//        entLock.setLocktype(bizPunishLockModel.getLocktype());
//        entLock.setLockTime(bizPunishLockModel.getLockTime());
//        entLock.setPunishFrom(bizPunishLockModel.getPunishFrom());
//        entLock.setLockstate("1");//锁定状态 有效
//        entLock.setMeasure(bizPunishLockModel.getMeasure());
//        entLock.setWarningcontent("警示：这家企业因为" + bizPunishLockModel.getLockreason() + "原因不让办理，如有问题，请联系电话");
//        entlockService.insert(e);
//        //EntLock entLock = entlockService.selectLockEntity(entName);
//        //entlockService.insert(entLock);
//        Long start = System.currentTimeMillis();
//        String tflockid = tsbizPunishLockService.sendEntLock(e);
//
//        log.info("推送锁定数据id：{},推送解锁数据耗时: {}ms", tflockid, System.currentTimeMillis() - start);
//        if(StringUtils.isNotBlank(tflockid)){
//            entLock.setTflockid(tflockid);
//            entlockService.updateById(e);
//        } else {
//            throw new BusinessException("推送锁定数据失败");
//        }
//    }
//}
