增加计划BIM绑定功能

dev_xd
lj7788@126.com 2025-06-25 10:36:08 +08:00
parent 183709ccb7
commit d2975044b7
9 changed files with 298 additions and 104 deletions

View File

@ -455,7 +455,7 @@ export default {
.then((d) => {
this.models = d.rows || [];
if (this.models.length == 0) {
this.$modal.msgError("暂无模型,请先关联模型");
this.$message.error("暂无模型,请先关联模型");
} else {
this.models.forEach((item) => {
this.addModel(item.lightweightName);

View File

@ -762,7 +762,7 @@ export default {
.then((d) => {
this.models = d.rows || [];
if (this.models.length == 0) {
this.$modal.msgError("暂无模型,请先关联模型");
this.$message.error("暂无模型,请先关联模型");
} else {
this.models.forEach((item) => {
this.addModel(item.lightweightName);

View File

@ -166,7 +166,7 @@ export default {
},
startRoaming(data) {
if (!this.modelLoaded) {
this.$message.error("模型未加载完成,请稍后重试");
this.$message.error("暂无模型,请先关联模型");
return;
}
let api = bimRoadmApi;
@ -349,7 +349,7 @@ export default {
.then((d) => {
this.models = d.rows || [];
if (this.models.length == 0) {
this.$modal.msgError("暂无模型,请先关联模型");
this.$modal.error("暂无模型,请先关联模型");
} else {
this.models.forEach((item) => {
this.addModel(item.lightweightName);

View File

@ -81,7 +81,7 @@ public class AttendanceSzjTask {
public String getToken(String secret) {
log.info("开始查询数智建TOKEN...{}",secret);
String key = "attendanceSzjTask.getToken::"+secret;
String token = redisService.getCacheObject(key);
String token = redisService!=null? redisService.getCacheObject(key):"";
if(StringUtils.isNotEmpty(token)){
return token;
}else{
@ -92,7 +92,9 @@ public class AttendanceSzjTask {
JSONObject jsonObject = JSONObject.parseObject(result);
if(jsonObject!=null && jsonObject.getBoolean("success")){
token = jsonObject.getJSONObject("data").getString("token");
if(redisService!=null){
redisService.setCacheObject(key,token,5L,TimeUnit.HOURS);
}
return token;
}
}catch (Exception e){
@ -102,6 +104,40 @@ public class AttendanceSzjTask {
throw new RuntimeException("无效token...");
}
public static void main(String[] args) {
AttendanceSzjTask task = new AttendanceSzjTask();
String secret = "185677eed140468fbb7d4dc47c1b2806";
String token = task.getToken(secret);
task.testEnterpriseQuery(token);
}
public void testEnterpriseQuery(String token){
Map<String, String> headerMap = new HashMap<>();
headerMap.put("token",token);
Map<String, Object> params = new HashMap<>();
try {
String result = HttpUtils.sendJSONPost(SZJ_HOST + "v1/api/enterprise/query", JSON.toJSONString(params), headerMap);
JSONObject jsonObject = JSONObject.parseObject(result);
System.out.println(result);
}catch (Exception e){
}
}
public int updateAttendanceGroup(JSONObject jsonObject) {
int result = 0;
if (jsonObject != null && jsonObject.getBoolean("success")) {
JSONArray jsonArray = jsonObject.getJSONArray("data");
if (jsonArray.size() > 0) {
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject json = jsonArray.getJSONObject(i);
QuartzProSubdepts dept = new QuartzProSubdepts();
}
}
}
return result;
}
/**
*
*/

View File

@ -20,6 +20,8 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import static org.reflections.Reflections.log;
@RestController
@RequestMapping("/uni/callback")
public class UniCallBackController {
@ -41,10 +43,11 @@ public class UniCallBackController {
public AjaxResult recognize(HttpServletRequest request){
String eventCode=request.getParameter("eventCode");
String eventGuid=request.getParameter("eventGuid");
String projectId=request.getParameter("prjId");
String data=request.getParameter("eventMsg");
switch (eventCode){
case "101004"://上报识别记录
return doAddAttendance(eventGuid,data);
return doAddAttendance(eventGuid,data,projectId);
case "100002"://设备上线
return doDeviceOnLine(eventGuid,data);
case "100003"://设备下线
@ -99,7 +102,8 @@ public class UniCallBackController {
* @param data
* @return
*/
private AjaxResult doAddAttendance(String eventGuid,String data){
private AjaxResult doAddAttendance(String eventGuid,String data,String prjId){
log.info("考勤记录同步开始,eventGuid:{},data:{},projectId:{}",eventGuid,data,prjId);
JSONObject json=JSONObject.parseObject(data);
int type=json.getInteger("type");
if(type==1){// 人员比对结果,1:比对成功 2:比对失败

View File

@ -107,4 +107,7 @@ a {
.blue {
color: rgb(30, 144, 255);
}
.icon-blue{
fill:rgb(30, 144, 255) !important;
}
</style>

View File

@ -154,7 +154,6 @@ export default {
enabled: item.show ? 1 : 0,
};
});
console.log("-->", adds, updates);
let ajaxs = [];
if (adds.length > 0) {
ajaxs.push(devicePositionAddItems({ items: adds }));

View File

@ -0,0 +1,131 @@
<template>
<el-dialog v-model="show" append-to-body :close-on-click-modal="false" :close-on-press-escape="false" :title="title" width="960px" modal-class="bim-selection-dialog">
<div id="bimSelectionDlg" :key="elId">
<div id="bimSelectionDlgContainer" class="bimSelectionDlgContainer"></div>
</div>
</el-dialog>
</template>
<script>
import useUserStore from "@/store/modules/user";
export default {
data() {
return {
title: "任务计划绑定BIM",
show: false,
plan: null,
currentPrjId: null,
currentComId: null,
models: [],
viewPoint: null,
};
},
methods: {
showDialog(plan) {
this.plan = plan;
this.show = true;
this.userStore = useUserStore();
this.currentPrjId = this.userStore.currentPrjId;
this.currentComId = this.userStore.currentComId;
this.initEngine();
},
initEngine() {
this.elId++;
this.activeMenu = 0;
setTimeout(() => {
this.loadEngine();
}, 10);
},
loadEngine() {
window.sandSettingApi = new SAPI(
{
serverIP: window.config.serverIP, //ip
port: window.config.port, //HTTP
useHttps: window.config.useHttps, //使Https
container: "bimSelectionDlgContainer", //[]id
secretKey: window.config.secretKey,
openEarth: window.config.openEarth, //[]Gis
bgColor: window.config.bgColor, //[]bim,
tintColor: window.config.tintColor, //[]osgb
sceneTime: window.config.sceneTime, //[]
cadMode: window.config.cadMode, // Cad
},
() => {
this.initSuccess = true;
console.log("初始化成功");
setTimeout(() => {
this.initLoadModel();
}, 10);
let mapOptions = {
imgs: {
//
top: "./img/top.png",
bottom: "./img/under.png",
east: "./img/east.png",
south: "./img/south.png",
west: "./img/west.png",
north: "./img/north.png",
},
offset: {
//
corner: GLENavigationCube.RightTop,
x: 25,
y: 20,
},
cube: {
hoverColor: "#7193dc", //
size: 32, //
hotPointSize: 7, //
cubeTextColor: "#4c4c4ccc", // cube
cubeStrokeColor: "#374769cc", // cube
cubeFillColor: "#374769cc", // cube
},
zoomRatios: 1, //
show: true, //
showAxes: true, // XYZ线
};
sandSettingApi.Plugin.initNavCube(mapOptions);
}
);
},
initLoadModel() {
listBimModel({
pageNum: 1,
pageSize: 10,
comId: this.currentComId,
projectId: this.currentPrjId,
}).then((d) => {
this.models = d.rows || [];
if (this.models.length == 0) {
this.$modal.msgError("暂无模型,请先关联模型");
} else {
this.models.forEach((item) => {
this.addModel(item.lightweightName);
});
}
});
},
addModel(modelId, cb) {
let url = `${window.config.modelUrl}/Tools/output/model/${modelId}/root.glt`;
console.log(modelId, url);
sandSettingApi.Model.add(
url,
modelId,
() => {},
() => {
cb && cb();
console.log("加载模型成功");
setTimeout(()=>{
sandSettingApi.Camera.getViewPort(p=>{
this.viewPoint=p;
this.$message.info("模型加载完成")
});
},1000);
}
);
},
},
};
</script>
<style lang="scss"></style>

View File

@ -2,10 +2,8 @@
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="项目" prop="projectId">
<el-select :disabled="data.projectId" v-model="queryParams.projectId" placeholder="请选择项目" style="width: 192px;" clearable
@change="handleQuery">
<el-option v-for="prj in data.projects" :key="prj.id" :label="prj.projectName" :value="prj.id">
</el-option>
<el-select :disabled="data.projectId" v-model="queryParams.projectId" placeholder="请选择项目" style="width: 192px" clearable @change="handleQuery">
<el-option v-for="prj in data.projects" :key="prj.id" :label="prj.projectName" :value="prj.id"> </el-option>
</el-select>
</el-form-item>
<el-form-item>
@ -28,51 +26,61 @@
v-hasPermi="['manage:plan:remove']">删除</el-button>
</el-col>
-->
<el-col :span="1.5" >
<el-upload ref="uploadRef" :limit="1" accept=".mpp" :headers="upload.headers"
:action="upload.url+'?compId='+data.compId+'&projectId='+queryParams.projectId" :disabled="upload.isUploading"
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="true">
<el-button type="primary" v-loading="upload.isUploading" >导入(Project)</el-button>
<el-col :span="1.5">
<el-upload ref="uploadRef" :limit="1" accept=".mpp" :headers="upload.headers" :action="upload.url + '?compId=' + data.compId + '&projectId=' + queryParams.projectId" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="true">
<el-button type="primary" v-loading="upload.isUploading">(Project)</el-button>
</el-upload>
</el-col>
<el-col :span="1.5" v-if="planList.length>0">
<el-button type="warning" plain icon="Download" @click="handleExport"
v-hasPermi="['manage:plan:export']">导出(Project)</el-button>
<el-col :span="1.5" v-if="planList.length > 0">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['manage:plan:export']">(Project)</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" v-if="1==2"></right-toolbar>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" v-if="1 == 2"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="planList" row-key="taskId" default-expand-all>
<el-table-column label="任务名称" align="left" prop="taskName" />
<el-table-column label="任务工期" align="center" prop="taskDuation" width="120">
<template #default="scope">{{scope.row.taskDuation}}d</template>
<template #default="scope">{{ scope.row.taskDuation }}d</template>
</el-table-column>
<el-table-column label="计划开始时间" align="center" prop="planStartDate" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.planStartDate, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.planStartDate, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column label="计划结束时间" align="center" prop="planFinishDate" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.planFinishDate, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.planFinishDate, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column label="BIM ID" align="center" prop="bimId" width="120"/>
<el-table-column label="负责人" align="center" prop="operator" width="120"/>
<el-table-column label="班组名称" align="center" prop="groupName" width="120"/>
<el-table-column label="BIM ID" align="center" prop="bimId" width="120">
<template #default="scope">
<template v-if="!scope.row.children||scope.row.children.length==0">
<span style="color: red" v-if="scope.row.bimId">BIM</span>
<span v-else style="color: #8e9aaf">未关联BIM</span>
<span style="margin-left: 8px; cursor: pointer">
<el-tooltip append-to="" content="关联BIM模型" placement="top">
<svg-icon icon-class="position" style="cursor: pointer" class="icon-blue" @click="handleBim(scope.row)" />
</el-tooltip>
</span>
</template>
</template>
</el-table-column>
<el-table-column label="负责人" align="center" prop="operator" width="120" />
<el-table-column label="班组名称" align="center" prop="groupName" width="120" />
</el-table>
<bim-selection-dialog ref="bimDlg"></bim-selection-dialog>"
</div>
</template>
<script setup name="Plan">
import { getToken } from "@/utils/auth";
import { listPlan, getPlan, delPlan, addPlan, updatePlan } from "@/api/manage/plan";
import useUserStore from '@/store/modules/user'
import useUserStore from "@/store/modules/user";
import { findMyProjectList } from "@/api/publics";
import bimSelectionDialog from "./bimSelectionDialog.vue";
const { proxy } = getCurrentInstance();
const userStore = useUserStore()
const userStore = useUserStore();
const planList = ref([]);
const open = ref(false);
const loading = ref(true);
@ -82,7 +90,8 @@ const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const uploadRef=ref();
const uploadRef = ref();
const bimDlg = ref();
/*** 用户导入参数 */
const upload = reactive({
//
@ -96,7 +105,7 @@ const upload = reactive({
//
headers: { Authorization: "Bearer " + getToken() },
//
url: import.meta.env.VITE_APP_BASE_API + "/manage/plan/importData"
url: import.meta.env.VITE_APP_BASE_API + "/manage/plan/importData",
});
const data = reactive({
@ -125,19 +134,18 @@ const data = reactive({
groupName: null,
isDel: null,
},
rules: {
},
compId:'',
projectId:'',
rules: {},
compId: "",
projectId: "",
});
const { queryParams, form, rules } = toRefs(data);
function buildTree(all,id){
let tmps=all.filter(d=>d.parentId==id);
if(tmps.length>0){
tmps.forEach(it=>{
it.children=buildTree(all,it.taskId);
function buildTree(all, id) {
let tmps = all.filter((d) => d.parentId == id);
if (tmps.length > 0) {
tmps.forEach((it) => {
it.children = buildTree(all, it.taskId);
});
}
return tmps;
@ -145,23 +153,28 @@ function buildTree(all,id){
/** 查询计划管理列表 */
function getList() {
queryParams.value.projectId=userStore.currentPrjId;
if(!queryParams.value.projectId){
planList.value=[];
queryParams.value.projectId = userStore.currentPrjId;
if (!queryParams.value.projectId) {
planList.value = [];
loading.value = false;
return;
}
loading.value = true;
listPlan(queryParams.value).then(response => {
let tmps= response.data||[];
let objs= buildTree(tmps,0)
planList.value =objs;
listPlan(queryParams.value).then((response) => {
let tmps = response.data || [];
let objs = buildTree(tmps, 0);
planList.value = objs;
loading.value = false;
});
}
function handleBim(row) {
bimDlg.value.showDialog(row);
}
/** 查询项目列表 */
function getProjectList() {
findMyProjectList({ pageNum: 1, pageSize: 100 }).then(response => {
findMyProjectList({ pageNum: 1, pageSize: 100 }).then((response) => {
data.projects = response.rows;
});
}
@ -174,13 +187,13 @@ const handleFileUploadProgress = (event, file, fileList) => {
/** 文件上传成功处理 */
const handleFileSuccess = (response, file, fileList) => {
upload.isUploading = false;
if(response.code==200){
if (response.code == 200) {
proxy.$modal.msgSuccess("导入成功!");
}else{
} else {
proxy.$modal.msgError("导入失败!");
}
if(fileList.length>0){
fileList.splice(0,1)
if (fileList.length > 0) {
fileList.splice(0, 1);
}
};
@ -218,19 +231,19 @@ function reset() {
createTime: null,
updateBy: null,
updateTime: null,
remark: null
remark: null,
};
proxy.resetForm("planRef");
}
/** 搜索按钮操作 */
function handleQuery() {
let prjId=queryParams.value.projectId;
if(prjId){
let tmps=data.projects.filter(d=>d.id==prjId);
data.compId=tmps.length>0?tmps[0].comId||'':''
}else{
data.compId="";
let prjId = queryParams.value.projectId;
if (prjId) {
let tmps = data.projects.filter((d) => d.id == prjId);
data.compId = tmps.length > 0 ? tmps[0].comId || "" : "";
} else {
data.compId = "";
}
queryParams.value.pageNum = 1;
getList();
@ -244,7 +257,7 @@ function resetQuery() {
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
@ -259,8 +272,8 @@ function handleAdd() {
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getPlan(_id).then(response => {
const _id = row.id || ids.value;
getPlan(_id).then((response) => {
form.value = response.data;
open.value = true;
title.value = "修改计划管理";
@ -269,16 +282,16 @@ function handleUpdate(row) {
/** 提交按钮 */
function submitForm() {
proxy.$refs["planRef"].validate(valid => {
proxy.$refs["planRef"].validate((valid) => {
if (valid) {
if (form.value.id != null) {
updatePlan(form.value).then(response => {
updatePlan(form.value).then((response) => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addPlan(form.value).then(response => {
addPlan(form.value).then((response) => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
@ -291,25 +304,33 @@ function submitForm() {
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除计划管理编号为"' + _ids + '"的数据项?').then(function () {
proxy.$modal
.confirm('是否确认删除计划管理编号为"' + _ids + '"的数据项?')
.then(function () {
return delPlan(_ids);
}).then(() => {
})
.then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => { });
})
.catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
let tmps=data.projects.filter(d=>d.id==queryParams.value.projectId);
let name=tmps.length>0?tmps[0].projectName+"_":"";
proxy.download('manage/plan/export', {
...queryParams.value
}, `${name}计划_${new Date().getTime()}.mpp`)
let tmps = data.projects.filter((d) => d.id == queryParams.value.projectId);
let name = tmps.length > 0 ? tmps[0].projectName + "_" : "";
proxy.download(
"manage/plan/export",
{
...queryParams.value,
},
`${name}计划_${new Date().getTime()}.mpp`
);
}
data.projectId=userStore.currentPrjId;
data.compId=userStore.currentComId;
queryParams.value.projectId=data.projectId;
data.projectId = userStore.currentPrjId;
data.compId = userStore.currentComId;
queryParams.value.projectId = data.projectId;
getList();
getProjectList();
</script>