无关风月
2024-08-30 a4fc8d1a88374ee4e1aba8acde5567e0abe9f659
Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
64个文件已修改
27个文件已添加
2444 ■■■■■ 已修改文件
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/InfoCouponDto.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/ListInfoCouponDto.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserAddress.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TInvoiceInformation.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ParkingLotFallbackFactory.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ParkingLotClient.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/ChargingGunCountVO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/SiteNameVO.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/ChargingHandshakeFallbackFactory.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/SendMessageFallbackFactory.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/ChargingHandshakeClient.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/SendMessageClient.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/model/ChargingHandshake.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/model/PlatformStartCharging.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrder.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrderRefund.java 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TOrderAppeal.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TShoppingOrder.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TShoppingOrderRefund.java 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TVipOrder.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TVipOrderRefund.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TOrderAppealVO.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/VipInfoDto.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/CouponFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/GoodsFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/CouponClient.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/GoodsClient.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/factory/WxPaymentFallbackFactory.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/feignClient/WxPaymentClient.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/vo/WxRefundNotifyResp.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/dto/ExchangeDto.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserAddressController.java 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java 99 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserVipDetailController.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TInvoiceInformationController.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/CarBrandUtil.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserAddressMapper.xml 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingLotController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyDetailServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/SiteMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/controller/ChargingHandshakeController.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/ChargingHandshakeService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java 269 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderAppealController.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/ChargingDetails.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/ChargingRefundDto.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/ManageFeedbackDto.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/ManageOrderAppealQuery.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/MyChargingOrderList.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/MyShoppingOrderInfo.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/MyShoppingOrderList.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/PayOrderChargingInfo.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/PayOrderDto.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/PayOrderInfoDto.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/PayOrderQueryDto.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderRefundMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TShoppingOrderRefundMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TVipOrderRefundMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderRefundService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TExchangeOrderService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TShoppingOrderRefundService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TShoppingOrderService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TVipOrderRefundService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderRefundServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java 125 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TExchangeOrderServiceImpl.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderAppealServiceImpl.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderRefundServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java 181 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TVipOrderRefundServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEvaluationTagController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TInvoiceTypeController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/WxPayController.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/InfoCouponDto.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -14,7 +15,7 @@
    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    private String id;
    @ApiModelProperty(value = "优惠券名称")
    @TableField("name")
    private String name;
