Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
Conflicts:
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserFallbackFactory.java
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderEvaluateController.java
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TOrderEvaluateMapper.java
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TOrderEvaluateService.java
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java
New file |
| | |
| | | package com.ruoyi.account.api.factory; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 门店服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class AppUserCarFallbackFactory implements FallbackFactory<AppUserCarClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(AppUserCarFallbackFactory.class); |
| | | |
| | | @Override |
| | | public AppUserCarClient create(Throwable throwable) { |
| | | log.error("用户车辆服务调用失败:{}", throwable.getMessage()); |
| | | return new AppUserCarClient() { |
| | | |
| | | @Override |
| | | public R<List<TAppUserCar>> getCarByIds(List<Integer> carIds) { |
| | | return R.fail("根据用户车辆id查询车辆信息失败:"+throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | public R<TAppUser> getUserById(Long id) { |
| | | return R.fail("根据id查询用户失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TAppUser>> getUserByIds(List<Long> appUserIds) { |
| | | return R.fail("根据用户id查询用户信息失败:"+throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.feignClient; |
| | | |
| | | import com.ruoyi.account.api.factory.AppUserCarFallbackFactory; |
| | | import com.ruoyi.account.api.factory.AppUserFallbackFactory; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户车辆服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "AppUserCarClient", value = ServiceNameConstants.ACCOUNT_SERVICE, fallbackFactory = AppUserCarFallbackFactory.class) |
| | | public interface AppUserCarClient { |
| | | |
| | | /** |
| | | * 根据用户车辆id查询车辆信息 |
| | | * @param carIds 车辆id集合 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-app-user-car/getCarByIds") |
| | | public R<List<TAppUserCar>> getCarByIds(@RequestBody List<Integer> carIds); |
| | | } |
| | |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | |
| | | @ApiOperation(value = "管理后台-根据手机号查询用户ids", tags = {"管理后台-活动费用统计"}) |
| | | @PostMapping(value = "/t-app-user/user/getUserIdsByPhone") |
| | | public R<List<Long>> getUserIdsByPhone(@RequestParam("phone") String phone); |
| | | |
| | | /** |
| | | * 根据用户id查询用户信息 |
| | | * @param appUserIds 用户id集合 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-app-user/user/getUserByIds") |
| | | public R<List<TAppUser>> getUserByIds(@RequestBody List<Long> appUserIds); |
| | | |
| | | |
| | | /** |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.factory; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 停车场服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class ParkingLotFallbackFactory implements FallbackFactory<ParkingLotClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(ParkingLotFallbackFactory.class); |
| | | |
| | | @Override |
| | | public ParkingLotClient create(Throwable throwable) { |
| | | log.error("停车场调用失败:{}", throwable.getMessage()); |
| | | return new ParkingLotClient() { |
| | | |
| | | @Override |
| | | public R<TParkingLot> getLotBySiteId(Integer siteId) { |
| | | return R.fail("通过站点id查询停车场信息调用失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.feignClient; |
| | | |
| | | import com.ruoyi.chargingPile.api.factory.ParkingLotFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 停车场服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "ParkingLotClient", value = ServiceNameConstants.CHARGINGPILE_SERVICE, fallbackFactory = ParkingLotFallbackFactory.class) |
| | | public interface ParkingLotClient { |
| | | |
| | | /** |
| | | * 通过站点id查询停车场信息 |
| | | */ |
| | | @GetMapping(value = "/t-parking-lot/getLotBySiteId") |
| | | public R<TParkingLot> getLotBySiteId(@RequestParam("siteId") Integer siteId); |
| | | |
| | | } |
| | |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/10 14:38 |
| | | */ |
| | | @FeignClient(contextId = "SiteClient", value = ServiceNameConstants.CONTRACT_SERVICE, fallbackFactory = SiteFallbackFactory.class) |
| | | @FeignClient(contextId = "SiteClient", value = ServiceNameConstants.CHARGINGPILE_SERVICE, fallbackFactory = SiteFallbackFactory.class) |
| | | public interface SiteClient { |
| | | |
| | | /** |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "StrategyPriceVO对象",description = "价格说明金额返回,会员开通金额说明") |
| | | public class StrategyPriceVO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "优惠金额") |
| | | private BigDecimal discountAmount; |
| | | |
| | | @ApiModelProperty(value = "最高优惠金额") |
| | | private BigDecimal maxDiscountAmount; |
| | | |
| | | @ApiModelProperty(value = "会员起步价") |
| | | private BigDecimal vipStartPrice; |
| | | |
| | | @ApiModelProperty(value = "服务费折扣") |
| | | private BigDecimal serviceFeeDiscount; |
| | | |
| | | } |
| | |
| | | @TableField("app_user_id") |
| | | private Long appUserId; |
| | | |
| | | @ApiModelProperty(value = "充电车辆 id") |
| | | @TableField("app_user_car_id") |
| | | private Integer appUserCarId; |
| | | |
| | | @ApiModelProperty(value = "评分") |
| | | @TableField("mark") |
| | | private Integer mark; |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "SiteDetailEvaluateVO对象",description = "站点详情订单评价") |
| | | public class SiteDetailEvaluateVO extends TOrderEvaluate { |
| | | |
| | | @ApiModelProperty(value = "好评率") |
| | | private BigDecimal reviewRate; |
| | | |
| | | @ApiModelProperty(value = "评价数") |
| | | private Integer evaluateCount; |
| | | |
| | | @ApiModelProperty(value = "评价列表取三条") |
| | | private List<TOrderEvaluateVO> orderEvaluateVOS; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.model.TOrderEvaluateTag; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TOrderEvaluateVO对象",description = "订单评价") |
| | |
| | | @ApiModelProperty(value = "头像") |
| | | private String avatar; |
| | | |
| | | @ApiModelProperty(value = "车辆品牌名称") |
| | | private String carName; |
| | | |
| | | @ApiModelProperty(value = "评价标签列表") |
| | | private List<TOrderEvaluateTag> orderEvaluateTags; |
| | | |
| | | } |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | |
| | | |
| | | @ApiModelProperty(value = "月卡价格") |
| | | @TableField("monthly_card") |
| | | private Double monthlyCard; |
| | | private BigDecimal monthlyCard; |
| | | |
| | | @ApiModelProperty(value = "月卡显示(0=否,1=是)") |
| | | @TableField("monthly_card_reveal") |
| | |
| | | |
| | | @ApiModelProperty(value = "月卡折扣") |
| | | @TableField("monthly_card_discount") |
| | | private Double monthlyCardDiscount; |
| | | private BigDecimal monthlyCardDiscount; |
| | | |
| | | @ApiModelProperty(value = "月卡折扣开始时间") |
| | | @TableField("monthly_card_discount_start") |
| | |
| | | |
| | | @ApiModelProperty(value = "季卡价格") |
| | | @TableField("season_card") |
| | | private Double seasonCard; |
| | | private BigDecimal seasonCard; |
| | | |
| | | @ApiModelProperty(value = "季卡显示(0=否,1=是)") |
| | | @TableField("season_card_reveal") |
| | |
| | | |
| | | @ApiModelProperty(value = "季卡折扣") |
| | | @TableField("season_card_discount") |
| | | private Double seasonCardDiscount; |
| | | private BigDecimal seasonCardDiscount; |
| | | |
| | | @ApiModelProperty(value = "季卡折扣开始时间") |
| | | @TableField("season_card_discount_start") |
| | |
| | | |
| | | @ApiModelProperty(value = "年卡价格") |
| | | @TableField("annual_card") |
| | | private Double annualCard; |
| | | private BigDecimal annualCard; |
| | | |
| | | @ApiModelProperty(value = "年卡显示(0=否,1=是)") |
| | | @TableField("annual_card_reveal") |
| | |
| | | |
| | | @ApiModelProperty(value = "年卡折扣") |
| | | @TableField("annual_card_discount") |
| | | private Double annualCardDiscount; |
| | | private BigDecimal annualCardDiscount; |
| | | |
| | | @ApiModelProperty(value = "年卡折扣开始时间") |
| | | @TableField("annual_card_discount_start") |
| | |
| | | |
| | | @ApiModelProperty(value = "最高抵扣金额") |
| | | @TableField("maximum_deduction") |
| | | private Double maximumDeduction; |
| | | private BigDecimal maximumDeduction; |
| | | |
| | | @ApiModelProperty(value = "抵扣类型(1=服务费)") |
| | | @TableField("deduction_type") |
New file |
| | |
| | | package com.ruoyi.other.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 会员服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class VipFallbackFactory implements FallbackFactory<VipClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(VipFallbackFactory.class); |
| | | |
| | | @Override |
| | | public VipClient create(Throwable throwable) { |
| | | log.error("会员调用失败:{}", throwable.getMessage()); |
| | | return new VipClient() { |
| | | |
| | | @Override |
| | | public R<TVip> getVipInfoByType(Integer type) { |
| | | return R.fail("获取最高抵扣、最低起步价,最高折扣的会员失败:" + throwable.getMessage()); |
| | | |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.factory.VipFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * 会员服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "VipClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = VipFallbackFactory.class) |
| | | public interface VipClient { |
| | | |
| | | /** |
| | | * 获取最高抵扣、最低起步价,最高折扣的会员 |
| | | * @param type 1=最高抵扣、2=最低起步价,3=最高折扣 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/vip/getVipInfoByType") |
| | | R<TVip> getVipInfoByType(@RequestParam Integer type); |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.account.service.TAppUserCarService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-app-user-car") |
| | | public class TAppUserCarController { |
| | | |
| | | @Autowired |
| | | private TAppUserCarService appUserCarService; |
| | | |
| | | /** |
| | | * 根据用户车辆id查询车辆信息 |
| | | * @param carIds |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-app-user-car/getCarByIds") |
| | | public R<List<TAppUserCar>> getCarByIds(@RequestBody List<Integer> carIds){ |
| | | return R.ok(appUserCarService.list(Wrappers.lambdaQuery(TAppUserCar.class).in(TAppUserCar::getId,carIds))); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.dto.*; |
| | | import com.ruoyi.account.api.model.*; |
| | |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户id查询用户信息 |
| | | * @param appUserIds 用户id |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/user/getUserByIds") |
| | | public R<List<TAppUser>> getUserByIds(@RequestBody List<Long> appUserIds){ |
| | | return R.ok(appUserService.list(Wrappers.<TAppUser>lambdaQuery().in(TAppUser::getId,appUserIds))); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据用户id获取用户 |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.query.GetSiteList; |
| | | import com.ruoyi.chargingPile.api.query.SiteDetailQuery; |
| | | import com.ruoyi.chargingPile.api.query.SiteQuery; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | @Resource |
| | | private ParkingLotClient parkingLotClient; |
| | | @Resource |
| | | private TChargingPileService chargingPileService; |
| | | @Resource |
| | |
| | | // 计算距离 |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(query.getLat() + "," + query.getLon(), siteDetailVO.getLat() + "," + siteDetailVO.getLon()); |
| | | siteDetailVO.setDistance(distance.get("WGS84")); |
| | | // TODO 查询绑定车牌提示文案 |
| | | // 查询绑定车牌提示文案 |
| | | TParkingLot parkingLot = parkingLotClient.getLotBySiteId(query.getSiteId()).getData(); |
| | | if(Objects.nonNull(parkingLot)){ |
| | | siteDetailVO.setRemark(parkingLot.getRemark()); |
| | | } |
| | | return AjaxResult.success(siteDetailVO); |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.vo.StrategyPriceVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyDetailService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyService; |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | /** |
| | | * 通过电站id查询计费策略明细列表 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-计费策略"},value = "通过站点id查询计费策略明细列表") |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "通过站点id查询计费策略明细列表") |
| | | @GetMapping(value = "/queryAccountingStrategyDetailBySiteId") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailBySiteId(@RequestParam Integer siteId) { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | |
| | | if(Objects.isNull(accountingStrategy)){ |
| | | throw new ServiceException("未查询到计费策略"); |
| | | } |
| | | // TODO 修改 |
| | | List<TAccountingStrategyDetailVO> list = accountingStrategyDetailService.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId()); |
| | | list.forEach(detail -> { |
| | | detail.setTotalPrice(detail.getElectrovalence().add(detail.getElectrovalence())); |
| | | }); |
| | | return AjaxResult.ok(list); |
| | | return AjaxResult.ok(accountingStrategyDetailService.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId())); |
| | | } |
| | | |
| | | /** |
| | | * 通过站点id查询当前时间段计费策略展示 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "通过站点id查询当前时间段计费策略展示") |
| | | @GetMapping(value = "/queryStrategyBySiteIdAndTime") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryStrategyBySiteIdAndTime(@RequestParam Integer siteId) { |
| | | return AjaxResult.ok(accountingStrategyDetailService.queryStrategyBySiteIdAndTime(siteId)); |
| | | } |
| | | |
| | | /** |
| | | * 价格说明金额返回,会员开通金额说明 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "价格说明金额返回,会员开通金额说明") |
| | | @GetMapping(value = "/queryPrice") |
| | | public AjaxResult<StrategyPriceVO> queryPrice(@RequestParam Integer siteId) { |
| | | return AjaxResult.ok(accountingStrategyDetailService.queryPrice(siteId)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.service.TCarportService; |
| | | import com.ruoyi.chargingPile.service.TParkingLotService; |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | |
| | | .in(TCarport::getParkingLotId, ids)); |
| | | return AjaxResult.ok(parkingLotService.removeByIds(ids)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过站点id查询停车场信息 |
| | | */ |
| | | @GetMapping(value = "/getLotBySiteId") |
| | | public R<TParkingLot> getLotBySiteId(@RequestParam("siteId") Integer siteId){ |
| | | return R.ok(parkingLotService.getOne(Wrappers.lambdaQuery(TParkingLot.class) |
| | | .eq(TParkingLot::getSiteId, siteId))); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.chargingPile.api.vo.StrategyPriceVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | |
| | | import java.util.List; |
| | |
| | | * @return |
| | | */ |
| | | List<TAccountingStrategyDetailVO> queryAccountingStrategyDetailByStrategyId(Integer strategyId); |
| | | |
| | | |
| | | /** |
| | | * 通过站点id查询当前时间段计费策略展示 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | List<TAccountingStrategyDetailVO> queryStrategyBySiteIdAndTime(Integer siteId); |
| | | |
| | | /** |
| | | * 价格说明金额返回,会员开通金额说明 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | StrategyPriceVO queryPrice(Integer siteId); |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.chargingPile.api.vo.StrategyPriceVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | import com.ruoyi.chargingPile.mapper.TAccountingStrategyDetailMapper; |
| | | import com.ruoyi.chargingPile.mapper.TAccountingStrategyMapper; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyDetailService; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TAccountingStrategyDetailServiceImpl extends ServiceImpl<TAccountingStrategyDetailMapper, TAccountingStrategyDetail> implements TAccountingStrategyDetailService { |
| | | |
| | | @Autowired |
| | | private TAccountingStrategyMapper accountingStrategyMapper; |
| | | @Autowired |
| | | private VipClient vipClient; |
| | | |
| | | @Override |
| | | public List<TAccountingStrategyDetailVO> queryAccountingStrategyDetailByStrategyId(Integer strategyId) { |
| | | return this.baseMapper.queryAccountingStrategyDetailByStrategyId(strategyId); |
| | | } |
| | | |
| | | @Override |
| | | public List<TAccountingStrategyDetailVO> queryStrategyBySiteIdAndTime(Integer siteId) { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyMapper.selectOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .eq(TAccountingStrategy::getSiteId, siteId) |
| | | .last("limit 1")); |
| | | if(Objects.isNull(accountingStrategy)){ |
| | | throw new ServiceException("未查询到计费策略"); |
| | | } |
| | | List<TAccountingStrategyDetailVO> list = this.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId()); |
| | | // 获取当前时间段的计费策略明细 |
| | | TAccountingStrategyDetailVO accountingStrategyDetailVO = list.stream().filter(detail -> detail.getStartTime().compareTo(LocalTime.now().toString()) <= 0 && detail.getEndTime().compareTo(LocalTime.now().toString()) >= 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("当前时间段未查询到计费策略明细")); |
| | | accountingStrategyDetailVO.setDiscount(accountingStrategy.getDiscount()); |
| | | // 获取后一次的计费策略明细 |
| | | TAccountingStrategyDetailVO accountingStrategyDetailNext = list.stream().filter(detail -> detail.getStartTime().compareTo(accountingStrategyDetailVO.getEndTime()) == 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("未查询到下一时间段的计费策略明细")); |
| | | accountingStrategyDetailNext.setDiscount(accountingStrategy.getDiscount()); |
| | | list = new ArrayList<>(); |
| | | list.add(accountingStrategyDetailVO); |
| | | list.add(accountingStrategyDetailNext); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public StrategyPriceVO queryPrice(Integer siteId) { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyMapper.selectOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .eq(TAccountingStrategy::getSiteId, siteId) |
| | | .last("limit 1")); |
| | | if(Objects.isNull(accountingStrategy)){ |
| | | throw new ServiceException("未查询到计费策略"); |
| | | } |
| | | |
| | | StrategyPriceVO strategyPriceVO = new StrategyPriceVO(); |
| | | |
| | | List<TAccountingStrategyDetailVO> list = this.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId()); |
| | | // 获取当前时间段的计费策略明细 |
| | | TAccountingStrategyDetailVO accountingStrategyDetailVO = list.stream().filter(detail -> detail.getStartTime().compareTo(LocalTime.now().toString()) <= 0 && detail.getEndTime().compareTo(LocalTime.now().toString()) >= 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("当前时间段未查询到计费策略明细")); |
| | | strategyPriceVO.setDiscountAmount(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()) |
| | | .subtract(accountingStrategyDetailVO.getServiceCharge().multiply(accountingStrategy.getDiscount())).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | // 查询最高抵扣的会员 |
| | | TVip maximumDeduction = vipClient.getVipInfoByType(1).getData(); |
| | | strategyPriceVO.setMaxDiscountAmount(maximumDeduction.getMaximumDeduction()); |
| | | // 查询最低起步价会员 |
| | | TVip monthlyCard = vipClient.getVipInfoByType(2).getData(); |
| | | strategyPriceVO.setVipStartPrice(monthlyCard.getMonthlyCard()); |
| | | // 查询最高折扣的会员 |
| | | TVip monthlyCardDiscount = vipClient.getVipInfoByType(3).getData(); |
| | | strategyPriceVO.setServiceFeeDiscount(monthlyCardDiscount.getMonthlyCardDiscount()); |
| | | return strategyPriceVO; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.query.TOrderEvaluateQuery; |
| | | import com.ruoyi.order.api.vo.SiteDetailEvaluateVO; |
| | | import com.ruoyi.order.api.vo.TOrderEvaluateVO; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageList; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO; |
| | |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(tags = {"小程序-订单评价"},value = "电站详情中评价列表查询") |
| | | @GetMapping(value = "/getSiteDetailEveList") |
| | | public AjaxResult<SiteDetailEvaluateVO> getSiteDetailEveList(@RequestParam(value = "siteId")@ApiParam(value = "站点id")Integer siteId) { |
| | | return AjaxResult.ok(orderEvaluateService.getSiteDetailEveList(siteId)); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | List<GetOrderEvaluatePageListDTO> getPageList(@Param("query") GetOrderEvaluatePageList pageList, @Param("evaluationTagIds") List<Integer> evaluationTagIds, |
| | | PageInfo<GetOrderEvaluatePageListDTO> pageInfo); |
| | | |
| | | /** |
| | | * 查询站点下的所有订单评价 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | List<TOrderEvaluateVO> getOrderEvaluateBySiteId(@Param("siteId")Integer siteId); |
| | | } |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.query.TOrderEvaluateQuery; |
| | | import com.ruoyi.order.api.vo.SiteDetailEvaluateVO; |
| | | import com.ruoyi.order.api.vo.TOrderEvaluateVO; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageList; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO; |
| | |
| | | * @return |
| | | */ |
| | | PageInfo<TOrderEvaluateVO> getTagList(TOrderEvaluateQuery query); |
| | | |
| | | /** |
| | | * 电站详情中评价列表查询 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | SiteDetailEvaluateVO getSiteDetailEveList(Integer siteId); |
| | | |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.model.TOrderEvaluateTag; |
| | | import com.ruoyi.order.api.query.TOrderEvaluateQuery; |
| | | import com.ruoyi.order.api.vo.SiteDetailEvaluateVO; |
| | | import com.ruoyi.order.api.vo.TOrderEvaluateVO; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageList; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @Resource |
| | | private TEvaluationTagClient evaluationTagClient; |
| | | @Resource |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | @Autowired |
| | | private AppUserCarClient appUserCarClient; |
| | | @Autowired |
| | | private TOrderEvaluateTagMapper orderEvaluateTagMapper; |
| | | @Resource |
| | | private TChargingOrderMapper chargingOrderMapper; |
| | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private TOrderEvaluateMapper orderEvaluateMapper; |
| | | @Override |
| | | public List<TEvaluationTagVO> getTagCount() { |
| | | // 查询标签列表 |
| | |
| | | List<Long> orderIds = tChargingOrders.stream().map(TChargingOrder::getId).collect(Collectors.toList()); |
| | | query.setOrderIds(orderIds); |
| | | List<TOrderEvaluateVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | // 查询用户信息 |
| | | List<TAppUser> appUsers = appUserClient.getUserByIds(list.stream().map(TOrderEvaluateVO::getAppUserId).collect(Collectors.toList())).getData(); |
| | | // 查询用户绑定车辆品牌 |
| | | List<TAppUserCar> appUserCars = appUserCarClient.getCarByIds(list.stream().map(TOrderEvaluateVO::getAppUserCarId).collect(Collectors.toList())).getData(); |
| | | list.forEach(orderEvaluateVO -> { |
| | | TAppUser appUser = appUsers.stream().filter(user -> user.getId().equals(orderEvaluateVO.getAppUserId())).findFirst().orElse(null); |
| | | if(Objects.nonNull(appUser)){ |
| | | orderEvaluateVO.setName(appUser.getName()); |
| | | orderEvaluateVO.setAvatar(appUser.getAvatar()); |
| | | } |
| | | TAppUserCar appUserCar = appUserCars.stream().filter(car -> car.getId().equals(Long.parseLong(String.valueOf(orderEvaluateVO.getAppUserCarId())))).findFirst().orElse(null); |
| | | if(Objects.nonNull(appUserCar)){ |
| | | orderEvaluateVO.setCarName(appUserCar.getVehicleBrand()); |
| | | } |
| | | }); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public SiteDetailEvaluateVO getSiteDetailEveList(Integer siteId) { |
| | | SiteDetailEvaluateVO siteDetailEvaluateVO = new SiteDetailEvaluateVO(); |
| | | // 查询站点下的所有订单评价 |
| | | List<TOrderEvaluateVO> tChargingOrders = orderEvaluateMapper.getOrderEvaluateBySiteId(siteId); |
| | | if(!CollectionUtils.isEmpty(tChargingOrders)){ |
| | | siteDetailEvaluateVO.setOrderEvaluateVOS(tChargingOrders); |
| | | // 统计好评率 |
| | | long goodCount = tChargingOrders.stream().filter(orderEvaluateVO -> orderEvaluateVO.getMark()>=4).count(); |
| | | BigDecimal reviewRate = new BigDecimal(goodCount).divide(new BigDecimal(tChargingOrders.size())).setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | siteDetailEvaluateVO.setReviewRate(reviewRate); |
| | | siteDetailEvaluateVO.setEvaluateCount(tChargingOrders.size()); |
| | | siteDetailEvaluateVO.setOrderEvaluateVOS(tChargingOrders.stream().limit(3).collect(Collectors.toList())); |
| | | } |
| | | return siteDetailEvaluateVO; |
| | | } |
| | | |
| | | /** |
| | | * 统计有图,好评,中差评数量 |
| | | * @param count |
| | |
| | | <result column="order_type" property="orderType" /> |
| | | <result column="order_id" property="orderId" /> |
| | | <result column="app_user_id" property="appUserId" /> |
| | | <result column="app_user_car_id" property="appUserCarId" /> |
| | | <result column="mark" property="mark" /> |
| | | <result column="content" property="content" /> |
| | | <result column="img_url" property="imgUrl" /> |
| | |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, order_type, order_id, app_user_id, mark, content, img_url, evaluation_response, create_time, response_time, del_flag |
| | | id, order_type, order_id, app_user_id,app_user_car_id, mark, content, img_url, evaluation_response, create_time, response_time, del_flag |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.order.api.vo.TOrderEvaluateVO"> |
| | | select id, order_type, order_id, app_user_id, mark, content, img_url, evaluation_response, |
| | | select id, order_type, order_id, app_user_id,app_user_car_id, mark, content, img_url, evaluation_response, |
| | | create_time, response_time, del_flag |
| | | from t_order_evaluate where id in |
| | | (select toe.id |
| | |
| | | create_time DESC; |
| | | </if> |
| | | </select> |
| | | <select id="getOrderEvaluateBySiteId" resultType="com.ruoyi.order.api.vo.TOrderEvaluateVO"> |
| | | select id, order_type, order_id, app_user_id,app_user_car_id, mark, content, img_url, evaluation_response, |
| | | create_time, response_time, del_flag |
| | | from t_order_evaluate toe |
| | | where toe.order_id in |
| | | (select toc.order_id |
| | | from t_charging_order toc |
| | | where toc.site_id = #{siteId} |
| | | and toc.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}) |
| | | </select> |
| | | |
| | | |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | return R.ok(idNameMap); |
| | | } |
| | | |
| | | /** |
| | | * 获取最高抵扣、最低起步价,最高折扣的会员 |
| | | * @param type 1=最高抵扣、2=最低起步价,3=最高折扣 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getVipInfoByType") |
| | | public R<TVip> getVipInfoByType(@RequestParam Integer type){ |
| | | switch (type){ |
| | | case 1: |
| | | return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class) |
| | | .eq(TVip::getReveal,1) |
| | | .orderByDesc(TVip::getMaximumDeduction) |
| | | .last("LIMIT 1"))); |
| | | case 2: |
| | | return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class) |
| | | .eq(TVip::getReveal,1) |
| | | .orderByAsc(TVip::getMonthlyCard) |
| | | .last("LIMIT 1"))); |
| | | default: |
| | | return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class) |
| | | .eq(TVip::getReveal,1) |
| | | .orderByDesc(TVip::getMonthlyCardDiscount) |
| | | .last("LIMIT 1"))); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |