reformat code

dev-active
lensfrex 2 years ago
parent a3dedc2c98
commit 5bbf9113c8
Signed by: lensfrex
GPG Key ID: 0F69A0A2FBEE98A0
  1. 2
      src/main/java/net/lensfrex/dscape/ServerMain.java
  2. 4
      src/main/java/net/lensfrex/dscape/auth/StpInterfaceImpl.java
  3. 13
      src/main/java/net/lensfrex/dscape/dao/entity/BlackList.java
  4. 10
      src/main/java/net/lensfrex/dscape/dao/entity/ComputeHistory.java
  5. 11
      src/main/java/net/lensfrex/dscape/dao/entity/PatientData.java
  6. 11
      src/main/java/net/lensfrex/dscape/dao/entity/RegisterApplies.java
  7. 11
      src/main/java/net/lensfrex/dscape/dao/entity/RolePermission.java
  8. 11
      src/main/java/net/lensfrex/dscape/dao/entity/UserBasic.java
  9. 11
      src/main/java/net/lensfrex/dscape/dao/entity/UserRole.java
  10. 8
      src/main/java/net/lensfrex/dscape/dao/mapper/BlackListMapper.java
  11. 2
      src/main/java/net/lensfrex/dscape/dao/mapper/ComputeHistoryMapper.java
  12. 2
      src/main/java/net/lensfrex/dscape/dao/mapper/PatientDataMapper.java
  13. 8
      src/main/java/net/lensfrex/dscape/dao/mapper/RegisterAppliesMapper.java
  14. 8
      src/main/java/net/lensfrex/dscape/dao/mapper/RolePermissionMapper.java
  15. 8
      src/main/java/net/lensfrex/dscape/dao/mapper/UserBasicMapper.java
  16. 8
      src/main/java/net/lensfrex/dscape/dao/mapper/UserRoleMapper.java
  17. 6
      src/main/java/net/lensfrex/dscape/dao/service/BlackListService.java
  18. 2
      src/main/java/net/lensfrex/dscape/dao/service/ComputeHistoryService.java
  19. 2
      src/main/java/net/lensfrex/dscape/dao/service/PatientDataService.java
  20. 6
      src/main/java/net/lensfrex/dscape/dao/service/RegisterAppliesService.java
  21. 6
      src/main/java/net/lensfrex/dscape/dao/service/RolePermissionService.java
  22. 7
      src/main/java/net/lensfrex/dscape/dao/service/UserBasicService.java
  23. 5
      src/main/java/net/lensfrex/dscape/dao/service/UserRoleService.java
  24. 3
      src/main/java/net/lensfrex/dscape/dao/service/impl/RolePermissionServiceImpl.java
  25. 2
      src/main/java/net/lensfrex/dscape/dao/service/impl/UserRoleServiceImpl.java
  26. 3
      src/main/java/net/lensfrex/dscape/dto/request/UserLoginRequestBody.java
  27. 1
      src/main/java/net/lensfrex/dscape/dto/response/data/user/RegisterResponseBody.java
  28. 32
      src/main/java/net/lensfrex/dscape/dto/response/general/Response.java
  29. 3
      src/main/java/net/lensfrex/dscape/dto/response/general/ResponseCode.java
  30. 3
      src/main/java/net/lensfrex/dscape/enums/user/BlackListTypeEnum.java
  31. 3
      src/main/java/net/lensfrex/dscape/enums/user/UserRoleEnum.java
  32. 12
      src/main/java/net/lensfrex/dscape/exception/handler/GlobalExceptionHandler.java
  33. 5
      src/main/java/net/lensfrex/dscape/utils/ObjectJsonSerializer.java
  34. 2
      src/main/java/net/lensfrex/dscape/utils/validate/TextCheckUtil.java
  35. 2
      src/main/java/net/lensfrex/dscape/web/controllers/user/UserController.java
  36. 2
      src/main/java/net/lensfrex/dscape/web/controllers/user/admin/AdminController.java
  37. 3
      src/main/java/net/lensfrex/dscape/web/service/data/HistoryService.java
  38. 4
      src/main/java/net/lensfrex/dscape/web/service/user/AdminService.java
  39. 3
      src/main/java/net/lensfrex/dscape/web/service/user/UserService.java

