From dd91a28bdbf8a97531618415c2174aae0ce70ceb Mon Sep 17 00:00:00 2001
From: zhibing.pu <393733352@qq.com>
Date: 星期六, 17 八月 2024 16:03:49 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile

---
 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/AppUserInfoDto.java                             |   25 +
 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/SendCouponDto.java                              |    9 
 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/InfoCouponDto.java                              |   35 ++
 ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingPileClient.java       |   11 
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java                            |    5 
 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppCoupon.java                               |    7 
 ruoyi-service/ruoyi-chargingPile/pom.xml                                                                            |    7 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/THtmlController.java                             |   24 +
 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java                        |   20 +
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java                       |    6 
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/THtml.java                                       |    2 
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipClient.java                              |    5 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java                              |   60 ++++
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/VipCouponDto.java                                   |   10 
 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java                |   46 ++
 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java |    2 
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java                    |   52 ++
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java                      |  171 +++++++++-
 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java                    |    7 
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipFallbackFactory.java                         |    5 
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/GiveVipUtil.java                                   |   96 ++++++
 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java                            |    2 
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java                    |    2 
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/TAppUserVipDetailService.java                   |    1 
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/task/TaskUtil.java                                      |   54 +++
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java                           |   55 +++
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/NoticeQueryDto.java                                 |   12 
 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java               |    5 
 ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingPileFallbackFactory.java  |    6 
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/VipInfoDto.java                                     |   35 ++
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java                     |    6 
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java                 |    4 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java                           |    5 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TSystemConfigurationController.java              |   15 
 ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/SiteInfoVO.java                        |    9 
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java          |   60 ++++
 36 files changed, 805 insertions(+), 71 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/AppUserInfoDto.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/AppUserInfoDto.java
new file mode 100644
index 0000000..28613f6
--- /dev/null
+++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/AppUserInfoDto.java
@@ -0,0 +1,25 @@
+package com.ruoyi.account.api.dto;
+
+import com.ruoyi.account.api.model.TAppUserCar;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Data
+public class AppUserInfoDto {
+    @ApiModelProperty("1是0否")
+    private Integer isVip;
+    @ApiModelProperty("vip结束时间")
+    private LocalDateTime vipExpireTime;
+    @ApiModelProperty("当天是否签到")
+    private Integer isSign;
+    @ApiModelProperty("当前积分")
+    private Integer points;
+    @ApiModelProperty("当前优惠卷数量")
+    private Integer couponNum;
+    @ApiModelProperty("当前绑定的车辆")
+    private List<TAppUserCar> userCars;
+}
diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/InfoCouponDto.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/InfoCouponDto.java
new file mode 100644
index 0000000..1af4b89
--- /dev/null
+++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/InfoCouponDto.java
@@ -0,0 +1,35 @@
+package com.ruoyi.account.api.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Data
+public class InfoCouponDto {
+    @ApiModelProperty(value = "优惠券名称")
+    @TableField("name")
+    private String name;
+    @ApiModelProperty(value = "优惠方式(1=满减,2=抵扣)")
+    @TableField("preferential_mode")
+    private Integer preferentialMode;
+
+    @ApiModelProperty(value = "优惠金额")
+    @TableField("discount_amount")
+    private BigDecimal discountAmount;
+    @ApiModelProperty(value = "满减条件为0时无条件")
+    @TableField("meet_the_conditions")
+    private BigDecimal meetTheConditions;
+
+    @ApiModelProperty(value = "折扣")
+    @TableField("discount")
+    private BigDecimal discount;
+    @ApiModelProperty(value = "结束时间")
+    @TableField("end_time")
+    private LocalDateTime endTime;
+    @ApiModelProperty(value = "开始时间")
+    @TableField("start_time")
+    private LocalDateTime startTime;
+}
diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/SendCouponDto.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/SendCouponDto.java
new file mode 100644
index 0000000..0489150
--- /dev/null
+++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/SendCouponDto.java
@@ -0,0 +1,9 @@
+package com.ruoyi.account.api.dto;
+
+import lombok.Data;
+
+@Data
+public class SendCouponDto {
+    private Integer id;
+    private Integer number;
+}
diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppCoupon.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppCoupon.java
index 0f6d8d1..b3bea84 100644
--- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppCoupon.java
+++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppCoupon.java
@@ -45,6 +45,9 @@
     @ApiModelProperty(value = "结束时间")
     @TableField("end_time")
     private LocalDateTime endTime;
+    @ApiModelProperty(value = "开始时间")
+    @TableField("start_time")
+    private LocalDateTime startTime;
 
     @ApiModelProperty(value = "获得方式(1=积分兑换,2=现金购买)")
     @TableField("ways_to_obtain")
@@ -77,6 +80,10 @@
     @TableField("orderId")
     private Long orderId;
 
+    @ApiModelProperty(value = "当前领取优惠卷的json记录")
+    @TableField("coupon_json")
+    private String couponJson;
+
 
 
 }
diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java
index 9ca255a..577fc54 100644
--- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java
+++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java
@@ -9,6 +9,7 @@
 import lombok.EqualsAndHashCode;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.time.LocalDateTime;
 
 /**
@@ -38,6 +39,16 @@
     @TableField("charge_num")
     private Integer chargeNum;
 
+
+
+    @ApiModelProperty(value = "购买时折扣金额")
+    @TableField("discount_money")
+    private BigDecimal discountMoney;
+
+    @ApiModelProperty(value = "该会员记录应赠送的充电次数")
+    @TableField("send_charge_num")
+    private Integer sendChargeNum;
+
     @ApiModelProperty(value = "会员id")
     @TableField("vip_id")
     private Integer vipId;
@@ -53,5 +64,14 @@
     @TableField("create_time")
     private LocalDateTime createTime;
 
+    @ApiModelProperty(value = "已赠送的月份")
+    @TableField("send_month")
+    private Integer sendMonth;
+
+
+    @ApiModelProperty(value = "要赠送的优惠卷")
+    @TableField("coupon_ids")
+    private String couponIds;
+
 
 }
diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingPileFallbackFactory.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingPileFallbackFactory.java
index 8b4f691..f8bb5cf 100644
--- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingPileFallbackFactory.java
+++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingPileFallbackFactory.java
@@ -2,6 +2,7 @@
 
 import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient;
 import com.ruoyi.chargingPile.api.model.TChargingPile;
+import com.ruoyi.chargingPile.api.vo.SiteInfoVO;
 import com.ruoyi.common.core.domain.R;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -35,6 +36,11 @@
             public R<BigDecimal> getServiceMoney(String param) {
                 return R.fail("根据会员折扣、预付金额 计算服务费失败:"+throwable.getMessage());
             }
+
+            @Override
+            public R<SiteInfoVO> getSiteInfoByNumber(String number) {
+                return R.fail("通过桩编号获取电站信息失败:"+throwable.getMessage());
+            }
         };
     }
 }
diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingPileClient.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingPileClient.java
index a330a00..b2e13b0 100644
--- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingPileClient.java
+++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingPileClient.java
@@ -2,6 +2,7 @@
 
 import com.ruoyi.chargingPile.api.factory.ChargingPileFallbackFactory;
 import com.ruoyi.chargingPile.api.model.TChargingPile;
+import com.ruoyi.chargingPile.api.vo.SiteInfoVO;
 import com.ruoyi.common.core.constant.ServiceNameConstants;
 import com.ruoyi.common.core.domain.R;
 import io.swagger.annotations.ApiOperation;
@@ -24,12 +25,16 @@
      */
     @ApiOperation(value = "管理后台-通过站点id获取充电桩列表 不分页")
     @PostMapping(value = "/t-charging-pile/getChargingPileBySiteId")