@@ -35,8 +36,13 @@
    private BigDecimal discount;
    @ApiModelProperty(value = "结束时间")
    @TableField("end_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private LocalDateTime endTime;
    @ApiModelProperty(value = "开始时间")
    @TableField("start_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private LocalDateTime startTime;
    @ApiModelProperty(value = "最高优惠金额")
    @TableField("maximum_discount_amount")
    private BigDecimal maximumDiscountAmount;
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/ListInfoCouponDto.java
New file
@@ -0,0 +1,20 @@
package com.ruoyi.account.api.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class ListInfoCouponDto {
    List<InfoCouponDto> infoCouponDtoList;
    Integer num1;
    Integer num2;
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserFallbackFactory.java
@@ -54,6 +54,11 @@
            }
            @Override
            public R changeDown(PointChangeDto points) {
                return null;
            }
            @Override
            public R<TAppUser> selectByPhone(String phone) {
                return R.fail("积分变化失败:"+throwable.getMessage());
            }
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java
@@ -58,6 +58,8 @@
    @PostMapping("/t-app-user/user/points/change")
    R change(@RequestBody PointChangeDto points);
    @PostMapping("/t-app-user/user/points/change/down")
    R changeDown(@RequestBody PointChangeDto points);
    /**
     * 通过手机号查询用户
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserAddress.java
@@ -33,6 +33,10 @@
    @TableId("id")
    private Long id;
    @ApiModelProperty(value = "主键")
    @TableField(exist = false)
    private String uid;
    @ApiModelProperty(value = "用户id")
    @TableField("app_user_id")
    private Long appUserId;
@@ -45,6 +49,14 @@
    @TableField("phone")
    private String phone;
    @ApiModelProperty(value = "省名称")
    @TableField("province")
    private String province;
    @ApiModelProperty(value = "省编号")
    @TableField("province_code")
    private String provinceCode;
    @ApiModelProperty(value = "市名称")
    @TableField("city")
    private String city;
@@ -53,10 +65,22 @@
    @TableField("city_code")
    private String cityCode;
    @ApiModelProperty(value = "区县")
    @TableField("district")
    private String district;
    @ApiModelProperty(value = "区县code")
    @TableField("district_code")
    private String districtCode;
    @ApiModelProperty(value = "详细地址")
    @TableField("address")
    private String address;
    @ApiModelProperty(value = "门牌号")
    @TableField("house_number")
    private String houseNumber;
    @ApiModelProperty(value = "经度")
    @TableField("lon")
    private String lon;
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -57,10 +58,12 @@
    @ApiModelProperty(value = "会员开始时间")
    @TableField("start_time")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private LocalDateTime startTime;
    @ApiModelProperty(value = "会员结束时间")
    @TableField("end_time")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private LocalDateTime endTime;
    @TableField("create_time")
@@ -74,6 +77,8 @@
    @ApiModelProperty(value = "要赠送的优惠卷")
    @TableField("coupon_ids")
    private String couponIds;
    @TableField(exist = false)
    private String vipName;
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TInvoiceInformation.java
@@ -38,7 +38,11 @@
    @ApiModelProperty(value = "发票类型(1=增值税普通发票,2=增值税专用发票)")
    @TableField("invoice_type")
    private Integer invoiceType;
    private String invoiceType;
    @ApiModelProperty(value = "发票类型(1=增值税普通发票,2=增值税专用发票)")
    @TableField("invoice_type_id")
    private Integer invoiceTypeId;
    @ApiModelProperty(value = "抬头类型(1=个人,2=企业)")
    @TableField("invoicing_object_type")
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java
@@ -4,6 +4,7 @@
import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.chargingPile.api.vo.SiteNameVO;
import com.ruoyi.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,6 +37,11 @@
            public R<TChargingGun> getChargingGunById(Integer id) {
                return R.fail("根据id获取充电枪失败:" + throwable.getMessage());
            }
            @Override
            public R<SiteNameVO> getAllInfoById(Integer id) {
                return R.fail("通过枪id获取站点、桩、枪的名称失败:" + throwable.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ParkingLotFallbackFactory.java
@@ -4,6 +4,7 @@
import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.chargingPile.api.model.TParkingLot;
import com.ruoyi.chargingPile.api.model.TParkingRecord;
import com.ruoyi.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -31,6 +32,11 @@
            public R<TParkingLot> getLotBySiteId(Integer siteId) {
                return R.fail("通过站点id查询停车场信息调用失败:" + throwable.getMessage());
            }
            @Override
            public R<TParkingRecord> getRecordById(Long siteId) {
                return R.fail("通过id查询停车场记录:" + throwable.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java
@@ -2,6 +2,7 @@
import com.ruoyi.chargingPile.api.factory.ChargingGunFallbackFactory;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.vo.SiteNameVO;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import org.springframework.cloud.openfeign.FeignClient;
@@ -32,4 +33,13 @@
     */
    @PostMapping("/t-charging-gun/getChargingGunById/{id}")
    R<TChargingGun> getChargingGunById(@PathVariable("id") Integer id);
    /**
     * 通过枪id获取站点、桩、枪的名称VO
     * @param id
     * @return
     */
    @PostMapping("/t-charging-gun/getAllInfoById/{id}")
    R<SiteNameVO> getAllInfoById(@PathVariable("id") Integer id);
}
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ParkingLotClient.java
@@ -3,6 +3,7 @@
import com.ruoyi.chargingPile.api.factory.ParkingLotFallbackFactory;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.chargingPile.api.model.TParkingLot;
import com.ruoyi.chargingPile.api.model.TParkingRecord;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import io.swagger.annotations.ApiOperation;
@@ -26,4 +27,7 @@
    @PostMapping(value = "/t-parking-lot/getLotBySiteId")
    public R<TParkingLot> getLotBySiteId(@RequestParam("siteId") Integer siteId);
    @PostMapping(value = "/t-parking-lot/getRecordById")
    public R<TParkingRecord> getRecordById(@RequestParam("id") Long siteId);
}
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java
@@ -39,6 +39,9 @@
    @ApiModelProperty(value = "车牌号")
    @TableField("license_plate")
    private String licensePlate;
    @ApiModelProperty(value = "订单编号")
    @TableField("code")
    private String code;
    @ApiModelProperty(value = "车辆颜色")
    @TableField("vehicle_color")
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/ChargingGunCountVO.java
@@ -9,7 +9,7 @@
@ApiModel(value = "ChargingGunCountVO对象",description = "充电枪数量VO")
public class ChargingGunCountVO extends Site {
    @ApiModelProperty(value = "充电枪在线数量")
    @ApiModelProperty(value = "充电枪空闲数量")
    private Integer freeCount;
    @ApiModelProperty(value = "充电枪总数数量")
    private Integer totalCount;
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/SiteNameVO.java
New file
@@ -0,0 +1,24 @@
package com.ruoyi.chargingPile.api.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel(value = "获取站点、桩、枪的名称VO")
public class SiteNameVO implements Serializable {
    @ApiModelProperty(value = "站点名称")
    private String siteName;
    @ApiModelProperty(value = "桩名称")
    private String pileName;
    @ApiModelProperty(value = "桩号")
    private Integer pileNumber;
    @ApiModelProperty(value = "枪名称")
    private String gunName;
    @ApiModelProperty(value = "枪号")
    private String gunNumber;
}
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/ChargingHandshakeFallbackFactory.java
New file
@@ -0,0 +1,37 @@
package com.ruoyi.integration.api.factory;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.integration.api.feignClient.ChargingHandshakeClient;
import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient;
import com.ruoyi.integration.api.model.ChargingHandshake;
import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData;
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 ChargingHandshakeFallbackFactory implements FallbackFactory<ChargingHandshakeClient>
{
    private static final Logger log = LoggerFactory.getLogger(ChargingHandshakeFallbackFactory.class);
    @Override
    public ChargingHandshakeClient create(Throwable throwable) {
        log.error("调用充电握手数据失败:{}", throwable.getMessage());
        return new ChargingHandshakeClient() {
            @Override
            public R<ChargingHandshake> getDataByOrderCode(String code) {
                return R.fail("根据订单号查询充电握手数据失败:" + throwable.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/SendMessageFallbackFactory.java
New file
@@ -0,0 +1,34 @@
package com.ruoyi.integration.api.factory;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.integration.api.feignClient.ChargingHandshakeClient;
import com.ruoyi.integration.api.feignClient.SendMessageClient;
import com.ruoyi.integration.api.model.ChargingHandshake;
import com.ruoyi.integration.api.model.PlatformStartCharging;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/**
 * 充电桩服务降级处理
 *
 * @author ruoyi
 */
@Component
public class SendMessageFallbackFactory implements FallbackFactory<SendMessageClient>
{
    private static final Logger log = LoggerFactory.getLogger(SendMessageFallbackFactory.class);
    @Override
    public SendMessageClient create(Throwable throwable) {
        log.error("发送充电桩消息失败:{}", throwable.getMessage());
        return new SendMessageClient() {
            @Override
            public void platformStartCharging(PlatformStartCharging platformStartCharging) {
            }
        };
    }
}
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/ChargingHandshakeClient.java
New file
@@ -0,0 +1,26 @@
package com.ruoyi.integration.api.feignClient;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.integration.api.factory.ChargingHandshakeFallbackFactory;
import com.ruoyi.integration.api.model.ChargingHandshake;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * @author zhibing.pu
 * @Date 2024/8/28 10:46
 */
@FeignClient(contextId = "ChargingHandshakeClient", value = ServiceNameConstants.INTEGRATION_SERVICE, fallbackFactory = ChargingHandshakeFallbackFactory.class)
public interface ChargingHandshakeClient {
    /**
     * 根据订单号查询充电握手数据
     * @param code
     * @return
     */
    @PostMapping("/chargingHandshake/getDataByOrderCode")
    R<ChargingHandshake> getDataByOrderCode(@RequestParam("code") String code);
}
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/SendMessageClient.java
New file
@@ -0,0 +1,26 @@
package com.ruoyi.integration.api.feignClient;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.integration.api.factory.SendMessageFallbackFactory;
import com.ruoyi.integration.api.model.EndCharge;
import com.ruoyi.integration.api.model.PlatformStartCharging;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
 * @author zhibing.pu
 * @Date 2024/8/28 16:53
 */
@FeignClient(contextId = "SendMessageClient", value = ServiceNameConstants.INTEGRATION_SERVICE, fallbackFactory = SendMessageFallbackFactory.class)
public interface SendMessageClient {
    /**
     * 远程控制启动充电
     * @param platformStartCharging
     * @return
     */
    @PostMapping("/sendMessage/platformStartCharging")
    void platformStartCharging(@RequestBody PlatformStartCharging platformStartCharging);
}
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/model/ChargingHandshake.java
@@ -2,6 +2,7 @@
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.math.BigDecimal;
@@ -14,7 +15,7 @@
@Document(collection = "charging_handshake") //指定要对应的文档名(表名)
@Accessors(chain = true)
public class ChargingHandshake extends BaseModel {
    @Id
    private String transaction_serial_number;// 交易流水号
    private String charging_pile_code;// 桩编码
    private String charging_gun_code;// 抢号
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/model/PlatformStartCharging.java
@@ -2,6 +2,7 @@
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.math.BigDecimal;
@@ -15,6 +16,7 @@
@Accessors(chain = true)
public class PlatformStartCharging extends BaseModel {
    @Id
    private String transaction_serial_number; // 交易流水号
    private String charging_pile_code; // 桩编码
    private String charging_gun_code; // 抢号
ruoyi-api/ruoyi-api-integration/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -1,2 +1,4 @@
com.ruoyi.integration.api.factory.IntegrationFallbackFactory
com.ruoyi.integration.api.factory.UploadRealTimeMonitoringDataFallbackFactory
com.ruoyi.integration.api.factory.UploadRealTimeMonitoringDataFallbackFactory
com.ruoyi.integration.api.factory.ChargingHandshakeFallbackFactory
com.ruoyi.integration.api.factory.SendMessageFallbackFactory
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrder.java
@@ -155,4 +155,17 @@
    @TableField("refund_time")
    private LocalDateTime refundTime;
    @ApiModelProperty(value = "支付时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField("pay_time")
    private LocalDateTime payTime;
    @ApiModelProperty(value = "累计服务费")
    @TableField("service_charge")
    private BigDecimal serviceCharge;
    @ApiModelProperty(value = "累计电费")
    @TableField("electrovalence")
    private BigDecimal electrovalence;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrderRefund.java
New file
@@ -0,0 +1,90 @@
package com.ruoyi.order.api.model;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * <p>
 *
 * </p>
 *
 * @author xiaochen
 * @since 2024-08-26
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_charging_order_refund")
@ApiModel(value="TChargingOrderRefund对象", description="")
public class TChargingOrderRefund implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "主键")
    @TableField("id")
    private Long id;
    @ApiModelProperty(value = "订单id")
    @TableField("charging_order_id")
    private Long chargingOrderId;
    @ApiModelProperty(value = "退款流水号")
    @TableField("refund_code")
    private String refundCode;
    @ApiModelProperty(value = "退款金额")
    @TableField("refund_amount")
    private BigDecimal refundAmount;
    @ApiModelProperty(value = "退款状态(1=退款中,2=退款成功)")
    @TableField("refund_status")
    private Integer refundStatus;
    @ApiModelProperty(value = "1wx2ali")
    @TableField("pay_type")
    private Integer payType;
    @ApiModelProperty(value = "退款第三方流水号")
    @TableField("refund_serial_number")
    private String refundSerialNumber;
    @ApiModelProperty(value = "退款成功时间")
    @TableField("refund_time")
    private LocalDateTime refundTime;
    @ApiModelProperty(value = "订单编号")
    @TableField("code")
    private String code;
    @ApiModelProperty(value = "退款标题")
    @TableField("refund_title")
    private String refundTitle;
    @ApiModelProperty(value = "退款内容")
    @TableField("refund_content")
    private String refundContent;
    @ApiModelProperty(value = "退款原因")
    @TableField("refund_reason")
    private String refundReason;
    @ApiModelProperty(value = "退款备注")
    @TableField("refund_remark")
    private String refundRemark;
    @ApiModelProperty(value = "累计退款金额")
    @TableField("refund_total_amount")
    private BigDecimal refundTotalAmount;
    @ApiModelProperty(value = "累计退款金额")
    @TableField("pay_amount")
    private BigDecimal payAmount;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TOrderAppeal.java
@@ -35,6 +35,10 @@
    @TableField("order_type")
    private Integer orderType;
    @ApiModelProperty(value = "订单编号")
    @TableField("code")
    private String code;
    @ApiModelProperty(value = "订单id")
    @TableField("order_id")
    private Long orderId;
@@ -47,6 +51,10 @@
    @TableField("reason")
    private String reason;
    @ApiModelProperty(value = "联系方式")
    @TableField("phone")
    private String phone;
    @ApiModelProperty(value = "申诉内容")
    @TableField("content")
    private String content;
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TShoppingOrder.java
@@ -157,6 +157,11 @@
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField("refund_time")
    private LocalDateTime refundTime;
    @ApiModelProperty(value = "支付时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField("pay_time")
    private LocalDateTime payTime;
    @ApiModelProperty(value = "收货人")
    @TableField(exist = false)
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TShoppingOrderRefund.java
New file
@@ -0,0 +1,97 @@
package com.ruoyi.order.api.model;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * <p>
 *
 * </p>
 *
 * @author xiaochen
 * @since 2024-08-26
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_shopping_order_refund")
@ApiModel(value="TShoppingOrderRefund对象", description="")
public class TShoppingOrderRefund implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "主键")
    @TableField("id")
    private Long id;
    @ApiModelProperty(value = "支付时间")
    @TableField("pay_time")
    private LocalDateTime payTime;
    @ApiModelProperty(value = "支付流水号")
    @TableField("pay_code")
    private String payCode;
    @ApiModelProperty(value = "累计退款金额")
    @TableField("pay_amount")
    private BigDecimal payAmount;
    @ApiModelProperty(value = "1wx2ali")
    @TableField("pay_type")
    private Integer payType;
    @ApiModelProperty(value = "订单id")
    @TableField("shopping_order_id")
    private Long shoppingOrderId;
    @ApiModelProperty(value = "退款流水号")
    @TableField("refund_code")
    private String refundCode;
    @ApiModelProperty(value = "退款金额")
    @TableField("refund_amount")
    private BigDecimal refundAmount;
    @ApiModelProperty(value = "退款状态(1=退款中,2=退款成功)")
    @TableField("refund_status")
    private Integer refundStatus;
    @ApiModelProperty(value = "退款第三方流水号")
    @TableField("refund_serial_number")
    private String refundSerialNumber;
    @ApiModelProperty(value = "退款成功时间")
    @TableField("refund_time")
    private LocalDateTime refundTime;
    @ApiModelProperty(value = "订单编号")
    @TableField("code")
    private String code;
    @ApiModelProperty(value = "退款标题")
    @TableField("refund_title")
    private String refundTitle;
    @ApiModelProperty(value = "退款内容")
    @TableField("refund_content")
    private String refundContent;
    @ApiModelProperty(value = "退款原因")
    @TableField("refund_reason")
    private String refundReason;
    @ApiModelProperty(value = "退款备注")
    @TableField("refund_remark")
    private String refundRemark;
    @ApiModelProperty(value = "累计退款金额")
    @TableField("refund_total_amount")
    private BigDecimal refundTotalAmount;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TVipOrder.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.web.domain.BasePojo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -11,6 +12,7 @@
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
 * <p>
@@ -80,4 +82,12 @@
    @TableField("serial_number")
    private String serialNumber;
    @ApiModelProperty(value = "支付时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField("pay_time")
    private LocalDateTime payTime;
    @ApiModelProperty(value = "退款金额")
    @TableField("refund_amount")
    private BigDecimal refundAmount;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TVipOrderRefund.java
New file
@@ -0,0 +1,91 @@
package com.ruoyi.order.api.model;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * <p>
 *
 * </p>
 *
 * @author xiaochen
 * @since 2024-08-26
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_vip_order_refund")
@ApiModel(value="TVipOrderRefund对象", description="")
public class TVipOrderRefund implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "主键")
    @TableField("id")
    private Long id;
    @ApiModelProperty(value = "累计退款金额")
    @TableField("pay_amount")
    private BigDecimal payAmount;
    @ApiModelProperty(value = "1wx2ali")
    @TableField("pay_type")
    private Integer payType;
    @ApiModelProperty(value = "订单id")
    @TableField("vip_order_id")
    private Long vipOrderId;
    @ApiModelProperty(value = "退款流水号")
    @TableField("refund_code")
    private String refundCode;
    @ApiModelProperty(value = "退款金额")
    @TableField("refund_amount")
    private BigDecimal refundAmount;
    @ApiModelProperty(value = "退款状态(1=退款中,2=退款成功)")
    @TableField("refund_status")
    private Integer refundStatus;
    @ApiModelProperty(value = "退款第三方流水号")
    @TableField("refund_serial_number")
    private String refundSerialNumber;
    @ApiModelProperty(value = "退款成功时间")
    @TableField("refund_time")
    private LocalDateTime refundTime;
    @ApiModelProperty(value = "订单编号")
    @TableField("code")
    private String code;
    @ApiModelProperty(value = "退款标题")
    @TableField("refund_title")
    private String refundTitle;
    @ApiModelProperty(value = "退款内容")
    @TableField("refund_content")
    private String refundContent;
    @ApiModelProperty(value = "退款原因")
    @TableField("refund_reason")
    private String refundReason;
    @ApiModelProperty(value = "退款备注")
    @TableField("refund_remark")
    private String refundRemark;
    @ApiModelProperty(value = "累计退款金额")
    @TableField("refund_total_amount")
    private BigDecimal refundTotalAmount;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TOrderAppealVO.java
@@ -4,10 +4,15 @@
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@Data
@ApiModel(value = "TOrderAppealVO对象", description = "订单申诉VO对象")
public class TOrderAppealVO extends TOrderAppeal {
    @ApiModelProperty(value = "uid")
    private String uid;
    @ApiModelProperty(value = "充电订单")
    private TChargingOrder chargingOrder;
@@ -15,10 +20,20 @@
    @ApiModelProperty(value = "购物订单")
    private TShoppingOrder shoppingOrder;
    @ApiModelProperty(value = "兑换订单")
    private TExchangeOrder exchangeOrder;
    @ApiModelProperty(value = "商品名称")
    private String goodsName;
    @ApiModelProperty(value = "商品图片")
    private String goodsPicture;
    @ApiModelProperty(value = "会员订单")
    private TVipOrder vipOrder;
    @ApiModelProperty(value = "站点名称")
    private String siteName;
    @ApiModelProperty(value = "桩名称")
    private String pileName;
    @ApiModelProperty(value = "桩号")
    private Integer pileNumber;
    @ApiModelProperty(value = "枪名称")
    private String gunName;
    @ApiModelProperty(value = "枪号")
    private String gunNumber;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/VipInfoDto.java
@@ -12,12 +12,19 @@
    @ApiModelProperty("月卡价格")
    private BigDecimal monthlyCard;
    @ApiModelProperty(value = "月卡折扣")
    private BigDecimal monthlyCardDiscount;
    @ApiModelProperty("季卡价格")
    private BigDecimal seasonCard;
    @ApiModelProperty(value = "季卡折扣")
    private BigDecimal seasonCardDiscount;
    @ApiModelProperty("年卡价格")
    private BigDecimal annualCard;
    @ApiModelProperty(value = "年卡折扣")
    private BigDecimal annualCardDiscount;
    @ApiModelProperty("最高抵扣价格")
    private BigDecimal maximumDeduction;
    private BigDecimal timeAmount;
    @ApiModelProperty("抵扣次数")
    private Integer discountTimes;
@@ -32,4 +39,7 @@
    @ApiModelProperty(value = "最高总折扣")
    private BigDecimal totalDiscount;
    @ApiModelProperty(value = "会员名称")
    private String name;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/CouponFallbackFactory.java
@@ -35,6 +35,11 @@
            public R<List<Integer>> getCouponIdsByName(String name) {
                return R.fail("根据名称查询优惠券ids:" + throwable.getMessage());
            }
            @Override
            public R updateCoupon(TCoupon coupon) {
                throw new RuntimeException("修改优惠券失败");
            }
        };
    }
    
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/GoodsFallbackFactory.java
@@ -33,6 +33,11 @@
            public R<List<Integer>> getGoodsIdsByName(String name) {
                return R.fail("根据商品名称获取商品ids失败:" + throwable.getMessage());
            }
            @Override
            public R updateGoods(TGoods goods) {
                throw new RuntimeException("修改商品异常");
            }
        };
    }
    
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/CouponClient.java
@@ -8,6 +8,7 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@@ -28,4 +29,13 @@
    R<TCoupon> getCouponById1(@PathVariable("id") Integer id);
    @PostMapping("/t-coupon/getCouponIdsByName/{name}")
     R<List<Integer>> getCouponIdsByName(@PathVariable("name")String name);
    /**
     * 修改优惠券
     * @param coupon
     * @return
     */
    @PostMapping("/t-coupon/updateCoupon")
    R updateCoupon(@RequestBody TCoupon coupon);
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/GoodsClient.java
@@ -8,6 +8,7 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@@ -32,4 +33,13 @@
     */
    @PostMapping("/t-goods/getGoodsIdsByName/{name}")
    public R<List<Integer>> getGoodsIdsByName(@PathVariable("name")String name);
    /**
     * 修改商品
     * @param goods
     * @return
     */
    @PostMapping("/t-goods/updateGoods")
    R updateGoods(@RequestBody TGoods goods);
}
ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/factory/WxPaymentFallbackFactory.java
@@ -5,6 +5,7 @@
import com.ruoyi.payment.api.model.WxPaymentRefundModel;
import com.ruoyi.payment.api.vo.NotifyV3PayDecodeRespBody;
import com.ruoyi.payment.api.vo.PaymentOrder;
import com.ruoyi.payment.api.vo.WxRefundNotifyResp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
@@ -58,6 +59,11 @@
                return R.fail("微信退款失败:" + throwable.getMessage());
            }
            @Override
            public R<WxRefundNotifyResp> refundNotify(HttpServletRequest request) {
                return R.fail("微信退款回调失败:" + throwable.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/feignClient/WxPaymentClient.java
@@ -6,6 +6,7 @@
import com.ruoyi.payment.api.model.WxPaymentRefundModel;
import com.ruoyi.payment.api.vo.NotifyV3PayDecodeRespBody;
import com.ruoyi.payment.api.vo.PaymentOrder;
import com.ruoyi.payment.api.vo.WxRefundNotifyResp;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
@@ -65,4 +66,10 @@
    @ApiOperation("订单退款")
    @PostMapping(value = "/wx/refundOrderR")
    public R<String> refundOrderR(@RequestBody WxPaymentRefundModel model);
    @ApiOperation("订单退款回调")
    @PostMapping(value = "/wx/refund/notify")
    R<WxRefundNotifyResp> refundNotify(HttpServletRequest request);
}
ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/vo/WxRefundNotifyResp.java
New file
@@ -0,0 +1,35 @@
package com.ruoyi.payment.api.vo;
import lombok.Data;
/**
 * @author zhibing.pu
 * @Date 2024/8/28 14:54
 */
@Data
public class WxRefundNotifyResp {
    /**
     * 支付单号
     */
    private String out_trade_no;
    /**
     * 退款单号
     */
    private String out_refund_no;
    /**
     * 支付流水号
     */
    private String transaction_id;
    /**
     * 退款流水号
     */
    private String refund_id;
    /**
     * 退款状态
     */
    private String tradeState;
    /**
     * 退款时间
     */
    private String success_time;
}
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/dto/ExchangeDto.java
@@ -10,7 +10,7 @@
    @ApiModelProperty("商品id")
    Integer goodId;
    @ApiModelProperty("地址id")
    Integer addressId;
    Long addressId;
    @ApiModelProperty("备注")
    String remark;
    @ApiModelProperty(hidden = true)
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserAddressController.java
@@ -12,6 +12,7 @@
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
 * <p>
@@ -53,19 +54,26 @@
    public AjaxResult<List<TAppUserAddress>> queryAddress() {
        // 用户id
        Long userId = tokenService.getLoginUserApplet().getUserId();
        return AjaxResult.ok(appUserAddressService.list(Wrappers.<TAppUserAddress>lambdaQuery().eq(TAppUserAddress::getAppUserId, userId)));
        List<TAppUserAddress> list = appUserAddressService.list(Wrappers.<TAppUserAddress>lambdaQuery().eq(TAppUserAddress::getAppUserId, userId));
        list.forEach(e->e.setUid(e.getId().toString()));
        return AjaxResult.ok(list);
    }
    /**
     * 查询用户默认地址列表
     */
    @ApiOperation(tags = {"小程序-用户地址"},value = "查询用户默认地址列表")
    @ApiOperation(tags = {"小程序-用户地址"},value = "查询用户默认地址")
    @GetMapping(value = "/queryDefaultAddress")
    public AjaxResult<TAppUserAddress> queryDefaultAddress() {
        // 用户id
        Long userId = tokenService.getLoginUserApplet().getUserId();
        return AjaxResult.ok(appUserAddressService.getOne(Wrappers.<TAppUserAddress>lambdaQuery().eq(TAppUserAddress::getAppUserId, userId)
                .eq(TAppUserAddress::getDefaultAddress,1)));
        TAppUserAddress appUserAddress = appUserAddressService.getOne(Wrappers.<TAppUserAddress>lambdaQuery().eq(TAppUserAddress::getAppUserId, userId)
                .eq(TAppUserAddress::getDefaultAddress, 1));
        if(Objects.isNull(appUserAddress)){
            return AjaxResult.success();
        }
        appUserAddress.setUid(appUserAddress.getId().toString());
        return AjaxResult.success(appUserAddress);
    }
@@ -85,12 +93,39 @@
    /**
     * 修改用户地址
     */
    @ApiOperation(tags = {"小程序-用户地址"},value = "设置默认地址")
    @GetMapping(value = "/setDefaultAddress")
    public AjaxResult<String> setDefaultAddress(@RequestParam(value = "id") Long  id) {
        // 修改用户默认地址
        appUserAddressService.updateDefaultAddress(1,tokenService.getLoginUserApplet().getUserId());
        TAppUserAddress appUserAddress = appUserAddressService.getById(id);
        appUserAddress.setDefaultAddress(1);
        appUserAddressService.updateById(appUserAddress);
        return AjaxResult.success();
    }
    /**
     * 修改用户地址
     */
    @ApiOperation(tags = {"小程序-用户地址"},value = "修改用户地址")
    @PostMapping(value = "/update")
    public AjaxResult<Boolean> update(@RequestBody TAppUserAddress dto) {
        // 用户id
        dto.setAppUserId(tokenService.getLoginUserApplet().getUserId());
        // 修改用户默认地址
        appUserAddressService.updateDefaultAddress(dto.getDefaultAddress(),dto.getAppUserId());
        return AjaxResult.ok(appUserAddressService.updateById(dto));
    }
    /**
     * 通过地址id 查询地址信息
     * @param id
     * @return
     */
    @ApiOperation(tags = {"小程序-用户地址"},value = "查询用户地址详情")
    @GetMapping(value = "/getDetailById")
    public R<TAppUserAddress> getDetailById(@RequestParam(value = "id")Long id) {
        return R.ok(appUserAddressService.getById(id));
    }
    /**
@@ -98,7 +133,7 @@
     */
    @ApiOperation(tags = {"小程序-用户地址"},value = "删除用户地址")
    @DeleteMapping(value = "/deleteById")
    public AjaxResult<Boolean> deleteById(@RequestParam("id") Integer id) {
    public AjaxResult<Boolean> deleteById(@RequestParam("id") Long id) {
        return AjaxResult.ok(appUserAddressService.removeById(id));
    }
    
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -340,6 +340,7 @@
            //累计充电次数
            R<Long> useOrderCount = chargingOrderClient.useOrderCount(appUser.getId());
            appUser.setOrderCount(useOrderCount.getData());
            appUser.setUid(appUser.getId().toString());
        }
        return R.ok(page);
@@ -512,7 +513,7 @@
            appUserInfoDto.setVipExpireTime(byId.getVipEndTime());
        }
        //判断当天是否签到
        Long count = signService.lambdaQuery().eq(TAppUserSign::getSignDay, LocalDate.now()).count();
        Long count = signService.lambdaQuery().eq(TAppUserSign::getAppUserId,userId).eq(TAppUserSign::getSignDay, LocalDate.now()).count();
        appUserInfoDto.setIsSign(count>0?1:0);
        //获取当前拥有的优惠卷数量
        Long coupons = appCouponService.lambdaQuery().eq(TAppCoupon::getAppUserId, userId).eq(TAppCoupon::getStatus, 1).count();
@@ -524,36 +525,68 @@
        }
        appUserInfoDto.setUserCars(list);
        appUserInfoDto.setFirstAdd(byId.getFirstAdd()!=null?byId.getFirstAdd():0);
        appUserInfoDto.setPoints(byId.getPoints()==null?0:byId.getPoints());
        return R.ok(appUserInfoDto);
    }
    @ApiOperation(value = "优惠卷列表不分页(1可使用2不可用)", tags = {"小程序-个人中心"})
    @PostMapping(value = "/user/coupon")
    public R<List<InfoCouponDto>> userCoupon(@RequestParam("type") Integer type) {
    @GetMapping(value = "/user/coupon")
    public R<ListInfoCouponDto> userCoupon(@RequestParam("type") Integer type) {
        Long userId = tokenService.getLoginUserApplet().getUserId();
        LocalDateTime now = LocalDateTime.now();
        List<InfoCouponDto> couponDtos = new ArrayList<>();
        List<TAppCoupon> list = appCouponService.lambdaQuery().le(TAppCoupon::getStartTime, now).ge(TAppCoupon::getEndTime, now).eq(TAppCoupon::getStatus, type).list();
        for (TAppCoupon tAppCoupon : list) {
        List<InfoCouponDto> couponDtos1 = new ArrayList<>();
            List<TAppCoupon> list = appCouponService.lambdaQuery().eq(TAppCoupon::getAppUserId, userId).ge(TAppCoupon::getEndTime, now).eq(TAppCoupon::getStatus, 1).list();
            for (TAppCoupon tAppCoupon : list) {
                TCoupon coupon = JSON.toJavaObject(JSON.parseObject(tAppCoupon.getCouponJson()), TCoupon.class);
                InfoCouponDto infoCouponDto = new InfoCouponDto();
                BeanUtils.copyProperties(coupon, infoCouponDto);
                infoCouponDto.setId(tAppCoupon.getId().toString());
                infoCouponDto.setEndTime(tAppCoupon.getEndTime());
                couponDtos1.add(infoCouponDto);
            }
        List<TAppCoupon> list1 = appCouponService.lambdaQuery().eq(TAppCoupon::getAppUserId, userId).eq(TAppCoupon::getStatus, 2).list();
        List<TAppCoupon> list2 = appCouponService.lambdaQuery().eq(TAppCoupon::getAppUserId, userId).lt(TAppCoupon::getEndTime, now).list();
        List<InfoCouponDto> couponDtos2 = new ArrayList<>();
        for (TAppCoupon tAppCoupon : list1) {
            TCoupon coupon = JSON.toJavaObject(JSON.parseObject(tAppCoupon.getCouponJson()), TCoupon.class);
            InfoCouponDto infoCouponDto = new InfoCouponDto();
            BeanUtils.copyProperties(coupon,infoCouponDto);
            infoCouponDto.setId(tAppCoupon.getId());
            couponDtos.add(infoCouponDto);
            BeanUtils.copyProperties(coupon, infoCouponDto);
            infoCouponDto.setId(tAppCoupon.getId().toString());
            infoCouponDto.setEndTime(tAppCoupon.getEndTime());
            couponDtos2.add(infoCouponDto);
        }
        for (TAppCoupon tAppCoupon : list2) {
            TCoupon coupon = JSON.toJavaObject(JSON.parseObject(tAppCoupon.getCouponJson()), TCoupon.class);
            InfoCouponDto infoCouponDto = new InfoCouponDto();
            BeanUtils.copyProperties(coupon, infoCouponDto);
            infoCouponDto.setId(tAppCoupon.getId().toString());
            infoCouponDto.setEndTime(tAppCoupon.getEndTime());
            couponDtos2.add(infoCouponDto);
        }
        return R.ok(couponDtos);
        ListInfoCouponDto listInfoCouponDto = new ListInfoCouponDto();
        if (type==1){
            listInfoCouponDto.setInfoCouponDtoList(couponDtos1);
        }else {
            listInfoCouponDto.setInfoCouponDtoList(couponDtos2);
        }
        listInfoCouponDto.setNum1(couponDtos1.size());
        listInfoCouponDto.setNum2(couponDtos2.size());
        return R.ok(listInfoCouponDto);
    }
    @ApiOperation(value = "优惠卷详情(1可使用2不可用)", tags = {"小程序-个人中心"})
    @PostMapping(value = "/user/coupon/getById")
    @GetMapping(value = "/user/coupon/getById")
    public R<TAppCoupon> couponGetById(@RequestParam("id")Long id) {
        TAppCoupon appCoupon = appCouponService.getById(id);
        return R.ok(appCoupon);
@@ -595,7 +628,7 @@
    }
    @ApiOperation(value = "已赠送列表", tags = {"小程序-个人中心-邀请好友"})
    @PostMapping(value = "/user/invite/info")
    @GetMapping(value = "/user/invite/info")
    public R<InviteInfoDto> inviteInfo() {
        Long userId = tokenService.getLoginUserApplet().getUserId();
        Integer point = 0;
@@ -784,6 +817,15 @@
        return R.ok();
    }
    @PostMapping(value = "/user/points/change/down")
    public R changeDown(@RequestBody PointChangeDto points) {
        TAppUser byId = appUserService.getById(points.getUserId());
        pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()-points.getPoints(),points.getType(),points.getUserId(),points.getRemark(),"JF");
        byId.setPoints(byId.getPoints()-points.getPoints());
        appUserService.updateById(byId);
        return R.ok();
    }
    @ApiOperation(value = "添加编辑车辆", tags = {"小程序-个人中心-车辆"})
    @PostMapping(value = "/user/car/addOrUpdate")
    public R carAdd(@RequestBody TAppUserCar appUserCar) {
@@ -834,7 +876,7 @@
        return R.ok();
    }
    @ApiOperation(value = "添加编辑车辆", tags = {"小程序-个人中心-车辆"})
    @DeleteMapping(value = "/user/car/delete")
    @GetMapping(value = "/user/car/delete")
    public R carDelete(String id) {
        boolean b = appUserCarService.removeById(id);
        return R.ok();
@@ -875,15 +917,26 @@
    public R getSeries(String id) throws Exception {
        String modelById = CarBrandUtil.getSeriesById(id);
        JSONObject jsonObject = JSON.parseObject(modelById);
        JSONArray data = jsonObject.getJSONArray("data");
        JSONArray backList = new JSONArray();
        for (Object datum : data) {
            JSONObject jsonObject1 = JSON.parseObject(datum.toString());
            JSONArray list = jsonObject1.getJSONArray("list");
            backList.addAll(list);
        }
        return R.ok(backList);
        JSONObject data1 = jsonObject.getJSONObject("data");
        JSONArray data = data1.getJSONArray("list");
//        JSONArray data = jsonObject.getJSONArray(data1.get("list").toString());
//        JSONArray backList = new JSONArray();
//        for (Object datum : data) {
//            JSONObject jsonObject1 = JSON.parseObject(datum.toString());
//            JSONArray list = jsonObject1.getJSONArray("list");
//            backList.addAll(jsonObject1);
//        }
        return R.ok(data);
    }
    @ApiOperation(value = "根据车型获取详情", tags = {"小程序-个人中心-车辆"})
    @GetMapping(value = "/user/car/getDetail")
    public R getDetail(String id) throws Exception {
        String detailById = CarBrandUtil.getDetailById(id);
        JSONObject jsonObject = JSON.parseObject(detailById);
        return R.ok(jsonObject.getJSONObject("data"));
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserVipDetailController.java
@@ -5,12 +5,14 @@
import com.ruoyi.account.api.vo.GetAppUserVipDetail;
import com.ruoyi.account.service.TAppUserVipDetailService;
import com.ruoyi.common.core.domain.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.other.api.domain.TVip;
import com.ruoyi.other.api.feignClient.VipClient;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
 * @author zhibing.pu
@@ -22,6 +24,8 @@
    
    @Resource
    private TAppUserVipDetailService appUserVipDetailService;
    @Resource
    private TokenService tokenService;
    
    /**
     * 获取用户当前有效的vip明细
@@ -36,6 +40,22 @@
                .last(" and now() between start_time and end_time"));
        return R.ok(one);
    }
    @Resource
    private VipClient vipClient;
    @GetMapping("/getVipUseDetail")
    @ApiOperation(value = "生效会员列表", tags = {"小程序-个人中心"})
    public R<List<TAppUserVipDetail>> getVipUseDetail(){
        Long userId = tokenService.getLoginUserApplet().getUserId();
        List<TAppUserVipDetail> list = appUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, userId).last(" and now() between start_time and end_time order by start_time desc").list();
        for (TAppUserVipDetail tAppUserVipDetail : list) {
            TVip data = vipClient.getInfo1(tAppUserVipDetail.getVipId()).getData();
            tAppUserVipDetail.setVipName(data.getName());
        }
        return R.ok(list);
    }
    
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TInvoiceInformationController.java
@@ -3,13 +3,16 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.account.api.model.TInvoiceInformation;
import com.ruoyi.account.api.vo.InvoiceInformationVo;
import com.ruoyi.account.service.TInvoiceInformationService;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.service.TokenService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
@@ -34,10 +37,17 @@
    @ResponseBody
    @GetMapping(value = "/getInvoiceInformationList")
    @ApiOperation(value = "获取开票抬头数据列表", tags = {"小程序-充电发票"})
    public AjaxResult<List<TInvoiceInformation>> getInvoiceInformationList(){
    public AjaxResult<List<InvoiceInformationVo>> getInvoiceInformationList(){
        Long userId = tokenService.getLoginUserApplet().getUserId();
        List<TInvoiceInformation> list = invoiceInformationService.list(new LambdaQueryWrapper<TInvoiceInformation>().eq(TInvoiceInformation::getAppUserId, userId).eq(TInvoiceInformation::getDelFlag, 0));
        return AjaxResult.success(list);
        List<InvoiceInformationVo> lists = new ArrayList<>();
        for (TInvoiceInformation tInvoiceInformation : list) {
            InvoiceInformationVo vo = new InvoiceInformationVo();
            BeanUtils.copyProperties(tInvoiceInformation, vo);
            vo.setId(tInvoiceInformation.getId().toString());
            lists.add(vo);
        }
        return AjaxResult.success(lists);
    }
    
    
@@ -48,7 +58,7 @@
    public AjaxResult addInvoiceInformation(@RequestBody TInvoiceInformation invoiceInformation){
        Long userId = tokenService.getLoginUserApplet().getUserId();
        //如果当前是默认抬头,则需要去除其他的默认配置
        if(1 == invoiceInformation.getIsDefault()){
        if(null != invoiceInformation.getIsDefault() && 1 == invoiceInformation.getIsDefault()){
            TInvoiceInformation one = invoiceInformationService.getOne(new LambdaQueryWrapper<TInvoiceInformation>().eq(TInvoiceInformation::getDelFlag, 0)
                    .eq(TInvoiceInformation::getIsDefault, 1).eq(TInvoiceInformation::getAppUserId, userId));
            if(null != one){
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/CarBrandUtil.java
@@ -172,4 +172,58 @@
        }
        return "";
    }
    public static   String getDetailById(String brandId) throws Exception {
        // Create a new request.
        Request httpClientRequest = new Request();
        try {
            // Set the request parameters.
            // AppKey, AppSecrect, Method and Url are required parameters.
            // Directly writing AK/SK in code is risky. For security, encrypt your AK/SK and store them in the configuration file or environment variables.
            // In this example, the AK/SK are stored in environment variables for identity authentication.
            // Before running this example, set environment variables HUAWEICLOUD_SDK_AK and HUAWEICLOUD_SDK_SK.
            httpClientRequest.setKey("9a4a2b69afe141718f6843c5d39961ec");
            httpClientRequest.setSecret("541845f206324bbc933065b44fc98c47");
            httpClientRequest.setMethod("POST");
            // Set a request URL in the format of https://{Endpoint}/{URI}.
            httpClientRequest.setUrl("https://vehiclequery.apistore.huaweicloud.com/vehicle/query/detail");
            httpClientRequest.addHeader("Content-Type", "text/plain");
            httpClientRequest.addQueryStringParam("modelId",brandId);
            // Set a body for http request.
//            httpClientRequest.setBody("put your request body here");
        } catch (Exception e) {
//            LOGGER.error(e.getMessage());
            return "";
        }
        CloseableHttpClient client = null;
        try {
            // Sign the request.
            HttpRequestBase signedRequest = Client.sign(httpClientRequest, Constant.SIGNATURE_ALGORITHM_SDK_HMAC_SHA256);
            if (Constant.DO_VERIFY) {
                // creat httpClient and verify ssl certificate
                HostName.setUrlHostName(httpClientRequest.getHost());
                client = (CloseableHttpClient) SSLCipherSuiteUtil.createHttpClientWithVerify(Constant.INTERNATIONAL_PROTOCOL);
            } else {
                // creat httpClient and do not verify ssl certificate
                client = (CloseableHttpClient) SSLCipherSuiteUtil.createHttpClient(Constant.INTERNATIONAL_PROTOCOL);
            }
            HttpResponse response = client.execute(signedRequest);
            // Print the body of the response.
            HttpEntity resEntity = response.getEntity();
            if (resEntity != null) {
//                LOGGER.info("Processing Body with name: {} and value: {}", System.getProperty("line.separator"),
//                        EntityUtils.toString(resEntity, "UTF-8"));
                String string = EntityUtils.toString(resEntity, "UTF-8");
                return string;
            }
        } catch (Exception e) {
            LOGGER.error(e.getMessage());
        } finally {
            if (client != null) {
                client.close();
            }
        }
        return "";
    }
}
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserAddressMapper.xml
@@ -8,9 +8,14 @@
        <result column="app_user_id" property="appUserId" />
        <result column="name" property="name" />
        <result column="phone" property="phone" />
        <result column="province" property="province" />
        <result column="provinceCode" property="provinceCode" />
        <result column="city" property="city" />
        <result column="city_code" property="cityCode" />
        <result column="district" property="district" />
        <result column="district_code" property="districtCode" />
        <result column="address" property="address" />
        <result column="house_number" property="houseNumber" />
        <result column="lon" property="lon" />
        <result column="lat" property="lat" />
        <result column="default_address" property="defaultAddress" />
@@ -20,7 +25,7 @@
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, app_user_id, name, phone, city, city_code, address, lon, lat, default_address, create_time, del_flag
        id, app_user_id, name, phone, province,provinceCode,city, city_code,district,district_code, address,house_number, lon, lat, default_address, create_time, del_flag
    </sql>
</mapper>
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java
@@ -4,10 +4,13 @@
import cn.hutool.core.img.ImgUtil;
import cn.hutool.core.io.FileUtil;
import com.ruoyi.chargingPile.api.dto.TChargingGunDTO;
import com.ruoyi.chargingPile.api.model.Site;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.chargingPile.api.query.TChargingGunQuery;
import com.ruoyi.chargingPile.api.vo.SiteNameVO;
import com.ruoyi.chargingPile.api.vo.TChargingGunVO;
import com.ruoyi.chargingPile.service.ISiteService;
import com.ruoyi.chargingPile.service.TChargingGunService;
import com.ruoyi.chargingPile.service.TChargingPileService;
import com.ruoyi.chargingPile.util.QRCodeUtils;
@@ -52,6 +55,8 @@
    
    @Resource
    private TChargingPileService chargingPileService;
    @Resource
    private ISiteService siteService;
    @Autowired
    public TChargingGunController(TChargingGunService chargingGunService) {
@@ -184,5 +189,24 @@
        TChargingGun chargingGun = chargingGunService.getById(id);
        return R.ok(chargingGun);
    }
    /**
     * 根据id获取充电枪详情
     * @param id
     * @return
     */
    @ResponseBody
    @PostMapping(value = "/getAllInfoById/{id}")
    public R<SiteNameVO> getAllInfoById(@PathVariable Integer id){
        SiteNameVO siteNameVO = new SiteNameVO();
        TChargingGun chargingGun = chargingGunService.getById(id);
        siteNameVO.setGunName(chargingGun.getName());
        siteNameVO.setGunNumber(chargingGun.getCode());
        TChargingPile chargingPile = chargingPileService.getById(id);
        siteNameVO.setPileName(chargingPile.getName());
        siteNameVO.setPileNumber(chargingPile.getNumber());
        Site site = siteService.getById(id);
        siteNameVO.setSiteName(site.getName());
        return R.ok(siteNameVO);
    }
}
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingLotController.java
@@ -5,11 +5,13 @@
import com.ruoyi.chargingPile.api.dto.TParkingLotDTO;
import com.ruoyi.chargingPile.api.model.TCarport;
import com.ruoyi.chargingPile.api.model.TParkingLot;
import com.ruoyi.chargingPile.api.model.TParkingRecord;
import com.ruoyi.chargingPile.api.model.TVehicleRamp;
import com.ruoyi.chargingPile.api.query.TParkingLotQuery;
import com.ruoyi.chargingPile.api.vo.TParkingLotVO;
import com.ruoyi.chargingPile.service.TCarportService;
import com.ruoyi.chargingPile.service.TParkingLotService;
import com.ruoyi.chargingPile.service.TParkingRecordService;
import com.ruoyi.chargingPile.service.TVehicleRampService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
@@ -23,6 +25,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
@@ -42,6 +45,9 @@
    private final TParkingLotService parkingLotService;
    private final TVehicleRampService vehicleRampService;
    private final TCarportService carportService;
    @Resource
    private TParkingRecordService parkingRecordService;
    @Autowired
    public TParkingLotController(TParkingLotService parkingLotService, TVehicleRampService vehicleRampService, TCarportService carportService) {
@@ -138,5 +144,10 @@
        return R.ok(parkingLotService.getOne(Wrappers.lambdaQuery(TParkingLot.class)
                .eq(TParkingLot::getSiteId, siteId)));
    }
    @PostMapping(value = "/getRecordById")
    public R<TParkingRecord> getRecordById(@RequestParam("id") Long id){
        return R.ok(parkingRecordService.getById(id));
    }
}
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyDetailServiceImpl.java
@@ -64,7 +64,7 @@
            throw new ServiceException("未查询到计费策略");
        }
        List<TAccountingStrategyDetailVO> list = this.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId());
        list.stream().filter(item -> "24:00".equals(item.getEndTime())).forEach(item -> item.setEndTime("23:59:59"));
        list.stream().filter(item -> "00:00".equals(item.getEndTime())).forEach(item -> item.setEndTime("23:59:59"));
        // 获取当前登录用户id
        Long userId = tokenService.getLoginUserApplet().getUserId();
        // 根据id查询用户信息
ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/SiteMapper.xml
@@ -163,6 +163,7 @@
            </if>
            AND ts.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}
            AND ts.status = ${@com.ruoyi.common.core.enums.status.SiteStatusEnum@NORMAL_USE.getCode()}
            AND ts.accounting_strategy_id IS NOT NULL
        </where>
        <if test="query.sortType != null">
            <choose>
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/controller/ChargingHandshakeController.java
New file
@@ -0,0 +1,35 @@
package com.ruoyi.integration.controller;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.integration.api.model.ChargingHandshake;
import com.ruoyi.integration.mongodb.service.ChargingHandshakeService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
 * @author zhibing.pu
 * @Date 2024/8/28 9:50
 */
