New file |
| | |
| | | package com.ruoyi.account.api.factory; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserAddressClient; |
| | | import com.ruoyi.account.api.model.TAppUserAddress; |
| | | import com.ruoyi.account.api.model.TAppUserIntegralChange; |
| | | 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; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/16 11:02 |
| | | */ |
| | | @Component |
| | | public class AppUserAddressFallbackFactory implements FallbackFactory<AppUserAddressClient> { |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(AppUserAddressFallbackFactory.class); |
| | | |
| | | |
| | | @Override |
| | | public AppUserAddressClient create(Throwable throwable) { |
| | | log.error("用户地址调用失败:{}", throwable.getMessage()); |
| | | return new AppUserAddressClient(){ |
| | | |
| | | @Override |
| | | public R<TAppUserAddress> getAppUserAddressById(Long id) { |
| | | return R.fail("根据id获取用户地址信息失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | return new AppUserCarClient() { |
| | | |
| | | @Override |
| | | public R<List<TAppUserCar>> getCarByIds(List<Integer> carIds) { |
| | | public R<List<TAppUserCar>> getCarByIds(List<Long> carIds) { |
| | | return R.fail("根据用户车辆id查询车辆信息失败:"+throwable.getMessage()); |
| | | } |
| | | }; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R updateAppUser(TAppUser appUser) { |
| | | return R.fail("修改用户失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TAppUser>> getUserByIds(List<Long> appUserIds) { |
| | | return R.fail("根据用户id查询用户信息失败:"+throwable.getMessage()); |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.factory; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserIntegralChangeClient; |
| | | import com.ruoyi.account.api.model.TAppUserIntegralChange; |
| | | 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; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/16 11:02 |
| | | */ |
| | | @Component |
| | | public class AppUserIntegralChangeFallbackFactory implements FallbackFactory<AppUserIntegralChangeClient> { |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(AppUserIntegralChangeFallbackFactory.class); |
| | | |
| | | |
| | | @Override |
| | | public AppUserIntegralChangeClient create(Throwable throwable) { |
| | | log.error("账户积分变动调用失败:{}", throwable.getMessage()); |
| | | return new AppUserIntegralChangeClient(){ |
| | | |
| | | @Override |
| | | public R addAppUserIntegralChange(TAppUserIntegralChange appUserIntegralChange) { |
| | | return R.fail("添加积分变动记录失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.feignClient; |
| | | |
| | | import com.ruoyi.account.api.factory.AppUserAddressFallbackFactory; |
| | | import com.ruoyi.account.api.model.TAppUserAddress; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/16 14:47 |
| | | */ |
| | | @FeignClient(contextId = "AppUserAddressClient", value = ServiceNameConstants.ACCOUNT_SERVICE, fallbackFactory = AppUserAddressFallbackFactory.class) |
| | | public interface AppUserAddressClient { |
| | | |
| | | |
| | | /** |
| | | * 根据id获取用户地址信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-app-user-address/getAppUserAddressById") |
| | | R<TAppUserAddress> getAppUserAddressById(Long id); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-app-user-car/getCarByIds") |
| | | public R<List<TAppUserCar>> getCarByIds(@RequestBody List<Integer> carIds); |
| | | public R<List<TAppUserCar>> getCarByIds(@RequestBody List<Long> carIds); |
| | | } |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/user/getUserById") |
| | | @PostMapping(value = "/t-app-user/user/getUserById") |
| | | R<TAppUser> getUserById(Long id); |
| | | |
| | | |
| | | |
| | | @PostMapping("/t-app-user/") |
| | | R updateAppUser(TAppUser appUser); |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.feignClient; |
| | | |
| | | import com.ruoyi.account.api.factory.AppUserIntegralChangeFallbackFactory; |
| | | import com.ruoyi.account.api.model.TAppUserIntegralChange; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/16 11:01 |
| | | */ |
| | | @FeignClient(contextId = "AppUserIntegralChangeClient", value = ServiceNameConstants.ACCOUNT_SERVICE, fallbackFactory = AppUserIntegralChangeFallbackFactory.class) |
| | | public interface AppUserIntegralChangeClient { |
| | | |
| | | /** |
| | | * 添加积分变动记录 |
| | | * @param appUserIntegralChange |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-app-user-integral-change/addAppUserIntegralChange") |
| | | R addAppUserIntegralChange(TAppUserIntegralChange appUserIntegralChange); |
| | | } |
| | |
| | | com.ruoyi.account.api.factory.AppUserFallbackFactory |
| | | com.ruoyi.account.api.factory.AppCouponFallbackFactory |
| | | com.ruoyi.account.api.factory.AppUserCarFallbackFactory |
| | | com.ruoyi.account.api.factory.AppUserCarFallbackFactory |
| | | com.ruoyi.account.api.factory.AppUserIntegralChangeFallbackFactory |
| | | com.ruoyi.account.api.factory.AppUserAddressFallbackFactory |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.factory; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | 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 ChargingGunFallbackFactory implements FallbackFactory<ChargingGunClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(ChargingGunFallbackFactory.class); |
| | | |
| | | @Override |
| | | public ChargingGunClient create(Throwable throwable) { |
| | | log.error("充电枪调用失败:{}", throwable.getMessage()); |
| | | return new ChargingGunClient() { |
| | | |
| | | @Override |
| | | public R<String> getAllName(Integer id) { |
| | | return R.fail("根据id获取充电枪完整名称失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TChargingGun> getChargingGunById(Integer id) { |
| | | return R.fail("根据id获取充电枪失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.feignClient; |
| | | |
| | | import com.ruoyi.chargingPile.api.factory.ChargingGunFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/15 19:36 |
| | | */ |
| | | @FeignClient(contextId = "ChargingGunClient", value = ServiceNameConstants.CHARGINGPILE_SERVICE, fallbackFactory = ChargingGunFallbackFactory.class) |
| | | public interface ChargingGunClient { |
| | | |
| | | /** |
| | | * 根据id获取充电枪完整名称 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-charging-gun/getAllName") |
| | | R<String> getAllName(Integer id); |
| | | |
| | | |
| | | /** |
| | | * 根据id获取充电枪 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-charging-gun/getChargingGunById") |
| | | R<TChargingGun> getChargingGunById(Integer id); |
| | | } |
| | |
| | | /** |
| | | * 通过站点id查询停车场信息 |
| | | */ |
| | | @GetMapping(value = "/t-parking-lot/getLotBySiteId") |
| | | @PostMapping(value = "/t-parking-lot/getLotBySiteId") |
| | | public R<TParkingLot> getLotBySiteId(@RequestParam("siteId") Integer siteId); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.vo; |
| | | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "SiteVO对象", description = "小程序扫一扫-详情页面") |
| | | public class SiteInfoVO { |
| | | @ApiModelProperty(value = "电站名称") |
| | | private String name; |
| | | @ApiModelProperty(value = "桩编号") |
| | | private String number; |
| | | @ApiModelProperty(value = "普通电价") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "会员电价") |
| | | private BigDecimal vipElectrovalence; |
| | | @ApiModelProperty(value = "超时占位费说明") |
| | | private String spaceChargeExplain; |
| | | } |
| | |
| | | com.ruoyi.chargingPile.api.factory.ChargingPileFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.SiteFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.ParkingLotFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.ParkingLotFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.ChargingGunFallbackFactory |
| | |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * 充电订单服务降级处理 |
| | |
| | | public ChargingOrderAccountingStrategyClient create(Throwable throwable) { |
| | | log.error("充电订单调用失败:{}", throwable.getMessage()); |
| | | return new ChargingOrderAccountingStrategyClient() { |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public R<List<List<Map<String, Object>>>> getTotalElectricQuantity(Integer days) { |
| | | public R<List<List<Map<String, Object>>>> getTotalElectricQuantity(Integer days, Set<Integer> siteIds) { |
| | | return R.fail("获取给定天数每天的充电量统计数据失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<List<Double>> getDailyChargingDegree(Integer days) { |
| | | public R<List<Double>> getDailyChargingDegree(Integer days, Set<Integer> siteIds) { |
| | | return R.fail("获取给定天数每天的充电度数失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | |
| | | public R<Integer> getChargingCount(TChargingCountQuery req) { |
| | | return R.fail("根据会员id和有效期查询有效期内享受充电折扣次数:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TChargingOrder> getOrderDetailByGunId(Integer chargingGunId) { |
| | | return R.fail("根据充电枪获取正在充电的订单:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.order.api.factory.ChargingOrderFallbackFactory; |
| | | 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; |
| | |
| | | * @param days 天数 |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-charging-order-accounting-strategy/getTotalElectricQuantity") |
| | | @PostMapping("/t-charging-order-accounting-strategy/getTotalElectricQuantity") |
| | | R<List<List<Map<String, Object>>>> getTotalElectricQuantity(Integer days, @RequestParam("siteIds") Set<Integer> siteIds); |
| | | |
| | | |
| | |
| | | * @param days |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-charging-order-getDailyChargingDegree-strategy/getUtilizationTrend") |
| | | @PostMapping("/t-charging-order-getDailyChargingDegree-strategy/getUtilizationTrend") |
| | | R<List<Double>> getDailyChargingDegree(Integer days, @RequestParam("siteIds") Set<Integer> siteIds); |
| | | } |
| | |
| | | * @param chargingGunId 充电枪id |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/t-charging-order/getOrderDetailByGunId") |
| | | @PostMapping(value = "/t-charging-order/getOrderDetailByGunId") |
| | | R<TChargingOrder> getOrderDetailByGunId(@RequestParam("chargingGunId") Integer chargingGunId); |
| | | } |
| | |
| | | @ApiModelProperty(value = "状态(0=未知,1=等待中,2=启动中,3=充电中,4=停止中,5=已结束)") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "结束方式(0=异常终止,1=主动终止,2=满电终止,3=费用不足终止)") |
| | | @TableField("end_mode") |
| | | private Integer endMode; |
| | | |
| | | @ApiModelProperty(value = "充值金额") |
| | | @TableField("recharge_amount") |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "订单类型(1=充电订单,2=购物订单,3=兑换订单,4=会员订单)") |
| | |
| | | |
| | | @ApiModelProperty(value = "充电车辆 id") |
| | | @TableField("app_user_car_id") |
| | | private Integer appUserCarId; |
| | | private Long appUserCarId; |
| | | |
| | | @ApiModelProperty(value = "评分") |
| | | @TableField("mark") |
| | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | |
| | | @ApiModelProperty(value = "封面图") |
| | | @TableField("cover_picture") |
| | | private String coverPicture; |
| | | |
| | | @ApiModelProperty(value = "详情图片") |
| | | @TableField("details_picture") |
| | | private String detailsPicture; |
| | | |
| | | @ApiModelProperty(value = "优惠方式(1=满减,2=抵扣)") |
| | | @TableField("preferential_mode") |
| | | private Integer preferentialMode; |
| | |
| | | @ApiModelProperty(value = "优惠券说明") |
| | | @TableField("explain") |
| | | private String explain; |
| | | |
| | | @ApiModelProperty(value = "封面图") |
| | | @TableField("cover_picture") |
| | | private String coverPicture; |
| | | @ApiModelProperty(value = "详情图片") |
| | | @TableField("details_picture") |
| | | private String detailsPicture; |
| | | |
| | | @ApiModelProperty(value = "说明") |
| | | @TableField("remark") |
New file |
| | |
| | | package com.ruoyi.other.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.api.feignClient.CouponClient; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/16 13:48 |
| | | */ |
| | | @Component |
| | | public class CouponFallbackFactory implements FallbackFactory<CouponClient> { |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(CouponFallbackFactory.class); |
| | | |
| | | @Override |
| | | public CouponClient create(Throwable throwable) { |
| | | log.error("优惠券调用失败:{}", throwable.getMessage()); |
| | | return new CouponClient() { |
| | | |
| | | @Override |
| | | public R<TCoupon> getCouponById(Integer id) { |
| | | return R.fail("根据id获取优惠券信息失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/16 13:48 |
| | | */ |
| | | @Component |
| | | public class GoodsFallbackFactory implements FallbackFactory<GoodsClient> { |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(GoodsFallbackFactory.class); |
| | | |
| | | @Override |
| | | public GoodsClient create(Throwable throwable) { |
| | | log.error("商品调用失败:{}", throwable.getMessage()); |
| | | return new GoodsClient() { |
| | | |
| | | @Override |
| | | public R<TGoods> getGoodsById(Integer id) { |
| | | return R.fail("根据id获取商品信息失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.factory; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.dto.TagListQueryDto; |
| | | import com.ruoyi.account.api.dto.UnitListQueryDto; |
| | | import com.ruoyi.account.api.vo.CouponListVOVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TCompany; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | | import com.ruoyi.other.api.feignClient.IntegralRuleClient; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 商品服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class IntegralRuleFallbackFactory implements FallbackFactory<IntegralRuleClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(IntegralRuleFallbackFactory.class); |
| | | |
| | | @Override |
| | | public IntegralRuleClient create(Throwable throwable) { |
| | | log.error("积分规则调用失败:{}", throwable.getMessage()); |
| | | return new IntegralRuleClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<TIntegralRule> getSet() { |
| | | 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.TCoupon; |
| | | import com.ruoyi.other.api.factory.CouponFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/16 14:00 |
| | | */ |
| | | @FeignClient(contextId = "CouponClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = CouponFallbackFactory.class) |
| | | public interface CouponClient { |
| | | |
| | | |
| | | /** |
| | | * 根据id获取优惠券信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-coupon/getCouponById") |
| | | R<TCoupon> getCouponById(Integer id); |
| | | } |
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.TGoods; |
| | | import com.ruoyi.other.api.factory.GoodsFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/16 13:47 |
| | | */ |
| | | @FeignClient(contextId = "GoodsClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = GoodsFallbackFactory.class) |
| | | public interface GoodsClient { |
| | | |
| | | /** |
| | | * 根据id获取商品信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-goods/getGoodsById") |
| | | R<TGoods> getGoodsById(Integer id); |
| | | } |
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.TIntegralRule; |
| | | import com.ruoyi.other.api.factory.IntegralRuleFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/16 10:54 |
| | | */ |
| | | @FeignClient(contextId = "IntegralRuleClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = IntegralRuleFallbackFactory.class) |
| | | public interface IntegralRuleClient { |
| | | |
| | | /** |
| | | * 获取积分设置 |
| | | * @return |
| | | */ |
| | | @PostMapping("/integral/getSet") |
| | | R<TIntegralRule> getSet(); |
| | | } |
| | |
| | | * @param roleId |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-role-site/getSiteIds") |
| | | @PostMapping("/t-role-site/getSiteIds") |
| | | R<List<Integer>> getSiteIds(Long roleId); |
| | | |
| | | |
| | |
| | | * @param tagIds |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-evaluation-tag/getListByIds") |
| | | @PostMapping("/t-evaluation-tag/getListByIds") |
| | | R<List<TEvaluationTag>> getListByIds(List<Integer> tagIds); |
| | | } |
| | |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-user-site/getSiteIds") |
| | | @PostMapping("/t-user-site/getSiteIds") |
| | | R<List<Integer>> getSiteIds(Long userId); |
| | | |
| | | |
| | |
| | | com.ruoyi.other.api.factory.UserSiteFallbackFactory |
| | | com.ruoyi.other.api.factory.RoleSiteFallbackFactory |
| | | com.ruoyi.other.api.factory.TEvaluationTagFallbackFactory |
| | | com.ruoyi.other.api.factory.VipFallbackFactory |
| | | com.ruoyi.other.api.factory.VipFallbackFactory |
| | | com.ruoyi.other.api.factory.IntegralRuleFallbackFactory |
| | | com.ruoyi.other.api.factory.GoodsFallbackFactory |
| | | com.ruoyi.other.api.factory.CouponFallbackFactory |
| | |
| | | import com.ruoyi.system.api.model.GetSysRoleByIds; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | @FeignClient(contextId = "SysRoleClient", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = SysRoleFallbackFactory.class) |
| | | public interface SysRoleClient { |
| | | |
| | | @GetMapping("/role/getSysRoleByIds") |
| | | @PostMapping("/role/getSysRoleByIds") |
| | | public R<List<SysRole>> getSysRoleByIds(GetSysRoleByIds ids); |
| | | |
| | | } |
| | |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @GetMapping("/user/queryRoleByUserId/{userId}") |
| | | @PostMapping("/user/queryRoleByUserId/{userId}") |
| | | R<SysRole> queryRoleByUserId(@PathVariable("userId") Long userId); |
| | | |
| | | |
| | |
| | | * @param roleId |
| | | * @return |
| | | */ |
| | | @GetMapping("/user/queryRoleByRoleId/{roleId}") |
| | | @PostMapping("/user/queryRoleByRoleId/{roleId}") |
| | | R<SysRole> queryRoleByRoleId(@PathVariable("roleId") Long roleId); |
| | | |
| | | /** |
| | |
| | | * 登录IP地址 |
| | | */ |
| | | private String ipaddr; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("token",tokenService.createToken(userInfo)); |
| | | List<SysRole> roles = userInfo.getSysUser().getRoles(); |
| | | if(CollectionUtils.isEmpty(roles)){ |
| | | return R.fail("请关联角色!"); |
| | | } |
| | | // if(CollectionUtils.isEmpty(roles)){ |
| | | // return R.fail("请关联角色!"); |
| | | // } |
| | | |
| | | map.put("roleName",roles.get(0).getRoleName()); |
| | | // map.put("roleName",roles.get(0).getRoleName()); |
| | | map.put("info",userInfo); |
| | | // 修改用户最后登录时间 |
| | | SysUser sysUser = new SysUser(); |
| | |
| | | /** |
| | | * 参数签名 |
| | | */ |
| | | public static final String SING = "sing"; |
| | | public static final String SIGN = "sign"; |
| | | |
| | | /** |
| | | * 参数随机字符串 |
New file |
| | |
| | | package com.ruoyi.common.core.exception.user; |
| | | |
| | | /** |
| | | * 学生端登录异常信息 |
| | | * |
| | | * @author HJL |
| | | * @version 1.0 |
| | | * @since 2024-05-24 11:35 |
| | | */ |
| | | public class UserAppletException extends RuntimeException { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 错误提示 |
| | | */ |
| | | private String message; |
| | | |
| | | /** |
| | | * 错误码 |
| | | */ |
| | | private int code; |
| | | |
| | | public UserAppletException() { |
| | | } |
| | | |
| | | public UserAppletException(String message, Integer code) { |
| | | this.message = message; |
| | | this.code = code; |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | } |
| | |
| | | import javax.naming.SizeLimitExceededException; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.user.UserAppletException; |
| | | import org.apache.commons.fileupload.FileUploadBase; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | log.error("上传文件异常 => : {}", e.getMessage()); |
| | | return AjaxResult.error("文件识别大小超出限制,允许的大小在" + maxFileSize); |
| | | } |
| | | |
| | | /** |
| | | * 学生端单点登录-异常信息 |
| | | */ |
| | | @ExceptionHandler(UserAppletException.class) |
| | | public AjaxResult<String> studyLoginExceptionHandler(UserAppletException e) { |
| | | return AjaxResult.error(e.getCode(), e.getMessage()); |
| | | } |
| | | } |
| | |
| | | import java.util.concurrent.TimeUnit; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.ruoyi.common.core.exception.user.UserAppletException; |
| | | import com.ruoyi.system.api.model.LoginUserApplet; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | return rspMap; |
| | | } |
| | | public LoginUserApplet getLoginUserApplet() { |
| | | return getLoginUserAppletToken(ServletUtils.getRequest()); |
| | | LoginUserApplet loginUserAppletToken = getLoginUserAppletToken(ServletUtils.getRequest()); |
| | | if (loginUserAppletToken == null){ |
| | | throw new UserAppletException("登录失效,请重新登录!", 401); |
| | | } |
| | | return loginUserAppletToken; |
| | | } |
| | | public LoginUserApplet getLoginUserAppletToken(HttpServletRequest request) { |
| | | // 获取请求携带的令牌 |
| | |
| | | /** |
| | | * 这里为支持的请求头,如果有自定义的header字段请自己添加 |
| | | */ |
| | | private static final String ALLOWED_HEADERS = "X-Requested-With, Content-Type, Authorization, credential, X-XSRF-TOKEN, token, username, client, request-origion"; |
| | | private static final String ALLOWED_HEADERS = "X-Requested-With, Content-Type, Authorization, credential, X-XSRF-TOKEN, token, username, client, request-origion, sign, nonce_str"; |
| | | private static final String ALLOWED_METHODS = "GET,POST,PUT,DELETE,OPTIONS,HEAD"; |
| | | private static final String ALLOWED_ORIGIN = "*"; |
| | | private static final String ALLOWED_EXPOSE = "*"; |
| | |
| | | if(method != HttpMethod.POST){ |
| | | return chain.filter(exchange.mutate().request(mutate.build()).build()); |
| | | } |
| | | String sing = request.getHeaders().getFirst(TokenConstants.SING); |
| | | String sign = request.getHeaders().getFirst(TokenConstants.SIGN); |
| | | String nonce_str = request.getHeaders().getFirst(TokenConstants.NONCE_STR); |
| | | // if (parameter_signature && StringUtils.isEmpty(sing)) { |
| | | // return unauthorizedResponse(exchange, "签名不能为空!"); |
| | | // } |
| | | // if (parameter_signature && StringUtils.isEmpty(nonce_str)) { |
| | | // return unauthorizedResponse(exchange, "签名不能为空!"); |
| | | // } |
| | | if (parameter_signature && StringUtils.isEmpty(sign)) { |
| | | return unauthorizedResponse(exchange, "签名不能为空!"); |
| | | } |
| | | if (parameter_signature && StringUtils.isEmpty(nonce_str)) { |
| | | return unauthorizedResponse(exchange, "签名不能为空!"); |
| | | } |
| | | if(parameter_signature){ |
| | | return authSign(exchange, chain, sing, nonce_str); |
| | | return authSign(exchange, chain, sign, nonce_str); |
| | | } |
| | | return chain.filter(exchange.mutate().request(mutate.build()).build()); |
| | | } |
| | |
| | | * 校验签名 |
| | | * @return |
| | | */ |
| | | private Mono<Void> authSign(ServerWebExchange exchange, GatewayFilterChain chain, String sing, String nonce_str){ |
| | | private Mono<Void> authSign(ServerWebExchange exchange, GatewayFilterChain chain, String sign, String nonce_str){ |
| | | return DataBufferUtils.join(exchange.getRequest().getBody()) |
| | | .flatMap(dataBuffer -> { |
| | | byte[] bytes = new byte[dataBuffer.readableByteCount()]; |
| | | dataBuffer.read(bytes); |
| | | String bodyString = new String(bytes, StandardCharsets.UTF_8); |
| | | log.info("请求参数:{}", bodyString); |
| | | if(!authSign(JSON.parseObject(bodyString), sing, nonce_str)){ |
| | | if(!authSign(JSON.parseObject(bodyString), sign, nonce_str)){ |
| | | return unauthorizedResponse(exchange, "签名验证失败!"); |
| | | } |
| | | DataBufferUtils.release(dataBuffer); |
| | |
| | | private boolean authSign(JSONObject jsonStr, String sign, String nonce_str) { |
| | | String signUrlEncode = localSignUrl(jsonStr, nonce_str); |
| | | signUrlEncode = signUrlEncode.replaceAll("& #40;", "\\(") |
| | | .replaceAll("& #41;", "\\)") |
| | | .replaceAll("\\+", " "); |
| | | .replaceAll("& #41;", "\\)"); |
| | | if(sign.equals(signUrlEncode)){ |
| | | return true; |
| | | } |
| | | |
| | | System.err.println("签名值:" + signUrlEncode); |
| | | return false; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | String signUrl = sb.substring(0, sb.length() - 1); |
| | | System.err.println("签名串:" + signUrl); |
| | | return signUrlEncode(signUrl, key); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping(value = "/getSysRoleByIds") |
| | | @PostMapping(value = "/getSysRoleByIds") |
| | | public R<List<SysRole>> getSysRoleByIds(@RequestBody GetSysRoleByIds ids){ |
| | | List<SysRole> sysRoleByIds = roleService.getSysRoleByIds(ids.getIds()); |
| | | return R.ok(sysRoleByIds); |
| | |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @GetMapping("/queryRoleByUserId/{userId}") |
| | | @PostMapping("/queryRoleByUserId/{userId}") |
| | | public R<SysRole> queryRoleByUserId(@PathVariable("userId") Long userId){ |
| | | SysUserRole one = sysUserRoleService.getOne(Wrappers.lambdaQuery(SysUserRole.class) |
| | | .eq(SysUserRole::getUserId, userId) |
| | |
| | | } |
| | | |
| | | |
| | | @GetMapping("/queryRoleByRoleId/{roleId}") |
| | | @PostMapping("/queryRoleByRoleId/{roleId}") |
| | | public R<SysRole> queryRoleByRoleId(@PathVariable("roleId") Long roleId){ |
| | | return R.ok( roleService.getOne(Wrappers.lambdaQuery(SysRole.class) |
| | | .eq(SysRole::getRoleId, roleId) |
| | |
| | | <id property="roleId" column="role_id" /> |
| | | <result property="roleName" column="role_name" /> |
| | | <result property="roleKey" column="role_key" /> |
| | | <result property="roleSort" column="role_sort" /> |
| | | <result property="dataScope" column="data_scope" /> |
| | | <result property="menuCheckStrictly" column="menu_check_strictly" /> |
| | | <result property="deptCheckStrictly" column="dept_check_strictly" /> |
| | | <result property="status" column="status" /> |
| | | <result property="delFlag" column="del_flag" /> |
| | | <result property="createBy" column="create_by" /> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectRoleVo"> |
| | | select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly, |
| | | r.status, r.del_flag, r.create_time, r.remark ,r.carDataAuth,r.carTrainOperAuth,r.contractDataAuth |
| | | select distinct r.role_id, r.role_name, r.role_key, r.data_scope, |
| | | r.status, r.del_flag, r.create_time, r.remark |
| | | from sys_role r |
| | | left join sys_user_role ur on ur.role_id = r.role_id |
| | | left join sys_user u on u.user_id = ur.user_id |
| | |
| | | </if> |
| | | <!-- 数据范围过滤 --> |
| | | ${params.dataScope} |
| | | order by r.role_sort |
| | | </select> |
| | | |
| | | <select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult"> |
| | |
| | | |
| | | <select id="getSysRoleByIds" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | where id in |
| | | <foreach collection="ids" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | <if test="null != ids and ids.size() > 0"> |
| | | where r.id in |
| | | <foreach collection="ids" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | <id property="roleId" column="role_id" /> |
| | | <result property="roleName" column="role_name" /> |
| | | <result property="roleKey" column="role_key" /> |
| | | <result property="roleSort" column="role_sort" /> |
| | | <result property="dataScope" column="data_scope" /> |
| | | <result property="status" column="role_status" /> |
| | | </resultMap> |
| | |
| | | <sql id="selectUserVo"> |
| | | select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, |
| | | d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, |
| | | r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status ,u.roleType as roleType,u.objectId AS objectId |
| | | r.role_id, r.role_name, r.role_key, r.data_scope, r.status as role_status ,u.roleType as roleType,u.objectId AS objectId |
| | | from sys_user u |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | | left join sys_user_role ur on u.user_id = ur.user_id |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | @Autowired |
| | | private TAppUserCarService appUserCarService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | /** |
| | | * 查询用户可用优惠券数量 |
| | | * @param dto |
| | |
| | | public AjaxResult<List<TAppUserCar>> carList() { |
| | | // todo 用户id |
| | | List<TAppUserCar> appUserId = appUserCarService.list(new QueryWrapper<TAppUserCar>() |
| | | .eq("app_user_id", 11)); |
| | | .eq("app_user_id",tokenService.getLoginUserApplet().getUserid() )); |
| | | return AjaxResult.ok(appUserId); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.account.api.model.TAppUserAddress; |
| | | import com.ruoyi.account.service.TAppUserAddressService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | public AjaxResult<Boolean> deleteById(@RequestParam("id") Integer id) { |
| | | return AjaxResult.ok(appUserAddressService.removeById(id)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据id获取地址信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getAppUserAddressById/{id}") |
| | | public R<TAppUserAddress> getAppUserAddressById(@PathVariable Long id){ |
| | | TAppUserAddress userAddress = appUserAddressService.getById(id); |
| | | return R.ok(userAddress); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-app-user-car/getCarByIds") |
| | | public R<List<TAppUserCar>> getCarByIds(@RequestBody List<Integer> carIds){ |
| | | public R<List<TAppUserCar>> getCarByIds(@RequestBody List<Long> carIds){ |
| | | return R.ok(appUserCarService.list(Wrappers.lambdaQuery(TAppUserCar.class).in(TAppUserCar::getId,carIds))); |
| | | } |
| | | |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/user/getUserById/{id}") |
| | | @PostMapping(value = "/user/getUserById/{id}") |
| | | public R<TAppUser> getUserById(@PathVariable Long id){ |
| | | TAppUser appUser = appUserService.getById(id); |
| | | return R.ok(appUser); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改用户信息 |
| | | * @param appUser |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/user/updateAppUser") |
| | | public R updateAppUser(@RequestBody TAppUser appUser){ |
| | | appUserService.updateById(appUser); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.account.api.model.TAppUserIntegralChange; |
| | | import com.ruoyi.account.service.TAppUserIntegralChangeService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-app-user-integral-change") |
| | | public class TAppUserIntegralChangeController { |
| | | |
| | | @Resource |
| | | private TAppUserIntegralChangeService appUserIntegralChangeService; |
| | | |
| | | |
| | | /** |
| | | * 添加积分变动记录 |
| | | * @param appUserIntegralChange |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/addAppUserIntegralChange") |
| | | public R addAppUserIntegralChange(@RequestBody TAppUserIntegralChange appUserIntegralChange){ |
| | | String code = Math.random() * 1000 + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); |
| | | appUserIntegralChange.setCode(code); |
| | | appUserIntegralChangeService.save(appUserIntegralChange); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import com.ruoyi.chargingPile.api.dto.TChargingGunDTO; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | 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; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | |
| | | public class TChargingGunController { |
| | | |
| | | private final TChargingGunService chargingGunService; |
| | | |
| | | @Resource |
| | | private TChargingPileService chargingPileService; |
| | | |
| | | @Autowired |
| | | public TChargingGunController(TChargingGunService chargingGunService) { |
| | |
| | | public void downloadQRCode(@PathVariable Integer id, HttpServletResponse response){ |
| | | // todo 待完善 |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取充电枪完整名称 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping(value = "/getAllName/{id}") |
| | | public R<String> getAllName(@PathVariable Integer id){ |
| | | TChargingGun chargingGun = chargingGunService.getById(id); |
| | | TChargingPile chargingPile = chargingPileService.getById(chargingGun.getChargingPileId()); |
| | | return R.ok(chargingPile.getName() + chargingGun.getName()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取充电枪详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping(value = "/getChargingGunById/{id}") |
| | | public R<TChargingGun> getChargingGunById(@PathVariable Integer id){ |
| | | TChargingGun chargingGun = chargingGunService.getById(id); |
| | | return R.ok(chargingGun); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/pageChargingPileList") |
| | | @ApiOperation(value = "获取充电桩列表数据", tags = {"管理后台-充电桩信息"}) |
| | |
| | | /** |
| | | * 通过站点id查询停车场信息 |
| | | */ |
| | | @GetMapping(value = "/getLotBySiteId") |
| | | @PostMapping(value = "/getLotBySiteId") |
| | | public R<TParkingLot> getLotBySiteId(@RequestParam("siteId") Integer siteId){ |
| | | return R.ok(parkingLotService.getOne(Wrappers.lambdaQuery(TParkingLot.class) |
| | | .eq(TParkingLot::getSiteId, siteId))); |
| | |
| | | Integer id = gunMonitoring.getId(); |
| | | //根据订单数据查询车牌号 |
| | | TChargingOrder chargingOrder = chargingOrderClient.getOrderDetailByGunId(id).getData(); |
| | | Integer appUserCarId = chargingOrder.getAppUserCarId(); |
| | | Long appUserCarId = chargingOrder.getAppUserCarId(); |
| | | if(null != appUserCarId){ |
| | | TAppUserCar tAppUserCar = appUserCarClient.getCarByIds(Arrays.asList(appUserCarId)).getData().get(0); |
| | | gunMonitoring.setLicensePlate(tAppUserCar.getLicensePlate()); |
| | |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-seata</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- SpringBoot Actuator --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/getTotalElectricQuantity/{days}") |
| | | @PostMapping("/getTotalElectricQuantity/{days}") |
| | | public R<List<List<Map<String, Object>>>> getTotalElectricQuantity(@PathVariable Integer days, @RequestParam("siteIds") Set<Integer> siteIds){ |
| | | List<List<Map<String, Object>>> list = chargingOrderAccountingStrategyService.getTotalElectricQuantity(days, siteIds); |
| | | return R.ok(list); |
| | |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/getDailyChargingDegree/{days}") |
| | | @PostMapping("/getDailyChargingDegree/{days}") |
| | | public R<List<Double>> getDailyChargingDegree(@PathVariable Integer days, @RequestParam("siteIds") Set<Integer> siteIds){ |
| | | List<Double> list = chargingOrderAccountingStrategyService.getDailyChargingDegree(days, siteIds); |
| | | return R.ok(list); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.query.TChargingCountQuery; |
| | | import com.ruoyi.order.dto.GetMyChargingOrderList; |
| | | import com.ruoyi.order.dto.MyChargingOrderInfo; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | /** |
| | | * 查询用户最近一次充电记录使用的车辆 |
| | | * @param |
| | |
| | | */ |
| | | @PostMapping(value = "/getCar") |
| | | public R<Long> getCar() { |
| | | // todo 获取用户id |
| | | List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>() |
| | | .eq(TChargingOrder::getAppUserId, 11) |
| | | .eq(TChargingOrder::getAppUserId, tokenService.getLoginUserApplet().getUserid()) |
| | | .isNotNull(TChargingOrder::getAppUserCarId)); |
| | | if (!list.isEmpty()){ |
| | | // 最近使用的车辆id |
| | |
| | | * @param chargingGunId 充电枪id |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/getOrderDetailByGunId") |
| | | @PostMapping(value = "/getOrderDetailByGunId") |
| | | public R<TChargingOrder> getOrderDetailByGunId(@RequestParam("chargingGunId") Integer chargingGunId){ |
| | | TChargingOrder one = chargingOrderService.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getChargingGunId, chargingGunId) |
| | | .eq(TChargingOrder::getDelFlag, 0).eq(TChargingOrder::getStatus, 3)); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping(value = "/getMyChargingOrderList") |
| | | @ApiOperation(value = "获取充电记录列表", tags = {"小程序-充电记录"}) |
| | | public AjaxResult<Map<String, Object>> getMyChargingOrderList(GetMyChargingOrderList query){ |
| | | Map<String, Object> orderList = chargingOrderService.getMyChargingOrderList(query); |
| | | return AjaxResult.success(orderList); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping(value = "/getMyChargingOrderInfo") |
| | | @ApiOperation(value = "获取充电记订单明细", tags = {"小程序-充电记录"}) |
| | | public AjaxResult<MyChargingOrderInfo> getMyChargingOrderInfo(String id){ |
| | | MyChargingOrderInfo myChargingOrderInfo = chargingOrderService.getMyChargingOrderInfo(id); |
| | | return AjaxResult.success(myChargingOrderInfo); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityStatisticslVO; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import com.ruoyi.order.dto.ExchangeOrderGoodsInfo; |
| | | import com.ruoyi.order.dto.GetMyExchangeOrder; |
| | | import com.ruoyi.order.dto.MyExchangeOrderList; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import com.ruoyi.order.service.TExchangeOrderService; |
| | | import com.ruoyi.order.service.TShoppingOrderService; |
| | | import com.ruoyi.order.service.TVipOrderService; |
| | | import com.ruoyi.order.service.impl.TChargingOrderServiceImpl; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @RestController |
| | | @RequestMapping("/t-exchange-order") |
| | | public class TExchangeOrderController { |
| | | @Autowired |
| | | @Resource |
| | | private TShoppingOrderService tShoppingOrderService; |
| | | @Autowired |
| | | @Resource |
| | | private TExchangeOrderService exchangeOrderService; |
| | | @Autowired |
| | | private TChargingOrderService chargingOrderService; |
| | | @Autowired |
| | | private TVipOrderService vipOrderService; |
| | | @Autowired |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Autowired |
| | | @Resource |
| | | private ChargingPileClient chargingPileClient; |
| | | /** |
| | | * 管理后台 活动费用统计 |
| | |
| | | |
| | | return R.ok(strings); |
| | | } |
| | | /** |
| | | * 管理后台 根据t_app_coupon订单ids查询积分兑换优惠券的订单编号 |
| | | * @param goodsIds 订单号-商品类型 |
| | | * @return |
| | | */ |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("/getMyExchangeOrder") |
| | | @ApiOperation(value = "获取兑换记录列表", tags = {"小程序-兑换记录"}) |
| | | public AjaxResult<List<MyExchangeOrderList>> getMyExchangeOrder(GetMyExchangeOrder query){ |
| | | List<MyExchangeOrderList> list = exchangeOrderService.getMyExchangeOrder(query); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getGoodsExchangeOrder/{id}") |
| | | @ApiOperation(value = "获取兑换订单详情", tags = {"小程序-兑换记录"}) |
| | | public AjaxResult<ExchangeOrderGoodsInfo> getGoodsExchangeOrder(@PathVariable String id){ |
| | | ExchangeOrderGoodsInfo goodsExchangeOrder = exchangeOrderService.getGoodsExchangeOrder(id); |
| | | return AjaxResult.success(goodsExchangeOrder); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.api.model.TOrderAppeal; |
| | | import com.ruoyi.order.api.query.TOrderAppealQuery; |
| | | import com.ruoyi.order.api.vo.TOrderAppealVO; |
| | | import com.ruoyi.order.service.TOrderAppealService; |
| | |
| | | public AjaxResult<TOrderAppealVO> getDetailById(@RequestParam("id") Integer id) { |
| | | return AjaxResult.ok(orderAppealService.getDetailById(id)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping(value = "/addOrderAppeal") |
| | | @ApiOperation(value = "申诉订单", tags = {"小程序-充电记录(个人中心)"}) |
| | | public AjaxResult addOrderAppeal(@RequestBody TOrderAppeal orderAppeal){ |
| | | Long appUserId = tokenService.getLoginUser().getUserid(); |
| | | orderAppeal.setAppUserId(appUserId); |
| | | orderAppeal.setStatus(1); |
| | | orderAppealService.save(orderAppeal); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.order.api.vo.TOrderEvaluateVO; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageList; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO; |
| | | import com.ruoyi.order.dto.OrderEvaluateVo; |
| | | import com.ruoyi.order.service.TOrderEvaluateService; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | public AjaxResult<SiteDetailEvaluateVO> getSiteDetailEveList(@RequestParam(value = "siteId")@ApiParam(value = "站点id")Integer siteId) { |
| | | return AjaxResult.ok(orderEvaluateService.getSiteDetailEveList(siteId)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @PostMapping(value = "/addOrderEvaluate") |
| | | @ApiOperation(value = "添加评价记录", tags = {"小程序-充电记录"}) |
| | | public AjaxResult addOrderEvaluate(@RequestBody OrderEvaluateVo query){ |
| | | return orderEvaluateService.addOrderEvaluate(query); |
| | | } |
| | | |
| | | |
| | | @GetMapping(value = "/getOrderEvaluate") |
| | | @ApiOperation(value = "获取订单评价详情", tags = {"小程序-充电记录"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true), |
| | | @ApiImplicitParam(value = "订单类型(1=充电订单,2=购物订单,3=兑换订单,4=会员订单)", name = "orderType", required = true), |
| | | }) |
| | | public AjaxResult<OrderEvaluateVo> getOrderEvaluate(@PathVariable Integer orderId, Integer orderType){ |
| | | OrderEvaluateVo orderEvaluate = orderEvaluateService.getOrderEvaluate(orderId, orderType); |
| | | return AjaxResult.success(orderEvaluate); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/16 14:07 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class ExchangeOrderGoodsInfo { |
| | | @ApiModelProperty("订单id") |
| | | private String id; |
| | | @ApiModelProperty("状态(1=待发货,2=待收货,3=已完成,4=已取消)") |
| | | private Integer status; |
| | | @ApiModelProperty("收货人姓名") |
| | | private String consignee; |
| | | @ApiModelProperty("电话") |
| | | private String phone; |
| | | @ApiModelProperty("地址") |
| | | private String address; |
| | | @ApiModelProperty("快递公司") |
| | | private String expressCompany; |
| | | @ApiModelProperty("快递单号") |
| | | private String expressNumber; |
| | | @ApiModelProperty("商品名称") |
| | | private String name; |
| | | @ApiModelProperty("商品图片") |
| | | private String imgUrl; |
| | | @ApiModelProperty("兑换数量") |
| | | private Integer purchaseQuantity; |
| | | @ApiModelProperty("兑换积分单价") |
| | | private Integer unitPoints; |
| | | @ApiModelProperty("订单编号") |
| | | private String code; |
| | | @ApiModelProperty("下单时间") |
| | | private String createTime; |
| | | @ApiModelProperty("兑换总积分") |
| | | private Integer points; |
| | | @ApiModelProperty("备注") |
| | | private String remark; |
| | | @ApiModelProperty("发货时间") |
| | | private String deliveryTime; |
| | | @ApiModelProperty("完成时间") |
| | | private String finishTime; |
| | | @ApiModelProperty("优惠券类型(1=充电优惠券,2=购物优惠券)") |
| | | private Integer couponType; |
| | | @ApiModelProperty("优惠券有效天数") |
| | | private Integer days; |
| | | @ApiModelProperty("有效期截止时间") |
| | | private String endTime; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/15 19:11 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class GetMyChargingOrderList extends BasePage { |
| | | @ApiModelProperty("0=全部,1=待评价") |
| | | private Integer type; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/16 13:34 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class GetMyExchangeOrder extends BasePage { |
| | | @ApiModelProperty("状态(0=全部,1=待发货,2=待收货,3=已完成)") |
| | | private Integer status; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/16 9:08 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class MyChargingOrderInfo { |
| | | @ApiModelProperty("订单id") |
| | | private String id; |
| | | @ApiModelProperty("订单编号") |
| | | private String code; |
| | | @ApiModelProperty("订单时间") |
| | | private String createTime; |
| | | @ApiModelProperty("订单状态(0=未知,1=等待中,2=启动中,3=充电中,4=停止中,5=已结束)") |
| | | private Integer status; |
| | | @ApiModelProperty("订单标题") |
| | | private String title; |
| | | @ApiModelProperty("充电模式(1=超级快充,2=快充,3=慢充)") |
| | | private Integer chargeMode; |
| | | @ApiModelProperty("充电枪名称") |
| | | private String name; |
| | | @ApiModelProperty("车牌号") |
| | | private String licensePlate; |
| | | @ApiModelProperty("充电开始时间") |
| | | private Long startTime; |
| | | @ApiModelProperty("充电结束时间") |
| | | private Long endTime; |
| | | @ApiModelProperty("充电费") |
| | | private BigDecimal orderAmount; |
| | | @ApiModelProperty("实际消费") |
| | | private BigDecimal paymentAmount;; |
| | | @ApiModelProperty("充值金额") |
| | | private BigDecimal rechargeAmount; |
| | | @ApiModelProperty("优惠券抵扣") |
| | | private BigDecimal couponDiscountAmount; |
| | | @ApiModelProperty("会员抵扣") |
| | | private BigDecimal vipDiscountAmount; |
| | | @ApiModelProperty("退回金额") |
| | | private BigDecimal refundAmount; |
| | | @ApiModelProperty("阶段费用明细") |
| | | private List<TChargingOrderAccountingStrategy> stageCost; |
| | | @ApiModelProperty("电流电压曲线") |
| | | private Map<String, Object> currentAndVoltage; |
| | | @ApiModelProperty("功率曲线") |
| | | private Map<String, Object> power; |
| | | @ApiModelProperty("是否可申诉(0=否,1=是)") |
| | | private Integer actionable; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/15 18:59 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class MyChargingOrderList { |
| | | @ApiModelProperty("订单id") |
| | | private String id; |
| | | @ApiModelProperty("订单状态(0=未知,1=等待中,2=启动中,3=充电中,4=停止中,5=已结束)") |
| | | private Integer status; |
| | | @ApiModelProperty("标题") |
| | | private String title; |
| | | @ApiModelProperty("充电度数") |
| | | private BigDecimal chargingDegree; |
| | | @ApiModelProperty("充电桩枪名称") |
| | | private String name; |
| | | @ApiModelProperty("结束方式(0=异常终止,1=主动终止,2=满电终止,3=费用不足终止)") |
| | | private Integer endMode; |
| | | @ApiModelProperty("支付金额") |
| | | private BigDecimal payMoney; |
| | | @ApiModelProperty("订单时间") |
| | | private String createTime; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/16 13:36 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class MyExchangeOrderList { |
| | | @ApiModelProperty("订单id") |
| | | private String id; |
| | | @ApiModelProperty("兑换积分单价") |
| | | private Integer unitPoints; |
| | | @ApiModelProperty("兑换总积分") |
| | | private Integer points; |
| | | @ApiModelProperty("兑换数量") |
| | | private Integer purchaseQuantity; |
| | | @ApiModelProperty("订单类型(1=商品,2=优惠券)") |
| | | private Integer orderType; |
| | | @ApiModelProperty("状态(1=待发货,2=待收货,3=已完成,4=已取消)") |
| | | private Integer status; |
| | | @ApiModelProperty("名称") |
| | | private String name; |
| | | @ApiModelProperty("图片") |
| | | private String imgUrl; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/16 10:25 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class OrderEvaluateVo extends TOrderEvaluate { |
| | | @ApiModelProperty("评价标签id") |
| | | private List<Integer> tagIds; |
| | | |
| | | @ApiModelProperty("评价标签名称") |
| | | private List<String> tagName; |
| | | |
| | | } |
| | |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | |
| | | */ |
| | | @Mapper |
| | | public interface TChargingOrderMapper extends BaseMapper<TChargingOrder> { |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取小程序充电记录列表数据 |
| | | * @param appUserId |
| | | * @param type |
| | | * @param pageCurr |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | List<TChargingOrder> getMyChargingOrderList(Long appUserId, Integer type, Integer pageCurr, Integer pageSize); |
| | | } |
| | |
| | | package com.ruoyi.order.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.dto.GetMyChargingOrderList; |
| | | import com.ruoyi.order.dto.MyChargingOrderInfo; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2024-08-07 |
| | | */ |
| | | public interface TChargingOrderService extends IService<TChargingOrder> { |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取小程序充电记录列表数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | Map<String, Object> getMyChargingOrderList(GetMyChargingOrderList query); |
| | | |
| | | |
| | | /** |
| | | * 获取小程序充电记录明细 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | MyChargingOrderInfo getMyChargingOrderInfo(String id); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | | import com.ruoyi.order.dto.ExchangeOrderGoodsInfo; |
| | | import com.ruoyi.order.dto.GetMyExchangeOrder; |
| | | import com.ruoyi.order.dto.MyExchangeOrderList; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2024-08-07 |
| | | */ |
| | | public interface TExchangeOrderService extends IService<TExchangeOrder> { |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取小程序兑换记录 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<MyExchangeOrderList> getMyExchangeOrder(GetMyExchangeOrder query); |
| | | |
| | | |
| | | /** |
| | | * 获取兑换订单详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | ExchangeOrderGoodsInfo getGoodsExchangeOrder(String id); |
| | | } |
| | |
| | | package com.ruoyi.order.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | 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.TOrderEvaluateVO; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageList; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO; |
| | | import com.ruoyi.order.dto.OrderEvaluateVo; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | |
| | | * @return |
| | | */ |
| | | PageInfo<GetOrderEvaluatePageListDTO> getPageList(GetOrderEvaluatePageList pageList); |
| | | |
| | | |
| | | /** |
| | | * 评价订单 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | AjaxResult addOrderEvaluate(OrderEvaluateVo query); |
| | | |
| | | |
| | | /** |
| | | * 根据订单id获取 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | OrderEvaluateVo getOrderEvaluate(Integer orderId, Integer orderType); |
| | | } |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy; |
| | | import com.ruoyi.order.dto.GetMyChargingOrderList; |
| | | import com.ruoyi.order.dto.MyChargingOrderInfo; |
| | | import com.ruoyi.order.dto.MyChargingOrderList; |
| | | import com.ruoyi.order.mapper.TChargingOrderMapper; |
| | | import com.ruoyi.order.service.TChargingOrderAccountingStrategyService; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.ZoneOffset; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class TChargingOrderServiceImpl extends ServiceImpl<TChargingOrderMapper, TChargingOrder> implements TChargingOrderService { |
| | | |
| | | |
| | | @Resource |
| | | private ChargingGunClient chargingGunClient; |
| | | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | @Resource |
| | | private AppUserCarClient appUserCarClient; |
| | | |
| | | @Resource |
| | | private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取小程序充电记录列表数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> getMyChargingOrderList(GetMyChargingOrderList query) { |
| | | Long appUserId = tokenService.getLoginUser().getUserid(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | int size = this.baseMapper.getMyChargingOrderList(appUserId, 1, null, null).size(); |
| | | map.put("number", size); |
| | | List<TChargingOrder> list = this.baseMapper.getMyChargingOrderList(appUserId, query.getType(), query.getPageCurr(), query.getPageSize()); |
| | | List<MyChargingOrderList> orderLists = new ArrayList<>(); |
| | | for (TChargingOrder tChargingOrder : list) { |
| | | MyChargingOrderList myChargingOrderList = new MyChargingOrderList(); |
| | | myChargingOrderList.setId(tChargingOrder.getId().toString()); |
| | | myChargingOrderList.setStatus(tChargingOrder.getStatus()); |
| | | Site site = siteClient.getSiteByIds(Arrays.asList(tChargingOrder.getSiteId())).getData().get(0); |
| | | myChargingOrderList.setTitle(site.getName()); |
| | | myChargingOrderList.setChargingDegree(tChargingOrder.getChargingCapacity()); |
| | | String name = chargingGunClient.getAllName(tChargingOrder.getChargingGunId()).getData(); |
| | | myChargingOrderList.setName(name); |
| | | myChargingOrderList.setEndMode(tChargingOrder.getEndMode()); |
| | | BigDecimal payMoney = tChargingOrder.getStatus() < 4 ? tChargingOrder.getRechargeAmount() : tChargingOrder.getPaymentAmount(); |
| | | myChargingOrderList.setPayMoney(payMoney); |
| | | myChargingOrderList.setCreateTime(tChargingOrder.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | orderLists.add(myChargingOrderList); |
| | | } |
| | | map.put("list", orderLists); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取充电订单明细 |
| | | * @param id 订单id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public MyChargingOrderInfo getMyChargingOrderInfo(String id) { |
| | | TChargingOrder chargingOrder = this.getById(id); |
| | | MyChargingOrderInfo myChargingOrderInfo = new MyChargingOrderInfo(); |
| | | myChargingOrderInfo.setId(id); |
| | | myChargingOrderInfo.setCode(chargingOrder.getCode()); |
| | | myChargingOrderInfo.setCreateTime(chargingOrder.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | myChargingOrderInfo.setStatus(chargingOrder.getStatus()); |
| | | Site site = siteClient.getSiteByIds(Arrays.asList(chargingOrder.getSiteId())).getData().get(0); |
| | | myChargingOrderInfo.setTitle(site.getName()); |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData(); |
| | | myChargingOrderInfo.setChargeMode(chargingGun.getChargeMode()); |
| | | String name = chargingGunClient.getAllName(chargingOrder.getChargingGunId()).getData(); |
| | | myChargingOrderInfo.setName(name); |
| | | if(null != chargingOrder.getAppUserCarId()){ |
| | | TAppUserCar tAppUserCar = appUserCarClient.getCarByIds(Arrays.asList(chargingOrder.getAppUserCarId())).getData().get(0); |
| | | myChargingOrderInfo.setLicensePlate(tAppUserCar.getLicensePlate()); |
| | | }else{ |
| | | myChargingOrderInfo.setLicensePlate("无"); |
| | | } |
| | | myChargingOrderInfo.setStartTime(chargingOrder.getStartTime().toInstant(ZoneOffset.of("+8")).toEpochMilli()); |
| | | myChargingOrderInfo.setEndTime(chargingOrder.getEndTime().toInstant(ZoneOffset.of("+8")).toEpochMilli()); |
| | | myChargingOrderInfo.setOrderAmount(chargingOrder.getOrderAmount()); |
| | | myChargingOrderInfo.setPaymentAmount(chargingOrder.getPaymentAmount()); |
| | | myChargingOrderInfo.setRechargeAmount(chargingOrder.getRechargeAmount()); |
| | | myChargingOrderInfo.setCouponDiscountAmount(chargingOrder.getCouponDiscountAmount()); |
| | | myChargingOrderInfo.setVipDiscountAmount(chargingOrder.getVipDiscountAmount()); |
| | | myChargingOrderInfo.setRefundAmount(chargingOrder.getRefundAmount()); |
| | | List<TChargingOrderAccountingStrategy> stageCost = chargingOrderAccountingStrategyService.list( |
| | | new LambdaQueryWrapper<TChargingOrderAccountingStrategy>().eq(TChargingOrderAccountingStrategy::getChargingOrderId, id) |
| | | .orderByAsc(TChargingOrderAccountingStrategy::getStartTime) |
| | | ); |
| | | myChargingOrderInfo.setStageCost(stageCost); |
| | | // todo 待完善 |
| | | //再MongoDB中获取数据 |
| | | myChargingOrderInfo.setCurrentAndVoltage(null); |
| | | //再MongoDB中获取数据 |
| | | myChargingOrderInfo.setPower(null); |
| | | myChargingOrderInfo.setActionable(myChargingOrderInfo.getEndTime() + 604800000L > System.currentTimeMillis() ? 0 : 1); |
| | | return myChargingOrderInfo; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserAddressClient; |
| | | import com.ruoyi.account.api.model.TAppUserAddress; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | | import com.ruoyi.order.dto.ExchangeOrderGoodsInfo; |
| | | import com.ruoyi.order.dto.GetMyExchangeOrder; |
| | | import com.ruoyi.order.dto.MyExchangeOrderList; |
| | | import com.ruoyi.order.mapper.TExchangeOrderMapper; |
| | | import com.ruoyi.order.service.TExchangeOrderService; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.api.feignClient.CouponClient; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class TExchangeOrderServiceImpl extends ServiceImpl<TExchangeOrderMapper, TExchangeOrder> implements TExchangeOrderService { |
| | | |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Resource |
| | | private GoodsClient goodsClient; |
| | | |
| | | @Resource |
| | | private CouponClient couponClient; |
| | | |
| | | @Resource |
| | | private AppUserAddressClient appUserAddressClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取小程序兑换记录 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MyExchangeOrderList> getMyExchangeOrder(GetMyExchangeOrder query) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | LambdaQueryWrapper<TExchangeOrder> wrapper = new LambdaQueryWrapper<TExchangeOrder>().eq(TExchangeOrder::getDelFlag, 0).eq(TExchangeOrder::getAppUserId, userid); |
| | | if(query.getStatus() == 0){ |
| | | wrapper.ne(TExchangeOrder::getStatus, 4); |
| | | }else{ |
| | | wrapper.eq(TExchangeOrder::getStatus, query.getStatus()); |
| | | } |
| | | List<TExchangeOrder> list = this.list(wrapper.orderByDesc(TExchangeOrder::getCreateTime).last(" limit " + query.getPageCurr() + "," + query.getPageSize())); |
| | | List<MyExchangeOrderList> pageList = new ArrayList<>(); |
| | | for (TExchangeOrder tExchangeOrder : list) { |
| | | MyExchangeOrderList exchangeOrderList = new MyExchangeOrderList(); |
| | | exchangeOrderList.setId(tExchangeOrder.getId().toString()); |
| | | exchangeOrderList.setUnitPoints(tExchangeOrder.getPoints() / tExchangeOrder.getPurchaseQuantity()); |
| | | exchangeOrderList.setPoints(tExchangeOrder.getPoints()); |
| | | exchangeOrderList.setPurchaseQuantity(tExchangeOrder.getPurchaseQuantity()); |
| | | exchangeOrderList.setOrderType(tExchangeOrder.getOrderType()); |
| | | exchangeOrderList.setStatus(tExchangeOrder.getStatus()); |
| | | String name = ""; |
| | | String imgUrl = ""; |
| | | if(tExchangeOrder.getOrderType() == 1){ |
| | | TGoods goods = goodsClient.getGoodsById(tExchangeOrder.getGoodsId()).getData(); |
| | | name = goods.getName(); |
| | | imgUrl = goods.getCoverPicture(); |
| | | }else{ |
| | | TCoupon coupon = couponClient.getCouponById(tExchangeOrder.getGoodsId()).getData(); |
| | | name = coupon.getName(); |
| | | imgUrl = coupon.getCoverPicture(); |
| | | } |
| | | exchangeOrderList.setName(name); |
| | | exchangeOrderList.setImgUrl(imgUrl); |
| | | pageList.add(exchangeOrderList); |
| | | } |
| | | return pageList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取兑换订单详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ExchangeOrderGoodsInfo getGoodsExchangeOrder(String id) { |
| | | TExchangeOrder exchangeOrder = this.getById(id); |
| | | ExchangeOrderGoodsInfo info = new ExchangeOrderGoodsInfo(); |
| | | info.setId(id); |
| | | info.setStatus(exchangeOrder.getStatus()); |
| | | TAppUserAddress userAddress = appUserAddressClient.getAppUserAddressById(exchangeOrder.getAppUserAddressId()).getData(); |
| | | info.setConsignee(userAddress.getName()); |
| | | info.setPhone(userAddress.getPhone()); |
| | | info.setAddress(userAddress.getAddress()); |
| | | info.setExpressCompany(exchangeOrder.getExpressCompany()); |
| | | info.setExpressNumber(exchangeOrder.getExpressNumber()); |
| | | String name = ""; |
| | | String imgUrl = ""; |
| | | if(exchangeOrder.getOrderType() == 1){ |
| | | TGoods goods = goodsClient.getGoodsById(exchangeOrder.getGoodsId()).getData(); |
| | | name = goods.getName(); |
| | | imgUrl = goods.getCoverPicture(); |
| | | }else{ |
| | | TCoupon coupon = couponClient.getCouponById(exchangeOrder.getGoodsId()).getData(); |
| | | info.setCouponType(coupon.getType()); |
| | | info.setDays(coupon.getDays()); |
| | | info.setEndTime(coupon.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | name = coupon.getName(); |
| | | imgUrl = coupon.getCoverPicture(); |
| | | } |
| | | info.setName(name); |
| | | info.setImgUrl(imgUrl); |
| | | info.setPurchaseQuantity(exchangeOrder.getPurchaseQuantity()); |
| | | info.setUnitPoints(exchangeOrder.getPoints() / exchangeOrder.getPurchaseQuantity()); |
| | | info.setCode(exchangeOrder.getCode()); |
| | | info.setCreateTime(exchangeOrder.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | info.setPoints(exchangeOrder.getPoints()); |
| | | info.setRemark(exchangeOrder.getRemark()); |
| | | info.setDeliveryTime(exchangeOrder.getConsignerTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | info.setFinishTime(exchangeOrder.getReceivingTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | return info; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import cn.hutool.db.DaoTemplate; |
| | | import com.alibaba.fastjson2.JSON; |
| | | 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.feignClient.AppUserIntegralChangeClient; |
| | | 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.account.api.model.TAppUserIntegralChange; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.model.TOrderEvaluateTag; |
| | |
| | | import com.ruoyi.order.api.vo.TOrderEvaluateVO; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageList; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO; |
| | | import com.ruoyi.order.dto.OrderEvaluateVo; |
| | | import com.ruoyi.order.mapper.TChargingOrderMapper; |
| | | import com.ruoyi.order.mapper.TOrderEvaluateMapper; |
| | | import com.ruoyi.order.mapper.TOrderEvaluateTagMapper; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import com.ruoyi.order.service.TOrderEvaluateService; |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.feignClient.IntegralRuleClient; |
| | | import com.ruoyi.other.api.feignClient.TEvaluationTagClient; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | |
| | | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | |
| | | @Resource |
| | | private IntegralRuleClient integralRuleClient; |
| | | |
| | | @Resource |
| | | private AppUserIntegralChangeClient appUserIntegralChangeClient; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | return pageInfo.setRecords(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 评价订单 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | public AjaxResult addOrderEvaluate(OrderEvaluateVo query) { |
| | | TOrderEvaluate orderEvaluate = this.getOne(new LambdaQueryWrapper<TOrderEvaluate>().eq(TOrderEvaluate::getOrderId, query.getOrderId()) |
| | | .eq(TOrderEvaluate::getOrderType, query.getOrderType()).eq(TOrderEvaluate::getDelFlag, 0)); |
| | | if(null != orderEvaluate){ |
| | | return AjaxResult.error("不能重复评价"); |
| | | } |
| | | orderEvaluate = new TOrderEvaluate(); |
| | | BeanUtils.copyProperties(query, orderEvaluate); |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | orderEvaluate.setAppUserId(userid); |
| | | if(query.getOrderType() == 1){ |
| | | TChargingOrder chargingOrder = chargingOrderService.getById(query.getOrderId()); |
| | | orderEvaluate.setAppUserCarId(chargingOrder.getAppUserCarId()); |
| | | } |
| | | this.save(orderEvaluate); |
| | | |
| | | List<Integer> tagIds = query.getTagIds(); |
| | | for (Integer tagId : tagIds) { |
| | | TOrderEvaluateTag orderEvaluateTag = new TOrderEvaluateTag(); |
| | | orderEvaluateTag.setOrderEvaluateId(orderEvaluate.getId()); |
| | | orderEvaluateTag.setEvaluationTagId(tagId); |
| | | orderEvaluateTagMapper.insert(orderEvaluateTag); |
| | | } |
| | | |
| | | //判断发放积分 文字+图片+5星好评 |
| | | if(StringUtils.isNotEmpty(query.getContent()) && StringUtils.isNotEmpty(query.getImgUrl()) && 5 == query.getMark()){ |
| | | TIntegralRule data = integralRuleClient.getSet().getData(); |
| | | String credit = data.getCredit(); |
| | | //积分 |
| | | Integer num1 = JSON.parseObject(credit).getInteger("num1"); |
| | | if(null != num1 && 0 < num1){ |
| | | TAppUser appUser = appUserClient.getUserById(userid).getData(); |
| | | Integer points = appUser.getPoints(); |
| | | appUser.setPoints(appUser.getPoints() + num1); |
| | | appUserClient.updateAppUser(appUser); |
| | | |
| | | //积分变动明细 |
| | | TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); |
| | | appUserIntegralChange.setAppUserId(appUser.getId()); |
| | | appUserIntegralChange.setChangeType(3); |
| | | appUserIntegralChange.setHistoricalIntegral(points); |
| | | appUserIntegralChange.setCurrentIntegral(points + num1); |
| | | appUserIntegralChange.setCreateTime(LocalDateTime.now()); |
| | | appUserIntegralChangeClient.addAppUserIntegralChange(appUserIntegralChange); |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取订单评价 |
| | | * @param orderId 订单id |
| | | * @param orderType 订单类型 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public OrderEvaluateVo getOrderEvaluate(Integer orderId, Integer orderType) { |
| | | TOrderEvaluate orderEvaluate = this.getOne(new LambdaQueryWrapper<TOrderEvaluate>().eq(TOrderEvaluate::getOrderId, orderId).eq(TOrderEvaluate::getOrderType, orderType)); |
| | | if(null != orderEvaluate){ |
| | | OrderEvaluateVo orderEvaluateVo = new OrderEvaluateVo(); |
| | | BeanUtils.copyProperties(orderEvaluate, orderEvaluateVo); |
| | | List<TOrderEvaluateTag> tOrderEvaluateTags = orderEvaluateTagMapper.selectList(new LambdaQueryWrapper<TOrderEvaluateTag>().eq(TOrderEvaluateTag::getOrderEvaluateId, orderEvaluate.getId())); |
| | | List<Integer> tagId = tOrderEvaluateTags.stream().map(TOrderEvaluateTag::getEvaluationTagId).collect(Collectors.toList()); |
| | | List<TEvaluationTag> data = evaluationTagClient.getListByIds(tagId).getData(); |
| | | List<String> collect = data.stream().map(TEvaluationTag::getName).collect(Collectors.toList()); |
| | | orderEvaluateVo.setTagName(collect); |
| | | return orderEvaluateVo; |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | <result column="start_time" property="startTime" /> |
| | | <result column="end_time" property="endTime" /> |
| | | <result column="status" property="status" /> |
| | | <result column="end_mode" property="endMode"/> |
| | | <result column="recharge_amount" property="rechargeAmount" /> |
| | | <result column="recharge_payment_type" property="rechargePaymentType" /> |
| | | <result column="recharge_payment_status" property="rechargePaymentStatus" /> |
| | |
| | | id, code, order_type, order_classification, app_user_id, app_user_car_id,site_id, parking_lot_id, charging_pile_id, charging_gun_id, start_time, end_time, status, recharge_amount, recharge_payment_type, recharge_payment_status, recharge_serial_number, order_amount, app_coupon_id, coupon_discount_amount, vip_discount, vip_discount_amount, payment_amount, refund_code, refund_amount, refund_status, refund_serial_number, refund_time, create_time, del_flag |
| | | </sql> |
| | | |
| | | |
| | | <select id="getMyChargingOrderList" resultMap="BaseResultMap"> |
| | | select * from t_charging_order where del_flag = 0 and app_user_id = #{appUserId} |
| | | <if test="1 == type"> |
| | | and id not in (select order_id from t_order_evaluate where order_type = 1 and app_user_id = #{appUserId} and del_flag = 0) |
| | | </if> |
| | | order by create_time desc |
| | | <if test="null != pageCurr and null != pageSize"> |
| | | limit #{pageCurr}, #{pageSize} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | } |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取优惠券信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getCouponById/{id}") |
| | | public R<TCoupon> getCouponById(@PathVariable Integer id){ |
| | | TCoupon coupon = tCouponService.getById(id); |
| | | return R.ok(coupon); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | |
| | | * @param tagIds |
| | | * @return |
| | | */ |
| | | @GetMapping("/getListByIds") |
| | | public R<List<TEvaluationTag>> getListByIds(List<Integer> tagIds){ |
| | | @PostMapping("/getListByIds") |
| | | public R<List<TEvaluationTag>> getListByIds(@RequestBody List<Integer> tagIds){ |
| | | List<TEvaluationTag> tEvaluationTags = evaluationTagService.listByIds(tagIds); |
| | | return R.ok(tEvaluationTags); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getRandomEvaluationTag") |
| | | @ApiOperation(value = "获取随机的4个评价标签", tags = {"小程序-充电记录"}) |
| | | public AjaxResult<List<TEvaluationTag>> getRandomEvaluationTag(){ |
| | | List<TEvaluationTag> list = evaluationTagService.list(new LambdaQueryWrapper<TEvaluationTag>().last(" order by RAND() limit 0, 4")); |
| | | return AjaxResult.success(list); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | 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.other.api.domain.TActivity; |
| | |
| | | public AjaxResult<PageInfo<TGoods>> pageList(@RequestBody GoodsDTO dto) { |
| | | return AjaxResult.ok(goodsService.pageList(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 根据id获取商品信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/getGoodsById/{id}") |
| | | public R<TGoods> getGoodsById(@PathVariable Integer id){ |
| | | TGoods goods = goodsService.getById(id); |
| | | return R.ok(goods); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.other.api.domain.THtml; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.dto.SaveIntegralDTO; |
| | | import com.ruoyi.other.service.THtmlService; |
| | | import com.ruoyi.other.service.TIntegralRuleService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | private THtmlService htmlService; |
| | | @Autowired |
| | | private TIntegralRuleService integralRuleService; |
| | | |
| | | |
| | | |
| | | @GetMapping("/getSet") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "获取积分设置") |
| | | public R<TIntegralRule> getSet() { |
| | | TIntegralRule res = integralRuleService.getOne(new QueryWrapper<>()); |
| | | return R.ok(res); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/saveSet") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "保存积分设置") |
| | | public R saveSet(@RequestBody TIntegralRule dto) { |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getIntegralRule") |
| | | @ApiOperation(tags = {"小程序-充电记录"},value = "获取积分规则设置") |
| | | public AjaxResult<String> getIntegralRule(){ |
| | | TIntegralRule one = integralRuleService.getOne(null); |
| | | return AjaxResult.success(one); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/getSiteIds") |
| | | public R<List<Integer>> getSiteIds(Long roleId){ |
| | | @PostMapping("/getSiteIds/{roleId}") |
| | | public R<List<Integer>> getSiteIds(@PathVariable Long roleId){ |
| | | List<TRoleSite> list = roleSiteService.list(new LambdaQueryWrapper<TRoleSite>().eq(TRoleSite::getRoleId, roleId)); |
| | | List<Integer> collect = list.stream().map(TRoleSite::getSiteId).collect(Collectors.toList()); |
| | | return R.ok(collect); |
| | |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getSiteIds") |
| | | @PostMapping("/addRoleSite") |
| | | public R addRoleSite(@RequestBody List<TRoleSite> roleSites){ |
| | | roleSiteService.saveBatch(roleSites); |
| | | return R.ok(); |
| | |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/getSiteIds") |
| | | public R<List<Integer>> getSiteIds(Long userId){ |
| | | @PostMapping("/getSiteIds/{userId}") |
| | | public R<List<Integer>> getSiteIds(@PathVariable Long userId){ |
| | | List<TUserSite> list = userSiteService.list(new LambdaQueryWrapper<TUserSite>().eq(TUserSite::getUserId, userId)); |
| | | List<Integer> collect = list.stream().map(TUserSite::getSiteId).collect(Collectors.toList()); |
| | | return R.ok(collect); |
| | |
| | | <id column="id" property="id" /> |
| | | <result column="type" property="type" /> |
| | | <result column="name" property="name" /> |
| | | <result column="cover_picture" property="coverPicture"/> |
| | | <result column="details_picture" property="detailsPicture"/> |
| | | <result column="preferential_mode" property="preferentialMode" /> |
| | | <result column="discount_amount" property="discountAmount" /> |
| | | <result column="meet_the_conditions" property="meetTheConditions" /> |