| | |
| | | * Corn表达式 @Scheduled(cron = Corn表达式) |
| | | * @Scheduled(cron = "0 0/30 * * * *") |
| | | */ |
| | | |
| | | @Scheduled(fixedRate = 1000 * 30) |
| | | public void autoStartMentalAppointment() { |
| | | // 当前时间 |
| | | DateTime dateTime = DateUtil.date(); |
| | | |
| | | // 待开始预约单 |
| | | List<MentalAppointment> mentalAppointmentList = mentalAppointmentService.list( |
| | | Wrappers.<MentalAppointment>lambdaUpdate() |
| | |
| | | } |
| | | |
| | | for (MentalAppointment o : mentalAppointmentList) { |
| | | MentalTestMyTestTopicDTO mentalTestMyTestTopicDTO = myTestRecordTopicList.stream().filter(rt -> rt.getMentalAppointmentId().equals(o.getId())).findFirst().orElse(new MentalTestMyTestTopicDTO()); |
| | | if (o.getType()==null) { |
| | | MentalTestMyTestTopicDTO mentalTestMyTestTopicDTO = myTestRecordTopicList.stream().filter(rt -> rt.getMentalAppointmentId().equals(o.getId())).findFirst().orElse(new MentalTestMyTestTopicDTO()); |
| | | |
| | | // 发送IM消息 |
| | | ImPushDataDTO pushData = ImPushDataDTO.builder() |
| | | // 发送IM消息 |
| | | ImPushDataDTO pushData = ImPushDataDTO.builder() |
| | | .type(ImPushTypeEnum.C_TO_W_IM_1V1_START_CONSULT.getCode()) |
| | | .title(ImPushTypeEnum.C_TO_W_IM_1V1_START_CONSULT.getName()) |
| | | .content("做了" |
| | |
| | | .data2(ObjUtil.toString(o.getWorkerId())) |
| | | .data3(ObjUtil.toString(mentalTestMyTestTopicDTO.getId())) |
| | | .build(); |
| | | imBizService.messageSendPrivate( |
| | | ObjUtil.toString(o.getUserId()), |
| | | new String[]{ObjUtil.toString(o.getWorkerId())}, |
| | | pushData |
| | | ); |
| | | imBizService.messageSendPrivate( |
| | | ObjUtil.toString(o.getUserId()), |
| | | new String[]{ObjUtil.toString(o.getWorkerId())}, |
| | | pushData |
| | | ); |
| | | } |
| | | |
| | | // 开始预约咨询 |
| | | mentalAppointmentService.update( |
| | |
| | | } |
| | | } |
| | | |
| | | // @Scheduled(fixedRate = 1000 * 30) |
| | | // public void autoStartMentalAppointment1() { |
| | | // // 当前时间 |
| | | // DateTime dateTime = DateUtil.date(); |
| | | // // 待开始预约单 |
| | | // List<MentalAppointment> mentalAppointmentList = mentalAppointmentService.list( |
| | | // Wrappers.<MentalAppointment>lambdaUpdate() |
| | | // .eq(MentalAppointment::getStatusFlag, MentalAppointmentStatusEnum.WAIT_SERVICE.getCode()) |
| | | // .eq(MentalAppointment::getType,"1") |
| | | // .apply("DATE_ADD(appointment_day, INTERVAL TIME_TO_SEC(begin_time_point) SECOND) < NOW()") |
| | | //// .le(MentalAppointment::getAppointmentDay, dateTime.toDateStr()) |
| | | //// .le(MentalAppointment::getBeginTimePoint, DateUtil.format(dateTime, "HH:mm")) |
| | | // ); |
| | | // |
| | | // for (MentalAppointment o : mentalAppointmentList) { |
| | | // // 开始预约咨询 |
| | | // mentalAppointmentService.update( |
| | | // Wrappers.<MentalAppointment>lambdaUpdate() |
| | | // .eq(MentalAppointment::getId, o.getId()) |
| | | // .set(MentalAppointment::getStatusFlag, MentalAppointmentStatusEnum.IN_SERVICE.getCode()) |
| | | // .set(MentalAppointment::getConsultStatus, MentalAppointmentConsultStatusEnum.IN_CONSULT.getCode()) |
| | | // ); |
| | | // log.info("开始预约咨询: {}", JSONUtil.toJsonStr(o)); |
| | | // } |
| | | // } |
| | | |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void autoEndMentalAppointment() { |
| | | // 当前时间 |