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 8b21da7..96a7780 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 @@ -46,6 +46,11 @@ public class TreeNodeVo implements Serializable { */ @Schema(description = "节点名称") private String label; + /** + * 是否是叶子节点 + */ + @Schema(description = "是否是叶子节点") + private Boolean isLeaf; /** * 排序 */ diff --git a/policeSecurityServer/src/main/java/com/changhu/common/utils/RsaUtil.java b/policeSecurityServer/src/main/java/com/changhu/common/utils/RsaUtil.java index 3c61de5..ec36116 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/utils/RsaUtil.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/utils/RsaUtil.java @@ -58,10 +58,4 @@ public class RsaUtil { } } - public static void main(String[] args) { - RSA rs = new RSA(); - System.out.println(rs.getPublicKeyBase64()); - System.out.println(rs.getPrivateKeyBase64()); - } - } diff --git a/policeSecurityServer/src/main/java/com/changhu/config/WebConfig.java b/policeSecurityServer/src/main/java/com/changhu/config/WebConfig.java index 35c4e95..15fd4a3 100644 --- a/policeSecurityServer/src/main/java/com/changhu/config/WebConfig.java +++ b/policeSecurityServer/src/main/java/com/changhu/config/WebConfig.java @@ -63,16 +63,16 @@ public class WebConfig implements WebMvcConfigurer { .addPathPatterns("/open/**"); } - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**") - .allowedOriginPatterns("*") - .allowedMethods("GET", "POST", "OPTION", "PUT", "DELETE") - .allowedHeaders("Content-Type", "X-Requested-With", "accept", "Origin", "Access-Control-Request-Method", - "Access-Control-Request-Headers", "Authorization","Token","*") - .allowCredentials(true) - .maxAge(3600); - } +// @Override +// public void addCorsMappings(CorsRegistry registry) { +// registry.addMapping("/**") +// .allowedOriginPatterns("*") +// .allowedMethods("GET", "POST", "OPTION", "PUT", "DELETE") +// .allowedHeaders("Content-Type", "X-Requested-With", "accept", "Origin", "Access-Control-Request-Method", +// "Access-Control-Request-Headers", "Authorization","Token","*") +// .allowCredentials(true) +// .maxAge(3600); +// } @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { diff --git a/policeSecurityServer/src/main/java/com/changhu/controller/OpenController.java b/policeSecurityServer/src/main/java/com/changhu/controller/OpenController.java index 8ec4b5a..99ec8d7 100644 --- a/policeSecurityServer/src/main/java/com/changhu/controller/OpenController.java +++ b/policeSecurityServer/src/main/java/com/changhu/controller/OpenController.java @@ -1,6 +1,5 @@ package com.changhu.controller; -import cn.hutool.core.util.IdUtil; import com.changhu.common.annotation.CheckOpenApi; import com.changhu.common.annotation.JsonBody; import com.changhu.common.enums.OpenApiType; diff --git a/policeSecurityServer/src/main/java/com/changhu/mapper/AdministrativeDivisionMapper.java b/policeSecurityServer/src/main/java/com/changhu/mapper/AdministrativeDivisionMapper.java index eb31e58..2e53acb 100644 --- a/policeSecurityServer/src/main/java/com/changhu/mapper/AdministrativeDivisionMapper.java +++ b/policeSecurityServer/src/main/java/com/changhu/mapper/AdministrativeDivisionMapper.java @@ -23,4 +23,12 @@ public interface AdministrativeDivisionMapper extends BaseMapper> treeList(@Param("level") Integer level); + + /** + * 根据父编码查询子级行政区划 + * + * @param parentCode 父编码 + * @return 结果 + */ + List> administrativeDivisionByParentCode(@Param("parentCode") String parentCode); } diff --git a/policeSecurityServer/src/main/java/com/changhu/service/impl/AdministrativeDivisionServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/service/impl/AdministrativeDivisionServiceImpl.java index 33fb245..c389d9e 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/impl/AdministrativeDivisionServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/impl/AdministrativeDivisionServiceImpl.java @@ -25,15 +25,6 @@ public class AdministrativeDivisionServiceImpl extends ServiceImpl> administrativeDivisionByParentCode(String parentCode) { - return this.lambdaQuery() - .eq(AdministrativeDivision::getParentCode, parentCode) - .list() - .stream() - .map(item -> TreeNodeVo.builder() - .value(item.getCode()) - .label(item.getName()) - .parentValue(item.getParentCode()) - .build()) - .toList(); + return baseMapper.administrativeDivisionByParentCode(parentCode); } } diff --git a/policeSecurityServer/src/main/java/com/changhu/support/minio/MinioProperties.java b/policeSecurityServer/src/main/java/com/changhu/support/minio/MinioProperties.java index f9f887f..28f907d 100644 --- a/policeSecurityServer/src/main/java/com/changhu/support/minio/MinioProperties.java +++ b/policeSecurityServer/src/main/java/com/changhu/support/minio/MinioProperties.java @@ -2,16 +2,24 @@ package com.changhu.support.minio; import io.minio.MinioClient; import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import okhttp3.OkHttpClient; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import java.security.cert.X509Certificate; + /** * fileName: MinioProperties * author: LuoZhun * createTime: 2023/11/10 17:26 * description: some... */ +@Slf4j @Data @Configuration @ConfigurationProperties(prefix = "minio") @@ -39,9 +47,43 @@ public class MinioProperties { @Bean public MinioClient minioClient() { + // Create a trust manager that does not validate certificate chains + TrustManager[] trustAllCerts = new TrustManager[]{ + new X509TrustManager() { + public X509Certificate[] getAcceptedIssuers() { + return new X509Certificate[0]; + } + + public void checkClientTrusted(X509Certificate[] certs, String authType) { + // Do nothing (trust any client certificate) + } + + public void checkServerTrusted(X509Certificate[] certs, String authType) { + // Do nothing (trust any server certificate) + } + } + }; + + // Install the all-trusting trust manager + SSLContext sslContext = null; + try { + sslContext = SSLContext.getInstance("SSL"); + sslContext.init(null, trustAllCerts, new java.security.SecureRandom()); + } catch (Exception e) { + log.error("Install the all-trusting trust manager error:{}", e.getMessage()); + } + + + // Create a custom OkHttpClient that trusts all certificates + OkHttpClient customHttpClient = new OkHttpClient.Builder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustAllCerts[0]) + .hostnameVerifier((hostname, session) -> true) + .build(); + return MinioClient.builder() .endpoint(url) .credentials(accessKey, secretKey) + .httpClient(customHttpClient) .build(); } } diff --git a/policeSecurityServer/src/main/resources/env/prod/application.yml b/policeSecurityServer/src/main/resources/env/prod/application.yml index 8a3d696..81ebf76 100644 --- a/policeSecurityServer/src/main/resources/env/prod/application.yml +++ b/policeSecurityServer/src/main/resources/env/prod/application.yml @@ -39,9 +39,9 @@ spring: datasource: type: com.alibaba.druid.pool.DruidDataSource driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://118.253.177.137:3306/police_security_dev?serverTimezone=Asia/Shanghai&allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false - username: police_security_dev - password: GejDeCNj3ZBSNxSP + url: jdbc:mysql://118.253.177.137:3306/police_security?serverTimezone=Asia/Shanghai&allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + username: police_security + password: xRxNWErNMKa6Th64 # druid 连接池管理 druid: # 初始化时建立物理连接的个数 @@ -119,7 +119,7 @@ minio: url: https://www.hnjinglian.cn:9000 accessKey: admin secretKey: lonsung301 - bucketName: police-security-dev + bucketName: police-security sa-token: # token 名称(同时也是 cookie 名称) diff --git a/policeSecurityServer/src/main/resources/mapper/AdministrativeDivisionMapper.xml b/policeSecurityServer/src/main/resources/mapper/AdministrativeDivisionMapper.xml index d54484e..256a042 100644 --- a/policeSecurityServer/src/main/resources/mapper/AdministrativeDivisionMapper.xml +++ b/policeSecurityServer/src/main/resources/mapper/AdministrativeDivisionMapper.xml @@ -12,4 +12,22 @@ and level <= #{level} order by code + + + + \ No newline at end of file diff --git a/policeSecurityServer/src/test/java/com/changhu/SuperUserInitTest.java b/policeSecurityServer/src/test/java/com/changhu/SuperUserInitTest.java new file mode 100644 index 0000000..e0b2a66 --- /dev/null +++ b/policeSecurityServer/src/test/java/com/changhu/SuperUserInitTest.java @@ -0,0 +1,28 @@ +package com.changhu; + +import com.changhu.module.management.pojo.params.ManagementSuperUserSaveOrUpdateParams; +import com.changhu.module.management.service.SuperService; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +/** + * @author 20252 + * @createTime 2024/10/30 上午11:23 + * @desc SuperUserInitTest... + */ +@SpringBootTest +public class SuperUserInitTest { + + @Autowired + private SuperService superService; + + @Test + public void initAdmin() { + ManagementSuperUserSaveOrUpdateParams params = new ManagementSuperUserSaveOrUpdateParams(); + params.setName("超级管理员"); + params.setTelephone("15576404472"); + superService.saveOrUpdateUser(params); + + } +} diff --git a/superManagement/.env.development b/superManagement/.env.development index 5023a59..4d6d879 100644 --- a/superManagement/.env.development +++ b/superManagement/.env.development @@ -2,10 +2,10 @@ VITE_APP_NAME=超级后台 VITE_APP_ENV=development VITE_APP_PORT=1000 VITE_DROP_CONSOLE=false +VITE_APP_MODULE_NAME=superManagement # axios VITE_APP_BASE_API=/api -# VITE_APP_PROXY_URL=http://localhost:8765 VITE_APP_PROXY_URL=http://172.10.10.93:8765 # rsa 公钥 diff --git a/superManagement/.env.production b/superManagement/.env.production index fe80255..e5f1369 100644 --- a/superManagement/.env.production +++ b/superManagement/.env.production @@ -2,11 +2,15 @@ VITE_APP_NAME=超级后台 VITE_APP_ENV=production VITE_APP_PORT=1001 VITE_DROP_CONSOLE=true +VITE_APP_MODULE_NAME=superManagement # axios VITE_APP_BASE_API=/api -VITE_APP_PROXY_URL=https://172.10.10.238:8765 +VITE_APP_PROXY_URL=http://118.253.177.137:8765 + +# rsa 公钥 +VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCpu1C3JHZ+Ng/eVVCZtwKsOZv9RktpAL13pKy4FoRHyNv2t8TPV2AMzLzfEzlWx001nBxyVxEMR2N9jAcqFLHv7r16ciOzbtzB9dky2G+bc9jIs4/EdVK5bAZcPRh5Jrb78sC9PHyR4AeceDyCIKHLUbWBJB4NTZE0s1Wh5kMynQIDAQAB # minio -VITE_APP_MINIO_URL=http://118.253.177.137:9000 -VITE_APP_MINIO_BUCKET=police-security-dev +VITE_APP_MINIO_URL=https://www.hnjinglian.cn:9000 +VITE_APP_MINIO_BUCKET=police-security diff --git a/superManagement/.gitignore b/superManagement/.gitignore index 247cdaf..10079ed 100644 --- a/superManagement/.gitignore +++ b/superManagement/.gitignore @@ -9,6 +9,7 @@ lerna-debug.log* node_modules dist +superManagement dist-ssr *.local diff --git a/superManagement/package.json b/superManagement/package.json index 09fd832..6a8d6e4 100644 --- a/superManagement/package.json +++ b/superManagement/package.json @@ -6,7 +6,7 @@ "type": "module", "scripts": { "dev": "vite", - "build": "vue-tsc -b && vite build", + "build": "vue-tsc -b && vite build --mode production", "preview": "vite preview" }, "dependencies": { @@ -28,6 +28,7 @@ "@types/node": "^22.5.1", "@vitejs/plugin-vue": "^5.1.2", "@vitejs/plugin-vue-jsx": "^4.0.1", + "terser": "^5.36.0", "typescript": "^5.5.3", "unplugin-vue-components": "^0.27.4", "vite": "^5.4.1", diff --git a/superManagement/src/components/form/FormProMax.vue b/superManagement/src/components/form/FormProMax.vue index 8fd21b6..1c36de7 100644 --- a/superManagement/src/components/form/FormProMax.vue +++ b/superManagement/src/components/form/FormProMax.vue @@ -97,6 +97,12 @@ :allowClear="item.componentsProps?.allowClear ?? true" :options="item.options" /> + import {FormInstance} from "ant-design-vue"; -import {ref} from "vue"; +import {defineAsyncComponent, ref} from "vue"; import {FormExpose} from "ant-design-vue/es/form/Form"; import {QuestionCircleOutlined} from '@ant-design/icons-vue' import {FormProMaxItemOptions, FormProMaxItemProps, FormProMaxProps} from "@/types/components/form/index.ts"; +import {ComponentProps} from "vue-component-type-helpers"; +import AdministrativeDivisionTree from "@/components/tree/AdministrativeDivisionTree.vue"; +const AdministrativeDivisionTreeComp: ComponentProps = defineAsyncComponent(() => import("@/components/tree/AdministrativeDivisionTree.vue")); const modelValue = defineModel('value', { default: {} diff --git a/superManagement/src/components/iconfont/IconFont.vue b/superManagement/src/components/iconfont/IconFont.vue index b3ecff4..abe2800 100644 --- a/superManagement/src/components/iconfont/IconFont.vue +++ b/superManagement/src/components/iconfont/IconFont.vue @@ -10,7 +10,7 @@ import {IconFontProps} from "@/types/components/iconfont/IconFont"; -const props = withDefaults(defineProps(), { +withDefaults(defineProps(), { size: 25, type: "svg" }); diff --git a/superManagement/src/components/layout/MenuItem.vue b/superManagement/src/components/layout/MenuItem.vue index 15d2564..feb26ca 100644 --- a/superManagement/src/components/layout/MenuItem.vue +++ b/superManagement/src/components/layout/MenuItem.vue @@ -18,7 +18,7 @@ @click="router.push(item.path)" > {{ item.title }} diff --git a/superManagement/src/components/layout/SystemMenus.vue b/superManagement/src/components/layout/SystemMenus.vue index a125600..8429600 100644 --- a/superManagement/src/components/layout/SystemMenus.vue +++ b/superManagement/src/components/layout/SystemMenus.vue @@ -14,7 +14,6 @@ import {computed} from "vue"; import {useRoute} from "vue-router"; import {SYSTEM_MENUS} from "@/config"; import MenuItem from "@/components/layout/MenuItem.vue"; -import IconFont from "@/components/iconfont/IconFont.vue"; const route = useRoute() diff --git a/superManagement/src/components/login/TelephoneLogin.vue b/superManagement/src/components/login/TelephoneLogin.vue index f1cc438..3e2b9a2 100644 --- a/superManagement/src/components/login/TelephoneLogin.vue +++ b/superManagement/src/components/login/TelephoneLogin.vue @@ -39,7 +39,7 @@ + + diff --git a/superManagement/src/router/index.ts b/superManagement/src/router/index.ts index 015957e..fb606fd 100644 --- a/superManagement/src/router/index.ts +++ b/superManagement/src/router/index.ts @@ -10,10 +10,10 @@ import {ROUTER_WHITE_LIST} from "@/config"; * createWebHashHistory: 路径带#号 这部分 URL 从未被发送到服务器,所以它不需要在服务器层面上进行任何特殊处理,影响SEO */ const router = createRouter({ - history: createWebHistory(), + history: createWebHistory(__APP_ENV.VITE_APP_MODULE_NAME), routes: [...staticRouter], strict: false, - scrollBehavior: () => ({left: 0, top: 0}) + scrollBehavior: () => ({left: 0, top: 0}), }); router.beforeEach(async (to, from, next) => { diff --git a/superManagement/src/types/components/form/index.ts b/superManagement/src/types/components/form/index.ts index 0477415..fae4ba2 100644 --- a/superManagement/src/types/components/form/index.ts +++ b/superManagement/src/types/components/form/index.ts @@ -15,6 +15,7 @@ import { } from "ant-design-vue"; import {Ref, UnwrapRef, VNode} from "vue"; import {ComponentProps} from "vue-component-type-helpers"; +import AdministrativeDivisionTree from "@/components/tree/AdministrativeDivisionTree.vue"; type FormProMaxItemType = | 'custom' @@ -32,7 +33,8 @@ type FormProMaxItemType = | 'datePicker' | 'rangePicker' | 'timeRangePicker' - | 'timePicker'; + | 'timePicker' + | 'administrativeDivisionTree' interface FormProMaxItemCommonProps extends ComponentProps { label?: string, @@ -64,6 +66,7 @@ export type FormProMaxItemOptions = { | FormProMaxItemProps<'rangePicker', ComponentProps> | FormProMaxItemProps<'timeRangePicker', ComponentProps> | FormProMaxItemProps<'timePicker', ComponentProps> + | FormProMaxItemProps<'administrativeDivisionTree', ComponentProps> } export interface FormProMaxProps extends FormProps { diff --git a/superManagement/src/views/test.vue b/superManagement/src/views/test.vue index dc4f5b3..bc55521 100644 --- a/superManagement/src/views/test.vue +++ b/superManagement/src/views/test.vue @@ -1,15 +1,10 @@