jin vor 2 Monaten
Ursprung
Commit
ba55ab34f3
28 geänderte Dateien mit 219 neuen und 721 gelöschten Zeilen
  1. 3 0
      pom.xml
  2. 1 1
      ruoyi-admin/src/main/resources/application-druid.yml
  3. 12 194
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/WxUser.java
  4. 2 1
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
  5. 1 1
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/controller/RecSaleInfoController.java
  6. 4 4
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/RecCommodity.java
  7. 2 2
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/RecContent.java
  8. 14 135
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/RecSaleInfo.java
  9. 6 187
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/RecStores.java
  10. 5 122
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/dto/RecSaleInfoDto.java
  11. 1 1
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/CommonServiceImpl.java
  12. 13 3
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/RecSaleInfoServiceImpl.java
  13. 4 1
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/WxLoginService.java
  14. 2 2
      ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java
  15. 7 2
      ruoyi-system/src/main/resources/mapper/system/RecSaleInfoMapper.xml
  16. 8 1
      ruoyi-system/src/main/resources/mapper/system/WxUserMapper.xml
  17. 3 3
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/controller/WxHomeController.java
  18. 21 15
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/controller/WxPayController.java
  19. 13 0
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/controller/WxPersonCenterController.java
  20. 0 2
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/domain/dto/CreditDto.java
  21. 2 2
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/domain/vo/GoodsInfoVo.java
  22. 7 3
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/domain/vo/SaleInfoVo.java
  23. 1 1
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/mapper/WxHomeMapper.java
  24. 1 1
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/IWxHomeService.java
  25. 8 0
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/IWxPersonCenterService.java
  26. 21 29
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/impl/WxHomeServiceImpl.java
  27. 56 3
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/impl/WxPersonCenterServiceImpl.java
  28. 1 5
      ruoyi-wx/src/main/resources/mapper/web/WxHomeMapper.xml

+ 3 - 0
pom.xml

@@ -251,6 +251,9 @@
                 <artifactId>maven-compiler-plugin</artifactId>
                 <version>3.13.0</version>
                 <configuration>
+                    <compilerArgs>
+                        <arg>-parameters</arg>
+                    </compilerArgs>
                     <parameters>true</parameters>
                     <source>${java.version}</source>
                     <target>${java.version}</target>

+ 1 - 1
ruoyi-admin/src/main/resources/application-druid.yml

@@ -6,7 +6,7 @@ spring:
         druid:
             # 主库数据源
             master:
-                url: jdbc:mysql://8.152.217.177:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                url: jdbc:mysql://8.152.217.177:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai
                 username: root
                 password: Sh@852741.
             # 从库数据源

+ 12 - 194
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/WxUser.java

@@ -3,9 +3,12 @@ package com.ruoyi.common.core.domain.entity;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
+import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.util.Date;
 
 /**
@@ -14,6 +17,7 @@ import java.util.Date;
  * @author jin
  * @date 2024-12-01
  */
+@Data
 public class WxUser extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
@@ -39,9 +43,8 @@ public class WxUser extends BaseEntity
     private Date birthday;
 
     /** 最近一次登录时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "最近一次登录时间", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date lastLoginTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime lastLoginTime;
 
     /** 最近一次登录IP地址 */
     @Excel(name = "最近一次登录IP地址")
@@ -86,199 +89,14 @@ public class WxUser extends BaseEntity
 
     /** 会员开始充值时间 */
     @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "会员开始充值时间", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date vipStartTime;
+    private LocalDate vipStartTime;
 
     /** 会员结束时间 */
     @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "会员结束时间", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date vipEndTime;
-
-    public void setId(Long id)
-    {
-        this.id = id;
-    }
-
-    public Long getId()
-    {
-        return id;
-    }
-    public void setUsername(String username)
-    {
-        this.username = username;
-    }
-
-    public String getUsername()
-    {
-        return username;
-    }
-    public void setPassword(String password)
-    {
-        this.password = password;
-    }
-
-    public String getPassword()
-    {
-        return password;
-    }
-    public void setGender(Long gender)
-    {
-        this.gender = gender;
-    }
-
-    public Long getGender()
-    {
-        return gender;
-    }
-    public void setBirthday(Date birthday)
-    {
-        this.birthday = birthday;
-    }
-
-    public Date getBirthday()
-    {
-        return birthday;
-    }
-    public void setLastLoginTime(Date lastLoginTime)
-    {
-        this.lastLoginTime = lastLoginTime;
-    }
-
-    public Date getLastLoginTime()
-    {
-        return lastLoginTime;
-    }
-    public void setLastLoginIp(String lastLoginIp)
-    {
-        this.lastLoginIp = lastLoginIp;
-    }
-
-    public String getLastLoginIp()
-    {
-        return lastLoginIp;
-    }
-    public void setUserLevel(Integer userLevel)
-    {
-        this.userLevel = userLevel;
-    }
-
-    public Integer getUserLevel()
-    {
-        return userLevel;
-    }
-    public void setNickname(String nickname)
-    {
-        this.nickname = nickname;
-    }
-
-    public String getNickname()
-    {
-        return nickname;
-    }
-    public void setMobile(String mobile)
-    {
-        this.mobile = mobile;
-    }
-
-    public String getMobile()
-    {
-        return mobile;
-    }
-    public void setAvatar(String avatar)
-    {
-        this.avatar = avatar;
-    }
-
-    public String getAvatar()
-    {
-        return avatar;
-    }
-    public void setWxOpenid(String wxOpenid)
-    {
-        this.wxOpenid = wxOpenid;
-    }
-
-    public String getWxOpenid()
-    {
-        return wxOpenid;
-    }
-    public void setStatus(Long status)
-    {
-        this.status = status;
-    }
-
-    public Long getStatus()
-    {
-        return status;
-    }
-    public void setAddTime(Date addTime)
-    {
-        this.addTime = addTime;
-    }
-
-    public Date getAddTime()
-    {
-        return addTime;
-    }
-    public void setDeleted(Integer deleted)
-    {
-        this.deleted = deleted;
-    }
-
-    public Integer getDeleted()
-    {
-        return deleted;
-    }
-    public void setPoints(Long points)
-    {
-        this.points = points;
-    }
-
-    public Long getPoints()
-    {
-        return points;
-    }
-    public void setVipStartTime(Date vipStartTime)
-    {
-        this.vipStartTime = vipStartTime;
-    }
-
-    public Date getVipStartTime()
-    {
-        return vipStartTime;
-    }
-    public void setVipEndTime(Date vipEndTime)
-    {
-        this.vipEndTime = vipEndTime;
-    }
-
-    public Date getVipEndTime()
-    {
-        return vipEndTime;
-    }
+    private LocalDate vipEndTime;
 
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("username", getUsername())
-            .append("password", getPassword())
-            .append("gender", getGender())
-            .append("birthday", getBirthday())
-            .append("lastLoginTime", getLastLoginTime())
-            .append("lastLoginIp", getLastLoginIp())
-            .append("userLevel", getUserLevel())
-            .append("nickname", getNickname())
-            .append("mobile", getMobile())
-            .append("avatar", getAvatar())
-            .append("wxOpenid", getWxOpenid())
-            .append("status", getStatus())
-            .append("addTime", getAddTime())
-            .append("updateTime", getUpdateTime())
-            .append("deleted", getDeleted())
-            .append("points", getPoints())
-            .append("vipStartTime", getVipStartTime())
-            .append("vipEndTime", getVipEndTime())
-            .toString();
-    }
+    /**
+     * 会员等级:1.月卡,2.季卡,3.年卡
+     */
+    private Integer vipLv;
 }

