From a4c425d190d2b797ae32baf92be01c1f049dd88d Mon Sep 17 00:00:00 2001 From: luozhun <2025254074@qq.com> Date: Fri, 15 Nov 2024 17:31:07 +0800 Subject: [PATCH 1/5] =?UTF-8?q?refactor(cache):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=9E=9A=E4=B8=BE=E6=95=B0=E6=8D=AE=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E5=92=8C=E5=BA=8F=E5=88=97=E5=8C=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化枚举字典数据初始化流程 - 添加判断子类是否重写父类序列化方法的逻辑 - 调整代码结构,提高可读性和性能 --- .../changhu/common/cache/GlobalCacheManager.java | 13 +++++++------ superManagement/src/stores/modules/userStore.ts | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/policeSecurityServer/src/main/java/com/changhu/common/cache/GlobalCacheManager.java b/policeSecurityServer/src/main/java/com/changhu/common/cache/GlobalCacheManager.java index 6738b5a..7ea767c 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/cache/GlobalCacheManager.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/cache/GlobalCacheManager.java @@ -36,18 +36,19 @@ public class GlobalCacheManager { static void initEnum() { log.info("初始化枚举字典数据----"); + //在包下扫描出BaseEnum的子类 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) + //子类是否重写了父类的serializer方法 + boolean isRewriteSerializer = !superSerializer.equals(ClassUtil.getDeclaredMethod(aClass, "serializer")); + // 获取所有字段并过滤出非静态字段并带有 IsExtData 注解的字段 + List extDataFields = Arrays.stream(aClass.getDeclaredFields()) .filter(field -> !Modifier.isStatic(field.getModifiers())) .filter(field -> field.getAnnotation(IsExtData.class) != null) .collect(Collectors.toList()); @@ -56,7 +57,7 @@ public class GlobalCacheManager { Stream.of(enumConstants).forEach(v -> { //如果子类重写父类的方法 则直接使用子类的结果 - if (!superSerializer.equals(childrenSerializer)) { + if (isRewriteSerializer) { map.put(v, v.serializer()); } else { SelectNodeVo vo = new SelectNodeVo<>(); diff --git a/superManagement/src/stores/modules/userStore.ts b/superManagement/src/stores/modules/userStore.ts index f52f0f5..63cb48e 100644 --- a/superManagement/src/stores/modules/userStore.ts +++ b/superManagement/src/stores/modules/userStore.ts @@ -20,7 +20,7 @@ export const useUserStore = defineStore({ getTokenInfo: (state): TokenInfo => state.tokenInfo as TokenInfo, }, persist: { - key: "useUserStore", + key: "spUserStore", storage: window.localStorage, paths: ["tokenInfo"], } From 735740bf8e8ad7341de2f14c432a08a427026dfd Mon Sep 17 00:00:00 2001 From: TimSpan Date: Mon, 18 Nov 2024 17:20:44 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E3=80=82=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- policeManagement/.env.development | 16 +++++++++------- policeManagement/components.d.ts | 5 +++++ policeManagement/src/views/query/index.tsx | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/policeManagement/.env.development b/policeManagement/.env.development index 7252cf2..6b84780 100644 --- a/policeManagement/.env.development +++ b/policeManagement/.env.development @@ -12,11 +12,13 @@ VITE_APP_PROXY_URL=http://172.10.10.93:8765 # rsa 公钥 VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJps/EXxxSpEM1Ix4R0NWIOBciHCr7P7coDT8tNKfelgR7txcJOqHCO/MIWe7T04aHQTcpQxqx9hMca7dbqz8TZpz9jvLzE/6ZonVKxHsoFnNlHMp1/CPAJ9f6D9wYicum2KltJkmQ0g//D9W2zPCYoGOmSRFcZx/KEBa4EM53jQIDAQAB -# 高德 -VITE_APP_GAODE_KEY=ca549d915cb38803582ca7e85c5f972c -VITE_APP_GAODE_VERSION=2.0 -VITE_APP_SECURITY_JS_CODE=f464462874676b3f1469780a62e5b921 - -# VITE_APP_GAODE_KEY=f379a3f860a68d7438526275d6a94b05 +# 高德 myx +# VITE_APP_GAODE_KEY=ca549d915cb38803582ca7e85c5f972c # VITE_APP_GAODE_VERSION=2.0 -# VITE_APP_SECURITY_JS_CODE=432125a0f8d8cad2dac38b77d6f6728f \ No newline at end of file +# VITE_APP_SECURITY_JS_CODE=f464462874676b3f1469780a62e5b921 + + +# 高德 lz +VITE_APP_GAODE_KEY=f379a3f860a68d7438526275d6a94b05 +VITE_APP_GAODE_VERSION=2.0 +VITE_APP_SECURITY_JS_CODE=432125a0f8d8cad2dac38b77d6f6728f \ No newline at end of file diff --git a/policeManagement/components.d.ts b/policeManagement/components.d.ts index 9373b1b..f757bec 100644 --- a/policeManagement/components.d.ts +++ b/policeManagement/components.d.ts @@ -10,10 +10,12 @@ declare module 'vue' { AAvatar: typeof import('ant-design-vue/es')['Avatar'] AButton: typeof import('ant-design-vue/es')['Button'] ACascader: typeof import('ant-design-vue/es')['Cascader'] + ACheckbox: typeof import('ant-design-vue/es')['Checkbox'] ACheckboxGroup: typeof import('ant-design-vue/es')['CheckboxGroup'] ACol: typeof import('ant-design-vue/es')['Col'] AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider'] ADatePicker: typeof import('ant-design-vue/es')['DatePicker'] + ADivider: typeof import('ant-design-vue/es')['Divider'] AdministrativeDivisionTree: typeof import('./src/components/tree/AdministrativeDivisionTree.vue')['default'] ADropdown: typeof import('ant-design-vue/es')['Dropdown'] AForm: typeof import('ant-design-vue/es')['Form'] @@ -30,6 +32,7 @@ declare module 'vue' { AMenuItem: typeof import('ant-design-vue/es')['MenuItem'] AModal: typeof import('ant-design-vue/es')['Modal'] APagination: typeof import('ant-design-vue/es')['Pagination'] + APopconfirm: typeof import('ant-design-vue/es')['Popconfirm'] APopover: typeof import('ant-design-vue/es')['Popover'] ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup'] ARangePicker: typeof import('ant-design-vue/es')['RangePicker'] @@ -39,6 +42,8 @@ declare module 'vue' { ASpin: typeof import('ant-design-vue/es')['Spin'] ASubMenu: typeof import('ant-design-vue/es')['SubMenu'] ATable: typeof import('ant-design-vue/es')['Table'] + ATabPane: typeof import('ant-design-vue/es')['TabPane'] + ATabs: typeof import('ant-design-vue/es')['Tabs'] ATag: typeof import('ant-design-vue/es')['Tag'] ATextarea: typeof import('ant-design-vue/es')['Textarea'] ATimePicker: typeof import('ant-design-vue/es')['TimePicker'] diff --git a/policeManagement/src/views/query/index.tsx b/policeManagement/src/views/query/index.tsx index 1207abf..91f1519 100644 --- a/policeManagement/src/views/query/index.tsx +++ b/policeManagement/src/views/query/index.tsx @@ -24,7 +24,7 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => { const _mapRef = ref>(null) const _formParams = ref<_FormType>({ ...params }) - let city = '全国' + let city = '' const initMarker = (map: AMap.Map) => { //添加maker点 设置point const maker = new AMap.Marker({ From 85db3000d93c6109441fcfd48f54b2c8d3c68ead Mon Sep 17 00:00:00 2001 From: TimSpan Date: Tue, 19 Nov 2024 11:36:39 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=8F=98=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../myEnterprisesUnit/myEnterprisesUnit.vue | 21 ++++----- .../projectDetails/projectDetails.vue | 46 ++++++++++--------- .../projectManager/myProject/index.ts | 12 +++-- 3 files changed, 44 insertions(+), 35 deletions(-) diff --git a/collect_information/src/subPages/police/myEnterprisesUnit/myEnterprisesUnit.vue b/collect_information/src/subPages/police/myEnterprisesUnit/myEnterprisesUnit.vue index e02963b..10b9a5c 100644 --- a/collect_information/src/subPages/police/myEnterprisesUnit/myEnterprisesUnit.vue +++ b/collect_information/src/subPages/police/myEnterprisesUnit/myEnterprisesUnit.vue @@ -3,7 +3,7 @@ {{ item?.name }} - 单位类型:{{ item?.type.label }} + 单位类型:{{ item?.type?.label }} 地址: @@ -15,18 +15,17 @@ - - - 项目名称:{{serviceProject.name}} - 项目类型:{{serviceProject.type.label}} - - - 项目负责人:{{serviceProject.projectManagerMiniProgramUserInfo?.name?serviceProject.projectManagerMiniProgramUserInfo?.name:'无分配项目经理'}} - - 责任单位:{{serviceProject.securityUnitName}} + + + 项目名称:{{ serviceProject.name }} + 项目类型:{{ serviceProject.type?.label }} + + 项目负责人:{{ serviceProject.projectManagerMiniProgramUserInfo?.name ? serviceProject.projectManagerMiniProgramUserInfo?.name : '无分配项目经理' }} + + 责任单位:{{ serviceProject.securityUnitName }} + - diff --git a/collect_information/src/subPages/police/myEnterprisesUnit/projectDetails/projectDetails.vue b/collect_information/src/subPages/police/myEnterprisesUnit/projectDetails/projectDetails.vue index 306fcdd..d71dd8a 100644 --- a/collect_information/src/subPages/police/myEnterprisesUnit/projectDetails/projectDetails.vue +++ b/collect_information/src/subPages/police/myEnterprisesUnit/projectDetails/projectDetails.vue @@ -2,14 +2,12 @@ - + {{ enterprisesUnitName }}-----{{ serviceProject?.name }}项目 - - 经理名称:{{ serviceProject?.projectManagerMiniProgramUserInfo.name }} - + 经理名称:{{ serviceProject?.projectManagerMiniProgramUserInfo.name }} 手机号:{{ serviceProject?.projectManagerMiniProgramUserInfo.telephone }} @@ -47,26 +45,33 @@ 项目人员 - - + - + 姓名:{{ item?.name ? item?.name : '创建者' }} 性别:{{ item.sex?.label ? item.sex?.label : ' 隐藏' }} 职位:{{ item.workPost ? item.workPost : '创建者' }} - + 保安证件:{{ item.securityNumber ? item.securityNumber : '无' }} 出生年月:{{ dayjs(item.dateOfBirth).format('YYYY-MM-DD') }} - + 创建时间:{{ item.createTime }} - 身份证:{{ item.idCard }} + 身份证:{{ item.idCard?.desensitizedValue }} @@ -74,16 +79,15 @@ - + + From e3fd86a585fbb356b446d029335975202a752a66 Mon Sep 17 00:00:00 2001 From: TimSpan Date: Wed, 20 Nov 2024 10:25:03 +0800 Subject: [PATCH 5/5] Update .env.development --- collect_information/.env.development | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collect_information/.env.development b/collect_information/.env.development index d7a068a..4e393f7 100644 --- a/collect_information/.env.development +++ b/collect_information/.env.development @@ -1,7 +1,7 @@ # 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config TARO_APP_ID="wx0acd1c4fcf94bdd3" -TARO_APP_BASE_API="http://172.10.10.93:8765" -# TARO_APP_BASE_API="https://www.hnjinglian.cn:5678" +# TARO_APP_BASE_API="http://172.10.10.93:8765" +TARO_APP_BASE_API="https://www.hnjinglian.cn:5678"