-    public R<List<TChargingPile>> getChargingPileBySiteId(@RequestParam("siteId") Integer siteId);
+    R<List<TChargingPile>> getChargingPileBySiteId(@RequestParam("siteId") Integer siteId);
 
     /**
      * 小程序远程调用 根据会员折扣、预付金额 计算服务费
      * @return
      */
-    @PostMapping(value = "/getServiceMoney")
-    public R<BigDecimal> getServiceMoney(@RequestParam("param") String param);
+    @PostMapping(value = "/t-accounting-strategy/getServiceMoney")
+    R<BigDecimal> getServiceMoney(@RequestParam("param") String param);
+
+    @PostMapping("/site/getSiteInfoByNumber")
+    @ApiOperation(value = "扫一扫后通过桩编号获取电站信息", tags = {"小程序-扫一扫"})
+    R<SiteInfoVO> getSiteInfoByNumber(@RequestParam("number") String number);
 }
diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/SiteInfoVO.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/SiteInfoVO.java
index 39fae79..df3a14a 100644
--- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/SiteInfoVO.java
+++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/SiteInfoVO.java
@@ -20,4 +20,13 @@
     private BigDecimal vipElectrovalence;
     @ApiModelProperty(value = "超时占位费说明")
     private String spaceChargeExplain;
+
+    @ApiModelProperty(value = "上次选择车辆logo")
+    private String carLogo;
+    @ApiModelProperty(value = "上次选择车辆车牌号")
+    private String licensePlate;
+    @ApiModelProperty(value = "上次选择车辆品牌")
+    private String vehicleBrand;
+    @ApiModelProperty(value = "上次选择车辆id")
+    private Long id;
 }
diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java
index c398faf..ee6192f 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java
@@ -44,6 +44,11 @@
             public R<TChargingOrder> getOrderDetailByGunId(Integer chargingGunId) {
                 return R.fail("根据充电枪获取正在充电的订单:" + throwable.getMessage());
             }
+
+            @Override
+            public R<Long> getCar() {
+                return R.fail("获取用户最近使用车辆充电的车辆id:" + throwable.getMessage());
+            }
         };
     }
 }
diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java
index b7402f2..5d19dd8 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java
@@ -39,4 +39,11 @@
      */
     @PostMapping(value = "/t-charging-order/getOrderDetailByGunId")
     R<TChargingOrder> getOrderDetailByGunId(@RequestParam("chargingGunId") Integer chargingGunId);
+
+    /**
+     * 获取用户最近使用车辆充电的车辆id
+     * @return
+     */
+    @GetMapping(value = "/t-charging-order/getCar")
+    public R<Long> getCar();
 }
diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java
index c00f97c..9e59397 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java
@@ -7,6 +7,7 @@
 import com.ruoyi.order.api.query.TActivityStatisticsQuery;
 import com.ruoyi.order.api.vo.TActivityVO;
 import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 
@@ -36,4 +37,5 @@
      */
     @PostMapping(value = "/t-exchange-order/activityStatistics")
     public R<TActivityVO> activityStatistics(@RequestBody TActivityStatisticsQuery dto);
+
 }
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/THtml.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/THtml.java
index f4d0e56..553d1cb 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/THtml.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/THtml.java
@@ -24,7 +24,7 @@
 @EqualsAndHashCode(callSuper = false)
 @TableName("t_html")
 @ApiModel(value="THtml对象", description="")
-public class THtml extends BasePojo {
+public class THtml  {
 
     private static final long serialVersionUID = 1L;
 
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/NoticeQueryDto.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/NoticeQueryDto.java
new file mode 100644
index 0000000..879c7cd
--- /dev/null
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/NoticeQueryDto.java
@@ -0,0 +1,12 @@
+package com.ruoyi.other.api.dto;
+
+import com.ruoyi.common.core.web.page.BasePage;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class NoticeQueryDto extends BasePage {
+    private String content;
+    @ApiModelProperty("0未开始1已开始2已结束")
+    private Integer status;
+}
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/VipCouponDto.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/VipCouponDto.java
new file mode 100644
index 0000000..f725386
--- /dev/null
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/VipCouponDto.java
@@ -0,0 +1,10 @@
+package com.ruoyi.other.api.dto;
+
+import com.ruoyi.other.api.domain.TCoupon;
+import lombok.Data;
+
+@Data
+public class VipCouponDto {
+    private TCoupon tCoupon;
+    private Integer num;
+ }
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/VipInfoDto.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/VipInfoDto.java
new file mode 100644
index 0000000..0783c96
--- /dev/null
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/VipInfoDto.java
@@ -0,0 +1,35 @@
+package com.ruoyi.other.api.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.License;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+@Data
+public class VipInfoDto {
+
+    @ApiModelProperty("月卡价格")
+    private BigDecimal monthlyCard;
+    @ApiModelProperty("季卡价格")
+    private BigDecimal seasonCard;
+    @ApiModelProperty("年卡价格")
+    private BigDecimal annualCard;
+    @ApiModelProperty("最高抵扣价格")
+    private BigDecimal maximumDeduction;
+    @ApiModelProperty("抵扣次数")
+    private Integer discountTimes;
+
+    @ApiModelProperty(value = "双倍积分开关(0=否,1=是)")
+    private Integer doubleIntegration;
+
+    @ApiModelProperty(value = "商城专享价开关(0=否,1=是)")
+    private Integer mallExclusivePrice;
+    @ApiModelProperty(value = "可赠送的优惠卷列表")
+
+    private List<VipCouponDto> vipCouponDtos;
+
+    @ApiModelProperty(value = "最高总折扣")
+    private BigDecimal totalDiscount;
+}
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java
index 4099d98..049f55c 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java
@@ -6,6 +6,7 @@
 import com.ruoyi.account.api.vo.CouponListVOVO;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.other.api.domain.TCompany;
+import com.ruoyi.other.api.domain.TCoupon;
 import com.ruoyi.other.api.domain.TUserTag;
 import com.ruoyi.other.api.feignClient.OtherClient;
 import org.slf4j.Logger;
@@ -85,6 +86,11 @@
             public R<List<CouponListVOVO>> getCouponInfoByCouponIds(List<CouponListVOVO> list) {
                 return R.fail("我的优惠券列表获取信息:"+throwable.getMessage());
             }
+
+            @Override
+            public R<TCoupon> getCouponById(Integer id) {
+                return R.fail("查询优惠卷:"+throwable.getMessage());
+            }
         };
     }
 }
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipFallbackFactory.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipFallbackFactory.java
index a4e1f0a..8a3cf05 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipFallbackFactory.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipFallbackFactory.java
@@ -1,6 +1,7 @@
 package com.ruoyi.other.api.factory;
 
 import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.other.api.domain.TVip;
 import com.ruoyi.other.api.feignClient.VipClient;
 import org.slf4j.Logger;
