This commit is contained in:
2026-06-08 10:28:35 +08:00
parent cb180a8771
commit f33bf970d7
6 changed files with 722 additions and 83 deletions

View File

@@ -91,16 +91,6 @@ public class PartCodeController {
codeInfoList = List.of((Map<String, Object>) 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<String, Object> 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++) {
@@ -110,11 +100,10 @@ public class PartCodeController {
codeDatas[i] = data != null ? data.toString() : "";
}
List<PartCodeRelation> list = service.saveBatchWithData(partIds, codeIds, codeDatas, createDates);
List<PartCodeRelation> 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<String, Object>) codeIdsObj);
}
String[] partIds = new String[partInfoList.size()];
String[] createDates = new String[partInfoList.size()];
for (int i = 0; i < partInfoList.size(); i++) {
Map<String, Object> 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<PartCodeRelation> list = service.deleteBatch(partIds, codeIds, codeDatas, createDates);
List<PartCodeRelation> list = service.deleteBatch(partInfoList, codeIds, codeDatas);
result.put("code", 200);
result.put("data", list);
} catch (Exception e) {

View File

@@ -18,6 +18,7 @@ public class PartCodeRelation {
private String codeData;
private String createDate;
private Boolean isLeaf;
private LocalDateTime createTime;
}

View File

@@ -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<PartCodeRelationMapper,
@Transactional
public List<PartCodeRelation> saveBatchWithData(String[] partIds, String[] codeIds, String[] codeDatas) {
return saveBatchWithData(partIds, codeIds, codeDatas, null);
List<Map<String, Object>> partInfoList = new ArrayList<>();
for (String partId : partIds) {
Map<String, Object> partInfo = new HashMap<>();
partInfo.put("id", partId);
partInfoList.add(partInfo);
}
return saveBatchWithData(partInfoList, codeIds, codeDatas);
}
@Transactional
public List<PartCodeRelation> saveBatchWithData(String[] partIds, String[] codeIds, String[] codeDatas, String[] createDates) {
List<Map<String, Object>> partInfoList = new ArrayList<>();
for (int i = 0; i < partIds.length; i++) {
Map<String, Object> 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<PartCodeRelation> saveBatchWithData(List<Map<String, Object>> partInfoList, String[] codeIds, String[] codeDatas) {
List<PartCodeRelation> 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<String, Object> partInfo : partInfoList) {
String partId = safeString(partInfo.get("id"));
if (partId == null || partId.isBlank()) {
continue;
}
long cnt = count(new LambdaQueryWrapper<PartCodeRelation>()
.eq(PartCodeRelation::getPartId, partId)
.eq(PartCodeRelation::getCodeId, codeId));
@@ -203,11 +229,13 @@ public class PartCodeRelationService extends ServiceImpl<PartCodeRelationMapper,
relation.setCodeId(codeId);
relation.setCodeData(codeData);
relation.setCreateTime(LocalDateTime.now());
if (createDates != null && createDates[j] != null && !createDates[j].isEmpty()) {
relation.setCreateDate(createDates[j].replaceAll("^(\\d{4}-\\d{2}-\\d{2}).*", "$1"));
String createDate = safeString(partInfo.get("createDate"));
if (createDate != null && !createDate.isEmpty()) {
relation.setCreateDate(createDate.replaceAll("^(\\d{4}-\\d{2}-\\d{2}).*", "$1"));
} else {
relation.setCreateDate("");
}
relation.setIsLeaf(parseBooleanValue(partInfo.get("isLeaf")));
save(relation);
result.add(relation);
}
@@ -217,14 +245,55 @@ public class PartCodeRelationService extends ServiceImpl<PartCodeRelationMapper,
}
@Transactional
public List<PartCodeRelation> deleteBatch(String[] partIds, String[] codeIds, String[] codeDatas, String[] createDates) {
if (partIds == null || partIds.length == 0) {
public List<PartCodeRelation> deleteBatch(List<Map<String, Object>> partInfoList, String[] codeIds, String[] codeDatas) {
if (partInfoList == null || partInfoList.isEmpty()) {
return List.of();
}
List<String> partIds = new ArrayList<>();
for (Map<String, Object> 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<PartCodeRelation>()
.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);
}
}

View File

@@ -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<PartCodeRelationMapper, PartCodeRelation> {
@@ -29,6 +32,7 @@ public class ProgressDataService extends ServiceImpl<PartCodeRelationMapper, Par
private static final String SUFFIX_RESULT = ":result";
private static final String SUFFIX_ERROR = ":error";
private static final String SUFFIX_RAW_ACT_AMT = ":rawActAmt";
private static final long TASK_TTL_MINUTES = 10;
private final ThirdPartyAuthUtil thirdPartyAuthUtil;
private final RedisTemplate<String, Object> redisTemplate;
@@ -45,9 +49,20 @@ public class ProgressDataService extends ServiceImpl<PartCodeRelationMapper, Par
String status = getTaskStatusByDate(normalizedDate);
if ("COMPLETED".equals(status)) {
Object cachedData = redisTemplate.opsForValue().get(buildTaskKey(normalizedDate, SUFFIX_RESULT));
if (cachedData != null) {
Integer cachedTotal = (Integer) redisTemplate.opsForValue().get(buildTaskKey(normalizedDate, SUFFIX_TOTAL));
int dbTotal = list().size();
if (cachedTotal != null && cachedTotal == dbTotal) {
result.put("status", "COMPLETED");
return result;
}
clearTaskCache(normalizedDate);
} else {
result.put("status", "COMPLETED");
return result;
}
}
String processing = (String) redisTemplate.opsForValue().get(buildProcessingKey(normalizedDate));
if (processing != null) {
@@ -55,7 +70,12 @@ public class ProgressDataService extends ServiceImpl<PartCodeRelationMapper, Par
return result;
}
Boolean lockResult = redisTemplate.opsForValue().setIfAbsent(buildProcessingKey(normalizedDate), "1");
Boolean lockResult = redisTemplate.opsForValue().setIfAbsent(
buildProcessingKey(normalizedDate),
"1",
TASK_TTL_MINUTES,
TimeUnit.MINUTES
);
if (!Boolean.TRUE.equals(lockResult)) {
result.put("status", "PROCESSING");
return result;
@@ -140,25 +160,31 @@ public class ProgressDataService extends ServiceImpl<PartCodeRelationMapper, Par
return request;
}
private Map<String, Object> buildPjDayRequest(String projectId, String positionIds, String period) {
Map<String, Object> 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<PartCodeRelation> 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<Map<String, Object>> results = new ArrayList<>();
List<Map<String, Object>> rawActAmtResults = new ArrayList<>();
@@ -168,6 +194,7 @@ public class ProgressDataService extends ServiceImpl<PartCodeRelationMapper, Par
Map<String, Object> 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<PartCodeRelationMapper, Par
String positionId = relation.getPartId();
String requestPeriod = date;
ActAmtResponse actAmtResponse = thirdPartyAuthUtil.findActAmtByPositionId(
PROJECT_ID,
positionId,
requestPeriod
);
Map<String, Object> requestParams = new HashMap<>();
requestParams.put("projectId", PROJECT_ID);
requestParams.put("positionId", positionId);
requestParams.put("period", requestPeriod);
Map<String, Object> requestParams = Boolean.TRUE.equals(relation.getIsLeaf())
? buildPjDayRequest(PROJECT_ID, positionId, requestPeriod)
: buildActAmtRequest(PROJECT_ID, positionId, requestPeriod);
Map<String, Object> rawEntry = new HashMap<>();
rawEntry.put("partId", positionId);
rawEntry.put("period", requestPeriod);
rawEntry.put("originalPeriod", originalPeriod);
rawEntry.put("request", requestParams);
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<PartCodeRelationMapper, Par
Map<String, Object> 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;
}
}

View File

@@ -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:

484
三方接口步骤.md Normal file
View File

@@ -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_tokenuserId=上一步获取的用户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"
}