From 95d37fab45d885d3c626da2af270ae4d2c4141ba Mon Sep 17 00:00:00 2001 From: haha Date: Wed, 21 May 2025 00:47:25 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=8A=B3=E5=8A=A1=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=A4=A7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yanzhu-bigscreen/src/api/index.js | 4 +- yanzhu-bigscreen/src/api/labor.js | 74 ++ yanzhu-bigscreen/src/views/greenCarbon.vue | 2 +- yanzhu-bigscreen/src/views/projectLabor.vue | 662 ++++++++---------- .../mapper/manage/ProProjectInfoMapper.xml | 3 +- .../manage/SurProjectAttendanceDataMapper.xml | 2 +- .../controller/bigscreen/LaborController.java | 2 +- ...roProjectInfoSubdeptsUsersServiceImpl.java | 2 +- .../SurProjectAttendanceUserServiceImpl.java | 2 +- 9 files changed, 395 insertions(+), 358 deletions(-) create mode 100644 yanzhu-bigscreen/src/api/labor.js diff --git a/yanzhu-bigscreen/src/api/index.js b/yanzhu-bigscreen/src/api/index.js index 182e2ef2..e2d5bb40 100644 --- a/yanzhu-bigscreen/src/api/index.js +++ b/yanzhu-bigscreen/src/api/index.js @@ -9,7 +9,8 @@ import safety from "./safety"; import tower from "./tower"; import powerIot from "./powerIot"; import aiWarning from "./aiWarning"; -import planSchedule from './planSchedule'; +import planSchedule from "./planSchedule"; +import labor from "./labor"; export default { http: axios, downFile: download, @@ -24,4 +25,5 @@ export default { powerIot, aiWarning, planSchedule, + labor, }; diff --git a/yanzhu-bigscreen/src/api/labor.js b/yanzhu-bigscreen/src/api/labor.js new file mode 100644 index 00000000..f0f09aad --- /dev/null +++ b/yanzhu-bigscreen/src/api/labor.js @@ -0,0 +1,74 @@ +import request from "@/utils/request"; +/** + * 分组统计人员年龄,省份统计信息 + * @param {*} type + * @param {*} prjId + * @returns + */ +const groupByWorker = (type, prjId) => { + return request({ + url: `/manage/bgscreen/labor/groupByWorker/${type}/${prjId}`, + method: "get", + }); +}; + +/** + * 劳务人员七天出勤趋势 + * @param {*} type + * @param {*} prjId + * @returns + */ +const groupAttendanceLastWeek = (type, prjId) => { + return request({ + url: `/manage/bgscreen/labor/groupAttendanceLastWeek/${type}/${prjId}`, + method: "get", + }); +}; + +/** + * 劳务人员工种占比 + * @param {*} type + * @param {*} prjId + * @returns + */ +const getWorkerCountGroupByType = (type, prjId) => { + return request({ + url: `/manage/bgscreen/labor/getWorkerCountGroupByType/${type}/${prjId}`, + method: "get", + }); +}; + +/** + * 实时考勤进出 + * @param {*} type + * @param {*} prjId + * @returns + */ +const getRealAttendance = (type, prjId) => { + return request({ + url: `/manage/bgscreen/labor/getRealAttendance/${type}/${prjId}`, + method: "get", + }); +}; + +/** + * 考勤预警 + * @param {*} type + * @param {*} prjId + * @returns + */ +const getAttendanceAlert = (type, prjId) => { + return request({ + url: `/manage/bgscreen/labor/getAttendanceAlert/${type}/${prjId}`, + method: "get", + }); +}; + +export default { + groupByWorker, + groupAttendanceLastWeek, + getWorkerCountGroupByType, + groupAttendanceLastWeek, + getRealAttendance, + getAttendanceAlert, +}; diff --git a/yanzhu-bigscreen/src/views/greenCarbon.vue b/yanzhu-bigscreen/src/views/greenCarbon.vue index 3f16b039..f599dede 100644 --- a/yanzhu-bigscreen/src/views/greenCarbon.vue +++ b/yanzhu-bigscreen/src/views/greenCarbon.vue @@ -539,7 +539,7 @@ export default { left: '5%', right: '5%', bottom: '0%', - top: '15%', + top: '5%', containLabel: true, }, tooltip: { diff --git a/yanzhu-bigscreen/src/views/projectLabor.vue b/yanzhu-bigscreen/src/views/projectLabor.vue index fd0ac0c1..5400a617 100644 --- a/yanzhu-bigscreen/src/views/projectLabor.vue +++ b/yanzhu-bigscreen/src/views/projectLabor.vue @@ -2,10 +2,43 @@
- +
+
+
在岗人员
+
今日出勤
+
+ + +
+
+ +
+
+
+
+ {{ attendanceTotal }} 人 +
+

{{ attendanceNav == 0 ? "在岗人员" : "今日出勤" }}

+
+
+ + + +
+
+
+ + + + + - -
@@ -15,7 +48,9 @@ - + + +
@@ -23,13 +58,24 @@ 数字建安施工 + diff --git a/yanzhu-ui-vue3/make.cjs b/yanzhu-ui-vue3/make.cjs new file mode 100644 index 00000000..ea1de21a --- /dev/null +++ b/yanzhu-ui-vue3/make.cjs @@ -0,0 +1,55 @@ +const fs = require("fs"); +const path = require("path"); + +const config = [ + { + name: "app1", + title: "建安施工管理平台", + dirPath: "app1", + }, + { + name: "app2", + title: "数字项管+", + dirPath: "app2", + }, +]; + +config.forEach((item) => { + // 在 dist 目录下创建 app 目录 + const appDirPath = path.join(__dirname, "dist", item.dirPath); + fs.mkdir(appDirPath, { recursive: true }, (err) => { + if (err) { + console.error("创建目录时出错:", err); + return; + } + console.log("目录创建成功或已存在"); + }); + const xdAppPath = path.join(__dirname, "dist", "xd"); + // 源文件路径 + const sourceFilePath = path.join(xdAppPath, "index.html"); + // 目标文件路径 + const targetFilePath = path.join(appDirPath, "index.html"); + + // 读取源文件内容 + fs.readFile(sourceFilePath, "utf8", (err, data) => { + if (err) { + console.error("读取文件时出错:", err); + return; + } + + // 替换文本 + const newData = data + .replace(/数字建安施工/g, item.title) + .replaceAll(`src="./`, `src = "/xd/`) + .replaceAll(`href="./`, `href = "/xd/`); + + // 将替换后的内容写入目标文件 + fs.writeFile(targetFilePath, newData, "utf8", (err) => { + if (err) { + console.error("写入文件时出错:", err); + return; + } + console.log("文件复制并替换成功"); + }); + }); +}); diff --git a/yanzhu-ui-vue3/package.json b/yanzhu-ui-vue3/package.json index 61f56ba6..4c7940a5 100644 --- a/yanzhu-ui-vue3/package.json +++ b/yanzhu-ui-vue3/package.json @@ -8,8 +8,9 @@ "scripts": { "dev": "vite", "dev:prod": "vite --mode production", - "build:prod": "vite build", + "build:prod": "vite build && npm run pkg", "build:stage": "vite build --mode staging", + "pkg":"node make.cjs", "preview": "vite preview" }, "repository": { diff --git a/yanzhu-ui-vue3/src/layout/components/Sidebar/Logo.vue b/yanzhu-ui-vue3/src/layout/components/Sidebar/Logo.vue index 67582d0d..724e5efa 100644 --- a/yanzhu-ui-vue3/src/layout/components/Sidebar/Logo.vue +++ b/yanzhu-ui-vue3/src/layout/components/Sidebar/Logo.vue @@ -1,16 +1,16 @@ \ No newline at end of file diff --git a/yanzhu-ui-vue3/src/settings.js b/yanzhu-ui-vue3/src/settings.js index 10e1db41..b77783e9 100644 --- a/yanzhu-ui-vue3/src/settings.js +++ b/yanzhu-ui-vue3/src/settings.js @@ -2,11 +2,11 @@ export default { /** * 网页标题 */ - title: import.meta.env.VITE_APP_TITLE, + title: window.yanzhuAppTitle, /** * 侧边栏主题 深色主题theme-dark,浅色主题theme-light */ - sideTheme: 'theme-dark', + sideTheme: "theme-dark", /** * 是否系统布局配置 */ @@ -43,5 +43,5 @@ export default { * The default is only used in the production env * If you want to also use it in dev, you can pass ['production', 'development'] */ - errorLog: 'production' -} + errorLog: "production", +}; diff --git a/yanzhu-ui-vue3/src/views/login.vue b/yanzhu-ui-vue3/src/views/login.vue index 80438090..ef9ba0dc 100644 --- a/yanzhu-ui-vue3/src/views/login.vue +++ b/yanzhu-ui-vue3/src/views/login.vue @@ -1,289 +1,294 @@ diff --git a/yanzhu-ui-vue3/vite.config.js b/yanzhu-ui-vue3/vite.config.js index 8ee0ab98..1fc36b09 100644 --- a/yanzhu-ui-vue3/vite.config.js +++ b/yanzhu-ui-vue3/vite.config.js @@ -1,27 +1,27 @@ -import { defineConfig, loadEnv } from 'vite' -import path from 'path' -import createVitePlugins from './vite/plugins' +import { defineConfig, loadEnv } from "vite"; +import path from "path"; +import createVitePlugins from "./vite/plugins"; // https://vitejs.dev/config/ export default defineConfig(({ mode, command }) => { - const env = loadEnv(mode, process.cwd()) - const { VITE_APP_ENV } = env + const env = loadEnv(mode, process.cwd()); + const { VITE_APP_ENV } = env; return { // 部署生产环境和开发环境下的URL。 // 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上 // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。 - base: VITE_APP_ENV === 'production' ? '/xd/' : '/xd/', - plugins: createVitePlugins(env, command === 'build'), + base: VITE_APP_ENV === "production" ? "/xd/" : "/xd/", + plugins: createVitePlugins(env, command === "build"), resolve: { // https://cn.vitejs.dev/config/#resolve-alias alias: { // 设置路径 - '~': path.resolve(__dirname, './'), + "~": path.resolve(__dirname, "./"), // 设置别名 - '@': path.resolve(__dirname, './src') + "@": path.resolve(__dirname, "./src"), }, // https://cn.vitejs.dev/config/#resolve-extensions - extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'] + extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"], }, // vite 相关配置 server: { @@ -30,56 +30,59 @@ export default defineConfig(({ mode, command }) => { open: true, proxy: { "/prod-api": { - //target: "http://localhost:8080", - target: 'http://62.234.3.186', - changeOrigin: true, - pathRewrite: { - "^/prod-api": "/", - }, - }, - // https://cn.vitejs.dev/config/#server-proxy - '/dev-api': { - target: 'http://localhost:8080', + //target: "http://localhost:8080", + target: "http://62.234.3.186", changeOrigin: true, - rewrite: (p) => p.replace(/^\/dev-api/, '') + pathRewrite: { + "^/prod-api": "/", + }, }, - '/statics': { - target: VITE_APP_ENV === 'production'?'http://62.234.3.186':`http://localhost:9300`, + // https://cn.vitejs.dev/config/#server-proxy + "/dev-api": { + target: "http://localhost:8080", + changeOrigin: true, + rewrite: (p) => p.replace(/^\/dev-api/, ""), + }, + "/statics": { + target: + VITE_APP_ENV === "production" + ? "http://62.234.3.186" + : `http://localhost:9300`, //target: 'http://62.234.3.186', changeOrigin: true, pathRewrite: { "^/statics": "/", }, }, - - } + }, }, //fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file css: { postcss: { plugins: [ { - postcssPlugin: 'internal:charset-removal', + postcssPlugin: "internal:charset-removal", AtRule: { charset: (atRule) => { - if (atRule.name === 'charset') { + if (atRule.name === "charset") { atRule.remove(); } - } - } - } - ] - } - }, + }, + }, + }, + ], + }, + }, optimizeDeps: { - include: ['@/lib/vform/designer.umd.js'] //此处路径必须跟main.js中import路径完全一致! - }, - build: { + include: ["@/lib/vform/designer.umd.js"], //此处路径必须跟main.js中import路径完全一致! + }, + build: { + outDir: "dist/xd/", /* 其他build生产打包配置省略 */ //... commonjsOptions: { - include: /node_modules|lib/ //这里记得把lib目录加进来,否则生产打包会报错!! - } - } - } -}) + include: /node_modules|lib/, //这里记得把lib目录加进来,否则生产打包会报错!! + }, + }, + }; +}); From d37d9e49665b198f4e2e684cf41aaa163d5963c7 Mon Sep 17 00:00:00 2001 From: haha Date: Wed, 21 May 2025 23:39:44 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9SQL=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/device/DevTowerProjectConfigMapper.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/device/DevTowerProjectConfigMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/device/DevTowerProjectConfigMapper.xml index e8b4beaf..fd33b28a 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/device/DevTowerProjectConfigMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/device/DevTowerProjectConfigMapper.xml @@ -41,8 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select dtpc.id, dtpc.project_id, dtpc.com_id, - sp.project_name as projectName, - sd.dept_name as com_name, dtpc.dept_id + sp.dept_name as projectName, + sd.dept_name as com_name, dtpc.dept_id, dtpc.device_sn, dtpc.device_name, dtpc.device_source, From 5f4862320434769fee12fd87aeeef3b116600c79 Mon Sep 17 00:00:00 2001 From: haha Date: Fri, 23 May 2025 00:08:04 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=8A=B3=E5=8A=A1=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=A4=A7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/project-overview-chart.vue | 1 + yanzhu-bigscreen/src/views/projectLabor.vue | 247 +++++++++++++++++- .../manage/SurProjectAttendanceDataMapper.xml | 7 +- .../manage/SurProjectAttendanceUserMapper.xml | 27 +- .../controller/ProVideoMonitorController.java | 12 +- 5 files changed, 281 insertions(+), 13 deletions(-) diff --git a/yanzhu-bigscreen/src/components/project-overview-chart.vue b/yanzhu-bigscreen/src/components/project-overview-chart.vue index b87ad353..bb74d17e 100644 --- a/yanzhu-bigscreen/src/components/project-overview-chart.vue +++ b/yanzhu-bigscreen/src/components/project-overview-chart.vue @@ -174,6 +174,7 @@ export default { legend: [ { right: 10, + data: legendData, align: 'left', ...opt, diff --git a/yanzhu-bigscreen/src/views/projectLabor.vue b/yanzhu-bigscreen/src/views/projectLabor.vue index 5400a617..d3ebab36 100644 --- a/yanzhu-bigscreen/src/views/projectLabor.vue +++ b/yanzhu-bigscreen/src/views/projectLabor.vue @@ -44,14 +44,57 @@ - + +
+
{{ item.inOutType==='out'?'出':'进' }}
+ +
{{ item.name }}
+
+ {{ item.workType }} +
+
+ {{item.inOutType==='in'?'进场时间:':'出场时间:'}} {{ item.inoutDate }} +
+
+
- + + + - + +
+ + + + + + + + + + + + + + + +
姓名单位缺勤天数
{{ item.name }}{{ item.companyName }}{{ item.id }}
+
+
@@ -65,6 +108,8 @@ export default { return { dpi: '', chartKey: 0, + chart4Height: 230, + chart2Height: 230, selProject: null, attendanceNav: 0, attendanceTotal: 0, @@ -73,12 +118,74 @@ export default { { text: '特殊工种', value: 0, id: 0 }, { text: '管理人员', value: 0, id: 0 }, ], + legendOpt: {}, + overviewDatas: [], nativeList: [], ageList: [], weekData: [], + workerTotal: 0, + workerGroupList: [], + realList: [], + alertList: [], } }, methods: { + changeChart4(opt) { + if (this.$dpi() == '1K') { + opt.legend[0].left = 200 + return opt + } else if (this.$dpi() == '2K') { + opt.legend[0].left = 360 + return opt + } else { + opt.legend[0].left = 500 + return opt + } + }, + setOpts() { + let is1K = this.$dpi() == '1K' + let is2K = this.$dpi() == '2K' + this.legendOpt = { + icon: 'rect', + orient: 'vertical', + itemWidth: '50%', + left: 240, + right: '10%', + itemWidth: 20, + itemGap: 20, + itemHeight: 20, + type: 'scroll', + pageTextStyle: { + color: '#c3dbfd', + }, + scroll: { + y: is1K ? 300 : is2K ? 500 : 600, + bar: { + show: true, + width: 5, + height: 10, + }, + }, + textStyle: { + padding: [0, 0, 0, 0], + fontSize: is1K ? 10 : is2K ? 14 : 16, + color: '#c3dbfd', + align: 'center', + rich: { + name: { + fontSize: is1K ? 10 : is2K ? 14 : 16, + color: '#c3dbfd', + padding: [5, 2, 5, 2], + }, + percent: { + fontSize: is1K ? 10 : is2K ? 14 : 16, + color: '#4676FD', + padding: [0, 2, 0, 2], + }, + }, + }, + } + }, init() { if (!this.selProject) { return @@ -86,6 +193,55 @@ export default { this.loadAttendanceData() this.getGroupByWorker() this.groupAttendanceLastWeek() + this.getWorkerCountGroupByType() + this.getRealAttendance() + this.getAttendanceAlert() + }, + resize() { + let is1K = this.$dpi() == '1K' + let is2K = this.$dpi() == '2K' + this.chart4Height = is1K ? 230 : is2K ? 360 : 595 + this.chart2Height = is1K ? 567 : is2K ? 800 : 1250 + this.chartKey++ + }, + getAttendanceAlert() { + this.$api.labor.getAttendanceAlert(this.selProject.vendorsCode, this.selProject.id).then((d) => { + this.alertList = d.data.map((it) => { + return it + }) + }) + }, + getRealAttendance() { + this.$api.labor.getRealAttendance(this.selProject.vendorsCode, this.selProject.id).then((d) => { + this.realList = d.data.map((it) => { + it.name = it.workerName + it.workType = it.workTypeName + it.img = it.scanPhoto + if (it.attendanceOutTime) { + it.inOutType = 'out' + it.inoutDate = it.attendanceInTime + } else { + it.inOutType = 'in' + it.inoutDate = it.attendanceTime + } + return it + }) + }) + }, + getWorkerCountGroupByType() { + this.$api.labor.getWorkerCountGroupByType(this.selProject.vendorsCode, this.selProject.id).then((d) => { + let sum = 0 + d.data.forEach((item) => { + sum += item.id ? item.id : 0 + }) + this.workerTotal = sum + this.workerGroupList = d.data.map((item) => { + return { + name: item.workTypeName, + value: item.id ? item.id : 0, + } + }) + }) }, groupAttendanceLastWeek() { this.$api.labor.groupAttendanceLastWeek(this.selProject.vendorsCode, this.selProject.id).then((d) => { @@ -506,12 +662,93 @@ export default { window.addEventListener('resize', () => { if (this.dpi != this.$dpi()) { this.dpi = this.$dpi() - this.chartKey++ + this.resize() } }) + this.setOpts() }, } - \ No newline at end of file diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/SurProjectAttendanceDataMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/SurProjectAttendanceDataMapper.xml index 3a09b7b0..1a51ee06 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/SurProjectAttendanceDataMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/SurProjectAttendanceDataMapper.xml @@ -664,10 +664,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/SurProjectAttendanceUserMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/SurProjectAttendanceUserMapper.xml index 4de009c0..8d5e42e8 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/SurProjectAttendanceUserMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/SurProjectAttendanceUserMapper.xml @@ -817,7 +817,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + select u.*,TIMESTAMPDIFF(Day, att.dt,now()) id + from ( + select su.workerId,su.name,pi.project_name companyName, pdept.sub_dept_name teamName + from ( select 11 cfgid, name,workerId + from yanzhu_jh.sur_project_attendance_user where cfgId=1) su + left join attendance_cfg cfg on su.cfgId=cfg.ID + left join pro_project_info pi on pi.id = cfg.project_id + join pro_project_info_subdepts pdept on cfg.dept_id=pdept.id + + ) u + join + + ( + + select workerId,max(ifnull(attendance_time,attendance_out_time)) dt + from yanzhu_jh.sur_project_attendance_data_2024 + where projectid=644 and is_del!=1 + GROUP BY workerId + order by max(ifnull(attendance_time,attendance_out_time)) + ) att on u.workerId=att.workerId + + LIMIT 10 \ No newline at end of file diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProVideoMonitorController.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProVideoMonitorController.java index 63027dd5..d0781de3 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProVideoMonitorController.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProVideoMonitorController.java @@ -120,12 +120,12 @@ public class ProVideoMonitorController extends BaseController String key="YS_Token__"+ proVideoMonitor.getAppkey()+"_"+proVideoMonitor.getSecret(); JSONObject jo=redisService.getCacheObject(key); String token=""; - if(jo!=null){ - long expireTime= jo.getLong("expireTime"); - if(expireTime> System.currentTimeMillis()+1000*60){ - token=jo.getString("accessToken"); - return AjaxResult.success(token); - } + if (jo != null) { + long expireTime = jo.getLong("expireTime"); + if (expireTime > System.currentTimeMillis() + 1000 * 60) { + token = jo.getString("accessToken"); + return AjaxResult.success(token); + } } String postData="appKey="+proVideoMonitor.getAppkey()+"&appSecret="+proVideoMonitor.getSecret(); String url="https://open.ys7.com/api/lapp/token/get";