@@ -28,6 +29,10 @@
                 return R.fail("获取最高抵扣、最低起步价,最高折扣的会员失败:" + throwable.getMessage());
 
             }
+            @Override
+            public R<TVip> getInfo(Integer type) {
+                return null;
+            }
 
             @Override
             public R<TVip> getInfo1(Integer id) {
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java
index 2fe5930..5299faa 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java
@@ -7,6 +7,7 @@
 import com.ruoyi.common.core.constant.ServiceNameConstants;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.other.api.domain.TCompany;
+import com.ruoyi.other.api.domain.TCoupon;
 import com.ruoyi.other.api.domain.TUserTag;
 import com.ruoyi.other.api.factory.OtherFallbackFactory;
 import org.springframework.cloud.openfeign.FeignClient;
@@ -64,6 +65,10 @@
     R<List<CouponListVOVO>> getCouponInfoByCouponIds(@RequestBody List<CouponListVOVO> list);
 
 
+    @PostMapping(value = "/t-coupon/getCouponById")
+    R<TCoupon> getCouponById(@RequestParam Integer id);
+
+
 
 
 
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipClient.java
index 763a217..b2ca8d3 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipClient.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipClient.java
@@ -2,6 +2,7 @@
 
 import com.ruoyi.common.core.constant.ServiceNameConstants;
 import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.other.api.domain.TVip;
 import com.ruoyi.other.api.factory.VipFallbackFactory;
 import org.springframework.cloud.openfeign.FeignClient;
@@ -31,4 +32,8 @@
      */
     @PostMapping("/vip/getInfo1")
     public R<TVip> getInfo1(@RequestParam("id") Integer id);
+    @PostMapping(value = "/vip/getInfo")
+    R<TVip> getInfo(@RequestParam("id") Integer id);
+
+
 }
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java
index 0e8ad72..2bf740b 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java
@@ -12,23 +12,24 @@
 import com.ruoyi.account.api.vo.ExchangeRecordVO;
 import com.ruoyi.account.service.TAppCouponService;
 import com.ruoyi.account.service.TAppUserCarService;
+import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient;
+import com.ruoyi.chargingPile.api.vo.SiteInfoVO;
 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.security.service.TokenService;
+import com.ruoyi.order.api.feignClient.ChargingOrderClient;
 import com.ruoyi.other.api.domain.TCoupon;
 import com.ruoyi.other.api.feignClient.OtherClient;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -49,6 +50,40 @@
     private TAppUserCarService appUserCarService;
     @Autowired
     private TokenService tokenService;
+    @Autowired
+    private ChargingPileClient chargingPileClient;
+    @Autowired
+    private ChargingOrderClient chargingOrderClient;
+    /**
+     * 查询用户可用优惠券数量
+     * @return
+     */
+    @ApiOperation(value = "通过桩编号获取电站详情", tags = {"小程序-扫一扫"})
+    @GetMapping(value = "/scan/siteInfo")
+    public AjaxResult<SiteInfoVO> siteInfo(String number) {
+        SiteInfoVO data = chargingPileClient.getSiteInfoByNumber(number).getData();
+        List<TAppUserCar> cars = appUserCarService.list(new QueryWrapper<TAppUserCar>()
+                .eq("app_user_id",tokenService.getLoginUserApplet().getUserId())
+                .orderByDesc("create_time"));
+        Long data1 = chargingOrderClient.getCar().getData();
+        if (!cars.isEmpty()){
+            if (data1 == -1){
+                // 没有充电订单 展示最新添加的车辆
+                data.setLicensePlate(cars.get(0).getLicensePlate());
+                data.setVehicleBrand(cars.get(0).getVehicleBrand());
+                data.setId(cars.get(0).getId());
+            }else{
+                for (TAppUserCar car : cars) {
+                    if (car.getId().equals(data1)){
+                        data.setLicensePlate(car.getLicensePlate());
+                        data.setVehicleBrand(car.getVehicleBrand());
+                        data.setId(car.getId());
+                    }
+                }
+            }
+        }
+        return AjaxResult.ok(data);
+    }
     /**
      * 查询用户可用优惠券数量
      * @param dto
@@ -61,16 +96,15 @@
         return AjaxResult.ok(res);
     }
     /**
-     * 选择车辆列表
+     * 选择车辆列表 远程调用
      * @return
      */
     @ApiOperation(value = "选择车辆列表", tags = {"小程序-扫一扫"})
     @PostMapping(value = "/scan/carList")
