package com.cool.store.job;

import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.dto.StaffExamInfoDTO;
import com.cool.store.dto.decoration.ConstructionScheduleDTO;
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.dto.xfsgFirstOderDTO;
import com.cool.store.entity.*;
import com.cool.store.enums.*;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.mapper.TrainingExperienceMapper;
import com.cool.store.mq.util.HttpRestTemplateService;
import com.cool.store.request.xfsgFirstOrderListRequest;
import com.cool.store.response.xfsgFirstOderListResponse;
import com.cool.store.service.*;
import com.cool.store.service.impl.CommonService;
import com.cool.store.utils.CoolDateUtils;
import com.cool.store.utils.NumberConverter;
import com.cool.store.utils.poi.DateUtils;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.utils.poi.constant.Constants;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

@Slf4j
@Service
public class XxlJobHandler {


    @Resource
    TrainingExperienceMapper trainingExperienceMapper;
    @Value("${xfsg.url}")
    private String xfsgUrl;
    @Resource
    private HttpRestTemplateService httpRestTemplateService;
    @Resource
    LineInfoMapper lineInfoMapper;
    @Resource
    private PreparationService preparationService;
    @Resource
    private LineInterviewDAO lineInterviewDAO;
    @Resource
    private LineInfoDAO lineInfoDAO;
    @Resource
    private ShopInfoDAO shopInfoDAO;
    @Resource
    private ShopStageInfoDAO shopStageInfoDAO;
    @Resource
    private CoolStoreStartFlowService coolStoreStartFlowService;
    @Resource
    private AcceptanceInfoDAO acceptanceInfoDAO;
    @Resource
    private DecorationService decorationService;
    @Resource
    private CommonService commonService;
    @Resource
    private EmployeeTrainingDAO employeeTrainingDAO;
    @Resource
    private XfsgEhrService xfsgEhrService;
    @Resource
    private TempUserDetailDAO tempUserDetailDAO;
    @Resource
    private EnterpriseUserDAO enterpriseUserDAO;
    @Resource
    private UserAuthMappingService userAuthMappingService;
    @Resource
    private OpenAcceptanceInfoDAO openAcceptanceInfoDAO;

    /**
     * 每天都将待体验门店信息变更到体验中
     */
    @XxlJob("updateStoreExperience")
    public void updateStoreExperience() {
        log.info("------实训体验状态变更------");
        String param = XxlJobHelper.getJobParam();
        String enterpriseId = param;
        //查出数据并更新为体验中
        List<LeaseBaseInfoDO> leaseBaseInfoDOS = trainingExperienceMapper.selectESTime();
        if (CollectionUtils.isEmpty(leaseBaseInfoDOS)) {
            log.info("------今日没有待更新数据------");
            return;
        }
        //线索ids
        List<Long> lineIds = leaseBaseInfoDOS.stream().map(LeaseBaseInfoDO::getLineId).collect(Collectors.toList());
        WorkflowSubStageStatusEnum storeExperience90 = WorkflowSubStageStatusEnum.STORE_EXPERIENCE_90;
        lineInfoMapper.toExperiencing(lineIds, storeExperience90.getCode());

        log.info("------实训体验状态变更结束------");
        XxlJobHelper.handleSuccess();
    }

    @XxlJob("batchUpdateInterviewWorkflowStage")
    public void batchUpdateInterviewWorkflowStage() {
        log.info("------面谈待审核状态变更------");
        List<LineInterviewDO> interviewList = lineInterviewDAO.getWaitAuditInterview();
        if (CollectionUtils.isEmpty(interviewList)) {
            log.info("------今日没有待更新数据------");
            return;
        }
        List<Long> lineIds = interviewList.stream().map(LineInterviewDO::getLineId).collect(Collectors.toList());
        List<Long> interviewIds = interviewList.stream().map(LineInterviewDO::getId).collect(Collectors.toList());
        lineInfoDAO.batchUpdateInterviewWorkflowStage(lineIds, WorkflowSubStageEnum.INVITING_INTERVIEWS, WorkflowSubStageStatusEnum.INVITING_INTERVIEWS_20);
        lineInterviewDAO.batchUpdateInterviewStatus(interviewIds, InterviewStatusEnum.WAIT_AUDIT);
        XxlJobHelper.handleSuccess();
    }

