xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/SysLoginService.java
@@ -160,8 +160,6 @@ if (!operationsUser.getStatus()){ throw new ServiceException("账号已禁用!"); } // todo 查询运维人员角色集合 // todo 权限集合 // 用户名或密码为空 错误 if (StringUtils.isAnyBlank(phoneNumber, password)) { throw new ServiceException("用户/验证码必须填写"); xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/controller/XpTaskController.java
@@ -7,8 +7,10 @@ import com.xiaopeng.api.model.maintenance.XpErrorType; import com.xiaopeng.api.model.maintenance.XpTask; import com.xiaopeng.api.model.maintenance.XpTaskHandleDetailRoutine; import com.xiaopeng.api.model.order.XpCruiseOrder; import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; import com.xiaopeng.api.vo.account.LoginOperationUser; import com.xiaopeng.api.vo.automaticPilot.VehiclePosition; import com.xiaopeng.common.core.domain.R; import com.xiaopeng.common.core.web.page.PageInfo; import com.xiaopeng.common.security.service.TokenService; @@ -24,6 +26,10 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.geo.GeoJsonPoint; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; @@ -45,6 +51,8 @@ public class XpTaskController { @Resource private XpTaskService xpTaskService; @Resource private MongoTemplate mongoTemplate; @Resource private TokenService tokenService; @Resource @@ -74,21 +82,28 @@ @ApiOperation(value = "查询车辆不分页列表", tags = "运维APP-任务中心") @PostMapping("/api/v1/task/listVehicle") public R<List<VehicleListVO>> listVehicle() { LoginOperationUser loginOperationUser = tokenService.getLoginOperationUser(); XpOperationsUser xpOperationsUser = loginOperationUser.getXpOperationsUser(); // 查询当前人员所属车队 查询车队关联车辆 R<List<Long>> vehicleByUserId = xpFleetOperationsClient.getVehicleByUserId(xpOperationsUser.getId()); List<Long> vehicleIds = vehicleByUserId.getData(); if (vehicleIds != null && !vehicleIds.isEmpty()){ // todo 查询车辆列表 获取经纬度 List<XpVehicle> data = xpVehicleClient.listByIds(vehicleIds).getData(); if (data!=null){ List<VehicleListVO> vehicleListVOS = new ArrayList<>(); for (XpVehicle xpVehicle : data) { VehicleListVO vehicleListVO = new VehicleListVO(); vehicleListVO.setId(xpVehicle.getId()); // vehicleListVO.setVehicleLon(xpVehicle.getVehicleLon()); // vehicleListVO.setVehicleLat(xpVehicle.getVehicleLat()); VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(xpVehicle.getVehicleVin())), VehiclePosition.class); if(vehiclePosition!=null){ double x = vehiclePosition.getPoint().getX(); double y = vehiclePosition.getPoint().getY(); vehicleListVO.setVehicleLon(x+""); vehicleListVO.setVehicleLat(y+""); } vehicleListVO.setVehicleCode(xpVehicle.getVehicleCode()); vehicleListVO.setVehicleColor(xpVehicle.getVehicleColor()); vehicleListVO.setPlateNumber(xpVehicle.getPlateNumber()); xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/controller/XpTaskManagementController.java
@@ -3,6 +3,7 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.ExportParams; import com.xiaopeng.api.feignClient.account.XpOperationUserClient; import com.xiaopeng.api.feignClient.vehicleConvoy.XpFleetOperationsClient; import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; import com.xiaopeng.api.model.account.SysUser; @@ -35,6 +36,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Workbook; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -46,7 +48,9 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; /** * <p> @@ -67,6 +71,8 @@ private TokenService tokenService; @Resource private IXpErrorTypeService xpErrorTypeService; @Resource private XpOperationUserClient operationUserClient; @Resource private XpFleetOperationsClient xpFleetOperationsClient; @Resource @@ -95,7 +101,18 @@ xpTaskExportExcel.setTaskTypeName(task.getTaskTypeName()); xpTaskExportExcel.setTaskUrgencyLevel(task.getTaskUrgencyLevel()); xpTaskExportExcel.setTaskDescription(task.getTaskDescription()); xpTaskExportExcel.setHandleUserName(task.getHandleUserName()); if (StringUtils.hasLength(task.getHandleUserId())){ String[] split = task.getHandleUserId().split(","); List<XpOperationsUser> users = operationUserClient.listByIds(Arrays.stream(split).map(Long::parseLong).collect(Collectors.toList())).getData(); if (users!=null){ StringBuilder handleUserName = new StringBuilder(); for (XpOperationsUser user : users) { handleUserName.append(user.getNickName()).append(";"); } xpTaskExportExcel.setHandleUserName(handleUserName.toString()); } } xpTaskExportExcel.setNumber(num); xpTaskExportExcel.setStatus(task.getStatus()); LocalDateTime createTime = task.getCreateTime(); xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/model/vo/TaskManagementAccidentDetailVO.java
@@ -59,7 +59,12 @@ private String reportUserPhone; @ApiModelProperty(value = "上报人头像") private String reportUserAvatar; @ApiModelProperty(value = "上报人时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime createTime; @ApiModelProperty(value = "处理时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime handleTime; @ApiModelProperty(value = "处理id") private Long handleUserId; @ApiModelProperty(value = "处理名称") xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/model/vo/TaskManagementChargingDetailVO.java
@@ -36,6 +36,8 @@ private String vehicleVin; @ApiModelProperty(value = "车辆地址") private String vehicleLocation; @ApiModelProperty(value = "车辆图片") private String vehiclePictures; @ApiModelProperty(value = "任务编号") private String taskCode; @ApiModelProperty(value = "开始剩余电量") @@ -58,4 +60,5 @@ private Long endOperationsUserId; @ApiModelProperty(value = "结束充电操作人名称") private String endOperationsUserName; } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/model/vo/TaskManagementCleanDetailVO.java
@@ -36,7 +36,8 @@ private String vehicleVin; @ApiModelProperty(value = "车辆地址") private String vehicleLocation; @ApiModelProperty(value = "车辆图片") private String vehiclePictures; @ApiModelProperty(value = "任务编号") private String taskCode; @@ -46,5 +47,11 @@ private Long operationUserId; @ApiModelProperty(value = "操作人名称") private String operationsUserName; @ApiModelProperty(value = "上报人时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime createTime; @ApiModelProperty(value = "处理时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime handleTime; } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/model/vo/TaskManagementDetectionDetailVO.java
@@ -36,6 +36,8 @@ private String vehicleVin; @ApiModelProperty(value = "车辆地址") private String vehicleLocation; @ApiModelProperty(value = "车辆图片") private String vehiclePictures; @ApiModelProperty(value = "任务编号") private String taskCode; @@ -95,4 +97,10 @@ @ApiModelProperty(value = "检测时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime checkTime; @ApiModelProperty(value = "上报人时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime createTime; @ApiModelProperty(value = "处理时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime handleTime; } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/model/vo/TaskManagementPageListVO.java
@@ -39,7 +39,7 @@ @ApiModelProperty(value = "状态 0=待到达 1=待处理 2=已完成 3=已取消") private Integer status; @ApiModelProperty(value = "处理人id") private Integer handleUserId; private String handleUserId; @ApiModelProperty(value = "处理人名称") private String handleUserName; @ApiModelProperty(value = "任务描述") xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/model/vo/TaskManagementPreparationDetailVO.java
@@ -36,6 +36,8 @@ private String vehicleVin; @ApiModelProperty(value = "车辆地址") private String vehicleLocation; @ApiModelProperty(value = "车辆图片") private String vehiclePictures; @ApiModelProperty(value = "任务编号") private String taskCode; @ApiModelProperty(value = "左前轮") @@ -78,4 +80,5 @@ @ApiModelProperty(value = "操作时间") private LocalDateTime operationsTime; } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/model/vo/TaskManagementRepairDetailVO.java
@@ -37,7 +37,8 @@ private String vehicleVin; @ApiModelProperty(value = "车辆地址") private String vehicleLocation; @ApiModelProperty(value = "车辆图片") private String vehiclePictures; @ApiModelProperty(value = "任务编号") private String taskCode; @@ -76,4 +77,5 @@ @ApiModelProperty(value = "取回时间") private LocalDateTime returnTime; } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/model/vo/TaskManagementRoutineDetailVO.java
@@ -35,6 +35,8 @@ private String vehicleVin; @ApiModelProperty(value = "车辆地址") private String vehicleLocation; @ApiModelProperty(value = "车辆图片") private String vehiclePictures; @ApiModelProperty(value = "任务编号") private String taskCode; @ApiModelProperty(value = "完成任务情况描述") @@ -48,4 +50,8 @@ @ApiModelProperty(value = "处理时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime handleTime; @ApiModelProperty(value = "上报人时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime createTime; } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpTaskServiceImpl.java
@@ -18,6 +18,7 @@ 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; @@ -45,9 +46,15 @@ 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.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.LocalTime; @@ -70,6 +77,8 @@ private RedissonClient redissonClient; @Autowired private XpErrorTypeMapper errorTypeMapper; @Resource private XpOperationUserClient operationUserClient; @Autowired private XpTaskHandleDetailMapper xpTaskHandleDetailMapper; @@ -95,6 +104,8 @@ private XpVehicleClient xpVehicleClient; @Autowired private XpTaskRuleMapper xpTaskRuleMapper; @Autowired private MongoTemplate mongoTemplate; @Autowired private XpAliPushMessageClient xpAliPushMessageClient; @Autowired @@ -155,6 +166,7 @@ return pageInfo; } @Transactional(rollbackFor = Exception.class) @Override public void saveVehicleAccident(SaveVehicleAccidentDto dto, XpOperationsUser xpOperationsUser) { XpTask xpTask = new XpTask(); @@ -165,11 +177,18 @@ 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); @@ -184,19 +203,18 @@ List<Long> userIds = xpOperationsRoleResult.getData().stream().map(XpOperationsRole::getOperationsUserId).collect(Collectors.toList()); xpTask.setHandleUserId(StringUtils.join(userIds, ",")); } //查询事故处理限时配置 // 根据事故处理限时配置设置任务截止时间 LocalDateTime endTime = LocalDateTime.now().plusMinutes(taskRule.getProcessingTimeLimit()); xpTask.setEndTime(endTime); this.save(xpTask); //发送消息通知 // 发送消息通知 List<Long> userIds = Arrays.stream(xpTask.getHandleUserId().split(",")).map(Long::valueOf).collect(Collectors.toList()); if (CollUtil.isNotEmpty(userIds)) { 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()); @@ -221,6 +239,7 @@ /** * 推送阿里云通知 * * @param data * @param content * @param xpTask @@ -844,6 +863,17 @@ PageInfo<TaskManagementPageListVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); List<TaskManagementPageListVO> list = this.baseMapper.pageListManagement(pageInfo, query); for (TaskManagementPageListVO taskManagementPageListVO : list) { if (org.springframework.util.StringUtils.hasLength(taskManagementPageListVO.getHandleUserId())){ String[] split = taskManagementPageListVO.getHandleUserId().split(","); List<XpOperationsUser> users = operationUserClient.listByIds(Arrays.stream(split).map(Long::parseLong).collect(Collectors.toList())).getData(); if (users!=null){ StringBuilder handleUserName = new StringBuilder(); for (XpOperationsUser user : users) { handleUserName.append(user.getNickName()).append(";"); } taskManagementPageListVO.setHandleUserName(handleUserName.toString()); } } if (taskManagementPageListVO.getTaskCategory() == 1) { switch (taskManagementPageListVO.getTaskTypeId()) { case "1": @@ -877,7 +907,7 @@ taskManagementPageListVO.setTaskTypeName(""); break; } }else{ } else { StringBuilder taskTypeName = new StringBuilder(); String[] typeIds = taskManagementPageListVO.getTaskTypeId().split(","); List<XpErrorType> xpErrorTypes = errorTypeMapper.selectList(new LambdaQueryWrapper<XpErrorType>() @@ -943,6 +973,8 @@ task.setEndTime(LocalDateTime.now().plusMinutes(taskRule.getProcessingTimeLimit())); } task.setTaskCategory(2); // todo 临时处理 task.setHandleUserId("1"); task.setTaskTypeId(dto.getTaskTypeId()); task.setTaskUrgencyLevel(dto.getTaskUrgencyLevel()); task.setTaskDescription(dto.getTaskDescription()); @@ -953,7 +985,7 @@ task.setVehicleLat(dto.getVehicleLat()); task.setReportUserId(reportUserId); task.setReportTime(LocalDateTime.now()); saveTask.add( task); saveTask.add(task); } this.saveBatch(saveTask); @@ -992,6 +1024,7 @@ taskManagementDetectionDetailVO.setVehicleCode(vehicle.getVehicleCode()); taskManagementDetectionDetailVO.setVehicleVin(vehicle.getVehicleVin()); taskManagementDetectionDetailVO.setVehicleLocation(task.getVehicleLocation()); taskManagementDetectionDetailVO.setVehiclePictures(vehicle.getVehiclePictures()); taskManagementDetectionDetailVO.setTaskCode(task.getTaskCode()); XpVehicleDetection vehicleDetection = vehicleDetectionMapper.selectOne(new LambdaQueryWrapper<XpVehicleDetection>() .eq(XpVehicleDetection::getTaskId, id).last("limit 1")); @@ -1035,6 +1068,8 @@ taskManagementChargingDetailVO.setVehicleVin(vehicle.getVehicleVin()); taskManagementChargingDetailVO.setVehicleLocation(task.getVehicleLocation()); taskManagementChargingDetailVO.setTaskCode(task.getTaskCode()); taskManagementChargingDetailVO.setVehiclePictures(vehicle.getVehiclePictures()); XpChargingRecord chargingRecord = chargingRecordMapper.selectOne(new LambdaQueryWrapper<XpChargingRecord>() .eq(XpChargingRecord::getTaskId, id).last("limit 1")); if (chargingRecord != null) { @@ -1074,6 +1109,8 @@ taskManagementPreparationDetailVO.setVehicleVin(vehicle.getVehicleVin()); taskManagementPreparationDetailVO.setVehicleLocation(task.getVehicleLocation()); taskManagementPreparationDetailVO.setTaskCode(task.getTaskCode()); taskManagementPreparationDetailVO.setVehiclePictures(vehicle.getVehiclePictures()); XpVehiclePreparation vehiclePreparation = vehiclePreparationMapper.selectOne(new LambdaQueryWrapper<XpVehiclePreparation>() .eq(XpVehiclePreparation::getTaskId, id).last("limit 1")); if (vehiclePreparation != null) { @@ -1113,6 +1150,8 @@ taskManagementCleanDetailVO.setVehicleVin(vehicle.getVehicleVin()); taskManagementCleanDetailVO.setVehicleLocation(task.getVehicleLocation()); taskManagementCleanDetailVO.setTaskCode(task.getTaskCode()); taskManagementCleanDetailVO.setVehiclePictures(vehicle.getVehiclePictures()); XpVehicleClean vehicleClean = vehicleCleanMapper.selectOne(new LambdaQueryWrapper<XpVehicleClean>() .eq(XpVehicleClean::getTaskId, id).last("limit 1")); if (vehicleClean != null) { @@ -1140,6 +1179,8 @@ taskManagementRepairDetailVO.setVehicleVin(vehicle.getVehicleVin()); taskManagementRepairDetailVO.setVehicleLocation(task.getVehicleLocation()); taskManagementRepairDetailVO.setTaskCode(task.getTaskCode()); taskManagementRepairDetailVO.setVehiclePictures(vehicle.getVehiclePictures()); XpVehicleRepair vehicleRepair = vehicleRepairMapper.selectOne(new LambdaQueryWrapper<XpVehicleRepair>() .eq(XpVehicleRepair::getTaskId, id).last("limit 1")); if (vehicleRepair != null) { @@ -1180,6 +1221,7 @@ res.setVehicleLocation(task.getVehicleLocation()); res.setVehicleVin(vehicle.getVehicleVin()); res.setTaskCode(task.getTaskCode()); res.setVehiclePictures(vehicle.getVehiclePictures()); XpTaskHandleDetailRoutine xpTaskHandleDetailRoutine = xpTaskHandleDetailRoutineMapper.selectOne(new LambdaQueryWrapper<XpTaskHandleDetailRoutine>() .eq(XpTaskHandleDetailRoutine::getTaskId, id)); if (xpTaskHandleDetailRoutine != null) { @@ -1218,6 +1260,8 @@ for (XpErrorType xpErrorType : xpErrorTypes) { xpErrorType.setChild(errorType.get(xpErrorType.getId())); } res.setCreateTime(task.getCreateTime()); res.setHandleTime(task.getHandleTime()); res.setErrorTypeList(xpErrorTypes); res.setStatus(task.getStatus()); res.setTaskDescription(task.getTaskDescription()); @@ -1251,7 +1295,7 @@ } 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()); xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpElectronicFenceAreaController.java
@@ -34,7 +34,7 @@ * @return 区域信息 */ @ApiOperation(value = "根据区域ID查询区域信息", notes = "根据区域ID查询区域信息", tags = {"内部接口"}) @PostMapping("/inner/v1/xp-electronic-fence-area/queryById/queryById") @PostMapping("/inner/v1/xp-electronic-fence-area/queryById") public R<XpElectronicFenceArea> queryById(@RequestParam("id") Long id) { return R.ok(xpElectronicFenceAreaService.getById(id)); }