mirror of
				https://github.com/suyiiyii/SIMS.git
				synced 2025-11-04 07:24:53 +08:00 
			
		
		
		
	cherry
This commit is contained in:
		
							parent
							
								
									199d4010e5
								
							
						
					
					
						commit
						8f83ee268a
					
				@ -22,6 +22,17 @@ import top.suyiiyii.sims.service.NotificationService;
 | 
			
		||||
import top.suyiiyii.sims.service.RecordService;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import top.suyiiyii.sims.common.AuthAccess;
 | 
			
		||||
import top.suyiiyii.sims.common.Result;
 | 
			
		||||
import top.suyiiyii.sims.dto.CommonResponse;
 | 
			
		||||
import top.suyiiyii.sims.dto.RecordDto;
 | 
			
		||||
import top.suyiiyii.sims.dto.RevokeRequestDto;
 | 
			
		||||
import top.suyiiyii.sims.entity.RevokeRequest;
 | 
			
		||||
import top.suyiiyii.sims.exception.ServiceException;
 | 
			
		||||
import top.suyiiyii.sims.service.CategoryService;
 | 
			
		||||
import top.suyiiyii.sims.service.NotificationService;
 | 
			
		||||
import top.suyiiyii.sims.service.RecordService;
 | 
			
		||||
import top.suyiiyii.sims.service.RevokedService;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										32
									
								
								src/main/java/top/suyiiyii/sims/dto/RevokeRequestDto.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								src/main/java/top/suyiiyii/sims/dto/RevokeRequestDto.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,32 @@
 | 
			
		||||
package top.suyiiyii.sims.dto;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.IdType;
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.TableId;
 | 
			
		||||
import lombok.AllArgsConstructor;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.NoArgsConstructor;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author tortoise
 | 
			
		||||
 * @Date 2024/9/8 21:34
 | 
			
		||||
 * @PackageName:top.suyiiyii.sims.dto
 | 
			
		||||
 * @ClassName: RevokeRequestDto
 | 
			
		||||
 * @Description: TODO
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@AllArgsConstructor
 | 
			
		||||
@NoArgsConstructor
 | 
			
		||||
public class RevokeRequestDto {
 | 
			
		||||
    private Integer id;
 | 
			
		||||
    private String categoryName;
 | 
			
		||||
    private String subCategoryName;
 | 
			
		||||
    private Integer userId;
 | 
			
		||||
    private String reason;
 | 
			
		||||
    private Long requestTime;
 | 
			
		||||
    private String status;
 | 
			
		||||
    //处理时间
 | 
			
		||||
    private Long handleTime;
 | 
			
