From f33bf970d7c7356882c3e979d3e9e4333b375a88 Mon Sep 17 00:00:00 2001 From: Syliang <1439806354@qq.com> Date: Mon, 8 Jun 2026 10:28:35 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=810608?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/PartCodeController.java | 39 +- .../com/bim/api/entity/PartCodeRelation.java | 3 +- .../api/service/PartCodeRelationService.java | 89 +++- .../bim/api/service/ProgressDataService.java | 183 +++++-- src/main/resources/application-prod.yml | 7 +- 三方接口步骤.md | 484 ++++++++++++++++++ 6 files changed, 722 insertions(+), 83 deletions(-) create mode 100644 三方接口步骤.md diff --git a/src/main/java/com/bim/api/controller/PartCodeController.java b/src/main/java/com/bim/api/controller/PartCodeController.java index 1abb54f..4ae3d63 100644 --- a/src/main/java/com/bim/api/controller/PartCodeController.java +++ b/src/main/java/com/bim/api/controller/PartCodeController.java @@ -38,7 +38,7 @@ public class PartCodeController { public Map getByCodeId(@PathVariable String codeId) { Map result = new HashMap<>(); try { - Map list = service.findByCodeId(codeId); + Map list = service.findByCodeId(codeId); result.put("code", 200); result.put("data", list); } catch (Exception e) { @@ -69,38 +69,28 @@ public class PartCodeController { try { Object partIdsObj = params.get("partIds"); Object codeIdsObj = params.get("codeIds"); - + if (partIdsObj == null || codeIdsObj == null) { result.put("code", 500); result.put("message", "参数不能为空"); return result; } - + List> partInfoList; List> codeInfoList; - + if (partIdsObj instanceof List) { partInfoList = (List>) partIdsObj; } else { partInfoList = List.of((Map) partIdsObj); } - + if (codeIdsObj instanceof List) { codeInfoList = (List>) codeIdsObj; } else { codeInfoList = List.of((Map) codeIdsObj); } - - // 从partInfos中提取id和createDate - String[] partIds = new String[partInfoList.size()]; - String[] createDates = new String[partInfoList.size()]; - for (int i = 0; i < partInfoList.size(); i++) { - Map partInfo = partInfoList.get(i); - partIds[i] = (String) partInfo.get("id"); - createDates[i] = (String) partInfo.get("createDate"); - } - - // 从codeInfos中提取code和data + String[] codeIds = new String[codeInfoList.size()]; String[] codeDatas = new String[codeInfoList.size()]; for (int i = 0; i < codeInfoList.size(); i++) { @@ -109,12 +99,11 @@ public class PartCodeController { Map data = (Map) codeInfo.get("data"); codeDatas[i] = data != null ? data.toString() : ""; } - - List list = service.saveBatchWithData(partIds, codeIds, codeDatas, createDates); + + List list = service.saveBatchWithData(partInfoList, codeIds, codeDatas); result.put("code", 200); result.put("data", list); } catch (Exception e) { - e.printStackTrace(); result.put("code", 500); result.put("message", e.getMessage()); } @@ -131,7 +120,7 @@ public class PartCodeController { if (partIdsObj == null || codeIdsObj == null) { result.put("code", 500); - result.put("message", "鍙傛暟涓嶈兘涓虹┖"); + result.put("message", "参数不能为空"); return result; } @@ -150,14 +139,6 @@ public class PartCodeController { codeInfoList = List.of((Map) codeIdsObj); } - String[] partIds = new String[partInfoList.size()]; - String[] createDates = new String[partInfoList.size()]; - for (int i = 0; i < partInfoList.size(); i++) { - Map partInfo = partInfoList.get(i); - partIds[i] = (String) partInfo.get("id"); - createDates[i] = (String) partInfo.get("createDate"); - } - String[] codeIds = new String[codeInfoList.size()]; String[] codeDatas = new String[codeInfoList.size()]; for (int i = 0; i < codeInfoList.size(); i++) { @@ -167,7 +148,7 @@ public class PartCodeController { codeDatas[i] = data != null ? data.toString() : ""; } - List list = service.deleteBatch(partIds, codeIds, codeDatas, createDates); + List list = service.deleteBatch(partInfoList, codeIds, codeDatas); result.put("code", 200); result.put("data", list); } catch (Exception e) { diff --git a/src/main/java/com/bim/api/entity/PartCodeRelation.java b/src/main/java/com/bim/api/entity/PartCodeRelation.java index 5c8707a..ed2c69a 100644 --- a/src/main/java/com/bim/api/entity/PartCodeRelation.java +++ b/src/main/java/com/bim/api/entity/PartCodeRelation.java @@ -18,6 +18,7 @@ public class PartCodeRelation { private String codeData; private String createDate; + private Boolean isLeaf; private LocalDateTime createTime; -} \ No newline at end of file +} diff --git a/src/main/java/com/bim/api/service/PartCodeRelationService.java b/src/main/java/com/bim/api/service/PartCodeRelationService.java index 852c921..0f374ec 100644 --- a/src/main/java/com/bim/api/service/PartCodeRelationService.java +++ b/src/main/java/com/bim/api/service/PartCodeRelationService.java @@ -12,7 +12,6 @@ import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -183,17 +182,44 @@ public class PartCodeRelationService extends ServiceImpl saveBatchWithData(String[] partIds, String[] codeIds, String[] codeDatas) { - return saveBatchWithData(partIds, codeIds, codeDatas, null); + List> partInfoList = new ArrayList<>(); + for (String partId : partIds) { + Map partInfo = new HashMap<>(); + partInfo.put("id", partId); + partInfoList.add(partInfo); + } + return saveBatchWithData(partInfoList, codeIds, codeDatas); } @Transactional public List saveBatchWithData(String[] partIds, String[] codeIds, String[] codeDatas, String[] createDates) { + List> partInfoList = new ArrayList<>(); + for (int i = 0; i < partIds.length; i++) { + Map partInfo = new HashMap<>(); + partInfo.put("id", partIds[i]); + if (createDates != null && i < createDates.length) { + partInfo.put("createDate", createDates[i]); + } + partInfoList.add(partInfo); + } + return saveBatchWithData(partInfoList, codeIds, codeDatas); + } + + @Transactional + public List saveBatchWithData(List> partInfoList, String[] codeIds, String[] codeDatas) { List result = new ArrayList<>(); + if (partInfoList == null || partInfoList.isEmpty()) { + return result; + } + for (int i = 0; i < codeIds.length; i++) { String codeId = codeIds[i]; String codeData = codeDatas[i]; - for (int j = 0; j < partIds.length; j++) { - String partId = partIds[j]; + for (Map partInfo : partInfoList) { + String partId = safeString(partInfo.get("id")); + if (partId == null || partId.isBlank()) { + continue; + } long cnt = count(new LambdaQueryWrapper() .eq(PartCodeRelation::getPartId, partId) .eq(PartCodeRelation::getCodeId, codeId)); @@ -203,11 +229,13 @@ public class PartCodeRelationService extends ServiceImpl deleteBatch(String[] partIds, String[] codeIds, String[] codeDatas, String[] createDates) { - if (partIds == null || partIds.length == 0) { + public List deleteBatch(List> partInfoList, String[] codeIds, String[] codeDatas) { + if (partInfoList == null || partInfoList.isEmpty()) { + return List.of(); + } + + List partIds = new ArrayList<>(); + for (Map partInfo : partInfoList) { + String partId = safeString(partInfo.get("id")); + if (partId != null && !partId.isBlank()) { + partIds.add(partId); + } + } + if (partIds.isEmpty()) { return List.of(); } remove(new LambdaQueryWrapper() - .in(PartCodeRelation::getPartId, Arrays.asList(partIds))); + .in(PartCodeRelation::getPartId, partIds)); - return saveBatchWithData(partIds, codeIds, codeDatas, createDates); + return saveBatchWithData(partInfoList, codeIds, codeDatas); + } + + private String safeString(Object value) { + if (value == null) { + return null; + } + return String.valueOf(value); + } + + private Boolean parseBooleanValue(Object value) { + if (value == null) { + return null; + } + if (value instanceof Boolean) { + return (Boolean) value; + } + if (value instanceof Number) { + return ((Number) value).intValue() != 0; + } + String text = String.valueOf(value).trim(); + if (text.isEmpty()) { + return null; + } + if ("1".equals(text)) { + return true; + } + if ("0".equals(text)) { + return false; + } + return Boolean.parseBoolean(text); } } diff --git a/src/main/java/com/bim/api/service/ProgressDataService.java b/src/main/java/com/bim/api/service/ProgressDataService.java index 6d43b41..2d04b92 100644 --- a/src/main/java/com/bim/api/service/ProgressDataService.java +++ b/src/main/java/com/bim/api/service/ProgressDataService.java @@ -3,7 +3,9 @@ package com.bim.api.service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.bim.api.entity.ActAmtResponse; import com.bim.api.entity.PartCodeRelation; +import com.bim.api.entity.PjDayListResponse; import com.bim.api.mapper.PartCodeRelationMapper; +import com.bim.api.query.ProjectProgressParams; import com.bim.api.util.ThirdPartyAuthUtil; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -15,6 +17,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.TimeUnit; @Service public class ProgressDataService extends ServiceImpl { @@ -29,6 +32,7 @@ public class ProgressDataService extends ServiceImpl redisTemplate; @@ -45,8 +49,19 @@ public class ProgressDataService extends ServiceImpl buildPjDayRequest(String projectId, String positionIds, String period) { + Map request = new HashMap<>(); + request.put("projectId", projectId); + request.put("positionIds", positionIds); + request.put("period", period); + return request; + } + private void initTask(String date) { - redisTemplate.opsForValue().set(buildTaskKey(date, SUFFIX_STATUS), "STARTED"); - redisTemplate.opsForValue().set(buildTaskKey(date, SUFFIX_TOTAL), 0); - redisTemplate.opsForValue().set(buildTaskKey(date, SUFFIX_CURRENT), 0); - redisTemplate.delete(buildTaskKey(date, SUFFIX_RESULT)); - redisTemplate.delete(buildTaskKey(date, SUFFIX_ERROR)); - redisTemplate.delete(buildTaskKey(date, SUFFIX_RAW_ACT_AMT)); + clearTaskCache(date); + setTaskValue(date, SUFFIX_STATUS, "STARTED"); + setTaskValue(date, SUFFIX_TOTAL, 0); + setTaskValue(date, SUFFIX_CURRENT, 0); } private void calculateProgressAsync(String date) { - redisTemplate.opsForValue().set(buildTaskKey(date, SUFFIX_STATUS), "PROCESSING"); + setTaskValue(date, SUFFIX_STATUS, "PROCESSING"); new Thread(() -> { try { List relations = list(); int total = relations.size(); - redisTemplate.opsForValue().set(buildTaskKey(date, SUFFIX_TOTAL), total); - redisTemplate.opsForValue().set(buildTaskKey(date, SUFFIX_CURRENT), 0); + setTaskValue(date, SUFFIX_TOTAL, total); + setTaskValue(date, SUFFIX_CURRENT, 0); List> results = new ArrayList<>(); List> rawActAmtResults = new ArrayList<>(); @@ -168,6 +194,7 @@ public class ProgressDataService extends ServiceImpl item = new HashMap<>(); item.put("partId", relation.getPartId()); item.put("codeData", relation.getCodeData()); + item.put("isLeaf", relation.getIsLeaf()); try { LocalDateTime createTime = relation.getCreateTime(); @@ -175,34 +202,43 @@ public class ProgressDataService extends ServiceImpl requestParams = new HashMap<>(); - requestParams.put("projectId", PROJECT_ID); - requestParams.put("positionId", positionId); - requestParams.put("period", requestPeriod); + Map requestParams = Boolean.TRUE.equals(relation.getIsLeaf()) + ? buildPjDayRequest(PROJECT_ID, positionId, requestPeriod) + : buildActAmtRequest(PROJECT_ID, positionId, requestPeriod); Map rawEntry = new HashMap<>(); rawEntry.put("partId", positionId); rawEntry.put("period", requestPeriod); rawEntry.put("originalPeriod", originalPeriod); rawEntry.put("request", requestParams); - rawEntry.put("response", actAmtResponse); + rawEntry.put("isLeaf", relation.getIsLeaf()); + + double progressData; + if (Boolean.TRUE.equals(relation.getIsLeaf())) { + ProjectProgressParams params = new ProjectProgressParams(); + params.setProjectId(PROJECT_ID); + params.setPositionIds(positionId); + params.setPeriod(requestPeriod); + + PjDayListResponse pjDayResponse = thirdPartyAuthUtil.findPjDayListByPositionId(params); + rawEntry.put("api", "findPjDayListByPositionId"); + rawEntry.put("response", pjDayResponse); + progressData = calculateAverageByPjDay(pjDayResponse); + } else { + ActAmtResponse actAmtResponse = thirdPartyAuthUtil.findActAmtByPositionId( + PROJECT_ID, + positionId, + requestPeriod + ); + rawEntry.put("api", "findActAmtByPositionId"); + rawEntry.put("response", actAmtResponse); + progressData = calculateAverageByActAmt(actAmtResponse); + } + rawActAmtResults.add(rawEntry); - double progressData = 0; - if (actAmtResponse != null && actAmtResponse.getData() != null && !actAmtResponse.getData().isEmpty()) { - ActAmtResponse.ActAmtData dayData = actAmtResponse.getData().get(0); - Double actAmt = dayData.getActAmt(); - Double meteringAmt = dayData.getMeteringAmt(); - - if (actAmt != null && meteringAmt != null && meteringAmt != 0) { - progressData = actAmt / meteringAmt; - } + if (Double.isNaN(progressData) || Double.isInfinite(progressData)) { + progressData = 0; } item.put("progressData", progressData); } catch (Exception e) { @@ -211,27 +247,94 @@ public class ProgressDataService extends ServiceImpl rawEntry = new HashMap<>(); rawEntry.put("partId", relation.getPartId()); - rawEntry.put("request", buildActAmtRequest(PROJECT_ID, relation.getPartId(), date)); + rawEntry.put("isLeaf", relation.getIsLeaf()); + rawEntry.put("request", Boolean.TRUE.equals(relation.getIsLeaf()) + ? buildPjDayRequest(PROJECT_ID, relation.getPartId(), date) + : buildActAmtRequest(PROJECT_ID, relation.getPartId(), date)); + rawEntry.put("api", Boolean.TRUE.equals(relation.getIsLeaf()) ? "findPjDayListByPositionId" : "findActAmtByPositionId"); rawEntry.put("error", e.getMessage()); rawActAmtResults.add(rawEntry); } results.add(item); current++; - redisTemplate.opsForValue().set(buildTaskKey(date, SUFFIX_CURRENT), current); + setTaskValue(date, SUFFIX_CURRENT, current); } - redisTemplate.opsForValue().set(buildTaskKey(date, SUFFIX_RESULT), results); - redisTemplate.opsForValue().set(buildTaskKey(date, SUFFIX_RAW_ACT_AMT), rawActAmtResults); - redisTemplate.opsForValue().set(buildTaskKey(date, SUFFIX_CURRENT), total); - redisTemplate.opsForValue().set(buildTaskKey(date, SUFFIX_STATUS), "COMPLETED"); + setTaskValue(date, SUFFIX_RESULT, results); + setTaskValue(date, SUFFIX_RAW_ACT_AMT, rawActAmtResults); + setTaskValue(date, SUFFIX_CURRENT, total); + setTaskValue(date, SUFFIX_STATUS, "COMPLETED"); redisTemplate.delete(buildProcessingKey(date)); } catch (Exception e) { - redisTemplate.opsForValue().set(buildTaskKey(date, SUFFIX_STATUS), "FAILED"); - redisTemplate.opsForValue().set(buildTaskKey(date, SUFFIX_ERROR), e.getMessage()); + setTaskValue(date, SUFFIX_STATUS, "FAILED"); + setTaskValue(date, SUFFIX_ERROR, e.getMessage()); redisTemplate.delete(buildProcessingKey(date)); } }).start(); } + + private void setTaskValue(String date, String suffix, Object value) { + redisTemplate.opsForValue().set( + buildTaskKey(date, suffix), + value, + TASK_TTL_MINUTES, + TimeUnit.MINUTES + ); + } + + private void clearTaskCache(String date) { + redisTemplate.delete(buildTaskKey(date, SUFFIX_STATUS)); + redisTemplate.delete(buildTaskKey(date, SUFFIX_TOTAL)); + redisTemplate.delete(buildTaskKey(date, SUFFIX_CURRENT)); + redisTemplate.delete(buildTaskKey(date, SUFFIX_RESULT)); + redisTemplate.delete(buildTaskKey(date, SUFFIX_ERROR)); + redisTemplate.delete(buildTaskKey(date, SUFFIX_RAW_ACT_AMT)); + redisTemplate.delete(buildProcessingKey(date)); + } + + private double calculateAverageByActAmt(ActAmtResponse response) { + if (response == null || response.getData() == null || response.getData().isEmpty()) { + return 0; + } + double sum = 0; + int count = 0; + for (ActAmtResponse.ActAmtData data : response.getData()) { + if (data == null) { + continue; + } + Double numerator = data.getActAmt(); + Double denominator = data.getMeteringAmt(); + double ratio = 0; + if (numerator != null && denominator != null && denominator != 0) { + ratio = numerator / denominator; + } + sum += ratio; + count++; + } + return count == 0 ? 0 : sum / count; + } + + private double calculateAverageByPjDay(PjDayListResponse response) { + if (response == null || response.getData() == null || response.getData().isEmpty()) { + return 0; + } + double sum = 0; + int count = 0; + for (PjDayListResponse.PjDayData data : response.getData()) { + if (data == null) { + continue; + } + Double numerator = data.getTotalAmt(); + Double denominator = data.getMeteringAmt(); + double ratio = 0; + if (numerator != null && denominator != null && denominator != 0) { + ratio = numerator / denominator; + } + sum += ratio; + count++; + } + return count == 0 ? 0 : sum / count; + } } diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index bcb2978..3bf907d 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -1,13 +1,14 @@ spring: datasource: - url: jdbc:mysql://localhost:3306/bim_project?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai - username: root - password: root + url: jdbc:mysql://192.168.1.80:3306/bim_project?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai + username: bim_project + password: 3nGFBMFhhMW4fjeH data: redis: host: localhost port: 6379 database: 0 + password: third-party: api: diff --git a/三方接口步骤.md b/三方接口步骤.md new file mode 100644 index 0000000..776f00c --- /dev/null +++ b/三方接口步骤.md @@ -0,0 +1,484 @@ +主要目的就是为了获取获取最后一步返回的数据,前端直接调用最后一步获取数据接口,然后请求先查看redis有没有换成当前用户的access_token,如果有直接用这个access_token调用最后一步接口获取数据,如果没有就走下面的流程获取access_token并存入redis,后续调用接口获取数据时就可以直接从redis获取access_token了。 +如果没有走分装好的三方登录校验流程,如果有直接请求返回数据。 +首先需要实现三方校验工具类 +第一步先要获取access_token,调用的接口是/oauth2/token,成功返回参数{ +"rtnFlag": "0", +"code": "0", +"rtnMessage": "接口调用成功!", +"msg": "success", +"rtnObj": { +"accessToken": { +"access_token": "d98e65eaca3a4bdab7e5299a81f9a447", +"expires_in": 6000000, +"refresh_token": "ee0c0dfad5f6480abc4265ac9854573c" +} +} +} 需要将这个access_token用redis存起来,下一步获取该access_token下的所有用户,请求路径为/sys/user/getUserIdentityPageData将access_token当做Query参数成功返回结果{ +"rtnFlag": "0", +"code": "0", +"rtnMessage": "接口调用成功!", +"msg": "success", +"rtnObj": { +"total": 1, +"data": [ +{ +"id": "45e9dcf918fd41bf8b03c21f2ae05feb", +"isNewRecord": false, +"createDate": "2026-04-15 16:25:05", +"updateDate": "2026-04-15 16:25:05", +"createById": "1", +"updateById": "1", +"loginName": "pmbim", +"no": "pmbim003", +"name": "施工bim", +"email": "", +"phone": "", +"mobile": "13456553434", +"loginFlag": "true", +"photo": "", +"account": { +"id": "a72dfbc621334c86ba2e3cb0bca39f2c", +"isNewRecord": false, +"loginName": "pmbim", +"acc4aName": "" +}, +"org": { +"id": "12e3c0eb186243869d94e214363ba083", +"isNewRecord": false, +"parentId": "adb0fe6486604dd9bf5ffedcff27ec9c", +"innerCode": "0000100006000040002000006000170000600003", +"orderNo": 0, +"isLeaf": false, +"treeTable": "sys_org", +"textField": "org_name", +"orgCode": "PJ2022041117", +"orgName": "海太长江隧道(公路部分)工程主体施工项目HT-A4标", +"orgType": "项目", +"extParentData": false, +"noUsed": false, +"timeLimit": 0.0, +"contractAmt": 0.0, +"postBudgetAmt": 0.0, +"org4aId": "101479505", +"org4aName": "中交隧道工程局有限公司海太长江隧道(公路部分)工程主体施工项目HT-A4标", +"org4aShortname": "海太项目A4标", +"dataSource": "dataSource00017", +"isCloudUp": "1", +"state": "closed" +}, +"dept": { +"id": "12e3c0eb186243869d94e214363ba083", +"isNewRecord": false, +"parentId": "adb0fe6486604dd9bf5ffedcff27ec9c", +"innerCode": "0000100006000040002000006000170000600003", +"orderNo": 0, +"isLeaf": false, +"treeTable": "sys_org", +"textField": "org_name", +"orgCode": "PJ2022041117", +"orgName": "海太长江隧道(公路部分)工程主体施工项目HT-A4标", +"orgType": "项目", +"extParentData": false, +"noUsed": false, +"timeLimit": 0.0, +"contractAmt": 0.0, +"postBudgetAmt": 0.0, +"org4aId": "101479505", +"org4aName": "中交隧道工程局有限公司海太长江隧道(公路部分)工程主体施工项目HT-A4标", +"org4aShortname": "海太项目A4标", +"state": "closed" +}, +"orgId": "12e3c0eb186243869d94e214363ba083", +"deptId": "12e3c0eb186243869d94e214363ba083", +"orgName": "海太长江隧道(公路部分)工程主体施工项目HT-A4标", +"deptName": "【一公局集团】-【隧道局】-【海太长江隧道(公路部分)工程主体施工项目HT-A4标】", +"accountId": "a72dfbc621334c86ba2e3cb0bca39f2c", +"userId": "45e9dcf918fd41bf8b03c21f2ae05feb", +"userNo": "pmbim003", +"userName": "施工bim", +"wxOpenId": "", +"roleNames": "", +"roleCodes": "", +"admin": false +} +], +"pageSize": 30, +"currentPage": 1 +} +} 接下来先默认将第一个用户id如:"id": "45e9dcf918fd41bf8b03c21f2ae05feb"进行下一步登录接口,登录接口路径为/oauth2/switchLogin +Query 参数 access_token=上一步获取的access_token,userId=上一步获取的用户id +成功返回{ +"rtnFlag": "0", +"code": "0", +"rtnMessage": "接口调用成功!", +"msg": "success", +"rtnObj": { +"principal": { +"id": "45e9dcf918fd41bf8b03c21f2ae05feb", +"loginName": "pmbim", +"name": "施工bim", +"orgId": "12e3c0eb186243869d94e214363ba083", +"deptId": "12e3c0eb186243869d94e214363ba083", +"orgName": "海太长江隧道(公路部分)工程主体施工项目HT-A4标", +"deptName": "海太长江隧道(公路部分)工程主体施工项目HT-A4标", +"accountId": "a72dfbc621334c86ba2e3cb0bca39f2c", +"loginType": "30", +"curUser": { +"id": "45e9dcf918fd41bf8b03c21f2ae05feb", +"isNewRecord": false, +"createDate": "2026-04-15 16:25:05", +"updateDate": "2026-04-15 16:25:05", +"createById": "1", +"updateById": "1", +"loginName": "pmbim", +"no": "pmbim003", +"name": "施工bim", +"email": "", +"phone": "", +"mobile": "13456553434", +"loginFlag": "true", +"photo": "", +"account": { +"id": "a72dfbc621334c86ba2e3cb0bca39f2c", +"isNewRecord": false, +"loginName": "pmbim", +"acc4aName": "" +}, +"org": { +"id": "12e3c0eb186243869d94e214363ba083", +"isNewRecord": false, +"parentId": "adb0fe6486604dd9bf5ffedcff27ec9c", +"innerCode": "0000100006000040002000006000170000600003", +"orderNo": 0, +"isLeaf": false, +"treeTable": "sys_org", +"textField": "org_name", +"orgCode": "PJ2022041117", +"orgName": "海太长江隧道(公路部分)工程主体施工项目HT-A4标", +"orgType": "项目", +"extParentData": false, +"noUsed": false, +"timeLimit": 0.0, +"contractAmt": 0.0, +"postBudgetAmt": 0.0, +"org4aId": "101479505", +"org4aName": "中交隧道工程局有限公司海太长江隧道(公路部分)工程主体施工项目HT-A4标", +"org4aShortname": "海太项目A4标", +"dataSource": "dataSource00017", +"state": "closed" +}, +"dept": { +"id": "12e3c0eb186243869d94e214363ba083", +"isNewRecord": false, +"parentId": "adb0fe6486604dd9bf5ffedcff27ec9c", +"innerCode": "0000100006000040002000006000170000600003", +"orderNo": 0, +"isLeaf": false, +"treeTable": "sys_org", +"textField": "org_name", +"orgCode": "PJ2022041117", +"orgName": "海太长江隧道(公路部分)工程主体施工项目HT-A4标", +"orgType": "项目", +"extParentData": false, +"noUsed": false, +"timeLimit": 0.0, +"contractAmt": 0.0, +"postBudgetAmt": 0.0, +"org4aId": "101479505", +"org4aName": "中交隧道工程局有限公司海太长江隧道(公路部分)工程主体施工项目HT-A4标", +"org4aShortname": "海太项目A4标", +"state": "closed" +}, +"orgId": "12e3c0eb186243869d94e214363ba083", +"deptId": "12e3c0eb186243869d94e214363ba083", +"orgName": "海太长江隧道(公路部分)工程主体施工项目HT-A4标", +"deptName": "海太长江隧道(公路部分)工程主体施工项目HT-A4标", +"accountId": "a72dfbc621334c86ba2e3cb0bca39f2c", +"userId": "45e9dcf918fd41bf8b03c21f2ae05feb", +"userNo": "pmbim003", +"userName": "施工bim", +"wxOpenId": "", +"roleNames": "仅查看权限(项目),所有人权限(项目)", +"roleCodes": "1-1-9-viewOnly,1-1-9-all", +"admin": false +}, +"__sid": "ce92742733dd4c15bda3edc008610422", +"sessionid": "ce92742733dd4c15bda3edc008610422" +}, +"accessToken": { +"access_token": "d98e65eaca3a4bdab7e5299a81f9a447", +"expires_in": 6000000, +"refresh_token": "ee0c0dfad5f6480abc4265ac9854573c" +} +} +}。 +最后一步就是获取WBS接口,路径为/pj/pjPosition/zTreeDataBim 参数为Query参数 参数为access_token=上一步获取的access_token +json参数为projectId=上一步获取的用户所属项目id(如)"orgId": "12e3c0eb186243869d94e214363ba083" 返回如下 +{ +"code": "0", +"msg": "success", +"data": [ +{ +"id": "c65248f0829c4da08ec725bf4ddc0c58", +"isNewRecord": false, +"createDate": "2024-04-07 15:27:19", +"updateDate": "2025-01-16 16:26:42", +"auditStatus": "2", +"auditStatusName": "已锁定", +"createById": "6ffc000001cf4553986f4c4694b2f58e", +"updateById": "e1b35c7e6f98462b8f7b57a225bcbf19", +"parentId": "-1", +"innerCode": "00001", +"orderNo": 1, +"isLeaf": false, +"treeTable": "pm_pj_position", +"busiField": "project_id", +"name": "总则", +"projectId": "12e3c0eb186243869d94e214363ba083", +"fullName": "【总则】", +"startNo": "", +"endNo": "", +"figureNo": "", +"auditDate": "2024-04-07 15:35:08", +"auditBy": "6ffc000001cf4553986f4c4694b2f58e", +"auditByName": "唐智", +"reviewAmt": 194301071, +"reviewNotaxAmt": 178257863.27, +"afterAmt": 194301071, +"afterNotaxAmt": 178257863.27, +"meteringAmt": 194301071, +"meteringNotaxAmt": 178257863.27, +"changeNum": 0, +"sourceId": "12e3c0eb186243869d94e214363ba083", +"staWbsId": "", +"staWbsCode": "", +"state": "closed" +}, +{ +"id": "a03817265daf421b85f7abaf28a60e05", +"isNewRecord": false, +"createDate": "2024-04-07 15:27:38", +"updateDate": "2025-01-16 16:26:42", +"auditStatus": "2", +"auditStatusName": "已锁定", +"createById": "6ffc000001cf4553986f4c4694b2f58e", +"updateById": "e1b35c7e6f98462b8f7b57a225bcbf19", +"parentId": "-1", +"innerCode": "00002", +"orderNo": 2, +"isLeaf": false, +"treeTable": "pm_pj_position", +"busiField": "project_id", +"name": "隧道工程", +"projectId": "12e3c0eb186243869d94e214363ba083", +"fullName": "【隧道工程】", +"startNo": "", +"endNo": "", +"figureNo": "", +"auditDate": "2024-04-07 15:35:08", +"auditBy": "6ffc000001cf4553986f4c4694b2f58e", +"auditByName": "唐智", +"reviewAmt": 3663530017.12, +"reviewNotaxAmt": 3361036665.12, +"afterAmt": 3656111376.35, +"afterNotaxAmt": 3354230524.36, +"meteringAmt": 3651875110.36, +"meteringNotaxAmt": 3350344041.79, +"changeNum": 0, +"sourceId": "12e3c0eb186243869d94e214363ba083", +"staWbsId": "", +"staWbsCode": "", +"state": "closed" +}, +{ +"id": "023ca4ab32a34529aa658ef304b51903", +"isNewRecord": false, +"createDate": "2024-04-07 15:32:13", +"updateDate": "2025-01-16 16:26:42", +"auditStatus": "2", +"auditStatusName": "已锁定", +"createById": "6ffc000001cf4553986f4c4694b2f58e", +"updateById": "e1b35c7e6f98462b8f7b57a225bcbf19", +"parentId": "-1", +"innerCode": "00003", +"orderNo": 3, +"isLeaf": false, +"treeTable": "pm_pj_position", +"busiField": "project_id", +"name": "机电预留预埋", +"projectId": "12e3c0eb186243869d94e214363ba083", +"fullName": "【机电预留预埋】", +"startNo": "", +"endNo": "", +"figureNo": "", +"auditDate": "2024-04-07 15:35:08", +"auditBy": "6ffc000001cf4553986f4c4694b2f58e", +"auditByName": "唐智", +"reviewAmt": 14437594.8, +"reviewNotaxAmt": 13245499.82, +"afterAmt": 14437594.8, +"afterNotaxAmt": 13245499.82, +"meteringAmt": 14437594.8, +"meteringNotaxAmt": 13245499.82, +"changeNum": 0, +"sourceId": "12e3c0eb186243869d94e214363ba083", +"staWbsId": "", +"staWbsCode": "", +"state": "closed" +}, +{ +"id": "055622c1fce24947910583274e2f3647", +"isNewRecord": false, +"createDate": "2024-04-07 15:32:13", +"updateDate": "2025-01-16 16:26:42", +"auditStatus": "2", +"auditStatusName": "已锁定", +"createById": "6ffc000001cf4553986f4c4694b2f58e", +"updateById": "e1b35c7e6f98462b8f7b57a225bcbf19", +"parentId": "-1", +"innerCode": "00004", +"orderNo": 4, +"isLeaf": false, +"treeTable": "pm_pj_position", +"busiField": "project_id", +"name": "暂列金额", +"projectId": "12e3c0eb186243869d94e214363ba083", +"fullName": "【暂列金额】", +"startNo": "", +"endNo": "", +"figureNo": "", +"auditDate": "2024-04-07 15:35:08", +"auditBy": "6ffc000001cf4553986f4c4694b2f58e", +"auditByName": "唐智", +"reviewAmt": 396986606.1, +"reviewNotaxAmt": 364207895.5, +"afterAmt": 396986606.1, +"afterNotaxAmt": 364207895.5, +"meteringAmt": 396986606.1, +"meteringNotaxAmt": 364207895.5, +"changeNum": 0, +"sourceId": "12e3c0eb186243869d94e214363ba083", +"staWbsId": "", +"staWbsCode": "", +"state": "closed" +}, +{ +"id": "c38f082f47af4e2492e472db3b7e7d4b", +"isNewRecord": false, +"createDate": "2024-04-07 15:32:13", +"updateDate": "2025-01-16 16:26:42", +"auditStatus": "2", +"auditStatusName": "已锁定", +"createById": "6ffc000001cf4553986f4c4694b2f58e", +"updateById": "e1b35c7e6f98462b8f7b57a225bcbf19", +"parentId": "-1", +"innerCode": "00005", +"orderNo": 5, +"isLeaf": false, +"treeTable": "pm_pj_position", +"busiField": "project_id", +"name": "DDCI构件采购(暂估价)", +"projectId": "12e3c0eb186243869d94e214363ba083", +"fullName": "【DDCI构件采购(暂估价)】", +"startNo": "", +"endNo": "", +"figureNo": "", +"auditDate": "2024-04-07 15:35:08", +"auditBy": "6ffc000001cf4553986f4c4694b2f58e", +"auditByName": "唐智", +"reviewAmt": 148960000, +"reviewNotaxAmt": 136660550.46, +"afterAmt": 148960000, +"afterNotaxAmt": 136660550.46, +"meteringAmt": 148960000, +"meteringNotaxAmt": 136660550.46, +"changeNum": 0, +"sourceId": "12e3c0eb186243869d94e214363ba083", +"staWbsId": "", +"staWbsCode": "", +"state": "closed" +}, +{ +"id": "b9f55978194b4284bac28378d2c85f8a", +"isNewRecord": false, +"createDate": "2024-04-07 15:32:13", +"updateDate": "2025-01-16 16:26:42", +"auditStatus": "2", +"auditStatusName": "已锁定", +"createById": "6ffc000001cf4553986f4c4694b2f58e", +"updateById": "e1b35c7e6f98462b8f7b57a225bcbf19", +"parentId": "-1", +"innerCode": "00006", +"orderNo": 6, +"isLeaf": false, +"treeTable": "pm_pj_position", +"busiField": "project_id", +"name": "调整金额", +"projectId": "12e3c0eb186243869d94e214363ba083", +"fullName": "【调整金额】", +"startNo": "", +"endNo": "", +"figureNo": "", +"auditDate": "2024-04-07 15:35:08", +"auditBy": "6ffc000001cf4553986f4c4694b2f58e", +"auditByName": "唐智", +"reviewAmt": 3.7, +"reviewNotaxAmt": 3.39, +"afterAmt": 3.7, +"afterNotaxAmt": 3.39, +"meteringAmt": 3.7, +"meteringNotaxAmt": 3.39, +"changeNum": 0, +"sourceId": "12e3c0eb186243869d94e214363ba083", +"staWbsId": "", +"staWbsCode": "", +"state": "closed" +} +], +"trace_id": "280a1c381bb9444b9942fcda0e4e64b8", +"span_id": "1aa20045d48d42b78e03c48c379598c9" +} 这一步也需要返回给前端,前端后续还会走这个接口参数多了一个parentId,每次点击都会进入下一集子节点成功返回 +{ +"code": "0", +"msg": "success", +"data": [ +{ +"id": "0fcdafbcbc1948e795301bbabd993198", +"isNewRecord": false, +"createDate": "2024-04-07 15:32:13", +"updateDate": "2025-01-16 16:26:41", +"auditStatus": "2", +"auditStatusName": "已锁定", +"createById": "6ffc000001cf4553986f4c4694b2f58e", +"updateById": "e1b35c7e6f98462b8f7b57a225bcbf19", +"parentId": "023ca4ab32a34529aa658ef304b51903", +"innerCode": "0000300001", +"orderNo": 1, +"isLeaf": false, +"treeTable": "pm_pj_position", +"busiField": "project_id", +"name": "机电预留预埋", +"projectId": "12e3c0eb186243869d94e214363ba083", +"fullName": "【机电预留预埋】-【机电预留预埋】", +"startNo": "", +"endNo": "", +"figureNo": "", +"auditDate": "2024-04-07 15:35:08", +"auditBy": "6ffc000001cf4553986f4c4694b2f58e", +"auditByName": "唐智", +"reviewAmt": 14437594.8, +"reviewNotaxAmt": 13245499.82, +"afterAmt": 14437594.8, +"afterNotaxAmt": 13245499.82, +"meteringAmt": 14437594.8, +"meteringNotaxAmt": 13245499.82, +"changeNum": 0, +"sourceId": "12e3c0eb186243869d94e214363ba083", +"staWbsId": "", +"staWbsCode": "", +"state": "closed" +} +], +"trace_id": "45486ce7de43465f8fcb6b9979b9d3b4", +"span_id": "03602b57b0d04d96aa587773416a479c" +} \ No newline at end of file