+ 2 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -109,7 +109,8 @@ public class SecurityConfig {
                     permitAllUrl.getUrls().forEach(url -> requests.requestMatchers(url).permitAll());
                     // 对于登录login 注册register 验证码captchaImage 允许匿名访问
                     requests.requestMatchers("/login", "/wx/login","/register", "/captchaImage", "/common/**",
-                                    "/wx/home/index", "/wx/home/sale/**", "/wx/recycle/**", "/wx/quotation/**", "/wx/common/**", "/wx/home/thumbs/**").permitAll()
+                                    "/wx/home/index", "/wx/home/sale/**", "/wx/recycle/**", "/wx/quotation/**",
+                                    "/wx/common/**", "/wx/home/thumbs/**", "/wx/person/info").permitAll()
                             // 静态资源,可匿名访问
                             .requestMatchers(HttpMethod.GET, "/", "/*.html", "/**.html", "/**.css", "/**.js", "/profile/**").permitAll()
                             .requestMatchers("/swagger-ui.html", "/v3/api-docs/**", "/swagger-ui/**", "/druid/**").permitAll()

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/controller/RecSaleInfoController.java

@@ -25,7 +25,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
 
 /**
  * 发售信息详情Controller
- * 
+ *
  * @author jin
  * @date 2024-11-18
  */

+ 4 - 4
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/RecCommodity.java

@@ -42,13 +42,13 @@ public class RecCommodity extends BaseEntity
     private BigDecimal market;
 
     /** 创建时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date createDate;
 
     /** 更新时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date updateDate;
 
     /**

+ 2 - 2
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/RecContent.java

@@ -30,12 +30,12 @@ public class RecContent extends BaseEntity
     private Long thumbs;
 
     /** 创建时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date createDate;
 
     /** 更新时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date updateDate;
 

+ 14 - 135
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/RecSaleInfo.java

@@ -1,7 +1,11 @@
 package com.ruoyi.framework.recovery.domain;
 
+import java.time.LocalDateTime;
 import java.util.Date;
+
+import cn.hutool.core.date.DateTime;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
@@ -13,6 +17,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
  * @author jin
  * @date 2024-11-18
  */
+@Data
 public class RecSaleInfo extends BaseEntity
 {
     private static final long serialVersionUID = -2546842741033173431L;
@@ -48,13 +53,13 @@ public class RecSaleInfo extends BaseEntity
      * 活动开始时间
      */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date eventStartTime;
+    private LocalDateTime eventStartTime;
 
     /**
      * 活动结束时间
      */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date endTimeOfActivity;
+    private LocalDateTime endTimeOfActivity;
 
     /** 创建时间 */
     @JsonFormat(pattern = "yyyy-MM-dd")
@@ -62,8 +67,8 @@ public class RecSaleInfo extends BaseEntity
     private Date createDate;
 
     /** 更新时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date updateDate;
 
     private Character topUp;
@@ -71,136 +76,10 @@ public class RecSaleInfo extends BaseEntity
     /**
      * 置顶排序
      */
+    private Integer durationOfTheActivity;
+
+    /**
+     * 发售
+     */
     private Integer topIndex;
-    public void setId(Long id)
-    {
-        this.id = id;
-    }
-
-    public Long getId()
-    {
-        return id;
-    }
-    public void setSaleName(String saleName)
-    {
-        this.saleName = saleName;
-    }
-
-    public String getSaleName()
-    {
-        return saleName;
-    }
-    public void setSalePrice(String salePrice)
-    {
-        this.salePrice = salePrice;
-    }
-
-    public String getSalePrice()
-    {
-        return salePrice;
-    }
-    public void setMarket(String market)
-    {
-        this.market = market;
-    }
-
-    public String getMarket()
-    {
-        return market;
-    }
-
-    public String getStoreId() {
-        return storeId;
-    }
-
-    public void setStoreId(String storeId) {
-        this.storeId = storeId;
-    }
-
-    public void setCreateDate(Date createDate)
-    {
-        this.createDate = createDate;
-    }
-
-    public Date getCreateDate()
-    {
-        return createDate;
-    }
-    public void setUpdateDate(Date updateDate)
-    {
-        this.updateDate = updateDate;
-    }
-
-    public Date getUpdateDate()
-    {
-        return updateDate;
-    }
-
-    public String getCatalog() {
-        return catalog;
-    }
-
-    public void setCatalog(String catalog) {
-        this.catalog = catalog;
-    }
-
-    public String getImages() {
-        return images;
-    }
-
-    public void setImages(String images) {
-        this.images = images;
-    }
-
-    public Date getEventStartTime() {
-        return eventStartTime;
-    }
-
-    public void setEventStartTime(Date eventStartTime) {
-        this.eventStartTime = eventStartTime;
-    }
-
-    public Date getEndTimeOfActivity() {
-        return endTimeOfActivity;
-    }
-
-    public void setEndTimeOfActivity(Date endTimeOfActivity) {
-        this.endTimeOfActivity = endTimeOfActivity;
-    }
-
-    public Character getTopUp() {
-        return topUp;
-    }
-
-    public void setTopUp(Character topUp) {
-        this.topUp = topUp;
-    }
-
-    public Integer getTopIndex() {
-        return topIndex;
-    }
-
-    public void setTopIndex(Integer topIndex) {
-        this.topIndex = topIndex;
-    }
-
-    @Override
-    public String toString() {
-        final StringBuffer sb = new StringBuffer("RecSaleInfo{");
-        sb.append("id=").append(id);
-        sb.append(", saleName='").append(saleName).append('\'');
-        sb.append(", salePrice='").append(salePrice).append('\'');
-        sb.append(", market='").append(market).append('\'');
-        sb.append(", storeId='").append(storeId).append('\'');
-        sb.append(", catalog='").append(catalog).append('\'');
-        sb.append(", images='").append(images).append('\'');
-        sb.append(", eventStartTime=").append(eventStartTime);
-        sb.append(", endTimeOfActivity=").append(endTimeOfActivity);
-        sb.append(", createDate=").append(createDate);
-        sb.append(", updateDate=").append(updateDate);
-        sb.append(", topUp=").append(topUp);
-        sb.append(", topIndex=").append(topIndex);
-        sb.append('}');
-        return sb.toString();
-    }
 }

