| | |
| | | package com.xiaopeng.operation.controller; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.xiaopeng.api.dto.account.UserResourcesDto; |
| | | import com.xiaopeng.api.dto.map.RouteAndFareDto; |
| | | import com.xiaopeng.api.dto.operation.LonLatDto; |
| | | import com.xiaopeng.api.feignClient.account.UserResourcesClient; |
| | | import com.xiaopeng.api.model.operation.XpPricing; |
| | | import com.xiaopeng.api.model.operation.XpWhitelist; |
| | | import com.xiaopeng.api.vo.operation.RouteAndFareVo; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | |
| | | import com.xiaopeng.operation.dto.XpOrderDto; |
| | | import com.xiaopeng.operation.query.PricingPageListQuery; |
| | | import com.xiaopeng.operation.service.IXpGeoQueryEntityService; |
| | | import com.xiaopeng.operation.service.IXpWhitelistService; |
| | | import com.xiaopeng.operation.service.XpPricingService; |
| | | import com.xiaopeng.operation.vo.PricingPageListVO; |
| | | import com.xiaopeng.operation.vo.SaveOrderVo; |
| | |
| | | |
| | | private final XpPricingService xpPricingService; |
| | | private final IXpGeoQueryEntityService xpGeoQueryEntityService; |
| | | private final UserResourcesClient userResourcesClient; |
| | | private final IXpWhitelistService xpWhitelistService; |
| | | |
| | | |
| | | public XpPricingController(XpPricingService xpPricingService, IXpGeoQueryEntityService xpGeoQueryEntityService) { |
| | | public XpPricingController(XpPricingService xpPricingService, IXpGeoQueryEntityService xpGeoQueryEntityService, UserResourcesClient userResourcesClient, IXpWhitelistService xpWhitelistService) { |
| | | this.xpPricingService = xpPricingService; |
| | | this.xpGeoQueryEntityService = xpGeoQueryEntityService; |
| | | this.userResourcesClient = userResourcesClient; |
| | | this.xpWhitelistService = xpWhitelistService; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * 获取用户是否在白名单中 |
| | | */ |
| | | @PostMapping("/base/v1/mini-program/pricing/isInWhiteList") |
| | | @ApiOperation(value = "获取用户是否在白名单中", tags = {"小程序-获取用户是否在白名单中"}, response = Boolean.class) |
| | | @XpClientCheck(checkToken = false, checkOtpToken = true) |
| | | public R<Boolean> isInWhiteList(HttpServletRequest request) { |
| | | String uid = request.getHeader("XP-Uid"); |
| | | UserResourcesDto baseUserByUid = userResourcesClient.getBaseUserByUid(uid); |
| | | if (baseUserByUid!=null) { |
| | | try { |
| | | Object data = baseUserByUid.getData(); |
| | | String phone = JSONObject.parseObject(data.toString()).getString("mobile"); |
| | | long count = xpWhitelistService.count(new LambdaQueryWrapper<XpWhitelist>().eq(XpWhitelist::getAccount, phone).eq(XpWhitelist::getStatus, 1)); |
| | | return R.ok(count>0); |
| | | }catch (Exception e){ |
| | | log.error("获取用户信息失败: {}", e.getMessage()); |
| | | return R.ok(false); |
| | | } |
| | | |
| | | } |
| | | return R.ok(false); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存信息 |
| | | * @param |
| | | * @return |