|
@@ -46,7 +46,6 @@ import javax.validation.constraints.NotNull;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.FileNotFoundException;
|
|
|
-import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
@@ -850,11 +849,11 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
try {
|
|
|
/*检验单附表处理*/
|
|
|
List<FormData> inspectionList = new ArrayList<>();
|
|
|
- /*0检验表1评定表*/
|
|
|
+ /*1检验表5评定表*/
|
|
|
this.tec.getTableAll().stream().filter(e -> e.getTableType().equals(1) ||e.getTableType().equals(5)).forEach(e -> {
|
|
|
- /*获取所有挂在表里的元素映射关系*/
|
|
|
+ /*获取所有挂在检验单、评定表里的元素映射关系*/
|
|
|
this.tec.getKeyMappers().stream().filter(p -> p.getPkId().equals(e.getPKeyId())).forEach(k -> {
|
|
|
- /*元素长度筛选超页的元素*/
|
|
|
+ /*筛选元素长度超1页的元素*/
|
|
|
List<FormData> target = tec.formDataMap.values().stream().filter(f -> f.getCode().equals(k.getCode()) && f.getAddPages() > 0).collect(Collectors.toList());
|
|
|
if (Func.isNotEmpty(target)) {
|
|
|
inspectionList.addAll(target);
|
|
@@ -874,8 +873,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
NodeTable one = this.tec.getTableAll().get(0);
|
|
|
WbsTreeContract wtc = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getParentId, one.getParentId()).eq(WbsTreeContract::getContractId,tec.getContractId()).eq(WbsTreeContract::getWbsId, one.getWbsId()).and(e->e.eq(WbsTreeContract::getNodeName, pd?"质量检验评定表(附表)":"质量检验表(附表)").or().eq(WbsTreeContract::getFullName, pd?"质量检验评定表(附表)":"质量检验表(附表)")));
|
|
|
if (wtc != null) {
|
|
|
- /*附表的顺序在检验单或者评定表之后*/
|
|
|
- int sort=this.tec.getTableAll().stream().filter(e ->e.getTableType().equals(1) || e.getTableType().equals(5)).map(NodeTable::getSort).max(Integer::compareTo).orElse(30);
|
|
|
+ /*附表的顺序在检验单或者评定表之后,默认最后*/
|
|
|
+ int sort=this.tec.getTableAll().stream().filter(e ->e.getTableType().equals(1) || e.getTableType().equals(5)).map(NodeTable::getSort).max(Integer::compareTo).orElse(1000);
|
|
|
this.wbsTreeContractService.update(Wrappers.<WbsTreeContract>lambdaUpdate()
|
|
|
.set(WbsTreeContract::getSort,sort).set(WbsTreeContract::getContractType,-1).set(WbsTreeContract::getAncestors,one.getAncestors())
|
|
|
.set(WbsTreeContract::getIsCopeTab,2)
|
|
@@ -893,7 +892,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
JSONArray dataArray = new JSONArray();
|
|
|
for (NodeTable data : subTabList) {
|
|
|
/*自动挂载附表情况下,装配TableInfo数据*/
|
|
|
- R bussDataInfo = this.getBussDataInfo(data.getPKeyId(), 1);
|
|
|
+ R bussDataInfo = this.excelTabService.getBussDataInfo(data.getPKeyId(), 1);
|
|
|
@SuppressWarnings("unchecked")
|
|
|
Map<String, Object> data1 = (Map<String, Object>) bussDataInfo.getData();
|
|
|
data1.put("pkeyId",data.getPKeyId());
|
|
@@ -911,7 +910,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
});
|
|
|
tec.getTableInfoList().addAll(subTableInfo);
|
|
|
/*获取附表元素定位集*/
|
|
|
- tec.getCoordinateMap().put(subTabList.get(0).getInitTableName(), FormulaUtils.getElementCell(first.getHtmlUrl()));
|
|
|
+ /*tec.getCoordinateMap().put(subTabList.get(0).getInitTableName(), FormulaUtils.getElementCell(first.getHtmlUrl()));*/
|
|
|
+ tec.getCoordinateMap().computeIfAbsent(subTabList.get(0).getInitTableName(),k->FormulaUtils.getElementCell(first.getHtmlUrl()));
|
|
|
/*附表元素关键信息*/
|
|
|
List<Map<String, Object>> elementMaps = this.jdbcTemplate.queryForList("select b.e_name ename , CONCAT(a.tab_en_name,':',b.e_key) code , b.e_key ekey ,b.id fieldId,a.tab_en_name tableName from m_table_info a join m_wbs_form_element b on a.id = b.f_id where a.tab_en_name='" + first.getInitTableName() + "' and b.is_deleted=0 ");
|
|
|
if (Func.isNotEmpty(elementMaps)) {
|
|
@@ -950,6 +950,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
/*根据行号排序*/
|
|
|
inspectionList.sort(Comparator.comparingInt(e->e.getCoordsList().get(0).getY()));
|
|
|
inspectionList.forEach(f -> {
|
|
|
+ /*检验单、评定表不能超过一页,多余的需要删除并把检测项数据写人附表*/
|
|
|
/*检验单或者评定表存的超页数据汇总到附表对象*/
|
|
|
List<ElementData> overList = f.getValues().stream().skip(f.getCoordsList().size()).collect(Collectors.toList());
|
|
|
f.setValues(f.getValues().stream().limit(f.getCoordsList().size()).collect(Collectors.toList()));
|
|
@@ -967,6 +968,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
/*把附表数据刷入对应的附表元素对象*/
|
|
|
sta.flush();
|
|
|
}
|
|
|
+ /*把主表的表头表尾信息拷贝*/
|
|
|
String mainTableName = this.tec.getTableAll().stream().filter(e -> e.getTableType().equals(1) || e.getTableType().equals(5)).map(NodeTable::getInitTableName).findFirst().orElse("");
|
|
|
if(Func.isNotBlank(mainTableName)){
|
|
|
List<FormData> sourceFds=tec.getFormDataMap().values().stream().filter(s->!s.empty()).filter(s->StringUtils.isEquals(s.getTableName(),mainTableName)).collect(Collectors.toList());
|
|
@@ -1845,231 +1847,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
return new HashMap<>();
|
|
|
}
|
|
|
|
|
|
- public R getBussDataInfo(Long pkeyId, int type) {
|
|
|
|
|
|
- Map<String, Object> reData = new HashMap<>();
|
|
|
-
|
|
|
- WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
- .eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
|
- if (wbsTreeContract == null) {
|
|
|
- return R.data(reData);
|
|
|
- }
|
|
|
-
|
|
|
- if (wbsTreeContract.getHtmlUrl() == null) {
|
|
|
- return R.data(reData);
|
|
|
- }
|
|
|
-
|
|
|
- //表单是否存储在
|
|
|
- String tabName = wbsTreeContract.getInitTableName();
|
|
|
- String isExitSql = " select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
|
|
|
- List<Map<String, Object>> tabList = jdbcTemplate.queryForList(isExitSql);
|
|
|
- if (tabList.size() <= 0) {
|
|
|
- return R.fail("无实体表对应");
|
|
|
- }
|
|
|
-
|
|
|
- String querySql = "select * from " + wbsTreeContract.getInitTableName() + " where p_key_id=" + pkeyId;
|
|
|
- List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
|
|
|
-
|
|
|
- // 匹配关联
|
|
|
- try {
|
|
|
- File file1 = ResourceUtil.getFile(wbsTreeContract.getHtmlUrl());
|
|
|
- if (file1.exists()) {
|
|
|
-
|
|
|
- String htmlString = IoUtil.readToString(new FileInputStream(file1));
|
|
|
- Document doc = Jsoup.parse(htmlString);
|
|
|
-
|
|
|
- // 解析
|
|
|
- // 模糊匹配
|
|
|
- Elements dwtitle = doc.select("el-input[placeholder~=.*承包单位]");
|
|
|
- Elements sgtitle = doc.select("el-input[placeholder~=^施工单位]");
|
|
|
- Elements sgtitle1 = doc.select("el-input[placeholder=安装单位]");
|
|
|
- sgtitle.addAll(sgtitle1);
|
|
|
-
|
|
|
- Elements htdtitle = doc.select("el-input[placeholder~=.*合同段.*]");
|
|
|
- Elements htdtitle1 = doc.select("el-input[placeholder~=合同名称.*]");
|
|
|
- htdtitle.addAll(htdtitle1);
|
|
|
-
|
|
|
- Elements jltitle = doc.select("el-input[placeholder~=监理单位.*]");
|
|
|
-
|
|
|
- Elements bhtitle = doc.select("el-input[placeholder~=^编号]");
|
|
|
- Elements bhtitle1 = doc.select("el-input[placeholder~=合同编号.*]");
|
|
|
- bhtitle.addAll(bhtitle1);
|
|
|
-
|
|
|
-
|
|
|
- Elements xmtitle = doc.select("el-input[placeholder~=^项目名称]");
|
|
|
-
|
|
|
-
|
|
|
- // Elements title = doc.select("el-input[placeholder~=^编号]");
|
|
|
-
|
|
|
- /**
|
|
|
- * 承包单位 承包单位、施工单位:引用施工单位名称 ,
|
|
|
- * 监理单位:引用监理单位名称
|
|
|
- * 合同段、所属建设项目(合同段):引用合同段编号
|
|
|
- *
|
|
|
- * 施工单位:施工单位 和 安装单位
|
|
|
- *
|
|
|
- */
|
|
|
- ContractInfo contractInfo = contractInfoService.getById(wbsTreeContract.getContractId());
|
|
|
- // 施工单位名称
|
|
|
- if (dwtitle.size() >= 1) {
|
|
|
- int y = Integer.parseInt(dwtitle.attr("trindex"));
|
|
|
- if (y <= 10) {
|
|
|
- reData.put(dwtitle.attr("keyName"), contractInfo.getConstructionUnitName());
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- if (sgtitle.size() >= 1) {
|
|
|
- int y = Integer.parseInt(sgtitle.attr("trindex"));
|
|
|
- if (y <= 10) {
|
|
|
- reData.put(sgtitle.attr("keyName"), contractInfo.getConstructionUnitName());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 合同段名称
|
|
|
- if (htdtitle.size() >= 1) {
|
|
|
- for (Element element : htdtitle) {
|
|
|
- int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
- if (trindex <= 8) {
|
|
|
- reData.put(element.attr("keyName"), contractInfo.getContractNumber());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // 监理单位名称
|
|
|
- if (jltitle.size() >= 1) {
|
|
|
-
|
|
|
- for (Element element : jltitle) {
|
|
|
- int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
- if (trindex <= 10) {
|
|
|
- reData.put(element.attr("keyName"), contractInfo.getSupervisionUnitName());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //获取父节点划分编号
|
|
|
- WbsTreeContract node = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
- .eq(WbsTreeContract::getId, wbsTreeContract.getParentId())
|
|
|
- .eq(WbsTreeContract::getContractId, wbsTreeContract.getContractId()));
|
|
|
- // 编号
|
|
|
- if (bhtitle.size() >= 1 && contractInfo.getIsReferenceNumber() == 1) {
|
|
|
- for (Element element : bhtitle) {
|
|
|
- int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
- if (trindex <= 10) {
|
|
|
- reData.put(element.attr("keyName"), node.getPartitionCode() == null ? "" : node.getPartitionCode());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 项目名称
|
|
|
- if (xmtitle.size() >= 1) {
|
|
|
- for (Element element : xmtitle) {
|
|
|
- int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
- if (trindex <= 6) {
|
|
|
- ProjectInfo projectInfo = projectInfoService.getById(wbsTreeContract.getProjectId());
|
|
|
- reData.put(element.attr("keyName"), projectInfo.getProjectName());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (FileNotFoundException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
- if (dataIn.size() >= 1) {
|
|
|
- Map<String, Object> mysqlData = dataIn.get(0);
|
|
|
- for (String key : mysqlData.keySet()) {
|
|
|
- String tabVal = mysqlData.get(key) + "";
|
|
|
- // 时间段处理
|
|
|
- if (org.apache.commons.lang.StringUtils.isNotEmpty(tabVal) && tabVal.indexOf("null") < 0) {
|
|
|
- if (tabVal.contains("T") && tabVal.contains(".000Z]")) {
|
|
|
- String[] tabData = tabVal.split("_\\^_");
|
|
|
-
|
|
|
- if (reData.containsKey("pickerKey")) {
|
|
|
- String pickerKey = reData.get("pickerKey") + "," + key + "__" + tabData[1];
|
|
|
- reData.put("pickerKey", pickerKey);
|
|
|
- } else {
|
|
|
- reData.put("pickerKey", key + "__" + tabData[1]);
|
|
|
- }
|
|
|
-
|
|
|
- String sql = tabData[0];
|
|
|
- sql = sql.replaceAll("\\[", "['");
|
|
|
- sql = sql.replaceAll("]", "']");
|
|
|
- sql = sql.replaceAll("000Z,", "000Z',");
|
|
|
- sql = sql.replaceAll(", 20", ", '20");
|
|
|
- // sql = sql.replaceAll("'", "");
|
|
|
- if (org.apache.commons.lang.StringUtils.isNotEmpty(tabData[0])) {
|
|
|
- reData.put(key + "__" + tabData[1], sql);
|
|
|
- }
|
|
|
- } else if (tabVal.contains("T") && tabVal.contains(".000Z")) { //时间
|
|
|
- // 时间和字符串合作
|
|
|
- if (tabVal.contains("☆")) {
|
|
|
- String[] mysql = tabVal.split("☆");
|
|
|
- for (String data : mysql) {
|
|
|
- String[] tabData = data.split("_\\^_");
|
|
|
- if (org.apache.commons.lang.StringUtils.isNotEmpty(tabData[0])) {
|
|
|
- reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- String[] tabData = tabVal.split("_\\^_");
|
|
|
- if (org.apache.commons.lang.StringUtils.isNotEmpty(tabData[0])) {
|
|
|
- reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (tabVal.contains("☆")) {
|
|
|
- String[] mysql = tabVal.split("☆");
|
|
|
- for (String data : mysql) {
|
|
|
- String[] tabData = data.split("_\\^_");
|
|
|
- if (org.apache.commons.lang.StringUtils.isNotEmpty(tabData[0])) {
|
|
|
- reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (tabVal.contains("_^_")) {
|
|
|
- String[] tabData = tabVal.split("_\\^_");
|
|
|
- if (org.apache.commons.lang.StringUtils.isNotEmpty(tabData[0])) {
|
|
|
- if (tabVal.contains("[") && tabVal.contains("年")) {
|
|
|
- String[] strings = org.apache.commons.lang.StringUtils.strip(tabData[0], "[]").split(",");
|
|
|
-
|
|
|
- reData.put(key + "__" + tabData[1], strings);
|
|
|
- } else {
|
|
|
- reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- reData.put(key, tabVal);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 获取默认值
|
|
|
- QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("type", 4);
|
|
|
- queryWrapper.eq("tab_id", wbsTreeContract.getIsTypePrivatePid());
|
|
|
- final List<TextdictInfo> textdictInfos = textDictInfoService.getBaseMapper().selectList(queryWrapper);
|
|
|
- if (!textdictInfos.isEmpty()) {
|
|
|
- for (TextdictInfo textdictInfo : textdictInfos) {
|
|
|
- if (reData.containsKey(textdictInfo.getColKey())) {
|
|
|
- String keyVal = reData.get(textdictInfo.getColKey()) + "";
|
|
|
- } else {
|
|
|
- reData.put(textdictInfo.getColKey() + "", textdictInfo.getSigRoleName());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 移除Id 和 p_key_id
|
|
|
- if (type == 0) {
|
|
|
- reData.remove("id");
|
|
|
- reData.remove("p_key_id");
|
|
|
- reData.remove("classify");
|
|
|
- reData.remove("contractId");
|
|
|
- reData.remove("pkeyId");
|
|
|
- reData.remove("projectId");
|
|
|
- }
|
|
|
- if (type == 1) {
|
|
|
- reData.put("pkeyId", reData.get("p_key_id"));
|
|
|
- }
|
|
|
- reData.put("tabGroupId", wbsTreeContract.getTabGroupId());
|
|
|
- return R.data(reData);
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
|