فهرست منبع

白名单功能调整

dzx 3 ماه پیش
والد
کامیت
fb849977d6

+ 15 - 0
src/main/java/com/xjrsoft/module/base/controller/WhitelistManagementController.java

@@ -3,11 +3,13 @@ package com.xjrsoft.module.base.controller;
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.hutool.core.bean.BeanUtil;
 import com.alibaba.excel.EasyExcel;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.module.base.dto.AddWhitelistManagementDto;
+import com.xjrsoft.module.base.dto.SetWhitelistEndTimeDto;
 import com.xjrsoft.module.base.dto.UpdateWhitelistManagementDto;
 import com.xjrsoft.module.base.dto.WhitelistManagementPageDto;
 import com.xjrsoft.module.base.entity.TreeNode;
@@ -87,6 +89,19 @@ public class WhitelistManagementController {
         return RT.ok(isSuccess);
     }
 
+    @PostMapping("/set-endtime-batch")
+    @ApiOperation(value = "批量设置结束时间")
+    @SaCheckPermission("whitelistmanagement:add")
+    public RT<Boolean> setEndtimeBatch(@Valid @RequestBody SetWhitelistEndTimeDto dto){
+        List<WhitelistManagement> list = whitelistManagementService.listByIds(dto.getIds());
+        for (WhitelistManagement whitelistManagement : list) {
+            whitelistManagement.setIsTemporary(1);
+            whitelistManagement.setEndTime(dto.getEndTime());
+        }
+        boolean updated = whitelistManagementService.updateBatchById(list);
+        return RT.ok(updated);
+    }
+
     @PutMapping
     @ApiOperation(value = "修改白名单管理")
     @SaCheckPermission("whitelistmanagement:edit")

+ 4 - 9
src/main/java/com/xjrsoft/module/base/dto/AddWhitelistManagementDto.java

@@ -2,14 +2,9 @@ package com.xjrsoft.module.base.dto;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonFormat;
 
-import java.time.LocalTime;
-import java.time.LocalDateTime;
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Date;
+import java.io.Serializable;
+import java.time.LocalDate;
 
 
 
@@ -49,9 +44,9 @@ public class AddWhitelistManagementDto implements Serializable {
     private Integer isTemporary;
 
     @ApiModelProperty("临时使用开始时间")
-    private LocalDateTime startTime;
+    private LocalDate startTime;
 
     @ApiModelProperty("临时使用结束时间")
-    private LocalDateTime endTime;
+    private LocalDate endTime;
 
 }

+ 34 - 0
src/main/java/com/xjrsoft/module/base/dto/SetWhitelistEndTimeDto.java

@@ -0,0 +1,34 @@
+package com.xjrsoft.module.base.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.List;
+
+
+/**
+* @title: 白名单管理
+* @Author brealinxx
+* @Date: 2024-06-24
+* @Version 1.0
+*/
+@Data
+public class SetWhitelistEndTimeDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 用户id
+    */
+    @ApiModelProperty("用户id")
+    private List<Long> ids;
+
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @ApiModelProperty("临时使用结束时间")
+    private LocalDate endTime;
+
+}

+ 3 - 3
src/main/java/com/xjrsoft/module/base/entity/WhitelistManagement.java

@@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
-import java.time.LocalDateTime;
+import java.time.LocalDate;
 import java.util.Date;
 
 
@@ -83,10 +83,10 @@ public class WhitelistManagement implements Serializable {
     private Integer isTemporary;
 
     @ApiModelProperty("临时使用开始时间")
-    private LocalDateTime startTime;
+    private LocalDate startTime;
 
     @ApiModelProperty("临时使用结束时间")
-    private LocalDateTime endTime;
+    private LocalDate endTime;
 
 
 }

+ 2 - 1
src/main/java/com/xjrsoft/module/student/vo/WhitelistInfoVo.java

@@ -3,6 +3,7 @@ package com.xjrsoft.module.student.vo;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 
 /**
@@ -18,7 +19,7 @@ public class WhitelistInfoVo {
     public Integer whitelistStatus;
 
     @ApiModelProperty("截止日期")
-    private LocalDateTime endTime;
+    private LocalDate endTime;
 
     @ApiModelProperty("是否临时性的(1:是 0:否)")
     private Integer isTemporary;

+ 1 - 1
src/main/resources/application.yml

@@ -5,7 +5,7 @@ server:
 spring:
   # 环 io境 dev|pre|prod
   profiles:
-    active: dev
+    active: pre
   # jackson时间格式化
   jackson:
     time-zone: GMT+8