From c0496c39e1013904d9956d5e10e077edfca6d167 Mon Sep 17 00:00:00 2001 From: luozhun <2025254074@qq.com> Date: Fri, 15 Nov 2024 11:12:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(cache):=20=E5=AE=9E=E7=8E=B0=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E7=BC=93=E5=AD=98=E7=AE=A1=E7=90=86=E5=99=A8=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9E=9A=E4=B8=BE=E6=95=B0=E6=8D=AE=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 GlobalCacheManager 类,用于统一管理枚举缓存 - 重构 BaseEnum 接口,使用 SelectNodeVo 作为序列化返回类型 - 更新 CheckStatus、EnterprisesUnitType 和 IsEnable 枚举类,使用 SelectNodeVo 作为序列化结果- 修改 CommonController 中的 enums 方法,直接使用 GlobalCacheManager 中的缓存数据 - 移除 CommonController 中的 initEnums 方法和 enumsResult 静态变量 --- .../common/cache/GlobalCacheManager.java | 79 +++++++++++++++++++ .../java/com/changhu/common/db/BaseEnum.java | 27 ++++--- .../changhu/common/db/enums/CheckStatus.java | 9 --- .../common/db/enums/EnterprisesUnitType.java | 16 ++-- .../com/changhu/common/db/enums/IsEnable.java | 9 --- .../com/changhu/common/enums/OpenApiType.java | 2 - .../changhu/controller/CommonController.java | 69 ++-------------- .../handler/ManagementPoliceUnitLogin.java | 2 +- .../handler/ManagementSecurityUnitLogin.java | 2 +- .../enums/handler/MiniProgramUserLogin.java | 2 +- .../AssessmentCriteriaController.java | 2 +- .../mapper/CkAssessmentRecordMapper.java | 3 - .../pojo/entity/CkAssessmentRecord.java | 16 ++-- .../entity/CkAssessmentRecordDetails.java | 16 ++-- .../pojo/entity/CkGroup.java | 16 ++-- .../pojo/entity/CkItem.java | 18 ++--- .../pojo/entity/CkProject.java | 18 ++--- .../pojo/entity/CkStandard.java | 17 ++-- .../params/CkGroupSaveOrUpdateParams.java | 1 - .../params/CkProjectSaveOrUpdateParams.java | 2 - .../params/CkStandardSaveOrUpdateParams.java | 1 - .../pojo/vo/AssessmentRecordPagerVo.java | 1 - .../impl/AssessmentCriteriaServiceImpl.java | 10 +-- .../mapper/ServiceProjectMapper.java | 1 - .../service/ServiceProjectService.java | 1 - .../service/impl/ManagementServiceImpl.java | 2 +- .../service/impl/SecurityServiceImpl.java | 2 +- .../impl/ServiceProjectServiceImpl.java | 1 - .../miniProgram/pojo/entity/SecurityUser.java | 18 ++--- .../service/ProjectManageIndexService.java | 1 - .../impl/MiniProgramUserServiceImpl.java | 1 - .../impl/ProjectManageIndexServiceImpl.java | 5 +- .../pojo/dto/EnterprisesUnitDetailDTO.java | 5 -- .../service/impl/OpenApiServiceImpl.java | 1 - 34 files changed, 180 insertions(+), 196 deletions(-) create mode 100644 policeSecurityServer/src/main/java/com/changhu/common/cache/GlobalCacheManager.java diff --git a/policeSecurityServer/src/main/java/com/changhu/common/cache/GlobalCacheManager.java b/policeSecurityServer/src/main/java/com/changhu/common/cache/GlobalCacheManager.java new file mode 100644 index 0000000..6738b5a --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/common/cache/GlobalCacheManager.java @@ -0,0 +1,79 @@ +package com.changhu.common.cache; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Dict; +import cn.hutool.core.util.ClassUtil; +import cn.hutool.core.util.ReflectUtil; +import com.changhu.common.annotation.IsExtData; +import com.changhu.common.db.BaseEnum; +import com.changhu.common.pojo.vo.SelectNodeVo; +import lombok.extern.slf4j.Slf4j; +import org.ehcache.impl.internal.concurrent.ConcurrentHashMap; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @author 20252 + * @createTime 2024/11/15 上午9:03 + * @desc GlobalCacheManager... + */ +@Slf4j +public class GlobalCacheManager { + /** + * 枚举缓存 + */ + public static final Map, Map, SelectNodeVo>> ENUM_CACHE = new ConcurrentHashMap<>(); + + static { + //初始化枚举数据 + initEnum(); + } + + static void initEnum() { + log.info("初始化枚举字典数据----"); + Set> classes = ClassUtil.scanPackageBySuper("com.changhu.common.db.enums", BaseEnum.class); + Method superSerializer = ClassUtil.getDeclaredMethod(BaseEnum.class, "serializer"); + for (Class aClass : classes) { + Method childrenSerializer = ClassUtil.getDeclaredMethod(aClass, "serializer"); + BaseEnum[] enumConstants = (BaseEnum[]) aClass.getEnumConstants(); + if (enumConstants == null) { + continue; + } + // 获取所有字段 + Field[] fields = aClass.getDeclaredFields(); + // 过滤出非静态字段并带有 IsExtData 注解的字段 + List extDataFields = Arrays.stream(fields) + .filter(field -> !Modifier.isStatic(field.getModifiers())) + .filter(field -> field.getAnnotation(IsExtData.class) != null) + .collect(Collectors.toList()); + + Map, SelectNodeVo> map = new LinkedHashMap<>(); + + Stream.of(enumConstants).forEach(v -> { + //如果子类重写父类的方法 则直接使用子类的结果 + if (!superSerializer.equals(childrenSerializer)) { + map.put(v, v.serializer()); + } else { + SelectNodeVo vo = new SelectNodeVo<>(); + vo.setValue(v.getValue()); + vo.setLabel(v.getLabel()); + if (CollUtil.isNotEmpty(extDataFields)) { + Dict extData = Dict.create(); + for (Field extDataField : extDataFields) { + extData.put(extDataField.getName(), ReflectUtil.getFieldValue(v, extDataField)); + } + vo.setExtData(extData); + } + map.put(v, vo); + } + }); + GlobalCacheManager.ENUM_CACHE.put(aClass, map); + } + log.info("初始化枚举字典数据----完成"); + } +} diff --git a/policeSecurityServer/src/main/java/com/changhu/common/db/BaseEnum.java b/policeSecurityServer/src/main/java/com/changhu/common/db/BaseEnum.java index 9dd7153..df0235a 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/db/BaseEnum.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/db/BaseEnum.java @@ -1,8 +1,11 @@ package com.changhu.common.db; -import cn.hutool.core.lang.Dict; import cn.hutool.core.util.ObjectUtil; +import com.changhu.common.cache.GlobalCacheManager; import com.changhu.common.exception.MessageException; +import com.changhu.common.pojo.vo.SelectNodeVo; + +import java.util.Map; /** * author: luozhun @@ -10,6 +13,7 @@ import com.changhu.common.exception.MessageException; * createTime: 2023/8/16 17:38 */ public interface BaseEnum { + /** * 获取值 * @@ -26,19 +30,22 @@ public interface BaseEnum { @SuppressWarnings("unchecked") static > T valueOf(Class> enumType, P code) { - BaseEnum

[] enumConstants = enumType.getEnumConstants(); - for (BaseEnum

pBaseEnum : enumConstants) { - if (ObjectUtil.equals(code, pBaseEnum.getValue())) { - return (T) pBaseEnum; + Map, SelectNodeVo> nodeVoMap = GlobalCacheManager.ENUM_CACHE.get(enumType); + for (Map.Entry, SelectNodeVo> mapEntry : nodeVoMap.entrySet()) { + if (ObjectUtil.equals(code, mapEntry.getValue().getValue())) { + return (T) mapEntry.getKey(); } } throw new MessageException("不存在值为:{} 的【{}】对象!", code.toString(), enumType.componentType().getSimpleName()); } - default Object serializer() { - return Dict.of( - "value", this.getValue(), - "label", this.getLabel() - ); + @SuppressWarnings("unchecked") + default SelectNodeVo serializer() { + Map, SelectNodeVo> map = GlobalCacheManager.ENUM_CACHE.get(this.getClass()); + if (map != null) { + return (SelectNodeVo) map.get(this); + } + return null; } + } diff --git a/policeSecurityServer/src/main/java/com/changhu/common/db/enums/CheckStatus.java b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/CheckStatus.java index 3116c84..b52332d 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/db/enums/CheckStatus.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/CheckStatus.java @@ -1,6 +1,5 @@ package com.changhu.common.db.enums; -import cn.hutool.core.lang.Dict; import com.baomidou.mybatisplus.annotation.IEnum; import com.changhu.common.annotation.IsExtData; import com.changhu.common.db.BaseEnum; @@ -25,12 +24,4 @@ public enum CheckStatus implements BaseEnum, IEnum { @IsExtData private final String color; - @Override - public Object serializer() { - return Dict.of( - "value", this.getValue(), - "label", this.getLabel(), - "extData", Dict.of("color", this.color) - ); - } } diff --git a/policeSecurityServer/src/main/java/com/changhu/common/db/enums/EnterprisesUnitType.java b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/EnterprisesUnitType.java index e6425e7..91a36c4 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/db/enums/EnterprisesUnitType.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/EnterprisesUnitType.java @@ -4,12 +4,10 @@ import cn.hutool.core.lang.Dict; import com.baomidou.mybatisplus.annotation.IEnum; import com.changhu.common.annotation.IsExtData; import com.changhu.common.db.BaseEnum; +import com.changhu.common.pojo.vo.SelectNodeVo; import lombok.AllArgsConstructor; import lombok.Getter; -import java.util.Arrays; -import java.util.stream.Collectors; - /** * @author 20252 * @createTime 2024/11/5 下午4:22 @@ -46,11 +44,11 @@ public enum EnterprisesUnitType implements BaseEnum, IEnum { private final String icon; @Override - public Object serializer() { - return Dict.of( - "value", this.getValue(), - "label", this.getLabel(), - "extData", Dict.of("icon", "/resources/icon/gaode/marker/" + this.icon) - ); + public SelectNodeVo serializer() { + return SelectNodeVo.builder() + .value(this.getValue()) + .label(this.getLabel()) + .extData(Dict.of("icon", "/resources/icon/gaode/marker/" + this.icon)) + .build(); } } diff --git a/policeSecurityServer/src/main/java/com/changhu/common/db/enums/IsEnable.java b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/IsEnable.java index 9ab863e..5244f02 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/db/enums/IsEnable.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/IsEnable.java @@ -1,6 +1,5 @@ package com.changhu.common.db.enums; -import cn.hutool.core.lang.Dict; import com.baomidou.mybatisplus.annotation.IEnum; import com.changhu.common.annotation.IsExtData; import com.changhu.common.db.BaseEnum; @@ -25,12 +24,4 @@ public enum IsEnable implements BaseEnum, IEnum { @IsExtData private final String color; - @Override - public Object serializer() { - return Dict.of( - "value", this.getValue(), - "label", this.getLabel(), - "extData", Dict.of("color", this.color) - ); - } } \ No newline at end of file diff --git a/policeSecurityServer/src/main/java/com/changhu/common/enums/OpenApiType.java b/policeSecurityServer/src/main/java/com/changhu/common/enums/OpenApiType.java index c68e356..db2de04 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/enums/OpenApiType.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/enums/OpenApiType.java @@ -1,12 +1,10 @@ package com.changhu.common.enums; -import cn.hutool.core.util.IdUtil; import lombok.AllArgsConstructor; import lombok.Getter; import java.util.Arrays; import java.util.List; -import java.util.UUID; /** * @author 20252 diff --git a/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java b/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java index 0984600..ed3ed63 100644 --- a/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java +++ b/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java @@ -1,13 +1,7 @@ package com.changhu.controller; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.lang.Dict; -import cn.hutool.core.util.ClassUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.ReflectUtil; -import com.changhu.common.annotation.IsExtData; import com.changhu.common.annotation.JsonBody; -import com.changhu.common.db.BaseEnum; +import com.changhu.common.cache.GlobalCacheManager; import com.changhu.common.pojo.model.JsonResult; import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.common.pojo.vo.TreeNodeVo; @@ -20,16 +14,14 @@ import com.changhu.support.minio.service.MinioService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.annotation.PostConstruct; import jakarta.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.Cacheable; import org.springframework.web.bind.annotation.*; -import java.lang.reflect.Field; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * @author 20252 @@ -50,9 +42,6 @@ public class CommonController { @Autowired private AdministrativeDivisionService administrativeDivisionService; - private static final Map>> enumsResult = new HashMap<>(); - - @Cacheable(value = "common", key = "'AdministrativeDivisionLevel' + #level + 'Tree'") @Operation(summary = "行政区划树") @GetMapping("/administrativeDivisionTree") @@ -95,53 +84,11 @@ public class CommonController { @Operation(summary = "字典数据") @GetMapping("/enums") public Map>> enums() { + // 初始化 enumsResult + Map>> enumsResult = new HashMap<>(); + //将缓存的数据转换 + GlobalCacheManager.ENUM_CACHE.forEach((aClass, item) -> enumsResult.put(aClass.getSimpleName(), item.values().stream().toList())); return enumsResult; } - @SuppressWarnings("unchecked") - @PostConstruct - public void initEnums() { - Set> classes = ClassUtil.scanPackageBySuper("com.changhu.common.db.enums", BaseEnum.class); - for (Class aClass : classes) { - if (BaseEnum.class.isAssignableFrom(aClass)) { - enumsResult.put(aClass.getSimpleName(), listSelectNodes((Class>) aClass)); - } - } - } - - public static > List> listSelectNodes(Class enumType) { - if (enumType == null) { - return null; - } - Field[] fields = ReflectUtil.getFields(enumType); - - List extras = new ArrayList<>(); - - for (Field field : fields) { - IsExtData annotation = field.getAnnotation(IsExtData.class); - if (ObjectUtil.isNotNull(annotation)) { - extras.add(field.getName()); - } - } - - T[] enumConstants = enumType.getEnumConstants(); - if (enumConstants == null) { - return null; - } - - return Stream.of(enumConstants).map(v -> { - SelectNodeVo vo = new SelectNodeVo<>(); - vo.setValue(v.getValue()); - vo.setLabel(v.getLabel()); - if (CollUtil.isNotEmpty(extras)) { - Dict map = Dict.create(); - for (String extra : extras) { - map.put(extra, ReflectUtil.getFieldValue(v, extra)); - } - vo.setExtData(map); - } - return vo; - }).collect(Collectors.toList()); - - } } diff --git a/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementPoliceUnitLogin.java b/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementPoliceUnitLogin.java index 74b9897..3b49c5f 100644 --- a/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementPoliceUnitLogin.java +++ b/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementPoliceUnitLogin.java @@ -3,8 +3,8 @@ package com.changhu.enums.handler; import cn.dev33.satoken.stp.SaTokenInfo; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.extension.toolkit.Db; -import com.changhu.common.db.enums.UserType; import com.changhu.common.db.enums.IsEnable; +import com.changhu.common.db.enums.UserType; import com.changhu.common.enums.ResultCode; import com.changhu.common.exception.MessageException; import com.changhu.common.pojo.vo.TokenInfo; diff --git a/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java b/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java index f185b4d..8390ba4 100644 --- a/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java +++ b/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java @@ -3,8 +3,8 @@ package com.changhu.enums.handler; import cn.dev33.satoken.stp.SaTokenInfo; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.extension.toolkit.Db; -import com.changhu.common.db.enums.UserType; import com.changhu.common.db.enums.IsEnable; +import com.changhu.common.db.enums.UserType; import com.changhu.common.enums.ResultCode; import com.changhu.common.exception.MessageException; import com.changhu.common.pojo.vo.TokenInfo; diff --git a/policeSecurityServer/src/main/java/com/changhu/enums/handler/MiniProgramUserLogin.java b/policeSecurityServer/src/main/java/com/changhu/enums/handler/MiniProgramUserLogin.java index 909bd6e..f3bdf79 100644 --- a/policeSecurityServer/src/main/java/com/changhu/enums/handler/MiniProgramUserLogin.java +++ b/policeSecurityServer/src/main/java/com/changhu/enums/handler/MiniProgramUserLogin.java @@ -8,9 +8,9 @@ import cn.hutool.core.lang.func.LambdaUtil; import cn.hutool.extra.spring.SpringUtil; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.extension.toolkit.Db; -import com.changhu.common.db.enums.UserType; import com.changhu.common.db.enums.CheckStatus; import com.changhu.common.db.enums.IsEnable; +import com.changhu.common.db.enums.UserType; import com.changhu.common.enums.ResultCode; import com.changhu.common.exception.MessageException; import com.changhu.common.pojo.vo.TokenInfo; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/controller/AssessmentCriteriaController.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/controller/AssessmentCriteriaController.java index df4f2bc..4165e9d 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/controller/AssessmentCriteriaController.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/controller/AssessmentCriteriaController.java @@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.toolkit.Db; import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.JsonBody; -import com.changhu.common.db.enums.UserType; import com.changhu.common.db.enums.EnterprisesUnitType; +import com.changhu.common.db.enums.UserType; import com.changhu.common.exception.MessageException; import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.module.assessmentCriteria.pojo.entity.CkGroup; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordMapper.java index 9c0cadb..13bc5c3 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordMapper.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordMapper.java @@ -4,13 +4,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecord; import com.changhu.module.assessmentCriteria.pojo.queryParams.AssessmentRecordPagerQueryParams; -import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentRecordDetailVo; import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentRecordPagerVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import java.util.List; - /** * ck_assessment_record (考核记录) 固化类 * author: luozhun diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecord.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecord.java index bc8ee3d..e3113b2 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecord.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecord.java @@ -1,16 +1,16 @@ package com.changhu.module.assessmentCriteria.pojo.entity; +import com.baomidou.mybatisplus.annotation.TableName; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + import java.io.Serial; import java.io.Serializable; -import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; -import lombok.Data; -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; -import lombok.EqualsAndHashCode; -import com.baomidou.mybatisplus.annotation.TableName; - /** * 考核记录 实体类 diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecordDetails.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecordDetails.java index 7b99f6c..cc758cb 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecordDetails.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecordDetails.java @@ -1,16 +1,16 @@ package com.changhu.module.assessmentCriteria.pojo.entity; +import com.baomidou.mybatisplus.annotation.TableName; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + import java.io.Serial; import java.io.Serializable; -import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; -import lombok.Data; -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; -import lombok.EqualsAndHashCode; -import com.baomidou.mybatisplus.annotation.TableName; - /** * 考核记录明细 实体类 diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkGroup.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkGroup.java index 4b2e86d..454b0bd 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkGroup.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkGroup.java @@ -1,16 +1,16 @@ package com.changhu.module.assessmentCriteria.pojo.entity; +import com.baomidou.mybatisplus.annotation.TableName; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + import java.io.Serial; import java.io.Serializable; -import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; -import lombok.Data; -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; -import lombok.EqualsAndHashCode; -import com.baomidou.mybatisplus.annotation.TableName; - /** * 考核组 实体类 diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkItem.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkItem.java index f969bd6..53710ae 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkItem.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkItem.java @@ -1,17 +1,17 @@ package com.changhu.module.assessmentCriteria.pojo.entity; +import com.baomidou.mybatisplus.annotation.TableName; +import com.changhu.common.db.enums.SelectType; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + import java.io.Serial; import java.io.Serializable; -import com.changhu.common.db.enums.SelectType; -import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; -import lombok.Data; -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; -import lombok.EqualsAndHashCode; -import com.baomidou.mybatisplus.annotation.TableName; - /** * 分组内的考核项 实体类 diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkProject.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkProject.java index f9f1bb3..56467bd 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkProject.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkProject.java @@ -1,17 +1,17 @@ package com.changhu.module.assessmentCriteria.pojo.entity; +import com.baomidou.mybatisplus.annotation.TableName; +import com.changhu.common.db.enums.EnterprisesUnitType; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + import java.io.Serial; import java.io.Serializable; -import com.changhu.common.db.enums.EnterprisesUnitType; -import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; -import lombok.Data; -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; -import lombok.EqualsAndHashCode; -import com.baomidou.mybatisplus.annotation.TableName; - /** * 考核项目 实体类 diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkStandard.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkStandard.java index 1a561a2..e4b6848 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkStandard.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkStandard.java @@ -1,17 +1,16 @@ package com.changhu.module.assessmentCriteria.pojo.entity; +import com.baomidou.mybatisplus.annotation.TableName; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + import java.io.Serial; import java.io.Serializable; -import com.changhu.common.db.enums.SelectType; -import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; -import lombok.Data; -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; -import lombok.EqualsAndHashCode; -import com.baomidou.mybatisplus.annotation.TableName; - /** * 扣分标准 实体类 diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkGroupSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkGroupSaveOrUpdateParams.java index d0e464c..66560c5 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkGroupSaveOrUpdateParams.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkGroupSaveOrUpdateParams.java @@ -1,6 +1,5 @@ package com.changhu.module.assessmentCriteria.pojo.params; -import com.changhu.common.db.enums.EnterprisesUnitType; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkProjectSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkProjectSaveOrUpdateParams.java index fb01afa..1c3d654 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkProjectSaveOrUpdateParams.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkProjectSaveOrUpdateParams.java @@ -6,8 +6,6 @@ import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.Data; -import java.time.LocalDateTime; - /** * @author 20252 * @createTime 2024/11/6 上午10:31 diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkStandardSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkStandardSaveOrUpdateParams.java index 9923114..f03d7c6 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkStandardSaveOrUpdateParams.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkStandardSaveOrUpdateParams.java @@ -1,6 +1,5 @@ package com.changhu.module.assessmentCriteria.pojo.params; -import com.changhu.common.db.enums.SelectType; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/AssessmentRecordPagerVo.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/AssessmentRecordPagerVo.java index f371242..ce1159f 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/AssessmentRecordPagerVo.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/AssessmentRecordPagerVo.java @@ -1,7 +1,6 @@ package com.changhu.module.assessmentCriteria.pojo.vo; import com.changhu.common.db.enums.EnterprisesUnitType; -import com.changhu.common.utils.JavaClassToTsUtil; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/AssessmentCriteriaServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/AssessmentCriteriaServiceImpl.java index 7656390..517e38f 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/AssessmentCriteriaServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/AssessmentCriteriaServiceImpl.java @@ -1,12 +1,5 @@ package com.changhu.module.assessmentCriteria.service.impl; -import com.changhu.common.db.enums.SelectType; - -import com.changhu.common.utils.SnowFlakeIdUtil; -import com.changhu.module.assessmentCriteria.pojo.entity.*; -import com.changhu.module.assessmentCriteria.pojo.params.*; -import com.google.common.collect.Lists; - import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Dict; @@ -16,7 +9,10 @@ import com.baomidou.mybatisplus.extension.toolkit.Db; import com.changhu.common.db.enums.EnterprisesUnitType; import com.changhu.common.exception.MessageException; import com.changhu.common.pojo.vo.SelectNodeVo; +import com.changhu.common.utils.SnowFlakeIdUtil; import com.changhu.module.assessmentCriteria.mapper.CkProjectMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.*; +import com.changhu.module.assessmentCriteria.pojo.params.*; import com.changhu.module.assessmentCriteria.pojo.queryParams.CkProjectPagerQueryParams; import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentCriteriaRuleVo; import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectDetailTableVo; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/mapper/ServiceProjectMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/management/mapper/ServiceProjectMapper.java index a9a22a8..9850bf1 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/mapper/ServiceProjectMapper.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/mapper/ServiceProjectMapper.java @@ -6,7 +6,6 @@ import com.changhu.module.management.pojo.entity.ServiceProject; import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams; import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; -import com.changhu.pojo.dto.EnterprisesUnitDetailDTO; import com.changhu.pojo.dto.ServiceProjectDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/service/ServiceProjectService.java b/policeSecurityServer/src/main/java/com/changhu/module/management/service/ServiceProjectService.java index 8c9db18..8f8d735 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/service/ServiceProjectService.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/service/ServiceProjectService.java @@ -6,7 +6,6 @@ import com.changhu.module.management.pojo.entity.ServiceProject; import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams; import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams; import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo; -import com.changhu.pojo.dto.EnterprisesUnitDetailDTO; import com.changhu.pojo.dto.ServiceProjectDTO; import com.changhu.support.mybatisplus.pojo.params.PageParams; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementServiceImpl.java index 9a2a580..48a7fad 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementServiceImpl.java @@ -1,8 +1,8 @@ package com.changhu.module.management.service.impl; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.changhu.common.db.enums.UserType; import com.changhu.common.db.enums.MiniProgramUserIdentity; +import com.changhu.common.db.enums.UserType; import com.changhu.common.exception.MessageException; import com.changhu.common.utils.UserUtil; import com.changhu.module.management.pojo.params.IndexCheckPassParams; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/SecurityServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/SecurityServiceImpl.java index fea4772..573a796 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/SecurityServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/SecurityServiceImpl.java @@ -8,9 +8,9 @@ import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.toolkit.Db; -import com.changhu.common.db.enums.UserType; import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.MiniProgramUserIdentity; +import com.changhu.common.db.enums.UserType; import com.changhu.common.enums.ResultCode; import com.changhu.common.exception.MessageException; import com.changhu.common.pojo.vo.SelectNodeVo; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ServiceProjectServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ServiceProjectServiceImpl.java index d4e6e80..15453f5 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ServiceProjectServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ServiceProjectServiceImpl.java @@ -11,7 +11,6 @@ import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParam import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams; import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo; import com.changhu.module.management.service.ServiceProjectService; -import com.changhu.pojo.dto.EnterprisesUnitDetailDTO; import com.changhu.pojo.dto.ServiceProjectDTO; import com.changhu.support.mybatisplus.pojo.params.PageParams; import org.springframework.stereotype.Service; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/entity/SecurityUser.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/entity/SecurityUser.java index d0b0a8c..fb8a58c 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/entity/SecurityUser.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/entity/SecurityUser.java @@ -1,17 +1,17 @@ package com.changhu.module.miniProgram.pojo.entity; +import com.baomidou.mybatisplus.annotation.TableName; +import com.changhu.common.db.enums.Sex; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + import java.io.Serial; import java.io.Serializable; -import com.changhu.common.db.enums.Sex; -import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; -import lombok.Data; -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; -import lombok.EqualsAndHashCode; -import com.baomidou.mybatisplus.annotation.TableName; - /** * 保安人员 实体类 diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/ProjectManageIndexService.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/ProjectManageIndexService.java index 69c3f9d..a1c7cd8 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/ProjectManageIndexService.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/ProjectManageIndexService.java @@ -2,7 +2,6 @@ package com.changhu.module.miniProgram.service; import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; -import jakarta.servlet.http.HttpServletResponse; import org.springframework.core.io.Resource; import org.springframework.http.ResponseEntity; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MiniProgramUserServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MiniProgramUserServiceImpl.java index fb85ceb..be7f6e2 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MiniProgramUserServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MiniProgramUserServiceImpl.java @@ -11,7 +11,6 @@ import com.changhu.common.utils.SnowFlakeIdUtil; import com.changhu.module.miniProgram.mapper.MiniProgramUserMapper; import com.changhu.module.miniProgram.mapper.SecurityUserMapper; import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser; -import com.changhu.module.miniProgram.pojo.entity.SecurityUser; import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams; import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams; import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/ProjectManageIndexServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/ProjectManageIndexServiceImpl.java index 82ee67c..ab64842 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/ProjectManageIndexServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/ProjectManageIndexServiceImpl.java @@ -11,8 +11,6 @@ import com.changhu.module.miniProgram.pojo.entity.SecurityUser; import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.service.ProjectManageIndexService; -import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; -import jakarta.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import me.chanjar.weixin.common.error.WxErrorException; import org.springframework.beans.factory.annotation.Autowired; @@ -23,9 +21,8 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; -import java.io.*; +import java.io.File; import java.util.List; -import java.util.Optional; /** * @author 20252 diff --git a/policeSecurityServer/src/main/java/com/changhu/pojo/dto/EnterprisesUnitDetailDTO.java b/policeSecurityServer/src/main/java/com/changhu/pojo/dto/EnterprisesUnitDetailDTO.java index 096f36b..65161b0 100644 --- a/policeSecurityServer/src/main/java/com/changhu/pojo/dto/EnterprisesUnitDetailDTO.java +++ b/policeSecurityServer/src/main/java/com/changhu/pojo/dto/EnterprisesUnitDetailDTO.java @@ -1,10 +1,5 @@ package com.changhu.pojo.dto; -import cn.hutool.core.util.DesensitizedUtil; -import com.changhu.common.annotation.Desensitized; -import com.changhu.common.db.enums.IsOrNot; -import com.changhu.common.db.enums.ServiceProjectType; -import com.changhu.common.db.enums.Sex; import com.changhu.module.management.pojo.model.ContactPersonInfo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; diff --git a/policeSecurityServer/src/main/java/com/changhu/service/impl/OpenApiServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/service/impl/OpenApiServiceImpl.java index 2904329..12843aa 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/impl/OpenApiServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/impl/OpenApiServiceImpl.java @@ -10,7 +10,6 @@ import com.changhu.module.management.service.ServiceProjectService; import com.changhu.module.miniProgram.pojo.entity.SecurityUser; import com.changhu.pojo.dto.DataViewDTO; import com.changhu.pojo.dto.EnterprisesUnitDetailDTO; -import com.changhu.pojo.dto.ServiceProjectDTO; import com.changhu.service.OpenApiService; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import lombok.SneakyThrows;