//package com.jxy.marketall.task;
//
//import com.jxy.common.core.text.Convert;
//import com.jxy.common.core.utils.DateUtils;
//import com.jxy.common.redis.service.RedisService;
//import com.jxy.marketall.dto.DailyMsgCountDto;
//import com.jxy.marketall.dto.DateBigDecimalDto;
//import com.jxy.marketall.dto.TicketListDto;
//import com.jxy.marketall.enums.TicketStatusType;
//import com.jxy.marketall.mapper.MessageMapper;
//import com.jxy.marketall.mapper.UserHelpMapper;
//import com.jxy.marketall.vo.QueryVo;
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.scheduling.annotation.Scheduled;
//
//import java.time.LocalDateTime;
//import java.util.Date;
//import java.util.List;
//import java.util.stream.Collectors;
//
//
///**
// * @Description 帮助中心定时任务
// * @Date 2022/7/7 18:03
// * @Author 杜懿
// */
//@Configuration
//@EnableScheduling
//public class UserHelpTask {
//
//    @Autowired
//    private UserHelpMapper userHelpMapper;
//
//    @Autowired
//    private RedisService redisService;
//
//    /** 更新超时数据 */
//    //@Scheduled(cron = "0 2 0/8 * * ?")
//    @Scheduled(cron = "0 0/30 * * * ?")
//    public void DailyMsgCountToRedis(){
//
//
//        QueryVo vo = new QueryVo();
//        vo.setEnd(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.toDate(LocalDateTime.now().plusDays(-7))));
//        //获取创建时间超过一周的工单
//        List<TicketListDto> list = userHelpMapper.getTicketListByTime(vo);
//
//        //从超过一周的工单中筛选状态为已处理/已回复的工单 并修改数据库中数据的状态为待审核（即进入审核流程）
//        List<TicketListDto> toTimeOutList =
//                list.stream().filter(
//                        e -> (TicketStatusType.STATUS_FOUR.getCode() == Convert.toInt(e.getStatus()) || TicketStatusType.STATUS_Thirteen.getCode() == Convert.toInt(e.getStatus()))
//                ).collect(Collectors.toList());
//
//        toTimeOutList.stream().forEach(e ->userHelpMapper.changeTicketStatus(e.getId(),TicketStatusType.STATUS_EIGHT.getCode()));
//
//        //从超过一周的工单中筛选状态为待处理/已提交/重复提交的工单 并修改数据库中数据的状态为超时
//        List<TicketListDto> toAuditList =
//                list.stream().filter(
//                        e -> (TicketStatusType.STATUS_ONE.getCode() == Convert.toInt(e.getStatus()) || TicketStatusType.STATUS_THREE.getCode() == Convert.toInt(e.getStatus()) || TicketStatusType.STATUS_SIX.getCode() == Convert.toInt(e.getStatus()))
//                ).collect(Collectors.toList());
//
//        toAuditList.stream().forEach(e ->userHelpMapper.changeTicketStatus(e.getId(),TicketStatusType.STATUS_SEVEN.getCode()));
//
//    }
//
//}