@ -4,8 +4,6 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
@SpringBootApplication @SpringBootApplication
@MapperScan("net.lensfrex.dscape.dao.mapper") @MapperScan("net.lensfrex.dscape.dao.mapper")

@ -1,13 +1,9 @@
package net.lensfrex.dscape.auth; package net.lensfrex.dscape.auth;
import cn.dev33.satoken.stp.StpInterface; import cn.dev33.satoken.stp.StpInterface;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.lensfrex.dscape.dao.entity.RolePermission;
import net.lensfrex.dscape.dao.entity.UserRole;
import net.lensfrex.dscape.dao.service.RolePermissionService; import net.lensfrex.dscape.dao.service.RolePermissionService;
import net.lensfrex.dscape.dao.service.UserRoleService; import net.lensfrex.dscape.dao.service.UserRoleService;
import net.lensfrex.dscape.dao.service.impl.UserRoleServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;

@ -1,16 +1,16 @@
package net.lensfrex.dscape.dao.entity; package net.lensfrex.dscape.dao.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data; import lombok.Data;
import java.util.Date;
import java.util.List;
import java.io.Serializable; import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType; import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
/** /**
* @description black_list
* @author lensfrex * @author lensfrex
* @description black_list
* @date 2022-08-19 * @date 2022-08-19
*/ */
@Data @Data
@ -55,5 +55,6 @@ public class BlackList implements Serializable {
@TableLogic @TableLogic
private int isDeleted; private int isDeleted;
public BlackList() {} public BlackList() {
}
} }

@ -1,13 +1,14 @@
package net.lensfrex.dscape.dao.entity; package net.lensfrex.dscape.dao.entity;
import lombok.Data;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.io.Serializable;
/** /**
* @description compute_history
* @author lensfrex * @author lensfrex
* @description compute_history
* @date 2022-08-17 * @date 2022-08-17
*/ */
@Data @Data
@ -31,5 +32,6 @@ public class ComputeHistory implements Serializable {
*/ */
private Long rid; private Long rid;
public ComputeHistory() {} public ComputeHistory() {
}
} }

@ -1,16 +1,16 @@
package net.lensfrex.dscape.dao.entity; package net.lensfrex.dscape.dao.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
/** /**
* @description patient_data
* @author lensfrex * @author lensfrex
* @description patient_data
* @date 2022-08-17 * @date 2022-08-17
*/ */
@Data @Data
@ -65,5 +65,6 @@ public class PatientData implements Serializable {
@TableLogic @TableLogic
private int isDeleted; private int isDeleted;
public PatientData() {} public PatientData() {
}
} }

@ -1,16 +1,16 @@
package net.lensfrex.dscape.dao.entity; package net.lensfrex.dscape.dao.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime;
import java.io.Serializable; import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType; import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
/** /**
* @description register_applies
* @author lensfrex * @author lensfrex
* @description register_applies
* @date 2022-08-18 * @date 2022-08-18
*/ */
@Data @Data
@ -55,5 +55,6 @@ public class RegisterApplies implements Serializable {
@TableLogic @TableLogic
private int isDeleted; private int isDeleted;
public RegisterApplies() {} public RegisterApplies() {
}
} }

@ -1,16 +1,16 @@
package net.lensfrex.dscape.dao.entity; package net.lensfrex.dscape.dao.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime;
import java.io.Serializable; import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType; import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
/** /**
* @description role_permission
* @author lensfrex * @author lensfrex
* @description role_permission
* @date 2022-08-17 * @date 2022-08-17
*/ */
@Data @Data
@ -50,5 +50,6 @@ public class RolePermission implements Serializable {
@TableLogic @TableLogic
private int isDeleted; private int isDeleted;
public RolePermission() {} public RolePermission() {
}
} }