    /**
     * @Auther: wangshuo
     * @Date: 2024/4/25
     * @description:每天查询更新订货金
     */
    @XxlJob("updateFirstOrder")
    public void updateFirstOrder() {
        log.info("----定时任务查询更新订货金----");
        boolean hasNext = true;
        int pageNum = 1;
        int pageSize = 50;
        while (hasNext) {
            PageHelper.startPage(pageNum, pageSize);
            List<ShopStageInfoDO> shopIdListByStageStatus = shopStageInfoDAO.getShopIdListByStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_152.getShopSubStageStatus());
            if (CollectionUtils.isEmpty(shopIdListByStageStatus)) {
                log.info("------定时任务结束调用鲜丰更新订货金结束------");
                return;
            }
            List<Long> shopIds = shopIdListByStageStatus.stream().filter(o -> o.getShopId() != null).map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
            try {
                List<OpenPlanShopInfoDTO> openPlanShopInfoDTOS = shopInfoDAO.queryStoreNumeListByid(shopIds);
                Map<String, Long> map = openPlanShopInfoDTOS.stream().filter(OpenPlanShopInfoDTO -> StringUtils.isNoneBlank(OpenPlanShopInfoDTO.getStoreNum())).
                        collect(Collectors.toMap(OpenPlanShopInfoDTO::getStoreNum, OpenPlanShopInfoDTO::getShopId));
                List<String> storeCodes = new ArrayList<>(map.keySet());
                xfsgFirstOrderListRequest request = new xfsgFirstOrderListRequest();
                request.setStoreCodeList(storeCodes);
                xfsgFirstOderListResponse firstOrderList = coolStoreStartFlowService.getFirstOrderList(request);
                if (Objects.nonNull(firstOrderList) && CollectionUtils.isNotEmpty(firstOrderList.getData())) {
                    for (xfsgFirstOderDTO o : firstOrderList.getData()) {
                        if (o.getBalance()) {
                            shopStageInfoDAO.updateShopStageInfo(map.get(o.getStoreCode()), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151);
                            preparationService.whetherToOpenForAcceptance(map.get(o.getStoreCode()));
                        }
                    }
                }
            } catch (Exception e) {
                log.error("定时任务更新订货金失败 shopIds:{},e:{}", shopIds, e.getMessage());
            }
            hasNext = shopIdListByStageStatus.size() >= pageSize;
            pageNum++;
        }
        log.info("------定时任务结束调用鲜丰更新订货金结束------");
        XxlJobHelper.handleSuccess();
    }

    /**
     * @Auther: wangshuo
     * @Date: 2024/4/29
     * @description: 每天更新装修阶段进场时间等
     */
    @XxlJob("updateEntryTime")
    public void updateEntryTime() {
        log.info("----定时任务每天更新装修阶段进场时间，施工完成时间等----");
        boolean hasNext = true;
        int pageNum = 1;
        int pageSize = 50;
        while (hasNext) {
            PageHelper.startPage(pageNum, pageSize);
            //获取表中进场时间为空的
            List<AcceptanceInfoDO> acceptanceInfoDOS = acceptanceInfoDAO.selectByEntryTimeNull();
            if (CollectionUtils.isEmpty(acceptanceInfoDOS)) {
                log.info("------定时任务结束每天更新至预约状态结束------");
                return;
            }
            for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) {
                int flag = CommonConstants.ZERO;
                while (flag < CommonConstants.TWO) {
                    try {
                        Long shopId = acceptanceInfoDO.getShopId();
                        //施工子阶段 更新装修阶段进场时间等
                        decorationService.getConstruction(shopId);
                        break;
                    } catch (Exception e) {
                        log.error("定时任务设置进场时间失败,shopId:{},e:{}", acceptanceInfoDO.getShopId(), e.getMessage());
                        flag++;
                    }
                }
            }
            hasNext = acceptanceInfoDOS.size() >= pageSize;
            pageNum++;
        }
        log.info("------定时任务结束每天更新至预约状态结束------");
        XxlJobHelper.handleSuccess();
    }

    /**
     * @Auther: wangshuo
     * @Date: 2024/4/29
     * @description: 每天更新装修阶段进场时间等，至预约状态
     */
    @XxlJob("fitmentAcceptanceHandler")
    public void fitmentAcceptanceHandler() {
        log.info("----定时任务每天更新至预约状态----");
        boolean hasNext = true;
        int pageNum = 1;
        int pageSize = 50;
        while (hasNext) {
            PageHelper.startPage(pageNum, pageSize);
            //获取表中的三方验收状态为-100状态和进场时间不为空的
            List<AcceptanceInfoDO> acceptanceInfoDOS = acceptanceInfoDAO.selectAcceptanceInfoBySignatures(ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_00.getShopSubStageStatus());
            if (CollectionUtils.isEmpty(acceptanceInfoDOS)) {
                log.info("------定时任务结束每天更新至预约状态结束------");
                return;
            }
            List<Long> shopIds = new ArrayList<>();
            for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) {
                Long shopId = acceptanceInfoDO.getShopId();
                Date actualEntryTime = acceptanceInfoDO.getActualEntryTime();
                LocalDate plusFDays = DateUtils.getPlusFDays(actualEntryTime, CommonConstants.FOUR);
                //小于等于当前时间
                if (plusFDays.isEqual(LocalDate.now()) || plusFDays.isBefore(LocalDate.now())) {
                    //三方验收待预约
                    shopIds.add(shopId);

                }
            }
            shopStageInfoDAO.batchUpdateShopStageStatus(shopIds, ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120.getShopSubStageStatus());
            hasNext = acceptanceInfoDOS.size() >= pageSize;
            pageNum++;
        }
        log.info("------定时任务结束调用鲜丰获取进场时间结束------");
        XxlJobHelper.handleSuccess();
    }

    /**
     * @Auther: wangshuo
     * @Date: 2024/5/10
     * @description:实际进场时间+5天，发送钉钉通知到工程监理
     */
    @XxlJob("threeAcceptanceBookingMessage")
    public void threeAcceptanceBookingMessage() {
        log.info("------定时任务三方验收待预约钉钉通知-----");
        boolean hasNext = true;
        int pageNum = 1;
        int pageSize = 50;
        while (hasNext) {
            PageHelper.startPage(pageNum, pageSize);
            //进场时间不为空的
            List<AcceptanceInfoDO> acceptanceInfoDOS = acceptanceInfoDAO
                    .selectListNotNullEntryTime();
            if (CollectionUtils.isEmpty(acceptanceInfoDOS)) {
                log.info("------定时任务结束三方验收待预约钉钉通知------");
                return;
            }
            for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) {
                int flag = CommonConstants.ZERO;
                //进场时间
                while (flag < CommonConstants.TWO) {
                    try {
                        Date approach = acceptanceInfoDO.getActualEntryTime();
                        LocalDate plusFDays = DateUtils.getPlusFDays(approach, CommonConstants.FOUR);
                        if (plusFDays.equals(LocalDate.now())) {
                            ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(acceptanceInfoDO.getShopId());
                            List<EnterpriseUserDO> supervisor = userAuthMappingService
                                    .getUserByRoleEnumAndRegionIdList(UserRoleEnum.ENGINEER_DEP_SUPERVISOR, shopInfo.getRegionId());
                            LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
                            for (EnterpriseUserDO enterpriseUserDO : supervisor) {
                                Map<String, String> messageMap = new HashMap<>();
                                messageMap.put("storeName", shopInfo.getShopName());
                                messageMap.put("partnerUsername", lineInfo.getUsername());
                                messageMap.put("partnerMobile", lineInfo.getMobile());
                                commonService.sendMessage(Arrays.asList(enterpriseUserDO.getUserId()), MessageEnum.MESSAGE_24, messageMap);
                            }
                        }
                        break;
                    } catch (Exception e) {
                        log.error("------定时任务三方验收待预约钉钉通知失败,shopId:{},e:{}", acceptanceInfoDO.getShopId(), e.getMessage());
                        flag++;
                    }
                }
            }
            hasNext = acceptanceInfoDOS.size() >= pageSize;
            pageNum++;
        }
    }

    /**
     * @Auther: wangshuo
     * @Date: 2024/5/7
     * @description:三方验收预约短信通知,进场时间+7天的18：00，发送短信到加盟商，
     */
    @XxlJob("threeAcceptanceMessage")
    public void threeAcceptanceMessage() {
        log.info("------定时任务三方验收待验收的短信通知-----");
        boolean hasNext = true;
        int pageNum = 1;
        int pageSize = 50;
        while (hasNext) {
            PageHelper.startPage(pageNum, pageSize);
            //获取待验收的
            List<AcceptanceInfoDO> acceptanceInfoDOS = acceptanceInfoDAO
                    .selectAcceptanceInfoBySignatures(ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121.getShopSubStageStatus());
            if (CollectionUtils.isEmpty(acceptanceInfoDOS)) {
                log.info("------定时任务结束三方验收待验收的短信通知------");
                return;
            }
            for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) {
                int flag = CommonConstants.ZERO;
                while (flag < CommonConstants.TWO) {
                    try {
                        Date approach = acceptanceInfoDO.getActualEntryTime();
                        if (Objects.nonNull(approach)) {
                            LocalDate plusFDays = DateUtils.getPlusFDays(approach, CommonConstants.SIX);//7 day
                            if (plusFDays.equals(LocalDate.now())) {
                                //三方验收带预约
                                ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(acceptanceInfoDO.getShopId());
                                //加盟商手机号
                                Long lineId = shopInfo.getLineId();
                                LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
                                if (Objects.isNull(lineInfo) && StringUtils.isNull(lineInfo.getMobile())) {
                                    log.error("定时任务三方验收待验收的短信通知:加盟商手机号为空,shopId:#{}", acceptanceInfoDO.getShopId());
                                    break;
                                }
                                EnterpriseUserDO supervisor = userAuthMappingService
                                        .getUserByRoleEnumAndRegionId(UserRoleEnum.ENGINEER_DEP_SUPERVISOR, shopInfo.getRegionId());
                                if (Objects.isNull(supervisor)) {
                                    log.error("该区域没有工程部监理,RegionId：{}", shopInfo.getRegionId());
                                    break;
                                }
                                //获取计划撤场时间
                                Date planExitTime = acceptanceInfoDO.getPlanExitTime();
                                //获取施工阶段计划完成时间
                                Date decorationEndTime = acceptanceInfoDO.getDecorationPlannedCompletionTime();
                                //获取计划验收时间
                                String planAcceptanceTime = CoolDateUtils.DateFormat(acceptanceInfoDO.getPlanAcceptanceTime(), CoolDateUtils.DATE_FORMAT_SEC);
                                if (StringUtils.isBlank(planAcceptanceTime)) {
                                    planAcceptanceTime = "";
                                }
                                //区域监理手机号
                                Boolean f = Boolean.TRUE;
                                String mobile = supervisor.getMobile();
                                String supervisionName = supervisor.getName();

                                Map<String, String> messageMap = new HashMap<>();
                                if (Objects.nonNull(planExitTime)) {
                                    String date = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, planExitTime);
                                    messageMap.put("demolitionPlanTime", date);
                                } else {
                                    if (Objects.nonNull(decorationEndTime)) {
                                        String date = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, decorationEndTime);
                                        messageMap.put("demolitionPlanTime", date);
                                    }
                                }
                                messageMap.put("palnAcceptanceTime", planAcceptanceTime);
                                messageMap.put("supervisionName", supervisionName);
                                messageMap.put("supervisionMobile", mobile);
                                commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.THREE_ACCEPTANCE_WAIT, messageMap);
                            }
                        }
                        break;
                    } catch (Exception e) {
                        log.error("定时任务三方验收待验收的短信通知失败 shopId:{},e:{}", acceptanceInfoDO.getShopId(), e.getMessage());
                        flag++;
                    }
                }

            }
            hasNext = acceptanceInfoDOS.size() >= pageSize;
            pageNum++;
        }
        XxlJobHelper.handleSuccess();
    }

    /**
     * @Auther: wangshuo
     * @Date: 2024/5/7
     * @description:实际进场时间+7天，发送钉钉通知到督导
     */
    @XxlJob("waitThreeAcceptanceMessage")
    public void waitThreeAcceptanceMessage() {
        log.info("------定时任务三方待验收钉钉通知-----");
        boolean hasNext = true;
        int pageNum = 1;
        int pageSize = 50;
        while (hasNext) {
            PageHelper.startPage(pageNum, pageSize);
            //获取待验收的
            List<AcceptanceInfoDO> acceptanceInfoDOS = acceptanceInfoDAO
                    .selectAcceptanceInfoBySignatures(ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121.getShopSubStageStatus());
            if (CollectionUtils.isEmpty(acceptanceInfoDOS)) {
                log.info("------定时任务结束三方待验收钉钉通知------");
                return;
            }
            List<Long> shopIds = acceptanceInfoDOS.stream().filter(o -> o.getShopId() != null)
                    .map(AcceptanceInfoDO::getShopId).collect(Collectors.toList());
            List<ShopInfoDO> shopListByIds = shopInfoDAO.getShopListByIds(shopIds);
            Map<Long, ShopInfoDO> shopIdMap = shopListByIds.stream().filter(o -> o.getId() != null)
                    .collect(Collectors.toMap(ShopInfoDO::getId, Function.identity()));
            for (AcceptanceInfoDO acceptance : acceptanceInfoDOS) {
                //进场时间
                Date approach = acceptance.getActualEntryTime();
                Long shopId = acceptance.getShopId();
                if (Objects.nonNull(approach)) {
                    LocalDate plusFDays = DateUtils.getPlusFDays(approach, CommonConstants.SIX);//7天
                    if (plusFDays.equals(LocalDate.now())) {
                        ShopInfoDO shopInfoDO = shopIdMap.get(shopId);
                        if (StringUtils.isBlank(shopInfoDO.getSupervisorUserId())) {
                            log.error("定时任务三方待验收钉钉通知,督导id为空,shopId:{}", shopId);
                        }
                        Long lineId = shopInfoDO.getLineId();
                        LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
                        Map<String, String> messageMap = new HashMap<>();
                        messageMap.put("storeName", shopInfoDO.getShopName());
                        messageMap.put("partnerUsername", lineInfo.getUsername());
                        messageMap.put("partnerMobile", lineInfo.getMobile());
                        commonService.sendMessage(Arrays.asList(shopInfoDO.getSupervisorUserId()), MessageEnum.MESSAGE_25, messageMap);

                    }
                }
            }
            hasNext = acceptanceInfoDOS.size() >= pageSize;
            pageNum++;
        }
        XxlJobHelper.handleSuccess();
    }

    @XxlJob("interviewRemind")
    public void interviewRemind() {
        log.info("------面试提醒------");
        String startTime = LocalDateTime.now().plusHours(1).minusMinutes(CommonConstants.FIVE).format(DateTimeFormatter.ofPattern(CoolDateUtils.DATE_FORMAT_SEC));
        String endTime = LocalDateTime.now().plusHours(1).plusMinutes(CommonConstants.FIVE).format(DateTimeFormatter.ofPattern(CoolDateUtils.DATE_FORMAT_SEC));
        List<LineInterviewDO> interviewList = lineInterviewDAO.getInterviewRemindList(startTime, endTime);
        if (CollectionUtils.isEmpty(interviewList)) {
            log.info("------今日没有待更新数据------");
            return;
        }
        List<Long> lineIds = interviewList.stream().map(LineInterviewDO::getLineId).collect(Collectors.toList());
        Map<Long, String> lineMobileMap = lineInfoDAO.getLineMobileMap(lineIds);
        for (LineInterviewDO interview : interviewList) {
            Map<String, String> templateParamMap = new HashMap<>();
            templateParamMap.put("interviewTime", DateUtil.format(interview.getStartTime(), "HH:mm"));
            if (InterviewTypeEnum.INTERVIEW.getCode().equals(interview.getInterviewType())) {
                commonService.sendSms(lineMobileMap.get(interview.getLineId()), SMSMsgEnum.FIRST_INTERVIEW_REMIND, templateParamMap);
            }
            if (InterviewTypeEnum.SECOND_INTERVIEW.getCode().equals(interview.getInterviewType())) {
                commonService.sendSms(lineMobileMap.get(interview.getLineId()), SMSMsgEnum.SECOND_INTERVIEW_REMIND, templateParamMap);
            }
        }
        XxlJobHelper.handleSuccess();
    }

    @XxlJob("theoreticalExam")
    public void theoreticalExam() {
        log.info("------理论考试更新------");
        List<EmployeeTrainingDO> theoreticalList = employeeTrainingDAO.theoreticalList();
        if (CollectionUtils.isEmpty(theoreticalList)) {
            log.info("------今日没有待更新数据------");
            return;
        }
        for (EmployeeTrainingDO employeeTrainingDO : theoreticalList) {
            TempUserDetailDO tempUserDetailDO = tempUserDetailDAO.selectById(employeeTrainingDO.getXfsgUserDetailId());

            EnterpriseUserDO enterpriseUserDO = enterpriseUserDAO.getUserInfoByThirdOaUniqueFlag(tempUserDetailDO.getIdCard());
            //查询理论分支并更新
            StaffExamInfoDTO staffExamInfoDTO = xfsgEhrService.getUserExamInfo(enterpriseUserDO.getJobnumber());
            if (staffExamInfoDTO != null && StringUtils.isNotBlank(staffExamInfoDTO.getExamResult())
                    && StringUtils.isNotBlank(staffExamInfoDTO.getExamScore())) {
                employeeTrainingDO.setTheoreticalExamScore(StringUtils.isNotBlank(staffExamInfoDTO.getExamScore()) ? NumberConverter.convertMath(staffExamInfoDTO.getExamScore()) : null);
                employeeTrainingDO.setTheoreticalExamStatus(ExamStatusEnum.matchCodeByDesc(staffExamInfoDTO.getExamResult()));
                employeeTrainingDAO.updateByPrimaryKeySelective(employeeTrainingDO);
            }

        }
        XxlJobHelper.handleSuccess();
    }

    /**
     * 店铺新店开业状态更新
     */
    @XxlJob("shopOpenAcceptanceStatusUpdate")
    public void shopOpenAcceptanceStatusUpdate() {
        log.info("------店铺新店开业状态更新------");
        int num = openAcceptanceInfoDAO.shopOpenAcceptanceStatusUpdate();
        log.info("------店铺新店开业状态更新完成num:{}------", num);
        XxlJobHelper.handleSuccess();
    }

}
