Merge branch '1.0' of http://120.76.84.145:10101/gitblit/r/java/Robotaxi into 1.0
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("/logan/inner/group/getPhoneDesensitization") |
| | | public R<String> getPhoneDesensitization(@RequestParam String phoneNumber) { |
| | | return R.ok(sysGroupService.getPhoneDesensitization(phoneNumber)); |
| | |
| | | import com.xiaopeng.account.model.query.SysUserListQuery; |
| | | import com.xiaopeng.account.service.*; |
| | | import com.xiaopeng.api.model.account.*; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.enums.DisabledEnum; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | |
| | | @GetMapping("/api/v1/sys-user/pageList") |
| | | @ApiOperation(value = "账号管理分页列表", tags = {"管理后台-账号管理"}) |
| | | public AjaxResult<PageInfo<SysUser>> list(final SysUserListQuery sysUserListQuery) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | PageInfo<SysUser> pageInfo = new PageInfo<SysUser>(sysUserListQuery.getPageNum(), sysUserListQuery.getPageSize()); |
| | | PageInfo<SysUser> page = userService.getList(pageInfo, sysUserListQuery); |
| | | page.getRecords().forEach(user -> { |
| | | user.setPhoneNumber(sysGroupService.getPhoneDesensitization(user.getPhoneNumber())); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | user.setPhoneNumber(DesensitizedUtil.mobilePhone(user.getPhoneNumber())); |
| | | // user.setUserAccount(sysGroupService.getPhoneDesensitization(user.getUserAccount())); |
| | | } |
| | | }); |
| | | return AjaxResult.success(page); |
| | | } |
| | |
| | | @GetMapping("/api/v1/sys-user/listAll") |
| | | @ApiOperation(value = "账号管理不分页列表", tags = {"管理后台-账号管理"}) |
| | | public R<List<SysUser>> listAll() { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | List<SysUser> listAll = userService.list(); |
| | | listAll.forEach(user -> user.setPhoneNumber(sysGroupService.getPhoneDesensitization(user.getPhoneNumber()))); |
| | | for (SysUser sysUser : listAll) { |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | sysUser.setPhoneNumber(DesensitizedUtil.mobilePhone(sysUser.getPhoneNumber())); |
| | | } |
| | | } |
| | | return R.ok(listAll); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "获取用户详情", tags = {"管理后台-系统用户管理"}) |
| | | @GetMapping("/api/v1/getInfo/{userId}") |
| | | public AjaxResult getInfo(@PathVariable Long userId) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | userService.checkUserDataScope(userId); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | List<SysRole> roles = sysRoleService.list(); |
| | |
| | | ajax.put("posts", postService.selectPostAll()); |
| | | if (StringUtils.isNotNull(userId)) { |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | sysUser.setPhoneNumber(sysGroupService.getPhoneDesensitization(sysUser.getPhoneNumber())); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | sysUser.setPhoneNumber(DesensitizedUtil.mobilePhone(sysUser.getPhoneNumber())); |
| | | } |
| | | ajax.put(AjaxResult.DATA_TAG, sysUser); |
| | | ajax.put("postIds", postService.selectPostListByUserId(userId)); |
| | | // ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getId).collect(Collectors.toList())); |
| | |
| | | package com.xiaopeng.account.controller; |
| | | |
| | | import com.xiaopeng.account.constant.I18nKeyConstant; |
| | | import com.xiaopeng.account.service.ISysGroupService; |
| | | import com.xiaopeng.account.service.ISysUserService; |
| | | import com.xiaopeng.account.service.IXpOperationsUserService; |
| | | import com.xiaopeng.account.service.impl.SysLoginService; |
| | |
| | | private IXpOperationsUserService xpOperationsUserService; |
| | | |
| | | @Autowired |
| | | private ISysGroupService sysGroupService; |
| | | |
| | | @Autowired |
| | | private RedisService redisService; |
| | | |
| | | @Resource |
| | |
| | | public R<?> login(@RequestBody LoginBody form, HttpServletRequest request) { |
| | | // 用户登录 |
| | | LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(), request); |
| | | boolean phoneDesensitization = sysGroupService.getPhoneDesensitization(); |
| | | userInfo.setPhoneDesensitization(phoneDesensitization); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("token", tokenService.createToken(userInfo)); |
| | | List<SysRole> roles = userInfo.getSysUser().getRoles(); |
| | |
| | | package com.xiaopeng.account.controller; |
| | | |
| | | |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.xiaopeng.account.constant.I18nKeyConstant; |
| | |
| | | import com.xiaopeng.api.model.account.XpQualificationAudit; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpFleet; |
| | | import com.xiaopeng.api.query.account.OptionalUsersPageListQuery; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.api.vo.account.XpOperationsUserProfileVO; |
| | | import com.xiaopeng.api.vo.account.XpOperationsUserVO; |
| | | import com.xiaopeng.api.vo.account.XpOperationsUserWithRoleVO; |
| | |
| | | @ApiOperation(value = "运维人员管理分页列表", tags = {"管理后台-运维执行"}) |
| | | @PostMapping("/api/v1/operationsUser/pageList") |
| | | public R<PageInfo<XpOperationsUserVO>> pageList(@RequestBody XpOperationsUserQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | PageInfo<XpOperationsUserVO> pageList = xpOperationsUserService.pageList(query); |
| | | pageList.getRecords().forEach(s->s.setPhoneNumber(groupMenuClient.getPhoneDesensitization(s.getPhoneNumber()).getData())); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | for (XpOperationsUserVO record : pageList.getRecords()) { |
| | | record.setPhoneNumber(DesensitizedUtil.mobilePhone(record.getPhoneNumber())); |
| | | } |
| | | } |
| | | return R.ok(pageList); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "运维人员管理详情", tags = {"管理后台-运维执行"}) |
| | | @GetMapping("/api/v1/operationsUser/detailById") |
| | | public R<XpOperationsUserVO> detailById(@RequestParam Long id) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | XpOperationsUserVO xpOperationsUserVO = xpOperationsUserService.detailById(id); |
| | | if (xpOperationsUserVO.getAvatar() != null) { |
| | | JSONObject jsonObject = JSONObject.parseObject(xpOperationsUserVO.getAvatar()); |
| | |
| | | xpOperationsUserVO.setCertificateOfNoCriminalRecord(jsonObject.toJSONString()); |
| | | } |
| | | } |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | xpOperationsUserVO.setPhoneNumber(DesensitizedUtil.mobilePhone(xpOperationsUserVO.getPhoneNumber())); |
| | | } |
| | | |
| | | xpOperationsUserVO.setPhoneNumber(groupMenuClient.getPhoneDesensitization(xpOperationsUserVO.getPhoneNumber()).getData()); |
| | | return R.ok(xpOperationsUserVO); |
| | | } |
| | | |
| | |
| | | package com.xiaopeng.account.service.impl; |
| | | |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xiaopeng.account.constant.I18nKeyConstant; |
| | |
| | | import com.xiaopeng.account.service.ISysUserService; |
| | | import com.xiaopeng.api.model.account.SysUser; |
| | | import com.xiaopeng.api.model.account.SysUserRole; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.common.core.constant.UserConstants; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.utils.StringUtils; |
| | |
| | | |
| | | @Override |
| | | public PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, SysUserListQuery sysUserListQuery) { |
| | | PageInfo<SysUser> page = userMapper.getList(pageInfo, sysUserListQuery); |
| | | for (SysUser user : page.getRecords()) { |
| | | user.setPhoneNumber(sysGroupService.getPhoneDesensitization(user.getPhoneNumber())); |
| | | } |
| | | PageInfo<SysUser> page = userMapper.getList(pageInfo, sysUserListQuery); |
| | | return page; |
| | | } |
| | | |
| | |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import cn.hutool.core.util.PhoneUtil; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.utils.poi.ExcelUtil; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.common.security.utils.SecurityUtils; |
| | | import com.xiaopeng.evi.oss.service.AliOssService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.Serializable; |
| | | import java.io.UnsupportedEncodingException; |
| | |
| | | private AliOssDownloadUtil aliOssDownloadUtil; |
| | | @Autowired |
| | | private ISysGroupService sysGroupService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Override |
| | | public XpOperationsUser getById(Serializable userId){ |
| | | XpOperationsUser user = baseMapper.selectById(userId); |
| | | //获取登录用户权限信息 |
| | | user.setPhoneNumber(sysGroupService.getPhoneDesensitization(user.getPhoneNumber())); |
| | | return user; |
| | | } |
| | | |
| | |
| | | } |
| | | List<XpOperationsUser> list = lambdaQuery().like(XpOperationsUser::getNickName, nickName).list(); |
| | | for (XpOperationsUser obj : list) { |
| | | obj.setPhoneNumber(sysGroupService.getPhoneDesensitization(obj.getPhoneNumber())); |
| | | obj.setPhoneNumber(DesensitizedUtil.mobilePhone(obj.getPhoneNumber())); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<XpOperationsUserWithRoleVO> selectUserPageByConditions(XpOperationsUserPageQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | PageInfo<XpOperationsUserWithRoleVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | Page<XpOperationsUserWithRoleVO> page = baseMapper.selectUserPageByConditions(pageInfo, query); |
| | | for (XpOperationsUserWithRoleVO record : page.getRecords()) { |
| | | record.setPhoneNumber(sysGroupService.getPhoneDesensitization(record.getPhoneNumber())); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | for (XpOperationsUserWithRoleVO record : page.getRecords()) { |
| | | record.setPhoneNumber(DesensitizedUtil.mobilePhone(record.getPhoneNumber())); |
| | | } |
| | | } |
| | | pageInfo.setRecords(page.getRecords()); |
| | | return pageInfo; |
| | |
| | | |
| | | XpOperationsUserProfileVO vo = new XpOperationsUserProfileVO(); |
| | | BeanUtils.copyProperties(user, vo); |
| | | vo.setPhoneNumber(sysGroupService.getPhoneDesensitization(vo.getPhoneNumber())); |
| | | vo.setAvatar(aliOssDownloadUtil.getPictureJSONObject(vo.getAvatar())); |
| | | // 2. 查询关联的车队ID列表(一个运维人员只能关联一个车队) |
| | | R<List<Long>> fleetIdsResult = xpFleetOperationsClient.getFleetIdsByUserId(userId); |
| | |
| | | |
| | | @Override |
| | | public PageInfo<XpOperationsUserVO> pageList(XpOperationsUserQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | PageInfo<XpOperationsUserVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<XpOperationsUserVO> list = this.baseMapper.pageList(pageInfo, query); |
| | | |
| | |
| | | } |
| | | |
| | | for (XpOperationsUserVO xpOperationsUserVO : list) { |
| | | xpOperationsUserVO.setPhoneNumber(sysGroupService.getPhoneDesensitization(xpOperationsUserVO.getPhoneNumber())); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | xpOperationsUserVO.setPhoneNumber(DesensitizedUtil.mobilePhone(xpOperationsUserVO.getPhoneNumber())); |
| | | } |
| | | |
| | | String avatar = xpOperationsUserVO.getAvatar(); |
| | | // 处理空的情况 |
| | | if (avatar == null) { |
| | |
| | | package com.xiaopeng.account.service.impl; |
| | | |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.xiaopeng.api.model.account.SysRole; |
| | | import com.xiaopeng.api.model.account.XpOperationsRole; |
| | | import com.xiaopeng.api.model.account.XpQualificationAudit; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.api.vo.account.XpQualificationAuditVO; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.evi.oss.service.AliOssService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashMap; |
| | |
| | | private AliOssService aliOssService; |
| | | @Autowired |
| | | private ISysGroupService sysGroupService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Override |
| | | public PageInfo<XpQualificationAuditVO> pageList(XpQualificationAuditQuery query) throws UnsupportedEncodingException { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | PageInfo<XpQualificationAuditVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<XpQualificationAuditVO> list = this.baseMapper.pageList(pageInfo, query); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | |
| | | |
| | | |
| | | for (XpQualificationAuditVO xpQualificationAuditVO : list) { |
| | | xpQualificationAuditVO.setPhoneNumber(sysGroupService.getPhoneDesensitization(xpQualificationAuditVO.getPhoneNumber())); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | xpQualificationAuditVO.setPhoneNumber(DesensitizedUtil.mobilePhone(xpQualificationAuditVO.getPhoneNumber())); |
| | | } |
| | | String certificateOfNoCriminalRecord = xpQualificationAuditVO.getCertificateOfNoCriminalRecord(); |
| | | if (certificateOfNoCriminalRecord != null) { |
| | | JSONObject jsonObject = JSONObject.parseObject(certificateOfNoCriminalRecord); |
| | |
| | | * 用户类型(系统用户,小程序用户) |
| | | */ |
| | | private String userType; |
| | | |
| | | /** |
| | | * 数据脱敏权限 |
| | | */ |
| | | private Boolean phoneDesensitization; |
| | | } |
| | |
| | | if(StringUtils.isNotEmpty(code)){ |
| | | xpOrder = xpOrderClient.queryOrderByOrderNo(code).getData(); |
| | | } |
| | | |
| | | //保存车辆实时信息到mongodb |
| | | VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(xpVehicle.getVehicleVin())), VehiclePosition.class); |
| | | if (null == vehiclePosition) { |
| | | log.info("【模拟接单】MongoDB无车辆位置记录,新建,vin={}", xpVehicle.getVehicleVin()); |
| | | vehiclePosition = new VehiclePosition(); |
| | | vehiclePosition.setVin(xpVehicle.getVehicleVin()); |
| | | vehiclePosition.setPoint(new GeoJsonPoint(startLon, startLat)); |
| | | vehiclePosition.setCourse(60D); |
| | | vehiclePosition.setAlt(100F); |
| | | vehiclePosition.setSpeed(50F); |
| | | vehiclePosition.setCurrentElectricity(80); |
| | | vehiclePosition.setMileageRange(300f); |
| | | vehiclePosition.setHasOrder(0); |
| | | vehiclePosition.setOrderId(orderId); |
| | | vehiclePosition.setTotalOdometer(10000L); |
| | | vehiclePosition.setAddTime(System.currentTimeMillis()); |
| | | mongoTemplate.save(vehiclePosition); |
| | | }else{ |
| | | log.info("【模拟接单】更新MongoDB车辆位置记录,vin={}", xpVehicle.getVehicleVin()); |
| | | vehiclePosition.setOrderId(orderId); |
| | | Update update = new Update() |
| | | .set("point", new GeoJsonPoint(startLon, startLat)) |
| | | .set("course", 60D) |
| | | .set("alt", 100F) |
| | | .set("speed", 50F) |
| | | .set("currentElectricity", 80) |
| | | .set("mileageRange", 300f) |
| | | .set("hasOrder", 0) |
| | | .set("orderId", orderId) |
| | | .set("totalOdometer", 10000L) |
| | | .set("addTime", System.currentTimeMillis()); |
| | | mongoTemplate.updateFirst(new Query(Criteria.where("vin").is(xpVehicle.getVehicleVin())), update, VehiclePosition.class); |
| | | } |
| | | |
| | | orderId = xpOrder.getId(); |
| | | OrderRouteAndFareDto dto = new OrderRouteAndFareDto(); |
| | | dto.setOrderId(orderId); |
| | |
| | | * 登录运维人员 |
| | | */ |
| | | public static final String LOGIN_OPERATION_USER = "login_oeeration_user"; |
| | | |
| | | /** |
| | | * 脱敏权限 |
| | | */ |
| | | public static final String DESENSITIZATION = "desensitization"; |
| | | } |
| | |
| | | loginUser.setUsername(userName); |
| | | loginUser.setIpaddr(IpUtils.getIpAddr()); |
| | | refreshToken(loginUser); |
| | | |
| | | // Jwt存储信息 |
| | | Map<String, Object> claimsMap = new HashMap<String, Object>(); |
| | | claimsMap.put(SecurityConstants.USER_KEY, token); |
| | | claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId); |
| | | claimsMap.put(SecurityConstants.USER_TYPE, "system"); |
| | | claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName); |
| | | claimsMap.put(SecurityConstants.DESENSITIZATION, loginUser.getPhoneDesensitization()); |
| | | // 接口返回信息 |
| | | Map<String, Object> rspMap = new HashMap<String, Object>(); |
| | | rspMap.put("access_token", JwtUtils.createToken(claimsMap)); |
| | |
| | | |
| | | @Override |
| | | public List<RouteAndFareVo> getRouteAndFare(RouteAndFareDto routeAndFareDto, String userId) { |
| | | // // 判断是否5分钟内进行了查询 相同站点的起始点 并且是同时段 |
| | | // String key = "xp-map-query-" + routeAndFareDto.getOpenCityId() |
| | | // + "-" + routeAndFareDto.getOrigin().getLongitude() + "-" + routeAndFareDto.getOrigin().getLatitude() |
| | | // + "-" + routeAndFareDto.getDestination().getLongitude() + "-" + routeAndFareDto.getDestination().getLatitude() + "-" + getCurrentTimeSlot() + "-" + userId+routeAndFareDto.getUserCouponId(); |
| | | // |
| | | // if (redisService.hasKey(key)) { |
| | | // String jsonStr = Objects.requireNonNull(redisService.getCacheObject(key)).toString(); |
| | | // RouteAndFareVo RouteAndFareVo = JSONObject.parseObject(jsonStr, RouteAndFareVo.class); |
| | | // return (RouteAndFareVo); |
| | | // } |
| | | ArrayList<RouteAndFareVo> routeAndFareVos = new ArrayList<>(3); |
| | | |
| | | // 1. 基础数据查询 |
| | |
| | | xpPricingCardVo = xpPricingUtil.calculationPrice(userId, |
| | | JSON.parseObject(xpPricing.getBasicPricingJson()), |
| | | JSON.parseArray(xpPricing.getStartingFareJson()), |
| | | routeVo.getDistance(), routeVo.getDuration(), 0, 0.0, xpPricing.getIsDynamicPrice(), routeAndFareDto.getOpenCityId(), xpPricing.getDynamicPricingJson() |
| | | routeVo.getDistance(), routeVo.getDuration(), 0, 0.0, xpPricing.getIsDynamicPrice(), |
| | | routeAndFareDto.getOpenCityId(), xpPricing.getDynamicPricingJson() |
| | | ); |
| | | } else { |
| | | xpPricingCardVo = xpPricingUtil.calculationFixedPrice(userId, |
| | |
| | | RouteAndFareDto copy = new RouteAndFareDto(); |
| | | copy.setOrigin(routeAndFareDto.getOrigin()); |
| | | copy.setDestination(routeAndFareDto.getDestination()); |
| | | copy.setOpenCityId(routeAndFareDto.getOpenCityId()); |
| | | copy.setUserCouponId(routeAndFareDto.getUserCouponId()); |
| | | copy.setVehicleId(routeAndFareDto.getVehicleId()); |
| | | copy.setRoutePlanRule(kind.getAmapStrategy()); |
| | | R<RouteVo> r = xpMapClient.getDistanceAndDuration(copy); |
| | | if (r.getCode() != 200 || r.getData() == null || r.getData().getRouteID() == null) { |
| | |
| | | * 用户偏好策略优先请求,其余策略仍请求以便合并去重。 |
| | | */ |
| | | private StrategyPlanningConfig buildStrategyKindsForPlanning(String userId, Long openCityId) { |
| | | Set<String> enabled = parseEnabledPreferenceCodes(); |
| | | List<XpRoutePlan> xpRoutePlans = xpRoutePlanMapper.selectList(new LambdaQueryWrapper<XpRoutePlan>().eq(XpRoutePlan::getOpenCityId, openCityId)); |
| | | Map<RouteStrategyKind, String> displayNames = new LinkedHashMap<>(); |
| | | List<RouteStrategyKind> configuredKinds = new ArrayList<>(); |
| | | if (xpRoutePlans.isEmpty()) { |
| | | configuredKinds.addAll(RouteStrategyKind.defaultPreferenceKinds()); |
| | | throw new ServiceException("未配置有效的导航策略", I18nKeyConstant.PATH_NOT_FOUND); |
| | | } else { |
| | | for (XpRoutePlan xpRoutePlan : xpRoutePlans) { |
| | | Integer strategy = xpRoutePlan.getRoutePlanRule(); |
| | |
| | | }); |
| | | } |
| | | } |
| | | List<RouteStrategyKind> all = new ArrayList<>(); |
| | | for (RouteStrategyKind k : configuredKinds) { |
| | | if (enabled.contains(k.name())) { |
| | | addIfAbsent(all, k); |
| | | } |
| | | } |
| | | if (all.isEmpty()) { |
| | | all.add(resolveDefaultEnabledKind(enabled)); |
| | | } |
| | | Optional<RouteStrategyKind> pref = resolveUserPreferredKind(userId); |
| | | if (!pref.isPresent()) { |
| | | return new StrategyPlanningConfig(all, displayNames); |
| | | } |
| | | RouteStrategyKind p = pref.get(); |
| | | if (!all.contains(p)) { |
| | | return new StrategyPlanningConfig(all, displayNames); |
| | | } |
| | | List<RouteStrategyKind> ordered = new ArrayList<>(); |
| | | ordered.add(p); |
| | | for (RouteStrategyKind k : all) { |
| | | if (k != p) { |
| | | ordered.add(k); |
| | | } |
| | | } |
| | | return new StrategyPlanningConfig(ordered, displayNames); |
| | | return new StrategyPlanningConfig(configuredKinds, displayNames); |
| | | } |
| | | |
| | | private String resolveStrategyDisplayName(RouteStrategyKind kind, Map<RouteStrategyKind, String> displayNames) { |
| | |
| | | /** |
| | | * 计算一口价 |
| | | */ |
| | | public XpPricingCardVo calculationFixedPrice(String uid, JSONObject rule, JSONArray startingFareJson, double distance, long duration, long wait, Double waitMoney, Integer isDynamicPriceStatus, Long openCityId, String dynamicPricingJson) { |
| | | public XpPricingCardVo calculationFixedPrice(String uid, JSONObject rule, JSONArray startingFareJson, double distance, long duration, long wait, Double waitMoney, |
| | | Integer isDynamicPriceStatus, Long openCityId, String dynamicPricingJson) { |
| | | // 默认费率1 |
| | | double priceRate=1; |
| | | if(isDynamicPriceStatus==1){ |
| | |
| | | // 当前费率+(费率*上升百分比) |
| | | priceRate = new BigDecimal(priceRate).multiply(divide).add(new BigDecimal(priceRate)).setScale(2, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | //天气动态调价 |
| | | JSONArray ws = jsonObject.getJSONArray("weather"); |
| | | if(null != ws){ |
| | | XpOpenCity openCity = openCityClient.getXpOpenCityById(openCityId).getData(); |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public XpPricingCardVo calculationPrice(String uid,JSONObject rule, JSONArray startingFareJson, double distance, long duration, long wait, Double waitMoney,Integer isDynamicPriceStatus,Long openCityId,String dynamicPricingJson) { |
| | | |
| | | |
| | | public XpPricingCardVo calculationPrice(String uid,JSONObject rule, JSONArray startingFareJson, double distance, long duration, |
| | | long wait, Double waitMoney,Integer isDynamicPriceStatus,Long openCityId,String dynamicPricingJson) { |
| | | // 默认费率1 |
| | | double priceRate=1; |
| | | if(isDynamicPriceStatus==1){ |
| | |
| | | priceRate = new BigDecimal(priceRate).multiply(divide).add(new BigDecimal(priceRate)).setScale(2, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | // 天气预报动态调价 |
| | | JSONArray ws = jsonObject.getJSONArray("weather"); |
| | | if (null != ws) { |
| | | XpOpenCity openCity = openCityClient.getXpOpenCityById(openCityId).getData(); |
| | | WeatherDTO data = xpMapClient.wether(openCity.getCityCode()).getData(); |
| | | List<WeatherDTO.Lives> lives = data.getLives(); |
| | | if (lives != null && !lives.isEmpty()) { |
| | | String w = lives.get(0).getWeather(); |
| | | for (Object o : ws) { |
| | | JSONObject ele = JSONObject.parseObject(o.toString()); |
| | | if (w.contains(ele.getString("weatherType"))) { |
| | | double floatRate = jsonObject.getDouble("ratio"); |
| | | priceRate = new BigDecimal(priceRate).add(new BigDecimal(floatRate)).doubleValue(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 冷却时间 |
| | | Integer time = getOrderNum(jsonObject, 6); |
| | | |
| | | |
| | | |
| | | // 触发调价了 |
| | | redisService.setCacheObject("USER_DYNAMIC_PRICE_" + openCityId + "_" + uid, priceRate,time.longValue(), TimeUnit.MINUTES); |
| | |
| | | private BigDecimal lat; |
| | | @ApiModelProperty("地址") |
| | | private String address; |
| | | @ApiModelProperty("打开范围") |
| | | private BigDecimal openRange; |
| | | } |
| | |
| | | vo.setLon(xpCheckLocation.getLocationLon()); |
| | | vo.setLat(xpCheckLocation.getLocationLat()); |
| | | vo.setAddress(xpCheckLocation.getLocationAddress()); |
| | | vo.setOpenRange(xpCheckLocation.getLocationRange()); |
| | | appXpCruiseCheckInLocationVos.add(vo); |
| | | } |
| | | return appXpCruiseCheckInLocationVos; |
| | |
| | | vo.setIsInRange(true); |
| | | vo.setMessageType(2); |
| | | vo.setCheckLocationId(cruiseCheckInRuleLocation.getCheckLocationId()); |
| | | // Boolean read = redisService.getCacheObject("CHECK_IN_SCOPE:" + xpCheckLocation.getId()); |
| | | // if(null == read || !read){ |
| | | // vo.setMessageType(2); |
| | | // vo.setCheckLocationId(cruiseCheckInRuleLocation.getCheckLocationId()); |
| | | // redisService.setCacheObject("CHECK_IN_SCOPE:" + xpCheckLocation.getId(), true, 1L, TimeUnit.HOURS); |
| | | // } |
| | | return vo; |
| | | } |
| | | //判断时间小于10分钟首次触发和小于3分钟再次触发 |
| | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DatePattern; |
| | | import cn.hutool.core.date.LocalDateTimeUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | disableCount++; |
| | | } |
| | | } |
| | | |
| | | List<XpStation> listByElectronicId = xpStationService.findListByElectronicId(dto.getId()); |
| | | if(CollUtil.isNotEmpty(listByElectronicId)){ |
| | | |
| | | for (XpStation bean : listByElectronicId) { |
| | | if (StrUtil.isBlank(bean.getEffectiveTimePeriod())) { |
| | | continue; |
| | | } |
| | | List<OperationStrategyIndex.TimeInterval> pointIntervals = OperationStrategyIndex.parsePointEffectiveTimePeriod(bean.getEffectiveTimePeriod()); |
| | | if (pointIntervals.isEmpty()) { |
| | | continue; |
| | | } |
| | | |
| | | boolean shouldDisable = !newIndex.isPointScheduleWithin(pointIntervals); |
| | | if (shouldDisable) { |
| | | disableCount++; |
| | | } |
| | | } |
| | | } |
| | | return R.ok(disableCount); |
| | | } |
| | | |
| | |
| | | public interface XpStationService extends IService<XpStation> { |
| | | |
| | | |
| | | List<XpStation> findListByElectronicId(Long electronicId); |
| | | |
| | | List<XpStation> findList(XpStationQuery query); |
| | | |
| | | List<XpStation> findList(PageInfo<XpStation> pageInfo, XpStationQuery query); |
| | |
| | | */ |
| | | public boolean getPointOperation(LocalTime localTime, XpPoint xpPoint){ |
| | | if(xpPoint.getOperationStatus() == 2 && xpPoint.getVerificationStatus() == 5){ |
| | | if(xpPoint.getOperationType()==2){//运营类型 1=与运营区同步 2=自定义时间段 |
| | | return getPointOperation(localTime,xpPoint.getEffectivePeriod(),xpPoint.getEffectiveTimePeriod()); |
| | | }else { |
| | | if (xpPoint.getStationId() == null) {//调用围栏运营策略 |
| | | return getFenceOperation(localTime, xpPoint.getFenceOperationStrategy()); |
| | | } else { |
| | | return this.getStationOperation(localTime, xpPoint.getStationOperationType(), xpPoint.getStationEffectivePeriod(), xpPoint.getStationEffectiveTimePeriod(), xpPoint.getFenceOperationStrategy()); |
| | | if(xpPoint.getOperationType() != null){ |
| | | if(xpPoint.getOperationType()==2){//运营类型 1=与运营区同步 2=自定义时间段 |
| | | return getPointOperation(localTime,xpPoint.getEffectivePeriod(),xpPoint.getEffectiveTimePeriod()); |
| | | }else { |
| | | if (xpPoint.getStationId() == null) {//调用围栏运营策略 |
| | | return getFenceOperation(localTime, xpPoint.getFenceOperationStrategy()); |
| | | } else { |
| | | return this.getStationOperation(localTime, xpPoint.getStationOperationType(), xpPoint.getStationEffectivePeriod(), xpPoint.getStationEffectiveTimePeriod(), xpPoint.getFenceOperationStrategy()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | //根据经纬度获取当前城市code |
| | | // XpElectronicFenceArea xpElectronicFenceArea = dto.getElectronicFenceAreas().get(0); |
| | | // String[] split = xpElectronicFenceArea.getFencePoints().split(","); |
| | | // Coordinate[] coordinates = new Coordinate[split.length + 1]; |
| | | // for (int i = 0; i < split.length; i++) { |
| | | // String[] split1 = split[i].split("_"); |
| | | // coordinates[i] = new Coordinate(Double.parseDouble(split1[0]), Double.parseDouble(split1[1])); |
| | | // } |
| | | // org.locationtech.jts.geom.Point point = calculateCentroid(coordinates); |
| | | // Map<String, String> geocode = gdMapGeocodingUtil.geocode(point.getX() + "", point.getY() + ""); |
| | | // if (null == geocode) { |
| | | // return R.fail("经纬度转换城市code失败"); |
| | | // } |
| | | // String cityCode = geocode.get("cityCode"); |
| | | // dto.setCityCode(cityCode); |
| | | XpElectronicFenceArea xpElectronicFenceArea = dto.getElectronicFenceAreas().get(0); |
| | | String[] split = xpElectronicFenceArea.getFencePoints().split(","); |
| | | Coordinate[] coordinates = new Coordinate[split.length + 1]; |
| | | for (int i = 0; i < split.length; i++) { |
| | | String[] split1 = split[i].split("_"); |
| | | coordinates[i] = new Coordinate(Double.parseDouble(split1[0]), Double.parseDouble(split1[1])); |
| | | } |
| | | org.locationtech.jts.geom.Point point = calculateCentroid(coordinates); |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(point.getX() + "", point.getY() + ""); |
| | | if (null == geocode) { |
| | | return R.fail("经纬度转换城市code失败"); |
| | | } |
| | | String cityCode = geocode.get("cityCode"); |
| | | dto.setCityCode(cityCode); |
| | | |
| | | xpElectronicFence.setCityCode(dto.getCityCode()); |
| | | |
| | |
| | | QuartzManager.removeJob((ElectronicEffectJob.effect + xpElectronicFence.getId()).toUpperCase(), TimeJobType.ELECTRONIC_EFFECT); |
| | | QuartzManager.removeJob((ElectronicEffectJob.failure + xpElectronicFence.getId()).toUpperCase(), TimeJobType.ELECTRONIC_FAILURE); |
| | | } |
| | | /* |
| | | |
| | | //根据经纬度获取当前城市code |
| | | XpElectronicFenceArea electronicFenceArea = dto.getElectronicFenceAreas().get(0); |
| | | String[] split = electronicFenceArea.getFencePoints().split(","); |
| | |
| | | } |
| | | String cityCode = geocode.get("cityCode"); |
| | | dto.setCityCode(cityCode); |
| | | */ |
| | | |
| | | xpElectronicFence.setCityCode(dto.getCityCode()); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xiaopeng.api.model.map.XpGeoFencingPolygon; |
| | | import com.xiaopeng.api.model.operation.*; |
| | | import com.xiaopeng.api.query.operation.PointListQuery; |
| | | import com.xiaopeng.api.query.operation.PointPageListListQuery; |
| | | import com.xiaopeng.api.query.operation.XpStationQuery; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | |
| | | @Resource |
| | | private BootCommonService bootCommonService; |
| | | |
| | | @Override |
| | | public List<XpStation> findListByElectronicId(Long electronicId) { |
| | | |
| | | LambdaQueryWrapper<XpStation> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(XpStation::getElectronicId, electronicId); |
| | | queryWrapper.eq(XpStation::getOperationType, 2); |
| | | queryWrapper.eq(XpStation::getDeleted, 0); |
| | | return super.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<XpStation> findList(XpStationQuery query) { |
| | |
| | | package com.xiaopeng.operation.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.xiaopeng.api.model.operation.XpAgreement; |
| | | import com.xiaopeng.api.model.operation.XpLoginAgreement; |
| | |
| | | @GetMapping("/api/v1/agreement/getLoginAgreementPageList/{type}") |
| | | @ApiParam(name = "type", value = "类型(1=用户登录协议,2=运维APP登录协议)") |
| | | public R<List<XpLoginAgreement>> getLoginAgreementPageList(@PathVariable Integer type) { |
| | | List<XpLoginAgreement> list = xpLoginAgreementService.list(new QueryWrapper<XpLoginAgreement>().eq("type", type) |
| | | .eq("is_deleted", 0).orderByDesc("sort")); |
| | | LambdaQueryWrapper<XpLoginAgreement> queryWrapper = new LambdaQueryWrapper<XpLoginAgreement>() |
| | | .eq(XpLoginAgreement::getType, type) |
| | | .eq(XpLoginAgreement::getDeleted, 0) |
| | | .orderByDesc(XpLoginAgreement::getSort); |
| | | List<XpLoginAgreement> list = xpLoginAgreementService.list(queryWrapper); |
| | | return R.ok(list); |
| | | } |
| | | |
| | |
| | | import cn.afterturn.easypoi.excel.entity.ImportParams; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import cn.hutool.core.util.PhoneUtil; |
| | | import cn.hutool.core.io.resource.ClassPathResource; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.xiaopeng.api.feignClient.account.SysGroupMenuClient; |
| | | import com.xiaopeng.api.model.operation.XpInvitationCode; |
| | | import com.xiaopeng.api.model.operation.XpWhitelist; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.utils.DateUtils; |
| | | import com.xiaopeng.common.core.utils.WebUtils; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.operation.constant.I18nKeyConstant; |
| | | import com.xiaopeng.operation.dto.InvitationAddDto; |
| | | import com.xiaopeng.operation.exportExcle.XpInvitationCodeExportExcel; |
| | |
| | | private MessageSource messageSource; |
| | | @Resource |
| | | private SysGroupMenuClient groupMenuClient; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | private static final Pattern CHINESE_PATTERN = Pattern.compile("\\p{IsHan}"); |
| | | private static final long INVITATION_CODE_LIMIT = 500L; |
| | |
| | | @ApiOperation(value = "邀请码管理分页列表", response = XpInvitationCode.class) |
| | | @PostMapping("/api/v1/invitation/pageList") |
| | | public R<PageInfo<XpInvitationCode>> pageList(@RequestBody InvitationPageListQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | PageInfo<XpInvitationCode> pageList = xpInvitationCodeService.pageList(query); |
| | | pageList.getRecords().forEach(s -> s.setBindAccount(groupMenuClient.getPhoneDesensitization(s.getBindAccount()).getData())); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | pageList.getRecords().forEach(s -> s.setBindAccount(DesensitizedUtil.mobilePhone(s.getBindAccount()))); |
| | | } |
| | | return R.ok(pageList); |
| | | } |
| | | |
| | |
| | | package com.xiaopeng.operation.controller; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import com.xiaopeng.api.feignClient.account.SysGroupMenuClient; |
| | | import com.xiaopeng.api.model.account.SysUser; |
| | | import com.xiaopeng.api.model.operation.XpTargetedService; |
| | | import com.xiaopeng.api.model.operation.XpWhitelist; |
| | | import com.xiaopeng.api.query.operation.XpTargetedServiceQuery; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.api.vo.operation.XpTargetedServiceVehicleVo; |
| | | import com.xiaopeng.api.vo.operation.XpTargetedServiceVo; |
| | | import com.xiaopeng.common.core.domain.R; |
| | |
| | | @ApiOperation(value = "定向服务-详情", tags = {"管理后台-定向服务详情"}) |
| | | @GetMapping("/api/v1/targetedService/detail") |
| | | public R<XpTargetedServiceVo> detail(@RequestParam Long id) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (id == null) { |
| | | return R.fail("ID不能为空"); |
| | | } |
| | |
| | | if (vo == null) { |
| | | return R.fail("数据不存在"); |
| | | } |
| | | vo.getWhitelistList().forEach(s->s.setAccount(groupMenuClient.getPhoneDesensitization(s.getAccount()).getData())); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | vo.getWhitelistList().forEach(s->s.setAccount(DesensitizedUtil.mobilePhone(s.getAccount()))); |
| | | } |
| | | |
| | | return R.ok(vo); |
| | | } |
| | | |
| | |
| | | package com.xiaopeng.operation.controller; |
| | | |
| | | |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import com.xiaopeng.api.feignClient.account.SysGroupMenuClient; |
| | | import com.xiaopeng.api.model.operation.XpUserFeedback; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.operation.dto.XpUserFeedbackDto; |
| | | import com.xiaopeng.operation.query.UserFeedBackQuery; |
| | | import com.xiaopeng.operation.service.IXpUserFeedbackService; |
| | |
| | | private final IXpUserFeedbackService xpUserFeedbackService; |
| | | @Resource |
| | | private SysGroupMenuClient groupMenuClient; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | public XpUserFeedbackController(IXpUserFeedbackService xpUserFeedbackService) { |
| | | this.xpUserFeedbackService = xpUserFeedbackService; |
| | |
| | | @ApiOperation(value = "获取意见反馈分页列表", tags = {"管理后台-服务中心"}) |
| | | @PostMapping(value = "/api/v1/userFeedBack/pageList") |
| | | public R<PageInfo<XpUserFeedbackVO>> getPageList(@RequestBody UserFeedBackQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | PageInfo<XpUserFeedbackVO> pageList = xpUserFeedbackService.getPageList(query); |
| | | pageList.getRecords().forEach(s->s.setPhone(groupMenuClient.getPhoneDesensitization(s.getPhone()).getData())); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | pageList.getRecords().forEach(s->s.setPhone(DesensitizedUtil.mobilePhone(s.getPhone()))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | import cn.afterturn.easypoi.excel.ExcelImportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import cn.afterturn.easypoi.excel.entity.ImportParams; |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import cn.hutool.core.util.PhoneUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.xiaopeng.api.feignClient.account.SysGroupMenuClient; |
| | | import com.xiaopeng.api.model.account.SysUser; |
| | | import com.xiaopeng.api.model.operation.XpWhitelist; |
| | | import com.xiaopeng.api.model.operation.XpWhitelistOperlog; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.utils.WebUtils; |
| | |
| | | @ApiOperation(value = "白名单管理详情", tags = {"管理后台-白名单管理详情"}) |
| | | @GetMapping("/api/v1/whitelist/detail/{id}") |
| | | public R<XpWhitelist> detail(@PathVariable("id") Long id) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | XpWhitelist xpWhitelist = xpWhitelistService.getById(id); |
| | | xpWhitelist.setAccount(groupMenuClient.getPhoneDesensitization(xpWhitelist.getAccount()).getData()); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | xpWhitelist.setAccount(DesensitizedUtil.mobilePhone(xpWhitelist.getAccount())); |
| | | } |
| | | return R.ok(xpWhitelist); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "白名单管理分页列表", response = XpWhitelist.class) |
| | | @PostMapping("/api/v1/whitelist/pageList") |
| | | public R<PageInfo<XpWhitelist>> pageList(@RequestBody WhitelistPageListQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | PageInfo<XpWhitelist> pageList = xpWhitelistService.pageList(query); |
| | | pageList.getRecords().forEach(s->s.setAccount(groupMenuClient.getPhoneDesensitization(s.getAccount()).getData())); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | pageList.getRecords().forEach(s->s.setAccount(DesensitizedUtil.mobilePhone(s.getAccount()))); |
| | | } |
| | | return R.ok(pageList); |
| | | } |
| | | |
| | |
| | | return R.ok(); |
| | | } |
| | | AppUserLocationVo vo = new AppUserLocationVo(); |
| | | AppUserPosition userPosition = mongoTemplate.findOne(Query.query(Criteria.where("appUserId").is(xpOrder.getAppUserId())), AppUserPosition.class); |
| | | if(null != userPosition){ |
| | | vo.setPassengerLng(userPosition.getPoint().getX()); |
| | | vo.setPassengerLat(userPosition.getPoint().getY()); |
| | | return R.ok(vo); |
| | | } |
| | | return R.ok(); |
| | | vo.setPassengerLng(104.5165135); |
| | | vo.setPassengerLat(30.2566515); |
| | | return R.ok(vo); |
| | | // TODO 后期放开,临时mock |
| | | // AppUserPosition userPosition = mongoTemplate.findOne(Query.query(Criteria.where("appUserId").is(xpOrder.getAppUserId())), AppUserPosition.class); |
| | | // if(null != userPosition){ |
| | | // vo.setPassengerLng(userPosition.getPoint().getX()); |
| | | // vo.setPassengerLat(userPosition.getPoint().getY()); |
| | | // return R.ok(vo); |
| | | // } |
| | | // return R.ok(); |
| | | } |
| | | |
| | | |
| | |
| | | if(null == xpOrder){ |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | return R.ok(); |
| | | // TODO 后期放开,临时mock |
| | | // R<VehicleDoorStatusVo> vehicleDoorStatus = xpVehicleClient.getVehicleDoorStatus(orderId); |
| | | // if(200 != vehicleDoorStatus.getCode()){ |
| | | // return R.fail(vehicleDoorStatus.getMsg()); |
| | | // } |
| | | // VehicleDoorStatusVo data = vehicleDoorStatus.getData(); |
| | | VehicleSeatStatusVo vo = new VehicleSeatStatusVo(); |
| | | //主驾 |
| | | VehicleSeatStatus frontLeft = new VehicleSeatStatus(); |
| | | // frontLeft.setSeatOccupied(data.getDriverSeatState() + ""); |
| | | // frontLeft.setSeatbeltFastened(data.getDrvSeatBeltBuckleSt() + ""); |
| | | frontLeft.setSeatOccupied("0"); |
| | | frontLeft.setSeatbeltFastened("0"); |
| | | vo.setFrontLeft(frontLeft); |
| | | //副驾 |
| | | VehicleSeatStatus frontRight = new VehicleSeatStatus(); |
| | | // frontRight.setSeatOccupied(data.getPsngrSeatOccupancyStatus() + ""); |
| | | // frontRight.setSeatbeltFastened(data.getPsngrSeatBeltBuckleSt() + ""); |
| | | frontRight.setSeatOccupied("1"); |
| | | frontRight.setSeatbeltFastened("0"); |
| | | vo.setFrontRight(frontRight); |
| | | //左后 |
| | | VehicleSeatStatus rearLeft = new VehicleSeatStatus(); |
| | | // rearLeft.setSeatOccupied(data.getSecRowLeftSeatOccupancyStatus() + ""); |
| | | // rearLeft.setSeatbeltFastened(data.getSecRowLtSeatBeltBuckleSt() + ""); |
| | | rearLeft.setSeatOccupied("1"); |
| | | rearLeft.setSeatbeltFastened("1"); |
| | | vo.setRearLeft(rearLeft); |
| | | //右后 |
| | | VehicleSeatStatus rearRight = new VehicleSeatStatus(); |
| | | // rearRight.setSeatOccupied(data.getSecRowRightSeatOccupancyStatus() + ""); |
| | | // rearRight.setSeatbeltFastened(data.getSecRowRtSeatBeltBuckleSt() + ""); |
| | | rearRight.setSeatOccupied("0"); |
| | | rearRight.setSeatbeltFastened("0"); |
| | | vo.setRearRight(rearRight); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | | |
| | |
| | | public R<VehicleRangeVo> getVehicleRange(@PathVariable String orderId){ |
| | | XpOrder xpOrder = xpOrderService.getById(orderId); |
| | | VehicleRangeVo vo = new VehicleRangeVo(); |
| | | if(null != xpOrder.getVehicleId()){ |
| | | XpVehicle xpVehicle = xpVehicleClient.queryById(xpOrder.getVehicleId()).getData(); |
| | | VehiclePosition vehiclePositions = mongoTemplate.findOne(Query.query(Criteria.where("vin").is(xpVehicle.getVehicleVin())), VehiclePosition.class); |
| | | if(null == vehiclePositions){ |
| | | return R.ok(); |
| | | } |
| | | vo.setBatteryLevel(vehiclePositions.getCurrentElectricity()); |
| | | vo.setEstimatedRange(Double.valueOf(vehiclePositions.getMileageRange())); |
| | | } |
| | | // TODO 后期放开,临时mock |
| | | // if(null != xpOrder.getVehicleId()){ |
| | | // XpVehicle xpVehicle = xpVehicleClient.queryById(xpOrder.getVehicleId()).getData(); |
| | | // VehiclePosition vehiclePositions = mongoTemplate.findOne(Query.query(Criteria.where("vin").is(xpVehicle.getVehicleVin())), VehiclePosition.class); |
| | | // if(null == vehiclePositions){ |
| | | // return R.ok(); |
| | | // } |
| | | // vo.setBatteryLevel(vehiclePositions.getCurrentElectricity()); |
| | | // vo.setEstimatedRange(Double.valueOf(vehiclePositions.getMileageRange())); |
| | | // } |
| | | vo.setBatteryLevel(85); |
| | | vo.setEstimatedRange(580D); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "根据 订单查询四门三盖状态", notes = "客服系统对接") |
| | | @ApiImplicitParam(name = "orderId", value = "订单ID", required = true, dataType = "Long", paramType = "path") |
| | | public R<VehicleDoorStatusVo> getVehicleDoorStatus(@PathVariable Long orderId){ |
| | | VehicleDoorStatusVo data = xpVehicleClient.getVehicleDoorStatus(orderId).getData(); |
| | | // VehicleDoorStatusVo data = xpVehicleClient.getVehicleDoorStatus(orderId).getData(); |
| | | // TODO 后期放开,临时mock |
| | | VehicleDoorStatusVo data = new VehicleDoorStatusVo(); |
| | | data.setFrontLeftDoor(0); |
| | | data.setFrontRightDoor(0); |
| | | data.setRearLeftDoor(0); |
| | | data.setRearRightDoor(0); |
| | | data.setTrunk(1); |
| | | data.setFrunk(1); |
| | | data.setHvacOn(0); |
| | | data.setHvacInnerTempFloat(28.5); |
| | | data.setHvacTempFloat(29.5); |
| | | data.setRearLeftHvacTempFloat(29.5); |
| | | data.setPassengerHvacTempFloat(29.5); |
| | | data.setDriverSeatState(1); |
| | | data.setPsngrSeatOccupancyStatus(0); |
| | | data.setSecRowLeftSeatOccupancyStatus(0); |
| | | data.setSecRowMidSeatOccupancyStatus(0); |
| | | data.setSecRowRightSeatOccupancyStatus(0); |
| | | data.setThirdRowLeftSeatOccupancyStatus(1); |
| | | data.setThirdRowMidSeatOccupancyStatus(0); |
| | | data.setThirdRowRightSeatOccupancyStatus(0); |
| | | data.setDrvSeatBeltBuckleSt(1); |
| | | data.setPsngrSeatBeltBuckleSt(0); |
| | | data.setSecRowLtSeatBeltBuckleSt(0); |
| | | data.setSecRowMidSeatBeltBuckleSt(0); |
| | | data.setSecRowRtSeatBeltBuckleSt(0); |
| | | data.setTrdRowLtSeatBeltBuckleSt(0); |
| | | data.setTrdRowMidSeatBeltBuckleSt(0); |
| | | data.setTrdRowRtSeatBeltBuckleSt(0); |
| | | data.setSlowChargePortStatus(2); |
| | | data.setFastChargePortStatus(2); |
| | | return R.ok(data); |
| | | } |
| | | |
| | |
| | | return R.ok(); |
| | | } |
| | | VehicleFenceInformationVo vo = new VehicleFenceInformationVo(); |
| | | vo.setVehicleLng(vehiclePositions.getPoint().getX()); |
| | | vo.setVehicleLat(vehiclePositions.getPoint().getY()); |
| | | XpGeoFencingPolygon fencingPolygon = mongoTemplate.findOne(Query.query(Criteria.where("areaId").is(xpOrder.getXpElectronicFenceAreaId())), XpGeoFencingPolygon.class); |
| | | List<FenceVo> collect = fencingPolygon.getPoints().getPoints().stream().map(point -> { |
| | | // TODO 后期放开,临时mock |
| | | // vo.setVehicleLng(vehiclePositions.getPoint().getX()); |
| | | // vo.setVehicleLat(vehiclePositions.getPoint().getY()); |
| | | vo.setVehicleLng(104.5313); |
| | | vo.setVehicleLat(30.26335); |
| | | // XpGeoFencingPolygon fencingPolygon = mongoTemplate.findOne(Query.query(Criteria.where("areaId").is(xpOrder.getXpElectronicFenceAreaId())), XpGeoFencingPolygon.class); |
| | | // List<FenceVo> collect = fencingPolygon.getPoints().getPoints().stream().map(point -> { |
| | | // FenceVo fenceVo = new FenceVo(); |
| | | // fenceVo.setLng(point.getX()); |
| | | // fenceVo.setLat(point.getY()); |
| | | // return fenceVo; |
| | | // }).collect(Collectors.toList()); |
| | | List<FenceVo> collect = new ArrayList<FenceVo>(){{ |
| | | FenceVo fenceVo = new FenceVo(); |
| | | fenceVo.setLng(point.getX()); |
| | | fenceVo.setLat(point.getY()); |
| | | return fenceVo; |
| | | }).collect(Collectors.toList()); |
| | | fenceVo.setLng(104.5313); |
| | | fenceVo.setLat(30.26335); |
| | | add(fenceVo); |
| | | fenceVo = new FenceVo(); |
| | | fenceVo.setLng(104.5323); |
| | | fenceVo.setLat(30.26325); |
| | | add(fenceVo); |
| | | fenceVo = new FenceVo(); |
| | | fenceVo.setLng(104.5353); |
| | | fenceVo.setLat(30.26365); |
| | | add(fenceVo); |
| | | fenceVo = new FenceVo(); |
| | | fenceVo.setLng(104.5343); |
| | | fenceVo.setLat(30.26375); |
| | | add(fenceVo); |
| | | fenceVo = new FenceVo(); |
| | | fenceVo.setLng(104.5373); |
| | | fenceVo.setLat(30.26395); |
| | | add(fenceVo); |
| | | fenceVo = new FenceVo(); |
| | | fenceVo.setLng(104.5323); |
| | | fenceVo.setLat(30.26375); |
| | | add(fenceVo); |
| | | fenceVo = new FenceVo(); |
| | | fenceVo.setLng(104.5343); |
| | | fenceVo.setLat(30.26345); |
| | | add(fenceVo); |
| | | }}; |
| | | vo.setGeofenceBoundary(collect); |
| | | |
| | | GeoJsonPoint point = new GeoJsonPoint(vehiclePositions.getPoint().getX(), vehiclePositions.getPoint().getY()); |
| | | List<XpGeoFencingPolygon> polygon = mongoTemplate.find(Query.query(Criteria.where("points").intersects(point)), XpGeoFencingPolygon.class); |
| | | Set<String> collect1 = polygon.stream().map(XpGeoFencingPolygon::getAreaId).collect(Collectors.toSet()); |
| | | vo.setIsOutOfGeofence(collect1.contains(xpOrder.getXpElectronicFenceAreaId())); |
| | | // GeoJsonPoint point = new GeoJsonPoint(vehiclePositions.getPoint().getX(), vehiclePositions.getPoint().getY()); |
| | | // List<XpGeoFencingPolygon> polygon = mongoTemplate.find(Query.query(Criteria.where("points").intersects(point)), XpGeoFencingPolygon.class); |
| | | // Set<String> collect1 = polygon.stream().map(XpGeoFencingPolygon::getAreaId).collect(Collectors.toSet()); |
| | | // vo.setIsOutOfGeofence(collect1.contains(xpOrder.getXpElectronicFenceAreaId())); |
| | | vo.setIsOutOfGeofence(false); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | import com.xiaopeng.api.model.operation.XpWhitelist; |
| | | import com.xiaopeng.api.model.order.XpOrder; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.api.vo.automaticPilot.VehiclePosition; |
| | | import com.xiaopeng.api.vo.operation.NavigationVo; |
| | | import com.xiaopeng.api.vo.operation.NearestNextVo; |
| | |
| | | @ApiOperation(value = "订单分页列表", tags = {"管理后台-交易管理-订单管理", "管理后台-活动管理"}) |
| | | @PostMapping("/api/v1/order/pageList") |
| | | public R<PageInfo<XpOrderPageVO>> pageList( @RequestBody XpOrderPageQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | PageInfo<XpOrderPageVO> pageInfo = xpOrderService.pageList(query); |
| | | pageInfo.getRecords().forEach(s->s.setPhoneNumber(groupMenuClient.getPhoneDesensitization(s.getPhoneNumber()).getData())); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | pageInfo.getRecords().forEach(s->s.setPhoneNumber(DesensitizedUtil.mobilePhone(s.getPhoneNumber()))); |
| | | } |
| | | |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "订单详情", tags = {"管理后台-交易管理-订单管理"}) |
| | | @GetMapping("/api/v1/order/queryById") |
| | | public R<XpOrderDetailVO> queryById(@ApiParam(value = "订单id", required = true) @RequestParam Long id) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | XpOrderDetailVO detail = xpOrderService.getOrderDetail(id); |
| | | detail.setPhoneNumber(groupMenuClient.getPhoneDesensitization(detail.getPhoneNumber()).getData()); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | detail.setPhoneNumber(DesensitizedUtil.mobilePhone(detail.getPhoneNumber())); |
| | | } |
| | | |
| | | return R.ok(detail); |
| | | } |
| | | |
| | |
| | | package com.xiaopeng.order.controller; |
| | | |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import com.xiaopeng.api.feignClient.account.SysGroupMenuClient; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.order.model.query.OrderEvaluatePageQuery; |
| | | import com.xiaopeng.order.model.vo.OrderEvaluatePageVO; |
| | | import com.xiaopeng.order.service.IXpOrderEvaluateService; |
| | |
| | | private IXpOrderEvaluateService xpOrderEvaluateService; |
| | | @Resource |
| | | private SysGroupMenuClient groupMenuClient; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * 订单评价分页列表查询 |
| | |
| | | @ApiOperation(value = "订单评价分页列表", tags = {"管理后台-交易管理"}) |
| | | @PostMapping("/pageList") |
| | | public R<PageInfo<OrderEvaluatePageVO>> pageList(@Validated @RequestBody OrderEvaluatePageQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | PageInfo<OrderEvaluatePageVO> pageInfo = xpOrderEvaluateService.pageList(query); |
| | | pageInfo.getRecords().forEach(s->s.setPhoneNumber(groupMenuClient.getPhoneDesensitization(s.getPhoneNumber()).getData())); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | pageInfo.getRecords().forEach(s->s.setPhoneNumber(DesensitizedUtil.mobilePhone(s.getPhoneNumber()))); |
| | | } |
| | | |
| | | return R.ok(pageInfo); |
| | | } |
| | | } |
| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; |
| | | import com.xiaopeng.api.vo.OrderType; |
| | | import com.xiaopeng.api.vo.account.CalculateDiscountAmountVo; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.api.vo.account.UserCouponVo; |
| | | import com.xiaopeng.api.vo.automaticPilot.VehiclePosition; |
| | | import com.xiaopeng.api.vo.automaticPilot.protobuf.OrderOperationType; |
| | |
| | | import com.xiaopeng.common.core.web.domain.BaseModel; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.redis.service.RedisService; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.common.security.utils.SecurityUtils; |
| | | import com.xiaopeng.order.constant.I18nKeyConstant; |
| | | import com.xiaopeng.order.dto.MileageDto; |
| | |
| | | |
| | | @Resource |
| | | private OfficialPartnerUtil officialPartnerUtil; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Value("${robotaxi.appId:xp_robotaxi_api}") |
| | | private String appid; |
| | |
| | | Map<Long, XpFleet> fleetMap, |
| | | BigDecimal orderMoney, |
| | | BigDecimal couponMoney) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | XpOrderPageVO vo = new XpOrderPageVO(); |
| | | vo.setId(order.getId()); |
| | | vo.setOrderNumber(order.getOrderNumber()); |
| | |
| | | if (Objects.nonNull(order.getAppUserId()) && userInfoMap != null && userInfoMap.containsKey(order.getAppUserId().toString())) { |
| | | UcUserInfo userInfo = userInfoMap.get(order.getAppUserId().toString()); |
| | | vo.setNickName(userInfo.getNickName()); |
| | | vo.setPhoneNumber(sysGroupMenuClient.getPhoneDesensitization(userInfo.getMobile()).getData()); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | vo.setPhoneNumber(DesensitizedUtil.mobilePhone(userInfo.getMobile())); |
| | | } |
| | | |
| | | } |
| | | |
| | | // 车辆信息 |
| | |
| | | totalPrice = totalPrice.add(xpOrderDetail1.getMoney()); |
| | | xpOrderDetailMapper.insert(xpOrderDetail1); |
| | | } |
| | | order.setOrderMoney(totalPrice); |
| | | |
| | | // 默认费率1 |
| | | double priceRate = 1; |
| | | if (pricing.getIsDynamicPrice() == 1) { |
| | | // 先判断是否已经调价过了 |
| | | Object userDynamicPriceObj = redisService.getCacheObject("USER_DYNAMIC_PRICE_" + order.getCityId() + "_" + uid); |
| | | if (userDynamicPriceObj != null) { |
| | | // 是否调价过了 |
| | | priceRate = Double.parseDouble(userDynamicPriceObj.toString()); |
| | | } else { |
| | | // 没有调过 |
| | | //是否触发动态调价 redis获取 |
| | | Object dynamicPriceObj = redisService.getCacheObject("DYNAMIC_PRICE_" + order.getCityId()); |
| | | if (dynamicPriceObj != null) { |
| | | JSONObject jsonObject = JSONObject.parseObject(pricing.getDynamicPricingJson()); |
| | | // 触发动态调价 |
| | | // value=时间 |
| | | String timeStr = dynamicPriceObj.toString(); |
| | | // 判断当前距离这个时间范围的新增订单数(排除取消) / 上浮数量 算出应该增加的价格率 |
| | | Integer num = this.getOrderNum(new GetOrderNumDto(timeStr, order.getCityId())); |
| | | // X单上升一次调价 |
| | | Integer orderNum = getOrderNum(jsonObject, 4); |
| | | // 需要调价的次数 |
| | | int count = num / orderNum; |
| | | if (count > 0) { |
| | | // 计算每次上升的费率 |
| | | Integer upRate = getOrderNum(jsonObject, 5); |
| | | BigDecimal divide = new BigDecimal(upRate).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP); |
| | | for (int i = count; i > 0; i--) { |
| | | // 当前费率+(费率*上升百分比) |
| | | priceRate = new BigDecimal(priceRate).multiply(divide).add(new BigDecimal(priceRate)).setScale(2, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | // 天气预报动态调价 |
| | | JSONArray ws = jsonObject.getJSONArray("weather"); |
| | | if (null != ws) { |
| | | WeatherDTO data = xpMapClient.wether(order.getCityCode()).getData(); |
| | | List<WeatherDTO.Lives> lives = data.getLives(); |
| | | if (lives != null && !lives.isEmpty()) { |
| | | String w = lives.get(0).getWeather(); |
| | | for (Object o : ws) { |
| | | JSONObject ele = JSONObject.parseObject(o.toString()); |
| | | if (w.contains(ele.getString("weatherType"))) { |
| | | double floatRate = jsonObject.getDouble("ratio"); |
| | | priceRate = new BigDecimal(priceRate).add(new BigDecimal(floatRate)).doubleValue(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // 冷却时间 |
| | | Integer time = getOrderNum(jsonObject, 6); |
| | | // 触发调价了 |
| | | redisService.setCacheObject("USER_DYNAMIC_PRICE_" + order.getCityId() + "_" + uid, priceRate, time.longValue(), TimeUnit.MINUTES); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | order.setOrderMoney(totalPrice.multiply(new BigDecimal(priceRate))); |
| | | order.setAppUserId(null); |
| | | baseMapper.updateById(order); |
| | | } else { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | // 封装费用明细数据 |
| | | for (Map.Entry<String, BigDecimal> stringBigDecimalEntry : bill.entrySet()) { |
| | |
| | | addTaxiPassengerVo.setUid(appUserId.toString()); |
| | | order.setAppUserId(null); |
| | | this.updateById(order); |
| | | order.setAppUserId(appUserId); |
| | | bootCommonService.setCache_orderStatus(order.getId(), order, null); |
| | | |
| | | //构建推送消息 |
| | |
| | | |
| | | //生成前往上车点的导航数据 |
| | | //查询车辆位置 |
| | | //TODO 本地环境默认写死 |
| | | // VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(dto.getXpVehicleVin())), VehiclePosition.class); |
| | | // if (Objects.isNull(vehiclePosition)) { |
| | | // throw new RuntimeException("车辆位置信息不存在"); |
| | | // } |
| | | VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(dto.getXpVehicleVin())), VehiclePosition.class); |
| | | if (Objects.isNull(vehiclePosition)) { |
| | | throw new RuntimeException("车辆位置信息不存在"); |
| | | } |
| | | |
| | | LonLatDto destination = new LonLatDto(); |
| | | LonLatDto origin = new LonLatDto(); |
| | | //查询司机当前位置到起点的线路 |
| | | // origin.setLongitude(vehiclePosition.getPoint().getX()); |
| | | // origin.setLatitude(vehiclePosition.getPoint().getY()); |
| | | origin.setLongitude(104.055499); |
| | | origin.setLatitude(30.586747); |
| | | origin.setLongitude(vehiclePosition.getPoint().getX()); |
| | | origin.setLatitude(vehiclePosition.getPoint().getY()); |
| | | // origin.setLongitude(104.055499); |
| | | // origin.setLatitude(30.586747); |
| | | destination.setLongitude(order.getStartLon()); |
| | | destination.setLatitude(order.getStartLat()); |
| | | |
| | |
| | | .plusMinutes(routeVo1.getDuration()).plusMinutes(endPoint.getParkingTimeLimit()).plusMinutes(30); |
| | | long expirationTime = localDateTime.toEpochSecond(ZoneOffset.of("+8")); |
| | | //生成token |
| | | // String token = bluetoothUnlockTokenUtil.generateBluetoothUnlockToken(order.getAppUserId(), |
| | | // order.getId(), order.getVehicleId(), expirationTime); |
| | | // log.info("生成蓝牙token:{} 有效期:{} 订单号: {}", token, expirationTime, order.getOrderNumber()); |
| | | // //存储缓存 |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // jsonObject.put("userId", order.getAppUserId()); |
| | | // jsonObject.put("orderId", order.getId()); |
| | | // jsonObject.put("vehicleId", order.getVehicleId()); |
| | | // jsonObject.put("expirationTime", expirationTime); |
| | | // jsonObject.put("orderNumber", order.getOrderNumber()); |
| | | // jsonObject.put("vehicleVin", vehicle.getVehicleVin()); |
| | | // jsonObject.put("createTime", System.currentTimeMillis()); |
| | | // redisService.setCacheObject("rt:bluetooth:unlock:" + token, jsonObject.toJSONString(), expirationTime, TimeUnit.SECONDS); |
| | | // redisService.setCacheObject("rt:bluetooth:unlock:order:" + order.getId(), token, expirationTime, TimeUnit.SECONDS); |
| | | // //开始下发蓝牙token |
| | | // BluetoothDeliverVo vo = new BluetoothDeliverVo(); |
| | | // vo.setCredential(token); |
| | | // vo.setVim(vehicle.getVehicleVin()); |
| | | // vo.setPassengerUid(order.getAppUserId()); |
| | | String token = bluetoothUnlockTokenUtil.generateBluetoothUnlockToken(order.getAppUserId(), |
| | | order.getId(), order.getVehicleId(), expirationTime); |
| | | log.info("生成蓝牙token:{} 有效期:{} 订单号: {}", token, expirationTime, order.getOrderNumber()); |
| | | //存储缓存 |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("userId", order.getAppUserId()); |
| | | jsonObject.put("orderId", order.getId()); |
| | | jsonObject.put("vehicleId", order.getVehicleId()); |
| | | jsonObject.put("expirationTime", expirationTime); |
| | | jsonObject.put("orderNumber", order.getOrderNumber()); |
| | | jsonObject.put("vehicleVin", vehicle.getVehicleVin()); |
| | | jsonObject.put("createTime", System.currentTimeMillis()); |
| | | redisService.setCacheObject("rt:bluetooth:unlock:" + token, jsonObject.toJSONString(), expirationTime, TimeUnit.SECONDS); |
| | | redisService.setCacheObject("rt:bluetooth:unlock:order:" + order.getId(), token, expirationTime, TimeUnit.SECONDS); |
| | | //开始下发蓝牙token |
| | | BluetoothDeliverVo vo = new BluetoothDeliverVo(); |
| | | vo.setCredential(token); |
| | | vo.setVim(vehicle.getVehicleVin()); |
| | | vo.setPassengerUid(order.getAppUserId()); |
| | | // BaseVehicleUserDto deliver = bluetoothUnlockClient.deliver(vo); |
| | | // if(null == deliver){ |
| | | // throw new ServiceException("下发蓝牙token失败"); |
| | |
| | | vo.setOrderId(xpOrder.getId()); |
| | | vo.setOrderCreatedAt(xpOrder.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | vo.setDispatchStartAt(""); |
| | | vo.setDispatchSuccessAt(xpOrder.getAcceptanceTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | vo.setVehicleArrivedAt(xpOrder.getArrivalTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | vo.setDispatchSuccessAt(null == xpOrder.getAcceptanceTime() ? "" : xpOrder.getAcceptanceTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | vo.setVehicleArrivedAt(null == xpOrder.getArrivalTime() ? "" : xpOrder.getArrivalTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | vo.setFreeWaitExpiredAt(""); |
| | | vo.setVehicleUnlockedAt(""); |
| | | vo.setDoorOpenedAt(Arrays.asList("")); |
| | | vo.setDoorClosedAt(Arrays.asList("")); |
| | | vo.setTripConfirmedAt(xpOrder.getTripBegin().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | vo.setTripConfirmedAt(null == xpOrder.getTripBegin() ? "" : xpOrder.getTripBegin().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | vo.setSafetybeltUnlockedAt(Arrays.asList("")); |
| | | vo.setArrivedDestinationAt(""); |
| | | vo.setDropoffDoorOpenedAt(Arrays.asList("")); |
| | | vo.setDropoffTrunkOpenedAt(Arrays.asList("")); |
| | | vo.setDropoffDoorClosedAt(Arrays.asList("")); |
| | | vo.setTripEndedAt(xpOrder.getTripEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | vo.setTripEndedAt(null == xpOrder.getTripEnd() ? "" : xpOrder.getTripEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | vo.setPaymentCompletedAt(""); |
| | | XpOrderEvaluate orderEvaluate = xpOrderEvaluateService.getOne(new QueryWrapper<XpOrderEvaluate>().eq("order_id", xpOrder.getId())); |
| | | if(null != orderEvaluate){ |
| | |
| | | @Data |
| | | @ApiModel |
| | | public class VehicleSeatStatus { |
| | | @ApiModelProperty("座椅状态") |
| | | @ApiModelProperty("座椅状态 0-无人,1-有人") |
| | | private String seatOccupied; |
| | | @ApiModelProperty("安全带状态") |
| | | @ApiModelProperty("安全带状态 0:已解开 1:未解开") |
| | | private String seatbeltFastened; |
| | | } |
| | |
| | | * @return 操作结果 |
| | | */ |
| | | @ApiOperation(value = "发送车辆路线、时间") |
| | | @PostMapping("/inner/websocket/order/sendRoute") |
| | | @PostMapping("/logan/inner/websocket/order/sendRoute") |
| | | public R<String> sendRoute(@RequestBody SendMessageDTO dto) { |
| | | try { |
| | | String message = dto.getMessage(); |
| | |
| | | package com.xiaopeng.vehicleConvoy.controller; |
| | | |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.xiaopeng.api.dto.open_api.BrandInfo; |
| | | import com.xiaopeng.api.feignClient.account.SysGroupMenuClient; |
| | |
| | | import com.xiaopeng.api.model.account.XpOperationsUser; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpFleet; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpFleetOperations; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.vehicleConvoy.model.dto.FleetAddDTO; |
| | | import com.xiaopeng.vehicleConvoy.model.dto.FleetEditDTO; |
| | | import com.xiaopeng.vehicleConvoy.model.query.FleetPageQuery; |
| | |
| | | private final IXpFleetOperationsService xpFleetOperationsService; |
| | | @Resource |
| | | private SysGroupMenuClient groupMenuClient; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * 根据车队名字模糊查询车队人员 |
| | |
| | | @ApiOperation(value = "查询车队详情", tags = {"管理后台-车队管理"}) |
| | | @GetMapping("/api/v1/fleet/queryById") |
| | | public R<FleetDetailVO> queryById(@RequestParam Long id) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | R<FleetDetailVO> fleetDetailVOR = xpFleetService.queryById(id); |
| | | fleetDetailVOR.getData().setPhoneNumber(groupMenuClient.getPhoneDesensitization(fleetDetailVOR.getData().getPhoneNumber()).getData()); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | fleetDetailVOR.getData().setPhoneNumber(DesensitizedUtil.mobilePhone(fleetDetailVOR.getData().getPhoneNumber())); |
| | | } |
| | | |
| | | return fleetDetailVOR; |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "车队分页列表", tags = {"管理后台-车队管理"}) |
| | | @PostMapping("/api/v1/fleet/pageList") |
| | | public R<PageInfo<FleetPageVO>> pageList(@Valid @RequestBody FleetPageQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | R<PageInfo<FleetPageVO>> pageInfoR = xpFleetService.pageList(query); |
| | | pageInfoR.getData().getRecords().forEach(s->s.setPhoneNumber(groupMenuClient.getPhoneDesensitization(s.getPhoneNumber()).getData())); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | pageInfoR.getData().getRecords().forEach(s->s.setPhoneNumber(DesensitizedUtil.mobilePhone(s.getPhoneNumber()))); |
| | | } |
| | | |
| | | return pageInfoR; |
| | | } |
| | | |
| | |
| | | package com.xiaopeng.vehicleConvoy.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpFleetOperations; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpFleetVehicle; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.api.vo.account.XpOperationsUserWithRoleVO; |
| | | import com.xiaopeng.api.vo.operation.ElectronicFenceDetailVo; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.vehicleConvoy.constant.I18nKeyConstant; |
| | | import com.xiaopeng.vehicleConvoy.mapper.XpFleetMapper; |
| | | import com.xiaopeng.vehicleConvoy.model.dto.FleetAddDTO; |
| | |
| | | private final XpCheckLocationClient xpCheckLocationClient; |
| | | @Resource |
| | | private SysGroupMenuClient sysGroupMenuClient; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Override |
| | | public List<XpFleet> listByIds(List<Long> ids) { |
| | |
| | | |
| | | @Override |
| | | public R<FleetDetailVO> queryById(Long id) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | // 1. 查询车队主表 |
| | | XpFleet fleet = this.getById(id); |
| | | if (fleet == null) { |
| | |
| | | R<XpOperationsUser> userResult = xpOperationUserClient.queryById(fleet.getOperationsUserId()); |
| | | if (userResult.getData() != null) { |
| | | vo.setOperationsUserName(userResult.getData().getNickName()); |
| | | vo.setPhoneNumber(sysGroupMenuClient.getPhoneDesensitization(userResult.getData().getPhoneNumber()).getData()); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | vo.setPhoneNumber(DesensitizedUtil.mobilePhone(userResult.getData().getPhoneNumber())); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public R<PageInfo<FleetPageVO>> pageList(FleetPageQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | // 1. 构建查询条件 |
| | | List<Long> operationUserIds = Collections.emptyList(); |
| | | if (StringUtils.isNotBlank(query.getPhoneNumber())) { |
| | |
| | | XpOperationsUser user = userMap.get(fleet.getOperationsUserId()); |
| | | if (user != null) { |
| | | vo.setOperationsUserName(user.getNickName()); |
| | | vo.setPhoneNumber(sysGroupMenuClient.getPhoneDesensitization(user.getPhoneNumber()).getData()); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | vo.setPhoneNumber(DesensitizedUtil.mobilePhone(user.getPhoneNumber())); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public R<PageInfo<FleetUserVO>> queryUserPageList(FleetUserPageQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | // 1. 先根据条件查询符合条件的运维用户 |
| | | List<Long> filteredUserIds = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(query.getNickName()) || |
| | |
| | | FleetUserVO vo = new FleetUserVO(); |
| | | vo.setUserId(user.getId()); |
| | | vo.setNickName(user.getNickName()); |
| | | vo.setPhoneNumber(sysGroupMenuClient.getPhoneDesensitization(user.getPhoneNumber()).getData()); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | vo.setPhoneNumber(DesensitizedUtil.mobilePhone(user.getPhoneNumber())); |
| | | } |
| | | |
| | | vo.setJobNumber(user.getUniqueNumber()); |
| | | vo.setRoleName(user.getRoles().stream().map(SysRole::getRoleName).collect(Collectors.joining(","))); |
| | | records.add(vo); |
| | |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | import com.xiaopeng.api.model.account.XpOperationsUser; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpPolicyApplication; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.enums.AuditStateEnum; |
| | | import com.xiaopeng.common.core.enums.PolicyApplicationAuditStateEnum; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.common.security.utils.SecurityUtils; |
| | | import com.xiaopeng.evi.oss.service.AliOssService; |
| | | import com.xiaopeng.vehicleConvoy.mapper.XpPolicyApplicationMapper; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | |
| | | private final AliOssService aliOssService; |
| | | @Autowired |
| | | private SysGroupMenuClient sysGroupMenuClient; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<XpPolicyApplicationVO> pageList(XpPolicyApplicationQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | PageInfo<XpPolicyApplicationVO> resultPage = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | |
| | | |
| | | for (XpPolicyApplicationVO vo : resultPage.getRecords()) { |
| | | vo.setPhoneNumber(sysGroupMenuClient.getPhoneDesensitization(vo.getPhoneNumber()).getData()); |
| | | if(!loginUser.getPhoneDesensitization()){ |
| | | for (XpPolicyApplicationVO vo : resultPage.getRecords()) { |
| | | vo.setPhoneNumber(DesensitizedUtil.mobilePhone(vo.getPhoneNumber())); |
| | | } |
| | | } |
| | | |
| | | // 1. 根据运维人员名称查询运维人员ID列表 |
| | |
| | | // 6. 返回分页结果 |
| | | resultPage.setTotal(page.getTotal()); |
| | | resultPage.setRecords(voList); |
| | | for (XpPolicyApplicationVO vo : resultPage.getRecords()) { |
| | | vo.setPhoneNumber(sysGroupMenuClient.getPhoneDesensitization(vo.getPhoneNumber()).getData()); |
| | | } |
| | | return resultPage; |
| | | } |
| | | |