| | |
| | | import com.xiaopeng.api.model.account.XpOperationsUserNotification; |
| | | import com.xiaopeng.api.model.maintenance.*; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; |
| | | import com.xiaopeng.api.vo.automaticPilot.VehiclePosition; |
| | | import com.xiaopeng.common.core.constant.AliPushTypeConstant; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.enums.NotificationTypeEnum; |
| | |
| | | import org.redisson.api.RedissonClient; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | |
| | | private XpVehicleClient xpVehicleClient; |
| | | @Autowired |
| | | private XpTaskRuleMapper xpTaskRuleMapper; |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Autowired |
| | | private XpAliPushMessageClient xpAliPushMessageClient; |
| | | @Autowired |
| | |
| | | xpTask.setTaskTypeId(dto.getTaskTypeId()); |
| | | xpTask.setTaskUrgencyLevel(dto.getTaskUrgencyLevel()); |
| | | xpTask.setTaskDescription(dto.getTaskDescription()); |
| | | // todo 获取车辆当前位置 |
| | | // xpTask.setVehicleLocation(); |
| | | xpTask.setVehicleId(dto.getId()); |
| | | // xpTask.setVehicleLon(); |
| | | // xpTask.setVehicleLat(); |
| | | XpVehicle vehicle = xpVehicleClient.queryById(xpTask.getVehicleId()).getData(); |
| | | if (vehicle!=null){ |
| | | VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(vehicle.getVehicleVin())), VehiclePosition.class); |
| | | if (vehiclePosition != null) { |
| | | double x = vehiclePosition.getPoint().getX(); |
| | | double y = vehiclePosition.getPoint().getY(); |
| | | xpTask.setVehicleLon(new BigDecimal(x)); |
| | | xpTask.setVehicleLat(new BigDecimal(y)); |
| | | } |
| | | } |
| | | |
| | | xpTask.setVehicleId(dto.getId()); |
| | | xpTask.setReportUserId(xpOperationsUser.getId()); |
| | | xpTask.setReportTime(LocalDateTime.now()); |
| | | xpTask.setStatus(0); |
| | |
| | | R<List<XpOperationsUser>> xpOperationUserResult = xpOperationUserClient.listByIds(userIds); |
| | | List<XpOperationsUser> data = xpOperationUserResult.getData(); |
| | | if (CollUtil.isNotEmpty(data)) { |
| | | R<XpVehicle> xpVehicleR = xpVehicleClient.queryById(dto.getId()); |
| | | XpVehicle vehicle = xpVehicleR.getData(); |
| | | |
| | | String plateNumber = Objects.nonNull(vehicle) ? vehicle.getPlateNumber() : ""; |
| | | // 车辆${车牌号}在${车辆位置信息}发生了紧急事故,请在${到达现场限时}内到达现场!${APP链接} |
| | | String content = String.format("车辆%s在%s发生了紧急事故,请在%d分钟内到达现场!", plateNumber, xpTask.getVehicleLocation(), taskRule.getProcessingTimeLimit()); |
| | |
| | | |
| | | /** |
| | | * 推送阿里云通知 |
| | | * |
| | | * @param data |
| | | * @param content |
| | | * @param xpTask |
| | |
| | | taskManagementPageListVO.setTaskTypeName(""); |
| | | break; |
| | | } |
| | | }else{ |
| | | } else { |
| | | StringBuilder taskTypeName = new StringBuilder(); |
| | | String[] typeIds = taskManagementPageListVO.getTaskTypeId().split(","); |
| | | List<XpErrorType> xpErrorTypes = errorTypeMapper.selectList(new LambdaQueryWrapper<XpErrorType>() |
| | |
| | | task.setVehicleLat(dto.getVehicleLat()); |
| | | task.setReportUserId(reportUserId); |
| | | task.setReportTime(LocalDateTime.now()); |
| | | saveTask.add( task); |
| | | saveTask.add(task); |
| | | } |
| | | this.saveBatch(saveTask); |
| | | |
| | |
| | | } |
| | | XpTaskHandleDetail xpTaskHandleDetail = xpTaskHandleDetailMapper.selectOne(new LambdaQueryWrapper<XpTaskHandleDetail>() |
| | | .eq(XpTaskHandleDetail::getTaskId, id)); |
| | | if (xpTaskHandleDetail != null){ |
| | | if (xpTaskHandleDetail != null) { |
| | | res.setDeathCount(xpTaskHandleDetail.getDeathCount()); |
| | | res.setSevereCount(xpTaskHandleDetail.getSevereCount()); |
| | | res.setMinorCount(xpTaskHandleDetail.getMinorCount()); |