| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -67,125 +67,164 @@ public class CarJob { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        String today = DateUtil.format(current, DateUtil.PATTERN_DATE); | 
					 | 
					 | 
					 | 
					        String today = DateUtil.format(current, DateUtil.PATTERN_DATE); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        String yesterday = DateUtil.format(before, DateUtil.PATTERN_DATE); | 
					 | 
					 | 
					 | 
					        String yesterday = DateUtil.format(before, DateUtil.PATTERN_DATE); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 车保状态变更
 | 
					 | 
					 | 
					 | 
					        // 车保状态变更
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<CarEntity> uninsuredCarList = carService.getCarListByInsuranceTime(today, yesterday); | 
					 | 
					 | 
					 | 
					        List<CarEntity> uninsuredCarList = carService.getCarListByInsuranceTime(yesterday, today); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(uninsuredCarList)) { | 
					 | 
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(uninsuredCarList)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            uninsuredCarList.forEach(car -> car.setInsuranceStatus(CarInsuranceStatusEnum.UNINSURED.getValue())); | 
					 | 
					 | 
					 | 
					            uninsuredCarList.forEach(car -> car.setInsuranceStatus(CarInsuranceStatusEnum.UNINSURED.getValue())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            boolean insuranceUpdate = carService.updateBatchById(uninsuredCarList); | 
					 | 
					 | 
					 | 
					            boolean insuranceUpdate = carService.updateBatchById(uninsuredCarList); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (!insuranceUpdate) { | 
					 | 
					 | 
					 | 
					            if (!insuranceUpdate) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return ReturnT.FAIL; | 
					 | 
					 | 
					 | 
					                return ReturnT.FAIL; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            // 变更成功则推送消息
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            uninsuredCarList.forEach(this::sendUninsuredMessage); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 维保状态变更
 | 
					 | 
					 | 
					 | 
					        // 维保状态变更
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<CarEntity> unmaintainedCarList = carService.getCarListByMaintenanceTime(today, yesterday); | 
					 | 
					 | 
					 | 
					        List<CarEntity> unmaintainedCarList = carService.getCarListByMaintenanceTime(yesterday, today); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(unmaintainedCarList)) { | 
					 | 
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(unmaintainedCarList)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            unmaintainedCarList.forEach(car -> car.setMaintenanceStatus(CarMaintenanceStatusEnum.UNMAINTAINED.getValue())); | 
					 | 
					 | 
					 | 
					            unmaintainedCarList.forEach(car -> car.setMaintenanceStatus(CarMaintenanceStatusEnum.UNMAINTAINED.getValue())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            boolean maintenanceUpdate = carService.updateBatchById(unmaintainedCarList); | 
					 | 
					 | 
					 | 
					            boolean maintenanceUpdate = carService.updateBatchById(unmaintainedCarList); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (!maintenanceUpdate) { | 
					 | 
					 | 
					 | 
					            if (!maintenanceUpdate) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return ReturnT.FAIL; | 
					 | 
					 | 
					 | 
					                return ReturnT.FAIL; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            // 变更成功则推送消息
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            unmaintainedCarList.forEach(this::sendUnmaintainedMessage); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 年检状态变更
 | 
					 | 
					 | 
					 | 
					        // 年检状态变更
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<CarEntity> uninspectedCarList = carService.getCarListByAnnualInspectionTime(today, yesterday); | 
					 | 
					 | 
					 | 
					        List<CarEntity> uninspectedCarList = carService.getCarListByAnnualInspectionTime(yesterday, today); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(uninspectedCarList)) { | 
					 | 
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(uninspectedCarList)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            uninspectedCarList.forEach(car -> car.setAnnualInspectionStatus(CarAnnualInspectionStatusEnum.UNFINISHED.getValue())); | 
					 | 
					 | 
					 | 
					            uninspectedCarList.forEach(car -> car.setAnnualInspectionStatus(CarAnnualInspectionStatusEnum.UNFINISHED.getValue())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            boolean inspectionUpdate = carService.updateBatchById(uninspectedCarList); | 
					 | 
					 | 
					 | 
					            boolean inspectionUpdate = carService.updateBatchById(uninspectedCarList); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (!inspectionUpdate) { | 
					 | 
					 | 
					 | 
					            if (!inspectionUpdate) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return ReturnT.FAIL; | 
					 | 
					 | 
					 | 
					                return ReturnT.FAIL; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            // 变更成功则推送消息
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            uninspectedCarList.forEach(this::sendUninspectedMessage); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return ReturnT.SUCCESS; | 
					 | 
					 | 
					 | 
					        return ReturnT.SUCCESS; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * 推送车保过期消息 | 
					 | 
					 | 
					 | 
					     * 推送车保即将过期消息 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param carEntity 车辆实体类 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private void sendUninsuredMessage(CarEntity carEntity) { | 
					 | 
					 | 
					 | 
					    @XxlJob("sendExpiredInsuranceMessage") | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (carEntity.getManagerId() == null) { | 
					 | 
					 | 
					 | 
					    public ReturnT<String> sendExpiredInsuranceMessage(String param) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            log.error("系统无该用户信息,推送车保过期消息失败"); | 
					 | 
					 | 
					 | 
					        // 获取时间范围
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return; | 
					 | 
					 | 
					 | 
					        Date current = DateUtil.now(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        Date next = DateUtil.plusDays(current, 2); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 查询用户
 | 
					 | 
					 | 
					 | 
					        String today = DateUtil.format(current, DateUtil.PATTERN_DATE); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        R<User> userRes = userClient.userInfoById(carEntity.getManagerId()); | 
					 | 
					 | 
					 | 
					        String tomorrow = DateUtil.format(next, DateUtil.PATTERN_DATE); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        User user = userRes.getData(); | 
					 | 
					 | 
					 | 
					        // 获取车保状态即将过期的车辆
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO(); | 
					 | 
					 | 
					 | 
					        List<CarEntity> uninsuredCarList = carService.getCarListByInsuranceTime(today, tomorrow); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (StringUtils.isNotEmpty(user.getDeptId())) { | 
					 | 
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(uninsuredCarList)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            Long id = Long.valueOf(user.getDeptId()); | 
					 | 
					 | 
					 | 
					            for (CarEntity car : uninsuredCarList) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setDeptId(id); | 
					 | 
					 | 
					 | 
					                if (car.getManagerId() == null) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData()); | 
					 | 
					 | 
					 | 
					                    return new ReturnT<>("系统无该用户信息,无法推送车保过期提醒消息"); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setBusinessKey("车保到期"); | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setBusinessClassify("system"); | 
					 | 
					 | 
					 | 
					                // 查询用户
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setTaskId(carEntity.getId()); | 
					 | 
					 | 
					 | 
					                R<User> userRes = userClient.userInfoById(car.getManagerId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setSubject("车保到期通知"); | 
					 | 
					 | 
					 | 
					                User user = userRes.getData(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setContent("您所管理的车辆" + carEntity.getPlateNumber() + "车保已过期,请及时续保。"); | 
					 | 
					 | 
					 | 
					                // 推送消息
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setUserIds(String.valueOf(carEntity.getManagerId())); | 
					 | 
					 | 
					 | 
					                BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setCreateUser(carEntity.getCreateUser()); | 
					 | 
					 | 
					 | 
					                if (StringUtils.isNotEmpty(user.getDeptId())) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setTenantId(CommonConstant.TENANT_ID); | 
					 | 
					 | 
					 | 
					                    Long id = Long.valueOf(user.getDeptId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setDeptId(id); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setBusinessKey("车保到期"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setBusinessClassify("system"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setTaskId(car.getId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setSubject("车保即将到期提醒"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setContent("您所管理的车辆" + car.getPlateNumber() + "的车保即将过期,请及时续保。"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setUserIds(String.valueOf(car.getManagerId())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setCreateUser(car.getCreateUser()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setTenantId(CommonConstant.TENANT_ID); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                R<Boolean> res = messageClient.sendAppAndWsMsgByUsers(businessMessageDTO); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                if (!res.isSuccess()) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    return ReturnT.FAIL; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        messageClient.sendAppAndWsMsgByUsers(businessMessageDTO); | 
					 | 
					 | 
					 | 
					        return ReturnT.SUCCESS; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * 推送维保过期消息 | 
					 | 
					 | 
					 | 
					     * 推送维保即将过期消息 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param carEntity 车辆实体类 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private void sendUnmaintainedMessage(CarEntity carEntity) { | 
					 | 
					 | 
					 | 
					    @XxlJob("sendExpiredMaintainedMessage") | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (carEntity.getManagerId() == null) { | 
					 | 
					 | 
					 | 
					    public ReturnT<String> sendExpiredMaintainedMessage(String param) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            log.error("系统无该用户信息,推送维保过期消息失败"); | 
					 | 
					 | 
					 | 
					        // 获取时间范围
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return; | 
					 | 
					 | 
					 | 
					        Date current = DateUtil.now(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        Date next = DateUtil.plusDays(current, 2); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 查询用户
 | 
					 | 
					 | 
					 | 
					        String today = DateUtil.format(current, DateUtil.PATTERN_DATE); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        R<User> userRes = userClient.userInfoById(carEntity.getManagerId()); | 
					 | 
					 | 
					 | 
					        String tomorrow = DateUtil.format(next, DateUtil.PATTERN_DATE); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        User user = userRes.getData(); | 
					 | 
					 | 
					 | 
					        // 获取维保状态即将过期的车辆
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO(); | 
					 | 
					 | 
					 | 
					        List<CarEntity> unmaintainedCarList = carService.getCarListByMaintenanceTime(today, tomorrow); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (StringUtils.isNotEmpty(user.getDeptId())) { | 
					 | 
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(unmaintainedCarList)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            Long id = Long.valueOf(user.getDeptId()); | 
					 | 
					 | 
					 | 
					            for (CarEntity car : unmaintainedCarList) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setDeptId(id); | 
					 | 
					 | 
					 | 
					                if (car.getManagerId() == null) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData()); | 
					 | 
					 | 
					 | 
					                    return new ReturnT<>("系统无该用户信息,无法推送维保过期提醒消息"); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setBusinessKey("维保到期"); | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setBusinessClassify("system"); | 
					 | 
					 | 
					 | 
					                // 查询用户
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setTaskId(carEntity.getId()); | 
					 | 
					 | 
					 | 
					                R<User> userRes = userClient.userInfoById(car.getManagerId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setSubject("维保到期通知"); | 
					 | 
					 | 
					 | 
					                User user = userRes.getData(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setContent("您所管理的车辆" + carEntity.getPlateNumber() + "维保已过期,请及时进行维保。"); | 
					 | 
					 | 
					 | 
					                // 推送消息
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setUserIds(String.valueOf(carEntity.getManagerId())); | 
					 | 
					 | 
					 | 
					                BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setCreateUser(carEntity.getCreateUser()); | 
					 | 
					 | 
					 | 
					                if (StringUtils.isNotEmpty(user.getDeptId())) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setTenantId(CommonConstant.TENANT_ID); | 
					 | 
					 | 
					 | 
					                    Long id = Long.valueOf(user.getDeptId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setDeptId(id); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setBusinessKey("维保到期"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setBusinessClassify("system"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setTaskId(car.getId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setSubject("维保即将到期提醒"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setContent("您所管理的车辆" + car.getPlateNumber() + "的维保即将过期,请及时进行维保。"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setUserIds(String.valueOf(car.getManagerId())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setCreateUser(car.getCreateUser()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setTenantId(CommonConstant.TENANT_ID); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                R<Boolean> res = messageClient.sendAppAndWsMsgByUsers(businessMessageDTO); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                if (!res.isSuccess()) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    return ReturnT.FAIL; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        messageClient.sendAppAndWsMsgByUsers(businessMessageDTO); | 
					 | 
					 | 
					 | 
					        return ReturnT.SUCCESS; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * 推送年检过期消息 | 
					 | 
					 | 
					 | 
					     * 推送年检即将过期消息 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param carEntity 车辆实体类 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private void sendUninspectedMessage(CarEntity carEntity) { | 
					 | 
					 | 
					 | 
					    @XxlJob("sendExpiredInspectedMessage") | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (carEntity.getManagerId() == null) { | 
					 | 
					 | 
					 | 
					    public ReturnT<String> sendExpiredInspectedMessage(String param) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            log.error("系统无该用户信息,推送年检过期消息失败"); | 
					 | 
					 | 
					 | 
					        // 获取时间范围
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return; | 
					 | 
					 | 
					 | 
					        Date current = DateUtil.now(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        Date next = DateUtil.plusDays(current, 2); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 查询用户
 | 
					 | 
					 | 
					 | 
					        String today = DateUtil.format(current, DateUtil.PATTERN_DATE); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        R<User> userRes = userClient.userInfoById(carEntity.getManagerId()); | 
					 | 
					 | 
					 | 
					        String tomorrow = DateUtil.format(next, DateUtil.PATTERN_DATE); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        User user = userRes.getData(); | 
					 | 
					 | 
					 | 
					        // 获取维保状态即将过期的车辆
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO(); | 
					 | 
					 | 
					 | 
					        List<CarEntity> uninspectedCarList = carService.getCarListByAnnualInspectionTime(today, tomorrow); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (StringUtils.isNotEmpty(user.getDeptId())) { | 
					 | 
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(uninspectedCarList)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            Long id = Long.valueOf(user.getDeptId()); | 
					 | 
					 | 
					 | 
					            for (CarEntity car : uninspectedCarList) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setDeptId(id); | 
					 | 
					 | 
					 | 
					                if (car.getManagerId() == null) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData()); | 
					 | 
					 | 
					 | 
					                    return new ReturnT<>("系统无该用户信息,无法推送年检过期提醒消息"); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setBusinessKey("年检到期"); | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setBusinessClassify("system"); | 
					 | 
					 | 
					 | 
					                // 查询用户
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setTaskId(carEntity.getId()); | 
					 | 
					 | 
					 | 
					                R<User> userRes = userClient.userInfoById(car.getManagerId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setSubject("年检到期通知"); | 
					 | 
					 | 
					 | 
					                User user = userRes.getData(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setContent("您所管理的车辆" + carEntity.getPlateNumber() + "年检已过期,请及时进行年检。"); | 
					 | 
					 | 
					 | 
					                // 推送消息
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setUserIds(String.valueOf(carEntity.getManagerId())); | 
					 | 
					 | 
					 | 
					                BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setCreateUser(carEntity.getCreateUser()); | 
					 | 
					 | 
					 | 
					                if (StringUtils.isNotEmpty(user.getDeptId())) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            businessMessageDTO.setTenantId(CommonConstant.TENANT_ID); | 
					 | 
					 | 
					 | 
					                    Long id = Long.valueOf(user.getDeptId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setDeptId(id); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setBusinessKey("年检到期"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setBusinessClassify("system"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setTaskId(car.getId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setSubject("年检即将到期提醒"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setContent("您所管理的车辆" + car.getPlateNumber() + "的年检即将过期,请及时进行年检。"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setUserIds(String.valueOf(car.getManagerId())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setCreateUser(car.getCreateUser()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    businessMessageDTO.setTenantId(CommonConstant.TENANT_ID); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                R<Boolean> res = messageClient.sendAppAndWsMsgByUsers(businessMessageDTO); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                if (!res.isSuccess()) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    return ReturnT.FAIL; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        messageClient.sendAppAndWsMsgByUsers(businessMessageDTO); | 
					 | 
					 | 
					 | 
					        return ReturnT.SUCCESS; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					 | 
					
  |