@ -1,16 +1,16 @@
package net.lensfrex.dscape.dao.entity; package net.lensfrex.dscape.dao.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime;
import java.io.Serializable; import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType; import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
/** /**
* @description user_basic
* @author lensfrex * @author lensfrex
* @description user_basic
* @date 2022-08-18 * @date 2022-08-18
*/ */
@Data @Data
@ -70,5 +70,6 @@ public class UserBasic implements Serializable {
@TableLogic @TableLogic
private int isDeleted; private int isDeleted;
public UserBasic() {} public UserBasic() {
}
} }

@ -1,16 +1,16 @@
package net.lensfrex.dscape.dao.entity; package net.lensfrex.dscape.dao.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
/** /**
* @description user_role
* @author lensfrex * @author lensfrex
* @description user_role
* @date 2022-08-17 * @date 2022-08-17
*/ */
@Data @Data
@ -50,5 +50,6 @@ public class UserRole implements Serializable {
@TableLogic @TableLogic
private int isDeleted; private int isDeleted;
public UserRole() {} public UserRole() {
}
} }

@ -1,12 +1,12 @@
package net.lensfrex.dscape.dao.mapper; package net.lensfrex.dscape.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import net.lensfrex.dscape.dao.entity.BlackList; import net.lensfrex.dscape.dao.entity.BlackList;
import java.util.List; import org.apache.ibatis.annotations.Mapper;
/** /**
* @description black_listMapper
* @author lensfrex * @author lensfrex
* @description black_listMapper
* @date 2022-08-19 * @date 2022-08-19
*/ */
@Mapper @Mapper

@ -1,8 +1,8 @@
package net.lensfrex.dscape.dao.mapper; package net.lensfrex.dscape.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import net.lensfrex.dscape.dao.entity.ComputeHistory; import net.lensfrex.dscape.dao.entity.ComputeHistory;
import org.apache.ibatis.annotations.Mapper;
/** /**

@ -1,8 +1,8 @@
package net.lensfrex.dscape.dao.mapper; package net.lensfrex.dscape.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import net.lensfrex.dscape.dao.entity.PatientData; import net.lensfrex.dscape.dao.entity.PatientData;
import org.apache.ibatis.annotations.Mapper;
/** /**
* @author lensfrex * @author lensfrex

@ -1,12 +1,12 @@
package net.lensfrex.dscape.dao.mapper; package net.lensfrex.dscape.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import net.lensfrex.dscape.dao.entity.RegisterApplies; import net.lensfrex.dscape.dao.entity.RegisterApplies;
import java.util.List; import org.apache.ibatis.annotations.Mapper;
/** /**
* @description register_appliesMapper
* @author lensfrex * @author lensfrex
* @description register_appliesMapper
* @date 2022-08-18 * @date 2022-08-18
*/ */
@Mapper @Mapper

@ -1,12 +1,12 @@
package net.lensfrex.dscape.dao.mapper; package net.lensfrex.dscape.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import net.lensfrex.dscape.dao.entity.RolePermission; import net.lensfrex.dscape.dao.entity.RolePermission;
import java.util.List; import org.apache.ibatis.annotations.Mapper;
/** /**
* @description role_permissionMapper
* @author lensfrex * @author lensfrex
* @description role_permissionMapper
* @date 2022-08-17 * @date 2022-08-17
*/ */
@Mapper @Mapper

@ -1,12 +1,12 @@
package net.lensfrex.dscape.dao.mapper; package net.lensfrex.dscape.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import net.lensfrex.dscape.dao.entity.UserBasic; import net.lensfrex.dscape.dao.entity.UserBasic;
import java.util.List; import org.apache.ibatis.annotations.Mapper;
/** /**
* @description user_basicMapper
* @author lensfrex * @author lensfrex
* @description user_basicMapper
* @date 2022-08-18 * @date 2022-08-18
*/ */
@Mapper @Mapper