+ 6 - 187
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/RecStores.java

@@ -1,8 +1,10 @@
 package com.ruoyi.framework.recovery.domain;
 
+import java.time.LocalDateTime;
 import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
@@ -14,7 +16,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
  * @author jin
  * @date 2024-11-16
  */
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
+@Data
 public class RecStores extends BaseEntity
 {
     private static final long serialVersionUID = -4720608856018159687L;
@@ -35,9 +37,8 @@ public class RecStores extends BaseEntity
     private String saleTime;
 
     /** 中签时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "中签时间", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date checkTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+    private LocalDateTime checkTime;
 
     /** 中签通知方式 */
     @Excel(name = "中签通知方式")
@@ -79,7 +80,7 @@ public class RecStores extends BaseEntity
      * 发售数量
      */
     @Excel(name = "发售数量")
-    private Long saleNum;
+    private String saleNum;
 
     /**
      * 发售城市id
@@ -101,186 +102,4 @@ public class RecStores extends BaseEntity
      */
     @Excel(name = "跳转链接")
     private String skipLink;
-
-    public void setId(Long id)
-    {
-        this.id = id;
-    }
-
-    public Long getId()
-    {
-        return id;
-    }
-    public void setStoresName(String storesName)
-    {
-        this.storesName = storesName;
-    }
-
-    public String getStoresName()
-    {
-        return storesName;
-    }
-    public void setSaleType(String saleType)
-    {
-        this.saleType = saleType;
-    }
-
-    public String getSaleType()
-    {
-        return saleType;
-    }
-    public void setSaleTime(String saleTime)
-    {
-        this.saleTime = saleTime;
-    }
-
-    public String getSaleTime()
-    {
-        return saleTime;
-    }
-    public void setCheckTime(Date checkTime)
-    {
-        this.checkTime = checkTime;
-    }
-
-    public Date getCheckTime()
-    {
-        return checkTime;
-    }
-    public void setCheckType(String checkType)
-    {
-        this.checkType = checkType;
-    }
-
-    public String getCheckType()
-    {
-        return checkType;
-    }
-    public void setBuyTime(String buyTime)
-    {
-        this.buyTime = buyTime;
-    }
-
-    public String getBuyTime()
-    {
-        return buyTime;
-    }
-    public void setSaleLink(String saleLink)
-    {
-        this.saleLink = saleLink;
-    }
-
-    public String getSaleLink()
-    {
-        return saleLink;
-    }
-    public void setCreateDate(Date createDate)
-    {
-        this.createDate = createDate;
-    }
-
-    public Date getCreateDate()
-    {
-        return createDate;
-    }
-    public void setUpdateDate(Date updateDate)
-    {
-        this.updateDate = updateDate;
-    }
-
-    public Date getUpdateDate()
-    {
-        return updateDate;
-    }
-    public void setCommondityId(String commondityId)
-    {
-        this.commondityId = commondityId;
-    }
-
-    public String getCommondityId()
-    {
-        return commondityId;
-    }
-    public void setStoresAddress(String storesAddress)
-    {
-        this.storesAddress = storesAddress;
-    }
-
-    public String getStoresAddress()
-    {
-        return storesAddress;
-    }
-
-    public String getNotice() {
-        return notice;
-    }
-
-    public void setNotice(String notice) {
-        this.notice = notice;
-    }
-
-    public Long getSaleNum() {
-        return saleNum;
-    }
-
-    public void setSaleNum(Long saleNum) {
-        this.saleNum = saleNum;
-    }
-
-    public String getCityId() {
-        return cityId;
-    }
-
-    public void setCityId(String cityId) {
-        this.cityId = cityId;
-    }
-
-    public String getImages() {
-        return images;
-    }
-
-    public void setImages(String images) {
-        this.images = images;
-    }
-
-    public String getCity() {
-        return city;
-    }
-
-    public void setCity(String city) {
-        this.city = city;
-    }
-
-    public String getSkipLink() {
-        return skipLink;
-    }
-
-    public void setSkipLink(String skipLink) {
-        this.skipLink = skipLink;
-    }
-
-    @Override
-    public String toString() {
-        final StringBuffer sb = new StringBuffer("RecStores{");
-        sb.append("id=").append(id);
-        sb.append(", storesName='").append(storesName).append('\'');
-        sb.append(", saleType='").append(saleType).append('\'');
-        sb.append(", saleTime='").append(saleTime).append('\'');
-        sb.append(", checkTime=").append(checkTime);
-        sb.append(", checkType='").append(checkType).append('\'');
-        sb.append(", buyTime='").append(buyTime).append('\'');
-        sb.append(", saleLink='").append(saleLink).append('\'');
-        sb.append(", createDate=").append(createDate);
-        sb.append(", updateDate=").append(updateDate);
-        sb.append(", commondityId='").append(commondityId).append('\'');
-        sb.append(", storesAddress='").append(storesAddress).append('\'');
-        sb.append(", notice='").append(notice).append('\'');
-        sb.append(", saleNum=").append(saleNum);
-        sb.append(", cityId='").append(cityId).append('\'');
-        sb.append(", city='").append(city).append('\'');
-        sb.append(", images='").append(images).append('\'');
-        sb.append(", skipLink='").append(skipLink).append('\'');
-        sb.append('}');
-        return sb.toString();
-    }
 }

