diff --git a/collect_information/.editorconfig b/collect_information/.editorconfig new file mode 100644 index 0000000..5760be5 --- /dev/null +++ b/collect_information/.editorconfig @@ -0,0 +1,12 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/collect_information/.env.development b/collect_information/.env.development new file mode 100644 index 0000000..f811773 --- /dev/null +++ b/collect_information/.env.development @@ -0,0 +1,2 @@ +TARO_APP_ID="wx8902ddbfddb820d1" +TARO_APP_BASE_API="http://172.10.10.93:8765" diff --git a/collect_information/.env.production b/collect_information/.env.production new file mode 100644 index 0000000..bf2df6e --- /dev/null +++ b/collect_information/.env.production @@ -0,0 +1,2 @@ +TARO_APP_ID="wx24cc8a872b57ac79" +TARO_APP_BASE_API="http://172.10.10.207:7000" diff --git a/collect_information/.env.test b/collect_information/.env.test new file mode 100644 index 0000000..0215b61 --- /dev/null +++ b/collect_information/.env.test @@ -0,0 +1 @@ +# TARO_APP_ID="测试环境下的小程序appid" \ No newline at end of file diff --git a/collect_information/.eslintrc b/collect_information/.eslintrc new file mode 100644 index 0000000..a5306c7 --- /dev/null +++ b/collect_information/.eslintrc @@ -0,0 +1,10 @@ +// ESLint 检查 .vue 文件需要单独配置编辑器: +// https://eslint.vuejs.org/user-guide/#editor-integrations +{ + "extends": [ + "taro/vue3" + ], + "rules": { + "vue/multi-word-component-names": "off" + } +} diff --git a/collect_information/.gitignore b/collect_information/.gitignore new file mode 100644 index 0000000..f54f355 --- /dev/null +++ b/collect_information/.gitignore @@ -0,0 +1,12 @@ +dist/ +deploy_versions/ +.temp/ +.rn_temp/ +node_modules/ +.DS_Store +.swc +yarn.lock +components.d.ts +package-lock.json +.vscode +.idea diff --git a/collect_information/__tests__/index.test.js b/collect_information/__tests__/index.test.js new file mode 100644 index 0000000..c3904d1 --- /dev/null +++ b/collect_information/__tests__/index.test.js @@ -0,0 +1,12 @@ +import TestUtils from '@tarojs/test-utils-vue3' + +describe('Testing', () => { + + test('Test', async () => { + const testUtils = new TestUtils() + await testUtils.createApp() + await testUtils.PageLifecycle.onShow('pages/index/index') + expect(testUtils.html()).toMatchSnapshot() + }) + +}) diff --git a/collect_information/babel.config.js b/collect_information/babel.config.js new file mode 100644 index 0000000..dc20faf --- /dev/null +++ b/collect_information/babel.config.js @@ -0,0 +1,10 @@ +// babel-preset-taro 更多选项和默认值: +// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md +module.exports = { + presets: [ + ['taro', { + framework: 'vue3', + ts: true + }] + ] +} diff --git a/collect_information/config/dev.ts b/collect_information/config/dev.ts new file mode 100644 index 0000000..c37eb43 --- /dev/null +++ b/collect_information/config/dev.ts @@ -0,0 +1,9 @@ +import type { UserConfigExport } from "@tarojs/cli"; +export default { + logger: { + quiet: false, + stats: true + }, + mini: {}, + h5: {} +} satisfies UserConfigExport diff --git a/collect_information/config/index.ts b/collect_information/config/index.ts new file mode 100644 index 0000000..54a4b61 --- /dev/null +++ b/collect_information/config/index.ts @@ -0,0 +1,114 @@ +import {defineConfig, type UserConfigExport} from '@tarojs/cli' +import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin' +import devConfig from './dev' +import prodConfig from './prod' +import ComponentsPlugin from 'unplugin-vue-components/webpack' +import NutUIResolver from '@nutui/auto-import-resolver' + +// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数 +export default defineConfig(async (merge, {command, mode}) => { + const baseConfig: UserConfigExport = { + projectName: 'collect_information', + date: '2024-4-12', + designWidth(input: any) { + // 配置 NutUI 375 尺寸 + if (input?.file?.replace(/\\+/g, '/').indexOf('@nutui') > -1) { + return 375 + } + // 全局使用 Taro 默认的 750 尺寸 + return 750 + }, + deviceRatio: { + 640: 2.34 / 2, + 750: 1, + 828: 1.81 / 2, + 375: 2 + }, + sourceRoot: 'src', + outputRoot: 'dist', + plugins: ['@tarojs/plugin-html'], + defineConstants: {}, + copy: { + patterns: [], + options: {} + }, + framework: 'vue3', + compiler: 'webpack5', + cache: { + enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache + }, + mini: { + miniCssExtractPluginOption: { + ignoreOrder: true + }, + postcss: { + pxtransform: { + enable: true, + config: {} + }, + url: { + enable: true, + config: { + limit: 1024 // 设定转换尺寸上限 + } + }, + cssModules: { + enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true + config: { + namingPattern: 'module', // 转换模式,取值为 global/module + generateScopedName: '[name]__[local]___[hash:base64:5]' + } + } + }, + webpackChain(chain) { + chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin) + chain.plugin('unplugin-vue-components').use(ComponentsPlugin({ + resolvers: [NutUIResolver({taro: true})] + })) + } + }, + h5: { + publicPath: '/', + staticDirectory: 'static', + output: { + filename: 'js/[name].[hash:8].js', + chunkFilename: 'js/[name].[chunkhash:8].js' + }, + miniCssExtractPluginOption: { + ignoreOrder: true, + filename: 'css/[name].[hash].css', + chunkFilename: 'css/[name].[chunkhash].css' + }, + postcss: { + autoprefixer: { + enable: true, + config: {} + }, + cssModules: { + enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true + config: { + namingPattern: 'module', // 转换模式,取值为 global/module + generateScopedName: '[name]__[local]___[hash:base64:5]' + } + } + }, + webpackChain(chain) { + chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin) + } + }, + rn: { + appName: 'taroDemo', + postcss: { + cssModules: { + enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true + } + } + } + } + if (process.env.NODE_ENV === 'development') { + // 本地开发构建配置(不混淆压缩) + return merge({}, baseConfig, devConfig) + } + // 生产构建配置(默认开启压缩混淆等) + return merge({}, baseConfig, prodConfig) +}) diff --git a/collect_information/config/prod.ts b/collect_information/config/prod.ts new file mode 100644 index 0000000..c9ba67f --- /dev/null +++ b/collect_information/config/prod.ts @@ -0,0 +1,32 @@ +import type { UserConfigExport } from "@tarojs/cli"; +export default { + mini: {}, + h5: { + /** + * WebpackChain 插件配置 + * @docs https://github.com/neutrinojs/webpack-chain + */ + // webpackChain (chain) { + // /** + // * 如果 h5 端编译后体积过大,可以使用 webpack-bundle-analyzer 插件对打包体积进行分析。 + // * @docs https://github.com/webpack-contrib/webpack-bundle-analyzer + // */ + // chain.plugin('analyzer') + // .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, []) + // /** + // * 如果 h5 端首屏加载时间过长,可以使用 prerender-spa-plugin 插件预加载首页。 + // * @docs https://github.com/chrisvfritz/prerender-spa-plugin + // */ + // const path = require('path') + // const Prerender = require('prerender-spa-plugin') + // const staticDir = path.join(__dirname, '..', 'dist') + // chain + // .plugin('prerender') + // .use(new Prerender({ + // staticDir, + // routes: [ '/pages/index/index' ], + // postProcess: (context) => ({ ...context, outputPath: path.join(staticDir, 'index.html') }) + // })) + // } + } +} satisfies UserConfigExport diff --git a/collect_information/jest.config.ts b/collect_information/jest.config.ts new file mode 100644 index 0000000..e720a3c --- /dev/null +++ b/collect_information/jest.config.ts @@ -0,0 +1,6 @@ +const defineJestConfig = require('@tarojs/test-utils-vue3/dist/jest.js').default + +module.exports = defineJestConfig({ + testEnvironment: 'jsdom', + testMatch: ['/__tests__/**/*.(spec|test).[jt]s?(x)'] +}) diff --git a/collect_information/package.json b/collect_information/package.json new file mode 100644 index 0000000..69bd40f --- /dev/null +++ b/collect_information/package.json @@ -0,0 +1,95 @@ +{ + "name": "collect_information", + "version": "1.0.0", + "private": true, + "description": "智慧派出所信息采集小程序", + "templateInfo": { + "name": "default", + "typescript": true, + "css": "Sass", + "framework": "Vue3" + }, + "scripts": { + "build:weapp": "taro build --type weapp", + "build:swan": "taro build --type swan", + "build:alipay": "taro build --type alipay", + "build:tt": "taro build --type tt", + "build:h5": "taro build --type h5", + "build:rn": "taro build --type rn", + "build:qq": "taro build --type qq", + "build:jd": "taro build --type jd", + "build:quickapp": "taro build --type quickapp", + "build:harmony-hybrid": "taro build --type harmony-hybrid", + "dev:weapp": "npm run build:weapp -- --watch", + "dev:swan": "npm run build:swan -- --watch", + "dev:alipay": "npm run build:alipay -- --watch", + "dev:tt": "npm run build:tt -- --watch", + "dev:h5": "npm run build:h5 -- --watch", + "dev:rn": "npm run build:rn -- --watch", + "dev:qq": "npm run build:qq -- --watch", + "dev:jd": "npm run build:jd -- --watch", + "dev:quickapp": "npm run build:quickapp -- --watch", + "dev:harmony-hybrid": "npm run build:harmony-hybrid -- --watch", + "test": "jest" + }, + "browserslist": [ + "last 3 versions", + "Android >= 4.1", + "ios >= 8" + ], + "author": "", + "dependencies": { + "@babel/runtime": "^7.21.5", + "@nutui/icons-vue-taro": "^0.0.9", + "@nutui/nutui-taro": "^4.3.5", + "@tarojs/components": "3.6.25", + "@tarojs/helper": "3.6.25", + "@tarojs/plugin-framework-vue3": "3.6.25", + "@tarojs/plugin-html": "^3.6.26", + "@tarojs/plugin-platform-alipay": "3.6.25", + "@tarojs/plugin-platform-h5": "3.6.25", + "@tarojs/plugin-platform-harmony-hybrid": "3.6.25", + "@tarojs/plugin-platform-jd": "3.6.25", + "@tarojs/plugin-platform-qq": "3.6.25", + "@tarojs/plugin-platform-swan": "3.6.25", + "@tarojs/plugin-platform-tt": "3.6.25", + "@tarojs/plugin-platform-weapp": "3.6.25", + "@tarojs/runtime": "3.6.25", + "@tarojs/shared": "3.6.25", + "@tarojs/taro": "3.6.25", + "dayjs": "^1.11.10", + "pinia": "^2.1.7", + "vue": "^3.0.0" + }, + "devDependencies": { + "@babel/core": "^7.8.0", + "@nutui/auto-import-resolver": "^1.0.0", + "@tarojs/cli": "3.6.25", + "@tarojs/taro-loader": "3.6.25", + "@tarojs/test-utils-vue3": "^0.1.1", + "@tarojs/webpack5-runner": "3.6.25", + "@types/jest": "^29.3.1", + "@types/node": "^18.15.11", + "@types/webpack-env": "^1.13.6", + "@typescript-eslint/eslint-plugin": "^6.2.0", + "@typescript-eslint/parser": "^6.2.0", + "@vue/babel-plugin-jsx": "^1.0.6", + "@vue/compiler-sfc": "^3.0.0", + "babel-preset-taro": "3.6.25", + "css-loader": "3.4.2", + "eslint": "^8.12.0", + "eslint-config-taro": "3.6.25", + "eslint-plugin-vue": "^8.0.0", + "jest": "^29.3.1", + "jest-environment-jsdom": "^29.5.0", + "postcss": "^8.4.18", + "style-loader": "1.3.0", + "stylelint": "^14.4.0", + "ts-node": "^10.9.1", + "tsconfig-paths-webpack-plugin": "^4.1.0", + "typescript": "^5.1.0", + "unplugin-vue-components": "^0.26.0", + "vue-loader": "^17.0.0", + "webpack": "5.78.0" + } +} diff --git a/collect_information/project.config.json b/collect_information/project.config.json new file mode 100644 index 0000000..ab4365c --- /dev/null +++ b/collect_information/project.config.json @@ -0,0 +1,31 @@ +{ + "miniprogramRoot": "dist/", + "projectname": "collect_information", + "description": "智慧派出所信息采集小程序", + "setting": { + "urlCheck": false, + "es6": false, + "enhance": false, + "compileHotReLoad": false, + "postcss": false, + "minified": false, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + }, + "ignoreUploadUnusedFiles": true + }, + "compileType": "miniprogram", + "libVersion": "3.5.0", + "srcMiniprogramRoot": "dist/", + "packOptions": { + "ignore": [], + "include": [] + }, + "condition": {}, + "editorSetting": { + "tabIndent": "insertSpaces", + "tabSize": 2 + } +} \ No newline at end of file diff --git a/collect_information/project.private.config.json b/collect_information/project.private.config.json new file mode 100644 index 0000000..3abd2fd --- /dev/null +++ b/collect_information/project.private.config.json @@ -0,0 +1,55 @@ +{ + "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "projectname": "collect_information", + "setting": { + "compileHotReLoad": true + }, + "condition": { + "miniprogram": { + "list": [ + { + "name": "", + "pathName": "pages/mine/mine", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/login/login", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/mine/mine", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/index/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/index/dataEntry/buildFloorEntry/buildFloorEntry", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/register/register", + "query": "", + "launchMode": "default", + "scene": null + } + ] + } + } +} \ No newline at end of file diff --git a/collect_information/project.tt.json b/collect_information/project.tt.json new file mode 100644 index 0000000..409b7a0 --- /dev/null +++ b/collect_information/project.tt.json @@ -0,0 +1,9 @@ +{ + "miniprogramRoot": "./", + "projectname": "collect_information", + "appid": "testAppId", + "setting": { + "es6": false, + "minified": false + } +} diff --git a/collect_information/src/app.config.ts b/collect_information/src/app.config.ts new file mode 100644 index 0000000..0c08573 --- /dev/null +++ b/collect_information/src/app.config.ts @@ -0,0 +1,38 @@ +export default defineAppConfig({ + pages: [ + 'pages/login/login', + 'pages/register/register', + 'pages/index/index', + 'pages/mine/mine', + 'pages/employeeInfo/employeeInfo', + ], + window: { + backgroundTextStyle: 'light', + navigationBarBackgroundColor: '#f7f8fa', + navigationBarTitleText: '', + navigationBarTextStyle: 'black', + }, + tabBar: { + list: [ + { + pagePath: 'pages/index/index', + text: '首页', + iconPath: "assets/mine/punch.png", + selectedIconPath: "assets/mine/punch-active.png" + }, + { + pagePath: 'pages/employeeInfo/employeeInfo', + text: '员工信息', + iconPath: "assets/mine/punch.png", + selectedIconPath: "assets/mine/punch-active.png" + }, + { + pagePath: 'pages/mine/mine', + text: '我的', + iconPath: "assets/mine/my.png", + selectedIconPath: "assets/mine/my-active.png" + }, + ] + } + +}) diff --git a/collect_information/src/app.scss b/collect_information/src/app.scss new file mode 100644 index 0000000..b6faf5f --- /dev/null +++ b/collect_information/src/app.scss @@ -0,0 +1,4 @@ +*{ + margin: 0; + padding: 0; +} diff --git a/collect_information/src/app.ts b/collect_information/src/app.ts new file mode 100644 index 0000000..60b67c5 --- /dev/null +++ b/collect_information/src/app.ts @@ -0,0 +1,15 @@ +import {createApp} from 'vue' +import {createPinia} from 'pinia' +import './app.scss' +import './assets/scss/colorui.scss' + +const App = createApp({ + onShow(options) { + console.log('App onShow.') + }, + // 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖 +}) + +App.use(createPinia()) + +export default App diff --git a/collect_information/src/assets/images/arrow.png b/collect_information/src/assets/images/arrow.png new file mode 100644 index 0000000..521b08a Binary files /dev/null and b/collect_information/src/assets/images/arrow.png differ diff --git a/collect_information/src/assets/images/badge.jpg b/collect_information/src/assets/images/badge.jpg new file mode 100644 index 0000000..ae19643 Binary files /dev/null and b/collect_information/src/assets/images/badge.jpg differ diff --git a/collect_information/src/assets/images/banner.jpg b/collect_information/src/assets/images/banner.jpg new file mode 100644 index 0000000..f29618c Binary files /dev/null and b/collect_information/src/assets/images/banner.jpg differ diff --git a/collect_information/src/assets/mine/my-active.png b/collect_information/src/assets/mine/my-active.png new file mode 100644 index 0000000..907d8a6 Binary files /dev/null and b/collect_information/src/assets/mine/my-active.png differ diff --git a/collect_information/src/assets/mine/my.png b/collect_information/src/assets/mine/my.png new file mode 100644 index 0000000..da73231 Binary files /dev/null and b/collect_information/src/assets/mine/my.png differ diff --git a/collect_information/src/assets/mine/punch-active.png b/collect_information/src/assets/mine/punch-active.png new file mode 100644 index 0000000..0098eb3 Binary files /dev/null and b/collect_information/src/assets/mine/punch-active.png differ diff --git a/collect_information/src/assets/mine/punch.png b/collect_information/src/assets/mine/punch.png new file mode 100644 index 0000000..e8ef36b Binary files /dev/null and b/collect_information/src/assets/mine/punch.png differ diff --git a/collect_information/src/assets/scss/colorui.scss b/collect_information/src/assets/scss/colorui.scss new file mode 100644 index 0000000..199b446 --- /dev/null +++ b/collect_information/src/assets/scss/colorui.scss @@ -0,0 +1,308 @@ +/* -- 内外边距 -- */ +.margin-0 { + margin: 0; +} + +.margin-xs { + margin: 10rpx; +} + +.margin-sm { + margin: 20rpx; +} + +.margin { + margin: 30rpx; +} + +.margin-lg { + margin: 40rpx; +} + +.margin-xl { + margin: 50rpx; +} + +.margin-top-xs { + margin-top: 10rpx; +} + +.margin-top-sm { + margin-top: 20rpx; +} + +.margin-top { + margin-top: 30rpx; +} + +.margin-top-lg { + margin-top: 40rpx; +} + +.margin-top-xl { + margin-top: 50rpx; +} + +.margin-right-xs { + margin-right: 10rpx; +} + +.margin-right-sm { + margin-right: 20rpx; +} + +.margin-right { + margin-right: 30rpx; +} + +.margin-right-lg { + margin-right: 40rpx; +} + +.margin-right-xl { + margin-right: 50rpx; +} + +.margin-bottom-xs { + margin-bottom: 10rpx; +} + +.margin-bottom-sm { + margin-bottom: 20rpx; +} + +.margin-bottom { + margin-bottom: 30rpx; +} + +.margin-bottom-lg { + margin-bottom: 40rpx; +} + +.margin-bottom-xl { + margin-bottom: 50rpx; +} + +.margin-left-xs { + margin-left: 10rpx; +} + +.margin-left-sm { + margin-left: 20rpx; +} + +.margin-left { + margin-left: 30rpx; +} + +.margin-left-lg { + margin-left: 40rpx; +} + +.margin-left-xl { + margin-left: 50rpx; +} + +.margin-lr-xs { + margin-left: 10rpx; + margin-right: 10rpx; +} + +.margin-lr-sm { + margin-left: 20rpx; + margin-right: 20rpx; +} + +.margin-lr { + margin-left: 30rpx; + margin-right: 30rpx; +} + +.margin-lr-lg { + margin-left: 40rpx; + margin-right: 40rpx; +} + +.margin-lr-xl { + margin-left: 50rpx; + margin-right: 50rpx; +} + +.margin-tb-xs { + margin-top: 10rpx; + margin-bottom: 10rpx; +} + +.margin-tb-sm { + margin-top: 20rpx; + margin-bottom: 20rpx; +} + +.margin-tb { + margin-top: 30rpx; + margin-bottom: 30rpx; +} + +.margin-tb-lg { + margin-top: 40rpx; + margin-bottom: 40rpx; +} + +.margin-tb-xl { + margin-top: 50rpx; + margin-bottom: 50rpx; +} + +.padding-0 { + padding: 0; +} + +.padding-xs { + padding: 10rpx; +} + +.padding-sm { + padding: 20rpx; +} + +.padding { + padding: 30rpx; +} + +.padding-lg { + padding: 40rpx; +} + +.padding-xl { + padding: 50rpx; +} + +.padding-top-xs { + padding-top: 10rpx; +} + +.padding-top-sm { + padding-top: 20rpx; +} + +.padding-top { + padding-top: 30rpx; +} + +.padding-top-lg { + padding-top: 40rpx; +} + +.padding-top-xl { + padding-top: 50rpx; +} + +.padding-right-xs { + padding-right: 10rpx; +} + +.padding-right-sm { + padding-right: 20rpx; +} + +.padding-right { + padding-right: 30rpx; +} + +.padding-right-lg { + padding-right: 40rpx; +} + +.padding-right-xl { + padding-right: 50rpx; +} + +.padding-bottom-xs { + padding-bottom: 10rpx; +} + +.padding-bottom-sm { + padding-bottom: 20rpx; +} + +.padding-bottom { + padding-bottom: 30rpx; +} + +.padding-bottom-lg { + padding-bottom: 40rpx; +} + +.padding-bottom-xl { + padding-bottom: 50rpx; +} + +.padding-left-xs { + padding-left: 10rpx; +} + +.padding-left-sm { + padding-left: 20rpx; +} + +.padding-left { + padding-left: 30rpx; +} + +.padding-left-lg { + padding-left: 40rpx; +} + +.padding-left-xl { + padding-left: 50rpx; +} + +.padding-lr-xs { + padding-left: 10rpx; + padding-right: 10rpx; +} + +.padding-lr-sm { + padding-left: 20rpx; + padding-right: 20rpx; +} + +.padding-lr { + padding-left: 30rpx; + padding-right: 30rpx; +} + +.padding-lr-lg { + padding-left: 40rpx; + padding-right: 40rpx; +} + +.padding-lr-xl { + padding-left: 50rpx; + padding-right: 50rpx; +} + +.padding-tb-xs { + padding-top: 10rpx; + padding-bottom: 10rpx; +} + +.padding-tb-sm { + padding-top: 20rpx; + padding-bottom: 20rpx; +} + +.padding-tb { + padding-top: 30rpx; + padding-bottom: 30rpx; +} + +.padding-tb-lg { + padding-top: 40rpx; + padding-bottom: 40rpx; +} + +.padding-tb-xl { + padding-top: 50rpx; + padding-bottom: 50rpx; +} diff --git a/collect_information/src/components/form/PersonnelInformationEntryForm.vue b/collect_information/src/components/form/PersonnelInformationEntryForm.vue new file mode 100644 index 0000000..c283038 --- /dev/null +++ b/collect_information/src/components/form/PersonnelInformationEntryForm.vue @@ -0,0 +1,225 @@ + + diff --git a/collect_information/src/enums/index.ts b/collect_information/src/enums/index.ts new file mode 100644 index 0000000..f7b0445 --- /dev/null +++ b/collect_information/src/enums/index.ts @@ -0,0 +1,30 @@ +export const SEX: SelectNode[] = [ + { + value: 0, + label: "男", + }, + { + value: 1, + label: "女", + }, +]; + +export const IDENTITY: SelectNode[] = [ + { + label: "公安", + value: "police" + }, + { + label: "项目经理", + value: "project_manager" + }, +] + +export const getLabelByEnumValue = (enums: SelectNode[], value: any): string => { + for (let i = 0; i < enums.length; i++) { + if (enums[i].value === value) { + return enums[i].label + } + } + return '-' +} diff --git a/collect_information/src/index.html b/collect_information/src/index.html new file mode 100644 index 0000000..21009d9 --- /dev/null +++ b/collect_information/src/index.html @@ -0,0 +1,17 @@ + + + + + + + + + + + collect_information + + + +
+ + diff --git a/collect_information/src/pages/employeeInfo/employeeInfo.config.ts b/collect_information/src/pages/employeeInfo/employeeInfo.config.ts new file mode 100644 index 0000000..ca739e2 --- /dev/null +++ b/collect_information/src/pages/employeeInfo/employeeInfo.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + // navigationBarTitleText: '自定义导航栏', + navigationStyle: "custom" +}) diff --git a/collect_information/src/pages/employeeInfo/employeeInfo.scss b/collect_information/src/pages/employeeInfo/employeeInfo.scss new file mode 100644 index 0000000..139597f --- /dev/null +++ b/collect_information/src/pages/employeeInfo/employeeInfo.scss @@ -0,0 +1,2 @@ + + diff --git a/collect_information/src/pages/employeeInfo/employeeInfo.vue b/collect_information/src/pages/employeeInfo/employeeInfo.vue new file mode 100644 index 0000000..77742df --- /dev/null +++ b/collect_information/src/pages/employeeInfo/employeeInfo.vue @@ -0,0 +1,21 @@ + + + diff --git a/collect_information/src/pages/index/index.config.ts b/collect_information/src/pages/index/index.config.ts new file mode 100644 index 0000000..6b0b2af --- /dev/null +++ b/collect_information/src/pages/index/index.config.ts @@ -0,0 +1,4 @@ + +export default definePageConfig({ + navigationBarTitleText: '首页', +}) diff --git a/collect_information/src/pages/index/index.scss b/collect_information/src/pages/index/index.scss new file mode 100644 index 0000000..e69de29 diff --git a/collect_information/src/pages/index/index.vue b/collect_information/src/pages/index/index.vue new file mode 100644 index 0000000..c25c9c2 --- /dev/null +++ b/collect_information/src/pages/index/index.vue @@ -0,0 +1,22 @@ + + + + diff --git a/collect_information/src/pages/login/login.config.ts b/collect_information/src/pages/login/login.config.ts new file mode 100644 index 0000000..97683f1 --- /dev/null +++ b/collect_information/src/pages/login/login.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '登录', +}) diff --git a/collect_information/src/pages/login/login.scss b/collect_information/src/pages/login/login.scss new file mode 100644 index 0000000..e69de29 diff --git a/collect_information/src/pages/login/login.vue b/collect_information/src/pages/login/login.vue new file mode 100644 index 0000000..44937f4 --- /dev/null +++ b/collect_information/src/pages/login/login.vue @@ -0,0 +1,16 @@ + + + diff --git a/collect_information/src/pages/mine/mine.config.ts b/collect_information/src/pages/mine/mine.config.ts new file mode 100644 index 0000000..18e4d2b --- /dev/null +++ b/collect_information/src/pages/mine/mine.config.ts @@ -0,0 +1,5 @@ +export default definePageConfig({ + navigationBarTitleText: '我的', + navigationBarBackgroundColor:'#3d69dc', + navigationBarTextStyle:'white' +}) diff --git a/collect_information/src/pages/mine/mine.scss b/collect_information/src/pages/mine/mine.scss new file mode 100644 index 0000000..810e441 --- /dev/null +++ b/collect_information/src/pages/mine/mine.scss @@ -0,0 +1,84 @@ +.message { + height: 100vh; + background-color: #fff; +} + +.login-container { + height: 205rpx; + display: flex; + align-items: center; + background-image: url('../../assets/images/banner.jpg'); + background-repeat: no-repeat; + background-position: right; + overflow: hidden; + padding: 18rpx; + box-sizing: border-box; + + .contact { + height: 100rpx; + width: 100rpx; + border-radius: 50%; + border: solid 1px gray; + + .image { + width: 100%; + height: 100%; + border-radius: 50% + } + } + + .tips-text { + display: flex; + font-size: 28rpx; + color: #fff; + line-height: 50rpx; + margin-left: 20rpx; + flex-direction: column; + justify-content: space-evenly; + } +} + +.userIndex { + .exit { + height: 100rpx; + line-height: 40px; + border-bottom: solid 0.5px #ebebf7; + box-sizing: border-box; + display: flex; + justify-content: space-between; + align-items: center; + // margin-bottom: 30rpx; + color: #7d7d7d; + + .exitItem { + display: flex; + align-items: center; + margin-left: 30rpx; + } + + .exitItemIndex { + height: 40rpx; + width: 40rpx; + border-radius: 50%; + // border: solid 1px gray; + display: block; + line-height: 48rpx; + + image { + width: 100%; + height: 100%; + } + } + + .iconScope { + width: 8px; + height: 8px; + display: inline-block; + border: solid 2px #ccc; + -webkit-transform: rotate(45deg); + transform: rotate(45deg); + border-bottom: white; + border-left: white; + } + } +} diff --git a/collect_information/src/pages/mine/mine.vue b/collect_information/src/pages/mine/mine.vue new file mode 100644 index 0000000..e85d037 --- /dev/null +++ b/collect_information/src/pages/mine/mine.vue @@ -0,0 +1,17 @@ + + + + diff --git a/collect_information/src/pages/register/register.config.ts b/collect_information/src/pages/register/register.config.ts new file mode 100644 index 0000000..7632e93 --- /dev/null +++ b/collect_information/src/pages/register/register.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '用户注册' +}) diff --git a/collect_information/src/pages/register/register.scss b/collect_information/src/pages/register/register.scss new file mode 100644 index 0000000..eaa1ebf --- /dev/null +++ b/collect_information/src/pages/register/register.scss @@ -0,0 +1,43 @@ +.register { + height: 100vh; +} + +.nut-cell-group__wrap { + margin: 0; +} + +.registerIndex { + width: 100%; +} + +.registerBtn { + margin-top: 40rpx; + padding: 0 20px; +} + +.buttonChoose { + margin: 0; + border: none; + background: transparent; + outline: none; + padding: 0; + height: 90rpx; + width: 90rpx; + border-radius: 50%; +} + +.nickNameInput{ + color: black; +} + +.contact { + height: 83rpx; + width: 83rpx; + border-radius: 50%; + border: solid 1px gray; + + .image { + width: 100%; + height: 100%; + } +} diff --git a/collect_information/src/pages/register/register.vue b/collect_information/src/pages/register/register.vue new file mode 100644 index 0000000..6a999c4 --- /dev/null +++ b/collect_information/src/pages/register/register.vue @@ -0,0 +1,212 @@ + + + diff --git a/collect_information/src/request/index.ts b/collect_information/src/request/index.ts new file mode 100644 index 0000000..d016e89 --- /dev/null +++ b/collect_information/src/request/index.ts @@ -0,0 +1,86 @@ +import Taro from "@tarojs/taro"; +import {ApiOptions} from "../../types/request"; + +const requestInterceptor = (chain: Taro.Chain) => { + const requestParams = chain.requestParams + const token = Taro.getStorageSync('token') + if (token) { + requestParams.header = { + ...requestParams.header, + token + } + } + return chain.proceed(requestParams) +} + +class CustomRequest { + BASE_API: string + + public constructor() { + this.BASE_API = process.env.TARO_APP_BASE_API + Taro.addInterceptor(requestInterceptor) + } + + private request(url: string, method: keyof Taro.request.Method, options: ApiOptions, params?: object,): Promise> { + return new Promise>((resolve, reject) => { + if (options.loading) { + Taro.showLoading({ + title: '请求中...', + }).then() + } + Taro.request, object>({ + url: this.BASE_API + url, + data: params, + method, + ...options, + success: (result) => { + Taro.hideLoading() + const jsonResult = result.data + if (jsonResult.code !== 200) { + if ([401].includes(jsonResult.code)) { + //todo 重新登录 跳转登录页 提示错误 + } + Taro.showToast({ + title: jsonResult.message, + icon: 'none', + mask: true, + duration: 2000 + }).then() + reject(jsonResult); + } + resolve(jsonResult); + }, + fail: (res) => { + Taro.hideLoading() + Taro.showToast({ + title: res.errMsg, + icon: 'none', + mask: true, + duration: 2000 + }).then() + reject(res.errMsg); + } + }) + }) + } + + get(url: string, params?: object, options: ApiOptions = {loading: false}): Promise> { + return this.request(url, "GET", options, params) + } + + post(url: string, params?: object, options: ApiOptions = {loading: false}): Promise> { + return this.request(url, "POST", options, params) + } + + delete(url: string, params?: object, options: ApiOptions = {loading: false}): Promise> { + return this.request(url, "DELETE", options, params) + } + + put(url: string, params?: object, options: ApiOptions = {loading: false}): Promise> { + return this.request(url, "PUT", options, params) + } +} + +const api = new CustomRequest(); + +export default api diff --git a/collect_information/src/store/index.ts b/collect_information/src/store/index.ts new file mode 100644 index 0000000..2c2c89c --- /dev/null +++ b/collect_information/src/store/index.ts @@ -0,0 +1,11 @@ +import {defineStore} from 'pinia' + +export const useCounterStore = defineStore('counter', { + state: () => { + return { + userInfo:{} + } + }, + actions: {}, +}) + diff --git a/collect_information/src/store/userStore.ts b/collect_information/src/store/userStore.ts new file mode 100644 index 0000000..e69de29 diff --git a/collect_information/src/utils/index.ts b/collect_information/src/utils/index.ts new file mode 100644 index 0000000..6fab107 --- /dev/null +++ b/collect_information/src/utils/index.ts @@ -0,0 +1,67 @@ +import Taro from "@tarojs/taro"; + + +/** + * 授权综合逻辑 + * @param {*} scope 权限代表 + * @param {*} successCallback 成功回调 + * @param {*} failCallback 失败回调 + */ +export function pullAuth(scope, successCallback, failCallback) { + const map = new Map([ + ['scope.userInfo', '用户信息'], + ['scope.userLocation', '地理位置'], + ['scope.userLocationBackground', '后台定位'], + ['scope.address', '通信地址'], + ['scope.record', '录音功能'], + ['scope.writePhotosAlbum', '保存到相册'], + ['scope.camera', '摄像头'], + ['scope.invoice', '获取发票'], + ['scope.invoiceTitle', '发票抬头'], + ['scope.werun', '微信运动步数'], + ]) + Taro.getSetting({ + success(res) { + if (!res.authSetting[scope]) { + Taro.authorize({ + scope, + success(){ // 允许授权 + successCallback() + }, + fail(){ // 拒绝授权 + if (map.has(scope)) { + let word = map.get(scope) + Taro.showModal({ + content:`检测到您没打开${word}权限,是否去设置打开?`, + confirmText: "确认", + cancelText:'取消', + success: (res) => { + if(res.confirm){ + Taro.openSetting({ + success: (res) => { + successCallback() + }, + fail: () => { + failCallback() + }, + }) + }else{ + failCallback() + } + } + }) + } else { + Taro.showToast({ + title: '无此授权功能' + }) + failCallback() + } + } + }) + } else { + successCallback() + } + } + }) + +} diff --git a/collect_information/tsconfig.json b/collect_information/tsconfig.json new file mode 100644 index 0000000..0db7497 --- /dev/null +++ b/collect_information/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "target": "es2017", + "module": "commonjs", + "removeComments": false, + "preserveConstEnums": true, + "moduleResolution": "node", + "experimentalDecorators": true, + "noImplicitAny": false, + "allowSyntheticDefaultImports": true, + "outDir": "lib", + "noUnusedLocals": false, + "noUnusedParameters": false, + "strictNullChecks": true, + "sourceMap": true, + "rootDir": ".", + "jsx": "preserve", + "allowJs": true, + "resolveJsonModule": true, + "typeRoots": ["node_modules/@types"], + "paths": { + "@/*": ["src/*"] + } + }, + "include": ["./src", "./types", "./config"], + "compileOnSave": false +} diff --git a/collect_information/types/global.d.ts b/collect_information/types/global.d.ts new file mode 100644 index 0000000..fe190e8 --- /dev/null +++ b/collect_information/types/global.d.ts @@ -0,0 +1,62 @@ +/// + +declare module '*.png'; +declare module '*.gif'; +declare module '*.jpg'; +declare module '*.jpeg'; +declare module '*.svg'; +declare module '*.css'; +declare module '*.less'; +declare module '*.scss'; +declare module '*.sass'; +declare module '*.styl'; + +declare namespace NodeJS { + interface ProcessEnv { + /** NODE 内置环境变量, 会影响到最终构建生成产物 */ + NODE_ENV: 'development' | 'production', + /** 当前构建的平台 */ + TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'quickapp' | 'qq' | 'jd' + /** + * 当前构建的小程序 appid + * @description 若不同环境有不同的小程序,可通过在 env 文件中配置环境变量`TARO_APP_ID`来方便快速切换 appid, 而不必手动去修改 dist/project.config.json 文件 + * @see https://taro-docs.jd.com/docs/next/env-mode-config#特殊环境变量-taro_app_id + */ + TARO_APP_ID: string, + TARO_APP_BASE_API: string + } +} + +declare module '@tarojs/components' { + export * from '@tarojs/components/types/index.vue3' +} + +/** + * 选择 + */ +interface SelectNode { + value: T, + label: string, + options?: SelectNode[] + orderIndex?: number, + disabled?: boolean, + extData?: Record +} + +interface JsonResult { + code: number; + data?: T; + message: string; +} + +/** + * 树 + */ +interface TreeNode { + value: T, + parentValue: T, + label: string, + orderIndex?: number, + extData?: Record, + children?: TreeNode[] +} diff --git a/collect_information/types/pages/index/index.d.ts b/collect_information/types/pages/index/index.d.ts new file mode 100644 index 0000000..f2e0c2f --- /dev/null +++ b/collect_information/types/pages/index/index.d.ts @@ -0,0 +1,39 @@ +interface PersonnelInformation { + name: string, + sex: number, + dataOfBirth: Date | string, + idCard: string, + phone: string, + householdRegistrationAddress: string, + streetCommunitySmallCommunityIds: string[], + buildingFloorHouseIds: string[] +} + +interface EnterUserInfoSaveOrUpdateParams { + snowFlakeId?: string, + + streetId?: string, + communityId?: string, + smallCommunityId?: string, + buildingId?: string, + floorId?: string, + houseId?: string, + + name: string, + sex: number, + dateOfBirth?: Date | string + idCard: string + phone: string + householdRegistrationAddress?: string + + optFlag: null | 0 | 1 +} + +interface SystemExitsPopulationInformationVo { + snowFlakeId: string, + name: string, + sex: number, + residentialDivisionDetail: string, + createTime: string, + createUserName: string +} diff --git a/collect_information/types/pages/login/index.d.ts b/collect_information/types/pages/login/index.d.ts new file mode 100644 index 0000000..2192b8c --- /dev/null +++ b/collect_information/types/pages/login/index.d.ts @@ -0,0 +1,4 @@ +interface LoginUserInfo { + name?: string; + avatar?: string; +} diff --git a/collect_information/types/pages/register/index.d.ts b/collect_information/types/pages/register/index.d.ts new file mode 100644 index 0000000..f759fd7 --- /dev/null +++ b/collect_information/types/pages/register/index.d.ts @@ -0,0 +1,8 @@ +interface RegisterParams { + avatar: string; + name: string; + sex:number, + telephone:string, + identity: string; + unitId: any +} diff --git a/collect_information/types/request/index.d.ts b/collect_information/types/request/index.d.ts new file mode 100644 index 0000000..e137c22 --- /dev/null +++ b/collect_information/types/request/index.d.ts @@ -0,0 +1,9 @@ +import Taro from "@tarojs/taro"; + +export interface ApiOptions + extends Omit< + Taro.request.Option, + "url" | "method" | "data" | "success" | "fail" + > { + loading?: boolean; +} diff --git a/collect_information/types/vue.d.ts b/collect_information/types/vue.d.ts new file mode 100644 index 0000000..a97867d --- /dev/null +++ b/collect_information/types/vue.d.ts @@ -0,0 +1,10 @@ +export {} + +declare module 'vue' { + export interface GlobalComponents extends JSX.IntrinsicElements { + /** Note: Vue 在 runtime 中将 JSX.IntrinsicElements 通过 index signature 重复声明标签 + * 这会导致插件无法正常跳转类型,可以手动覆盖声明标签活得更好的体验,参考如下: + * 'scroll-view': JSX.IntrinsicElements['scroll-view'] + */ + } +} diff --git a/policeSecurityServer/src/main/java/com/changhu/common/annotation/CheckUserType.java b/policeSecurityServer/src/main/java/com/changhu/common/annotation/CheckUserType.java index 247ea5d..d97d4e8 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/annotation/CheckUserType.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/annotation/CheckUserType.java @@ -1,10 +1,8 @@ package com.changhu.common.annotation; -import com.changhu.enums.ClientType; import org.springframework.web.bind.annotation.RestController; import java.lang.annotation.*; -import java.util.List; /** * @author 20252 diff --git a/policeSecurityServer/src/main/java/com/changhu/common/utils/UserUtil.java b/policeSecurityServer/src/main/java/com/changhu/common/utils/UserUtil.java index 7d6cbe8..93dfb6c 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/utils/UserUtil.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/utils/UserUtil.java @@ -9,7 +9,6 @@ import cn.hutool.crypto.SecureUtil; import com.changhu.common.annotation.UserType; import com.changhu.common.enums.ResultCode; import com.changhu.common.exception.MessageException; -import com.changhu.enums.ClientType; import lombok.extern.slf4j.Slf4j; import java.util.Optional; @@ -59,7 +58,7 @@ public class UserUtil { if (clientType instanceof String ct) { return UserType.valueOf(ct); } - return null; + throw new MessageException("获取不到用户类型"); } /** diff --git a/policeSecurityServer/src/main/java/com/changhu/config/WebConfig.java b/policeSecurityServer/src/main/java/com/changhu/config/WebConfig.java index e34c5c2..0d429fc 100644 --- a/policeSecurityServer/src/main/java/com/changhu/config/WebConfig.java +++ b/policeSecurityServer/src/main/java/com/changhu/config/WebConfig.java @@ -2,8 +2,8 @@ package com.changhu.config; import cn.dev33.satoken.interceptor.SaInterceptor; import cn.dev33.satoken.stp.StpUtil; -import com.changhu.support.interceptor.UserTypeInterceptor; import com.changhu.support.interceptor.JsonBodyInterceptor; +import com.changhu.support.interceptor.UserTypeInterceptor; import org.jetbrains.annotations.NotNull; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; @@ -28,7 +28,6 @@ public class WebConfig implements WebMvcConfigurer { whiteList.add("/test/**"); whiteList.add("/login"); whiteList.add("/logout"); - whiteList.add("/management/getCheckStatus"); whiteList.add("/favicon.ico"); //druid console whiteList.add("/druid/**"); @@ -38,8 +37,10 @@ public class WebConfig implements WebMvcConfigurer { whiteList.add("/swagger-resources"); whiteList.add("/**webjars/**"); whiteList.add("/v3/**"); - //平台信息 - whiteList.add("/platformSetting/getPlatformInfo"); + //获取企业注册审核状态 + whiteList.add("/management/getCheckStatus"); + //微信小程序注册 + whiteList.add("/miniProgramUser/register"); } @Override diff --git a/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java b/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java index 2d316fb..0984600 100644 --- a/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java +++ b/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java @@ -13,6 +13,7 @@ import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.common.pojo.vo.TreeNodeVo; import com.changhu.pojo.params.PoliceUnitRegisterParams; import com.changhu.pojo.params.SecurityUnitRegisterParams; +import com.changhu.pojo.queryParams.QueryUnitListByIdentityQueryParams; import com.changhu.service.AdministrativeDivisionService; import com.changhu.service.CommonService; import com.changhu.support.minio.service.MinioService; @@ -59,6 +60,12 @@ public class CommonController { return administrativeDivisionService.tree(level); } + @Operation(summary = "根据父编码查询子级行政区划") + @GetMapping("/administrativeDivisionByParentCode") + public List> administrativeDivisionByParentCode(@Schema(description = "父编码") @RequestParam(defaultValue = "0") String parentCode) { + return administrativeDivisionService.administrativeDivisionByParentCode(parentCode); + } + @Operation(summary = "保安单位注册") @PostMapping("/securityUnitRegister") public JsonResult securityUnitRegister(@RequestBody @Valid SecurityUnitRegisterParams params) { @@ -78,6 +85,14 @@ public class CommonController { return minioService.getResignedObjectUrl(bucketName, objectName); } + @Operation(summary = "根据身份查询单位列表") + @PostMapping("/queryUnitListByIdentity") + public List> queryUnitListByIdentity(@RequestBody QueryUnitListByIdentityQueryParams queryParams) { + return commonService.queryUnitListByIdentity(queryParams); + } + + + @Operation(summary = "字典数据") @GetMapping("/enums") public Map>> enums() { return enumsResult; diff --git a/policeSecurityServer/src/main/java/com/changhu/enums/ClientType.java b/policeSecurityServer/src/main/java/com/changhu/enums/ClientType.java index 2b9923e..bfdf768 100644 --- a/policeSecurityServer/src/main/java/com/changhu/enums/ClientType.java +++ b/policeSecurityServer/src/main/java/com/changhu/enums/ClientType.java @@ -1,9 +1,6 @@ package com.changhu.enums; -import com.changhu.enums.handler.AbstractLoginHandler; -import com.changhu.enums.handler.ManagementPoliceUnitLogin; -import com.changhu.enums.handler.ManagementSecurityUnitLogin; -import com.changhu.enums.handler.ManagementSuperLogin; +import com.changhu.enums.handler.*; import lombok.AllArgsConstructor; import lombok.Getter; @@ -18,7 +15,7 @@ public enum ClientType { MANAGEMENT_SUPER("超级后台", ManagementSuperLogin.instance), MANAGEMENT_POLICE("公安后台", ManagementPoliceUnitLogin.instance), MANAGEMENT_SECURITY("保安后台", ManagementSecurityUnitLogin.instance), - MINI_PROGRAM("微信小程序", ManagementSuperLogin.instance), + MINI_PROGRAM("微信小程序", MiniProgramUserLogin.instance), ; private final String remark; diff --git a/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java b/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java index 3bd009e..37790bb 100644 --- a/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java +++ b/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java @@ -11,7 +11,6 @@ import com.changhu.common.pojo.vo.TokenInfo; import com.changhu.common.utils.RsaUtil; import com.changhu.common.utils.UserUtil; import com.changhu.common.utils.ValidatorUtil; -import com.changhu.enums.ClientType; import com.changhu.module.management.pojo.entity.ManagementSecurityUnitUser; import com.changhu.module.management.pojo.entity.SecurityUnit; import com.changhu.pojo.params.ManagementSecurityUnitLoginParams; diff --git a/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSuperLogin.java b/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSuperLogin.java index 8204208..6b1ad39 100644 --- a/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSuperLogin.java +++ b/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSuperLogin.java @@ -10,7 +10,6 @@ import com.changhu.common.pojo.vo.TokenInfo; import com.changhu.common.utils.RsaUtil; import com.changhu.common.utils.UserUtil; import com.changhu.common.utils.ValidatorUtil; -import com.changhu.enums.ClientType; import com.changhu.module.management.pojo.entity.ManagementSuperUser; import com.changhu.pojo.params.ManagementSuperLoginParams; diff --git a/policeSecurityServer/src/main/java/com/changhu/enums/handler/MiniProgramUserLogin.java b/policeSecurityServer/src/main/java/com/changhu/enums/handler/MiniProgramUserLogin.java new file mode 100644 index 0000000..bbf35b1 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/enums/handler/MiniProgramUserLogin.java @@ -0,0 +1,65 @@ +package com.changhu.enums.handler; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; +import cn.dev33.satoken.stp.SaTokenInfo; +import cn.hutool.extra.spring.SpringUtil; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.extension.toolkit.Db; +import com.changhu.common.annotation.UserType; +import com.changhu.common.enums.ResultCode; +import com.changhu.common.exception.MessageException; +import com.changhu.common.pojo.vo.TokenInfo; +import com.changhu.common.utils.UserUtil; +import com.changhu.common.utils.ValidatorUtil; +import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser; +import com.changhu.pojo.params.MiniProgramUserLoginParams; +import me.chanjar.weixin.common.error.WxErrorException; + +/** + * @author 20252 + * @createTime 2024/9/10 上午10:00 + * @desc MiniProgramUserLogin... + */ +public class MiniProgramUserLogin extends AbstractLoginHandler { + + public static final MiniProgramUserLogin instance = new MiniProgramUserLogin(); + + private MiniProgramUserLogin() { + } + + @Override + public TokenInfo login(JSONObject jsonObject) { + MiniProgramUserLoginParams loginParams = jsonObject.to(MiniProgramUserLoginParams.class); + ValidatorUtil.manual(loginParams); + String code = loginParams.getCode(); + + String openId; + final WxMaService wxMaService = SpringUtil.getBean(WxMaService.class); + + try { + WxMaJscode2SessionResult sessionInfo = wxMaService.getUserService().getSessionInfo(code); + openId = sessionInfo.getOpenid(); + } catch (WxErrorException e) { + throw new MessageException(e.getMessage()); + } + + MiniProgramUser miniProgramUser = Db.lambdaQuery(MiniProgramUser.class) + .eq(MiniProgramUser::getOpenId, openId) + .oneOpt() + .orElseThrow(() -> new MessageException(ResultCode.USER_NOT_FOUND)); + + UserType userType = switch (miniProgramUser.getIdentity()) { + case POLICE -> UserType.MINI_PROGRAM_POLICE; + case PROJECT_MANAGER -> UserType.MINI_PROGRAM_PROJECT_MANAGE; + }; + + //登录 + SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo( + miniProgramUser.getSnowFlakeId(), + userType, + miniProgramUser.getUnitId()); + //返回token + return new TokenInfo(saTokenInfo.getTokenName(), saTokenInfo.getTokenValue()); + } +} 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 deleted file mode 100644 index cb58b24..0000000 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/controller/IndexController.java +++ /dev/null @@ -1,47 +0,0 @@ -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.params.IndexDisableOrEnableParams; -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); - } - - @Operation(summary = "启用或禁用状态") - @PostMapping("/disableOrEnable") - public void disableOrEnable(@RequestBody @Valid IndexDisableOrEnableParams params) { - indexService.disableOrEnable(params); - } -} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/controller/ManagementController.java b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/ManagementController.java new file mode 100644 index 0000000..4218758 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/ManagementController.java @@ -0,0 +1,72 @@ +package com.changhu.module.management.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.changhu.common.annotation.CheckUserType; +import com.changhu.common.annotation.JsonBody; +import com.changhu.common.annotation.UserType; +import com.changhu.module.management.pojo.params.IndexCheckPassParams; +import com.changhu.module.management.pojo.params.IndexCheckStatusParams; +import com.changhu.module.management.pojo.params.IndexDisableOrEnableParams; +import com.changhu.module.management.pojo.queryParams.UnitMiniProgramUserPagerQueryParams; +import com.changhu.module.management.pojo.vo.UnitCheckStatusVo; +import com.changhu.module.management.pojo.vo.UnitMiniProgramUserPagerVo; +import com.changhu.module.management.service.ManagementService; +import com.changhu.support.mybatisplus.pojo.params.PageParams; +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 ManagementController { + + @Autowired + private ManagementService managementService; + + @Operation(summary = "审核通过") + @PostMapping("/checkPass") + public void checkPass(@RequestBody @Valid IndexCheckPassParams params) { + managementService.checkPass(params); + } + + @Operation(summary = "获取审核状态") + @PostMapping("/getCheckStatus") + public UnitCheckStatusVo getCheckStatus(@RequestBody @Valid IndexCheckStatusParams params) { + return managementService.getCheckStatus(params); + } + + @Operation(summary = "启用或禁用状态") + @PostMapping("/disableOrEnable") + public void disableOrEnable(@RequestBody @Valid IndexDisableOrEnableParams params) { + managementService.disableOrEnable(params); + } + + @Operation(summary = "查询单位下的小程序用户") + @PostMapping("/miniProgramUserPager") + @CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SECURITY}) + public Page miniProgramUserPager(@RequestBody PageParams queryParams) { + return managementService.miniProgramUserPager(queryParams); + } + + @Operation(summary = "审核通过小程序用户") + @PostMapping("/passMiniProgramUser") + public void passMiniProgramUser(@RequestBody @Valid IndexDisableOrEnableParams params) { + managementService.passMiniProgramUser(params); + } + + @Operation(summary = "禁用或启用小程序用户") + @PostMapping("/disableOrEnableMiniProgramUser") + public void disableOrEnableMiniProgramUser(@RequestBody @Valid IndexDisableOrEnableParams params) { + managementService.disableOrEnableMiniProgramUser(params); + } +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/controller/ManagementPoliceUnitUserController.java b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/ManagementPoliceUnitUserController.java index ef2083e..7882d57 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/controller/ManagementPoliceUnitUserController.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/ManagementPoliceUnitUserController.java @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.UserType; -import com.changhu.enums.ClientType; import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams; import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams; import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/controller/ManagementSecurityUnitUserController.java b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/ManagementSecurityUnitUserController.java index 9de9ef8..a2bcecc 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/controller/ManagementSecurityUnitUserController.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/ManagementSecurityUnitUserController.java @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.UserType; -import com.changhu.enums.ClientType; import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams; import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams; import com.changhu.module.management.pojo.vo.ManagementSecurityUnitUserPagerVo; 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 f64fb8f..0d30c78 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 @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.UserType; -import com.changhu.enums.ClientType; import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams; import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams; import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo; 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 c2e97a3..8b50174 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 @@ -5,7 +5,6 @@ import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.UserType; import com.changhu.common.pojo.vo.SelectNodeVo; -import com.changhu.enums.ClientType; import com.changhu.module.management.pojo.params.SecurityUnitSaveOrUpdateParams; import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams; import com.changhu.module.management.pojo.vo.SecurityUnitPagerVo; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/controller/ServiceProjectController.java b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/ServiceProjectController.java index 7f31b1e..c9dc499 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/controller/ServiceProjectController.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/controller/ServiceProjectController.java @@ -5,7 +5,6 @@ import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.UserType; import com.changhu.common.exception.MessageException; -import com.changhu.enums.ClientType; import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams; import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams; import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo; @@ -24,6 +23,7 @@ import org.springframework.web.bind.annotation.*; @Tag(name = "服务项目") @JsonBody @RequestMapping("/serviceProject") +@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY) public class ServiceProjectController { @Autowired @@ -31,14 +31,12 @@ public class ServiceProjectController { @Operation(summary = "分页查询") @PostMapping("/pager") - @CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY) public Page pager(@RequestBody PageParams queryParams) { return serviceProjectService.pager(queryParams); } @Operation(summary = "新增或者保存") @PostMapping("/saveOrUpdate") - @CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY) public void saveOrUpdate(@RequestBody ServiceProjectSaveOrUpdateParams params) { serviceProjectService.saveOrUpdate(params); } 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 index db71404..8413f1e 100644 --- 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 @@ -32,4 +32,18 @@ public abstract class AbstractUnitTypeHandler { * @param unitId 单位id */ public abstract void disableOrEnable(Long unitId); + + /** + * 审核通过单位内的小程序用户 + * + * @param miniProgramUserId 小程序用户id + */ + public abstract void passMiniProgramUser(Long miniProgramUserId); + + /** + * 启用或禁用小程序用户 + * + * @param miniProgramUserId 小程序用户id + */ + public abstract void disableOrEnableMiniProgramUser(Long miniProgramUserId); } 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 index f2b5c8a..19ffc09 100644 --- 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 @@ -36,7 +36,6 @@ public class PoliceUnitTypeHandler extends AbstractUnitTypeHandler { private final ManagementPoliceUnitUserService policeUnitUserService = SpringUtil.getBean(ManagementPoliceUnitUserService.class); @Override - public void pass(Long checkDataId) { DefaultTransactionDefinition def = new DefaultTransactionDefinition(); TransactionStatus status = transactionManager.getTransaction(def); @@ -125,4 +124,14 @@ public class PoliceUnitTypeHandler extends AbstractUnitTypeHandler { throw new MessageException(); } } + + @Override + public void passMiniProgramUser(Long miniProgramUserId) { + + } + + @Override + public void disableOrEnableMiniProgramUser(Long miniProgramUserId) { + + } } 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 index dbb918f..ad23979 100644 --- 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 @@ -15,6 +15,8 @@ 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.module.miniProgram.pojo.entity.MiniProgramUser; +import com.changhu.module.miniProgram.service.MiniProgramUserService; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import lombok.extern.slf4j.Slf4j; import org.springframework.transaction.TransactionStatus; @@ -34,6 +36,8 @@ public class SecurityUnitTypeHandler extends AbstractUnitTypeHandler { private final ManagementSecurityUnitUserService securityUnitUserService = SpringUtil.getBean(ManagementSecurityUnitUserService.class); + private final MiniProgramUserService miniProgramUserService = SpringUtil.getBean(MiniProgramUserService.class); + @Override public void pass(Long checkDataId) { DefaultTransactionDefinition def = new DefaultTransactionDefinition(); @@ -126,4 +130,38 @@ public class SecurityUnitTypeHandler extends AbstractUnitTypeHandler { } } + @Override + public void passMiniProgramUser(Long miniProgramUserId) { + boolean update = miniProgramUserService.lambdaUpdate() + .set(MiniProgramUser::getCheckStatus, CheckStatus.checked) + .eq(BaseEntity::getSnowFlakeId, miniProgramUserId) + .update(); + if (!update) { + throw new MessageException(); + } + } + + @Override + public void disableOrEnableMiniProgramUser(Long miniProgramUserId) { + MiniProgramUser miniProgramUser = miniProgramUserService.lambdaQuery() + .eq(BaseEntity::getSnowFlakeId, miniProgramUserId) + .oneOpt() + .orElseThrow(() -> new MessageException(ResultCode.DATA_NOT_FOUND)); + + //取反 + IsEnable isEnable = switch (miniProgramUser.getIsEnable()) { + case TRUE -> IsEnable.FALSE; + case FALSE -> IsEnable.TRUE; + }; + + boolean update = miniProgramUserService.lambdaUpdate() + .set(MiniProgramUser::getIsEnable, isEnable) + .eq(BaseEntity::getSnowFlakeId, miniProgramUserId) + .update(); + if (!update) { + throw new MessageException(); + } + + } + } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ServiceProject.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ServiceProject.java index 1e14b5c..3adb2ba 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ServiceProject.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/ServiceProject.java @@ -1,17 +1,17 @@ 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.IsOrNot; import com.changhu.common.db.enums.ServiceProjectType; 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/IndexDisableOrEnableParams.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/IndexDisableOrEnableParams.java index b81fee7..f00c4ef 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/IndexDisableOrEnableParams.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/IndexDisableOrEnableParams.java @@ -12,9 +12,9 @@ import lombok.Data; */ @Data public class IndexDisableOrEnableParams { - @Schema(description = "单位id") - @NotNull(message = "单位id不能为空") - private Long unitId; + @Schema(description = "数据id") + @NotNull(message = "数据id不能为空") + private Long dataId; @Schema(description = "单位类型") @NotNull(message = "单位类型不能为空") diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/queryParams/UnitMiniProgramUserPagerQueryParams.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/queryParams/UnitMiniProgramUserPagerQueryParams.java new file mode 100644 index 0000000..e01b151 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/queryParams/UnitMiniProgramUserPagerQueryParams.java @@ -0,0 +1,23 @@ +package com.changhu.module.management.pojo.queryParams; + +import com.changhu.common.db.enums.IsEnable; +import com.changhu.common.db.enums.Sex; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/9/6 下午4:53 + * @desc UnitMiniProgramUserPagerQueryParams... + */ +@Data +public class UnitMiniProgramUserPagerQueryParams { + @Schema(description = "名称") + private String name; + @Schema(description = "性别") + private Sex sex; + @Schema(description = "手机号") + private String telephone; + @Schema(description = "是否启用") + private IsEnable isEnable; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/UnitMiniProgramUserPagerVo.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/UnitMiniProgramUserPagerVo.java new file mode 100644 index 0000000..9511ae7 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/UnitMiniProgramUserPagerVo.java @@ -0,0 +1,46 @@ +package com.changhu.module.management.pojo.vo; + +import com.changhu.common.db.enums.CheckStatus; +import com.changhu.common.db.enums.IsEnable; +import com.changhu.common.db.enums.MiniProgramUserIdentity; +import com.changhu.common.db.enums.Sex; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author 20252 + * @createTime 2024/9/6 下午4:32 + * @desc 单位下的微信小程序用户 + */ +@Data +public class UnitMiniProgramUserPagerVo { + + @Schema(description = "id") + private Long snowFlakeId; + + @Schema(description = "名称") + private String name; + + @Schema(description = "手机号") + private String telephone; + + @Schema(description = "性别") + private Sex sex; + + @Schema(description = "身份证") + private String idCard; + + @Schema(description = "身份") + private MiniProgramUserIdentity identity; + + @Schema(description = "审核状态") + private CheckStatus checkStatus; + + @Schema(description = "是否启用") + private IsEnable isEnable; + + @Schema(description = ":创建时间") + private LocalDateTime createTime; +} 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 deleted file mode 100644 index 4b6fc8b..0000000 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/service/IndexService.java +++ /dev/null @@ -1,36 +0,0 @@ -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.params.IndexDisableOrEnableParams; -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); - - /** - * 启用或者禁用单位 - * - * @param params 参数 - */ - void disableOrEnable(IndexDisableOrEnableParams params); -} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/service/ManagementService.java b/policeSecurityServer/src/main/java/com/changhu/module/management/service/ManagementService.java new file mode 100644 index 0000000..9fd2787 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/service/ManagementService.java @@ -0,0 +1,63 @@ +package com.changhu.module.management.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.changhu.module.management.pojo.params.IndexCheckPassParams; +import com.changhu.module.management.pojo.params.IndexCheckStatusParams; +import com.changhu.module.management.pojo.params.IndexDisableOrEnableParams; +import com.changhu.module.management.pojo.queryParams.UnitMiniProgramUserPagerQueryParams; +import com.changhu.module.management.pojo.vo.UnitCheckStatusVo; +import com.changhu.module.management.pojo.vo.UnitMiniProgramUserPagerVo; +import com.changhu.support.mybatisplus.pojo.params.PageParams; + +/** + * @author 20252 + * @createTime 2024/9/2 上午9:49 + * @desc IndexService... + */ +public interface ManagementService { + + /** + * 审核通过 + * + * @param params 审核参数 + */ + void checkPass(IndexCheckPassParams params); + + /** + * 获取审核状态 + * + * @param params 参数 + * @return 结果 + */ + UnitCheckStatusVo getCheckStatus(IndexCheckStatusParams params); + + /** + * 启用或者禁用单位 + * + * @param params 参数 + */ + void disableOrEnable(IndexDisableOrEnableParams params); + + /** + * 查询单位下的小程序用户 + * + * @param queryParams 查询参数 + * @return 结果 + */ + Page miniProgramUserPager(PageParams queryParams); + + /** + * 审核通过小程序用户 + * + * @param params 参数 + */ + void passMiniProgramUser(IndexDisableOrEnableParams params); + + /** + * 禁用或启用小程序用户 + * + * @param params 参数 + */ + void disableOrEnableMiniProgramUser(IndexDisableOrEnableParams 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 deleted file mode 100644 index 4fbec9f..0000000 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/IndexServiceImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -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.params.IndexDisableOrEnableParams; -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()); - } - - @Override - public void disableOrEnable(IndexDisableOrEnableParams params) { - params.getUnitOptType() - .getHandler() - .disableOrEnable(params.getUnitId()); - } -} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementPoliceUnitUserServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementPoliceUnitUserServiceImpl.java index f15fbe0..072a0f3 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementPoliceUnitUserServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementPoliceUnitUserServiceImpl.java @@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.changhu.common.enums.ResultCode; import com.changhu.common.exception.MessageException; import com.changhu.common.utils.UserUtil; -import com.changhu.enums.ClientType; import com.changhu.module.management.mapper.ManagementPoliceUnitUserMapper; import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser; import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementSecurityUnitUserServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementSecurityUnitUserServiceImpl.java index 553aeb6..23f7dd6 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementSecurityUnitUserServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementSecurityUnitUserServiceImpl.java @@ -9,9 +9,7 @@ import com.changhu.common.annotation.UserType; import com.changhu.common.enums.ResultCode; import com.changhu.common.exception.MessageException; import com.changhu.common.utils.UserUtil; -import com.changhu.enums.ClientType; import com.changhu.module.management.mapper.ManagementSecurityUnitUserMapper; -import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser; import com.changhu.module.management.pojo.entity.ManagementSecurityUnitUser; import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams; import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementServiceImpl.java new file mode 100644 index 0000000..8a2450b --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/service/impl/ManagementServiceImpl.java @@ -0,0 +1,76 @@ +package com.changhu.module.management.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.changhu.common.annotation.UserType; +import com.changhu.common.db.enums.MiniProgramUserIdentity; +import com.changhu.common.exception.MessageException; +import com.changhu.common.utils.UserUtil; +import com.changhu.module.management.pojo.params.IndexCheckPassParams; +import com.changhu.module.management.pojo.params.IndexCheckStatusParams; +import com.changhu.module.management.pojo.params.IndexDisableOrEnableParams; +import com.changhu.module.management.pojo.queryParams.UnitMiniProgramUserPagerQueryParams; +import com.changhu.module.management.pojo.vo.UnitCheckStatusVo; +import com.changhu.module.management.pojo.vo.UnitMiniProgramUserPagerVo; +import com.changhu.module.management.service.ManagementService; +import com.changhu.module.miniProgram.mapper.MiniProgramUserMapper; +import com.changhu.support.mybatisplus.pojo.params.PageParams; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @author 20252 + * @createTime 2024/9/2 上午9:49 + * @desc IndexServiceImpl... + */ +@Service +public class ManagementServiceImpl implements ManagementService { + + @Autowired + private MiniProgramUserMapper miniProgramUserMapper; + + @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()); + } + + @Override + public void disableOrEnable(IndexDisableOrEnableParams params) { + params.getUnitOptType() + .getHandler() + .disableOrEnable(params.getDataId()); + } + + @Override + public Page miniProgramUserPager(PageParams queryParams) { + UserType userType = UserUtil.getUserType(); + MiniProgramUserIdentity identity = switch (userType) { + case MANAGEMENT_POLICE -> MiniProgramUserIdentity.POLICE; + case MANAGEMENT_SECURITY -> MiniProgramUserIdentity.PROJECT_MANAGER; + default -> throw new MessageException("用户类型不匹配"); + }; + return miniProgramUserMapper.pager(queryParams.getPage(), queryParams.getParams(), identity); + } + + @Override + public void passMiniProgramUser(IndexDisableOrEnableParams params) { + params.getUnitOptType() + .getHandler() + .passMiniProgramUser(params.getDataId()); + } + + @Override + public void disableOrEnableMiniProgramUser(IndexDisableOrEnableParams params) { + params.getUnitOptType() + .getHandler() + .disableOrEnableMiniProgramUser(params.getDataId()); + } +} 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 cefc6f2..2bae0e3 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 @@ -10,14 +10,14 @@ import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.MiniProgramUserIdentity; import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.common.utils.UserUtil; -import com.changhu.module.miniProgram.mapper.MiniProgramUserMapper; import com.changhu.module.management.mapper.SecurityUnitMapper; -import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser; 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.module.miniProgram.mapper.MiniProgramUserMapper; +import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser; import com.changhu.support.mybatisplus.pojo.params.PageParams; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/MiniProgramUserController.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/MiniProgramUserController.java index 8026d43..381edf8 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/MiniProgramUserController.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/MiniProgramUserController.java @@ -1,9 +1,7 @@ package com.changhu.module.miniProgram.controller; -import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.JsonBody; -import com.changhu.common.annotation.UserType; -import com.changhu.enums.ClientType; +import com.changhu.common.pojo.vo.TokenInfo; import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams; import com.changhu.module.miniProgram.service.MiniProgramUserService; import io.swagger.v3.oas.annotations.Operation; @@ -29,7 +27,7 @@ public class MiniProgramUserController { @Operation(summary = "注册") @PostMapping("/register") - public void register(@RequestBody @Valid MiniProgramUserRegisterParams params) { - miniProgramUserService.register(params); + public TokenInfo register(@RequestBody @Valid MiniProgramUserRegisterParams params) { + return miniProgramUserService.register(params); } } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/mapper/MiniProgramUserMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/mapper/MiniProgramUserMapper.java index 458d4b7..4ae4e0c 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/mapper/MiniProgramUserMapper.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/mapper/MiniProgramUserMapper.java @@ -1,8 +1,13 @@ package com.changhu.module.miniProgram.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.changhu.common.db.enums.MiniProgramUserIdentity; +import com.changhu.module.management.pojo.queryParams.UnitMiniProgramUserPagerQueryParams; +import com.changhu.module.management.pojo.vo.UnitMiniProgramUserPagerVo; import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * mini_program_user (小程序用户) 固化类 @@ -12,4 +17,15 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface MiniProgramUserMapper extends BaseMapper { + /** + * 分页查询 + * + * @param page 分页参数 + * @param params 查询参数 + * @param identity 用户身份 + * @return 结果 + */ + Page pager(@Param("page") Page page, + @Param("params") UnitMiniProgramUserPagerQueryParams params, + @Param("identity") MiniProgramUserIdentity identity); } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/entity/MiniProgramUser.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/entity/MiniProgramUser.java index e38bf7a..d2d2944 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/entity/MiniProgramUser.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/entity/MiniProgramUser.java @@ -1,18 +1,19 @@ package com.changhu.module.miniProgram.pojo.entity; -import java.io.Serial; -import java.io.Serializable; - +import com.baomidou.mybatisplus.annotation.TableName; +import com.changhu.common.db.enums.CheckStatus; import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.MiniProgramUserIdentity; 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; /** @@ -76,4 +77,9 @@ public class MiniProgramUser extends BaseEntity implements Serializable { */ private IsEnable isEnable; + /** + * 审核状态 + */ + private CheckStatus checkStatus; + } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/params/MiniProgramUserRegisterParams.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/params/MiniProgramUserRegisterParams.java index b5315cd..39a67e2 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/params/MiniProgramUserRegisterParams.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/params/MiniProgramUserRegisterParams.java @@ -2,6 +2,7 @@ package com.changhu.module.miniProgram.pojo.params; import com.changhu.common.db.enums.MiniProgramUserIdentity; import com.changhu.common.db.enums.Sex; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.Data; @@ -13,19 +14,26 @@ import lombok.Data; */ @Data public class MiniProgramUserRegisterParams { + @Schema(description = "微信code") @NotBlank(message = "code不能为空") private String code; + @Schema(description = "名称") @NotBlank(message = "名称不能为空") private String name; + @Schema(description = "性别") @NotNull(message = "性别不能为空") private Sex sex; + @Schema(description = "手机号") private String telephone; + @Schema(description = "身份") @NotNull(message = "身份不能为空") private MiniProgramUserIdentity identity; + + @Schema(description = "单位id") @NotNull(message = "单位不能为空") private Long unitId; } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/MiniProgramUserService.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/MiniProgramUserService.java index 454c4ed..73299b3 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/MiniProgramUserService.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/MiniProgramUserService.java @@ -1,6 +1,7 @@ package com.changhu.module.miniProgram.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.changhu.common.pojo.vo.TokenInfo; import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser; import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams; @@ -16,5 +17,5 @@ public interface MiniProgramUserService extends IService { * * @param params 参数 */ - void register(MiniProgramUserRegisterParams params); + TokenInfo register(MiniProgramUserRegisterParams params); } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MiniProgramUserServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MiniProgramUserServiceImpl.java index 3f623eb..4c1339f 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MiniProgramUserServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MiniProgramUserServiceImpl.java @@ -2,11 +2,15 @@ package com.changhu.module.miniProgram.service.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; +import cn.dev33.satoken.stp.SaTokenInfo; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.changhu.common.annotation.UserType; import com.changhu.common.exception.MessageException; +import com.changhu.common.pojo.vo.TokenInfo; import com.changhu.common.utils.SnowFlakeIdUtil; +import com.changhu.common.utils.UserUtil; import com.changhu.module.miniProgram.mapper.MiniProgramUserMapper; import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser; import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams; @@ -27,7 +31,7 @@ public class MiniProgramUserServiceImpl extends ServiceImpl administrativeDivisionCodes; + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/service/AdministrativeDivisionService.java b/policeSecurityServer/src/main/java/com/changhu/service/AdministrativeDivisionService.java index 48b910c..1cb42d3 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/AdministrativeDivisionService.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/AdministrativeDivisionService.java @@ -20,4 +20,12 @@ public interface AdministrativeDivisionService extends IService> tree(Integer level); + + /** + * 根据父编码查询子级(懒加载) + * + * @param parentCode 父编码 + * @return 子级 + */ + List> administrativeDivisionByParentCode(String parentCode); } diff --git a/policeSecurityServer/src/main/java/com/changhu/service/CommonService.java b/policeSecurityServer/src/main/java/com/changhu/service/CommonService.java index 1b4a2b0..12dbb2d 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/CommonService.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/CommonService.java @@ -1,8 +1,12 @@ package com.changhu.service; import com.changhu.common.pojo.model.JsonResult; +import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.pojo.params.PoliceUnitRegisterParams; import com.changhu.pojo.params.SecurityUnitRegisterParams; +import com.changhu.pojo.queryParams.QueryUnitListByIdentityQueryParams; + +import java.util.List; /** * @author 20252 @@ -24,4 +28,12 @@ public interface CommonService { * @param params 注册参数 */ JsonResult policeUnitRegister(PoliceUnitRegisterParams params); + + /** + * 根据身份查询单位列表 + * + * @param queryParams 查询参数 + * @return 结果 + */ + List> queryUnitListByIdentity(QueryUnitListByIdentityQueryParams queryParams); } 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 cb51542..33fb245 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/impl/AdministrativeDivisionServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/impl/AdministrativeDivisionServiceImpl.java @@ -22,4 +22,18 @@ public class AdministrativeDivisionServiceImpl extends ServiceImpl> treeNodeVos = baseMapper.treeList(level); return TreeNodeVo.buildTree(treeNodeVos, "0"); } + + @Override + public List> 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(); + } } 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 e3d113e..cc6d256 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/impl/CommonServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/impl/CommonServiceImpl.java @@ -2,19 +2,24 @@ package com.changhu.service.impl; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.changhu.common.db.enums.CheckStatus; +import com.changhu.common.db.enums.IsEnable; import com.changhu.common.enums.ResultCode; import com.changhu.common.exception.MessageException; import com.changhu.common.pojo.model.JsonResult; +import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.module.management.mapper.PoliceUnitMapper; import com.changhu.module.management.mapper.SecurityUnitMapper; import com.changhu.module.management.pojo.entity.PoliceUnit; import com.changhu.module.management.pojo.entity.SecurityUnit; import com.changhu.pojo.params.PoliceUnitRegisterParams; import com.changhu.pojo.params.SecurityUnitRegisterParams; +import com.changhu.pojo.queryParams.QueryUnitListByIdentityQueryParams; import com.changhu.service.CommonService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; import java.util.Optional; /** @@ -93,4 +98,37 @@ public class CommonServiceImpl implements CommonService { return JsonResult.successMsg("申请已提交,请等待审核"); } + + @Override + public List> queryUnitListByIdentity(QueryUnitListByIdentityQueryParams queryParams) { + List administrativeDivisionCodes = queryParams.getAdministrativeDivisionCodes(); + return switch (queryParams.getIdentity()) { + case POLICE -> policeUnitMapper.selectList(Wrappers.lambdaQuery() + .eq(PoliceUnit::getIsEnable, IsEnable.TRUE) + .eq(PoliceUnit::getCheckStatus, CheckStatus.checked) + .eq(!administrativeDivisionCodes.isEmpty(), PoliceUnit::getProvince, administrativeDivisionCodes.get(0)) + .eq(administrativeDivisionCodes.size() >= 2, PoliceUnit::getCity, administrativeDivisionCodes.get(1)) + .eq(administrativeDivisionCodes.size() >= 3, PoliceUnit::getDistricts, administrativeDivisionCodes.get(2)) + .eq(administrativeDivisionCodes.size() >= 4, PoliceUnit::getStreet, administrativeDivisionCodes.get(3))) + .stream() + .map(item -> SelectNodeVo.builder() + .value(item.getSnowFlakeId()) + .label(item.getName()) + .build()) + .toList(); + case PROJECT_MANAGER -> securityUnitMapper.selectList(Wrappers.lambdaQuery() + .eq(SecurityUnit::getIsEnable, IsEnable.TRUE) + .eq(SecurityUnit::getCheckStatus, CheckStatus.checked) + .eq(!administrativeDivisionCodes.isEmpty(), SecurityUnit::getProvince, administrativeDivisionCodes.get(0)) + .eq(administrativeDivisionCodes.size() >= 2, SecurityUnit::getCity, administrativeDivisionCodes.get(1)) + .eq(administrativeDivisionCodes.size() >= 3, SecurityUnit::getDistricts, administrativeDivisionCodes.get(2)) + .eq(administrativeDivisionCodes.size() >= 4, SecurityUnit::getStreet, administrativeDivisionCodes.get(3))) + .stream() + .map(item -> SelectNodeVo.builder() + .value(item.getSnowFlakeId()) + .label(item.getName()) + .build()) + .toList(); + }; + } } diff --git a/policeSecurityServer/src/main/java/com/changhu/support/handler/GlobalExceptionHandler.java b/policeSecurityServer/src/main/java/com/changhu/support/handler/GlobalExceptionHandler.java index f350a77..05ba1d5 100644 --- a/policeSecurityServer/src/main/java/com/changhu/support/handler/GlobalExceptionHandler.java +++ b/policeSecurityServer/src/main/java/com/changhu/support/handler/GlobalExceptionHandler.java @@ -48,7 +48,7 @@ public class GlobalExceptionHandler { @ExceptionHandler(HttpMessageNotWritableException.class) public void HttpMessageNotWritableException(HttpMessageNotWritableException e) { - log.error("HttpMessageNotWritableException:{}", ExceptionUtil.stacktraceToString(e, 500)); + log.error("HttpMessageNotWritableException", e); } /** @@ -57,7 +57,7 @@ public class GlobalExceptionHandler { @ExceptionHandler(NullPointerException.class) public JsonResult nullPointerException(NullPointerException exception) { String errorLabel = "空指针错误:" + ExceptionUtil.getMessage(exception); - log.error("空指针错误:{}", ExceptionUtil.stacktraceToString(exception)); + log.error("空指针错误:", exception); return JsonResult.custom(ResultCode.ERROR.getCode(), errorLabel); } @@ -67,7 +67,7 @@ public class GlobalExceptionHandler { @ExceptionHandler(MessageException.class) public JsonResult messageExceptionHandler(MessageException exception) { String errorLabel = "业务异常:" + exception.getMessage(); - log.error(errorLabel); + log.error("业务异常:", exception); return JsonResult.custom(exception.getCode(), errorLabel); } diff --git a/policeSecurityServer/src/main/java/com/changhu/support/interceptor/UserTypeInterceptor.java b/policeSecurityServer/src/main/java/com/changhu/support/interceptor/UserTypeInterceptor.java index 4318c98..bac23f7 100644 --- a/policeSecurityServer/src/main/java/com/changhu/support/interceptor/UserTypeInterceptor.java +++ b/policeSecurityServer/src/main/java/com/changhu/support/interceptor/UserTypeInterceptor.java @@ -5,7 +5,6 @@ import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.UserType; import com.changhu.common.exception.MessageException; import com.changhu.common.utils.UserUtil; -import com.changhu.enums.ClientType; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.jetbrains.annotations.NotNull; diff --git a/policeSecurityServer/src/main/resources/mapper/MiniProgramUserMapper.xml b/policeSecurityServer/src/main/resources/mapper/MiniProgramUserMapper.xml new file mode 100644 index 0000000..021a877 --- /dev/null +++ b/policeSecurityServer/src/main/resources/mapper/MiniProgramUserMapper.xml @@ -0,0 +1,26 @@ + + + + + \ No newline at end of file diff --git a/securityManagement/src/assets/scss/myAntD.scss b/securityManagement/src/assets/scss/myAntD.scss index 1b055a3..6062db6 100644 --- a/securityManagement/src/assets/scss/myAntD.scss +++ b/securityManagement/src/assets/scss/myAntD.scss @@ -6,6 +6,7 @@ $--my-antd-important: !important; background-color: #F5222D; border-color: #F5222D; + &:hover, &:focus { color: #ffffff $--my-antd-important; background-color: #ff4d4f $--my-antd-important; diff --git a/securityManagement/src/components/layout/layout.vue b/securityManagement/src/components/layout/layout.vue index 09ce243..682ed00 100644 --- a/securityManagement/src/components/layout/layout.vue +++ b/securityManagement/src/components/layout/layout.vue @@ -7,10 +7,10 @@ collapsible >
-
超级后台
+
保安后台
diff --git a/securityManagement/src/types/views/bgManagement.ts b/securityManagement/src/types/views/bgManagement.ts index 8f6b7fa..8c0b28d 100644 --- a/securityManagement/src/types/views/bgManagement.ts +++ b/securityManagement/src/types/views/bgManagement.ts @@ -10,7 +10,7 @@ export interface BgManagementPagerQueryParams extends BaseTableRowRecord{ /** 是否启用 **/ isEnable?: BaseEnum; /** 审核状态 **/ - checkStatus?: number; + checkStatus?: BaseEnum; /** 账号 **/ account?:string, sex?:BaseEnum, diff --git a/securityManagement/src/types/views/enterprise.ts b/securityManagement/src/types/views/enterprise.ts index e69de29..e8bdb4b 100644 --- a/securityManagement/src/types/views/enterprise.ts +++ b/securityManagement/src/types/views/enterprise.ts @@ -0,0 +1,15 @@ +export interface formDatePort { + name:string, + socialCode:string, + businessLicense:string, + legalPersonInfo:string, + telephone:string, + administrativeDivisionCodes:Record, + address:string, + nature:string +} + +export interface statusPort { + onlyCode:string, + unitOptType:string +} \ No newline at end of file diff --git a/securityManagement/src/views/enterprise.vue b/securityManagement/src/views/enterprise.vue index 8c86b33..2b04a73 100644 --- a/securityManagement/src/views/enterprise.vue +++ b/securityManagement/src/views/enterprise.vue @@ -27,11 +27,11 @@ - + - + @@ -76,42 +76,25 @@ import api from "@/axios"; import {message, Modal} from 'ant-design-vue'; import SingleImageFileUpload from "@/components/upload/SingleImageFileUpload.vue"; import {useRouter} from "vue-router"; +import {formDatePort, statusPort} from "@/types/views/enterprise.ts"; const activeKey = ref('1'); const labelCol = { style: { width: '120px' } }; const wrapperCol = { span: 14 }; const administrativeDivisionTree = ref[]>([]) const formDateRef = ref(); - +const fileUpload = ref() const router = useRouter() - -interface formDatePort { - name:string, - socialCode:string, - businessLicense:string, - legalPersonInfo:string, - telephone:string, - administrativeDivisionCodes:Record, - address:string, - nature:string -} - -interface statusPort { - onlyCode:string, - unitOptType:string -} - const formDate = ref({ name:'', socialCode:'', businessLicense:'', legalPersonInfo:'', telephone:'', - administrativeDivisionCodes:[''], + administrativeDivisionCodes:undefined, address:'', nature:'' }) - const statusDate = ref({ onlyCode:'', unitOptType:'SECURITY_UNIT' @@ -177,7 +160,7 @@ const onFinish = async ()=>{ businessLicense:'', legalPersonInfo:'', telephone:'', - administrativeDivisionCodes:[''], + administrativeDivisionCodes:undefined, address:'', nature:'' } diff --git a/securityManagement/src/views/serviceManagement/index.vue b/securityManagement/src/views/serviceManagement/index.vue index d28a2e0..dd9a46c 100644 --- a/securityManagement/src/views/serviceManagement/index.vue +++ b/securityManagement/src/views/serviceManagement/index.vue @@ -52,7 +52,8 @@ const searchFormOptions: TableProps["searchFormOptions"] = { }, projectManagerMiniProgramUserName:{ type: 'input', - label: '服务经理用户名称' + label: '服务经理用户名称', + }, remark: { type: 'input', @@ -77,6 +78,7 @@ const formParams = ref<{ enterprisesUnitId:string, administrativeDivisionCodes?:null, projectManagerMiniProgramUserId?:string, + projectManagerMiniProgramUserName?:string name: string, type:string, isRecruitSecurity:number, @@ -204,6 +206,7 @@ const columns: TableProps['columns'] = [ idNumberDisabled.value = true } } + formParams.value.projectManagerMiniProgramUserId = record.projectManagerMiniProgramUserName formParams.value.snowFlakeId = record.snowFlakeId formParams.value.name = record.name formParams.value.type = record.type.value @@ -232,6 +235,13 @@ const getAdministrativeDivisionTree = async ()=>{ administrativeDivisionTree.value = resp.data as TreeNodeVo[] } +// 项目经理接口 +const userNameOptions = ref([]) +const projectManagerMiniProgram = async()=>{ + const resp = await api.get('/securityUnit/listProjectManager') + userNameOptions.value = resp.data as any +} + // 企事业单位接口 const enterprisesUnitIdList = ref[]>([]) const enterprisesUnitId = ref('') @@ -244,6 +254,11 @@ const formItemOptions = ref{ const serviceProjectSaveOrUpdateParams = { snowFlakeId: snowFlakeId.value, enterprisesUnitId:UnitId.value, + projectManagerMiniProgramUserId:formParams.value.projectManagerMiniProgramUserId, name: formParams.value.name, type:formParams.value.type, isRecruitSecurity:formParams.value.isRecruitSecurity, @@ -411,6 +427,7 @@ const addServiceProjects = () => { onMounted(async ()=>{ await getAdministrativeDivisionTree() + await projectManagerMiniProgram() }) diff --git a/securityManagement/src/views/userManagement/uniManagement/index.vue b/securityManagement/src/views/userManagement/uniManagement/index.vue index 902efdc..1a1d32e 100644 --- a/securityManagement/src/views/userManagement/uniManagement/index.vue +++ b/securityManagement/src/views/userManagement/uniManagement/index.vue @@ -1,11 +1,235 @@ - \ No newline at end of file + diff --git a/superManagement/package.json b/superManagement/package.json index 08d6e02..09fd832 100644 --- a/superManagement/package.json +++ b/superManagement/package.json @@ -10,6 +10,7 @@ "preview": "vite preview" }, "dependencies": { + "@vueuse/core": "^11.0.3", "ant-design-vue": "^4.2.3", "axios": "^1.7.5", "jsencrypt": "^3.3.2", diff --git a/superManagement/src/config/index.ts b/superManagement/src/config/index.ts index afd0533..b8c0668 100644 --- a/superManagement/src/config/index.ts +++ b/superManagement/src/config/index.ts @@ -3,8 +3,8 @@ import {SystemMenu} from "@/types/config"; export const CLIENT_TYPE = "MANAGEMENT_SUPER"; export const ROUTER_WHITE_LIST: string[] = ['/login', '/test']; export const UNIT_TYPE = { - security: 'SECURITY_UNIT', - police: 'POLICE_UNIT' + security: 'SECURITY_UNIT', //安全 + police: 'POLICE_UNIT' //警察 } export const SYSTEM_MENUS: SystemMenu[] = [ diff --git a/superManagement/src/views/unitManage/policeUnit/index.vue b/superManagement/src/views/unitManage/policeUnit/index.vue index 4c9507c..1f92d39 100644 --- a/superManagement/src/views/unitManage/policeUnit/index.vue +++ b/superManagement/src/views/unitManage/policeUnit/index.vue @@ -92,7 +92,7 @@ const columns: TableProps['columns'] = [ class={record.isEnable.value === 0 ? 'btn-danger' : 'btn-success'} onClick={async () => { const resp = await api.post('/management/disableOrEnable', { - unitId: record.snowFlakeId, + dataId: record.snowFlakeId, unitOptType: UNIT_TYPE.police }) message.success(resp.message) diff --git a/superManagement/src/views/unitManage/securityUnit/index.vue b/superManagement/src/views/unitManage/securityUnit/index.vue index 12ebf4a..a60f479 100644 --- a/superManagement/src/views/unitManage/securityUnit/index.vue +++ b/superManagement/src/views/unitManage/securityUnit/index.vue @@ -103,7 +103,7 @@ const columns: TableProps['columns'] = [ class={record.isEnable.value === 0 ? 'btn-danger' : 'btn-success'} onClick={async () => { const resp = await api.post('/management/disableOrEnable', { - unitId: record.snowFlakeId, + dataId: record.snowFlakeId, unitOptType: UNIT_TYPE.security }) message.success(resp.message)