@ -1,12 +1,12 @@
package net.lensfrex.dscape.dao.mapper; package net.lensfrex.dscape.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import net.lensfrex.dscape.dao.entity.UserRole; import net.lensfrex.dscape.dao.entity.UserRole;
import java.util.List; import org.apache.ibatis.annotations.Mapper;
/** /**
* @description user_roleMapper
* @author lensfrex * @author lensfrex
* @description user_roleMapper
* @date 2022-08-17 * @date 2022-08-17
*/ */
@Mapper @Mapper

@ -1,10 +1,12 @@
package net.lensfrex.dscape.dao.service; package net.lensfrex.dscape.dao.service;
import com.baomidou.mybatisplus.extension.service.IService;
import net.lensfrex.dscape.dao.entity.BlackList; import net.lensfrex.dscape.dao.entity.BlackList;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.IService;
/** /**
* @description black_list服务层
* @author lensfrex * @author lensfrex
* @description black_list服务层
* @date 2022-08-19 * @date 2022-08-19
*/ */
@Service @Service

@ -1,9 +1,9 @@
package net.lensfrex.dscape.dao.service; package net.lensfrex.dscape.dao.service;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.baomidou.mybatisplus.extension.service.IService;
import net.lensfrex.dscape.dao.entity.ComputeHistory; import net.lensfrex.dscape.dao.entity.ComputeHistory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;

@ -1,8 +1,8 @@
package net.lensfrex.dscape.dao.service; package net.lensfrex.dscape.dao.service;
import com.baomidou.mybatisplus.extension.service.IService;
import net.lensfrex.dscape.dao.entity.PatientData; import net.lensfrex.dscape.dao.entity.PatientData;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;

@ -1,10 +1,12 @@
package net.lensfrex.dscape.dao.service; package net.lensfrex.dscape.dao.service;
import com.baomidou.mybatisplus.extension.service.IService;
import net.lensfrex.dscape.dao.entity.RegisterApplies; import net.lensfrex.dscape.dao.entity.RegisterApplies;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.IService;
/** /**
* @description register_applies服务层
* @author lensfrex * @author lensfrex
* @description register_applies服务层
* @date 2022-08-18 * @date 2022-08-18
*/ */
@Service @Service

@ -1,15 +1,15 @@
package net.lensfrex.dscape.dao.service; package net.lensfrex.dscape.dao.service;
import com.baomidou.mybatisplus.extension.service.IService;
import net.lensfrex.dscape.dao.entity.RolePermission; import net.lensfrex.dscape.dao.entity.RolePermission;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;
/** /**
* @description role_permission服务层
* @author lensfrex * @author lensfrex
* @description role_permission服务层
* @date 2022-08-17 * @date 2022-08-17
*/ */
@Service @Service

@ -1,16 +1,15 @@
package net.lensfrex.dscape.dao.service; package net.lensfrex.dscape.dao.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.baomidou.mybatisplus.extension.service.IService;
import net.lensfrex.dscape.dao.entity.UserBasic; import net.lensfrex.dscape.dao.entity.UserBasic;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.function.Function;
/** /**
* @description user_basic服务层
* @author lensfrex * @author lensfrex
* @description user_basic服务层
* @date 2022-08-18 * @date 2022-08-18
*/ */
@Service @Service

@ -1,14 +1,15 @@
package net.lensfrex.dscape.dao.service; package net.lensfrex.dscape.dao.service;
import com.baomidou.mybatisplus.extension.service.IService;
import net.lensfrex.dscape.dao.entity.UserRole; import net.lensfrex.dscape.dao.entity.UserRole;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;
/** /**
* @description user_role服务层
* @author lensfrex * @author lensfrex
* @description user_role服务层
* @date 2022-08-17 * @date 2022-08-17
*/ */
@Service @Service

