From cae9ca114211e70f6ec8bfdefcc2e827ebe7331d Mon Sep 17 00:00:00 2001 From: wangyilin <1454641981@qq.com> Date: Fri, 30 Aug 2024 18:01:34 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=85=A5=E9=A9=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- securityManagement/.env.development | 6 +- securityManagement/.gitignore | 4 + securityManagement/package.json | 5 +- .../src/components/login/TelephoneLogin.vue | 2 +- .../upload/SingleImageFileUpload.vue | 95 +++++++++ securityManagement/src/config/index.ts | 2 +- securityManagement/src/global.d.ts | 53 +++++ securityManagement/src/router/index.ts | 2 +- .../src/router/staticRouters.ts | 17 +- securityManagement/src/utils/index.ts | 17 ++ securityManagement/src/utils/minioUtil.ts | 26 +++ securityManagement/src/views/enterprise.vue | 182 ++++++++++++++++++ securityManagement/src/views/test.vue | 13 ++ securityManagement/src/vite-env.d.ts | 4 + securityManagement/tsconfig.app.json | 2 +- securityManagement/tsconfig.node.json | 2 +- 16 files changed, 424 insertions(+), 8 deletions(-) create mode 100644 securityManagement/src/components/upload/SingleImageFileUpload.vue create mode 100644 securityManagement/src/utils/index.ts create mode 100644 securityManagement/src/utils/minioUtil.ts create mode 100644 securityManagement/src/views/enterprise.vue create mode 100644 securityManagement/src/views/test.vue diff --git a/securityManagement/.env.development b/securityManagement/.env.development index 522a69f..e876cce 100644 --- a/securityManagement/.env.development +++ b/securityManagement/.env.development @@ -5,7 +5,11 @@ VITE_DROP_CONSOLE=false # axios VITE_APP_BASE_API=/api -VITE_APP_PROXY_URL=http://localhost:8765 +VITE_APP_PROXY_URL=http://172.10.10.151:8765 # rsa 公钥 VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJps/EXxxSpEM1Ix4R0NWIOBciHCr7P7coDT8tNKfelgR7txcJOqHCO/MIWe7T04aHQTcpQxqx9hMca7dbqz8TZpz9jvLzE/6ZonVKxHsoFnNlHMp1/CPAJ9f6D9wYicum2KltJkmQ0g//D9W2zPCYoGOmSRFcZx/KEBa4EM53jQIDAQAB + +# minio +VITE_APP_MINIO_URL=http://118.253.177.137:9000 +VITE_APP_MINIO_BUCKET=police-security-dev diff --git a/securityManagement/.gitignore b/securityManagement/.gitignore index eca7316..88931a5 100644 --- a/securityManagement/.gitignore +++ b/securityManagement/.gitignore @@ -23,3 +23,7 @@ dist-ssr *.njsproj *.sln *.sw? + +package-lock.json +yarn.lock +components.d.ts \ No newline at end of file diff --git a/securityManagement/package.json b/securityManagement/package.json index abb937f..1986058 100644 --- a/securityManagement/package.json +++ b/securityManagement/package.json @@ -17,9 +17,12 @@ "pinia-plugin-persistedstate": "^3.2.0", "sass": "^1.77.8", "vue": "^3.4.37", - "vue-router": "4" + "vue-router": "4", + "vue-uuid": "^3.0.0", + "lodash-es": "^4.17.21" }, "devDependencies": { + "@types/lodash-es": "^4.17.8", "@types/node": "^22.5.1", "@vitejs/plugin-vue": "^5.1.2", "@vitejs/plugin-vue-jsx": "^4.0.1", diff --git a/securityManagement/src/components/login/TelephoneLogin.vue b/securityManagement/src/components/login/TelephoneLogin.vue index f1cc438..3e2b9a2 100644 --- a/securityManagement/src/components/login/TelephoneLogin.vue +++ b/securityManagement/src/components/login/TelephoneLogin.vue @@ -39,7 +39,7 @@ + + diff --git a/securityManagement/src/config/index.ts b/securityManagement/src/config/index.ts index be6b2cf..050672d 100644 --- a/securityManagement/src/config/index.ts +++ b/securityManagement/src/config/index.ts @@ -1,2 +1,2 @@ export const CLIENT_TYPE = "MANAGEMENT_SUPER"; -export const ROUTER_WHITE_LIST: string[] = ['/login', '/test']; +export const ROUTER_WHITE_LIST: string[] = ['/login', '/test','/enterprise']; diff --git a/securityManagement/src/global.d.ts b/securityManagement/src/global.d.ts index d977a79..f74eeff 100644 --- a/securityManagement/src/global.d.ts +++ b/securityManagement/src/global.d.ts @@ -8,3 +8,56 @@ interface JsonResult { message: string; data?: T; } + +/** + * 选择 + */ +class SelectNodeVo> { + value: T; + label: string; + options?: SelectNodeVo[] + orderIndex?: number; + disabled?: boolean; + extData?: E +} + +/** + * 树 + */ +class TreeNodeVo> { + value: T; + parentValue: T; + label: string; + orderIndex?: number; + children?: TreeNodeVo[] + extData?: E; +} + +/** + * 栅格布局 + */ +declare interface Grid { + //栅格占据的列数 + span?: number; + //栅格左侧的间隔格数 + offset?: number; + //栅格向右移动格数 + push?: number; + //栅格向左移动格数 + pull?: number; + //<768px 响应式栅格数或者栅格属性对象 + xs?: number; + //≥768px 响应式栅格数或者栅格属性对象 + sm?: number; + //≥992px 响应式栅格数或者栅格属性对象 + md?: number; + //≥1200px 响应式栅格数或者栅格属性对象 + lg?: number; + //≥1920px 响应式栅格数或者栅格属性对象 + xl?: number; +} + +interface BaseEnum { + value: T; + label: string +} diff --git a/securityManagement/src/router/index.ts b/securityManagement/src/router/index.ts index 015957e..3864660 100644 --- a/securityManagement/src/router/index.ts +++ b/securityManagement/src/router/index.ts @@ -29,7 +29,7 @@ router.beforeEach(async (to, from, next) => { if (ROUTER_WHITE_LIST.includes(to.path)) { return next(); } - //不在白名单内需要查看是否携带token 没有token需要返回登录页进行登录 + // 不在白名单内需要查看是否携带token 没有token需要返回登录页进行登录 if (!userStore.getTokenInfo?.value) { await message.warn('未找到token,请重新登陆!') return next('/login'); diff --git a/securityManagement/src/router/staticRouters.ts b/securityManagement/src/router/staticRouters.ts index ef81c78..c569483 100644 --- a/securityManagement/src/router/staticRouters.ts +++ b/securityManagement/src/router/staticRouters.ts @@ -1,6 +1,14 @@ import {RouteRecordRaw} from "vue-router"; export const staticRouter: RouteRecordRaw[] = [ + { + path: '/enterprise', + name: 'enterprise', + meta: { + title: '企业入驻', + }, + component: () => import("@/views/enterprise.vue"), + }, { path: '/login', name: 'login', @@ -11,6 +19,13 @@ export const staticRouter: RouteRecordRaw[] = [ }, { path: "/", redirect: '/index', + }, { + path: '/test', + name: 'test', + meta: { + title: '测试', + }, + component: () => import("@/views/test.vue"), }, { path: '/layout', name: 'layout', @@ -29,5 +44,5 @@ export const staticRouter: RouteRecordRaw[] = [ component: () => import('@/views/index.vue') } ] - } + }, ] diff --git a/securityManagement/src/utils/index.ts b/securityManagement/src/utils/index.ts new file mode 100644 index 0000000..257081a --- /dev/null +++ b/securityManagement/src/utils/index.ts @@ -0,0 +1,17 @@ +import {ceil, divide} from "lodash-es"; + +/** + * 将文件大小转为字符串格式 + * @param fileSizeInBytes + */ +export const convertFileSizeToStr = (fileSizeInBytes: number): string => { + if (fileSizeInBytes < 1024) { + return fileSizeInBytes + "B"; + } else if (fileSizeInBytes < 1024 * 1024) { + return (ceil(divide(fileSizeInBytes, 1024), 2)) + "KB"; + } else if (fileSizeInBytes < 1024 * 1024 * 1024) { + return (ceil(divide(fileSizeInBytes, (1024 * 1024)), 2)) + "MB"; + } else { + return (ceil(divide(fileSizeInBytes, (1024 * 1024 * 1024)), 2)) + "GB"; + } +} diff --git a/securityManagement/src/utils/minioUtil.ts b/securityManagement/src/utils/minioUtil.ts new file mode 100644 index 0000000..6b4e91f --- /dev/null +++ b/securityManagement/src/utils/minioUtil.ts @@ -0,0 +1,26 @@ +import api from "@/axios"; +import dayjs from "dayjs"; +import {uuid} from "vue-uuid"; + +/** + * 生成一个简单的对象文件地址 + * @param fileName 原始文件名 + * @param parentDir 上级目录 + */ +export const generateSimpleObjectName = (fileName: string, parentDir?: String): string => { + let objectName = parentDir + dayjs().format('/YYYY/MM/DD/') + uuid.v4().replace(/-/g, ''); + if (fileName && fileName.length > 0) { + objectName += fileName.substring(fileName.lastIndexOf('.')) + } + return objectName; +} + +/** + * 获取生成预签名的 URL + */ +export const getResignedObjectUrl = async (bucketName: string, objectName: string): Promise => { + return (await api.get('/common/getResignedObjectUrl', { + bucketName, + objectName + })).data as string; +} diff --git a/securityManagement/src/views/enterprise.vue b/securityManagement/src/views/enterprise.vue new file mode 100644 index 0000000..316dd16 --- /dev/null +++ b/securityManagement/src/views/enterprise.vue @@ -0,0 +1,182 @@ + + + + + \ No newline at end of file diff --git a/securityManagement/src/views/test.vue b/securityManagement/src/views/test.vue new file mode 100644 index 0000000..1a58db2 --- /dev/null +++ b/securityManagement/src/views/test.vue @@ -0,0 +1,13 @@ + + + \ No newline at end of file diff --git a/securityManagement/src/vite-env.d.ts b/securityManagement/src/vite-env.d.ts index adbe17c..eb53e48 100644 --- a/securityManagement/src/vite-env.d.ts +++ b/securityManagement/src/vite-env.d.ts @@ -11,6 +11,10 @@ interface ImportMetaEnv { readonly VITE_APP_BASE_API: string; readonly VITE_APP_PROXY_URL: string; + // minio + readonly VITE_APP_MINIO_URL: string + readonly VITE_APP_MINIO_BUCKET: string + // RSA公钥 readonly VITE_APP_RSA_PUBLIC_KEY: string; } diff --git a/securityManagement/tsconfig.app.json b/securityManagement/tsconfig.app.json index ac06e22..239e8eb 100644 --- a/securityManagement/tsconfig.app.json +++ b/securityManagement/tsconfig.app.json @@ -18,7 +18,7 @@ "jsx": "preserve", "jsxImportSource": "vue", /* Linting */ - "strict": true, + "strict": false, "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, diff --git a/securityManagement/tsconfig.node.json b/securityManagement/tsconfig.node.json index 9dbaccb..8aeefc6 100644 --- a/securityManagement/tsconfig.node.json +++ b/securityManagement/tsconfig.node.json @@ -13,7 +13,7 @@ "moduleDetection": "force", "noEmit": true, /* Linting */ - "strict": true, + "strict": false, "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true From 909d278772021f4edabb461533ce86369ed05b4d Mon Sep 17 00:00:00 2001 From: luozhun <2025254074@qq.com> Date: Fri, 30 Aug 2024 18:05:45 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PoliceUnitController.java | 3 - .../service/impl/SecurityUnitServiceImpl.java | 22 +------ .../resources/mapper/SecurityUnitMapper.xml | 65 ++++++++++++------- .../views/unitManage/securityUnit/index.vue | 11 +++- 4 files changed, 50 insertions(+), 51 deletions(-) diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/controller/PoliceUnitController.java b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/PoliceUnitController.java index ef662ee..5c9ce6b 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/controller/PoliceUnitController.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/PoliceUnitController.java @@ -33,7 +33,4 @@ public class PoliceUnitController { return policeUnitService.pager(queryParams); } - public static void main(String[] args) { - System.out.println(JavaClassToTsUtil.parse(PoliceUnitPagerVo.class)); - } } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/SecurityUnitServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/SecurityUnitServiceImpl.java index 595380d..3ae912c 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/SecurityUnitServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/SecurityUnitServiceImpl.java @@ -35,27 +35,7 @@ public class SecurityUnitServiceImpl extends ServiceImpl pager(PageParams queryParams) { - Page page = queryParams.getPage(); - SecurityUnitPagerQueryParams params = queryParams.getParams(); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() - .like(StrUtil.isNotEmpty(params.getName()), SecurityUnit::getName, params.getName()) - .like(StrUtil.isNotEmpty(params.getSocialCode()), SecurityUnit::getSocialCode, params.getSocialCode()); - - if (params.getCheckStatus() != null) { - wrapper.eq(SecurityUnit::getCheckStatus, params.getCheckStatus().getValue()); - } - if (params.getIsEnable() != null) { - wrapper.eq(SecurityUnit::getIsEnable, params.getIsEnable().getValue()); - } - - List administrativeDivisionCodes = params.getAdministrativeDivisionCodes(); - if (administrativeDivisionCodes != null) { - wrapper.eq(!administrativeDivisionCodes.isEmpty(), SecurityUnit::getProvince, administrativeDivisionCodes.get(0)); - wrapper.eq(administrativeDivisionCodes.size() >= 2, SecurityUnit::getCity, administrativeDivisionCodes.get(1)); - wrapper.eq(administrativeDivisionCodes.size() >= 3, SecurityUnit::getDistricts, administrativeDivisionCodes.get(2)); - wrapper.eq(administrativeDivisionCodes.size() >= 4, SecurityUnit::getStreet, administrativeDivisionCodes.get(3)); - } - return baseMapper.pager(page, params); + return baseMapper.pager(queryParams.getPage(), queryParams.getParams()); } @Override diff --git a/policeSecurityServer/src/main/resources/mapper/SecurityUnitMapper.xml b/policeSecurityServer/src/main/resources/mapper/SecurityUnitMapper.xml index 63367c5..bfa2fae 100644 --- a/policeSecurityServer/src/main/resources/mapper/SecurityUnitMapper.xml +++ b/policeSecurityServer/src/main/resources/mapper/SecurityUnitMapper.xml @@ -1,34 +1,51 @@ - select - * - from security_unit + *, + ad1.name as provinceName, + ad2.name as cityName, + ad3.name as districtsName, + ad4.name as streetName + from + security_unit su + left join administrative_division ad1 on su.province = ad1.code and ad1.delete_flag = 0 + left join administrative_division ad2 on su.city = ad2.code and ad2.delete_flag = 0 + left join administrative_division ad3 on su.districts = ad3.code and ad3.delete_flag = 0 + left join administrative_division ad4 on su.street = ad4.code and ad4.delete_flag = 0 where - delete_flag = 0 - - and name like concat('%',#{params.name},'%') - - - and socialCode like concat('%',#{params.socialCode},'%') - - - - and province = #{params.administrativeDivisionCodes[0]} + su.delete_flag = 0 + + and su.name like concat('%',#{params.name},'%') - - and city = #{params.administrativeDivisionCodes[1]} + + and su.socialCode like concat('%',#{params.socialCode},'%') - - and districts = #{params.administrativeDivisionCodes[2]} + + + and su.province = #{params.administrativeDivisionCodes[0]} + + + and su.city = #{params.administrativeDivisionCodes[1]} + + + and su.districts = #{params.administrativeDivisionCodes[2]} + + + and su.street = #{params.administrativeDivisionCodes[3]} + + order by su.create_time desc - - and street = #{params.administrativeDivisionCodes[3]} - - order by create_time desc - - and is_enable = #{params.isEnable.value} - and check_status = #{params.checkStatus.value} + and su.is_enable = #{params.isEnable.value} + and su.check_status = #{params.checkStatus.value} + order by su.create_time desc \ No newline at end of file diff --git a/superManagement/src/views/unitManage/securityUnit/index.vue b/superManagement/src/views/unitManage/securityUnit/index.vue index 9f018d6..2cfb478 100644 --- a/superManagement/src/views/unitManage/securityUnit/index.vue +++ b/superManagement/src/views/unitManage/securityUnit/index.vue @@ -34,7 +34,10 @@ const columns: TableProps['columns'] = [ title: '印业执照' }, { dataIndex: 'legalPersonInfo', - title: '法人信息' + title: '法人信息', + customRender({record}) { + return record.legalPersonInfo?.name + "/" + record.legalPersonInfo?.telephone + }, }, { dataIndex: 'provinceName', title: '行政区划', @@ -44,10 +47,12 @@ const columns: TableProps['columns'] = [ title: '性质' }, { dataIndex: 'isEnable', - title: '是否启用' + title: '是否启用', + customRender: ({text}) => text?.label, }, { dataIndex: 'checkStatus', - title: '审核状态' + title: '审核状态', + customRender: ({text}) => text?.label, }, { dataIndex: 'createTime', title: '创建时间' From 4dc5c2acef62b8834414b212a4c7c3501a9f0d1a Mon Sep 17 00:00:00 2001 From: wangyilin <1454641981@qq.com> Date: Fri, 30 Aug 2024 18:06:52 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=85=A5=E9=A9=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- securityManagement/src/views/enterprise.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/securityManagement/src/views/enterprise.vue b/securityManagement/src/views/enterprise.vue index 316dd16..0bb25a5 100644 --- a/securityManagement/src/views/enterprise.vue +++ b/securityManagement/src/views/enterprise.vue @@ -44,7 +44,7 @@ - 22 + From 28cf9ac1edbd976b1894de8d57c849242282cba2 Mon Sep 17 00:00:00 2001 From: wangyilin <1454641981@qq.com> Date: Fri, 30 Aug 2024 18:08:24 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=85=A5=E9=A9=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- securityManagement/src/views/enterprise.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/securityManagement/src/views/enterprise.vue b/securityManagement/src/views/enterprise.vue index 0bb25a5..7d9b4af 100644 --- a/securityManagement/src/views/enterprise.vue +++ b/securityManagement/src/views/enterprise.vue @@ -44,7 +44,7 @@ - +1 From 1db42de02836bd22bd134bd59e7d0d5d68a7219e Mon Sep 17 00:00:00 2001 From: wangyilin <1454641981@qq.com> Date: Fri, 30 Aug 2024 18:09:19 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=85=A5=E9=A9=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- securityManagement/src/views/enterprise.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/securityManagement/src/views/enterprise.vue b/securityManagement/src/views/enterprise.vue index 7d9b4af..0bb25a5 100644 --- a/securityManagement/src/views/enterprise.vue +++ b/securityManagement/src/views/enterprise.vue @@ -44,7 +44,7 @@ -1 + From e52490011a6c57d403397cb4ee8a7ca5ef6cb21e Mon Sep 17 00:00:00 2001 From: luozhun <2025254074@qq.com> Date: Mon, 2 Sep 2024 11:48:12 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=8D=95=E4=BD=8D=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E5=8F=8A=E7=8A=B6=E6=80=81=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/changhu/common/db/BaseEnum.java | 3 - .../changhu/common/db/enums/CheckStatus.java | 17 ++- .../changhu/common/db/enums/DeleteFlag.java | 1 - .../com/changhu/common/db/enums/IsEnable.java | 9 ++ .../com/changhu/common/db/enums/IsOrNot.java | 3 +- .../java/com/changhu/common/db/enums/Sex.java | 3 +- .../changhu/common/pojo/vo/TreeNodeVo.java | 5 +- .../common/validator/IsMobileValidator.java | 1 - .../common/validator/annotation/IdCard.java | 7 +- .../java/com/changhu/config/WebConfig.java | 3 + .../changhu/controller/CommonController.java | 1 - .../enums/handler/AbstractLoginHandler.java | 1 - .../controller/IndexController.java | 40 +++++++ .../controller/PoliceUnitController.java | 1 - .../controller/SecurityUnitController.java | 1 + .../module/management/enums/UnitOptType.java | 22 ++++ .../handler/AbstractUnitTypeHandler.java | 28 +++++ .../enums/handler/PoliceUnitTypeHandler.java | 106 +++++++++++++++++ .../handler/SecurityUnitTypeHandler.java | 108 ++++++++++++++++++ ...va => ManagementPoliceUnitUserMapper.java} | 2 +- .../management/mapper/SecurityUnitMapper.java | 3 - .../pojo/entity/ManagementPoliceUnitUser.java | 17 ++- .../entity/ManagementSecurityUnitUser.java | 17 ++- .../pojo/entity/ManagementSuperUser.java | 18 +-- .../management/pojo/entity/PoliceUnit.java | 12 +- .../management/pojo/entity/SecurityUnit.java | 12 +- .../pojo/params/IndexCheckPassParams.java | 22 ++++ .../pojo/params/IndexCheckStatusParams.java | 23 ++++ .../SecurityUnitSaveOrUpdateParams.java | 4 - .../management/pojo/vo/PoliceUnitPagerVo.java | 2 + .../management/pojo/vo/UnitCheckStatusVo.java | 22 ++++ .../management/service/IndexService.java | 28 +++++ ...a => ManagementPoliceUnitUserService.java} | 2 +- .../service/SecurityUnitService.java | 1 + .../service/impl/IndexServiceImpl.java | 29 +++++ ... ManagementPoliceUnitUserServiceImpl.java} | 6 +- .../service/impl/SecurityUnitServiceImpl.java | 14 +-- .../pojo/entity/AdministrativeDivision.java | 16 +-- .../params/SecurityUnitRegisterParams.java | 2 - .../service/impl/CommonServiceImpl.java | 1 - .../service/impl/LoginServiceImpl.java | 2 - .../fastjson2/filter/DesensitizedFilter.java | 1 - .../mybatisplus/pojo/entity/BaseEntity.java | 1 - .../manager/UserConnectWebsocketManager.java | 2 - .../ws/server/ManagementWebSocketServer.java | 2 - .../resources/mapper/PoliceUnitMapper.xml | 41 ++++--- .../resources/mapper/SecurityUnitMapper.xml | 3 +- .../src/views/unitManage/policeUnit/index.vue | 38 +++++- .../views/unitManage/securityUnit/index.vue | 61 ++++++++-- superManagement/src/vite-env.d.ts | 6 + 50 files changed, 646 insertions(+), 124 deletions(-) create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/management/controller/IndexController.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/management/enums/UnitOptType.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/management/enums/handler/AbstractUnitTypeHandler.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/management/enums/handler/PoliceUnitTypeHandler.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/management/enums/handler/SecurityUnitTypeHandler.java rename policeSecurityServer/src/main/java/com/changhu/module/management/mapper/{ManagementPoliceUserMapper.java => ManagementPoliceUnitUserMapper.java} (79%) create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/IndexCheckPassParams.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/IndexCheckStatusParams.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/UnitCheckStatusVo.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/management/service/IndexService.java rename policeSecurityServer/src/main/java/com/changhu/module/management/service/{ManagementPoliceUserService.java => ManagementPoliceUnitUserService.java} (77%) create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/IndexServiceImpl.java rename policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/{ManagementPoliceUserServiceImpl.java => ManagementPoliceUnitUserServiceImpl.java} (54%) 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 1d9f22c..9dd7153 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/db/BaseEnum.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/db/BaseEnum.java @@ -2,11 +2,8 @@ package com.changhu.common.db; import cn.hutool.core.lang.Dict; import cn.hutool.core.util.ObjectUtil; -import com.baomidou.mybatisplus.annotation.IEnum; import com.changhu.common.exception.MessageException; -import java.io.Serializable; - /** * author: luozhun * desc: BaseEnum 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 fae69b1..3116c84 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,8 @@ 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; import lombok.AllArgsConstructor; import lombok.Getter; @@ -14,10 +16,21 @@ import lombok.Getter; @AllArgsConstructor public enum CheckStatus implements BaseEnum, IEnum { - checked(0, "已审核"), - unChecked(1, "未审核"), + checked(0, "已审核", "success"), + unChecked(1, "未审核", "error"), ; private final Integer value; private final String label; + @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/DeleteFlag.java b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/DeleteFlag.java index e24502d..bc77c58 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/db/enums/DeleteFlag.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/DeleteFlag.java @@ -1,6 +1,5 @@ package com.changhu.common.db.enums; -import cn.hutool.core.lang.Dict; import com.changhu.common.db.BaseEnum; import lombok.AllArgsConstructor; import lombok.Getter; 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 5244f02..9ab863e 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,5 +1,6 @@ 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; @@ -24,4 +25,12 @@ 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/db/enums/IsOrNot.java b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/IsOrNot.java index 1b646c4..7472b62 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/db/enums/IsOrNot.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/IsOrNot.java @@ -1,5 +1,6 @@ package com.changhu.common.db.enums; +import com.baomidou.mybatisplus.annotation.IEnum; import com.changhu.common.db.BaseEnum; import lombok.AllArgsConstructor; import lombok.Getter; @@ -11,7 +12,7 @@ import lombok.Getter; */ @Getter @AllArgsConstructor -public enum IsOrNot implements BaseEnum { +public enum IsOrNot implements BaseEnum, IEnum { IS(0, "是"), NOT(1, "否"), ; diff --git a/policeSecurityServer/src/main/java/com/changhu/common/db/enums/Sex.java b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/Sex.java index d22db2e..066664c 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/db/enums/Sex.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/Sex.java @@ -1,5 +1,6 @@ package com.changhu.common.db.enums; +import com.baomidou.mybatisplus.annotation.IEnum; import com.changhu.common.db.BaseEnum; import lombok.AllArgsConstructor; import lombok.Getter; @@ -12,7 +13,7 @@ import lombok.Getter; */ @Getter @AllArgsConstructor -public enum Sex implements BaseEnum { +public enum Sex implements BaseEnum, IEnum { MAN(0, "男"), WOMAN(1, "女"), UNKNOWN(2, "隐藏"); diff --git a/policeSecurityServer/src/main/java/com/changhu/common/pojo/vo/TreeNodeVo.java b/policeSecurityServer/src/main/java/com/changhu/common/pojo/vo/TreeNodeVo.java index 2295eba..8b21da7 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/pojo/vo/TreeNodeVo.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/pojo/vo/TreeNodeVo.java @@ -13,7 +13,10 @@ import lombok.NoArgsConstructor; import org.springframework.lang.NonNull; import java.io.Serializable; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; diff --git a/policeSecurityServer/src/main/java/com/changhu/common/validator/IsMobileValidator.java b/policeSecurityServer/src/main/java/com/changhu/common/validator/IsMobileValidator.java index 7b839dc..7efd4a4 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/validator/IsMobileValidator.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/validator/IsMobileValidator.java @@ -2,7 +2,6 @@ package com.changhu.common.validator; import cn.hutool.core.lang.Validator; import cn.hutool.core.util.StrUtil; -import com.changhu.common.utils.ValidatorUtil; import com.changhu.common.validator.annotation.IsMobile; import jakarta.validation.ConstraintValidator; import jakarta.validation.ConstraintValidatorContext; diff --git a/policeSecurityServer/src/main/java/com/changhu/common/validator/annotation/IdCard.java b/policeSecurityServer/src/main/java/com/changhu/common/validator/annotation/IdCard.java index 4938da8..b9d0228 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/validator/annotation/IdCard.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/validator/annotation/IdCard.java @@ -8,12 +8,7 @@ import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.ANNOTATION_TYPE; -import static java.lang.annotation.ElementType.CONSTRUCTOR; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.ElementType.TYPE_USE; +import static java.lang.annotation.ElementType.*; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** diff --git a/policeSecurityServer/src/main/java/com/changhu/config/WebConfig.java b/policeSecurityServer/src/main/java/com/changhu/config/WebConfig.java index 1e0fc91..d9a481f 100644 --- a/policeSecurityServer/src/main/java/com/changhu/config/WebConfig.java +++ b/policeSecurityServer/src/main/java/com/changhu/config/WebConfig.java @@ -23,11 +23,14 @@ public class WebConfig implements WebMvcConfigurer { private final List whiteList = new ArrayList<>(); public WebConfig() { + //todo 要删除的 whiteList.add("/managementSuperUser/**"); + whiteList.add("/common/**"); whiteList.add("/test/**"); whiteList.add("/login"); whiteList.add("/logout"); + whiteList.add("/management/getCheckStatus"); whiteList.add("/favicon.ico"); //druid console whiteList.add("/druid/**"); diff --git a/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java b/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java index 045a868..3f3da94 100644 --- a/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java +++ b/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java @@ -20,7 +20,6 @@ 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.annotation.Resource; import jakarta.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; diff --git a/policeSecurityServer/src/main/java/com/changhu/enums/handler/AbstractLoginHandler.java b/policeSecurityServer/src/main/java/com/changhu/enums/handler/AbstractLoginHandler.java index 79b6777..4341284 100644 --- a/policeSecurityServer/src/main/java/com/changhu/enums/handler/AbstractLoginHandler.java +++ b/policeSecurityServer/src/main/java/com/changhu/enums/handler/AbstractLoginHandler.java @@ -2,7 +2,6 @@ package com.changhu.enums.handler; import com.alibaba.fastjson2.JSONObject; import com.changhu.common.pojo.vo.TokenInfo; -import org.apache.poi.ss.formula.functions.T; /** * @author 20252 diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/controller/IndexController.java b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/IndexController.java new file mode 100644 index 0000000..12ba752 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/IndexController.java @@ -0,0 +1,40 @@ +package com.changhu.module.management.controller; + +import com.changhu.common.annotation.JsonBody; +import com.changhu.module.management.pojo.params.IndexCheckPassParams; +import com.changhu.module.management.pojo.params.IndexCheckStatusParams; +import com.changhu.module.management.pojo.vo.UnitCheckStatusVo; +import com.changhu.module.management.service.IndexService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * @author 20252 + * @createTime 2024/9/2 上午9:48 + * @desc IndexController... + */ +@Tag(name = "后台-通用接口") +@JsonBody +@RequestMapping("/management") +public class IndexController { + + @Autowired + private IndexService indexService; + + @Operation(summary = "审核通过") + @PostMapping("/checkPass") + public void checkPass(@RequestBody @Valid IndexCheckPassParams params) { + indexService.checkPass(params); + } + + @Operation(summary = "获取审核状态") + @PostMapping("/getCheckStatus") + public UnitCheckStatusVo getCheckStatus(@RequestBody @Valid IndexCheckStatusParams params) { + return indexService.getCheckStatus(params); + } +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/controller/PoliceUnitController.java b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/PoliceUnitController.java index 5c9ce6b..f4be772 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/controller/PoliceUnitController.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/PoliceUnitController.java @@ -2,7 +2,6 @@ package com.changhu.module.management.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.changhu.common.annotation.JsonBody; -import com.changhu.common.utils.JavaClassToTsUtil; import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams; import com.changhu.module.management.pojo.vo.PoliceUnitPagerVo; import com.changhu.module.management.service.PoliceUnitService; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/controller/SecurityUnitController.java b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/SecurityUnitController.java index 877ee07..2d0ddbb 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/controller/SecurityUnitController.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/SecurityUnitController.java @@ -39,4 +39,5 @@ public class SecurityUnitController { public void saveOrUpdate(@RequestBody @Valid SecurityUnitSaveOrUpdateParams params) { securityUnitService.saveOrUpdate(params); } + } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/enums/UnitOptType.java b/policeSecurityServer/src/main/java/com/changhu/module/management/enums/UnitOptType.java new file mode 100644 index 0000000..d6116e2 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/enums/UnitOptType.java @@ -0,0 +1,22 @@ +package com.changhu.module.management.enums; + +import com.changhu.module.management.enums.handler.AbstractUnitTypeHandler; +import com.changhu.module.management.enums.handler.PoliceUnitTypeHandler; +import com.changhu.module.management.enums.handler.SecurityUnitTypeHandler; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author 20252 + * @createTime 2024/9/2 上午9:51 + * @desc IndexCheckPass... + */ +@AllArgsConstructor +@Getter +public enum UnitOptType { + + SECURITY_UNIT(new SecurityUnitTypeHandler()), + POLICE_UNIT(new PoliceUnitTypeHandler()); + + private final AbstractUnitTypeHandler handler; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/enums/handler/AbstractUnitTypeHandler.java b/policeSecurityServer/src/main/java/com/changhu/module/management/enums/handler/AbstractUnitTypeHandler.java new file mode 100644 index 0000000..01f3f48 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/enums/handler/AbstractUnitTypeHandler.java @@ -0,0 +1,28 @@ +package com.changhu.module.management.enums.handler; + +import cn.hutool.extra.spring.SpringUtil; +import com.changhu.module.management.pojo.vo.UnitCheckStatusVo; +import org.springframework.transaction.PlatformTransactionManager; + +/** + * @author 20252 + * @createTime 2024/9/2 上午9:53 + * @desc AbstractCheckPassHandler... + */ +public abstract class AbstractUnitTypeHandler { + + final PlatformTransactionManager transactionManager = SpringUtil.getBean(PlatformTransactionManager.class); + + /** + * 通过 + */ + public abstract void pass(Long checkDataId); + + /** + * 获取审核状态 + * + * @param onlyCode 唯一代码 + * @return 审核状态 + */ + public abstract UnitCheckStatusVo getCheckStatus(String onlyCode); +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/enums/handler/PoliceUnitTypeHandler.java b/policeSecurityServer/src/main/java/com/changhu/module/management/enums/handler/PoliceUnitTypeHandler.java new file mode 100644 index 0000000..0f49227 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/enums/handler/PoliceUnitTypeHandler.java @@ -0,0 +1,106 @@ +package com.changhu.module.management.enums.handler; + +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.spring.SpringUtil; +import com.changhu.common.db.enums.CheckStatus; +import com.changhu.common.db.enums.IsOrNot; +import com.changhu.common.db.enums.Sex; +import com.changhu.common.enums.ResultCode; +import com.changhu.common.exception.MessageException; +import com.changhu.common.utils.UserUtil; +import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser; +import com.changhu.module.management.pojo.entity.PoliceUnit; +import com.changhu.module.management.pojo.vo.UnitCheckStatusVo; +import com.changhu.module.management.service.ManagementPoliceUnitUserService; +import com.changhu.module.management.service.PoliceUnitService; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.extern.slf4j.Slf4j; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.support.DefaultTransactionDefinition; + +import java.util.List; + + +/** + * @author 20252 + * @createTime 2024/9/2 上午11:03 + * @desc PoliceUnitTypeHandler... + */ +@Slf4j +public class PoliceUnitTypeHandler extends AbstractUnitTypeHandler { + + private final PoliceUnitService policeUnitService = SpringUtil.getBean(PoliceUnitService.class); + + private final ManagementPoliceUnitUserService policeUnitUserService = SpringUtil.getBean(ManagementPoliceUnitUserService.class); + + @Override + + public void pass(Long checkDataId) { + DefaultTransactionDefinition def = new DefaultTransactionDefinition(); + TransactionStatus status = transactionManager.getTransaction(def); + + try { + PoliceUnit policeUnit = policeUnitService.getOptById(checkDataId).orElseThrow(() -> new MessageException(ResultCode.DATA_NOT_FOUND)); + //更新状态 + boolean update = policeUnitService.lambdaUpdate() + .set(PoliceUnit::getCheckStatus, CheckStatus.checked) + .eq(BaseEntity::getSnowFlakeId, checkDataId) + .update(); + if (!update) { + throw new MessageException(ResultCode.ERROR); + } + //生成管理员账号密码 + String passWordEncrypt = UserUtil.passWordEncrypt(UserUtil.DEFAULT_PASSWORD); + List saltAndPassWord = StrUtil.split(passWordEncrypt, "$$"); + + ManagementPoliceUnitUser managementPoliceUnitUser = new ManagementPoliceUnitUser(); + managementPoliceUnitUser.setPoliceUnitId(policeUnit.getSnowFlakeId()); + managementPoliceUnitUser.setName("超级管理员"); + managementPoliceUnitUser.setSex(Sex.UNKNOWN); + managementPoliceUnitUser.setAccount(RandomUtil.randomString(6)); + managementPoliceUnitUser.setTelephone(""); + managementPoliceUnitUser.setSalt(saltAndPassWord.get(0)); + managementPoliceUnitUser.setPassword(saltAndPassWord.get(1)); + managementPoliceUnitUser.setIsAdmin(IsOrNot.IS); + + boolean save = policeUnitUserService.save(managementPoliceUnitUser); + if (!save) { + throw new MessageException(ResultCode.ERROR); + } + + //提交事务 + transactionManager.commit(status); + } catch (Exception e) { + //回滚事务 + transactionManager.rollback(status); + log.error("公安单位审核通过错误:{}", e.getMessage()); + throw new MessageException(e.getMessage()); + } + } + + @Override + public UnitCheckStatusVo getCheckStatus(String onlyCode) { + PoliceUnit policeUnit = policeUnitService.lambdaQuery() + .eq(PoliceUnit::getCode, onlyCode) + .oneOpt() + .orElseThrow(() -> new MessageException(ResultCode.DATA_NOT_FOUND)); + + UnitCheckStatusVo unitCheckStatusVo = new UnitCheckStatusVo(); + unitCheckStatusVo.setCheckStatus(policeUnit.getCheckStatus()); + + if (policeUnit.getCheckStatus().equals(CheckStatus.checked)) { + ManagementPoliceUnitUser managementPoliceUnitUser = policeUnitUserService.lambdaQuery() + .eq(ManagementPoliceUnitUser::getPoliceUnitId, policeUnit.getSnowFlakeId()) + .eq(ManagementPoliceUnitUser::getIsAdmin, IsOrNot.IS) + .oneOpt() + .orElseThrow(() -> new MessageException("超管账号未初始化 请联系管理员")); + unitCheckStatusVo.setAccount(managementPoliceUnitUser.getAccount()); + unitCheckStatusVo.setRemark("恭喜!单位审核通过了,请使用管理员账号前往登录页进行登录."); + } else { + unitCheckStatusVo.setPassword(null); + unitCheckStatusVo.setRemark("单位注册申请正在审核中..."); + } + return unitCheckStatusVo; + } +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/enums/handler/SecurityUnitTypeHandler.java b/policeSecurityServer/src/main/java/com/changhu/module/management/enums/handler/SecurityUnitTypeHandler.java new file mode 100644 index 0000000..a67df1a --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/enums/handler/SecurityUnitTypeHandler.java @@ -0,0 +1,108 @@ +package com.changhu.module.management.enums.handler; + +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.spring.SpringUtil; +import com.changhu.common.db.enums.CheckStatus; +import com.changhu.common.db.enums.IsEnable; +import com.changhu.common.db.enums.IsOrNot; +import com.changhu.common.db.enums.Sex; +import com.changhu.common.enums.ResultCode; +import com.changhu.common.exception.MessageException; +import com.changhu.common.utils.UserUtil; +import com.changhu.module.management.pojo.entity.ManagementSecurityUnitUser; +import com.changhu.module.management.pojo.entity.SecurityUnit; +import com.changhu.module.management.pojo.vo.UnitCheckStatusVo; +import com.changhu.module.management.service.ManagementSecurityUnitUserService; +import com.changhu.module.management.service.SecurityUnitService; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.extern.slf4j.Slf4j; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.support.DefaultTransactionDefinition; + +import java.util.List; + +/** + * @author 20252 + * @createTime 2024/9/2 上午9:55 + * @desc SecurityCheckPassHandler... + */ +@Slf4j +public class SecurityUnitTypeHandler extends AbstractUnitTypeHandler { + + private final SecurityUnitService securityUnitService = SpringUtil.getBean(SecurityUnitService.class); + + private final ManagementSecurityUnitUserService securityUnitUserService = SpringUtil.getBean(ManagementSecurityUnitUserService.class); + + @Override + public void pass(Long checkDataId) { + DefaultTransactionDefinition def = new DefaultTransactionDefinition(); + TransactionStatus status = transactionManager.getTransaction(def); + + try { + SecurityUnit securityUnit = securityUnitService.getOptById(checkDataId).orElseThrow(() -> new MessageException(ResultCode.DATA_NOT_FOUND)); + //更新状态 + boolean update = securityUnitService.lambdaUpdate() + .set(SecurityUnit::getCheckStatus, CheckStatus.checked) + .eq(BaseEntity::getSnowFlakeId, checkDataId) + .update(); + if (!update) { + throw new MessageException(ResultCode.ERROR); + } + //生成简单的超级管理员账号密码 + String passWordEncrypt = UserUtil.passWordEncrypt(UserUtil.DEFAULT_PASSWORD); + List saltAndPassWord = StrUtil.split(passWordEncrypt, "$$"); + + ManagementSecurityUnitUser managementSecurityUnitUser = new ManagementSecurityUnitUser(); + managementSecurityUnitUser.setSecurityUnitId(securityUnit.getSnowFlakeId()); + managementSecurityUnitUser.setName("超级管理员"); + managementSecurityUnitUser.setSex(Sex.UNKNOWN); + managementSecurityUnitUser.setAccount(RandomUtil.randomString(6)); + managementSecurityUnitUser.setTelephone(""); + managementSecurityUnitUser.setSalt(saltAndPassWord.get(0)); + managementSecurityUnitUser.setPassword(saltAndPassWord.get(1)); + managementSecurityUnitUser.setIsEnable(IsEnable.TRUE); + managementSecurityUnitUser.setIsAdmin(IsOrNot.IS); + managementSecurityUnitUser.setRemark("单位审核通过 默认分配超管账号"); + boolean save = securityUnitUserService.save(managementSecurityUnitUser); + if (!save) { + throw new MessageException(ResultCode.ERROR); + } + + //提交事务 + transactionManager.commit(status); + } catch (Exception e) { + //回滚事务 + transactionManager.rollback(status); + log.error("保安单位审核通过错误:{}", e.getMessage()); + throw new MessageException(e.getMessage()); + } + } + + @Override + public UnitCheckStatusVo getCheckStatus(String onlyCode) { + SecurityUnit securityUnit = securityUnitService.lambdaQuery() + .eq(SecurityUnit::getSocialCode, onlyCode) + .oneOpt() + .orElseThrow(() -> new MessageException(ResultCode.DATA_NOT_FOUND)); + + UnitCheckStatusVo unitCheckStatusVo = new UnitCheckStatusVo(); + unitCheckStatusVo.setCheckStatus(securityUnit.getCheckStatus()); + + if (securityUnit.getCheckStatus().equals(CheckStatus.checked)) { + ManagementSecurityUnitUser managementSecurityUnitUser = securityUnitUserService.lambdaQuery() + .eq(ManagementSecurityUnitUser::getSecurityUnitId, securityUnit.getSnowFlakeId()) + .eq(ManagementSecurityUnitUser::getIsAdmin, IsOrNot.IS) + .oneOpt() + .orElseThrow(() -> new MessageException("超管账号未初始化 请联系管理员")); + unitCheckStatusVo.setAccount(managementSecurityUnitUser.getAccount()); + unitCheckStatusVo.setRemark("恭喜!单位审核通过了,请使用管理员账号前往登录页进行登录."); + } else { + unitCheckStatusVo.setPassword(null); + unitCheckStatusVo.setRemark("单位注册申请正在审核中..."); + } + + return unitCheckStatusVo; + } + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/mapper/ManagementPoliceUserMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/management/mapper/ManagementPoliceUnitUserMapper.java similarity index 79% rename from policeSecurityServer/src/main/java/com/changhu/module/management/mapper/ManagementPoliceUserMapper.java rename to policeSecurityServer/src/main/java/com/changhu/module/management/mapper/ManagementPoliceUnitUserMapper.java index 3a02194..7eea1e6 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/mapper/ManagementPoliceUserMapper.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/mapper/ManagementPoliceUnitUserMapper.java @@ -10,6 +10,6 @@ import org.apache.ibatis.annotations.Mapper; * desc 由groovy脚本自动生成 */ @Mapper -public interface ManagementPoliceUserMapper extends BaseMapper { +public interface ManagementPoliceUnitUserMapper extends BaseMapper { } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/mapper/SecurityUnitMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/management/mapper/SecurityUnitMapper.java index 0d1a407..cf0e1fe 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/mapper/SecurityUnitMapper.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/mapper/SecurityUnitMapper.java @@ -1,9 +1,6 @@ package com.changhu.module.management.mapper; -import com.baomidou.mybatisplus.core.conditions.Wrapper; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.changhu.module.management.pojo.entity.SecurityUnit; import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ManagementPoliceUnitUser.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ManagementPoliceUnitUser.java index a15eeaa..a43b52b 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ManagementPoliceUnitUser.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ManagementPoliceUnitUser.java @@ -1,18 +1,18 @@ package com.changhu.module.management.pojo.entity; -import java.io.Serial; -import java.io.Serializable; - +import com.baomidou.mybatisplus.annotation.TableName; import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.IsOrNot; import com.changhu.common.db.enums.Sex; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; -import lombok.Data; import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; -import lombok.EqualsAndHashCode; -import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serial; +import java.io.Serializable; /** @@ -46,6 +46,11 @@ public class ManagementPoliceUnitUser extends BaseEntity implements Serializable */ private Sex sex; + /** + * 账号 + */ + private String account; + /** * 手机号 */ diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ManagementSecurityUnitUser.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ManagementSecurityUnitUser.java index fddfed0..4619b82 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ManagementSecurityUnitUser.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ManagementSecurityUnitUser.java @@ -1,18 +1,18 @@ package com.changhu.module.management.pojo.entity; -import java.io.Serial; -import java.io.Serializable; - +import com.baomidou.mybatisplus.annotation.TableName; import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.IsOrNot; import com.changhu.common.db.enums.Sex; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; -import lombok.Data; import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; -import lombok.EqualsAndHashCode; -import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serial; +import java.io.Serializable; /** @@ -46,6 +46,11 @@ public class ManagementSecurityUnitUser extends BaseEntity implements Serializab */ private Sex sex; + /** + * 账号 + */ + private String account; + /** * 手机号 */ diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ManagementSuperUser.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ManagementSuperUser.java index 9ecaa0f..a2a4e1e 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ManagementSuperUser.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ManagementSuperUser.java @@ -1,17 +1,17 @@ package com.changhu.module.management.pojo.entity; +import com.baomidou.mybatisplus.annotation.TableName; +import com.changhu.common.db.enums.IsEnable; +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.IsEnable; -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/management/pojo/entity/PoliceUnit.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/PoliceUnit.java index 4e766c9..6598f97 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/PoliceUnit.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/PoliceUnit.java @@ -1,20 +1,20 @@ package com.changhu.module.management.pojo.entity; -import java.io.Serial; -import java.io.Serializable; - import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler; import com.changhu.common.db.enums.CheckStatus; import com.changhu.common.db.enums.IsEnable; import com.changhu.module.management.pojo.model.ContactPersonInfo; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; -import lombok.Data; import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; -import lombok.EqualsAndHashCode; -import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serial; +import java.io.Serializable; /** diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/SecurityUnit.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/SecurityUnit.java index 357aad6..ae2445b 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/SecurityUnit.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/SecurityUnit.java @@ -1,20 +1,20 @@ package com.changhu.module.management.pojo.entity; -import java.io.Serial; -import java.io.Serializable; - import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler; import com.changhu.common.db.enums.CheckStatus; import com.changhu.common.db.enums.IsEnable; import com.changhu.module.management.pojo.model.LegalPersonInfo; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; -import lombok.Data; import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; -import lombok.EqualsAndHashCode; -import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serial; +import java.io.Serializable; /** diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/IndexCheckPassParams.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/IndexCheckPassParams.java new file mode 100644 index 0000000..adb448b --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/IndexCheckPassParams.java @@ -0,0 +1,22 @@ +package com.changhu.module.management.pojo.params; + +import com.changhu.module.management.enums.UnitOptType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/9/2 上午9:59 + * @desc IndexCheckPassParams... + */ +@Data +public class IndexCheckPassParams { + @Schema(description = "审核数据的id") + @NotNull(message = "审核数据的id不能为空") + private Long checkDataId; + + @Schema(description = "单位类型") + @NotNull(message = "单位类型不能为空") + private UnitOptType unitOptType; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/IndexCheckStatusParams.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/IndexCheckStatusParams.java new file mode 100644 index 0000000..7cce7c9 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/IndexCheckStatusParams.java @@ -0,0 +1,23 @@ +package com.changhu.module.management.pojo.params; + +import com.changhu.module.management.enums.UnitOptType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/9/2 上午10:51 + * @desc IndexCheckStatusParams... + */ +@Data +public class IndexCheckStatusParams { + + @Schema(description = "审核数据的唯一标识") + @NotNull(message = "唯一标识不能为空") + private String onlyCode; + + @Schema(description = "单位类型") + @NotNull(message = "单位类型不能为空") + private UnitOptType unitOptType; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/SecurityUnitSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/SecurityUnitSaveOrUpdateParams.java index 2b45ee3..cc59f7c 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/SecurityUnitSaveOrUpdateParams.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/SecurityUnitSaveOrUpdateParams.java @@ -1,10 +1,6 @@ package com.changhu.module.management.pojo.params; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler; -import com.changhu.common.db.enums.CheckStatus; import com.changhu.common.db.enums.IsEnable; -import com.changhu.common.validator.annotation.IsMobile; import com.changhu.module.management.pojo.model.LegalPersonInfo; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/PoliceUnitPagerVo.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/PoliceUnitPagerVo.java index f47a20b..e78fd8c 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/PoliceUnitPagerVo.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/PoliceUnitPagerVo.java @@ -4,6 +4,7 @@ import com.changhu.common.db.enums.CheckStatus; import com.changhu.common.db.enums.IsEnable; import com.changhu.module.management.pojo.model.ContactPersonInfo; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; import java.time.LocalDateTime; @@ -12,6 +13,7 @@ import java.time.LocalDateTime; * @createTime 2024/8/30 下午3:55 * @desc PoliceUnitPagerVo... */ +@Data public class PoliceUnitPagerVo { @Schema(description = "id") diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/UnitCheckStatusVo.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/UnitCheckStatusVo.java new file mode 100644 index 0000000..de656c9 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/UnitCheckStatusVo.java @@ -0,0 +1,22 @@ +package com.changhu.module.management.pojo.vo; + +import com.changhu.common.db.enums.CheckStatus; +import com.changhu.common.utils.UserUtil; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/9/2 上午10:42 + * @desc SecurityUnitCheckStatusVo... + */ +@Data +public class UnitCheckStatusVo { + + private CheckStatus checkStatus; + + private String remark; + + private String account; + + private String password = UserUtil.DEFAULT_PASSWORD; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/service/IndexService.java b/policeSecurityServer/src/main/java/com/changhu/module/management/service/IndexService.java new file mode 100644 index 0000000..58507d4 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/service/IndexService.java @@ -0,0 +1,28 @@ +package com.changhu.module.management.service; + +import com.changhu.module.management.pojo.params.IndexCheckPassParams; +import com.changhu.module.management.pojo.params.IndexCheckStatusParams; +import com.changhu.module.management.pojo.vo.UnitCheckStatusVo; + +/** + * @author 20252 + * @createTime 2024/9/2 上午9:49 + * @desc IndexService... + */ +public interface IndexService { + + /** + * 审核通过 + * + * @param params 审核参数 + */ + void checkPass(IndexCheckPassParams params); + + /** + * 获取审核状态 + * + * @param params 参数 + * @return 结果 + */ + UnitCheckStatusVo getCheckStatus(IndexCheckStatusParams params); +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/service/ManagementPoliceUserService.java b/policeSecurityServer/src/main/java/com/changhu/module/management/service/ManagementPoliceUnitUserService.java similarity index 77% rename from policeSecurityServer/src/main/java/com/changhu/module/management/service/ManagementPoliceUserService.java rename to policeSecurityServer/src/main/java/com/changhu/module/management/service/ManagementPoliceUnitUserService.java index eeace45..d70efca 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/service/ManagementPoliceUserService.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/service/ManagementPoliceUnitUserService.java @@ -8,6 +8,6 @@ import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser; * author: luozhun * desc 由groovy脚本自动生成 */ -public interface ManagementPoliceUserService extends IService { +public interface ManagementPoliceUnitUserService extends IService { } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/service/SecurityUnitService.java b/policeSecurityServer/src/main/java/com/changhu/module/management/service/SecurityUnitService.java index 373384f..8bc4a59 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/service/SecurityUnitService.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/service/SecurityUnitService.java @@ -29,4 +29,5 @@ public interface SecurityUnitService extends IService { * @param params 参数 */ void saveOrUpdate(SecurityUnitSaveOrUpdateParams params); + } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/IndexServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/IndexServiceImpl.java new file mode 100644 index 0000000..d3efd13 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/IndexServiceImpl.java @@ -0,0 +1,29 @@ +package com.changhu.module.management.service.impl; + +import com.changhu.module.management.pojo.params.IndexCheckPassParams; +import com.changhu.module.management.pojo.params.IndexCheckStatusParams; +import com.changhu.module.management.pojo.vo.UnitCheckStatusVo; +import com.changhu.module.management.service.IndexService; +import org.springframework.stereotype.Service; + +/** + * @author 20252 + * @createTime 2024/9/2 上午9:49 + * @desc IndexServiceImpl... + */ +@Service +public class IndexServiceImpl implements IndexService { + @Override + public void checkPass(IndexCheckPassParams params) { + params.getUnitOptType() + .getHandler() + .pass(params.getCheckDataId()); + } + + @Override + public UnitCheckStatusVo getCheckStatus(IndexCheckStatusParams params) { + return params.getUnitOptType() + .getHandler() + .getCheckStatus(params.getOnlyCode()); + } +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementPoliceUserServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementPoliceUnitUserServiceImpl.java similarity index 54% rename from policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementPoliceUserServiceImpl.java rename to policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementPoliceUnitUserServiceImpl.java index 46339f7..821ae52 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementPoliceUserServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementPoliceUnitUserServiceImpl.java @@ -1,9 +1,9 @@ package com.changhu.module.management.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.changhu.module.management.mapper.ManagementPoliceUserMapper; +import com.changhu.module.management.mapper.ManagementPoliceUnitUserMapper; import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser; -import com.changhu.module.management.service.ManagementPoliceUserService; +import com.changhu.module.management.service.ManagementPoliceUnitUserService; import org.springframework.stereotype.Service; /** @@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; * desc 由groovy脚本自动生成 */ @Service -public class ManagementPoliceUserServiceImpl extends ServiceImpl implements ManagementPoliceUserService { +public class ManagementPoliceUnitUserServiceImpl extends ServiceImpl implements ManagementPoliceUnitUserService { } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/SecurityUnitServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/SecurityUnitServiceImpl.java index 3ae912c..c6563a5 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/SecurityUnitServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/SecurityUnitServiceImpl.java @@ -1,28 +1,18 @@ package com.changhu.module.management.service.impl; import cn.hutool.core.bean.BeanUtil; -import com.changhu.common.utils.JavaClassToTsUtil; -import com.changhu.module.management.pojo.model.LegalPersonInfo; -import com.changhu.module.management.pojo.params.SecurityUnitSaveOrUpdateParams; -import com.google.common.collect.Lists; -import com.changhu.common.db.enums.IsEnable; -import com.changhu.common.db.enums.CheckStatus; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.changhu.common.utils.JavaClassToTsUtil; import com.changhu.module.management.mapper.SecurityUnitMapper; import com.changhu.module.management.pojo.entity.SecurityUnit; +import com.changhu.module.management.pojo.params.SecurityUnitSaveOrUpdateParams; import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams; import com.changhu.module.management.pojo.vo.SecurityUnitPagerVo; import com.changhu.module.management.service.SecurityUnitService; import com.changhu.support.mybatisplus.pojo.params.PageParams; import org.springframework.stereotype.Service; -import java.util.List; import java.util.Optional; /** diff --git a/policeSecurityServer/src/main/java/com/changhu/pojo/entity/AdministrativeDivision.java b/policeSecurityServer/src/main/java/com/changhu/pojo/entity/AdministrativeDivision.java index bc139d1..ee5ea03 100644 --- a/policeSecurityServer/src/main/java/com/changhu/pojo/entity/AdministrativeDivision.java +++ b/policeSecurityServer/src/main/java/com/changhu/pojo/entity/AdministrativeDivision.java @@ -1,16 +1,16 @@ package com.changhu.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; - /** * 全国行政区划表(2023/12/04) 实体类 diff --git a/policeSecurityServer/src/main/java/com/changhu/pojo/params/SecurityUnitRegisterParams.java b/policeSecurityServer/src/main/java/com/changhu/pojo/params/SecurityUnitRegisterParams.java index 91f2b8f..cd3ee47 100644 --- a/policeSecurityServer/src/main/java/com/changhu/pojo/params/SecurityUnitRegisterParams.java +++ b/policeSecurityServer/src/main/java/com/changhu/pojo/params/SecurityUnitRegisterParams.java @@ -2,10 +2,8 @@ package com.changhu.pojo.params; import com.changhu.module.management.pojo.model.LegalPersonInfo; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.Valid; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.NotNull; import lombok.Data; import java.util.List; diff --git a/policeSecurityServer/src/main/java/com/changhu/service/impl/CommonServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/service/impl/CommonServiceImpl.java index c62966f..e3d113e 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/impl/CommonServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/impl/CommonServiceImpl.java @@ -2,7 +2,6 @@ package com.changhu.service.impl; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.toolkit.Db; import com.changhu.common.enums.ResultCode; import com.changhu.common.exception.MessageException; import com.changhu.common.pojo.model.JsonResult; diff --git a/policeSecurityServer/src/main/java/com/changhu/service/impl/LoginServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/service/impl/LoginServiceImpl.java index 03db67d..2bdf875 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/impl/LoginServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/impl/LoginServiceImpl.java @@ -1,8 +1,6 @@ package com.changhu.service.impl; import com.changhu.common.pojo.vo.TokenInfo; -import com.changhu.enums.ClientType; -import com.changhu.enums.handler.AbstractLoginHandler; import com.changhu.pojo.params.LoginParams; import com.changhu.service.LoginService; import org.springframework.stereotype.Service; diff --git a/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/filter/DesensitizedFilter.java b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/filter/DesensitizedFilter.java index e00a93d..b4a0ff0 100644 --- a/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/filter/DesensitizedFilter.java +++ b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/filter/DesensitizedFilter.java @@ -6,7 +6,6 @@ import com.changhu.common.annotation.Desensitized; import lombok.extern.slf4j.Slf4j; import java.lang.reflect.Field; -import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/pojo/entity/BaseEntity.java b/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/pojo/entity/BaseEntity.java index 3bc50d8..a5705a5 100644 --- a/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/pojo/entity/BaseEntity.java +++ b/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/pojo/entity/BaseEntity.java @@ -1,7 +1,6 @@ package com.changhu.support.mybatisplus.pojo.entity; import com.baomidou.mybatisplus.annotation.*; -import com.changhu.common.db.enums.DeleteFlag; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/policeSecurityServer/src/main/java/com/changhu/support/ws/manager/UserConnectWebsocketManager.java b/policeSecurityServer/src/main/java/com/changhu/support/ws/manager/UserConnectWebsocketManager.java index 2ed4e54..ae7b47e 100644 --- a/policeSecurityServer/src/main/java/com/changhu/support/ws/manager/UserConnectWebsocketManager.java +++ b/policeSecurityServer/src/main/java/com/changhu/support/ws/manager/UserConnectWebsocketManager.java @@ -1,7 +1,6 @@ package com.changhu.support.ws.manager; import com.alibaba.fastjson2.JSON; -import com.changhu.support.ws.enums.WsMsgType; import com.changhu.support.ws.pojo.dto.WsMsgDTO; import lombok.extern.slf4j.Slf4j; import org.springframework.web.socket.TextMessage; @@ -9,7 +8,6 @@ import org.springframework.web.socket.WebSocketSession; import org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator; import java.io.IOException; -import java.time.LocalDateTime; import java.util.Map; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; diff --git a/policeSecurityServer/src/main/java/com/changhu/support/ws/server/ManagementWebSocketServer.java b/policeSecurityServer/src/main/java/com/changhu/support/ws/server/ManagementWebSocketServer.java index 8721374..2b38d09 100644 --- a/policeSecurityServer/src/main/java/com/changhu/support/ws/server/ManagementWebSocketServer.java +++ b/policeSecurityServer/src/main/java/com/changhu/support/ws/server/ManagementWebSocketServer.java @@ -9,8 +9,6 @@ import com.changhu.support.ws.manager.UserConnectWebsocketManager; import com.changhu.support.ws.pojo.dto.WsMsgDTO; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Component; import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.TextMessage; diff --git a/policeSecurityServer/src/main/resources/mapper/PoliceUnitMapper.xml b/policeSecurityServer/src/main/resources/mapper/PoliceUnitMapper.xml index 7ca25df..c6d5f6a 100644 --- a/policeSecurityServer/src/main/resources/mapper/PoliceUnitMapper.xml +++ b/policeSecurityServer/src/main/resources/mapper/PoliceUnitMapper.xml @@ -1,28 +1,43 @@ - + select + pu.*, + ad1.name as provinceName, + ad2.name as cityName, + ad3.name as districtsName, + ad4.name as streetName + from police_unit pu + left join administrative_division ad1 on pu.province = ad1.code and ad1.delete_flag = 0 + left join administrative_division ad2 on pu.city = ad2.code and ad2.delete_flag = 0 + left join administrative_division ad3 on pu.districts = ad3.code and ad3.delete_flag = 0 + left join administrative_division ad4 on pu.street = ad4.code and ad4.delete_flag = 0 + where pu.delete_flag = 0 + and pu.name like concat('%',#{params.name},'%') + and pu.code like concat('%',#{params.code},'%') - and province = #{params.administrativeDivisionCodes[0]} + and pu.province = #{params.administrativeDivisionCodes[0]} - and city = #{params.administrativeDivisionCodes[1]} + and pu.city = #{params.administrativeDivisionCodes[1]} - and districts = #{params.administrativeDivisionCodes[2]} + and pu.districts = #{params.administrativeDivisionCodes[2]} - and street = #{params.administrativeDivisionCodes[3]} + and pu.street = #{params.administrativeDivisionCodes[3]} - order by create_time desc - and is_enable = #{params.isEnable.value} - and check_status = #{params.checkStatus.value} + and pu.is_enable = #{params.isEnable.value} + and pu.check_status = #{params.checkStatus.value} + order by pu.create_time desc \ No newline at end of file diff --git a/policeSecurityServer/src/main/resources/mapper/SecurityUnitMapper.xml b/policeSecurityServer/src/main/resources/mapper/SecurityUnitMapper.xml index bfa2fae..4a936cd 100644 --- a/policeSecurityServer/src/main/resources/mapper/SecurityUnitMapper.xml +++ b/policeSecurityServer/src/main/resources/mapper/SecurityUnitMapper.xml @@ -7,10 +7,9 @@ typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler" property="legalPersonInfo"/> -