-    public AjaxResult<List<TAppUserCar>> carList() {
-        // todo 用户id
+    public R<List<TAppUserCar>> carList() {
         List<TAppUserCar> appUserId = appUserCarService.list(new QueryWrapper<TAppUserCar>()
-                .eq("app_user_id",tokenService.getLoginUserApplet().getUserId() ));
-        return AjaxResult.ok(appUserId);
+                .eq("app_user_id",tokenService.getLoginUserApplet().getUserId()));
+        return R.ok(appUserId);
     }
 
     /**
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
index 217799e..bff645a 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -1,6 +1,7 @@
 package com.ruoyi.account.controller;
 
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
@@ -14,6 +15,7 @@
 import com.ruoyi.account.wx.body.resq.Code2SessionResqBody;
 import com.ruoyi.account.wx.model.WeixinProperties;
 import com.ruoyi.account.wx.tools.WxAppletTools;
+import com.ruoyi.account.util.GiveVipUtil;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.bean.BeanUtils;
 import com.ruoyi.common.core.web.domain.AjaxResult;
@@ -27,6 +29,7 @@
 import com.ruoyi.order.api.model.TChargingOrder;
 import com.ruoyi.order.api.model.TExchangeOrder;
 import com.ruoyi.other.api.domain.TCompany;
+import com.ruoyi.other.api.domain.TCoupon;
 import com.ruoyi.other.api.domain.TUserTag;
 import com.ruoyi.other.api.feignClient.OtherClient;
 import com.ruoyi.system.api.domain.SysRole;
@@ -34,13 +37,16 @@
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import org.apache.poi.ss.formula.functions.T;
 import lombok.extern.slf4j.Slf4j;
+import org.aspectj.weaver.loadtime.Aj;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
 import java.time.Duration;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -78,12 +84,70 @@
 
     @Resource
     private ExchangeOrderClient exchangeOrderClient;
+    @Autowired
+    private TokenService tokenService;
+    @Autowired
+    private RedisService redisService;
+    @Autowired
+    private WeixinProperties wxConfig;
+    @Autowired
+    private RestTemplate wxRestTemplate;
+
+    @Resource
+    private  TAppUserSignService signService;
+    @Resource
+    private TAppCouponService appCouponService;
+    @Resource
+    private TAppUserCarService carService;
+
+
+    @ApiOperation(value = "查询当前用户是否为会员 0否1是", tags = {"小程序--查询当前用户是否为会员"})
+    @PostMapping(value = "/getUserInfo")
+    public AjaxResult<Integer> getUserInfo() {
+        TAppUser byId = appUserService.getById(tokenService.getLoginUserApplet().getUserId());
+        if (byId.getVipEndTime() == null){
+            return AjaxResult.ok(0);
+        }else if (byId.getVipEndTime().isAfter(LocalDateTime.now())){
+            return AjaxResult.ok(1);
+        }else{
+            return AjaxResult.ok(0);
+        }
+    }
+    @ApiOperation(value = "通过code获得openid,  1 --->对应的appid:wx4c405fa42539fc21  2---->对应的appid:wx02d9f6c92e6d3c86")
+    @GetMapping("openId-by-jscode2session/{code}")
+    public AjaxResult<Map<String, Object>> jscode2session(@PathVariable String code) {
+        log.info("<<<<<<<<换取openid开始<<<<<<<<:{}", code);
+        WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig);
+        Code2SessionRespBody body = appletTools.getOpenIdByJscode2session(new Code2SessionResqBody().build(code));
+        String openid = body.getOpenid();
+        String sessionKey = body.getSessionKey();
+        TAppUser appUser = appUserService.getOne(Wrappers.lambdaQuery(TAppUser.class).eq(TAppUser::getWxOpenid, openid).last("limit 1"));
+        if (Objects.isNull(appUser)) {
+            appUser = new TAppUser();
+            appUser.setWxOpenid(openid);
+            appUserService.save(appUser);
+        }
+        // 提前对sessionKey进行删除
+        log.info("换取sessionKey:{}", sessionKey);
+        // 将sessionKey进行存储,后续获取信息需要
+        redisService.setCacheObject(openid, sessionKey);
+        LoginUserApplet loginUserApplet = new LoginUserApplet();
+        if(ObjectUtils.isNotNull(appUser)){
+            loginUserApplet.setUserId(appUser.getId());
+        }
+        HashMap<String, Object> tokenInfos = new HashMap<>();
+        tokenInfos.put("token",tokenService.createTokenApplet(loginUserApplet));
+        tokenInfos.put("info",loginUserApplet);
+        return AjaxResult.ok(tokenInfos);
+    }
 
     @ApiOperation(value = "管理后台-根据手机号查询用户ids", tags = {"管理后台-活动费用统计"})
     @PostMapping(value = "/user/getUserIdsByPhone")
     public R<List<Long>> getUserIdsByPhone(@RequestParam("phone") String phone) {
         return R.ok(appUserService.list(new QueryWrapper<TAppUser>().like("phone",phone)).stream().map(TAppUser::getId).collect(Collectors.toList()));
     }
+    @Resource
+    private GiveVipUtil giveVipUtil;
     @ApiOperation(value = "单位管理列表", tags = {"用户管理-单位管理"})
     @PostMapping(value = "/unit/page")
     public R<Page<TCompany>> unitPage(@RequestBody UnitListQueryDto unitListQueryDto) {
@@ -96,6 +160,20 @@
         }
         return R.ok(data);
     }
+
+
+    @ApiOperation(value = "单位下拉框", tags = {"用户管理-单位管理"})
+    @PostMapping(value = "/unit/select")
+    public R<List<TCompany>> unitSelect() {
+        UnitListQueryDto unitListQueryDto = new UnitListQueryDto();
+        unitListQueryDto.setPageCurr(1);
+        unitListQueryDto.setPageSize(9999);
+        //拿到单位列表
+        R<Page<TCompany>> pageR = otherClient.queryUnitPage(unitListQueryDto);
+
+        return R.ok(pageR.getData().getRecords());
+    }
+
 
     @ApiOperation(value = "单位管理添加或编辑", tags = {"用户管理-单位管理"})
     @PostMapping(value = "/unit/addOrUpdate")
@@ -267,7 +345,7 @@
         return R.ok(userDetailDto);
     }
 
-    @ApiOperation(value = "用户详情积分明细", tags = {"用户管理-用户列表"})
+    @ApiOperation(value = "用户详情积分明细", tags = {"后台-用户管理-用户列表","小程序-个人中心"})
     @PostMapping(value = "/user/points/page")
     public R<Page<TAppUserIntegralChange>> pointsDetail(@RequestBody PointsQueryDto pointsQueryDto) {
         List<Integer> types = new ArrayList<>();
@@ -303,7 +381,7 @@
 
     }
 
-    @ApiOperation(value = "用户详情积分明细", tags = {"用户管理-用户列表"})
+    @ApiOperation(value = "冻结解冻用户", tags = {"后台-用户管理-用户列表"})
     @PostMapping(value = "/user/status/change")
     public R pointsDetail(@RequestBody UserChangeDto userChangeDto) {
         TAppUser appUser = appUserService.getById(userChangeDto.getUserId());
@@ -312,37 +390,76 @@
         return R.ok();
     }
 
+    @ApiOperation(value = "个人中心信息", tags = {"小程序-个人中心"})
+    @PostMapping(value = "/user/info")
+    public R<AppUserInfoDto> info() {
+        Long userId = 1L;
+        TAppUser byId = appUserService.getById(userId);
+        AppUserInfoDto appUserInfoDto = new AppUserInfoDto();
+
+        //判断会员
+        if (byId.getVipEndTime()==null||byId.getVipEndTime().isBefore(LocalDateTime.now())){
+            appUserInfoDto.setIsVip(0);
+        }else {
+            appUserInfoDto.setIsVip(1);
+            appUserInfoDto.setVipExpireTime(byId.getVipEndTime());
+        }
+        //判断当天是否签到
+        Long count = signService.lambdaQuery().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();
+        appUserInfoDto.setCouponNum(Math.toIntExact(coupons));
+        //当前绑定的车辆
+        List<TAppUserCar> list = carService.lambdaQuery().eq(TAppUserCar::getAppUserId, userId).list();
+        appUserInfoDto.setUserCars(list);
+        return R.ok(appUserInfoDto);
+
+
+    }
+
+    @ApiOperation(value = "优惠卷列表不分页(1可使用2不可用)", tags = {"小程序-个人中心"})
+    @PostMapping(value = "/user/coupon")
+    public R<List<InfoCouponDto>> userCoupon(@RequestParam("type") Integer type) {
+        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) {
+            TCoupon coupon = JSON.toJavaObject(JSON.parseObject(tAppCoupon.getCouponJson()), TCoupon.class);
+            InfoCouponDto infoCouponDto = new InfoCouponDto();
+            BeanUtils.copyProperties(coupon,infoCouponDto);
+            couponDtos.add(infoCouponDto);
+
+        }
+
+
+        return R.ok(couponDtos);
+
+
+    }
+
+
 
     @ApiOperation(value = "赠送会员", tags = {"用户管理-用户列表"})
     @PostMapping(value = "/user/give/vip")
     public R giveVip(@RequestBody GiveVipDto  giveVipDto) {
         TAppUser nowUser = appUserService.getById(giveVipDto.getUserId());
 
-
-        //如果vipEndTime为空或已过期,直接增加
-        if (nowUser.getVipEndTime()==null||nowUser.getVipEndTime().isBefore(LocalDateTime.now())) {
-            if (giveVipDto.getType() == 1) {
-                nowUser.setVipEndTime(LocalDateTime.now().plusDays(31));
-                //直接增加vipDetail
-            } else if (giveVipDto.getType() == 2) {
-                nowUser.setVipEndTime(LocalDateTime.now().plusDays(93));
-            } else if (giveVipDto.getType() == 3) {
-                nowUser.setVipEndTime(LocalDateTime.now().plusDays(365));
-            }
-            //直接赠送优惠卷
-        }else {
-            if (giveVipDto.getType() == 1) {
-                nowUser.setVipEndTime(nowUser.getVipEndTime().plusDays(31));
-                //如果有这个类型的vip,累加,没有的话,从entTime新增
-            } else if (giveVipDto.getType() == 2) {
-                nowUser.setVipEndTime(nowUser.getVipEndTime().plusDays(93));
-            } else if (giveVipDto.getType() == 3) {
-                nowUser.setVipEndTime(nowUser.getVipEndTime().plusDays(365));
-            }
+        int plusDay = 0;
+        if (giveVipDto.getType() == 1) {
+            plusDay = 1;
+        } else if (giveVipDto.getType() == 2) {
+            plusDay = 3;
+        } else if (giveVipDto.getType() == 3) {
+            plusDay = 12;
         }
+        //增加vipDetail
+        giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay);
 
 
-
+        appUserService.updateById(nowUser);
+        //执行一次赠送优惠卷的定时任务
 
         return R.ok();
     }
@@ -357,7 +474,7 @@
         return R.ok(appUserService.list(Wrappers.<TAppUser>lambdaQuery().in(TAppUser::getId,appUserIds)));
     }
 
-    
+
     /**
      * 根据用户id获取用户
      * @param id
@@ -368,8 +485,8 @@
         TAppUser appUser = appUserService.getById(id);
         return R.ok(appUser);
     }
-    
-    
+
+
     /**
      * 修改用户信息
      * @param appUser
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/TAppUserVipDetailService.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/TAppUserVipDetailService.java
index 8e90bd7..4dff539 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/TAppUserVipDetailService.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/TAppUserVipDetailService.java
@@ -13,4 +13,5 @@
  */
 public interface TAppUserVipDetailService extends IService<TAppUserVipDetail> {
 
+    void giveVipCoupun(Long appUserId, Integer vipId,Long recordId,Integer monthNum);
 }
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java
index a499a52..34f0530 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java
@@ -241,8 +241,8 @@
                     break;
             }
         }