@ -5,7 +5,6 @@
package net.lensfrex.dscape.dao.service.impl; package net.lensfrex.dscape.dao.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.lensfrex.dscape.dao.entity.RolePermission; import net.lensfrex.dscape.dao.entity.RolePermission;
import net.lensfrex.dscape.dao.mapper.RolePermissionMapper; import net.lensfrex.dscape.dao.mapper.RolePermissionMapper;
@ -44,7 +43,7 @@ public class RolePermissionServiceImpl extends ServiceImpl<RolePermissionMapper,
List<RolePermission> rolePermissionList = this.list(wrapper); List<RolePermission> rolePermissionList = this.list(wrapper);
List<String > permissions = new ArrayList<>(); List<String> permissions = new ArrayList<>();
rolePermissionList.forEach(rolePermission -> permissions.add(rolePermission.getPermission().toString())); rolePermissionList.forEach(rolePermission -> permissions.add(rolePermission.getPermission().toString()));
return permissions; return permissions;

@ -5,12 +5,10 @@
package net.lensfrex.dscape.dao.service.impl; package net.lensfrex.dscape.dao.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.lensfrex.dscape.dao.entity.UserRole; import net.lensfrex.dscape.dao.entity.UserRole;
import net.lensfrex.dscape.dao.mapper.UserRoleMapper; import net.lensfrex.dscape.dao.mapper.UserRoleMapper;
import net.lensfrex.dscape.dao.service.UserRoleService; import net.lensfrex.dscape.dao.service.UserRoleService;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;

@ -1,8 +1,5 @@
package net.lensfrex.dscape.dto.request; package net.lensfrex.dscape.dto.request;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;

@ -4,7 +4,6 @@
package net.lensfrex.dscape.dto.response.data.user; package net.lensfrex.dscape.dto.response.data.user;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
@Data @Data

@ -16,35 +16,35 @@ public class Response<T> {
this.data = data; this.data = data;
} }
public int getCode() { public static <T> Response<T> success(T data) {
return code; return new Response<>(ResponseCode.SUCCESS.getCode(), "success", data);
} }
public String getMessage() { public static <T> Response<T> success() {
return message; return success(null);
} }
public T getData() { public static <T> Response<T> error(int code, String message) {
return data; return new Response<>(code, message, null);
} }
public static<T> Response<T> success(T data) { public static <T> Response<T> error(ResponseCode code, String message) {
return new Response<>(ResponseCode.SUCCESS.getCode(), "success", data); return error(code.getCode(), message);
} }
public static<T> Response<T> success() { public static <T> Response<T> error(ResponseCode code) {
return success(null); return error(code, code.getMessage());
} }
public static<T> Response<T> error(int code, String message) { public int getCode() {
return new Response<>(code, message, null); return code;
} }
public static<T> Response<T> error(ResponseCode code, String message) { public String getMessage() {
return error(code.getCode(), message); return message;
} }
public static<T> Response<T> error(ResponseCode code) { public T getData() {
return error(code, code.getMessage()); return data;
} }
} }

