|
@@ -59,6 +59,7 @@ import org.springblade.manager.enums.ExecuteType;
|
|
|
import org.springblade.manager.formula.FormulaLog;
|
|
|
import org.springblade.manager.formula.KeyMapper;
|
|
|
import org.springblade.manager.formula.NodeTable;
|
|
|
+import org.springblade.manager.formula.impl.ElementConverter;
|
|
|
import org.springblade.manager.formula.impl.TableElementConverter;
|
|
|
import org.springblade.manager.mapper.ExcelTabMapper;
|
|
|
import org.springblade.manager.service.*;
|
|
@@ -396,12 +397,50 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
StopWatch stopWatch = new StopWatch();
|
|
|
FormulaLog log = new FormulaLog();
|
|
|
stopWatch.start("公式处理");
|
|
|
- /*公式*/
|
|
|
JSONObject tableInfo =dataArray.getJSONObject(0);
|
|
|
Long nodeId=tableInfo.getLong("nodeId");
|
|
|
List<TableInfo> tableInfoList = this.getTableInfoList(dataArray);
|
|
|
List<NodeTable> tableAll = createNodeTables(nodeId, tableInfoList.get(0).getContractId(), tableInfoList.get(0).getProjectId(), type);
|
|
|
- Thread.sleep(200);
|
|
|
+ List<KeyMapper> keyMappers = this.formulaService.getKeyMapperList(tableInfoList.stream().map(TableInfo::getPkeyId).filter(Func::isNotEmpty).map(Long::parseLong).collect(Collectors.toList()), tableInfoList.get(0).getProjectId(), String.valueOf(nodeId), type);
|
|
|
+ if (Func.isNotEmpty(keyMappers) && Func.isNotEmpty(tableAll)) {
|
|
|
+ Map<String, Map<String, String>> coordinateMap = createCoordinateMap(keyMappers, type);
|
|
|
+ List<Formula> formulas = this.formulaService.getFormulaList(keyMappers);
|
|
|
+ CurrentNode currentNode = null;
|
|
|
+ Long pKeyId = null;
|
|
|
+ Long contractId = null;
|
|
|
+ Long projectId = null;
|
|
|
+ if (type.equals(ExecuteType.INSPECTION)) {
|
|
|
+ WbsTreeContract wtc = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, nodeId));
|
|
|
+ pKeyId = wtc.getPKeyId();
|
|
|
+ currentNode = createCurrentNode(wtc);
|
|
|
+ contractId = Long.parseLong(wtc.getContractId());
|
|
|
+ projectId = Long.parseLong(wtc.getProjectId());
|
|
|
+ } else if (type.equals(ExecuteType.TESTING)) {
|
|
|
+ WbsTreePrivate wtp = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, nodeId));
|
|
|
+ pKeyId = wtp.getPKeyId();
|
|
|
+ currentNode = createCurrentNode(wtp);
|
|
|
+ projectId = Long.parseLong(wtp.getProjectId());
|
|
|
+ }
|
|
|
+ if (currentNode != null) {
|
|
|
+ ElementConverter tec = new ElementConverter(tableInfoList, keyMappers, formulas, coordinateMap, currentNode, tableAll);
|
|
|
+ tec.setLog(log);
|
|
|
+ tec.setExecuteType(type);
|
|
|
+ tec.setContractId(contractId);
|
|
|
+ tec.setProjectId(projectId);
|
|
|
+ if (tec.isPresent()) {
|
|
|
+ tec.before();
|
|
|
+ this.formulaService.execute(tec);
|
|
|
+ tec.after();
|
|
|
+ } else {
|
|
|
+ tec.getLog().put(FormulaLog.OTHER, "没有执行任何公式");
|
|
|
+ }
|
|
|
+ stopWatch.stop();
|
|
|
+ long totalTime = stopWatch.getTotalTimeMillis();
|
|
|
+ log.put(FormulaLog.PF, "公式执行消耗时间:" + (double)totalTime / 1000 + "秒");
|
|
|
+ StaticLog.info("公式执行用时:{}", totalTime);
|
|
|
+ updateFormulaLog(log.toJsonString(), pKeyId);
|
|
|
+ }
|
|
|
+ }
|
|
|
stopWatch.stop();
|
|
|
long totalTime = stopWatch.getTotalTimeMillis();
|
|
|
log.put(FormulaLog.PF, "公式执行消耗时间:" + (double)totalTime / 1000 + "秒");
|