| | |
| | | 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.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | 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 IXpWhitelistService xpWhitelistService; |
| | | 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; |
| | |
| | | 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}") |
| | |
| | | if (baseUserByUid != null) { |
| | | try { |
| | | String phone = baseUserByUid.getMobile(); |
| | | long count = xpWhitelistService.count(new LambdaQueryWrapper<XpWhitelist>().eq(XpWhitelist::getAccount, phone).eq(XpWhitelist::getStatus, 1)); |
| | | 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)); |
| | | return R.ok(count > 0); |
| | | } catch (Exception e) { |
| | | log.error("获取用户信息失败: {}", e.getMessage()); |
| | |
| | | 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")) { |
| | |
| | | |
| | | @PostMapping("/api/v1/pricing/add") |
| | | @ApiOperation(value = "管理后台-新增定价", tags = {"管理后台-定价管理"}) |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.PRICING_MANAGEMENT, |
| | | operationType = AdminOperationType.ADD, |
| | | content = "新增定价", |
| | | appendRequestData = true |
| | | ) |
| | | public R<Long> add(@Valid @RequestBody PricingAddDTO dto) { |
| | | return R.ok(xpPricingService.add(dto)); |
| | | } |
| | | |
| | | @PostMapping("/api/v1/pricing/edit") |
| | | @ApiOperation(value = "管理后台-编辑定价", tags = {"管理后台-定价管理"}) |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.PRICING_MANAGEMENT, |
| | | operationType = AdminOperationType.EDIT, |
| | | content = "编辑定价", |
| | | appendRequestData = true |
| | | ) |
| | | public R<?> edit(@Valid @RequestBody PricingEditDTO dto) { |
| | | return R.ok(xpPricingService.edit(dto)); |
| | | } |
| | | |
| | | @PostMapping("/api/v1/pricing/setPrice") |
| | | @ApiOperation(value = "管理后台-定价管理-设置价格", tags = {"管理后台-定价管理"}) |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.PRICING_MANAGEMENT, |
| | | operationType = AdminOperationType.EDIT, |
| | | content = "设置价格", |
| | | appendRequestData = true |
| | | ) |
| | | public R<?> setPrice(@Valid @RequestBody PricingSetPriceDTO dto) { |
| | | xpPricingService.setPrice(dto); |
| | | return R.ok(); |
| | |
| | | |
| | | @PostMapping("/api/v1/pricing/setRule") |
| | | @ApiOperation(value = "管理后台-计费规则富文本配置", tags = {"管理后台-定价管理"}) |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.PRICING_MANAGEMENT, |
| | | operationType = AdminOperationType.EDIT, |
| | | content = "配置计费规则", |
| | | appendRequestData = true |
| | | ) |
| | | public R<?> setRule(@Valid @RequestBody PricingSetRuleDTO dto) { |
| | | xpPricingService.setRule(dto); |
| | | return R.ok(); |
| | |
| | | |
| | | @DeleteMapping("/api/v1/pricing/deleteById") |
| | | @ApiOperation(value = "管理后台-定价管理-删除", tags = {"管理后台-定价管理"}) |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.PRICING_MANAGEMENT, |
| | | operationType = AdminOperationType.DELETE, |
| | | contentExpression = "'删除定价,id=' + #p0", |
| | | appendRequestData = false |
| | | ) |
| | | public R<?> deleteById(@RequestParam Long id) { |
| | | XpPricing pricing = xpPricingService.getById(id); |
| | | if (pricing == null) { |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 合作商添加计费策略 |
| | | * @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(); |
| | | } |
| | | } |