-        // 通过集合的money字段 将money从大到小排序
-        data.sort(Comparator.comparing(CouponListVOVO::getMoney).reversed());
+        // 通过集合的money、isUse字段 将money、isUse从大到小排序 将不可用的排在最后
+        data.sort(Comparator.comparing(CouponListVOVO::getMoney).reversed().thenComparing(CouponListVOVO::getIsUse));
         pageInfo.setRecords(data);
         return pageInfo;
     }
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java
index 50674ce..1894f70 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java
@@ -1,11 +1,27 @@
 package com.ruoyi.account.service.impl;
 
+import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.api.dto.SendCouponDto;
+import com.ruoyi.account.api.feignClient.AppCouponClient;
+import com.ruoyi.account.api.model.TAppCoupon;
 import com.ruoyi.account.api.model.TAppUserVipDetail;
 import com.ruoyi.account.mapper.TAppUserVipDetailMapper;
 
+import com.ruoyi.account.service.TAppCouponService;
 import com.ruoyi.account.service.TAppUserVipDetailService;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.other.api.domain.TCoupon;
+import com.ruoyi.other.api.domain.TVip;
+import com.ruoyi.other.api.feignClient.OtherClient;
+import com.ruoyi.other.api.feignClient.VipClient;
 import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.List;
 
 /**
  * <p>
@@ -17,5 +33,49 @@
  */
 @Service
 public class TAppUserVipDetailServiceImpl extends ServiceImpl<TAppUserVipDetailMapper, TAppUserVipDetail> implements TAppUserVipDetailService {
+    @Resource
+    private VipClient vipClient;
+    @Resource
+    private OtherClient otherClient;
+    @Resource
+    private TAppCouponService appCouponService;
+    @Resource
+    private TAppUserVipDetailService tAppUserVipDetailService;
+
+
+
+    @Override
+    public void giveVipCoupun(Long appUserId, Integer vipId,Long recordId,Integer monthNum) {
+        //如果不包含,则更新sendNum,并且赠送优惠卷
+        TAppUserVipDetail byId = tAppUserVipDetailService.getById(recordId);
+        if (byId.getStartTime().plusMonths(byId.getSendMonth()).toLocalDate().compareTo(LocalDate.now())==0&&LocalDate.now().isBefore(byId.getEndTime().toLocalDate())){
+            byId.setSendMonth(byId.getSendMonth()+1);
+        //给这个用户发放对应vip的优惠卷以及充电次数加满
+            List<SendCouponDto> javaList = JSON.parseArray(byId.getCouponIds()).toJavaList(SendCouponDto.class);
+            for (SendCouponDto sendCouponDto : javaList) {
+                Integer number = sendCouponDto.getNumber();
+                for (Integer i = 0; i < number; i++) {
+                    R<TCoupon> couponById = otherClient.getCouponById(sendCouponDto.getId());
+                    TCoupon coupon = couponById.getData();
+                    //将该优惠卷添加到用户优惠卷中
+                    TAppCoupon tAppCoupon = new TAppCoupon();
+                    tAppCoupon.setAppUserId(appUserId);
+                    tAppCoupon.setCouponId(sendCouponDto.getId());
+                    if (coupon.getValidityPeriodMode() == 1) {
+                        tAppCoupon.setEndTime(coupon.getEndTime());
+                    } else {
+                        tAppCoupon.setEndTime(LocalDateTime.now().plusDays(coupon.getDays()));
+                    }
+                    tAppCoupon.setWaysToObtain(4);
+                    tAppCoupon.setStatus(1);
+                    tAppCoupon.setCouponJson(JSON.toJSONString(coupon));
+                    appCouponService.save(tAppCoupon);
+                }
+                }
+
+            }
+        byId.setChargeNum(byId.getSendChargeNum());
+        tAppUserVipDetailService.updateById(byId);
+        }
 
 }
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/task/TaskUtil.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/task/TaskUtil.java
new file mode 100644
index 0000000..0bdf907
--- /dev/null
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/task/TaskUtil.java
@@ -0,0 +1,54 @@
+package com.ruoyi.account.task;
+
+
+import com.ruoyi.account.api.model.TAppUserVipDetail;
+import com.ruoyi.account.service.TAppUserVipDetailService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.util.List;
+
+
+/**
+ * 定时任务工具类
+ */
+@Component
+public class TaskUtil {
+
+    @Resource
+    private TAppUserVipDetailService tAppUserVipDetailService;
+
+
+
+    /**
+     * 每隔一分钟去处理的定时任务
+     */
+    @Scheduled(fixedRate = 1000 * 60)
+    public void sendVipCoupon(){
+        try {
+            //首先获取当前的月份,用int类型标识
+            LocalDate currentDate = LocalDate.now();
+            int monthNum = currentDate.getMonthValue();
+            //获取在当前时间内生效的vipDetail
+            List<TAppUserVipDetail> recentDetails = tAppUserVipDetailService.lambdaQuery()
+                    .ge(TAppUserVipDetail::getStartTime, currentDate)
+                    .le(TAppUserVipDetail::getEndTime, currentDate)
+                    .orderByDesc(TAppUserVipDetail::getStartTime).list();
+            //判断sendNum是否包括当前月份
+            for (TAppUserVipDetail recentDetail : recentDetails) {
+
+                    //赠送优惠卷
+                    tAppUserVipDetailService.giveVipCoupun(recentDetail.getAppUserId(), recentDetail.getVipId(),recentDetail.getId(),monthNum);
+
+
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+}
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/GiveVipUtil.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/GiveVipUtil.java
new file mode 100644
index 0000000..b477141
--- /dev/null
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/GiveVipUtil.java
@@ -0,0 +1,96 @@
+package com.ruoyi.account.util;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONArray;
+import com.ruoyi.account.api.dto.SendCouponDto;
+import com.ruoyi.account.api.model.TAppCoupon;
+import com.ruoyi.account.api.model.TAppUser;
+import com.ruoyi.account.api.model.TAppUserVipDetail;
+import com.ruoyi.account.service.TAppCouponService;
+import com.ruoyi.account.service.TAppUserVipDetailService;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.other.api.domain.TCoupon;
+import com.ruoyi.other.api.domain.TVip;
+import com.ruoyi.other.api.feignClient.OtherClient;
+import com.ruoyi.other.api.feignClient.VipClient;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Component
+public class GiveVipUtil {
+
+    @Resource
+    private VipClient vipClient;
+    @Resource
+    private TAppUserVipDetailService tAppUserVipDetailService;
+    @Resource
+    private OtherClient otherClient;
+    @Resource
+    private TAppCouponService appCouponService;
+    public void sendVip(TAppUser nowUser,Integer vipId,Integer plusDay){
+        if (nowUser.getVipEndTime()==null||nowUser.getVipEndTime().isBefore(LocalDateTime.now())) {
+     
+            nowUser.setVipEndTime(LocalDateTime.now().plusMonths(plusDay));
+
+            //直接再detail里新增数据,因为不是续费
+            TAppUserVipDetail tAppUserVipDetail = new TAppUserVipDetail();
+            tAppUserVipDetail.setAppUserId(nowUser.getId());
+            tAppUserVipDetail.setStartTime(LocalDateTime.now());
+            tAppUserVipDetail.setEndTime(LocalDateTime.now().plusMonths(plusDay).minusDays(1));
+            tAppUserVipDetail.setVipId(vipId);
+
+            R<TVip> info = vipClient.getInfo(vipId);
+            TVip vip = info.getData();
+            List<SendCouponDto> javaList = JSON.parseArray(vip.getCoupon()).toJavaList(SendCouponDto.class);
+
+            tAppUserVipDetail.setCouponIds(vip.getCoupon());
+            tAppUserVipDetail.setSendChargeNum(vip.getDiscountTimes());
+            tAppUserVipDetail.setChargeNum(vip.getDiscountTimes());
+            tAppUserVipDetail.setDiscountMoney(vip.getMaximumDeduction());
+            tAppUserVipDetail.setSendMonth(1);
+            tAppUserVipDetailService.save(tAppUserVipDetail);
+            //直接赠送优惠卷
+            for (SendCouponDto sendCouponDto : javaList) {
+                Integer number = sendCouponDto.getNumber();
+                for (Integer i = 0; i < number; i++) {
+
+
+                R<TCoupon> couponById = otherClient.getCouponById(sendCouponDto.getId());
+                TCoupon coupon = couponById.getData();
+                //将该优惠卷添加到用户优惠卷中
+                TAppCoupon tAppCoupon = new TAppCoupon();
+                tAppCoupon.setAppUserId(nowUser.getId());
+                tAppCoupon.setCouponId(Integer.valueOf(sendCouponDto.getId()));
+                if (coupon.getValidityPeriodMode() == 1) {
+                    tAppCoupon.setEndTime(coupon.getEndTime());
+                } else {
+                    tAppCoupon.setEndTime(LocalDateTime.now().plusDays(coupon.getDays()));
+                }
+                tAppCoupon.setWaysToObtain(4);
+                tAppCoupon.setStatus(1);
+                tAppCoupon.setCouponJson(JSON.toJSONString(coupon));
+                appCouponService.save(tAppCoupon);
+                }
+            }
+
+
+        }else {
+            nowUser.setVipEndTime(nowUser.getVipEndTime().plusDays(plusDay));
+            //获取detail里结束时间大于当前时间的数据,并将enttime延长
+            TAppUserVipDetail tAppUserVipDetail = tAppUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, nowUser.getId()).orderByDesc(TAppUserVipDetail::getEndTime).last("limit 1").one();
+
+//            TAppUserVipDetail newAppUser = new TAppUserVipDetail();
+//            newAppUser.setAppUserId(nowUser.getId());
+//            newAppUser.setStartTime(tAppUserVipDetail.getEndTime());
+            tAppUserVipDetail.setEndTime(tAppUserVipDetail.getEndTime().plusMonths(plusDay).minusDays(1));
+//            newAppUser.setVipId(vipId);
+            tAppUserVipDetailService.updateById(tAppUserVipDetail);
+//                tAppUserVipDetail.setEndTime(tAppUserVipDetail.getEndTime().plusDays(plusDay));
+//                tAppUserVipDetailService.updateById(tAppUserVipDetail);
+        }
+
+    }
+}
diff --git a/ruoyi-service/ruoyi-chargingPile/pom.xml b/ruoyi-service/ruoyi-chargingPile/pom.xml
index 87b9b86..63d7f4a 100644
--- a/ruoyi-service/ruoyi-chargingPile/pom.xml
+++ b/ruoyi-service/ruoyi-chargingPile/pom.xml
@@ -15,7 +15,12 @@
     </description>
 
     <dependencies>
-
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>ruoyi-api-account</artifactId>
+            <version>3.6.2</version>
+            <scope>compile</scope>
+        </dependency>
         <!-- ruoyi-modules-chargingPile-api -->
         <dependency>
             <groupId>com.ruoyi</groupId>
diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java
index 41a7db3..8ddb212 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java
+++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java
@@ -5,17 +5,11 @@
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.ruoyi.chargingPile.api.dto.GetSiteListDTO;
 import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient;
-import com.ruoyi.chargingPile.api.model.Site;
-import com.ruoyi.chargingPile.api.model.TChargingGun;
-import com.ruoyi.chargingPile.api.model.TChargingPile;
-import com.ruoyi.chargingPile.api.model.TParkingLot;
+import com.ruoyi.chargingPile.api.model.*;
 import com.ruoyi.chargingPile.api.query.GetSiteList;
 import com.ruoyi.chargingPile.api.query.SiteDetailQuery;
 import com.ruoyi.chargingPile.api.query.SiteQuery;
-import com.ruoyi.chargingPile.api.vo.ChargingGunCountVO;
-import com.ruoyi.chargingPile.api.vo.SiteDetailVO;
-import com.ruoyi.chargingPile.api.vo.SiteVO;
-import com.ruoyi.chargingPile.api.vo.TChargingPileVO;
+import com.ruoyi.chargingPile.api.vo.*;
 import com.ruoyi.chargingPile.domain.SiteMenu;
 import com.ruoyi.chargingPile.service.*;
 import com.ruoyi.common.core.domain.R;
@@ -36,6 +30,8 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.time.LocalTime;
 import java.util.*;
 
 /**
@@ -69,18 +65,44 @@
 
 	@Autowired
 	private TParkingLotService parkingLotService;
+	@Autowired
+	private TAccountingStrategyService accountingStrategyService;
+	@Autowired
+	private TAccountingStrategyDetailService accountingStrategyDetailService;
 
+
+	/**
+	 * 小程序扫一扫
+	 * @param number
+	 * @return
+	 */
+	@PostMapping("/getSiteInfoByNumber")
+	@ApiOperation(value = "扫一扫后通过桩编号获取电站信息", tags = {"小程序-扫一扫"})
+	public R<SiteInfoVO> getSiteInfoByNumber(@RequestParam("number") String number){
+		SiteInfoVO siteInfoVO = new SiteInfoVO();
+		TChargingPile one = chargingPileService.lambdaQuery().eq(TChargingPile::getNumber, number).one();
+		Site byId = siteService.getById(one.getSiteId());
+		TAccountingStrategy byId1 = accountingStrategyService.getById(byId.getAccountingStrategyId());
+		List<TAccountingStrategyDetail> list = accountingStrategyDetailService.lambdaQuery().eq(TAccountingStrategyDetail::getAccountingStrategyId, byId1.getId()).list();
+		for (TAccountingStrategyDetail tAccountingStrategyDetail : list) {
+			// 当前时间属于那个阶段 取哪个阶段的电价
+			if(LocalTime.now().isAfter(LocalTime.parse(tAccountingStrategyDetail.getStartTime())) && LocalTime.now().isBefore(LocalTime.parse(tAccountingStrategyDetail.getEndTime()))){
+				siteInfoVO.setElectrovalence(tAccountingStrategyDetail.getElectrovalence());
+				siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().multiply(byId1.getDiscount()).setScale(2, BigDecimal.ROUND_HALF_UP));
+			}
+		}
+		siteInfoVO.setName(byId.getName());
+		siteInfoVO.setNumber(one.getNumber().toString());
+		siteInfoVO.setSpaceChargeExplain(byId.getSpaceChargeExplain());
+		return R.ok(siteInfoVO);
+	}
 	
-	
-	
-	@ResponseBody
 	@GetMapping("/getSiteList")
 	@ApiOperation(value = "获取站点列表", tags = {"管理后台-站点管理"})
 	public AjaxResult<PageInfo<GetSiteListDTO>> getSiteList(GetSiteList siteList){
 		PageInfo<GetSiteListDTO> list = siteService.getSiteList(siteList);
 		return AjaxResult.success(list);
 	}
-	@ResponseBody
 	@GetMapping("/getSiteList1")
 	@ApiOperation(value = "获取站点列表 不分页", tags = {"管理后台-活动费用统计"})
 	public AjaxResult<List<Site>> getSiteList1(){
diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java
index d7f4f4c..53fee20 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java
+++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java
@@ -179,8 +179,6 @@
             }
 
         }
