|
@@ -116,6 +116,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
|
|
private final InformationQueryClient informationQueryClient;
|
|
private final InformationQueryClient informationQueryClient;
|
|
|
private final IWbsTreeContractService wbsTreeContractService;
|
|
private final IWbsTreeContractService wbsTreeContractService;
|
|
|
|
|
+ private final WbsTreeContractExtendService wbsTreeContractExtendService;
|
|
|
private final IFormulaService formulaService;
|
|
private final IFormulaService formulaService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
private JdbcTemplate jdbcTemplate;
|
|
@@ -503,6 +504,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
e.setClassify(example.getClassify());
|
|
e.setClassify(example.getClassify());
|
|
|
e.setProjectId(example.getProjectId());
|
|
e.setProjectId(example.getProjectId());
|
|
|
e.setGroupId(example.getGroupId());
|
|
e.setGroupId(example.getGroupId());
|
|
|
|
|
+ e.setTestGroupId(example.getTestGroupId());
|
|
|
map.forEach((key, value) -> {
|
|
map.forEach((key, value) -> {
|
|
|
if (key.startsWith("key_")) {
|
|
if (key.startsWith("key_")) {
|
|
|
e.getDataMap().put(key, Func.toStr(value));
|
|
e.getDataMap().put(key, Func.toStr(value));
|
|
@@ -516,7 +518,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
tableInfoList.sort(Comparator.comparingInt(a -> tableAllIds.indexOf(Long.parseLong(a.getPkeyId()))));
|
|
tableInfoList.sort(Comparator.comparingInt(a -> tableAllIds.indexOf(Long.parseLong(a.getPkeyId()))));
|
|
|
}
|
|
}
|
|
|
StopWatch stopWatch = new StopWatch();
|
|
StopWatch stopWatch = new StopWatch();
|
|
|
- List<KeyMapper> keyMappers = this.formulaService.getKeyMapperList(tableAll.stream().map(NodeTable::getPKeyId).filter(Func::isNotEmpty).collect(Collectors.toList()), tableInfoList.get(0).getProjectId(), String.valueOf(nodeId), type);
|
|
|
|
|
|
|
+ List<KeyMapper> keyMappers = this.formulaService.getKeyMapperList(tableAll.stream().map(NodeTable::getPKeyId).filter(Func::isNotEmpty).collect(Collectors.toList()), tableInfoList.get(0).getProjectId(), String.valueOf(nodeId), type, tableInfoList.get(0).getTestGroupId());
|
|
|
if (Func.isNotEmpty(keyMappers) && Func.isNotEmpty(tableAll)) {
|
|
if (Func.isNotEmpty(keyMappers) && Func.isNotEmpty(tableAll)) {
|
|
|
Map<String, Map<String, String>> coordinateMap = createCoordinateMap(keyMappers, type);
|
|
Map<String, Map<String, String>> coordinateMap = createCoordinateMap(keyMappers, type);
|
|
|
stopWatch.start("公式处理");
|
|
stopWatch.start("公式处理");
|
|
@@ -1089,13 +1091,35 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
@Override
|
|
@Override
|
|
|
public void gsColor(Long pKeyId, String nodeId, String projectId, Document doc) {
|
|
public void gsColor(Long pKeyId, String nodeId, String projectId, Document doc) {
|
|
|
try {
|
|
try {
|
|
|
- List<KeyMapper> keyMappers = this.formulaService.getKeyMapperList(Collections.singletonList(pKeyId), projectId, nodeId, ExecuteType.INSPECTION);
|
|
|
|
|
|
|
+ List<KeyMapper> keyMappers = this.formulaService.getKeyMapperList(Collections.singletonList(pKeyId), projectId, nodeId, ExecuteType.INSPECTION, "1");
|
|
|
|
|
+ //扩展----根据父节点查询不允许执行的公式
|
|
|
|
|
+ WbsTreeContractExtend byId = wbsTreeContractExtendService.getById(nodeId);
|
|
|
|
|
+ List<String> list;
|
|
|
|
|
+
|
|
|
|
|
+ if(byId != null){
|
|
|
|
|
+ String formulaConfig = byId.getFormulaConfig();
|
|
|
|
|
+ if(StringUtils.isNotEmpty(formulaConfig)){
|
|
|
|
|
+ list = Arrays.asList(formulaConfig.split(","));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ list = new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ list = new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (!keyMappers.isEmpty()) {
|
|
if (!keyMappers.isEmpty()) {
|
|
|
keyMappers.stream()
|
|
keyMappers.stream()
|
|
|
.filter(e -> e.getFormulaId() != null)
|
|
.filter(e -> e.getFormulaId() != null)
|
|
|
.forEach(e -> {
|
|
.forEach(e -> {
|
|
|
String key = e.getField() + "__";
|
|
String key = e.getField() + "__";
|
|
|
- processElements(doc.select("table").first().select("[keyname^=" + key + "]"));
|
|
|
|
|
|
|
+ Elements select = doc.select("table").first().select("[keyname^=" + key + "]");
|
|
|
|
|
+ if(list.contains(e.getTableName() + ":" + e.getField())){
|
|
|
|
|
+ //当前元素不执行公式
|
|
|
|
|
+ select.stream().filter(Objects::nonNull).forEach(element -> element.attr("clearFormula", "1"));
|
|
|
|
|
+ }else{
|
|
|
|
|
+ select.stream().filter(Objects::nonNull).forEach(element -> element.attr("clearFormula", "0"));
|
|
|
|
|
+ processElements(select);
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -1103,6 +1127,21 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void setAutomatic(Long pkeyId, String nodeId, Document doc) {
|
|
|
|
|
+ //自动获取数据查询
|
|
|
|
|
+ try {
|
|
|
|
|
+ Map<String, Object> nodeBaseInfo = nodeBaseInfoService.getAllNodeBaseInfoByPkeyId(pkeyId, Long.valueOf(nodeId));
|
|
|
|
|
+ nodeBaseInfo.keySet().forEach(key -> {
|
|
|
|
|
+ Elements select = doc.select("table").first().select("[keyname=" + key + "]");
|
|
|
|
|
+ select.stream().filter(Objects::nonNull).forEach(element -> element.attr("clearAutomatic", "1"));
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public Element findParentTd(Element element) {
|
|
public Element findParentTd(Element element) {
|
|
|
Element parent = element.parent();
|
|
Element parent = element.parent();
|
|
|
while (parent != null && !parent.tagName().equalsIgnoreCase("td")) {
|
|
while (parent != null && !parent.tagName().equalsIgnoreCase("td")) {
|
|
@@ -1834,6 +1873,15 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ //取消公式执行 的单元格不自动获取html上的数据到表格中
|
|
|
|
|
+ WbsTreeContractExtend byId = wbsTreeContractExtendService.getById(nodeId);
|
|
|
|
|
+ if(byId != null && StringUtils.isNotEmpty(byId.getFormulaConfig())){
|
|
|
|
|
+ List<String> notFormula = Arrays.asList(byId.getFormulaConfig().split(","));
|
|
|
|
|
+ reData.keySet().removeIf(key -> {
|
|
|
|
|
+ String[] keyParts = key.split("__");
|
|
|
|
|
+ return keyParts.length > 1 && notFormula.contains(wbsTreeContract.getInitTableName() + ":" + keyParts[0]);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
//电签默认值
|
|
//电签默认值
|
|
|
if (defText.size() >= 1) {
|
|
if (defText.size() >= 1) {
|
|
@@ -3229,6 +3277,16 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ //取消公式执行 过滤html数据
|
|
|
|
|
+ WbsTreeContractExtend byId = wbsTreeContractExtendService.getById(record.getId());
|
|
|
|
|
+ if(byId != null && StringUtils.isNotEmpty(byId.getFormulaConfig())){
|
|
|
|
|
+ List<String> notFormula = Arrays.asList(byId.getFormulaConfig().split(","));
|
|
|
|
|
+ reData.keySet().removeIf(key -> {
|
|
|
|
|
+ String[] keyParts = key.split("__");
|
|
|
|
|
+ return keyParts.length > 1 && notFormula.contains(wbsTreePrivate.getInitTableName() + ":" + keyParts[0]);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
ProjectInfo projectInfo = jdbcTemplate.query("select project_name from m_project_info where id = " + wbsTreePrivate.getProjectId(), new BeanPropertyRowMapper<>(ProjectInfo.class)).stream().findAny().orElse(null);
|
|
ProjectInfo projectInfo = jdbcTemplate.query("select project_name from m_project_info where id = " + wbsTreePrivate.getProjectId(), new BeanPropertyRowMapper<>(ProjectInfo.class)).stream().findAny().orElse(null);
|
|
|
if (projectInfo != null) {
|
|
if (projectInfo != null) {
|