@RestController
@RequestMapping("/chargingHandshake")
public class ChargingHandshakeController {
    @Resource
    private ChargingHandshakeService chargingHandshakeService;
    /**
     * 根据订单编号获取充电握手数据
     * @param code
     * @return
     */
    @PostMapping("/getDataByOrderCode")
    public R<ChargingHandshake> getDataByOrderCode(@RequestParam("code") String code){
        ChargingHandshake chargingHandshake = chargingHandshakeService.findById(code);
        return R.ok(chargingHandshake);
    }
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/ChargingHandshakeService.java
@@ -4,4 +4,6 @@
import com.ruoyi.integration.mongodb.base.BaseService;
public interface ChargingHandshakeService extends BaseService<ChargingHandshake> {
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -1,8 +1,21 @@
package com.ruoyi.order.controller;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.account.api.feignClient.AppUserCarClient;
import com.ruoyi.account.api.feignClient.AppUserClient;
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.ParkingLotClient;
import com.ruoyi.chargingPile.api.feignClient.SiteClient;
import com.ruoyi.chargingPile.api.model.Site;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.chargingPile.api.model.TParkingRecord;
import com.ruoyi.chargingPile.api.vo.SiteVO;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.redis.service.RedisService;
@@ -10,8 +23,7 @@
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.model.TOrderEvaluate;
import com.ruoyi.order.api.model.*;
import com.ruoyi.order.api.query.ChargingOrderQuery;
import com.ruoyi.order.api.query.TChargingCountQuery;
import com.ruoyi.order.api.vo.ChargingOrderVO;
@@ -22,9 +34,7 @@
import com.ruoyi.order.dto.MyChargingOrderList;
import com.ruoyi.order.dto.OrderEvaluateVo;
import com.ruoyi.order.dto.*;
import com.ruoyi.order.service.TChargingOrderService;
import com.ruoyi.order.service.TOrderEvaluateService;
import com.ruoyi.order.service.TOrderEvaluateTagService;
import com.ruoyi.order.service.*;
import com.ruoyi.payment.api.feignClient.AliPaymentClient;
import com.ruoyi.payment.api.feignClient.WxPaymentClient;
import com.ruoyi.payment.api.vo.AliQueryOrder;
@@ -39,13 +49,14 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.List;
/**
 * <p>
 *  前端控制器
 * 前端控制器
 * </p>
 *
 * @author xiaochen
@@ -62,37 +73,175 @@
    private TokenService tokenService;
    @Autowired
    private TOrderEvaluateService orderEvaluateService;
    @Resource
    private WxPaymentClient wxPaymentClient;
    @Resource
    private RedisService redisService;
    @Resource
    private AliPaymentClient aliPaymentClient;
    @Resource
    private TShoppingOrderService shoppingOrderService;
    @Autowired
    private AppUserClient appUserClient;
    @Resource
    private TVipOrderService vipOrderService;
    @Resource
    private ParkingLotClient parkingLotClient;
    @Resource
    private TChargingOrderRefundService chargingOrderRefundService;
    @Resource
    private TShoppingOrderRefundService shoppingOrderRefundService;
    @Resource
    private TVipOrderRefundService vipOrderRefundService;
    @Resource
    private SiteClient siteClient;
    @Resource
    private ChargingPileClient chargingPileClient;
    @Resource
    private ChargingGunClient chargingGunClient;
    @Resource
    private AppUserCarClient appUserCarClient;
    @Resource
    private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService;
    @ResponseBody
    @PostMapping(value = "/pay/order/list")
    @ApiOperation(value = "列表", tags = {"管理后台-支付订单-订单信息"})
    public R<PageInfo<PayOrderDto>> payOrderList(@RequestBody PayOrderQueryDto payOrderQueryDto) {
        return chargingOrderService.payOrderQuery(payOrderQueryDto);
    }
    @ResponseBody
    @GetMapping(value = "/pay/order/pay/detail")
    @ApiOperation(value = "支付信息", tags = {"管理后台-支付订单-订单信息"})
    public R<PayOrderInfoDto> payOrderList(Long orderId, Integer type) {
        switch (type) {
            case 1:
                TChargingOrder byId = chargingOrderService.getById(orderId);
                PayOrderInfoDto payOrderInfoDto = new PayOrderInfoDto();
                payOrderInfoDto.setOrderId(byId.getId().toString());
                payOrderInfoDto.setCode(byId.getCode());
                payOrderInfoDto.setTradeNo(byId.getRechargeSerialNumber());
                payOrderInfoDto.setPayType(byId.getRechargePaymentType());
                payOrderInfoDto.setPayAmount(byId.getPaymentAmount());
                payOrderInfoDto.setPayTime(byId.getPayTime());
                payOrderInfoDto.setRefundAmount(byId.getRefundAmount());
                return R.ok(payOrderInfoDto);
            case 2:
                TShoppingOrder byId1 = shoppingOrderService.getById(orderId);
                PayOrderInfoDto payOrderInfoDto1 = new PayOrderInfoDto();
                payOrderInfoDto1.setOrderId(byId1.getId().toString());
                payOrderInfoDto1.setCode(byId1.getCode());
                payOrderInfoDto1.setTradeNo(byId1.getSerialNumber());
                payOrderInfoDto1.setPayType(byId1.getPaymentType());
                payOrderInfoDto1.setPayAmount(byId1.getPaymentAmount());
                payOrderInfoDto1.setPayTime(byId1.getPayTime());
                payOrderInfoDto1.setRefundAmount(byId1.getRefundAmount());
                return R.ok(payOrderInfoDto1);
            case 3:
                TVipOrder byId2 = vipOrderService.getById(orderId);
                PayOrderInfoDto payOrderInfoDto2 = new PayOrderInfoDto();
                payOrderInfoDto2.setOrderId(byId2.getId().toString());
                payOrderInfoDto2.setCode(byId2.getCode());
                payOrderInfoDto2.setTradeNo(byId2.getSerialNumber());
                payOrderInfoDto2.setPayType(byId2.getPaymentType());
                payOrderInfoDto2.setPayAmount(byId2.getPaymentAmount());
                payOrderInfoDto2.setPayTime(byId2.getPayTime());
                payOrderInfoDto2.setRefundAmount(byId2.getRefundAmount());
                return R.ok(payOrderInfoDto2);
            //todo luo 停车场订单
//                case 4:
//                    TParkingRecord byId3 = parkingLotClient.getRecordById(orderId).getData();
//                    PayOrderInfoDto payOrderInfoDto3 = new PayOrderInfoDto();
//                    payOrderInfoDto3.setOrderId(byId3.getId().toString());
//                    payOrderInfoDto3.setCode(byId3.getCode());
//                    payOrderInfoDto3.setTradeNo(byId3);
//                    payOrderInfoDto3.setPayType(0);
//                    payOrderInfoDto3.setPayAmount(new BigDecimal("0"));
//                    payOrderInfoDto3.setPayTime(LocalDateTime.now());
//                    payOrderInfoDto3.setRefundAmount(new BigDecimal("0"));
        }
        return R.ok();
    }
    @ResponseBody
    @GetMapping(value = "/pay/order/refund/detail")
    @ApiOperation(value = "退款信息", tags = {"管理后台-支付订单-订单信息"})
    public R refundDetail(Long orderId, Integer type) {
        switch (type) {
            case 1:
                List<TChargingOrderRefund> byId = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getChargingOrderId, orderId).orderByDesc(TChargingOrderRefund::getRefundTime).list();
                return R.ok(byId);
            case 2:
                List<TShoppingOrderRefund> list = shoppingOrderRefundService.lambdaQuery().eq(TShoppingOrderRefund::getShoppingOrderId, orderId).orderByDesc(TShoppingOrderRefund::getRefundTime).list();
                return R.ok(list);
            case 3:
                List<TVipOrderRefund> list1 = vipOrderRefundService.lambdaQuery().eq(TVipOrderRefund::getVipOrderId, orderId).orderByDesc(TVipOrderRefund::getRefundTime).list();
                return R.ok(list1);
        }
        return R.ok();
    }
    @ResponseBody
    @GetMapping(value = "/pay/order/charging")
    @ApiOperation(value = "充电信息", tags = {"管理后台-支付订单-订单信息"})
    public R refundDetail(Long orderId) {
        PayOrderChargingInfo payOrderChargingInfo = new PayOrderChargingInfo();
        TChargingOrder byId = chargingOrderService.getById(orderId);
        List<Site> data = siteClient.getSiteByIds(Collections.singletonList(byId.getSiteId())).getData();
        payOrderChargingInfo.setSiteName(data.get(0).getName());
        TChargingPile data1 = chargingPileClient.getChargingPileById(byId.getChargingPileId()).getData();
        payOrderChargingInfo.setChargingName(data1.getName());
        TChargingGun data2 = chargingGunClient.getChargingGunById(byId.getChargingGunId()).getData();
        payOrderChargingInfo.setGunName(data2.getName());
        List<TAppUserCar> data3 = appUserCarClient.getCarByIds(Collections.singletonList(byId.getAppUserCarId())).getData();
        payOrderChargingInfo.setCarNum(data3.get(0).getLicensePlate());
        return R.ok();
    }
    @ResponseBody
    @GetMapping(value = "/pay/order/charging/details")
    @ApiOperation(value = "充电明细", tags = {"管理后台-支付订单-订单信息"})
    public R<List<TChargingOrderAccountingStrategy>> chargingDetail(Long orderId) {
        List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, orderId).orderByDesc(TChargingOrderAccountingStrategy::getStartTime).list();
        return R.ok(list);
    }
    @ResponseBody
    @PostMapping(value = "/pay/order/refund/list")
    @ApiOperation(value = "充电信息", tags = {"管理后台-支付订单-退款订单"})
    public R<PageInfo<TChargingOrderRefund>> refundList(@RequestBody ChargingRefundDto chargingRefundDto) {
        return chargingOrderService.getRefundList(chargingRefundDto);
    }
    @ResponseBody
    @PostMapping(value = "/chargingOrder")
    @ApiOperation(value = "充电桩订单列表", tags = {"管理后台-订单管理"})
    public AjaxResult<TCharingOrderVO> chargingOrder(@RequestBody ChargingOrderQuery dto){
    public AjaxResult<TCharingOrderVO> chargingOrder(@RequestBody ChargingOrderQuery dto) {
        List<Long> data = appUserClient.getUserIdsByPhone(dto.getPhone()).getData();
        dto.setUserIds(data);
        TCharingOrderVO res = chargingOrderService.chargingOrder(dto);
        return AjaxResult.success(res);
    }
    @ResponseBody
    @PostMapping(value = "/chargingOrderInfo")
    @ApiOperation(value = "充电桩订单列表查看详情", tags = {"管理后台-订单管理"})
    public AjaxResult<TCharingOrderVO> chargingOrderInfo(String orderId){
    public AjaxResult<TCharingOrderVO> chargingOrderInfo(String orderId) {
        return AjaxResult.success();
    }
@@ -100,13 +249,15 @@
    @ResponseBody
    @PostMapping(value = "/addEvaluate")
    @ApiOperation(value = "添加评价", tags = {"小程序-扫一扫"})
    public AjaxResult getMyChargingOrderList(@RequestBody OrderEvaluateVo dto){
    public AjaxResult getMyChargingOrderList(@RequestBody OrderEvaluateVo dto) {
        dto.setAppUserId(tokenService.getLoginUserApplet().getUserId());
        orderEvaluateService.addOrderEvaluate(dto);
        return AjaxResult.success();
    }
    /**
     * 查询用户最近一次充电记录使用的车辆
     *
     * @param
     * @return
     */
@@ -115,17 +266,18 @@
        List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>()
                .eq(TChargingOrder::getAppUserId, tokenService.getLoginUserApplet().getUserId())
                .isNotNull(TChargingOrder::getAppUserCarId));
        if (!list.isEmpty()){
        if (!list.isEmpty()) {
            // 最近使用的车辆id
            Long size = list.get(0).getAppUserCarId();
            return R.ok(size);
        }else{
        } else {
            return R.ok(-1L);
        }
    }
    /**
     * 查询会员在本月有多少次享受了充电折扣
     *
     * @param req
     * @return
     */
@@ -133,10 +285,11 @@
    public R<Integer> getChargingCount(@RequestBody TChargingCountQuery req) {
        int size = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>()
                .eq(TChargingOrder::getAppUserId, req.getUserId())
                        .eq(TChargingOrder::getRechargePaymentStatus,2)
                .eq(TChargingOrder::getRechargePaymentStatus, 2)
                .between(TChargingOrder::getStartTime, req.getStartTime(), req.getEndTime())).size();
        return R.ok(size);
    }
    //用户订单数量
    @PostMapping(value = "/useOrderCount")
    public R<Long> useOrderCount(@RequestParam("userId") Long userId) {
@@ -144,141 +297,137 @@
        return R.ok(count);
    }
    //订单详情
    @PostMapping(value = "/detail")
    public R<TChargingOrder> detail(@RequestParam("orderId") Long orderId) {
        return R.ok(chargingOrderService.getById(orderId));
    }
    /**
     * 根据充电枪id获取正在进行中的订单
     *
     * @param chargingGunId 充电枪id
     * @return
     */
    @PostMapping(value = "/getOrderDetailByGunId")
    public R<TChargingOrder> getOrderDetailByGunId(@RequestParam("chargingGunId") Integer chargingGunId){
    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){
    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){
    public AjaxResult<MyChargingOrderInfo> getMyChargingOrderInfo(String id) {
        MyChargingOrderInfo myChargingOrderInfo = chargingOrderService.getMyChargingOrderInfo(id);
        return AjaxResult.success(myChargingOrderInfo);
    }
    @ResponseBody
    @GetMapping(value = "/getNoInvoicedOrder")
    @ApiOperation(value = "获取未开票的订单数据", tags = {"小程序-充电发票"})
    public AjaxResult<List<MyChargingOrderList>> getNoInvoicedOrder(GetNoInvoicedOrder query){
    public AjaxResult<List<MyChargingOrderList>> getNoInvoicedOrder(GetNoInvoicedOrder query) {
        List<MyChargingOrderList> list = chargingOrderService.getNoInvoicedOrder(query);
        return AjaxResult.success(list);
    }
    @ResponseBody
    @PostMapping(value = "/paymentChargingOrder")
    @ApiOperation(value = "支付充电充值费用", tags = {"小程序-扫一扫"})
    public AjaxResult paymentChargingOrder(@RequestBody AddChargingOrder addChargingOrder){
    public AjaxResult paymentChargingOrder(@RequestBody AddChargingOrder addChargingOrder) {
        return chargingOrderService.paymentChargingOrder(addChargingOrder);
    }
    /**
     * 充电充值支付回调
     *
     * @param request
     */
    @ResponseBody
    @PostMapping(value = "/chargingOrderWXCallback")
    public void chargingOrderWXCallback(HttpServletRequest request){
    public void chargingOrderWXCallback(HttpServletRequest request) {
        Map<String, Object> data = wxPaymentClient.payNotify(request).getData();
        if(null != data){
        if (null != data) {
            String out_trade_no = data.get("out_trade_no").toString();
            String transaction_id = data.get("transaction_id").toString();
            String attach = data.get("attach").toString();
            AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(1, out_trade_no, transaction_id, attach);
            if(ajaxResult.isSuccess()){
            if (ajaxResult.isSuccess()) {
                wxPaymentClient.ack();
            }
        }
    }
    /**
     * 支付宝支付成功后的回调
     */
    @ResponseBody
    @PostMapping(value = "/chargingOrderALICallback")
    public void chargingOrderALICallback(@RequestBody AliQueryOrder aliQueryOrder, HttpServletResponse response){
    public void chargingOrderALICallback(@RequestBody AliQueryOrder aliQueryOrder, HttpServletResponse response) {
        try {
            String out_trade_no = aliQueryOrder.getOutTradeNo();
            String transaction_id = aliQueryOrder.getTradeNo();
            String attach = aliQueryOrder.getPassbackParams();
            AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach);
            if(ajaxResult.isSuccess()){
            if (ajaxResult.isSuccess()) {
                PrintWriter writer = response.getWriter();
                writer.println("success");
                writer.flush();
                writer.close();
            }
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @ResponseBody
    @GetMapping(value = "/preChargeCheck/{id}")
    @ApiOperation(value = "获取安全检测数据", tags = {"小程序-扫一扫"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "充电枪id", required = true)
    })
    public AjaxResult<PreChargeCheck> preChargeCheck(@PathVariable Integer id){
    public AjaxResult<PreChargeCheck> preChargeCheck(@PathVariable Integer id) {
        String key = "AQJC_" + id;
        Object cacheObject = redisService.getCacheObject(key);
        return AjaxResult.success(cacheObject);
    }
    @ResponseBody
    @GetMapping(value = "/getChargingDetails/{id}")
    @ApiOperation(value = "获取充电中页面数据", tags = {"小程序-扫一扫"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "充电枪id", required = true)
    })
    public AjaxResult<ChargingDetails> getChargingDetails(@PathVariable Integer id){
    public AjaxResult<ChargingDetails> getChargingDetails(@PathVariable Integer id) {
        ChargingDetails chargingDetails = chargingOrderService.getChargingDetails(id);
        return AjaxResult.success(chargingDetails);
    }
    @ResponseBody
    @PutMapping(value = "/stopCharging/{id}")
    @ApiOperation(value = "手动停止充电", tags = {"小程序-扫一扫"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "订单id", required = true)
    })
    public AjaxResult stopCharging(@PathVariable String id){
    public AjaxResult stopCharging(@PathVariable String id) {
        return chargingOrderService.stopCharging(id);
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java
@@ -38,10 +38,7 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -202,8 +199,6 @@
                for (int i = 0; i < split1.length; i++) {
                    Integer reduce = tShoppingOrderService.list(new QueryWrapper<TShoppingOrder>()
                                    .eq("order_type",1)
                                    .eq("goods_id", split[i])
                                    .eq("payment_status", 2)
                                    .ne("refund_status", 2))
                            .stream().map(TShoppingOrder::getPurchaseQuantity).reduce(0, Integer::sum);
                    res.add(reduce);
@@ -211,11 +206,7 @@
                break;
            case 2:
                for (int i = 0; i < split1.length; i++) {
                    Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>()
                                            .eq("order_type",1)
                                    .ne("status",4)
                                    .eq("goods_id", split[i])
                                    )
                    Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>().eq("order_type",1).ne("status",4).eq("goods_id", split1[i]))
                            .stream().map(TExchangeOrder::getPurchaseQuantity).reduce(0, Integer::sum);
                    res.add(reduce);
                }
@@ -283,11 +274,11 @@
            tExchangeOrder.setCouponId(exchangeDto.getGoodId());
        }
        tExchangeOrder.setPurchaseQuantity(1);
        tExchangeOrder.setAppUserAddressId(Long.valueOf(exchangeDto.getAddressId()));
        tExchangeOrder.setAppUserAddressId(exchangeDto.getAddressId()==null?null:Long.valueOf(exchangeDto.getAddressId()));
        tExchangeOrder.setPoints(exchangeDto.getPoint());
        tExchangeOrder.setRemark("");
        if (exchangeDto.getGoodType()==1){
            tExchangeOrder.setStatus(0);
            tExchangeOrder.setStatus(1);
        }else {
            tExchangeOrder.setStatus(3);
        }
@@ -302,8 +293,8 @@
    
    @GetMapping("/getMyExchangeOrder")
    @ApiOperation(value = "获取兑换记录列表", tags = {"小程序-兑换记录"})
    public AjaxResult<List<MyExchangeOrderList>> getMyExchangeOrder(GetMyExchangeOrder query){
        List<MyExchangeOrderList> list = exchangeOrderService.getMyExchangeOrder(query);
    public AjaxResult<Map<String, Object>> getMyExchangeOrder(GetMyExchangeOrder query){
        Map<String, Object> list = exchangeOrderService.getMyExchangeOrder(query);
        return AjaxResult.success(list);
    }
    
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderAppealController.java
@@ -1,6 +1,10 @@
package com.ruoyi.order.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.TAppUser;
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.security.service.TokenService;
@@ -8,11 +12,15 @@
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.dto.ManageFeedbackDto;
import com.ruoyi.order.dto.ManageOrderAppealQuery;
import com.ruoyi.order.service.TOrderAppealService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
 * <p>
@@ -28,11 +36,35 @@
    private final TOrderAppealService orderAppealService;
    private final TokenService tokenService;
    @Resource
    private AppUserClient appUserClient;
    @Autowired
    public TOrderAppealController(TOrderAppealService orderAppealService, TokenService tokenService) {
        this.orderAppealService = orderAppealService;
        this.tokenService = tokenService;
    }
    @ApiOperation(tags = {"后台-订单管理-订单申诉"},value = "列表")
    @PostMapping(value = "/manage/pageList")
    public R<Page<TOrderAppeal>> managePageList(@RequestBody ManageOrderAppealQuery manageOrderAppealQuery) {
        Page<TOrderAppeal> page = orderAppealService.lambdaQuery().eq(manageOrderAppealQuery.getStatus() != null, TOrderAppeal::getStatus, manageOrderAppealQuery.getStatus())
                .like(manageOrderAppealQuery.getCode() != null, TOrderAppeal::getCode, manageOrderAppealQuery.getCode())
                .like(manageOrderAppealQuery.getPhone() != null, TOrderAppeal::getPhone, manageOrderAppealQuery.getPhone())
                .eq(manageOrderAppealQuery.getOrderType() != null, TOrderAppeal::getOrderType, manageOrderAppealQuery.getOrderType())
                .in(TOrderAppeal::getOrderType, 1, 2).page(Page.of(manageOrderAppealQuery.getPageCurr(), manageOrderAppealQuery.getPageSize()));
        return R.ok(page);
    }
    @ApiOperation(tags = {"后台-订单管理-订单申诉"},value = "后台-订单管理-订单申诉")
    @PostMapping(value = "/manage/feedback")
    public R manageFeedback(@RequestBody ManageFeedbackDto manageFeedbackDto) {
        TOrderAppeal byId = orderAppealService.getById(manageFeedbackDto.getId());
        byId.setFeedback(manageFeedbackDto.getFeedback());
        orderAppealService.updateById(byId);
        return R.ok();
    }
    /**
@@ -41,8 +73,7 @@
    @ApiOperation(tags = {"小程序-订单申诉"},value = "查询订单申诉分页列表")
    @PostMapping(value = "/pageList")
    public AjaxResult<PageInfo<TOrderAppealVO>> pageList(@RequestBody TOrderAppealQuery query) {
        // TODO 用户id 获取小程序当前登录用户id
        Long userId = tokenService.getLoginUser().getUserid();
        Long userId = tokenService.getLoginUserApplet().getUserId();
        query.setAppUserId(userId);
        return AjaxResult.ok(orderAppealService.pageList(query));
    }
@@ -63,8 +94,10 @@
    @ApiOperation(value = "申诉订单", tags = {"小程序-充电记录(个人中心)"})
    public AjaxResult addOrderAppeal(@RequestBody TOrderAppeal orderAppeal){
        Long appUserId = tokenService.getLoginUserApplet().getUserId();
        TAppUser data = appUserClient.getUserById(appUserId).getData();
        orderAppeal.setAppUserId(appUserId);
        orderAppeal.setStatus(1);
        orderAppeal.setPhone(data.getPhone());
        orderAppealService.save(orderAppeal);
        return AjaxResult.success();
    }
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java
@@ -3,6 +3,8 @@
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.ruoyi.account.api.feignClient.AppCouponClient;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.TAppUserAddress;
@@ -24,6 +26,7 @@
import com.ruoyi.payment.api.model.RefundReq;
import com.ruoyi.payment.api.model.RefundResp;
import com.ruoyi.payment.api.model.WxPaymentRefundModel;
import com.ruoyi.payment.api.vo.WxRefundNotifyResp;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
import io.swagger.annotations.Api;
@@ -33,9 +36,8 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
/**
 * <p>
@@ -187,15 +189,32 @@
    }
    @GetMapping("/getMyShoppingOrderList")
    @ApiOperation(value = "获取购买订单列表", tags = {"小程序-商城购买订单"})
    public AjaxResult<List<MyShoppingOrderList>> getMyShoppingOrderList(GetMyShoppingOrderList query){
        List<MyShoppingOrderList> list = shoppingOrderService.getMyShoppingOrderList(query);
    public AjaxResult<Map<String, Object>> getMyShoppingOrderList(GetMyShoppingOrderList query){
        Map<String, Object> list = shoppingOrderService.getMyShoppingOrderList(query);
        return AjaxResult.success(list);
    }
    @GetMapping("/getMyShoppingOrderListNum")
    @ApiOperation(value = "获取购买订单列表数量", tags = {"小程序-商城购买订单"})
    public AjaxResult<Map<String, Object>> getMyShoppingOrderListNum(){
        Long userId = tokenService.getLoginUserApplet().getUserId();
        long dfh = shoppingOrderService.count(new LambdaQueryWrapper<TShoppingOrder>().eq(TShoppingOrder::getDelFlag, 0)
                .eq(TShoppingOrder::getStatus, 1).eq(TShoppingOrder::getAppUserId, userId));
        long dsh = shoppingOrderService.count(new LambdaQueryWrapper<TShoppingOrder>().eq(TShoppingOrder::getDelFlag, 0)
                .eq(TShoppingOrder::getStatus, 2).eq(TShoppingOrder::getAppUserId, userId));
        long ywc = shoppingOrderService.count(new LambdaQueryWrapper<TShoppingOrder>().eq(TShoppingOrder::getDelFlag, 0)
                .eq(TShoppingOrder::getStatus, 3).eq(TShoppingOrder::getAppUserId, userId));
        Map<String, Object> map = new HashMap<>();
        map.put("dfh", dfh);
        map.put("dsh", dsh);
        map.put("ywc", ywc);
        return AjaxResult.success(map);
    }
    
    
    @GetMapping("/getMyShoppingOrderInfo/{id}")
    @ApiOperation(value = "获取购买订单详情", tags = {"小程序-商城购买订单"})
    @ApiOperation(value = "获取购买订单详情", tags = {"小程序-商城购买订单","管理后台-支付订单-订单信息"})
    public AjaxResult<MyShoppingOrderInfo> getMyShoppingOrderInfo(@PathVariable String id){
        MyShoppingOrderInfo info = shoppingOrderService.getMyShoppingOrderInfo(id);
        return AjaxResult.success(info);
@@ -228,6 +247,21 @@
        return shoppingOrderService.cancelOrder(id);
    }
    
    /**
     * 商城订单取消微信退款回调
     */
    @PostMapping("/cancelShoppingOrderWxRefund")
    public void cancelShoppingOrderWxRefund(HttpServletRequest request){
        WxRefundNotifyResp data = wxPaymentClient.refundNotify(request).getData();
        if(null != data){
            String out_refund_no = data.getOut_refund_no();
            String refund_id = data.getRefund_id();
            String tradeState = data.getTradeState();
            String success_time = data.getSuccess_time();
            shoppingOrderService.cancelShoppingOrderWxRefund(out_refund_no, refund_id, tradeState, success_time);
        }
    }
    
    
    @ResponseBody
@@ -250,7 +284,7 @@
            shoppingOrder.setCouponId(exchangeDto.getGoodId());
        }
        shoppingOrder.setPurchaseQuantity(exchangeDto.getNum());
        shoppingOrder.setAppUserAddressId(Long.valueOf(exchangeDto.getAddressId()));
        shoppingOrder.setAppUserAddressId(exchangeDto.getAddressId());
        shoppingOrder.setOrderAmount(exchangeDto.getOrderPrice());
        if (exchangeDto.getCouponId()!=null) {
            shoppingOrder.setAppCouponId(exchangeDto.getCouponId());
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/ChargingDetails.java
@@ -26,7 +26,7 @@
    @ApiModelProperty("续航")
    private BigDecimal endurance;
    @ApiModelProperty("剩余充电时间")
    private Long remainingChargeTime;
    private Integer remainingChargeTime;
    @ApiModelProperty("充电枪名")
    private String name;
    @ApiModelProperty("订单编号")
@@ -34,9 +34,9 @@
    @ApiModelProperty("已充电度数")
    private BigDecimal chargedDegrees;
    @ApiModelProperty("已充电时间")
    private Long chargedTime;
    private Integer chargedTime;
    @ApiModelProperty("充电费用")
    private BigDecimal ChargingCost;
    private BigDecimal chargingCost;
    @ApiModelProperty("充电状态(0=未知,1=等待中,2=启动中,3=充电中,4=停止中,5=已结束)")
    private Integer status;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/ChargingRefundDto.java
New file
@@ -0,0 +1,13 @@
package com.ruoyi.order.dto;
import com.ruoyi.common.core.web.page.BasePage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ChargingRefundDto extends BasePage {
    @ApiModelProperty("订单编号")
    private String code;
    @ApiModelProperty("平台退款编号")
    private String refundCode;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/ManageFeedbackDto.java
New file
@@ -0,0 +1,12 @@
package com.ruoyi.order.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.ruoyi.common.core.web.page.BasePage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ManageFeedbackDto  {
    private Long id;
    private String feedback;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/ManageOrderAppealQuery.java
New file
@@ -0,0 +1,22 @@
package com.ruoyi.order.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.ruoyi.common.core.web.page.BasePage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ManageOrderAppealQuery  extends BasePage {
    @ApiModelProperty(value = "申诉状态 (1=待处理,2=已处理)")
    @TableField("status")
    private Integer status;
    @ApiModelProperty(value = "订单编号")
    @TableField("code")
    private String code;
    @ApiModelProperty(value = "手机号")
    private String phone;
    @ApiModelProperty(value = "订单类型(1=充电订单,2=购物订单")
    private Integer orderType;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/MyChargingOrderList.java
@@ -31,4 +31,10 @@
    private BigDecimal payMoney;
    @ApiModelProperty("订单时间")
    private String createTime;
    @ApiModelProperty("评价状态(1=待评价,2=已评价)")
    private Long evaluate;
    @ApiModelProperty("电费")
    private BigDecimal electricCharge;
    @ApiModelProperty("服务费")
    private BigDecimal serviceCharge;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/MyShoppingOrderInfo.java
@@ -39,6 +39,8 @@
    private String code;
    @ApiModelProperty("下单时间")
    private String createTime;
    @ApiModelProperty("订单金额")
    private BigDecimal orderAmount;
    @ApiModelProperty("支付金额")
    private BigDecimal paymentAmount;
    @ApiModelProperty("备注")
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/MyShoppingOrderList.java
@@ -19,6 +19,8 @@
    private String imgUrl;
    @ApiModelProperty("商品名称")
    private String name;
    @ApiModelProperty("商品类型(1=商品,2=优惠券)")
    private Integer orderType;
    @ApiModelProperty("状态(1=待发货,2=待收货,3=已完成,4=已取消)")
    private Integer status;
    @ApiModelProperty("单价")
@@ -27,4 +29,6 @@
    private Integer number;
    @ApiModelProperty("支付金额")
    private BigDecimal paymentAmount;
    @ApiModelProperty("订单时间")
    private String createTime;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/PayOrderChargingInfo.java
New file
@@ -0,0 +1,37 @@
package com.ruoyi.order.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class PayOrderChargingInfo {
            @ApiModelProperty(value = "站点名称", required = true)
            private String siteName;
            @ApiModelProperty(value = "充电设备名称", required = true)
            private String chargingName;
    @ApiModelProperty(value = "接口名称", required = true)
    private String gunName;
    @ApiModelProperty(value = "充电开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField("start_time")
    private LocalDateTime startTime;
    @ApiModelProperty(value = "充电结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField("end_time")
    private LocalDateTime endTime;
    @ApiModelProperty(value = "订单金额(总金额)")
    @TableField("order_amount")
    private BigDecimal orderAmount;
    @ApiModelProperty(value = "车牌")
    private String carNum;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/PayOrderDto.java
New file
@@ -0,0 +1,35 @@
package com.ruoyi.order.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class PayOrderDto {
    private String id;
    @ApiModelProperty("1充电订单2购物订单3vip订单4停车订单")
    private Integer type;
    @ApiModelProperty("订单编号")
    private String code;
    @ApiModelProperty("订单标题")
    private String title;
    @ApiModelProperty("手机号")
    private String phone;
    @ApiModelProperty("订单子状态[ 1充电订单:0=未知,1=等待中,2=启动中,3=充电中,4=停止中,5=已结束 ];" +
            "[2购物订单:1=待发货,2=待收货,3=已完成,4=已取消]" +
            "[3vip订单都为支付成功]" +
            "[4(1=已进场,2=已出场,3=已缴费出场)]")
    private Integer status;
    @ApiModelProperty("订单金额")
    private Double orderAmount;
    @ApiModelProperty("支付金额")
    private Double paymentAmount;
    @ApiModelProperty("下单时间")
    private LocalDateTime createTime;
    @ApiModelProperty("订单完成时间")
    private LocalDateTime endTime;
    @ApiModelProperty("支付时间")
    private LocalDateTime payTime;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/PayOrderInfoDto.java
New file
@@ -0,0 +1,27 @@
package com.ruoyi.order.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class PayOrderInfoDto {
    @ApiModelProperty("订单id")
    private String orderId;
    @ApiModelProperty("订单编号")
    private String code;
    @ApiModelProperty("支付流水号")
    private String tradeNo;
    @ApiModelProperty("1微信2支付宝")
    private Integer payType;
    @ApiModelProperty("支付金额")
    private BigDecimal payAmount;
    @ApiModelProperty("支付时间")
    private LocalDateTime payTime;
    @ApiModelProperty("退款金额")
    private BigDecimal refundAmount;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/PayOrderQueryDto.java
New file
@@ -0,0 +1,25 @@
package com.ruoyi.order.dto;
import com.ruoyi.common.core.web.page.BasePage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class PayOrderQueryDto extends BasePage {
    @ApiModelProperty("订单编号")
    private String code;
    @ApiModelProperty("1充电订单2购物订单3vip订单4停车订单")
    private Integer type;
    @ApiModelProperty("手机号")
    private String phone;
    @ApiModelProperty("1有退款2无退款")
    private Integer isRefund;
    @ApiModelProperty("下单时间1")
    private LocalDateTime createTime1;
    @ApiModelProperty("下单时间2")
    private LocalDateTime createTime2;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java
@@ -3,9 +3,13 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.order.api.model.TChargingOrder;
import com.ruoyi.order.api.model.TChargingOrderRefund;
import com.ruoyi.order.api.query.ChargingOrderQuery;
import com.ruoyi.order.api.vo.ChargingOrderVO;
import com.ruoyi.order.dto.ChargingRefundDto;
import com.ruoyi.order.dto.GetNoInvoicedOrder;
import com.ruoyi.order.dto.PayOrderDto;
import com.ruoyi.order.dto.PayOrderQueryDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -48,4 +52,7 @@
    List<ChargingOrderVO> chargingOrder(@Param("pageInfo") PageInfo<ChargingOrderVO> pageInfo, @Param("req") ChargingOrderQuery dto, @Param("startTime1")String startTime1, @Param("startTime2")String startTime2,@Param("endTime1") String endTime1,@Param("endTime2") String endTime11);
    List<PayOrderDto> payOrderQuery(@Param("pageInfo")PageInfo<PayOrderDto> pageInfo,@Param("data") PayOrderQueryDto payOrderQueryDto);
    List<TChargingOrderRefund> getRefundList(@Param("pageInfo")PageInfo<TChargingOrderRefund> pageInfo,@Param("data")  ChargingRefundDto chargingRefundDto);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderRefundMapper.java
New file
@@ -0,0 +1,16 @@
package com.ruoyi.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.order.api.model.TChargingOrderRefund;
/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xiaochen
 * @since 2024-08-26
 */
public interface TChargingOrderRefundMapper extends BaseMapper<TChargingOrderRefund> {
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TShoppingOrderRefundMapper.java
New file
@@ -0,0 +1,16 @@
package com.ruoyi.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.order.api.model.TShoppingOrderRefund;
/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xiaochen
 * @since 2024-08-26
 */
public interface TShoppingOrderRefundMapper extends BaseMapper<TShoppingOrderRefund> {
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TVipOrderRefundMapper.java
New file
@@ -0,0 +1,16 @@
package com.ruoyi.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.order.api.model.TVipOrderRefund;
/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xiaochen
 * @since 2024-08-26
 */
public interface TVipOrderRefundMapper extends BaseMapper<TVipOrderRefund> {
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderRefundService.java
New file
@@ -0,0 +1,16 @@
package com.ruoyi.order.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.order.api.model.TChargingOrderRefund;
/**
 * <p>
 *  服务类
 * </p>
 *
 * @author xiaochen
 * @since 2024-08-26
 */
public interface TChargingOrderRefundService extends IService<TChargingOrderRefund> {
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java
@@ -1,10 +1,12 @@
package com.ruoyi.order.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.R;
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.model.TChargingOrderRefund;
import com.ruoyi.order.api.query.ChargingOrderQuery;
import com.ruoyi.order.api.vo.ChargingOrderVO;
import com.ruoyi.order.api.vo.TCharingOrderVO;
@@ -84,4 +86,8 @@
    AjaxResult stopCharging(String id);
    TCharingOrderVO chargingOrder(ChargingOrderQuery dto);
    R<PageInfo<PayOrderDto>> payOrderQuery(PayOrderQueryDto payOrderQueryDto);
    R<PageInfo<TChargingOrderRefund>> getRefundList(ChargingRefundDto chargingRefundDto);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TExchangeOrderService.java
@@ -9,6 +9,7 @@
import com.ruoyi.order.dto.MyExchangeOrderList;
import java.util.List;
import java.util.Map;
/**
 * <p>
@@ -26,7 +27,7 @@
     * @param query
     * @return
     */
    List<MyExchangeOrderList> getMyExchangeOrder(GetMyExchangeOrder query);
    Map<String, Object> getMyExchangeOrder(GetMyExchangeOrder query);
    
    
    /**
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TShoppingOrderRefundService.java
New file
@@ -0,0 +1,15 @@
package com.ruoyi.order.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.order.api.model.TShoppingOrderRefund;
/**
 * <p>
 *  服务类
 * </p>
 *
 * @author xiaochen
 * @since 2024-08-26
 */
public interface TShoppingOrderRefundService extends IService<TShoppingOrderRefund> {
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TShoppingOrderService.java
@@ -16,6 +16,7 @@
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.Map;
/**
 * <p>
@@ -35,7 +36,7 @@
     * @param query
     * @return
     */
    List<MyShoppingOrderList> getMyShoppingOrderList(GetMyShoppingOrderList query);
    Map<String, Object> getMyShoppingOrderList(GetMyShoppingOrderList query);
    
    
    /**
@@ -55,6 +56,18 @@
    
    
    /**
     * 商城订单取消订单微信退款处理
     * @param out_refund_no 退款单号
     * @param refund_id 退款流水号
     * @param refund_status 退款状态 SUCCESS:退款成功  CLOSED:退款关闭  ABNORMAL:退款异常
     * @param success_time 退款成功时间
     * @return
     */
    AjaxResult cancelShoppingOrderWxRefund(String out_refund_no, String refund_id, String refund_status, String success_time);
    /**
     * 获取未开票的订单列表
     * @param query
     * @return
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TVipOrderRefundService.java
New file
@@ -0,0 +1,16 @@
package com.ruoyi.order.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.order.api.model.TVipOrderRefund;
/**
 * <p>
 *  服务类
 * </p>
 *
 * @author xiaochen
 * @since 2024-08-26
 */
public interface TVipOrderRefundService extends IService<TVipOrderRefund> {
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderRefundServiceImpl.java
New file
@@ -0,0 +1,15 @@
package com.ruoyi.order.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.order.api.model.TChargingOrderRefund;
import com.ruoyi.order.mapper.TChargingOrderRefundMapper;
import com.ruoyi.order.service.TChargingOrderRefundService;
import org.springframework.stereotype.Service;
/**
 * @author zhibing.pu
 * @date 2024/8/28 15:18
 */
@Service
public class TChargingOrderRefundServiceImpl extends ServiceImpl<TChargingOrderRefundMapper, TChargingOrderRefund> implements TChargingOrderRefundService {
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -16,15 +16,22 @@
import com.ruoyi.chargingPile.api.model.Site;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.common.core.domain.R;
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.redis.service.RedisService;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.integration.api.feignClient.ChargingHandshakeClient;
import com.ruoyi.integration.api.feignClient.SendMessageClient;
import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient;
import com.ruoyi.integration.api.model.ChargingHandshake;
import com.ruoyi.integration.api.model.PlatformStartCharging;
import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData;
import com.ruoyi.order.api.model.TChargingOrder;
import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy;
import com.ruoyi.order.api.model.TChargingOrderRefund;
import com.ruoyi.order.api.model.TOrderEvaluate;
import com.ruoyi.order.api.query.ChargingOrderQuery;
import com.ruoyi.order.api.vo.ChargingOrderVO;
import com.ruoyi.order.api.vo.TCharingOrderVO;
@@ -32,6 +39,7 @@
import com.ruoyi.order.mapper.TChargingOrderMapper;
import com.ruoyi.order.service.TChargingOrderAccountingStrategyService;
import com.ruoyi.order.service.TChargingOrderService;
import com.ruoyi.order.service.TOrderEvaluateService;
import com.ruoyi.payment.api.feignClient.AliPaymentClient;
import com.ruoyi.payment.api.feignClient.WxPaymentClient;
import com.ruoyi.payment.api.vo.*;
@@ -98,6 +106,14 @@
    @Resource
    private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient;
    
    @Resource
    private ChargingHandshakeClient chargingHandshakeClient;
    @Resource
    private SendMessageClient sendMessageClient;
    @Resource
    private TOrderEvaluateService orderEvaluateService;
    
    
    
@@ -129,9 +145,14 @@
            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")));
            long count = orderEvaluateService.count(new LambdaQueryWrapper<TOrderEvaluate>().eq(TOrderEvaluate::getOrderType, 1)
                    .eq(TOrderEvaluate::getOrderId, tChargingOrder.getId()).eq(TOrderEvaluate::getDelFlag, 0));
            myChargingOrderList.setEvaluate(count + 1L);
            orderLists.add(myChargingOrderList);
        }
        list = this.baseMapper.getMyChargingOrderList(appUserId, query.getType(), null, null);
        map.put("list", orderLists);
        map.put("totle", list.size());
        return map;
    }
    
@@ -201,7 +222,7 @@
                map.put("time", time.get(i));
                //soc
                map.put("soc", soc.get(i));
                //电压
                //功率
                map.put("power", po.get(i));
                power.add(map);
            }
@@ -235,6 +256,8 @@
            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")));
            myChargingOrderList.setElectricCharge(tChargingOrder.getElectrovalence());
            myChargingOrderList.setServiceCharge(tChargingOrder.getServiceCharge());
            list.add(myChargingOrderList);
        }
        return list;
@@ -408,10 +431,25 @@
        preChargeCheck.setSecureConnectionDetection(false);
        String key = "AQJC_" + chargingOrder.getChargingGunId();
        redisService.setCacheObject(key, preChargeCheck);
        //开始检测充电桩状,将检查状态写入缓存。检测完成后开始开启充电
        //充电结束后需要计算退款剩余金额
        // todo 需要完善
        
        //根据当前充值的金额和计费模板算出充电的金额
        BigDecimal rechargeAmount = chargingOrder.getRechargeAmount();
        //计算充电金额,会员需要将折扣金额加入到充电总金额中
//        TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData();
//        if(){
//            appUser.getVipId()
//        }
//
//
//        //调用远程启动充电消息
//        PlatformStartCharging platformStartCharging = new PlatformStartCharging();
//        platformStartCharging.setTransaction_serial_number(chargingOrder.getCode());
//        platformStartCharging.setCharging_pile_code();
//        platformStartCharging.setCharging_gun_code();
//        platformStartCharging.setCard_number();
//        platformStartCharging.setAccount_balance()
//        sendMessageClient.platformStartCharging(platformStartCharging);
        return AjaxResult.success();
    }
    
@@ -429,7 +467,6 @@
        if(null == one){
            return null;
        }
        // todo 需要完善充电实时数据
        ChargingDetails chargingDetails = new ChargingDetails();
        chargingDetails.setId(one.getId().toString());
        TChargingGun chargingGun = chargingGunClient.getChargingGunById(id).getData();
@@ -438,6 +475,27 @@
        chargingDetails.setName(site.getName() + "-" + chargingPile.getName());
        chargingDetails.setCode(one.getCode());
        chargingDetails.setStatus(one.getStatus());
        UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataClient.chargingOrderInfo(one.getCode()).getData();
        if(null != data){
            chargingDetails.setChargeCurrent(data.getOutput_current());
            chargingDetails.setChargeVoltage(data.getOutput_voltage());
            BigDecimal power = data.getOutput_current().multiply(data.getOutput_voltage()).divide(new BigDecimal(1000));
            chargingDetails.setChargePower(power);
            chargingDetails.setCompletionRatio(data.getSoc());
            chargingDetails.setRemainingChargeTime(data.getTime_remaining());
            chargingDetails.setChargedDegrees(data.getCharging_degree());
            chargingDetails.setChargedTime(data.getCumulative_charging_time());
            chargingDetails.setChargingCost(data.getPaid_amount());
        }
        ChargingHandshake chargingHandshake = chargingHandshakeClient.getDataByOrderCode(one.getCode()).getData();
        if(null != chargingHandshake && null != data && null != one.getAppUserCarId()){
            BigDecimal bms_battery_capacity = chargingHandshake.getBms_battery_capacity();
            TAppUserCar appUserCar = appUserCarClient.getCarByIds(Arrays.asList(one.getAppUserCarId())).getData().get(0);
            //   续航 = 电池容量 / 续航里程 * soc
            BigDecimal divide = bms_battery_capacity.divide(new BigDecimal(appUserCar.getEndurance()));
            BigDecimal multiply = new BigDecimal(data.getSoc() / 100).multiply(divide);
            chargingDetails.setEndurance(multiply);
        }
        return chargingDetails;
    }
    
@@ -458,10 +516,21 @@
        chargingOrder.setEndMode(1);
        this.updateById(chargingOrder);
        //调用硬件停止充电,停止成功后开始计算费用退款
        // todo 待完善
        return AjaxResult.success();
    }
    public void endCharge(){
    }
    @Override
    public TCharingOrderVO chargingOrder(ChargingOrderQuery dto) {
@@ -500,7 +569,9 @@
         BigDecimal electronicMoney = new BigDecimal("0");
         BigDecimal serviceMoney = new BigDecimal("0");
        for (ChargingOrderVO chargingOrderVO : list) {
            total = total.add(chargingOrderVO.getChargingCapacity());
            if (chargingOrderVO.getChargingCapacity()!=null){
                total = total.add(chargingOrderVO.getChargingCapacity());
            }
            // 充电订单 明细记录
            List<TChargingOrderAccountingStrategy> chargingOrderId = chargingOrderAccountingStrategyService.list(new QueryWrapper<TChargingOrderAccountingStrategy>()
                    .eq("charging_order_id", chargingOrderVO.getId()));
@@ -511,14 +582,18 @@
            LocalDateTime startTime = chargingOrderVO.getStartTime();
            LocalDateTime endTime = chargingOrderVO.getEndTime();
            // 计算时间差 秒 充电时长
            long between = ChronoUnit.SECONDS.between(startTime, endTime);
            chargingOrderVO.setChargingSecond(between);
            time += between;
            if (startTime!=null && endTime!=null){
                long between = ChronoUnit.SECONDS.between(startTime, endTime);
                chargingOrderVO.setChargingSecond(between);
                time += between;
            }
            // 总收入
            if (chargingOrderVO.getRefundStatus() == 2){
            if (chargingOrderVO.getRefundStatus() !=null && chargingOrderVO.getRefundStatus() == 2){
                income = income.add(chargingOrderVO.getPaymentAmount().subtract(chargingOrderVO.getRefundAmount()));
            }else{
                income = income.add(chargingOrderVO.getPaymentAmount());
                if (chargingOrderVO.getPaymentAmount()!=null){
                    income = income.add(chargingOrderVO.getPaymentAmount());
                }
            }
            for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : chargingOrderId) {
                // 累计电费
@@ -540,11 +615,14 @@
                // 车牌号
                chargingOrderVO.setPhone(data.getPhone());
                List<Long> longs = new ArrayList<>();
                longs.add(chargingOrderVO.getAppUserCarId());
                List<TAppUserCar> data1 = appUserCarClient.getCarByIds(longs).getData();
                if (!data1.isEmpty()){
                    chargingOrderVO.setLicensePlate(data1.get(0).getLicensePlate());
                if (chargingOrderVO.getAppUserCarId()!=null){
                    longs.add(chargingOrderVO.getAppUserCarId());
                    List<TAppUserCar> data1 = appUserCarClient.getCarByIds(longs).getData();
                    if (!data1.isEmpty()){
                        chargingOrderVO.setLicensePlate(data1.get(0).getLicensePlate());
                    }
                }
            }
        }
        tCharingOrderVO.setTotal(total);
@@ -556,4 +634,21 @@
        tCharingOrderVO.setList(pageInfo);
        return tCharingOrderVO;
    }
    @Override
    public R<PageInfo<PayOrderDto>> payOrderQuery(PayOrderQueryDto payOrderQueryDto) {
        PageInfo<PayOrderDto> pageInfo = new PageInfo<>(payOrderQueryDto.getPageCurr(),payOrderQueryDto.getPageSize());
        List<PayOrderDto> list = this.baseMapper.payOrderQuery(pageInfo,payOrderQueryDto);
        pageInfo.setRecords(list);
        return R.ok(pageInfo);
    }
    @Override
    public R<PageInfo<TChargingOrderRefund>> getRefundList(ChargingRefundDto chargingRefundDto) {
        PageInfo<TChargingOrderRefund> pageInfo = new PageInfo<>(chargingRefundDto.getPageCurr(),chargingRefundDto.getPageSize());
        List<TChargingOrderRefund> list = this.baseMapper.getRefundList(pageInfo,chargingRefundDto);
        pageInfo.setRecords(list);
        return R.ok(pageInfo);
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TExchangeOrderServiceImpl.java
@@ -25,7 +25,9 @@
import javax.annotation.Resource;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * <p>
@@ -61,7 +63,7 @@
     * @return
     */
    @Override
    public List<MyExchangeOrderList> getMyExchangeOrder(GetMyExchangeOrder query) {
    public Map<String, Object> getMyExchangeOrder(GetMyExchangeOrder query) {
        Long userid = tokenService.getLoginUserApplet().getUserId();
        LambdaQueryWrapper<TExchangeOrder> wrapper = new LambdaQueryWrapper<TExchangeOrder>().eq(TExchangeOrder::getDelFlag, 0).eq(TExchangeOrder::getAppUserId, userid);
        if(query.getStatus() == 0){
@@ -69,7 +71,9 @@
        }else{
            wrapper.eq(TExchangeOrder::getStatus, query.getStatus());
        }
        List<TExchangeOrder> list = this.list(wrapper.orderByDesc(TExchangeOrder::getCreateTime).last(" limit " + query.getPageCurr() + "," + query.getPageSize()));
        long count = this.count(wrapper);
        Integer pageCurr = (query.getPageCurr() - 1) * query.getPageSize();
        List<TExchangeOrder> list = this.list(wrapper.orderByDesc(TExchangeOrder::getCreateTime).last(" limit " + pageCurr + "," + query.getPageSize()));
        List<MyExchangeOrderList> pageList = new ArrayList<>();
        for (TExchangeOrder tExchangeOrder : list) {
            MyExchangeOrderList exchangeOrderList = new MyExchangeOrderList();
@@ -86,7 +90,7 @@
                name = goods.getName();
                imgUrl = goods.getCoverPicture();
            }else{
                TCoupon coupon = couponClient.getCouponById1(tExchangeOrder.getGoodsId()).getData();
                TCoupon coupon = couponClient.getCouponById1(tExchangeOrder.getCouponId()).getData();
                name = coupon.getName();
                imgUrl = coupon.getCoverPicture();
            }
@@ -94,7 +98,10 @@
            exchangeOrderList.setImgUrl(imgUrl);
            pageList.add(exchangeOrderList);
        }
        return pageList;
        Map<String, Object> map = new HashMap<>();
        map.put("list", pageList);
        map.put("total", count);
        return map;
    }
    
    
@@ -109,10 +116,12 @@
        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());
        if(null != exchangeOrder.getAppUserAddressId()){
            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 = "";
@@ -122,7 +131,7 @@
            name = goods.getName();
            imgUrl = goods.getCoverPicture();
        }else{
            TCoupon coupon = couponClient.getCouponById1(exchangeOrder.getGoodsId()).getData();
            TCoupon coupon = couponClient.getCouponById1(exchangeOrder.getCouponId()).getData();
            info.setCouponType(coupon.getType());
            info.setDays(coupon.getDays());
            info.setEndTime(coupon.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
@@ -137,8 +146,12 @@
        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")));
        if(null != exchangeOrder.getConsignerTime()){
            info.setDeliveryTime(exchangeOrder.getConsignerTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        }
        if(null != exchangeOrder.getReceivingTime()){
            info.setFinishTime(exchangeOrder.getReceivingTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        }
        return info;
    }
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderAppealServiceImpl.java
@@ -2,6 +2,10 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient;
import com.ruoyi.chargingPile.api.model.Site;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.chargingPile.api.vo.SiteNameVO;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.order.api.model.*;
import com.ruoyi.order.api.query.TOrderAppealQuery;
@@ -9,11 +13,14 @@
import com.ruoyi.order.mapper.*;
import com.ruoyi.order.service.TChargingOrderService;
import com.ruoyi.order.service.TOrderAppealService;
import com.ruoyi.other.api.domain.TGoods;
import com.ruoyi.other.api.feignClient.GoodsClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@@ -30,11 +37,11 @@
    @Autowired
    private TChargingOrderMapper chargingOrderMapper;
    @Autowired
    private TExchangeOrderMapper exchangeOrderMapper;
    @Autowired
    private TShoppingOrderMapper shoppingOrderMapper;
    @Autowired
    private TVipOrderMapper vipOrderMapper;
    private GoodsClient goodsClient;
    @Autowired
    private ChargingGunClient chargingGunClient;
    @Override
    public PageInfo<TOrderAppealVO> pageList(TOrderAppealQuery query) {
@@ -44,23 +51,26 @@
        // 查询当前页的订单
        List<TChargingOrder> chargingOrders = chargingOrderMapper.selectList(Wrappers.lambdaQuery(TChargingOrder.class)
                .in(TChargingOrder::getId, orderIds));
        List<TExchangeOrder> exchangeOrders = exchangeOrderMapper.selectList(Wrappers.lambdaQuery(TExchangeOrder.class)
                .in(TExchangeOrder::getId, orderIds));
        List<TShoppingOrder> shoppingOrders = shoppingOrderMapper.selectList(Wrappers.lambdaQuery(TShoppingOrder.class)
                .in(TShoppingOrder::getId, orderIds));
        List<TVipOrder> vipOrders = vipOrderMapper.selectList(Wrappers.lambdaQuery(TVipOrder.class)
                .in(TVipOrder::getId, orderIds));
        list.forEach(item -> {
            if (item.getOrderType() == 1) {
                item.setChargingOrder(chargingOrders.stream().filter(chargingOrder -> chargingOrder.getId().equals(item.getOrderId())).findFirst().orElse(null));
            } else if (item.getOrderType() == 2) {
                item.setExchangeOrder(exchangeOrders.stream().filter(exchangeOrder -> exchangeOrder.getId().equals(item.getOrderId())).findFirst().orElse(null));
            }else if (item.getOrderType() == 3) {
                item.setShoppingOrder(shoppingOrders.stream().filter(shoppingOrder -> shoppingOrder.getId().equals(item.getOrderId())).findFirst().orElse(null));
            }else if (item.getOrderType() == 4) {
                item.setVipOrder(vipOrders.stream().filter(vipOrder -> vipOrder.getId().equals(item.getOrderId())).findFirst().orElse(null));
                TChargingOrder tChargingOrder = chargingOrders.stream().filter(chargingOrder -> chargingOrder.getId().equals(item.getOrderId())).findFirst().orElse(null);
                if(Objects.nonNull(tChargingOrder)){
                    item.setChargingOrder(chargingOrders.stream().filter(chargingOrder -> chargingOrder.getId().equals(item.getOrderId())).findFirst().orElse(null));
                    SiteNameVO siteNameVO = chargingGunClient.getAllInfoById(tChargingOrder.getChargingGunId()).getData();
                    item.setGunName(siteNameVO.getGunName());
                    item.setGunNumber(siteNameVO.getGunNumber());
                    item.setPileName(siteNameVO.getPileName());
                    item.setPileNumber(siteNameVO.getPileNumber());
                    item.setSiteName(siteNameVO.getSiteName());
                }
            }else if (item.getOrderType() == 2) {
                TShoppingOrder tShoppingOrder = shoppingOrders.stream().filter(shoppingOrder -> shoppingOrder.getId().equals(item.getOrderId())).findFirst().orElse(null);
                setGoodsInfo(item,tShoppingOrder);
            }
        });
        list.forEach(e->e.setUid(e.getId().toString()));
        pageInfo.setRecords(list);
        return pageInfo;
    }
@@ -73,13 +83,22 @@
        // 查询申诉详情
        if (orderAppeal.getOrderType() == 1) {
            orderAppealVO.setChargingOrder(chargingOrderMapper.selectById(orderAppeal.getOrderId()));
        } else if (orderAppeal.getOrderType() == 2) {
            orderAppealVO.setExchangeOrder(exchangeOrderMapper.selectById(orderAppeal.getOrderId()));
        }else if (orderAppeal.getOrderType() == 3) {
            orderAppealVO.setShoppingOrder(shoppingOrderMapper.selectById(orderAppeal.getOrderId()));
        }else if (orderAppeal.getOrderType() == 4) {
            orderAppealVO.setVipOrder(vipOrderMapper.selectById(orderAppeal.getOrderId()));
        }else if (orderAppeal.getOrderType() == 2) {
            TShoppingOrder tShoppingOrder = shoppingOrderMapper.selectById(orderAppeal.getOrderId());
            setGoodsInfo(orderAppealVO,tShoppingOrder);
        }
        return orderAppealVO;
    }
    private void setGoodsInfo(TOrderAppealVO orderAppealVO,TShoppingOrder tShoppingOrder){
        if(Objects.nonNull(tShoppingOrder)){
            orderAppealVO.setShoppingOrder(tShoppingOrder);
            TGoods goods = goodsClient.getGoodsById(tShoppingOrder.getGoodsId()).getData();
            if(Objects.nonNull(goods)){
                orderAppealVO.setGoodsName(goods.getName());
                orderAppealVO.setGoodsPicture(goods.getCoverPicture());
            }
        }
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderRefundServiceImpl.java
New file
@@ -0,0 +1,15 @@
package com.ruoyi.order.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.order.api.model.TShoppingOrderRefund;
import com.ruoyi.order.mapper.TShoppingOrderRefundMapper;
import com.ruoyi.order.service.TShoppingOrderRefundService;
import org.springframework.stereotype.Service;
/**
 * @author zhibing.pu
 * @date 2024/8/28 15:16
 */
@Service
public class TShoppingOrderRefundServiceImpl extends ServiceImpl<TShoppingOrderRefundMapper, TShoppingOrderRefund> implements TShoppingOrderRefundService {
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java
@@ -7,11 +7,13 @@
import com.ruoyi.account.api.feignClient.AppCouponClient;
import com.ruoyi.account.api.feignClient.AppUserAddressClient;
import com.ruoyi.account.api.model.TAppUserAddress;
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.security.service.TokenService;
import com.ruoyi.order.api.model.TExchangeOrder;
import com.ruoyi.order.api.model.TShoppingOrder;
import com.ruoyi.order.api.model.TShoppingOrderRefund;
import com.ruoyi.order.api.query.ShoppingOrderQuery;
import com.ruoyi.order.api.query.TActivityStatisticsQuery;
import com.ruoyi.order.api.vo.ChargingOrderVO;
@@ -19,21 +21,31 @@
import com.ruoyi.order.api.vo.TActivityVO;
import com.ruoyi.order.dto.*;
import com.ruoyi.order.mapper.TShoppingOrderMapper;
import com.ruoyi.order.service.TShoppingOrderRefundService;
import com.ruoyi.order.service.TShoppingOrderService;
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 com.ruoyi.payment.api.feignClient.AliPaymentClient;
import com.ruoyi.payment.api.feignClient.WxPaymentClient;
import com.ruoyi.payment.api.model.RefundReq;
import com.ruoyi.payment.api.model.RefundResp;
import com.ruoyi.payment.api.model.WxPaymentRefundModel;
import com.ruoyi.payment.api.vo.AliQueryOrder;
import com.ruoyi.payment.api.vo.NotifyV3PayDecodeRespBody;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
 * <p>
@@ -59,6 +71,15 @@
    private AppUserAddressClient appUserAddressClient;
    @Resource
    private AppCouponClient appCouponClient;
    @Resource
    private WxPaymentClient wxPaymentClient;
    @Resource
    private AliPaymentClient aliPaymentClient;
    @Resource
    private TShoppingOrderRefundService shoppingOrderRefundService;
    
    
    
@@ -167,14 +188,16 @@
     * @return
     */
    @Override
    public List<MyShoppingOrderList> getMyShoppingOrderList(GetMyShoppingOrderList query) {
    public Map<String, Object> getMyShoppingOrderList(GetMyShoppingOrderList query) {
        Long userId = tokenService.getLoginUserApplet().getUserId();
        LambdaQueryWrapper<TShoppingOrder> wrapper = new LambdaQueryWrapper<TShoppingOrder>().eq(TShoppingOrder::getDelFlag, 0)
                .eq(TShoppingOrder::getAppUserId, userId);
        if(query.getStatus() != 0){
            wrapper.eq(TShoppingOrder::getStatus, query.getStatus());
        }
        List<TShoppingOrder> list = this.list(wrapper.orderByDesc(TShoppingOrder::getCreateTime).last(" limit " + query.getPageCurr() + ", " + query.getPageSize()));
        long count = this.count(wrapper);
        Integer pageCurr = (query.getPageCurr() - 1) * query.getPageSize();
        List<TShoppingOrder> list = this.list(wrapper.orderByDesc(TShoppingOrder::getCreateTime).last(" limit " + pageCurr + ", " + query.getPageSize()));
        List<MyShoppingOrderList> pageList = new ArrayList<>();
        for (TShoppingOrder tShoppingOrder : list) {
            MyShoppingOrderList myShoppingOrderList = new MyShoppingOrderList();
@@ -186,7 +209,7 @@
                name = goods.getName();
                imgUrl = goods.getCoverPicture();
            }else{
                TCoupon coupon = couponClient.getCouponById1(tShoppingOrder.getGoodsId()).getData();
                TCoupon coupon = couponClient.getCouponById1(tShoppingOrder.getCouponId()).getData();
                name = coupon.getName();
                imgUrl = coupon.getCoverPicture();
            }
@@ -197,9 +220,13 @@
            myShoppingOrderList.setUnitPrice(unitPrice);
            myShoppingOrderList.setNumber(tShoppingOrder.getPurchaseQuantity());
            myShoppingOrderList.setPaymentAmount(tShoppingOrder.getPaymentAmount());
            myShoppingOrderList.setOrderType(tShoppingOrder.getOrderType());
            pageList.add(myShoppingOrderList);
        }
        return pageList;
        Map<String, Object> map = new HashMap<>();
        map.put("list", pageList);
        map.put("total", count);
        return map;
    }
    
    
@@ -227,7 +254,7 @@
            name = goods.getName();
            imgUrl = goods.getCoverPicture();
        }else{
            TCoupon coupon = couponClient.getCouponById1(shoppingOrder.getGoodsId()).getData();
            TCoupon coupon = couponClient.getCouponById1(shoppingOrder.getCouponId()).getData();
            info.setCouponType(coupon.getType());
            info.setDays(coupon.getDays());
            info.setEndTime(coupon.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
@@ -241,10 +268,15 @@
        info.setUnitPrice(unitPrice);
        info.setCode(shoppingOrder.getCode());
        info.setCreateTime(shoppingOrder.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        info.setOrderAmount(shoppingOrder.getOrderAmount());
        info.setPaymentAmount(shoppingOrder.getPaymentAmount());
        info.setRemark(shoppingOrder.getRemark());
        info.setDeliveryTime(shoppingOrder.getConsignerTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        info.setFinishTime(shoppingOrder.getReceivingTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        if(null != shoppingOrder.getConsignerTime()){
            info.setDeliveryTime(shoppingOrder.getConsignerTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        }
        if(null != shoppingOrder.getReceivingTime()){
            info.setFinishTime(shoppingOrder.getReceivingTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        }
        return info;
    }
    
@@ -263,25 +295,143 @@
        if(shoppingOrder.getStatus() == 3){
            return AjaxResult.error("订单已完成,不能取消");
        }
        if(shoppingOrder.getStatus() == 4){
        //退款状态并且所有金额退完
        List<TShoppingOrderRefund> list = shoppingOrderRefundService.list(new LambdaQueryWrapper<TShoppingOrderRefund>().eq(TShoppingOrderRefund::getShoppingOrderId, id).eq(TShoppingOrderRefund::getRefundStatus, 2));
        BigDecimal bigDecimal = list.stream().map(TShoppingOrderRefund::getRefundAmount).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_EVEN);
        if(shoppingOrder.getPaymentAmount().compareTo(bigDecimal) == 0 && shoppingOrder.getStatus() == 4){
            return AjaxResult.error("订单已取消,不能重复操作");
        }
        //退款金额
        BigDecimal refundAmount = shoppingOrder.getPaymentAmount().subtract(bigDecimal);
        //先查询第三方订单状态订单是否退款
        //支付方式(1=微信,2=支付宝) todo 待完善
        //支付方式(1=微信,2=支付宝)
        Integer paymentType = shoppingOrder.getPaymentType();
        if(1 == paymentType){
            NotifyV3PayDecodeRespBody data = wxPaymentClient.queryOrderInfo(shoppingOrder.getCode()).getData();
            String trade_state = data.getTrade_state();
            if("NOTPAY".equals(trade_state) || "REVOKED".equals(trade_state) || "PAYERROR".equals(trade_state)){
                return AjaxResult.error("订单还未支付,不能操作退款");
            }
            if("CLOSED".equals(trade_state)){
                return AjaxResult.error("订单支付已关闭,不能操作退款");
            }
            if("USERPAYING".equals(trade_state)){
                return AjaxResult.error("订单正在支付中,不能操作退款");
            }
        }
        if(2 == paymentType){
            AliQueryOrder aliQueryOrder = aliPaymentClient.query(shoppingOrder.getCode()).getData();
            String tradeStatus = aliQueryOrder.getTradeStatus();
            if("TRADE_CLOSED".equals(tradeStatus)){
                return AjaxResult.error("订单还未支付,不能操作退款");
            }
            if("TRADE_FINISHED".equals(tradeStatus)){
                return AjaxResult.error("订单支付已关闭,不能操作退款");
            }
            if("WAIT_BUYER_PAY".equals(tradeStatus)){
                return AjaxResult.error("订单正在支付中,不能操作退款");
            }
        }
        //退款成功后需要判断商品库存类型后决定是否需要回退库存
        //加redis锁处理高并发
        //构建退款明细
        TShoppingOrderRefund shoppingOrderRefund = new TShoppingOrderRefund();
        shoppingOrderRefund.setPayTime(shoppingOrder.getPayTime());
        shoppingOrderRefund.setPayCode(shoppingOrder.getSerialNumber());
        shoppingOrderRefund.setPayType(shoppingOrder.getPaymentType());
        shoppingOrderRefund.setShoppingOrderId(shoppingOrder.getId());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        shoppingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Math.random() * 1000));
        shoppingOrderRefund.setRefundAmount(refundAmount);
        shoppingOrderRefund.setRefundStatus(1);
        shoppingOrderRefund.setCode(shoppingOrder.getCode());
        shoppingOrderRefund.setRefundTitle("取消订单");
        shoppingOrderRefund.setRefundContent("取消订单");
        shoppingOrderRefund.setRefundReason("取消订单");
        shoppingOrderRefund.setRefundRemark("全额退款");
        shoppingOrderRefund.setRefundTotalAmount(refundAmount.add(bigDecimal));
        shoppingOrderRefund.setPayAmount(shoppingOrder.getPaymentAmount());
        if(1 == paymentType){
            WxPaymentRefundModel model = new WxPaymentRefundModel();
            model.setOut_trade_no(shoppingOrder.getCode());
            model.setOut_refund_no(shoppingOrderRefund.getRefundCode());
            model.setReason("取消订单");
            model.setNotify_url("http://127.0.0.1:9000/order/t-shopping-order/cancelShoppingOrderWxRefund");
            WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount();
            amount.setRefund(refundAmount.multiply(new BigDecimal(100)).intValue());
            amount.setTotal(shoppingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue());
            amount.setCurrency("CNY");
            model.setAmount(amount);
            R<String> orderR = wxPaymentClient.refundOrderR(model);
            if(200 == orderR.getCode()){
                shoppingOrderRefundService.save(shoppingOrderRefund);
            }
        }
        if(2 == paymentType){
            RefundReq dto = new RefundReq();
            dto.setOutTradeNo(shoppingOrder.getCode());
            dto.setOutRequestNo(shoppingOrderRefund.getCode());
            dto.setRefundAmount(refundAmount.toString());
            dto.setRefundReason("取消订单");
            RefundResp resp = aliPaymentClient.refund(dto).getData();
            if(null != resp){
                SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE");
                AjaxResult success = cancelShoppingOrderWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", sdf1.format(new Date()));
                if(success.isSuccess()){
                    shoppingOrderRefundService.save(shoppingOrderRefund);
                }
            }
        }
        return AjaxResult.success();
    }
    
    /**
     * 商城订单取消订单微信退款处理
     * @param out_refund_no 退款单号
     * @param refund_id 退款流水号
     * @param refund_status 退款状态 SUCCESS:退款成功  CLOSED:退款关闭  ABNORMAL:退款异常
     * @param success_time 退款成功时间
     * @return
     */
    @Override
    @GlobalTransactional(rollbackFor = Exception.class)//分布式事务
    public AjaxResult cancelShoppingOrderWxRefund(String out_refund_no, String refund_id, String refund_status, String success_time) {
        if("SUCCESS".equals(refund_status)){
            TShoppingOrderRefund one = shoppingOrderRefundService.getOne(new LambdaQueryWrapper<TShoppingOrderRefund>().eq(TShoppingOrderRefund::getRefundCode, out_refund_no));
            one.setRefundSerialNumber(refund_id);
            one.setRefundTime(LocalDateTime.parse(success_time, DateTimeFormatter.ofPattern("yyyy-MM-DDTHH:mm:ss+TIMEZONE")));
            shoppingOrderRefundService.updateById(one);
            //判断是否需要回退库存
            TShoppingOrder shoppingOrder = this.getById(one.getShoppingOrderId());
            //商品
            if(shoppingOrder.getOrderType() == 1){
                // todo 需完善redis锁
                //redis锁 和支付使用同一个锁
                TGoods goods = goodsClient.getGoodsById(shoppingOrder.getGoodsId()).getData();
                Integer inventory = goods.getInventory();
                if(-1 != inventory){
                    goods.setInventory(inventory + shoppingOrder.getPurchaseQuantity());
                    goodsClient.updateGoods(goods);
                }
                //解锁
            }
            //优惠券
            if(shoppingOrder.getOrderType() == 2){
                //redis锁
                TCoupon coupon = couponClient.getCouponById1(shoppingOrder.getCouponId()).getData();
                Integer inventory = coupon.getInventoryQuantity();
                if(-1 != inventory){
                    coupon.setInventoryQuantity(inventory + shoppingOrder.getPurchaseQuantity());
                    couponClient.updateCoupon(coupon);
                }
                //解锁
            }
        }
        return AjaxResult.success();
    }
    
    /**
     * 获取未开票的订单列表
@@ -314,6 +464,7 @@
            myShoppingOrderList.setUnitPrice(unitPrice);
            myShoppingOrderList.setNumber(tShoppingOrder.getPurchaseQuantity());
            myShoppingOrderList.setPaymentAmount(tShoppingOrder.getPaymentAmount());
            myShoppingOrderList.setCreateTime(tShoppingOrder.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy.MM.dd HH:mm:ss")));
            pageList.add(myShoppingOrderList);
        }
        return pageList;
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TVipOrderRefundServiceImpl.java
New file
@@ -0,0 +1,15 @@
package com.ruoyi.order.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.order.api.model.TVipOrderRefund;
import com.ruoyi.order.mapper.TVipOrderRefundMapper;
import com.ruoyi.order.service.TVipOrderRefundService;
import org.springframework.stereotype.Service;
/**
 * @author zhibing.pu
 * @date 2024/8/28 15:19
 */
@Service
public class TVipOrderRefundServiceImpl extends ServiceImpl<TVipOrderRefundMapper, TVipOrderRefund> implements TVipOrderRefundService {
}
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -102,4 +102,135 @@
            and (t1.end_time between #{endTime1} and #{endTime2}
        </if>
    </select>
    <select id="payOrderQuery" resultType="com.ruoyi.order.dto.PayOrderDto">
        SELECT * FROM (SELECT
                           id,
                           `code`,
                           1 as type,
                           title,
                           phone,
                           `status`,
                           order_amount,
                           payment_amount ,
                           create_time,
                           end_time,
                           pay_time
                       FROM
                           charging_pile_order.t_charging_order UNION ALL
                       SELECT
                           id,
                           `code`,
                           2 as type,
                           title,
                           phone,
                           `status`,
                           order_amount,
                           payment_amount ,
                           create_time,
                           receiving_time as end_time,
                           pay_time
                       FROM
                           charging_pile_order.t_shopping_order UNION ALL
                       SELECT
                           id,
                           `code`,
                           3 as type,
                           title,
                           phone,
                           payment_status AS `status`,
                           order_amount,
                           payment_amount ,
                           create_time,
                           create_time as end_time,
                           pay_time
                       FROM
                           charging_pile_order.t_vip_order UNION ALL
                       SELECT
                           id,
                           `code`,
                           4 as type,
                           title,
                           phone,
                           `status`,
                           order_amount ,
                           order_amount as payment_amount,
                           create_time,
                           out_parking_time as end_time,
                           out_parking_time as pay_time
                       FROM
                           charging_pile_service.t_parking_record ) o
                <where>
                    <if test="data.code != null and data.code != ''">
                        AND o.code LIKE CONCAT('%',#{data.code},'%')
                    </if>
                    <if test="data.phone != null and data.phone != ''">
                        AND o.phone LIKE CONCAT('%',#{data.phone},'%')
                    </if>
                    <if test="data.type != null">
                        AND o.type = #{data.type}
                    </if>
                    <if test="data.status != null">
                        AND o.status = #{data.status}
                    </if>
                    <if test="data.createTime1 != null">
                        AND o.create_time &gt;= #{data.createTime1}
                    </if>
                    <if test="data.createTime2 != null">
                        AND o.create_time &lt;= #{data.createTime2}
                    </if>
                </where>
    </select>
    <select id="getRefundList" resultType="com.ruoyi.order.api.model.TChargingOrderRefund">
        select * from (SELECT id,
                              `code`,
                              refund_code,
                              refund_title,
                              refund_reason,
                              refund_amount,
                              refund_total_amount,
                              refund_time,
                              pay_type,
                              pay_amount,
                              refund_remark
                       FROM t_charging_order_refund
                       UNION ALL
                       SELECT id,
                              `code`,
                              refund_code,
                              refund_title,
                              refund_reason,
                              refund_amount,
                              refund_total_amount,
                              refund_time,
                              pay_type,
                              pay_amount,
                              refund_remark
                       FROM t_shopping_order_refund
                       UNION ALL
                       SELECT id,
                              `code`,
                              refund_code,
                              refund_title,
                              refund_reason,
                              refund_amount,
                              refund_total_amount,
                              refund_time,
                              pay_type,
                              pay_amount,
                              refund_remark
                       FROM t_vip_order_refund) o
        <where>
            <if test="data.code != null and data.code != ''">
                AND o.code LIKE CONCAT('%',#{data.code},'%')
            </if>
            <if test="data.refundCode != null and data.refundCode != ''">
                AND o.refund_code LIKE CONCAT('%',#{data.refundCode},'%')
            </if>
        </where>
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java
@@ -197,5 +197,22 @@
        return R.ok(coupon);
    }
    @PostMapping(value = "/getCouponById")
    public R<TCoupon> getCouponById(@RequestParam("id") Integer id){
        TCoupon coupon = tCouponService.getById(id);
        return R.ok(coupon);
    }
    /**
     * 修改优惠券
     * @param coupon
     * @return
     */
    @PostMapping(value = "/updateCoupon")
    public R updateCoupon(@RequestBody TCoupon coupon){
        tCouponService.updateById(coupon);
        return R.ok();
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEvaluationTagController.java
@@ -107,8 +107,9 @@
    @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"));
    public AjaxResult<List<TEvaluationTag>> getRandomEvaluationTag(Integer type){
        List<TEvaluationTag> list = evaluationTagService.list(new LambdaQueryWrapper<TEvaluationTag>().eq(TEvaluationTag::getType, type)
                .last(" order by RAND() limit 0, 4"));
        return AjaxResult.success(list);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java
@@ -110,10 +110,25 @@
    @GetMapping("/getInfo")
    @ApiOperation(tags = {"管理后台-商品管理","小程序-兑换商城"},value = "商品查看详情")
    @ApiOperation(tags = {"管理后台-商品管理"},value = "商品查看详情")
    public AjaxResult<TGoods> getInfo(Integer id) {
        return AjaxResult.ok(goodsService.getById(id));
        TGoods byId = goodsService.getById(id);
        return AjaxResult.ok(byId);
    }
    @GetMapping("/getInfoByType")
    @ApiOperation(tags = {"小程序-兑换商城"},value = "商品查看详情")
    public AjaxResult getInfoByType(Integer goodType,Integer id) {
        if (goodType==1){
        TGoods byId = goodsService.getById(id);
        return AjaxResult.ok(byId);}
        else {
            TCoupon byId = couponService.getById(id);
            return AjaxResult.ok(byId);
    }
    }
@@ -130,6 +145,40 @@
        return AjaxResult.ok(goodsService.pageList1(appGoodQuery));
    }
    @ApiOperation(tags = {"小程序-兑换商城"},value = "积分兑换商品检查数量")
    @PostMapping(value = "/app/shop/check")
    public R check(@RequestBody ExchangeDto exchangeDto) {
        //检查当前用户积分是否够
        Long userId = tokenService.getLoginUserApplet().getUserId();
        Integer point = 0;
        if (exchangeDto.getGoodType()==1) {
            //查询当前商品信息
            TGoods good = goodsService.getById(exchangeDto.getGoodId());
            point = good.getRedeemPoints();
            //检查当前用户是否到达兑换上限
            Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId,exchangeDto.getGoodType()).getData();
            if (good.getLimitExchangeTimes() != -1 && count >= good.getLimitExchangeTimes()) {
                return R.fail("当前用户已兑换"+count+"张");
            }
            TAppUser user = appUserClient.getUserById(userId).getData();
            if (user.getPoints()<good.getRedeemPoints()){
                return R.fail("当前用户积分不足");
            }
        }else {
            TCoupon coupon = couponService.getById(exchangeDto.getGoodId());
            point = coupon.getRedeemPoints();
            Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId,exchangeDto.getGoodType()).getData();
            if (coupon.getInventoryQuantity() != -1 && count >= coupon.getInventoryQuantity()) {
                return R.fail("当前用户已到达兑换"+coupon+"次");
            }
    }
        return R.ok();
    }
    @ApiOperation(tags = {"小程序-兑换商城"},value = "积分兑换商品")
    @PostMapping(value = "/app/shop")
    public AjaxResult<PageInfo<TGoods>> shop(@RequestBody ExchangeDto exchangeDto) {
@@ -144,7 +193,7 @@
            //检查当前用户是否到达兑换上限
            Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId,exchangeDto.getGoodType()).getData();
            if (good.getLimitExchangeTimes() != -1 && count >= good.getLimitExchangeTimes()) {
                return AjaxResult.error("当前用户已到达兑换上限");
                return AjaxResult.error("当前用户已兑换"+count+"张");
            }
        TAppUser user = appUserClient.getUserById(userId).getData();
        if (user.getPoints()<good.getRedeemPoints()){
@@ -156,10 +205,11 @@
            Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId,exchangeDto.getGoodType()).getData();
            if (coupon.getInventoryQuantity() != -1 && count >= coupon.getInventoryQuantity()) {
                return AjaxResult.error("当前用户已到达兑换上限");
                return AjaxResult.error("当前用户已到达兑换"+coupon+"次");
            }
        }
        exchangeDto.setPoint(point);
        exchangeDto.setUserId(userId);
        //生成积分兑换成功的订单
        R<Long> longR = orderClient.exchangeCreate(exchangeDto);
        if (exchangeDto.getGoodType()==2) {
@@ -177,7 +227,7 @@
        pointChangeDto.setPoints(point);
        pointChangeDto.setRemark(longR.getData().toString());
        pointChangeDto.setType(6);
        appUserClient.change(pointChangeDto);
        appUserClient.changeDown(pointChangeDto);
        return AjaxResult.success();
@@ -189,7 +239,7 @@
        Long userId = tokenService.getLoginUserApplet().getUserId();
        TAppUser user = appUserClient.getUserById(userId).getData();
        boolean isVip = false;
        if (user.getVipEndTime().isAfter(LocalDateTime.now())){
        if (user.getVipEndTime()!=null&&user.getVipEndTime().isAfter(LocalDateTime.now())){
            isVip = true;
        }
        //计算价格
@@ -206,7 +256,7 @@
                    originalPrice = good.getVipPrice();
                }
            }
            orderPrice.add(originalPrice.multiply(BigDecimal.valueOf(exchangeDto.getNum())));
            orderPrice =  orderPrice.add(originalPrice.multiply(BigDecimal.valueOf(exchangeDto.getNum())));
        }else {
            TCoupon coupon = couponService.getById(exchangeDto.getGoodId());
            BigDecimal originalPrice = coupon.getPaymentAmount();
@@ -216,7 +266,7 @@
                    originalPrice = coupon.getVipPaymentAmount();
                }
            }
            orderPrice.add(originalPrice);
            orderPrice  = orderPrice.add(originalPrice);
        }
        exchangeDto.setOrderPrice(orderPrice);
@@ -236,6 +286,7 @@
        exchangeDto.setPayPrice(payPrice);
        exchangeDto.setDiscountPrice(discountPrice);
        exchangeDto.setVipDiscount(vipDiscount);
        exchangeDto.setUserId(userId);
        //创建订单
        TShoppingOrder shopOrder = orderClient.shopCreate(exchangeDto).getData();
        if (exchangeDto.getPayMethod()==1) {
@@ -267,5 +318,17 @@
        TGoods goods = goodsService.getById(id);
        return R.ok(goods);
    }
    /**
     * 修改商品
     * @param goods
     * @return
     */
    @PostMapping("/updateGoods")
    public R updateGoods(@RequestBody TGoods goods){
        goodsService.updateById(goods);
        return R.ok();
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TInvoiceTypeController.java
@@ -80,7 +80,7 @@
    
    
    @ResponseBody
    @DeleteMapping("/getInvoiceTypeList")
    @GetMapping("/getInvoiceTypeList")
    @ApiOperation(value = "获取开票类型", tags = {"小程序-充电发票"})
    public AjaxResult<List<TInvoiceType>> getInvoiceTypeList(){
        List<TInvoiceType> list = invoiceTypeService.list(new LambdaQueryWrapper<TInvoiceType>()
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java
@@ -25,6 +25,7 @@
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -143,19 +144,34 @@
    @ApiOperation(value = "会员信息", tags = {"小程序-个人中心"})
    @PostMapping("/vipInfo")
    public AjaxResult<VipInfoDto> vipInfo() {
    @GetMapping("/vipInfo")
    public R<List<VipInfoDto>> vipInfo() {
        List<VipInfoDto> vipInfoDtos = new ArrayList<>();
        List<TVip> vips = vipService.lambdaQuery().eq(TVip::getReveal, 1).list();
        LocalDateTime now = LocalDateTime.now();
        for (TVip vip : vips) {
            VipInfoDto vipInfoDto = new VipInfoDto();
            vipInfoDto.setMonthlyCard(vip.getMonthlyCardReveal()==1?vip.getMonthlyCard():null);
            vipInfoDto.setSeasonCard(vip.getSeasonCardReveal()==1?vip.getSeasonCard():null);
            vipInfoDto.setAnnualCard(vip.getAnnualCardReveal()==1?vip.getAnnualCard():null);
            //判断是否在折扣时间内,然后设置折扣价格
            if (vip.getMonthlyCardDiscountStart()!=null&&(now.isAfter(vip.getMonthlyCardDiscountStart())&&now.isBefore(vip.getMonthlyCardDiscountEnd()))){
                vipInfoDto.setMonthlyCardDiscount(vip.getMonthlyCardDiscount());
            }
            if (vip.getSeasonCardDiscountStart()!=null&&(now.isAfter(vip.getSeasonCardDiscountStart())&&now.isBefore(vip.getSeasonCardDiscountEnd()))){
                vipInfoDto.setSeasonCardDiscount(vip.getSeasonCardDiscount());
            }
            if (vip.getAnnualCardDiscountStart()!=null&&(now.isAfter(vip.getAnnualCardDiscountStart())&&now.isBefore(vip.getAnnualCardDiscountEnd()))){
                vipInfoDto.setAnnualCardDiscount(vip.getAnnualCardDiscount());
            }
            vipInfoDto.setMaximumDeduction(vip.getMaximumDeduction());
            vipInfoDto.setDiscountTimes(vip.getDiscountTimes());
            vipInfoDto.setDoubleIntegration(vip.getDoubleIntegration());
            vipInfoDto.setMallExclusivePrice(vip.getMallExclusivePrice());
            vipInfoDto.setName(vip.getName());
            List<SendCouponDto> javaList = JSON.parseArray(vip.getCoupon()).toJavaList(SendCouponDto.class);
            List<VipCouponDto> vipCouponDtos = new ArrayList<>();
            if (!javaList.isEmpty()){
@@ -175,12 +191,13 @@
            total = total.add(vip.getMaximumDeduction().multiply(BigDecimal.valueOf(vip.getDiscountTimes())));
            for (VipCouponDto vipCouponDto : vipCouponDtos) {
                TCoupon tCoupon = vipCouponDto.getTCoupon();
                total.add(tCoupon.getDiscount());
                total.add(tCoupon.getMaximumDiscountAmount());
            }
            vipInfoDto.setTotalDiscount(total);
            vipInfoDto.setTimeAmount(vip.getMaximumDeduction().multiply(BigDecimal.valueOf(vip.getDiscountTimes())));
            vipInfoDtos.add(vipInfoDto);
        }
        return AjaxResult.success(vipInfoDtos);
        return R.ok(vipInfoDtos);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java
@@ -83,10 +83,10 @@
        // 订单号加上商品类型
        String res = string+"-"+dto.getType();
        List<Integer> data = orderClient.getSalesCountByGoodsId(res).getData();
        for (int i = 0; i < list.size(); i++) {
            list.get(i).setSalesCount(data.get(i));
        }
//        List<Integer> data = orderClient.getSalesCountByGoodsId(res).getData();
//        for (int i = 0; i < list.size(); i++) {
//            list.get(i).setSalesCount(data.get(i));
//        }
        pageInfo.setRecords(list);
        return pageInfo;
    }
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml
@@ -52,23 +52,23 @@
    <select id="pageList1" resultType="com.ruoyi.other.api.domain.TGoods">
        SELECT
            id,name,redeem_points,inventory,original_price,preferential_price,vip_price
            id,name,redeem_points as redeemPoints,inventory,original_price as originalPrice ,preferential_price as preferentialPrice,vip_price as vipPrice,1 as goodType,cover_picture as coverPicture
        FROM
            t_goods
        WHERE `status` = 1 and del_flag = 0 and type = #{appGoodQuery.type}
        UNION ALL
        SELECT
            id,name,redeem_points,inventory_quantity as inventory,payment_amount as preferential_price,vip_payment_amount as vip_price
            id,name,redeem_points  as redeemPoints,inventory_quantity as inventory,payment_amount as originalPrice,payment_amount as preferentiaPrice,vip_payment_amount as vipPrice,2 as goodType,cover_picture as coverPicture
        FROM
            t_coupon
        WHERE `status`= 1 and del_flag = 0 and type = #{appGoodQuery.type}
        WHERE `status`= 1 and del_flag = 0 and ways_to_obtain != #{appGoodQuery.type}
        ORDER BY
            CASE
                WHEN `inventory` = 0 THEN
                    0 ELSE 1
                END DESC,
            `redeem_points` ASC;
            `redeemPoints` ASC
    </select>
</mapper>
ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/WxPayController.java
@@ -4,6 +4,7 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.payment.api.vo.PaymentOrder;
import com.ruoyi.payment.api.vo.WxRefundNotifyResp;
import com.ruoyi.payment.wx.enums.RefundEnum;
import com.ruoyi.payment.api.model.WxPaymentRefundModel;
import com.ruoyi.payment.wx.resp.NotifyV3PayDecodeRespBody;
@@ -149,12 +150,12 @@
     * 退款回调
     */
    @PostMapping("refund/notify")
    public void refundNotify(HttpServletRequest request) throws IOException {
    public R<WxRefundNotifyResp> refundNotify(HttpServletRequest request) throws IOException {
        try {
            Map<String, Object> params = wxV3Pay.verifyNotify(request, new TypeReference<Map<String, Object>>() {
            });
            // 商户订单号
            String tradeNo = params.get("out_trade_no").toString();
            String out_trade_no = params.get("out_trade_no").toString();
            // 商户退款单号
            String out_refund_no = params.get("out_refund_no").toString();
            // 微信支付订单号
@@ -167,21 +168,22 @@
            // 时间不对的话,可以调用  WxTimeUtils.toRfc3339Date(success_time)转换一下
            String success_time = params.get("success_time").toString();
            if (tradeState.equals(RefundEnum.SUCCESS.name())) {
                String substring = out_refund_no.substring(0, 2);
                switch (substring){
                    case "GW":
                        break;
                }
                // TODO 退款成功处理
                WxRefundNotifyResp resp = new WxRefundNotifyResp();
                resp.setOut_trade_no(out_trade_no);
                resp.setOut_refund_no(out_refund_no);
                resp.setTradeState(tradeState);
                resp.setTransaction_id(transaction_id);
                resp.setRefund_id(refund_id);
                resp.setSuccess_time(success_time);
                wxV3Pay.ack();
                return R.ok(resp);
            } else {
                wxV3Pay.ack(false, "不是成功的退款状态");
            }
        } catch (Exception e) {
            wxV3Pay.ack(false, e.getMessage());
        }
        return R.fail();
    }
    
    /**