Browse Source

台州免费领取VIP

花田厝 3 months ago
parent
commit
716641c947

+ 13 - 1
jsjp-admin/src/main/java/com/miaxis/app/controller/gzpt/GzptUserInfoController.java

@@ -8,6 +8,8 @@ import com.miaxis.common.core.domain.entity.UserInfo;
 import com.miaxis.common.core.page.ResponsePageInfo;
 import com.miaxis.common.exception.CustomException;
 import com.miaxis.common.utils.SecurityUtils;
+import com.miaxis.free.domain.FreeUserLog;
+import com.miaxis.free.service.IFreeUserLogService;
 import com.miaxis.newgzpt.domain.GzptUserInfo;
 import com.miaxis.newgzpt.dto.GzptUserInfoDTO;
 import com.miaxis.newgzpt.dto.GzptVideoVipDTO;
@@ -56,6 +58,9 @@ public class GzptUserInfoController extends BaseController {
     @Autowired
     private IUserVipService userVipService;
 
+    @Autowired
+    private IFreeUserLogService freeUserLogService;
+
     /**
      * 获取用户id获取详细信息
      */
@@ -140,7 +145,6 @@ public class GzptUserInfoController extends BaseController {
         GzptUserInfo gzptUserInfo = userInfoService.getInfoById(gzptVideoVipDTO.getUserId());
         //清除会员信息
         UserVip userVip = userVipService.getUserVipByUserId(gzptVideoVipDTO.getUserId());
-
         long threeMonthLong = 1000 * 60 * 60 * 24 * 90l;
         Date now = new Date();
 
@@ -156,6 +160,14 @@ public class GzptUserInfoController extends BaseController {
             userVip.setSubject1(threeMonth);
             userVip.setSubject4(threeMonth);
             userVipService.updateById(userVip);
+            //插入获取日志
+            FreeUserLog freeUserLog = new FreeUserLog();
+            freeUserLog.setJxbh(gzptUserInfo.getSchool());
+            freeUserLog.setUserName(gzptUserInfo.getUserName());
+            freeUserLog.setLogincode(gzptUserInfo.getLogincode());
+            freeUserLog.setUserId(gzptUserInfo.getId());
+            freeUserLog.setSchoolName(gzptUserInfo.getSchoolName());
+            freeUserLogService.save(freeUserLog);
             return Response.success();
         }
 

+ 14 - 20
jsjp-admin/src/main/java/com/miaxis/app/controller/userInfo/FreeSchVipController.java

@@ -3,17 +3,14 @@ package com.miaxis.app.controller.userInfo;
 import com.miaxis.common.constant.Constants;
 import com.miaxis.common.core.controller.BaseController;
 import com.miaxis.common.core.domain.Response;
-import com.miaxis.common.core.page.ResponsePageInfo;
 import com.miaxis.free.domain.FreeSchVip;
 import com.miaxis.free.service.IFreeSchVipService;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * 【免费领取VIP的驾校】Controller
@@ -28,20 +25,9 @@ public class FreeSchVipController extends BaseController {
     @Autowired
     private IFreeSchVipService freeSchVipService;
 
-    /**
-     * 查询免费领取VIP的驾校列表
-     */
-    @GetMapping("/list")
-    @ApiOperation("查询免费领取VIP的驾校列表")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "pageNum", value = "当前页码", dataType = "int", paramType = "query", required = false),
-            @ApiImplicitParam(name = "pageSize", value = "每页数据量", dataType = "int", paramType = "query", required = false),
-    })
-    public ResponsePageInfo<FreeSchVip> list(@ModelAttribute FreeSchVip freeSchVip) {
-        startPage();
-        List<FreeSchVip> list = freeSchVipService.selectFreeSchVipList(freeSchVip);
-        return toResponsePageInfo(list);
-    }
+
+
+
 
 
     /**
@@ -61,4 +47,12 @@ public class FreeSchVipController extends BaseController {
     }
 
 
+    @PostMapping("/clearAllFreeSchVipCache")
+    @ApiOperation("清除免费领导VIP的驾校缓存")
+    public Response clearAllFreeSchVipCache() {
+        freeSchVipService.clearAllFreeSchVipCache();
+        return new Response<>(200, "已清除免费领导VIP的驾校缓存");
+    }
+
+
 }

+ 3 - 1
jsjp-admin/src/main/java/com/miaxis/app/controller/userInfo/UserVipController.java

@@ -9,6 +9,7 @@ import java.security.spec.PKCS8EncodedKeySpec;
 import java.util.*;
 
 import com.miaxis.common.utils.PrivateKeyUtil;
+import com.miaxis.free.service.IFreeUserLogService;
 import com.miaxis.newgzpt.domain.GzptVideoVip;
 import com.miaxis.newgzpt.vo.GzptVideoVipVO;
 import com.miaxis.userInfo.dto.UserVipDTO;
@@ -48,7 +49,8 @@ public class UserVipController extends BaseController {
     @Autowired
     private IUserVipService userVipService;
 
-
+    @Autowired
+    private IFreeUserLogService freeUserLogService;
     /**
      * 获取会员信息详细信息
      *

+ 118 - 0
jsjp-service/src/main/java/com/miaxis/free/domain/FreeUserLog.java

@@ -0,0 +1,118 @@
+package com.miaxis.free.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.miaxis.common.annotation.Excel;
+import com.miaxis.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.miaxis.common.core.domain.BaseBusinessEntity;
+import lombok.Data;
+/**
+ * 免费领取VIP的记录对象 free_user_log
+ *
+ * @author miaxis
+ * @date 2025-03-06
+ */
+@Data
+@TableName("free_user_log")
+@ApiModel(value = "FreeUserLog", description = "免费领取VIP的记录对象 free_user_log")
+public class FreeUserLog extends BaseBusinessEntity{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    @TableId(value = "id")
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    /** 用户ID */
+    @Excel(name = "用户ID")
+    @TableField("user_id")
+    @ApiModelProperty(value = "用户ID")
+    private Long userId;
+
+    /** 登录身份证号 */
+    @Excel(name = "登录身份证号")
+    @TableField("logincode")
+    @ApiModelProperty(value = "登录身份证号")
+    private String logincode;
+
+    /** 用户姓名 */
+    @Excel(name = "用户姓名")
+    @TableField("user_name")
+    @ApiModelProperty(value = "用户姓名")
+    private String userName;
+
+    /** 驾校编号 */
+    @Excel(name = "驾校编号")
+    @TableField("jxbh")
+    @ApiModelProperty(value = "驾校编号")
+    private String jxbh;
+
+    /** 驾校名称 */
+    @Excel(name = "驾校名称")
+    @TableField("school_name")
+    @ApiModelProperty(value = "驾校名称")
+    private String schoolName;
+
+    public void setId(Long id){
+        this.id = id;
+    }
+
+    public Long getId(){
+        return id;
+    }
+    public void setUserId(Long userId){
+        this.userId = userId;
+    }
+
+    public Long getUserId(){
+        return userId;
+    }
+    public void setLogincode(String logincode){
+        this.logincode = logincode;
+    }
+
+    public String getLogincode(){
+        return logincode;
+    }
+    public void setUserName(String userName){
+        this.userName = userName;
+    }
+
+    public String getUserName(){
+        return userName;
+    }
+    public void setJxbh(String jxbh){
+        this.jxbh = jxbh;
+    }
+
+    public String getJxbh(){
+        return jxbh;
+    }
+    public void setSchoolName(String schoolName){
+        this.schoolName = schoolName;
+    }
+
+    public String getSchoolName(){
+        return schoolName;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("userId", getUserId())
+            .append("logincode", getLogincode())
+            .append("userName", getUserName())
+            .append("jxbh", getJxbh())
+            .append("schoolName", getSchoolName())
+            .append("createTime", getCreateTime())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 22 - 0
jsjp-service/src/main/java/com/miaxis/free/mapper/FreeUserLogMapper.java

@@ -0,0 +1,22 @@
+package com.miaxis.free.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.miaxis.free.domain.FreeUserLog;
+
+/**
+ * 免费领取VIP的记录Mapper接口
+ *
+ * @author miaxis
+ * @date 2025-03-06
+ */
+public interface FreeUserLogMapper extends BaseMapper<FreeUserLog> {
+    /**
+     * 查询免费领取VIP的记录列表
+     *
+     * @param freeUserLog 免费领取VIP的记录
+     * @return 免费领取VIP的记录集合
+     */
+    public List<FreeUserLog> selectFreeUserLogList(FreeUserLog freeUserLog);
+
+}

+ 2 - 0
jsjp-service/src/main/java/com/miaxis/free/service/IFreeSchVipService.java

@@ -20,4 +20,6 @@ public interface IFreeSchVipService extends IService<FreeSchVip>{
     public List<FreeSchVip> selectFreeSchVipList(FreeSchVip freeSchVip);
 
     FreeSchVip isExistFreeSch(String jxbh);
+
+    void clearAllFreeSchVipCache();
 }

+ 21 - 0
jsjp-service/src/main/java/com/miaxis/free/service/IFreeUserLogService.java

@@ -0,0 +1,21 @@
+package com.miaxis.free.service;
+
+import java.util.List;
+import com.miaxis.free.domain.FreeUserLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 免费领取VIP的记录Service接口
+ *
+ * @author miaxis
+ * @date 2025-03-06
+ */
+public interface IFreeUserLogService extends IService<FreeUserLog>{
+    /**
+     * 查询免费领取VIP的记录列表
+     *
+     * @param freeUserLog 免费领取VIP的记录
+     * @return 免费领取VIP的记录集合
+     */
+    public List<FreeUserLog> selectFreeUserLogList(FreeUserLog freeUserLog);
+}

+ 18 - 1
jsjp-service/src/main/java/com/miaxis/free/service/impl/FreeSchVipServiceImpl.java

@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.miaxis.free.domain.FreeSchVip;
 import com.miaxis.free.mapper.FreeSchVipMapper;
 import com.miaxis.free.service.IFreeSchVipService;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.stereotype.Service;
-
+import org.springframework.cache.annotation.Cacheable;
 import java.util.List;
 
 /**
@@ -16,6 +18,7 @@ import java.util.List;
  * @date 2025-03-04
  */
 @Service
+@Slf4j
 public class FreeSchVipServiceImpl extends ServiceImpl<FreeSchVipMapper, FreeSchVip> implements IFreeSchVipService {
     @Autowired
     private FreeSchVipMapper freeSchVipMapper;
@@ -32,7 +35,21 @@ public class FreeSchVipServiceImpl extends ServiceImpl<FreeSchVipMapper, FreeSch
     }
 
     @Override
+    @Cacheable(value = "freeSchVipCache", key = "#jxbh")
     public FreeSchVip isExistFreeSch(String jxbh) {
         return freeSchVipMapper.isExistFreeSch(jxbh);
     }
+
+
+    /**
+     * 该方法用于清除名为 freeSchVipCache 的所有缓存条目。
+     * 通过 @CacheEvict 注解实现,注解参数 allEntries = true
+     * 表示清除所有缓存项。方法体内记录了一条日志信息,表示缓存已清除。
+     */
+    @CacheEvict(value = "freeSchVipCache", allEntries = true)
+    public void clearAllFreeSchVipCache() {
+        // 方法体内不需要写任何与缓存相关的代码
+        // 这里可以写一些业务逻辑,比如记录日志等
+        log.info("Cleared all cache entries for freeSchVipCache");
+    }
 }

+ 36 - 0
jsjp-service/src/main/java/com/miaxis/free/service/impl/FreeUserLogServiceImpl.java

@@ -0,0 +1,36 @@
+package com.miaxis.free.service.impl;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.miaxis.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.apache.commons.lang3.StringUtils;
+import com.miaxis.free.mapper.FreeUserLogMapper;
+import com.miaxis.free.domain.FreeUserLog;
+import com.miaxis.free.service.IFreeUserLogService;
+
+/**
+ * 免费领取VIP的记录Service业务层处理
+ *
+ * @author miaxis
+ * @date 2025-03-06
+ */
+@Service
+public class FreeUserLogServiceImpl extends ServiceImpl<FreeUserLogMapper, FreeUserLog> implements IFreeUserLogService {
+    @Autowired
+    private FreeUserLogMapper freeUserLogMapper;
+
+    /**
+     * 查询免费领取VIP的记录列表
+     *
+     * @param freeUserLog 免费领取VIP的记录
+     * @return 免费领取VIP的记录
+     */
+    @Override
+    public List<FreeUserLog> selectFreeUserLogList(FreeUserLog freeUserLog){
+        return freeUserLogMapper.selectFreeUserLogList(freeUserLog);
+    }
+}

+ 33 - 0
jsjp-service/src/main/resources/mapper/free/FreeUserLogMapper.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.miaxis.free.mapper.FreeUserLogMapper">
+
+    <resultMap type="FreeUserLog" id="FreeUserLogResult">
+        <result property="id"    column="id"    />
+        <result property="userId"    column="user_id"    />
+        <result property="logincode"    column="logincode"    />
+        <result property="userName"    column="user_name"    />
+        <result property="jxbh"    column="jxbh"    />
+        <result property="schoolName"    column="school_name"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectFreeUserLogVo">
+        select * from free_user_log
+    </sql>
+
+    <select id="selectFreeUserLogList" parameterType="FreeUserLog" resultMap="FreeUserLogResult">
+        <include refid="selectFreeUserLogVo"/>
+        <where>
+            <if test="userId != null "> and user_id = #{userId}</if>
+            <if test="logincode != null  and logincode != ''"> and logincode = #{logincode}</if>
+            <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
+            <if test="jxbh != null  and jxbh != ''"> and jxbh = #{jxbh}</if>
+            <if test="schoolName != null  and schoolName != ''"> and school_name like concat('%', #{schoolName}, '%')</if>
+        </where>
+    </select>
+
+</mapper>