-
-
         return AjaxResult.ok(accountingStrategyService.pageList(query));
     }
 
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
index b2dffa9..af5cec4 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -44,7 +44,7 @@
      * @param
      * @return
      */
-    @PostMapping(value = "/getCar")
+    @GetMapping(value = "/getCar")
     public R<Long> getCar() {
         List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>()
                 .eq(TChargingOrder::getAppUserId, tokenService.getLoginUserApplet().getUserId())
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java
index f36cca6..3e4f054 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java
@@ -117,6 +117,11 @@
         return AjaxResult.ok(tCouponService.pageList(dto));
     }
 
+    @PostMapping(value = "/getCouponById")
+    public R<TCoupon> getCouponById(@RequestParam Integer id) {
+        return R.ok(tCouponService.getById(id));
+
+    }
     /**
      * 小程序远程调用 获取优惠券信息
      */
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/THtmlController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/THtmlController.java
index 1739f4d..46b995a 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/THtmlController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/THtmlController.java
@@ -1,9 +1,14 @@
 package com.ruoyi.other.controller;
 
 
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.other.api.domain.THtml;
+import com.ruoyi.other.api.domain.TNotice;
+import com.ruoyi.other.service.THtmlService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
 
-import org.springframework.web.bind.annotation.RestController;
+import javax.annotation.Resource;
 
 /**
  * <p>
@@ -16,6 +21,21 @@
 @RestController
 @RequestMapping("/t-html")
 public class THtmlController {
+    @Resource
+    private THtmlService htmlService;
+    @ApiOperation(tags = {"后台-内容设置-协议服务"},value = "新增修改")
+    @PostMapping(value = "/saveOrUpdate")
+    public AjaxResult saveOrUpdate(@RequestBody THtml tHtml) {
+        htmlService.saveOrUpdate(tHtml);
+    return AjaxResult.success();
+    }
+
+    @ApiOperation(tags = {"后台-内容设置-协议服务"},value = "查询")
+    @PostMapping(value = "/selectByType/{type}")
+    public AjaxResult selectByType(@PathVariable Integer type) {
+        THtml one = htmlService.lambdaQuery().eq(THtml::getType, type).last("limit 1").one();
+        return AjaxResult.success(one);
+    }
 
 }
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java
index bfda7a8..b19e461 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java
@@ -62,6 +62,9 @@
             "11=开票说明")
     public R<String> getInfo(Integer type) {
         THtml g = htmlService.getOne(new QueryWrapper<THtml>().eq("type",type));
+        if (g == null){
+            return R.ok("");
+        }
         return R.ok(g.getContent());
     }
     @GetMapping("/saveInfo")
@@ -87,9 +90,6 @@
             THtml tHtml = new THtml();
             tHtml.setType(type);
             tHtml.setContent(info);
-
-
-            tHtml.setCreateTime(LocalDateTime.now());
             htmlService.save(tHtml);
         }else{
             g.setContent(info);
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java
index ee4dcb9..06838a6 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java
@@ -1,9 +1,17 @@
 package com.ruoyi.other.controller;
 
 
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.other.api.domain.TNotice;
+import com.ruoyi.other.api.dto.NoticeQueryDto;
+import com.ruoyi.other.mapper.SysNoticeMapper;
+import com.ruoyi.other.service.TNoticeService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
 
-import org.springframework.web.bind.annotation.RestController;
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
 
 /**
  * <p>
@@ -16,6 +24,49 @@
 @RestController
 @RequestMapping("/t-notice")
 public class TNoticeController {
+    @Resource
+    private TNoticeService noticeService;
+
+    @ApiOperation(tags = {"后台-内容设置-公告管理"},value = "新增修改")
+    @PostMapping(value = "/saveOrUpdate")
+    public AjaxResult saveOrUpdate(@RequestBody TNotice notice) {
+        noticeService.saveOrUpdate(notice);
+        return AjaxResult.success();
+    }
+
+    @ApiOperation(tags = {"后台-内容设置-公告管理"},value = "删除")
+    @PostMapping(value = "/deleteById/{id}")
+    public AjaxResult deleteById(@PathVariable Integer id) {
+        noticeService.removeById(id);
+        return AjaxResult.success();
+    }
+
+    @ApiOperation(tags = {"后台-内容设置-公告管理"},value = "查询")
+    @PostMapping(value = "/pageList")
+    public AjaxResult<Page<TNotice>> authPageList(@RequestBody NoticeQueryDto query) {
+            if (query.getStatus()==0){
+                return AjaxResult.success(noticeService.lambdaQuery()
+                        .le(TNotice::getStartTime, LocalDateTime.now())
+                        .like(query.getContent()!=null&&query.getContent()!="",TNotice::getContent,query.getContent())
+                        .page(Page.of(query.getPageCurr(),query.getPageSize())));
+            }else if (query.getStatus()==1){
+                return AjaxResult.success(noticeService.lambdaQuery()
+                        .ge(TNotice::getStartTime, LocalDateTime.now()).le(TNotice::getEndTime,LocalDateTime.now())
+                        .like(query.getContent()!=null&&query.getContent()!="",TNotice::getContent,query.getContent())
+                        .page(Page.of(query.getPageCurr(),query.getPageSize())));
+            }else if (query.getStatus()==2){
+                return AjaxResult.success(noticeService.lambdaQuery()
+                        .ge(TNotice::getEndTime, LocalDateTime.now())
+                        .like(query.getContent()!=null&&query.getContent()!="",TNotice::getContent,query.getContent())
+                        .page(Page.of(query.getPageCurr(),query.getPageSize())));
+            }else{
+                return AjaxResult.success(noticeService.lambdaQuery()
+                        .like(query.getContent()!=null&&query.getContent()!="",TNotice::getContent,query.getContent())
+                        .page(Page.of(query.getPageCurr(),query.getPageSize())));
+        }
+
+
+    }
 
 }
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TSystemConfigurationController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TSystemConfigurationController.java
index a78e805..f63f4a5 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TSystemConfigurationController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TSystemConfigurationController.java
@@ -8,11 +8,7 @@
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * <p>
@@ -36,12 +32,19 @@
     /**
      * 查看系统设置
      */