@ -22,8 +22,7 @@ public enum ResponseCode {
USER_NAME_EXISTS(60204, "用户名已经被使用"), USER_NAME_EXISTS(60204, "用户名已经被使用"),
INVITE_CODE_WRONG(60202, "注册码不正确"), INVITE_CODE_WRONG(60202, "注册码不正确"),
INVITE_CODE_REACHED_LIMIT(60401, "注册码已达上限") INVITE_CODE_REACHED_LIMIT(60401, "注册码已达上限");
;
private final int code; private final int code;

@ -7,7 +7,8 @@ import lombok.Getter;
public enum BlackListTypeEnum { public enum BlackListTypeEnum {
IP_ADDRESS(0, "IP地址"), IP_ADDRESS(0, "IP地址"),
UID(1, "用户UID"),; UID(1, "用户UID"),
;
@EnumValue @EnumValue
private final int code; private final int code;

@ -8,9 +8,9 @@ public enum UserRoleEnum {
NORMAL_USER(0, "normal"), NORMAL_USER(0, "normal"),
ADMIN(1, "admin"); ADMIN(1, "admin");
private final static UserRoleEnum[] allEnums = values();
@EnumValue @EnumValue
private final int code; private final int code;
private final String name; private final String name;
UserRoleEnum(int code, String name) { UserRoleEnum(int code, String name) {
@ -18,7 +18,6 @@ public enum UserRoleEnum {
this.name = name; this.name = name;
} }
private final static UserRoleEnum[] allEnums = values();
public static UserRoleEnum getTypeEnumByCode(int code) { public static UserRoleEnum getTypeEnumByCode(int code) {
for (UserRoleEnum result : allEnums) { for (UserRoleEnum result : allEnums) {
if (result.code == code) { if (result.code == code) {

@ -26,6 +26,7 @@ public class GlobalExceptionHandler {
/** /**
* 负责处理各种自定义业务异常权限不足学号不存在等 * 负责处理各种自定义业务异常权限不足学号不存在等
*
* @param e 抛出的异常 * @param e 抛出的异常
* @return 统一响应 * @return 统一响应
*/ */
@ -38,6 +39,7 @@ public class GlobalExceptionHandler {
/** /**
* 负责处理和响应其他部分都没有接收的异常说白了就是剩下的都返回50000 * 负责处理和响应其他部分都没有接收的异常说白了就是剩下的都返回50000
* 这部分日志要特别关注所以以error打出来 * 这部分日志要特别关注所以以error打出来
*
* @param e 异常 * @param e 异常
* @return 统一响应 * @return 统一响应
*/ */
@ -51,6 +53,7 @@ public class GlobalExceptionHandler {
/** /**
* 处理参数不完整的请求异常 * 处理参数不完整的请求异常
*
* @param e 异常 * @param e 异常
* @return 统一响应 * @return 统一响应
*/ */
@ -62,6 +65,7 @@ public class GlobalExceptionHandler {
/** /**
* 处理参数类型错误的请求异常请求参数类型错误 * 处理参数类型错误的请求异常请求参数类型错误
*
* @param e 异常 * @param e 异常
* @return 统一响应 * @return 统一响应
*/ */
@ -73,6 +77,7 @@ public class GlobalExceptionHandler {
/** /**
* 处理参数类型错误的请求异常请求参数类型错误 * 处理参数类型错误的请求异常请求参数类型错误
*
* @param e 异常 * @param e 异常
* @return 统一响应 * @return 统一响应
*/ */
@ -84,6 +89,7 @@ public class GlobalExceptionHandler {
/** /**
* 处理参数类型错误的请求异常2Json解析错误 * 处理参数类型错误的请求异常2Json解析错误
*
* @param e 异常 * @param e 异常
* @return 统一响应 * @return 统一响应
*/ */
@ -95,6 +101,7 @@ public class GlobalExceptionHandler {
/** /**
* 处理参数类型错误的请求异常3字段映射错误 * 处理参数类型错误的请求异常3字段映射错误
*
* @param e 异常 * @param e 异常
* @return 统一响应 * @return 统一响应
*/ */
@ -106,6 +113,7 @@ public class GlobalExceptionHandler {
/** /**
* 处理请求头中Content-Type字段不正确的异常 * 处理请求头中Content-Type字段不正确的异常
*
* @param e 异常 * @param e 异常
* @return 统一响应 * @return 统一响应
*/ */
@ -117,6 +125,7 @@ public class GlobalExceptionHandler {
/** /**
* 处理请求方法错误的情况 * 处理请求方法错误的情况
*
* @param e 异常 * @param e 异常
* @return 统一响应 * @return 统一响应
*/ */
@ -128,6 +137,7 @@ public class GlobalExceptionHandler {
/** /**
* 处理上传文件时不是Multipart方式 * 处理上传文件时不是Multipart方式
*
* @param e 异常 * @param e 异常
* @return 统一响应 * @return 统一响应
*/ */
@ -139,6 +149,7 @@ public class GlobalExceptionHandler {
/** /**
* 权限不足 * 权限不足
*
* @param e 异常 * @param e 异常
* @return 统一响应 * @return 统一响应
*/ */
@ -149,6 +160,7 @@ public class GlobalExceptionHandler {
/** /**
* 没登陆 * 没登陆
*
* @param e 异常 * @param e 异常
* @return 统一响应 * @return 统一响应
*/ */

@ -8,11 +8,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@Component @Component
public class ObjectJsonSerializer { public class ObjectJsonSerializer {
/** /**

@ -19,6 +19,7 @@ public class TextCheckUtil {
/** /**
* 检测非字母和中文符号下划线"_"除外 * 检测非字母和中文符号下划线"_"除外
*
* @param source 待检测字符串 * @param source 待检测字符串
* @return 是否含有非字母字符 * @return 是否含有非字母字符
*/ */
@ -28,6 +29,7 @@ public class TextCheckUtil {
/** /**
* 批量检测非字母和中文符号下划线"_"除外 * 批量检测非字母和中文符号下划线"_"除外
*
* @param source 待检测字符串 * @param source 待检测字符串
* @return 是否含有非字母字符 * @return 是否含有非字母字符
*/ */

@ -11,9 +11,9 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import net.lensfrex.dscape.dto.request.UserLoginRequestBody; import net.lensfrex.dscape.dto.request.UserLoginRequestBody;
import net.lensfrex.dscape.dto.request.user.PasswordModifyRequestBody; import net.lensfrex.dscape.dto.request.user.PasswordModifyRequestBody;
import net.lensfrex.dscape.dto.request.user.RegisterRequestBody; import net.lensfrex.dscape.dto.request.user.RegisterRequestBody;
import net.lensfrex.dscape.dto.response.data.user.RegisterResponseBody;
import net.lensfrex.dscape.dto.response.general.Response; import net.lensfrex.dscape.dto.response.general.Response;
import net.lensfrex.dscape.dto.response.general.ResponseCode; import net.lensfrex.dscape.dto.response.general.ResponseCode;
import net.lensfrex.dscape.dto.response.data.user.RegisterResponseBody;
import net.lensfrex.dscape.exception.GlobalException; import net.lensfrex.dscape.exception.GlobalException;
import net.lensfrex.dscape.utils.NetworkUtil; import net.lensfrex.dscape.utils.NetworkUtil;
import net.lensfrex.dscape.utils.validate.TextCheckUtil; import net.lensfrex.dscape.utils.validate.TextCheckUtil;

@ -8,9 +8,9 @@ import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.lensfrex.dscape.dto.request.user.UserAddRequest; import net.lensfrex.dscape.dto.request.user.UserAddRequest;
import net.lensfrex.dscape.dto.response.data.user.RegisterResponseBody;
import net.lensfrex.dscape.dto.response.general.Response; import net.lensfrex.dscape.dto.response.general.Response;
import net.lensfrex.dscape.dto.response.general.ResponseCode; import net.lensfrex.dscape.dto.response.general.ResponseCode;
import net.lensfrex.dscape.dto.response.data.user.RegisterResponseBody;
import net.lensfrex.dscape.enums.user.UserRoleEnum; import net.lensfrex.dscape.enums.user.UserRoleEnum;
import net.lensfrex.dscape.exception.GlobalException; import net.lensfrex.dscape.exception.GlobalException;
import net.lensfrex.dscape.utils.NetworkUtil; import net.lensfrex.dscape.utils.NetworkUtil;

@ -11,7 +11,6 @@ import net.lensfrex.dscape.dao.service.ComputeHistoryService;
import net.lensfrex.dscape.dao.service.PatientDataService; import net.lensfrex.dscape.dao.service.PatientDataService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
@ -24,8 +23,8 @@ public class HistoryService {
public HistoryService(ComputeHistoryService computeHistoryService, public HistoryService(ComputeHistoryService computeHistoryService,
PatientDataService patientDataService) { PatientDataService patientDataService) {
this.computeHistoryService = computeHistoryService;
this.computeHistoryService = computeHistoryService;
this.patientDataService = patientDataService; this.patientDataService = patientDataService;
} }

@ -17,8 +17,8 @@ import net.lensfrex.dscape.dao.entity.UserBasic;
import net.lensfrex.dscape.dao.service.BlackListService; import net.lensfrex.dscape.dao.service.BlackListService;
import net.lensfrex.dscape.dao.service.UserBasicService; import net.lensfrex.dscape.dao.service.UserBasicService;
import net.lensfrex.dscape.dto.request.user.UserAddRequest; import net.lensfrex.dscape.dto.request.user.UserAddRequest;
import net.lensfrex.dscape.dto.response.general.ResponseCode;
import net.lensfrex.dscape.dto.response.data.user.RegisterResponseBody; import net.lensfrex.dscape.dto.response.data.user.RegisterResponseBody;
import net.lensfrex.dscape.dto.response.general.ResponseCode;
import net.lensfrex.dscape.enums.user.BlackListTypeEnum; import net.lensfrex.dscape.enums.user.BlackListTypeEnum;
import net.lensfrex.dscape.enums.user.UserRoleEnum; import net.lensfrex.dscape.enums.user.UserRoleEnum;
import net.lensfrex.dscape.exception.GlobalException; import net.lensfrex.dscape.exception.GlobalException;
@ -97,7 +97,7 @@ public class AdminService {
String uid = userService.addUserToDatabase(requestBody.getUserName(), requestBody.getPassword(), String uid = userService.addUserToDatabase(requestBody.getUserName(), requestBody.getPassword(),
StpUtil.getLoginIdAsString(), UserRoleEnum.getTypeEnumByCode(requestBody.getRole()), registerIp); StpUtil.getLoginIdAsString(), UserRoleEnum.getTypeEnumByCode(requestBody.getRole()), registerIp);
RegisterResponseBody registerResponseBody = new RegisterResponseBody (); RegisterResponseBody registerResponseBody = new RegisterResponseBody();
registerResponseBody.setUid(uid); registerResponseBody.setUid(uid);
return registerResponseBody; return registerResponseBody;

@ -15,8 +15,8 @@ import net.lensfrex.dscape.dao.service.UserBasicService;
import net.lensfrex.dscape.dao.service.UserRoleService; import net.lensfrex.dscape.dao.service.UserRoleService;
import net.lensfrex.dscape.dto.request.UserLoginRequestBody; import net.lensfrex.dscape.dto.request.UserLoginRequestBody;
import net.lensfrex.dscape.dto.request.user.RegisterRequestBody; import net.lensfrex.dscape.dto.request.user.RegisterRequestBody;
import net.lensfrex.dscape.dto.response.general.ResponseCode;
import net.lensfrex.dscape.dto.response.data.user.RegisterResponseBody; import net.lensfrex.dscape.dto.response.data.user.RegisterResponseBody;
import net.lensfrex.dscape.dto.response.general.ResponseCode;
import net.lensfrex.dscape.enums.user.UserRoleEnum; import net.lensfrex.dscape.enums.user.UserRoleEnum;
import net.lensfrex.dscape.enums.user.UserStatusEnum; import net.lensfrex.dscape.enums.user.UserStatusEnum;
import net.lensfrex.dscape.exception.GlobalException; import net.lensfrex.dscape.exception.GlobalException;
@ -140,6 +140,7 @@ public class UserService {
/** /**
* 添加一个用户到数据库 * 添加一个用户到数据库
*
* @param userName 用户名 * @param userName 用户名
* @param password 密码未用bcrypt加密的 * @param password 密码未用bcrypt加密的
* @param superior 上级管理员本身是管理员时可为空 * @param superior 上级管理员本身是管理员时可为空

Loading…
Cancel
Save