		||||
    private String adminRemark;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -27,7 +27,7 @@ public class Notification {
 | 
			
		||||
    private String title;
 | 
			
		||||
    private String content;
 | 
			
		||||
    private Integer senderId;
 | 
			
		||||
    private LocalDateTime createdAt;
 | 
			
		||||
    private Long createdAt;
 | 
			
		||||
    private String status;
 | 
			
		||||
    private String type;
 | 
			
		||||
    private Integer targetUserId;
 | 
			
		||||
 | 
			
		||||
@ -27,10 +27,10 @@ public class RevokeRequest {
 | 
			
		||||
    private Integer recordId;
 | 
			
		||||
    private Integer userId;
 | 
			
		||||
    private String reason;
 | 
			
		||||
    private LocalDateTime requestTime;
 | 
			
		||||
    private Long requestTime;
 | 
			
		||||
    private String status;
 | 
			
		||||
    //处理时间
 | 
			
		||||
    private LocalDateTime handleTime;
 | 
			
		||||
    private Long handleTime;
 | 
			
		||||
    private String adminRemark;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -31,7 +31,7 @@ public class RevokedRecord {
 | 
			
		||||
    // 撤销原因
 | 
			
		||||
    private String reason;
 | 
			
		||||
    // 撤销时间
 | 
			
		||||
    private LocalDateTime revokedTime;
 | 
			
		||||
    private Long revokedTime;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,15 +1,15 @@
 | 
			
		||||
package top.suyiiyii.sims.mapper;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
			
		||||
import top.suyiiyii.sims.entity.RevokedRecord;
 | 
			
		||||
import top.suyiiyii.sims.entity.Notification;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author tortoise
 | 
			
		||||
 * @Date 2024/9/6 10:04
 | 
			
		||||
 * @Date 2024/9/8 20:50
 | 
			
		||||
 * @PackageName:top.suyiiyii.sims.mapper
 | 
			
		||||
 * @ClassName: MpRevRecordMapper
 | 
			
		||||
 * @ClassName: MpNotificationMapper
 | 
			
		||||
 * @Description: TODO
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
public interface MpRevRecordMapper extends BaseMapper<RevokedRecord> {
 | 
			
		||||
public interface MpNotificationMapper extends BaseMapper<Notification> {
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,21 @@
 | 
			
		||||
package top.suyiiyii.sims.mapper;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
			
		||||
import org.apache.ibatis.annotations.Select;
 | 
			
		||||
import top.suyiiyii.sims.entity.RevokeRequest;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author tortoise
 | 
			
		||||
 * @Date 2024/9/6 10:04
 | 
			
		||||
 * @PackageName:top.suyiiyii.sims.mapper
 | 
			
		||||
 * @ClassName: MpRevRequestMapper
 | 
			
		||||
 * @Description: TODO
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
public interface MpRevRequestMapper extends BaseMapper<RevokeRequest> {
 | 
			
		||||
    @Select("select * from revoke_request limit #{page},#{size}")
 | 
			
		||||
    List<RevokeRequest> selectList(int page, int size);
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,33 @@
 | 
			
		||||
package top.suyiiyii.sims.service;
 | 
			
		||||
 | 
			
		||||
import org.checkerframework.checker.units.qual.A;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import top.suyiiyii.sims.entity.Notification;
 | 
			
		||||
import top.suyiiyii.sims.entity.RevokeRequest;
 | 
			
		||||
import top.suyiiyii.sims.mapper.MpNotificationMapper;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author tortoise
 | 
			
		||||
 * @Date 2024/9/8 20:50
 | 
			
		||||
 * @PackageName:top.suyiiyii.sims.service
 | 
			
		||||
 * @ClassName: NotificationService
 | 
			
		||||
 * @Description: TODO
 | 
			
		||||
 * @Version 1.0
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class NotificationService {
 | 
			
		||||
    @Autowired
 | 
			
		||||
    MpNotificationMapper mpNotificationMapper;
 | 
			
		||||
    public void addNotification(RevokeRequest revokeRequest) {
 | 
			
		||||
        Notification notification = new Notification();
 | 
			
		||||
        notification.setSenderId(revokeRequest.getUserId());
 | 
			
		||||
        notification.setTitle("申请撤销");
 | 
			
		||||
        notification.setContent(revokeRequest.getReason());
 | 
			
		||||
        notification.setType("申请");
 | 
			
		||||
        notification.setCreatedAt(revokeRequest.getRequestTime());
 | 
			
		||||
        notification.setStatus("未处理");
 | 
			
		||||
        notification.setTargetUserId(-1);
 | 
			
		||||
        mpNotificationMapper.insert(notification);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -4,6 +4,7 @@ package top.suyiiyii.sims.service;
 | 
			
		||||
import org.modelmapper.ModelMapper;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
 | 
			
		||||
import top.suyiiyii.sims.dto.RecordDto;
 | 
			
		||||
import top.suyiiyii.sims.entity.Record;
 | 
			
		||||
import top.suyiiyii.sims.entity.RewardPunishmentCategory;
 | 
			
		||||
@ -63,7 +64,7 @@ public class RecordService {
 | 
			
		||||
 | 
			
		||||
        //查看数据库里面是否有这个类别
 | 
			
		||||
        String subCategoryName = categoryMapper.IsSubCategoryName(recordDto.getSubCategoryName());
 | 
			
		||||
        if (subCategoryName == null) {
 | 
			
		||||
        if(subCategoryName == null) {
 | 
			
		||||
            //没有这个类别就加上
 | 
			
		||||
            categoryMapper.addsubcategory(recordDto.getCategoryName(), recordDto.getSubCategoryName());
 | 
			
		||||
        }
 | 
			
		||||
@ -75,11 +76,12 @@ public class RecordService {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public List<Record> getRecordsLike(int page, int size, Integer studentId, String userGroup, String grade) {
 | 
			
		||||
        return recordMapper.getRecordsLike(page, size, studentId, userGroup, grade);
 | 
			
		||||
        return recordMapper.getRecordsLike(page, size, studentId, userGroup,grade);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public List<Integer> getSidByCategoryId(Integer i) {
 | 
			
		||||
 | 
			
		||||
    public  List<Integer> getSidByCategoryId(Integer i) {
 | 
			
		||||
        return recordMapper.getSidByCategoryId(i);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -117,4 +119,8 @@ public class RecordService {
 | 
			
		||||
        Boolean isRevoked=true;
 | 
			
		||||
        recordMapper.Rupdate(id, reason,isRevoked,revokeReason,userId);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Integer getCategoryIdById(Integer  id) {
 | 
			
		||||
        return recordMapper.getCategoryIdById(id);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,6 @@ import top.suyiiyii.sims.mapper.RoleMapper;
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class RevokedService {
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    MpRevRequestMapper mpRevRequestMapper;
 | 
			
		||||
@Autowired
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user