-    @ApiOperation(tags = {"小程序-系统设置"},value = "联系客服")
+    @ApiOperation(tags = {"小程序-系统设置","后台-内容设置"},value = "联系客服,查询设置")
     @GetMapping(value = "/getDetailById")
     public AjaxResult<TSystemConfiguration> getDetailById(@RequestParam(name = "type")@ApiParam(value = "1=客服信息,2=系统设置") Integer type) {
         return AjaxResult.ok(systemConfigurationService.getOne(Wrappers.lambdaQuery(TSystemConfiguration.class)
                 .eq(TSystemConfiguration::getType, type)));
     }
 
+    @ApiOperation(tags = {"后台-内容设置"},value = "客户信息,系统内容设置")
+    @GetMapping(value = "/save")
+    public AjaxResult getDetailById(@RequestBody TSystemConfiguration systemConfiguration) {
+        systemConfigurationService.saveOrUpdate(systemConfiguration);
+        return AjaxResult.success();
+    }
+
 }
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java
index 97f0451..ee13993 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java
@@ -1,13 +1,19 @@
 package com.ruoyi.other.controller;
 
 
+import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ruoyi.account.api.dto.SendCouponDto;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.page.PageInfo;
+import com.ruoyi.other.api.domain.TCoupon;
 import com.ruoyi.other.api.domain.TIntegralRule;
 import com.ruoyi.other.api.domain.TUserTag;
 import com.ruoyi.other.api.domain.TVip;