+ 5 - 122
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/dto/RecSaleInfoDto.java

@@ -2,9 +2,12 @@ package com.ruoyi.framework.recovery.domain.dto;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.common.annotation.Excel;
+import lombok.Data;
 
+import java.time.LocalDateTime;
 import java.util.Date;
 
+@Data
 public class RecSaleInfoDto {
 
     /** 发售名称 */
@@ -35,7 +38,7 @@ public class RecSaleInfoDto {
      * 活动时间
      */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date activityTime;
+    private LocalDateTime activityTime;
 
     /**
      * 活动持续时长
@@ -59,125 +62,5 @@ public class RecSaleInfoDto {
      */
     private Integer topIndex;
 
-    public void setSaleName(String saleName)
-    {
-        this.saleName = saleName;
-    }
-
-    public String getSaleName()
-    {
-        return saleName;
-    }
-    public void setSalePrice(String salePrice)
-    {
-        this.salePrice = salePrice;
-    }
-
-    public String getSalePrice()
-    {
-        return salePrice;
-    }
-    public void setMarket(String market)
-    {
-        this.market = market;
-    }
-
-    public String getMarket()
-    {
-        return market;
-    }
-
-    public String getStoreId() {
-        return storeId;
-    }
-
-    public void setStoreId(String storeId) {
-        this.storeId = storeId;
-    }
-
-    public void setCreateDate(Date createDate)
-    {
-        this.createDate = createDate;
-    }
-
-    public Date getCreateDate()
-    {
-        return createDate;
-    }
-    public void setUpdateDate(Date updateDate)
-    {
-        this.updateDate = updateDate;
-    }
-
-    public Date getUpdateDate()
-    {
-        return updateDate;
-    }
-
-    public String getCatalog() {
-        return catalog;
-    }
-
-    public void setCatalog(String catalog) {
-        this.catalog = catalog;
-    }
-
-    public String getImages() {
-        return images;
-    }
-
-    public void setImages(String images) {
-        this.images = images;
-    }
-
-    public Date getActivityTime() {
-        return activityTime;
-    }
-
-    public void setActivityTime(Date activityTime) {
-        this.activityTime = activityTime;
-    }
-
-    public Integer getDurationOfTheActivity() {
-        return durationOfTheActivity;
-    }
-
-    public void setDurationOfTheActivity(Integer durationOfTheActivity) {
-        this.durationOfTheActivity = durationOfTheActivity;
-    }
-
-    public Character getTopUp() {
-        return topUp;
-    }
-
-    public void setTopUp(Character topUp) {
-        this.topUp = topUp;
-    }
-
-    public Integer getTopIndex() {
-        return topIndex;
-    }
-
-    public void setTopIndex(Integer topIndex) {
-        this.topIndex = topIndex;
-    }
-
-    @Override
-    public String toString() {
-        final StringBuffer sb = new StringBuffer("RecSaleInfoDto{");
-        sb.append("saleName='").append(saleName).append('\'');
-        sb.append(", salePrice='").append(salePrice).append('\'');
-        sb.append(", market='").append(market).append('\'');
-        sb.append(", storeId='").append(storeId).append('\'');
-        sb.append(", catalog='").append(catalog).append('\'');
-        sb.append(", images='").append(images).append('\'');
-        sb.append(", activityTime=").append(activityTime);
-        sb.append(", durationOfTheActivity=").append(durationOfTheActivity);
-        sb.append(", createDate=").append(createDate);
-        sb.append(", updateDate=").append(updateDate);
-        sb.append(", topUp=").append(topUp);
-        sb.append(", topIndex=").append(topIndex);
-        sb.append('}');
-        return sb.toString();
-    }
+
 }

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/CommonServiceImpl.java

@@ -72,7 +72,7 @@ public class CommonServiceImpl implements ICommonService {
         }
         // 如果是图片,就上传缩略图
         if (isImg) {
-            BufferedImage image = Thumbnails.of(file.getInputStream()).scale(0.7f).outputFormat(suffix.substring(1)).outputQuality(0.5).asBufferedImage();
+            BufferedImage image = Thumbnails.of(file.getInputStream()).scale(0.5f).outputFormat(suffix.substring(1)).outputQuality(0.3).asBufferedImage();
             ByteArrayOutputStream out = new ByteArrayOutputStream();
             ImageIO.write(image, suffix.substring(1), out);
             // ByteArrayOutputStream 转化为 byte[]

+ 13 - 3
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/RecSaleInfoServiceImpl.java

@@ -1,12 +1,18 @@
 package com.ruoyi.framework.recovery.service.impl;
 
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
+import java.util.TimeZone;
 
 import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import com.ruoyi.framework.recovery.domain.dto.RecSaleInfoDto;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -21,6 +27,7 @@ import com.ruoyi.framework.recovery.service.IRecSaleInfoService;
  * @date 2024-11-18
  */
 @Service
+@Slf4j
 public class RecSaleInfoServiceImpl implements IRecSaleInfoService {
     @Autowired
     private RecSaleInfoMapper recSaleInfoMapper;
@@ -56,11 +63,14 @@ public class RecSaleInfoServiceImpl implements IRecSaleInfoService {
     @Override
     public int insertRecSaleInfo(RecSaleInfoDto dto) {
         RecSaleInfo recSaleInfo = new RecSaleInfo();
-        Date activityTime = dto.getActivityTime();
+        LocalDateTime activityTime = dto.getActivityTime();
+        LocalDateTime endTime = null;
         if (null == dto.getDurationOfTheActivity()) {
-            dto.setDurationOfTheActivity(1);
+            endTime = LocalDateTime.of(LocalDate.from(activityTime), LocalTime.MAX).minusNanos(1);
+        } else {
+            endTime = activityTime.plusDays(dto.getDurationOfTheActivity());
         }
-        DateTime endTime = DateUtil.offsetDay(activityTime, dto.getDurationOfTheActivity());
+        log.info("活动结束时间:{}", endTime);
         BeanUtils.copyProperties(dto, recSaleInfo);
         recSaleInfo.setEventStartTime(activityTime);
         recSaleInfo.setEndTimeOfActivity(endTime);

+ 4 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/WxLoginService.java

@@ -15,6 +15,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+
 @Component
 @Slf4j
 public class WxLoginService {
@@ -77,7 +80,7 @@ public class WxLoginService {
         WxUser appUser = new WxUser();
         appUser.setId(userId);
         appUser.setLastLoginIp(IpUtils.getIpAddr());
-        appUser.setLastLoginTime(DateUtils.getNowDate());
+        appUser.setLastLoginTime(LocalDateTime.now(ZoneId.of("Asia/Shanghai")));
         wxUserService.updateWxUser(appUser);
     }
 

+ 2 - 2
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java

@@ -8,7 +8,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
 
 /**
  * 操作日志记录表 oper_log
- * 
+ *
  * @author ruoyi
  */
 public class SysOperLog extends BaseEntity
@@ -79,7 +79,7 @@ public class SysOperLog extends BaseEntity
     private String errorMsg;
 
     /** 操作时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date operTime;
 

+ 7 - 2
ruoyi-system/src/main/resources/mapper/system/RecSaleInfoMapper.xml

@@ -19,12 +19,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="eventStartTime"    column="event_start_time"    />
         <result property="endTimeOfActivity"    column="end_time_of_activity"    />
         <result property="topUp"    column="top_up"    />
+        <result property="durationOfTheActivity"    column="duration_of_the_activity"    />
         <result property="topIndex"    column="top_index"    />
     </resultMap>
 
     <sql id="selectRecSaleInfoVo">
         select id, sale_name,catalog, sale_price, market, store_id, create_by, create_date, update_by, update_date,
-            images, event_start_time, end_time_of_activity, top_up, top_index  from rec_sale_info
+            images, event_start_time, end_time_of_activity, top_up, duration_of_the_activity, top_index  from rec_sale_info
     </sql>
 
     <select id="selectRecSaleInfoList" parameterType="RecSaleInfo" resultMap="RecSaleInfoResult">
@@ -39,8 +40,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="catalog != null "> and catalog = #{catalog}</if>
             <if test="images != null "> and images = #{images}</if>
             <if test="eventStartTime != null "> and event_start_time = #{eventStartTime}</if>
-            <if test="endTimeOfActivity != null "> and end_time_of_activity = #{endTimeOfActivity}</if>
+            <if test="endTimeOfActivity != null "> and end_time_of_activity >= #{endTimeOfActivity}</if>
             <if test="topUp != null "> and top_up = #{topUp}</if>
+            <if test="durationOfTheActivity != null "> and duration_of_the_activity = #{durationOfTheActivity}</if>
             <if test="topIndex != null "> and top_index = #{topIndex}</if>
         </where>
     </select>
@@ -67,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="info.eventStartTime != null">event_start_time,</if>
             <if test="info.endTimeOfActivity != null">end_time_of_activity,</if>
             <if test="info.topUp != null">top_up,</if>
+            <if test="info.durationOfTheActivity != null">duration_of_the_activity,</if>
             <if test="info.topIndex != null">top_index,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -84,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="info.eventStartTime != null">#{info.eventStartTime},</if>
             <if test="info.endTimeOfActivity != null">#{info.endTimeOfActivity},</if>
             <if test="info.topUp != null">#{info.topUp},</if>
+            <if test="info.durationOfTheActivity != null">#{info.durationOfTheActivity},</if>
             <if test="info.topIndex != null">#{info.topIndex},</if>
          </trim>
     </insert>
@@ -104,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="eventStartTime != null">event_start_time = #{eventStartTime},</if>
             <if test="endTimeOfActivity != null">end_time_of_activity = #{endTimeOfActivity},</if>
             <if test="topUp != null">top_up = #{topUp},</if>
+            <if test="durationOfTheActivity != null">top_index = #{durationOfTheActivity},</if>
             <if test="topIndex != null">top_index = #{topIndex},</if>
         </trim>
         where id = #{id}

+ 8 - 1
ruoyi-system/src/main/resources/mapper/system/WxUserMapper.xml

@@ -24,10 +24,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="points"    column="points"    />
         <result property="vipStartTime"    column="vip_start_time"    />
         <result property="vipEndTime"    column="vip_end_time"    />
+        <result property="vipLv" column="vip_lv" />
     </resultMap>
 
     <sql id="selectWxUserVo">
-        select id, username, password, gender, birthday, last_login_time, last_login_ip, user_level, nickname, mobile, avatar, wx_openid, status, add_time, update_time, deleted, points, vip_start_time, vip_end_time from wx_user
+        select id, username, password, gender, birthday, last_login_time, last_login_ip, user_level, nickname, mobile,
+               avatar, wx_openid, status, add_time, update_time, deleted, points, vip_start_time, vip_end_time, vip_lv from wx_user
     </sql>
 
     <select id="selectWxUserList" parameterType="WxUser" resultMap="WxUserResult">
@@ -50,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="points != null "> and points = #{points}</if>
             <if test="vipStartTime != null "> and vip_start_time = #{vipStartTime}</if>
             <if test="vipEndTime != null "> and vip_end_time = #{vipEndTime}</if>
+            <if test="vipIv != null "> and vip_lv = #{vipIv}</if>
         </where>
     </select>
 
@@ -83,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="points != null">points,</if>
             <if test="vipStartTime != null">vip_start_time,</if>
             <if test="vipEndTime != null">vip_end_time,</if>
+            <if test="vipLv != null">vip_lv,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="username != null and username != ''">#{username},</if>
@@ -103,6 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="points != null">#{points},</if>
             <if test="vipStartTime != null">#{vipStartTime},</if>
             <if test="vipEndTime != null">#{vipEndTime},</if>
+            <if test="vipLv != null">#{vipLv},</if>
          </trim>
     </insert>
 
@@ -127,6 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="points != null">points = #{points},</if>
             <if test="vipStartTime != null">vip_start_time = #{vipStartTime},</if>
             <if test="vipEndTime != null">vip_end_time = #{vipEndTime},</if>
+            <if test="vipLv != null">vip_lv = #{vipLv},</if>
         </trim>
         where id = #{id}
     </update>
@@ -150,6 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="points != null">points = #{points},</if>
             <if test="vipStartTime != null">vip_start_time = #{vipStartTime},</if>
             <if test="vipEndTime != null">vip_end_time = #{vipEndTime},</if>
+            <if test="vipLv != null">vip_lv = #{vipLv},</if>
         </trim>
         where wxOpenid = #{wxOpenid}
     </update>

+ 3 - 3
ruoyi-wx/src/main/java/com/ruoyi/wx/web/controller/WxHomeController.java

@@ -35,10 +35,10 @@ public class WxHomeController {
     }
 
 //    @ApiOperation(value = "发售信息详情", notes = "根据id查询详情内容")
-    @GetMapping("/sale/info/{id}")
-    public AjaxResult getSaleInfo(@PathVariable("id") Long id) {
+    @GetMapping("/sale/info/{id}/{storeIds}")
+    public AjaxResult getSaleInfo(@PathVariable("id") Long id, @PathVariable("storeIds") String storeIds) {
         try {
-            List<SaleInfoVo> infoList = wxHomeService.getSaleInfo(id);
+            List<SaleInfoVo> infoList = wxHomeService.getSaleInfo(id, storeIds);
             return AjaxResult.success(infoList);
         } catch (Exception e) {
             return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));

+ 21 - 15
ruoyi-wx/src/main/java/com/ruoyi/wx/web/controller/WxPayController.java

@@ -34,7 +34,13 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
 import java.util.concurrent.locks.ReentrantLock;
 
 /**
@@ -143,7 +149,6 @@ public class WxPayController {
         payer.setOpenid(dto.getOpenId());
         request.setPayer(payer);
         WxPayUnifiedOrderV3Result.JsapiResult orderV3 = this.wxPayService.createOrderV3(TradeTypeEnum.JSAPI, request);
-        AjaxResult result = new AjaxResult();
         WxRecharge wxRecharge = new WxRecharge();
         wxRecharge.setPoints(dto.getPoints());
         wxRecharge.setPrice(total.divide(new BigDecimal(100)));
@@ -153,16 +158,17 @@ public class WxPayController {
         wxRecharge.setUserName(wxUser.getUsername());
         wxRechargeService.insertWxRecharge(wxRecharge);
         wxUser.setUserLevel(dto.getVipLv());
-        wxUser.setVipStartTime(new Date());
-        wxUser.setVipEndTime(defDate(new Date(), dto.getVipLv()));
+        wxUser.setVipStartTime(LocalDate.now(ZoneId.of("Asia/Shanghai")));
+        wxUser.setVipEndTime(defDate(LocalDate.now(ZoneId.of("Asia/Shanghai")), dto.getVipLv()));
         wxUserService.updateWxUser(wxUser);
-        result.put("appId", orderV3.getAppId());
-        result.put("timeStamp", orderV3.getTimeStamp());
-        result.put("nonceStr", orderV3.getNonceStr());
-        result.put("packageValue", orderV3.getPackageValue());
-        result.put("signType", orderV3.getSignType());
-        result.put("outTradeNo", orderNo);
-        return result;
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("appId", orderV3.getAppId());
+        resultMap.put("timeStamp", orderV3.getTimeStamp());
+        resultMap.put("nonceStr", orderV3.getNonceStr());
+        resultMap.put("packageValue", orderV3.getPackageValue());
+        resultMap.put("signType", orderV3.getSignType());
+        resultMap.put("outTradeNo", orderNo);
+        return AjaxResult.success(resultMap);
     }
 
     /**
@@ -218,17 +224,17 @@ public class WxPayController {
         return AjaxResult.success();
     }
 
-    private Date defDate(Date now, Integer offset) {
-        Date defDate = new Date();
+    private static LocalDate defDate(LocalDate now, Integer offset) {
+        LocalDate defDate = null;
         switch (offset) {
             case 1:
-                defDate = DateUtil.offset(now, DateField.MONTH, 1);
+                defDate = now.plusMonths(1);
                 break;
             case 2:
-                defDate = DateUtil.offset(now, DateField.MONTH, 3);
+                defDate = now.plusMonths(3);
                 break;
             case 3:
-                defDate = DateUtil.offset(now, DateField.MONTH, 12);
+                defDate = now.plusMonths(12);
                 break;
             default:
                 break;

+ 13 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/controller/WxPersonCenterController.java

@@ -53,6 +53,19 @@ public class WxPersonCenterController {
         }
     }
 
+    /**
+     * 积分兑换
+     */
+    @GetMapping("/conversion/credit/{cash}")
+    public AjaxResult conversion(@PathVariable("cash") String cash) {
+        try {
+            String conversion = wxPersonCenterService.conCredit(cash);
+                return AjaxResult.success(conversion);
+        } catch (Exception e) {
+            return AjaxResult.error(e.getMessage());
+        }
+    }
+
     /**
      * 获取积分记录
      */

+ 0 - 2
ruoyi-wx/src/main/java/com/ruoyi/wx/web/domain/dto/CreditDto.java

@@ -14,10 +14,8 @@ public class CreditDto {
     private Long id;
 
     /** 积分类型 */
-    @Excel(name = "积分类型")
     private String creditType;
 
     /** 积分数 */
-    @Excel(name = "积分数")
     private Long creditNum;
 }

+ 2 - 2
ruoyi-wx/src/main/java/com/ruoyi/wx/web/domain/vo/GoodsInfoVo.java

@@ -47,8 +47,8 @@ public class GoodsInfoVo {
     private BigDecimal arbitrage;
 
     /** 更新时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date updateDate;
 
     public Long getId() {

+ 7 - 3
ruoyi-wx/src/main/java/com/ruoyi/wx/web/domain/vo/SaleInfoVo.java

@@ -6,6 +6,7 @@ import lombok.Data;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.time.LocalDateTime;
 import java.util.Date;
 import java.util.List;
 
@@ -44,13 +45,13 @@ public class SaleInfoVo implements Serializable {
      * 活动开始时间
      */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date eventStartTime;
+    private LocalDateTime eventStartTime;
 
     /**
      * 活动结束时间
      */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date endTimeOfActivity;
+    private LocalDateTime endTimeOfActivity;
 
     /**
      * 是否发售
@@ -63,10 +64,13 @@ public class SaleInfoVo implements Serializable {
     /**
      * 置顶排序
      */
-    private Integer topIndex;
+    private Integer DurationOfTheActivity;
 
     /**
      * 门店信息
      */
     private List<RecStoresVo> stores;
+
+
+    private String storeId;
 }

+ 1 - 1
ruoyi-wx/src/main/java/com/ruoyi/wx/web/mapper/WxHomeMapper.java

@@ -26,7 +26,7 @@ public interface WxHomeMapper {
      * @param comIds ids
      * @return 模糊查询所有发售此商品的门店
      */
-    List<RecStores> selectRecStoresByCommondityIds(@Param("ids") List<String> comIds);
+    List<RecStores> selectRecStoresByCommondityIds(@Param("ids") String comIds);
 
     /**
      * 查询是否展示抽奖系统

+ 1 - 1
ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/IWxHomeService.java

@@ -23,7 +23,7 @@ public interface IWxHomeService {
      * @param id 发售信息id
      * @return 详情内容
      */
-    List<SaleInfoVo> getSaleInfo(Long id);
+    List<SaleInfoVo> getSaleInfo(Long id, String storeIds);
 
     /**
      * 获取所有发售信息

+ 8 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/IWxPersonCenterService.java

@@ -45,4 +45,12 @@ public interface IWxPersonCenterService {
      * @return 结果集
      */
     List<CreditVo> getCredit();
+
+    /**
+     * 兑换积分
+     *
+     * @param cash
+     * @return
+     */
+    String conCredit(String cash);
 }

+ 21 - 29
ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/impl/WxHomeServiceImpl.java

@@ -22,6 +22,7 @@ import com.ruoyi.wx.web.domain.vo.SaleInfoVo;
 import com.ruoyi.wx.web.domain.vo.WxContentVo;
 import com.ruoyi.wx.web.mapper.WxHomeMapper;
 import com.ruoyi.wx.web.service.IWxHomeService;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,12 +31,14 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDateTime;
 import java.time.ZoneId;
+import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.stream.Collectors;
 
 @Service
+@Slf4j
 public class WxHomeServiceImpl implements IWxHomeService {
     @Autowired
     private IRecSaleInfoService recSaleInfoService;
@@ -65,7 +68,6 @@ public class WxHomeServiceImpl implements IWxHomeService {
 
     @Override
     public AjaxResult getIndex() throws ExecutionException, InterruptedException {
-        AjaxResult result = new AjaxResult();
         // 查询最近创建的活动并且处于活动期间的内容
         DateTime dateTime = DateUtil.beginOfDay(new Date());
         Date startTime = DateUtil.offsetDay(dateTime, -1);
@@ -91,21 +93,20 @@ public class WxHomeServiceImpl implements IWxHomeService {
         }
         String display = wxHomeMapper.selectLotteryDisplay("is_lottery");
         List<RecSaleInfo> saleInfos = saleInfoTask.get();
-        saleInfos.sort(Comparator.comparing(RecSaleInfo::getTopIndex, Integer::compareTo));
-        contentVos.sort(Comparator.comparing(WxContentVo::getCreateDate, (t1, t2) -> t2.compareTo(t1)));
-        result.put("saleInfo", saleInfos);
-        result.put("content", contentVos);
-        result.put("is_lottery", display);
-        return result;
+//        saleInfos.sort(Comparator.comparing(RecSaleInfo::getTopIndex, Integer::compareTo));
+        contentVos.sort(Comparator.comparing(WxContentVo::getCreateDate, Comparator.reverseOrder()));
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("saleInfo", saleInfos);
+        resultMap.put("content", contentVos);
+        resultMap.put("is_lottery", display);
+        return AjaxResult.success(resultMap);
     }
 
     @Override
-    public List<SaleInfoVo> getSaleInfo(Long id) {
+    public List<SaleInfoVo> getSaleInfo(Long id, String storeIds) {
         RecSaleInfo saleInfo = saleInfoMapper.selectRecSaleInfoById(id);
-        // 获取到商品id,并将商品id转换为Integer到数据库中查询
-        List<String> ids = Arrays.asList(saleInfo.getStoreId().split(","));
         // 根据商品获取所有门店信息
-        List<RecStores> stores = wxHomeMapper.selectRecStoresByCommondityIds(ids);
+        List<RecStores> stores = wxHomeMapper.selectRecStoresByCommondityIds(storeIds);
         Map<String, List<RecStores>> cityMap = stores.stream().filter(vo -> StringUtils.isNotEmpty(vo.getCity())).collect(Collectors.groupingBy(RecStores::getCity));
         List<SaleInfoVo> result = new ArrayList<>();
         SaleInfoVo saleInfoVo = new SaleInfoVo();
@@ -120,20 +121,23 @@ public class WxHomeServiceImpl implements IWxHomeService {
         });
         saleInfoVo.setStores(cityList);
         result.add(saleInfoVo);
+        log.info("查询发售信息详情结束");
         return result;
     }
 
     @Override
     public List<SaleInfoVo> getSaleCalendar() {
-        List<RecSaleInfo> recSaleInfos = saleInfoMapper.selectRecSaleInfoList(new RecSaleInfo());
+        RecSaleInfo saleInfo = new RecSaleInfo();
+        saleInfo.setEndTimeOfActivity(LocalDateTime.now());
+        List<RecSaleInfo> recSaleInfos = saleInfoMapper.selectRecSaleInfoList(saleInfo);
         List<SaleInfoVo> result = new ArrayList<>();
         for (RecSaleInfo info : recSaleInfos) {
             SaleInfoVo vo = new SaleInfoVo();
             BeanUtils.copyProperties(info, vo);
-            vo.setStore(belongCalendar(new Date(), vo.getEventStartTime(), vo.getEndTimeOfActivity()));
+            vo.setStore(belongCalendar(LocalDateTime.now(ZoneId.of("Asia/Shanghai")), vo.getEventStartTime(), vo.getEndTimeOfActivity()));
             result.add(vo);
         }
-        result.sort((t1, t2) -> t2.getEndTimeOfActivity().compareTo(t1.getEndTimeOfActivity()));
+        result.sort(Comparator.comparing(SaleInfoVo::getEndTimeOfActivity));
         return result;
     }
 
@@ -195,20 +199,8 @@ public class WxHomeServiceImpl implements IWxHomeService {
      * @param endTime
      * @return
      */
-    public static boolean belongCalendar(Date nowTime, Date beginTime, Date endTime) {
-        Calendar date = Calendar.getInstance();
-        date.setTime(nowTime);
-
-        Calendar begin = Calendar.getInstance();
-        begin.setTime(beginTime);
-
-        Calendar end = Calendar.getInstance();
-        end.setTime(endTime);
-
-        if (date.after(begin) && date.before(end)) {
-            return true;
-        } else {
-            return false;
-        }
+    public static boolean belongCalendar(LocalDateTime nowTime, LocalDateTime beginTime, LocalDateTime endTime) {
+        log.info("当前时间:{}, 开始时间:{}, 结束时间:{}", nowTime, beginTime, endTime);
+        return nowTime.isAfter(beginTime) && nowTime.isBefore(endTime);
     }
 }

+ 56 - 3
ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/impl/WxPersonCenterServiceImpl.java

@@ -1,6 +1,5 @@
 package com.ruoyi.wx.web.service.impl;
 
-import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.WxUser;
@@ -19,16 +18,20 @@ import com.ruoyi.wx.web.domain.dto.CreditDto;
 import com.ruoyi.wx.web.domain.vo.WxCreditVo;
 import com.ruoyi.wx.web.domain.vo.WxUserVo;
 import com.ruoyi.wx.web.service.IWxPersonCenterService;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.time.LocalDate;
+import java.time.ZoneId;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 @Service
+@Slf4j
 public class WxPersonCenterServiceImpl implements IWxPersonCenterService {
     @Autowired
     private WxCreditMapper wxCreditMapper;
@@ -45,7 +48,8 @@ public class WxPersonCenterServiceImpl implements IWxPersonCenterService {
         if (loginWxUser == null) {
             throw new SecurityException("请登录");
         }
-        WxUser wxUser = loginWxUser.getWxUser();
+        WxUser loginWxUserWxUser = loginWxUser.getWxUser();
+        WxUser wxUser = wxUserMapper.selectWxUserById(loginWxUserWxUser.getId());
         WxUserVo userVo = new WxUserVo();
         BeanUtils.copyBeanProp(userVo, wxUser);
         Map<String, Object> data = new HashMap<>();
@@ -75,8 +79,11 @@ public class WxPersonCenterServiceImpl implements IWxPersonCenterService {
         if (loginWxUser == null) {
             throw new SecurityException("请登录");
         }
-        WxUser wxUser = loginWxUser.getWxUser();
+        WxUser loginWxUserWxUser = loginWxUser.getWxUser();
+        log.info("用户信息:{}", loginWxUserWxUser.toString());
+        WxUser wxUser = wxUserMapper.selectWxUserById(loginWxUserWxUser.getId());
         wxCreditMapper.insertWxCreditUser(wxUser.getWxOpenid(), creditDto.getId(), new Date());
+        log.info("用户积分详情:{}, 添加积分:{}", wxUser.getPoints(), creditDto.getCreditNum());
         wxUser.setPoints(wxUser.getPoints() + creditDto.getCreditNum());
         int result = wxUserMapper.updateWxUser(wxUser);
         return result > 0;
@@ -110,4 +117,50 @@ public class WxPersonCenterServiceImpl implements IWxPersonCenterService {
         WxUser wxUser = loginWxUser.getWxUser();
         return wxCreditMapper.selectWxCreditByOpenId(wxUser.getWxOpenid());
     }
+
+    @Override
+    public String conCredit(String cash) {
+        String result = "兑换成功";
+        LoginWxUser loginWxUser = SecurityUtils.getLoginWxUser();
+        if (loginWxUser == null) {
+            throw new SecurityException("请登录");
+        }
+        WxUser loginWxUserWxUser = loginWxUser.getWxUser();
+        WxUser wxUser = wxUserMapper.selectWxUserById(loginWxUserWxUser.getId());
+        if (wxUser.getPoints() < 200) {
+            log.error("积分不足:{}", wxUser.getPoints());
+            throw new RuntimeException("积分不足");
+        }
+        wxUser.setVipStartTime(null == wxUser.getVipStartTime() ? LocalDate.now(ZoneId.of("Asia/Shanghai")) : wxUser.getVipStartTime());
+        switch (cash) {
+            case "month":
+                wxUser.setPoints(wxUser.getPoints() - 200);
+                wxUser.setVipLv(1);
+                wxUser.setVipEndTime(wxUser.getVipStartTime().plusMonths(1));
+                break;
+            case "quarter":
+                if (wxUser.getPoints() < 500) {
+                    result = "兑换失败";
+                    break;
+                }
+                wxUser.setPoints(wxUser.getPoints() - 500);
+                wxUser.setVipLv(2);
+                wxUser.setVipEndTime(wxUser.getVipStartTime().plusMonths(3));
+                break;
+            case "year":
+                if (wxUser.getPoints() < 1800) {
+                    result = "兑换失败";
+                    break;
+                }
+                wxUser.setPoints(wxUser.getPoints() - 1800);
+                wxUser.setVipLv(3);
+                wxUser.setVipEndTime(wxUser.getVipStartTime().plusMonths(12));
+                break;
+            default:
+                break;
+        }
+
+        wxUserMapper.updateWxUser(wxUser);
+        return result;
+    }
 }

+ 1 - 5
ruoyi-wx/src/main/resources/mapper/web/WxHomeMapper.xml

@@ -19,11 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                         rc.city as city, rs.images as images, skip_link as skipLink
         from rec_stores rs
             left join rec_city rc on rc.id = rs.city_id
-        <where>
-            <foreach collection="ids" item="item" index="index"  open="(" separator="or" close=")">
-                commondity_id LIKE CONCAT('%',#{item},'%')
-            </foreach>
-        </where>
+        where commondity_id = #{ids}
     </select>
     <select id="selectLotteryDisplay" resultType="java.lang.String">
         select config_value from sys_config where config_key = #{key}