| | |
| | | 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.feignClient.maintenance.XpVehicleModelClient; |
| | | import com.xiaopeng.api.model.maintenance.XpVehicleModel; |
| | | import com.xiaopeng.api.model.operation.XpOfficialPartner; |
| | | 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.utils.SensitiveDataCryptoUtil; |
| | | import com.xiaopeng.common.core.web.controller.BaseController; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.operation.constant.I18nKeyConstant; |
| | | import com.xiaopeng.operation.dto.*; |
| | | import com.xiaopeng.operation.query.PricingPageListQuery; |
| | | import com.xiaopeng.operation.service.*; |
| | | import com.xiaopeng.operation.utils.ImageTagProcessor; |
| | | import com.xiaopeng.operation.vo.OfficialPartnerVo; |
| | | import com.xiaopeng.operation.vo.PricingInfoVo; |
| | | import com.xiaopeng.operation.vo.PricingPageListVO; |
| | | import com.xiaopeng.operation.vo.SaveOrderVo; |
| | | import com.xiaopeng.unifiedverification.interceptor.XpClientCheck; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.validation.Valid; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private final XpOpenCityService xpOpenCityService; |
| | | private final ImageTagProcessor imageTagProcessor; |
| | | |
| | | @Resource |
| | | private XpVehicleModelClient xpVehicleModelClient; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | public XpPricingController(XpPricingService xpPricingService, IXpGeoQueryEntityService xpGeoQueryEntityService, UserResourcesClient userResourcesClient, IXpWhitelistService xpWhitelistService, XpRegionService xpRegionService, XpOpenCityService xpOpenCityService, ImageTagProcessor imageTagProcessor) { |
| | | this.xpPricingService = xpPricingService; |
| | | this.xpGeoQueryEntityService = xpGeoQueryEntityService; |
| | |
| | | |
| | | // 根据开通城市 获取定价 |
| | | @GetMapping("/base/v1/mini-program/getPricingByCityId/{cityId}") |
| | | @XpClientCheck(checkToken = false, checkOtpToken = true) |
| | | public R<XpPricing> getPricingByCityId(@PathVariable("cityId") Long cityId) { |
| | | XpPricing pricing = xpPricingService.lambdaQuery().eq(XpPricing::getCityId, cityId).last("limit 1").one(); |
| | | return R.ok(pricing); |
| | | } |
| | | // 根据开通城市 获取定价 |
| | | @GetMapping("/inner/v1/getPricingByCid") |
| | | public R<XpPricing> getPricingByCid(@RequestParam Long cityId) { |
| | | XpPricing pricing = xpPricingService.lambdaQuery().eq(XpPricing::getCityId, cityId).last("limit 1").one(); |
| | | @GetMapping("/logan/inner/v1/getPricingByCid") |
| | | public R<XpPricing> getPricingByCid(@RequestParam("cityId") Long cityId,@RequestParam(value = "vehicleModelId", required = false) String vehicleModelId) { |
| | | LambdaQueryWrapper<XpPricing> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(XpPricing::getDeleted, 0); |
| | | queryWrapper.eq(XpPricing::getCityId, cityId); |
| | | if(null != vehicleModelId){ |
| | | queryWrapper.eq(XpPricing::getVehicleModel, vehicleModelId); |
| | | } |
| | | XpPricing pricing = xpPricingService.getOne(queryWrapper); |
| | | |
| | | return R.ok(pricing); |
| | | } |
| | | |
| | | /** |
| | | * 根据车型编码查询定价策略的数量 |
| | | * @param vehicleModelId 车型id |
| | | * @return |
| | | */ |
| | | @GetMapping("/logan/inner/v1/getPriceCountByVmid") |
| | | public R<Long> getPriceCountByVmid(@RequestParam(value = "vehicleModelId") String vehicleModelId) { |
| | | LambdaQueryWrapper<XpPricing> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(XpPricing::getDeleted, 0); |
| | | queryWrapper.eq(XpPricing::getVehicleModel, vehicleModelId); |
| | | long count = xpPricingService.count(queryWrapper); |
| | | return R.ok(count); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/base/v1/mini-program/pricing/rules/{openCityId}") |
| | | @XpClientCheck(checkToken = false, checkOtpToken = true) |
| | | @ApiOperation(value = "获取费用规则(弃用)", tags = {"小程序-根据开通城市获取费用规则(弃用)"}, response = String.class) |
| | | public R<?> getPricingRules(@PathVariable Long openCityId) { |
| | | XpPricing xpPricing = xpPricingService.getOne(new LambdaQueryWrapper<XpPricing>().eq(XpPricing::getCityId, openCityId).last("limit 1")); |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/v1/mini-program/pricing/getWaitTime") |
| | | @XpClientCheck(checkToken = false, checkOtpToken = true) |
| | | @ApiOperation(value = "获取等待时间(弃用)", tags = {"小程序-获取等待时间(弃用)"}, response = Integer.class) |
| | | public R<Integer> getWaitTime(@RequestBody LonLatDto dto) { |
| | | return R.ok(xpPricingService.getWaitTime(dto.getLongitude(), dto.getLatitude())); |
| | |
| | | if (baseUserByUid != null) { |
| | | try { |
| | | String phone = baseUserByUid.getMobile(); |
| | | if (StringUtils.isBlank(phone)) { |
| | | return R.ok(false); |
| | | } |
| | | long count = xpWhitelistService.count(new LambdaQueryWrapper<XpWhitelist>() |
| | | .in(XpWhitelist::getAccount, SensitiveDataCryptoUtil.queryValues(phone)) |
| | | .eq(XpWhitelist::getStatus, 1)); |
| | |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping("/inner/updateXpGeoQueryEntity") |
| | | @PostMapping("/logan/inner/updateXpGeoQueryEntity") |
| | | public R<?> updateXpGeoQueryEntity(@RequestParam String orderId) { |
| | | xpGeoQueryEntityService.updateByOrderId(orderId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/inner/deleteXpGeoQueryEntity") |
| | | @PostMapping("/logan/inner/deleteXpGeoQueryEntity") |
| | | public R<?> deleteXpGeoQueryEntity(@RequestParam String orderId){ |
| | | xpGeoQueryEntityService.deleteXpGeoQueryEntity(orderId); |
| | | return R.ok(); |
| | |
| | | String cityName = xpOpenCityService.getNameWithCityName(pricing.getCityId()); |
| | | pricing.setCityName(cityName); |
| | | |
| | | R<List<XpVehicleModel>> listR = xpVehicleModelClient.listByIds(new ArrayList<String>(){{add(pricing.getVehicleModel());}}); |
| | | if(listR != null && listR.getData() != null) { |
| | | XpVehicleModel xpVehicleModel = listR.getData().get(0); |
| | | pricing.setVehicleModelName(xpVehicleModel.getName()); |
| | | } |
| | | |
| | | String priceRule = pricing.getPriceRule(); |
| | | if (priceRule != null && priceRule.contains("<img")) { |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 合作商添加计费策略 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @PostMapping("/drainage/v1/pricing/save") |
| | | @ApiOperation(value = "保存计价规则", notes = "流量接入-基础信息") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "token", name = "token", required = true, paramType = "header") |
| | | }) |
| | | public R<?> save(@RequestBody PricingInfoVo vo) { |
| | | XpOfficialPartner officialPartner = tokenService.getOfficialPartner(); |
| | | xpPricingService.savePrice(vo, officialPartner); |
| | | return R.ok(); |
| | | } |
| | | } |