+import com.ruoyi.other.api.dto.VipCouponDto;
+import com.ruoyi.other.api.dto.VipInfoDto;
+import com.ruoyi.other.service.TCouponService;
 import com.ruoyi.other.service.TVipService;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -16,6 +22,9 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -33,6 +42,8 @@
 public class TVipController {
     @Autowired
     private TVipService vipService;
+    @Resource
+    private TCouponService couponService;
     @PostMapping("/saveVip")
     @ApiOperation(tags = {"管理后台-会员管理"},value = "会员添加")
     public AjaxResult saveVip(@RequestBody TVip dto) {
@@ -55,6 +66,13 @@
     @ApiOperation(tags = {"管理后台-会员管理"},value = "会员查看详情")
     public AjaxResult<TVip> getInfo(Integer id) {
         return AjaxResult.ok(vipService.getById(id));
+    }
+
+
+    @GetMapping("/getById")
+    @ApiOperation(value = "通过id查会员")
+    public R<TVip> getById(Integer id) {
+        return R.ok(vipService.getById(id));
     }
 
     /**
@@ -115,5 +133,47 @@
         }
     }
 
+
+    @ApiOperation(value = "会员信息", tags = {"小程序-个人中心"})
+    @PostMapping("/vipInfo")
+    public AjaxResult vipInfo() {
+        List<VipInfoDto> vipInfoDtos = new ArrayList<>();
+        List<TVip> vips = vipService.lambdaQuery().eq(TVip::getReveal, 1).list();
+        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);
+            vipInfoDto.setMaximumDeduction(vip.getMaximumDeduction());
+            vipInfoDto.setDiscountTimes(vip.getDiscountTimes());
+            vipInfoDto.setDoubleIntegration(vip.getDoubleIntegration());
+            vipInfoDto.setMallExclusivePrice(vip.getMallExclusivePrice());
+            List<SendCouponDto> javaList = JSON.parseArray(vip.getCoupon()).toJavaList(SendCouponDto.class);
+            List<VipCouponDto> vipCouponDtos = new ArrayList<>();
+            if (!javaList.isEmpty()){
+                for (SendCouponDto sendCouponDto : javaList) {
+                    VipCouponDto vipCouponDto = new VipCouponDto();
+                    TCoupon byId = couponService.getById(sendCouponDto.getId());
+                    vipCouponDto.setNum(sendCouponDto.getNumber());
+                    vipCouponDto.setTCoupon(byId);
+                    vipCouponDtos.add(vipCouponDto);
+                }
+            }
+
+            vipInfoDto.setVipCouponDtos(vipCouponDtos);
+
+            //计算总折扣
+            BigDecimal  total = BigDecimal.ZERO;
+            total = total.add(vip.getMaximumDeduction().multiply(BigDecimal.valueOf(vip.getDiscountTimes())));
+            for (VipCouponDto vipCouponDto : vipCouponDtos) {
+                TCoupon tCoupon = vipCouponDto.getTCoupon();
+                total.add(tCoupon.getDiscount());
+            }
+            vipInfoDto.setTotalDiscount(total);
+            vipInfoDtos.add(vipInfoDto);
+        }
+        return AjaxResult.success(vipInfoDtos);
+    }
+
 }
 

--
Gitblit v1.7.1