|
@@ -333,9 +333,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
}
|
|
|
dataInfo2.put("p_key_id", tableInfo.getPkeyId());
|
|
|
- dataInfo2.put("classify",tableInfo.getClassify());
|
|
|
- dataInfo2.put("contractId",tableInfo.getContractId());
|
|
|
- dataInfo2.put("projectId",tableInfo.getProjectId());
|
|
|
+ dataInfo2.put("classify", tableInfo.getClassify());
|
|
|
+ dataInfo2.put("contractId", tableInfo.getContractId());
|
|
|
+ dataInfo2.put("projectId", tableInfo.getProjectId());
|
|
|
tableInfo.setDataMap(dataMap2);
|
|
|
result.add(tableInfo);
|
|
|
}
|
|
@@ -352,40 +352,40 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
FormulaLog log = new FormulaLog();
|
|
|
/*每次都是部分表单提交,保证跨节点跨表取数正常,其次是反向依赖的被动刷新*/
|
|
|
List<NodeTable> tableAll = createNodeTables(nodeId, tableInfoList.get(0).getContractId(), tableInfoList.get(0).getProjectId(), type);
|
|
|
- if(tableAll.size()>tableInfoList.size()){
|
|
|
+ if (tableAll.size() > tableInfoList.size()) {
|
|
|
TableInfo example = tableInfoList.get(0);
|
|
|
/*补充缺失的数据*/
|
|
|
- List<Long> cp= tableInfoList.stream().map(TableInfo::getPkeyId).map(Long::parseLong).collect(Collectors.toList());
|
|
|
- List<Long> load=tableAll.stream().map(NodeTable::getPKeyId).filter(pk->!cp.contains(pk)).collect(Collectors.toList());
|
|
|
- Map<Long,String> keyMap=tableAll.stream().collect(Collectors.toMap(NodeTable::getPKeyId,NodeTable::getInitTableName));
|
|
|
- Map<String,List<Long>> loadMap=load.stream().collect(Collectors.groupingBy(keyMap::get,Collectors.toList()));
|
|
|
- loadMap.entrySet().parallelStream().forEach(entry->{
|
|
|
+ List<Long> cp = tableInfoList.stream().map(TableInfo::getPkeyId).map(Long::parseLong).collect(Collectors.toList());
|
|
|
+ List<Long> load = tableAll.stream().map(NodeTable::getPKeyId).filter(pk -> !cp.contains(pk)).collect(Collectors.toList());
|
|
|
+ Map<Long, String> keyMap = tableAll.stream().collect(Collectors.toMap(NodeTable::getPKeyId, NodeTable::getInitTableName));
|
|
|
+ Map<String, List<Long>> loadMap = load.stream().collect(Collectors.groupingBy(keyMap::get, Collectors.toList()));
|
|
|
+ loadMap.entrySet().parallelStream().forEach(entry -> {
|
|
|
/*init_table_name*/
|
|
|
- String k=entry.getKey();
|
|
|
+ String k = entry.getKey();
|
|
|
/*pkeyId集合*/
|
|
|
- List<Long> v= entry.getValue();
|
|
|
- List<Map<String,Object>> dataMap= this.jdbcTemplate.queryForList("select * from "+k+" where p_key_id in ("+v.stream().map(Objects::toString).collect(Collectors.joining(","))+")");
|
|
|
- if(dataMap.size()>0){
|
|
|
- dataMap.forEach(map->{
|
|
|
- TableInfo e = new TableInfo();
|
|
|
- e.setPkeyId(map.get("p_key_id").toString());
|
|
|
- e.setDataMap(new LinkedHashMap<>());
|
|
|
- e.setToBeUpdated(false);
|
|
|
- e.setBusinessId(null);
|
|
|
- e.setContractId(example.getContractId());
|
|
|
- e.setClassify(example.getClassify());
|
|
|
- e.setProjectId(example.getProjectId());
|
|
|
- e.setGroupId(example.getGroupId());
|
|
|
- map.forEach((key,value)->{
|
|
|
- if(key.startsWith("key_")){
|
|
|
- e.getDataMap().put(key,Func.toStr(value));
|
|
|
- }
|
|
|
- });
|
|
|
- tableInfoList.add(e);
|
|
|
- });
|
|
|
- }
|
|
|
+ List<Long> v = entry.getValue();
|
|
|
+ List<Map<String, Object>> dataMap = this.jdbcTemplate.queryForList("select * from " + k + " where p_key_id in (" + v.stream().map(Objects::toString).collect(Collectors.joining(",")) + ")");
|
|
|
+ if (dataMap.size() > 0) {
|
|
|
+ dataMap.forEach(map -> {
|
|
|
+ TableInfo e = new TableInfo();
|
|
|
+ e.setPkeyId(map.get("p_key_id").toString());
|
|
|
+ e.setDataMap(new LinkedHashMap<>());
|
|
|
+ e.setToBeUpdated(false);
|
|
|
+ e.setBusinessId(null);
|
|
|
+ e.setContractId(example.getContractId());
|
|
|
+ e.setClassify(example.getClassify());
|
|
|
+ e.setProjectId(example.getProjectId());
|
|
|
+ e.setGroupId(example.getGroupId());
|
|
|
+ map.forEach((key, value) -> {
|
|
|
+ if (key.startsWith("key_")) {
|
|
|
+ e.getDataMap().put(key, Func.toStr(value));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ tableInfoList.add(e);
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
- List<Long> tableAllIds=tableAll.stream().map(NodeTable::getPKeyId).collect(Collectors.toList());
|
|
|
+ List<Long> tableAllIds = tableAll.stream().map(NodeTable::getPKeyId).collect(Collectors.toList());
|
|
|
tableInfoList.sort(Comparator.comparingInt(a -> tableAllIds.indexOf(Long.parseLong(a.getPkeyId()))));
|
|
|
}
|
|
|
StopWatch stopWatch = new StopWatch();
|
|
@@ -437,7 +437,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public void formulaFillData2(JSONArray dataArray, ExecuteType type) {
|
|
|
try {
|
|
@@ -513,7 +512,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
private List<NodeTable> createNodeTables(Long nodeId, String contractId, String projectId, ExecuteType type) {
|
|
|
List<NodeTable> tableAll = new ArrayList<>();
|
|
|
if (type.equals(ExecuteType.INSPECTION)) {
|
|
|
- List<AppWbsTreeContractVO> treeNode = wbsTreeContractService.searchNodeAllTable(nodeId.toString(), "1", contractId, projectId,null);
|
|
|
+ List<AppWbsTreeContractVO> treeNode = wbsTreeContractService.searchNodeAllTable(nodeId.toString(), "1", contractId, projectId, null);
|
|
|
tableAll = BeanUtil.copyProperties(treeNode, NodeTable.class);
|
|
|
} else if (type.equals(ExecuteType.TESTING)) {
|
|
|
List<WbsTreePrivateVO4> wbsTreePrivateVO4s = wbsTreePrivateService.searchNodeAllTable(nodeId.toString(), "1", "9", contractId, projectId, null, null);
|
|
@@ -563,12 +562,12 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
private void updateFormulaLog(String log, Long pKeyId) {
|
|
|
try {
|
|
|
- if(log.length()<=2000) {
|
|
|
+ if (log.length() <= 2000) {
|
|
|
String deleteSql = "DELETE FROM m_formula_log WHERE id = ?";
|
|
|
String insertSql = "INSERT INTO m_formula_log (id, content,update_time) VALUES (?, ?,?)";
|
|
|
jdbcTemplate.update(deleteSql, pKeyId);
|
|
|
jdbcTemplate.update(insertSql, pKeyId, log, DateTime.now());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
StaticLog.error(log);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -594,7 +593,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
currentNode.setWbsId(Long.parseLong(publicWtp.getWbsId()));
|
|
|
currentNode.setWtpPkeyId(wtp.getPKeyId());
|
|
|
currentNode.setWbsNodeId(publicWtp.getId());
|
|
|
- if(Func.isNotBlank(wtc.getTreeCode())){
|
|
|
+ if (Func.isNotBlank(wtc.getTreeCode())) {
|
|
|
currentNode.getTreeCode().addAll(FormulaUtils.treeCodeSplit(wtc.getTreeCode()));
|
|
|
}
|
|
|
return currentNode;
|
|
@@ -928,8 +927,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
//获取未匹配的字段
|
|
|
List<WbsFormElement> list = new ArrayList<>();
|
|
|
- if(set!=null && set.size()>0){
|
|
|
- list = baseMapper.getUnMatchField(tabId, set);
|
|
|
+ if (set != null && set.size() > 0) {
|
|
|
+ list = baseMapper.getUnMatchField(tabId, set);
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
@@ -1145,7 +1144,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
String sqlInfo = "";
|
|
|
LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
|
|
|
/*检查发现有p_key_id缺失的情况,导致表单数据丢失,所以强制覆盖*/
|
|
|
- dataMap2.put("p_key_id",tableInfo.getPkeyId());
|
|
|
+ dataMap2.put("p_key_id", tableInfo.getPkeyId());
|
|
|
//统计保存的字段
|
|
|
// saveData.append(wbsTreeContract.getNodeName()+"<br>");
|
|
|
// for (String s : dataMap2.keySet()) {
|
|
@@ -1236,7 +1235,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (p.contains("Data too long for column")) {
|
|
|
List<Map<String, Object>> result = this.jdbcTemplate.queryForList("select CONCAT(a.tab_ch_name,'&',b.e_name) tf from m_table_info a join m_wbs_form_element b on b.f_id=a.id where a.tab_en_name='" + m.group(1) + "' and b.e_key='" + m.group(4) + "'");
|
|
|
if (result.size() > 0) {
|
|
|
- sb.append("【").append(result.get(0).values().stream().map(String::valueOf).collect(Collectors.joining(","))).append(m.group(4)+"数据库字段太短】");
|
|
|
+ sb.append("【").append(result.get(0).values().stream().map(String::valueOf).collect(Collectors.joining(","))).append(m.group(4) + "数据库字段太短】");
|
|
|
}
|
|
|
} else if (p.contains("Unknown column")) {
|
|
|
sb.append("【").append(m.group(1)).append(":").append(m.group(4)).append("关联错误】");
|
|
@@ -1289,14 +1288,15 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String,Object> getBussDataInfo(Long pkeyId, int type) {
|
|
|
+ public Map<String, Object> getBussDataInfo(Long pkeyId, int type) {
|
|
|
/*只有默认不执行表单公式isFormLoading==false*/
|
|
|
- return this.getBussDataInfo(pkeyId,type,false);
|
|
|
+ return this.getBussDataInfo(pkeyId, type, false);
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
- public Map<String,Object> getBussDataInfo(Long pkeyId, int type,Boolean isFormLoading) {
|
|
|
+ public Map<String, Object> getBussDataInfo(Long pkeyId, int type, Boolean isFormLoading) {
|
|
|
/*需要加载表单公式的时候isFormLoading==true*/
|
|
|
- Document document=null;
|
|
|
+ Document document = null;
|
|
|
Map<String, Object> reData = new HashMap<>();
|
|
|
|
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
@@ -1329,7 +1329,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
String htmlString = IoUtil.readToString(inputStreamByUrl);
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
- document=doc;
|
|
|
+ document = doc;
|
|
|
|
|
|
// 解析
|
|
|
// 模糊匹配
|
|
@@ -1380,10 +1380,14 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
if (sgtitle.size() >= 1) {
|
|
|
- int y = Integer.parseInt(sgtitle.attr("trindex"));
|
|
|
- if (y <= 20) {
|
|
|
- reData.put(sgtitle.attr("keyName"), contractInfo.getConstructionUnitName());
|
|
|
+ for (Element element : sgtitle) {
|
|
|
+ int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
+ String placeholderxx = element.attr("placeholder");
|
|
|
+ if (trindex < 10 || placeholderxx.equals("施工单位")) {
|
|
|
+ reData.put(element.attr("keyName"), contractInfo.getConstructionUnitName());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1517,7 +1521,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (tabVal.contains("[") && tabVal.contains("年")) {
|
|
|
String[] strings = StringUtils.strip(tabData[0], "[]").split(",");
|
|
|
reData.put(key + "__" + tabData[1], strings);
|
|
|
- }if (tabVal.contains("[") && tabVal.contains("]") && tabVal.indexOf(",")>=0) {
|
|
|
+ }
|
|
|
+ if (tabVal.contains("[") && tabVal.contains("]") && tabVal.indexOf(",") >= 0) {
|
|
|
String[] strings = StringUtils.strip(tabData[0], "[]").split(",");
|
|
|
reData.put(key + "__" + tabData[1], strings);
|
|
|
} else {
|
|
@@ -1560,15 +1565,15 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
reData.put("tabGroupId", wbsTreeContract.getTabGroupId());
|
|
|
/*表单公式*/
|
|
|
- if(isFormLoading) {
|
|
|
+ if (isFormLoading) {
|
|
|
this.formulaService.paramFormula(wbsTreeContract, reData, document);
|
|
|
}
|
|
|
return reData;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Object> getBussDataInfoMulti(Long pkeyId, int type, Boolean isFormLoading, ConcurrentHashMap<String,String> htmlStrCache) {
|
|
|
- Document document=null;
|
|
|
+ public Map<String, Object> getBussDataInfoMulti(Long pkeyId, int type, Boolean isFormLoading, ConcurrentHashMap<String, String> htmlStrCache) {
|
|
|
+ Document document = null;
|
|
|
Map<String, Object> reData = new HashMap<>();
|
|
|
|
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
@@ -1598,14 +1603,14 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
// 匹配关联
|
|
|
try {
|
|
|
String htmlString;
|
|
|
- if(htmlStrCache.containsKey(wbsTreeContract.getInitTableName())) {
|
|
|
+ if (htmlStrCache.containsKey(wbsTreeContract.getInitTableName())) {
|
|
|
htmlString = htmlStrCache.get(wbsTreeContract.getInitTableName());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(wbsTreeContract.getHtmlUrl());
|
|
|
htmlString = IoUtil.readToString(inputStreamByUrl);
|
|
|
}
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
- document=doc;
|
|
|
+ document = doc;
|
|
|
// 解析
|
|
|
// 模糊匹配
|
|
|
Elements dwtitle = doc.select("el-input[placeholder~=.*承包单位]");
|
|
@@ -1827,7 +1832,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
reData.put("tabGroupId", wbsTreeContract.getTabGroupId());
|
|
|
/*表单公式*/
|
|
|
- if(isFormLoading) {
|
|
|
+ if (isFormLoading) {
|
|
|
this.formulaService.paramFormula(wbsTreeContract, reData, document);
|
|
|
}
|
|
|
return reData;
|
|
@@ -1895,7 +1900,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
int all = 0;
|
|
|
List<CellRangeAddress> mergedRegions = sheet.getMergedRegions();
|
|
|
int xle = 10;
|
|
|
- if(mergedRegions.size()<=10){
|
|
|
+ if (mergedRegions.size() <= 10) {
|
|
|
xle = mergedRegions.size();
|
|
|
}
|
|
|
for (int i = 0; i < xle; i++) {
|
|
@@ -1942,7 +1947,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(pkeyId==1771097177339199489L){
|
|
|
+ if (pkeyId == 1771097177339199489L) {
|
|
|
System.out.println("1231");
|
|
|
}
|
|
|
//数据不为空
|
|
@@ -1965,10 +1970,10 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
Long sigSize = table.getElementsByAttribute(":readonly").stream().count();
|
|
|
int keySize = keyList.size();
|
|
|
List<String> fills = DataInfo.keySet().stream().filter(e -> e.contains("__") && e.contains("key")).collect(Collectors.toList());
|
|
|
- if (fills.size() != 0 && keyList != null && keyList.size() != 0){
|
|
|
- if (keySize == sigSize){
|
|
|
+ if (fills.size() != 0 && keyList != null && keyList.size() != 0) {
|
|
|
+ if (keySize == sigSize) {
|
|
|
realFillRate = 100;
|
|
|
- }else if (keySize > sigSize) {
|
|
|
+ } else if (keySize > sigSize) {
|
|
|
keySize = keySize - sigSize.intValue();
|
|
|
keyList.retainAll(fills);
|
|
|
Double v = new Double(keyList.size()) / new Double(keySize) * 100;
|
|
@@ -2000,8 +2005,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
|
|
|
String myData = DataInfo.get(val) + "";
|
|
|
- System.out.println(data.attr("type").indexOf("date")>=0);
|
|
|
- if (data.attr("type").indexOf("date")>=0 && (myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) || (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0) ) {
|
|
|
+ System.out.println(data.attr("type").indexOf("date") >= 0);
|
|
|
+ if (data.attr("type").indexOf("date") >= 0 && (myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) || (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0)) {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
|
|
sdf.setTimeZone(TimeZone.getTimeZone("GTM+8"));
|
|
|
SimpleDateFormat formatStr = new SimpleDateFormat("yyyy年MM月dd日");
|
|
@@ -2041,14 +2046,14 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (obj instanceof String[]) {
|
|
|
String[] dataDate = (String[]) obj;
|
|
|
String HtmlEle = data.toString();
|
|
|
- if(HtmlEle.indexOf("el-date-picker")>=0){//时间时间段处理格式
|
|
|
+ if (HtmlEle.indexOf("el-date-picker") >= 0) {//时间时间段处理格式
|
|
|
if ((dataDate[0].trim()).equals((dataDate[1].trim()))) {
|
|
|
myData = dataDate[0];
|
|
|
} else {
|
|
|
myData = dataDate[0].replace("\"", "") + "-" + dataDate[1].trim().replace("\"", "");
|
|
|
}
|
|
|
- }else{
|
|
|
- myData = Func.convert(dataDate,String.class).replaceAll(" ","");
|
|
|
+ } else {
|
|
|
+ myData = Func.convert(dataDate, String.class).replaceAll(" ", "");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2056,7 +2061,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if ((myData.indexOf("https") >= 0 || myData.indexOf("http") >= 0) && myData.indexOf("aliyuncs") >= 0) {
|
|
|
|
|
|
InputStream imageIn = CommonUtil.getOSSInputStream(myData);
|
|
|
- if(imageIn!=null) {
|
|
|
+ if (imageIn != null) {
|
|
|
byte[] byteNew = IOUtils.toByteArray(imageIn);
|
|
|
byte[] bytes = CommonUtil.compressImage(byteNew);
|
|
|
// 这里根据实际需求选择图片类型
|
|
@@ -2170,7 +2175,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
FileOutputStream outputStream = new FileOutputStream(excelPath);
|
|
|
workbook.write(outputStream);
|
|
|
|
|
|
- // FileUtils.excel2pdf(excelPath, pdfPath);
|
|
|
+ // FileUtils.excel2pdf(excelPath, pdfPath);
|
|
|
FileUtils.excelToPdf(excelPath, pdfPath);
|
|
|
|
|
|
BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
|
|
@@ -2232,9 +2237,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
public void getBussPdfs(String nodeId, String classify, String contractId, String projectId) throws Exception {
|
|
|
String file_path = FileUtils.getSysLocalFileUrl();
|
|
|
// 获取有权限的节点信息
|
|
|
- List<AppWbsTreeContractVO> wbsTreeContractList = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId,null);
|
|
|
+ List<AppWbsTreeContractVO> wbsTreeContractList = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId, null);
|
|
|
List<String> data = new ArrayList<>();
|
|
|
- if(nodeId.indexOf(":")>=0){
|
|
|
+ if (nodeId.indexOf(":") >= 0) {
|
|
|
nodeId = nodeId.split(":")[0];
|
|
|
}
|
|
|
if (wbsTreeContractList != null && wbsTreeContractList.size() >= 1) {
|
|
@@ -2276,7 +2281,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
contractId = wbsTreeContract.getContractId();
|
|
|
}
|
|
|
}
|
|
|
- String sql = "update u_information_query set pdf_url ='" + bladeFile.getLink() + "' , sort = " + sort +",e_visa_pdf_url = null" +" where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id ='" + contractId + "' ";
|
|
|
+ String sql = "update u_information_query set pdf_url ='" + bladeFile.getLink() + "' , sort = " + sort + ",e_visa_pdf_url = null" + " where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id ='" + contractId + "' ";
|
|
|
System.out.println(sql);
|
|
|
jdbcTemplate.execute(sql);
|
|
|
}
|
|
@@ -2293,7 +2298,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
tableInfo.setToBeUpdated(true);
|
|
|
|
|
|
// entrustInfo = 为 委托单信息
|
|
|
- if(!tabIds.equals("entrustInfo")){
|
|
|
+ if (!tabIds.equals("entrustInfo")) {
|
|
|
if (!tabIds.contains(tableInfo.getPkeyId())) {
|
|
|
//隐藏表不做处理
|
|
|
continue;
|
|
@@ -2305,6 +2310,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
this.setFirstData(dataInfo2, tableInfo);
|
|
|
//设置日志信息
|
|
|
this.setTheLogData(dataInfo2, tableInfo);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
tableInfo.setContractId(dataInfo2.getString("contractId"));
|
|
|
|
|
@@ -2329,6 +2336,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
//计算数据
|
|
|
LinkedHashMap<String, List<String>> dataMap = dataInfo2.keySet().stream().filter(e -> e.contains("__")).collect(Collectors.groupingBy(e -> e.split("__")[0], LinkedHashMap<String, List<String>>::new, Collectors.toList()));
|
|
|
LinkedHashMap<String, String> dataMap2 = new LinkedHashMap<>();
|
|
|
+
|
|
|
//字段组合
|
|
|
for (String k : dataMap.keySet()) {
|
|
|
if (dataMap.get(k).size() > 1 && !dataMap.get(k).contains("000Z")) {
|
|
@@ -2350,7 +2358,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
StringBuilder lastStr = new StringBuilder(dataInfo2.getString(ziduan[0]) + "_^_" + ziduan[0].split("__")[1]);
|
|
|
for (int i = 1; i < ziduan.length; i++) {
|
|
|
String keyData = dataInfo2.getString(ziduan[i]);
|
|
|
- if (!keyData.equals("")) {
|
|
|
+ if (keyData!=null && Func.isNotEmpty(keyData)) {
|
|
|
lastStr.append("☆").append(dataInfo2.getString(ziduan[i])).append("_^_").append(ziduan[i].split("__")[1]);
|
|
|
}
|
|
|
|
|
@@ -2397,6 +2405,22 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ //获取引用数据信息
|
|
|
+ String loadDataId = "";
|
|
|
+ try {
|
|
|
+ String sqlQuery = "select * from u_trial_self_data_record where record_id = " + groupId + " and tab_id = " + pkeyId;
|
|
|
+ List<Map<String, Object>> stringObjectMap = jdbcTemplate.queryForList(sqlQuery);
|
|
|
+ if (stringObjectMap != null && stringObjectMap.size() >= 1) {
|
|
|
+ loadDataId = stringObjectMap.get(0).get("load_data_id") + "";
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return list;
|
|
|
+ } finally {
|
|
|
+ reData.put("loadDataId", loadDataId);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//实体数据
|
|
|
String querySql = "select * from " + wbsTreePrivate.getInitTableName() + " where p_key_id=" + pkeyId + " and group_id = " + groupId;
|
|
|
List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
|
|
@@ -2567,6 +2591,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (tabVal.contains("[") && tabVal.contains("年")) {
|
|
|
String[] strings = StringUtils.strip(tabData[0], "[]").split(",");
|
|
|
reData.put(key + "__" + tabData[1], strings);
|
|
|
+ }else if (tabVal.contains("[") && tabVal.contains("]") && tabVal.indexOf(",") >= 0) {
|
|
|
+ String[] strings = StringUtils.strip(tabData[0], "[]").split(",");
|
|
|
+ reData.put(key + "__" + tabData[1], strings);
|
|
|
} else {
|
|
|
reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
}
|
|
@@ -2790,8 +2817,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
*/
|
|
|
@Override
|
|
|
public String getBussPDFTrial(Long pkeyId, String contractId, Long id, int pageNumber, int pageNumberCount, TrialSelfInspectionRecordDTO dto) throws Exception {
|
|
|
- String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
- String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
|
|
|
+ String file_path = FileUtils.getSysLocalFileUrl();
|
|
|
+
|
|
|
WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
|
|
|
.eq(WbsTreePrivate::getPKeyId, pkeyId));
|
|
|
if (wbsTreePrivate == null) {
|
|
@@ -2873,13 +2900,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
//数据不为空,构造数据
|
|
|
String fileUrl = wbsTreePrivate.getHtmlUrl();
|
|
|
File file1 = ResourceUtil.getFile(fileUrl);
|
|
|
- InputStream fileInputStream;
|
|
|
- if (file1.exists()) {
|
|
|
- fileInputStream = new FileInputStream(file1);
|
|
|
- } else {
|
|
|
- String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
|
|
|
- fileInputStream = CommonUtil.getOSSInputStream(path);
|
|
|
- }
|
|
|
+ InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
|
|
|
|
|
|
String htmlString = IoUtil.readToString(fileInputStream);
|
|
|
htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
|
|
@@ -2965,9 +2986,15 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
Object obj = DataInfo.get(val);
|
|
|
if (obj instanceof String[]) {
|
|
|
String[] dataDate = (String[]) obj;
|
|
|
- myData = dataDate[0].trim() + "-" + dataDate[1].trim();
|
|
|
- if (dataDate[0].trim().equals(dataDate[1].trim())) {
|
|
|
- myData = dataDate[0];
|
|
|
+ String HtmlEle = data.toString();
|
|
|
+ if (HtmlEle.indexOf("el-date-picker") >= 0) {//时间时间段处理格式
|
|
|
+ if ((dataDate[0].trim()).equals((dataDate[1].trim()))) {
|
|
|
+ myData = dataDate[0];
|
|
|
+ } else {
|
|
|
+ myData = dataDate[0].replace("\"", "") + "-" + dataDate[1].trim().replace("\"", "");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ myData = Func.convert(dataDate, String.class).replaceAll(" ", "");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -3001,6 +3028,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
Row row = sheet.getRow(y1 - 1);
|
|
|
if (row != null) {
|
|
|
Cell cell = row.getCell(x1 - 1);
|
|
|
+
|
|
|
if (cell != null) {
|
|
|
String exceVal = cell.getStringCellValue().replaceAll(" ", "");
|
|
|
short fontIndex = cell.getCellStyle().getFontIndex();
|
|
@@ -3148,14 +3176,25 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
//查询是否存在关系
|
|
|
String sqlQuery = "select id from u_trial_self_data_record where record_id = " + id + " and tab_id = " + pkeyId;
|
|
|
List<TrialSelfDataRecord> query = jdbcTemplate.query(sqlQuery, new BeanPropertyRowMapper<>(TrialSelfDataRecord.class));
|
|
|
+
|
|
|
+ // 获取匹配的laodId
|
|
|
+ String load_data_id = "";
|
|
|
+ JSONArray jsonArray = dto.getDataInfo().getJSONArray("orderList");
|
|
|
+ load_data_id = jsonArray.getJSONObject(0).getString("loadDataId");
|
|
|
+
|
|
|
String sql;
|
|
|
if (query.size() == 0) {
|
|
|
//新增关系
|
|
|
- sql = "insert into u_trial_self_data_record(id,record_id,tab_id,is_buss_show,is_tab_pdf,is_tab_file_type,pdf_url) values" +
|
|
|
- "(" + SnowFlakeUtil.getId() + "," + id + "," + pkeyId + "," + 1 + "," + 2 + "," + 1 + ",'" + bladeFile.getLink() + "')";
|
|
|
+ sql = "insert into u_trial_self_data_record(id,record_id,tab_id,is_buss_show,is_tab_pdf,is_tab_file_type,pdf_url,load_data_id) values" +
|
|
|
+ "(" + SnowFlakeUtil.getId() + "," + id + "," + pkeyId + "," + 1 + "," + 2 + "," + 1 + ",'" + bladeFile.getLink() + "','" + load_data_id + "')";
|
|
|
} else {
|
|
|
//修改pdfUrl
|
|
|
- sql = "update u_trial_self_data_record set pdf_url ='" + bladeFile.getLink() + "' where record_id = " + id + " and tab_id = " + pkeyId;
|
|
|
+ if (load_data_id == null || Func.isEmpty(load_data_id)) {
|
|
|
+ sql = "update u_trial_self_data_record set pdf_url ='" + bladeFile.getLink() + "' where record_id = " + id + " and tab_id = " + pkeyId;
|
|
|
+ } else {
|
|
|
+ sql = "update u_trial_self_data_record set pdf_url ='" + bladeFile.getLink() + "',load_data_id='" + load_data_id + "' where record_id = " + id + " and tab_id = " + pkeyId;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
jdbcTemplate.execute(sql);
|
|
|
|
|
@@ -3170,7 +3209,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
@Override
|
|
|
public String getBussPDFSTrial(String nodeId, String tableType, String classify, String contractId, String
|
|
|
projectId, Long id, String tabIds, TrialSelfInspectionRecordDTO dto) throws Exception {
|
|
|
- String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ String file_path = FileUtils.getSysLocalFileUrl();
|
|
|
//获取有权限的表的信息
|
|
|
List<WbsTreePrivate> queryList = jdbcTemplate.query("select p_key_id,html_url,table_type,sort,node_name,create_time from m_wbs_tree_private where is_deleted = 0 and p_key_id in (" + tabIds + ") order by sort,node_name,create_time", new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
|
List<String> dataPdfUrls = new ArrayList<>();
|
|
@@ -3292,14 +3331,14 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
String contractId = tableInfo1.getString("contractId");
|
|
|
String projectId = tableInfo1.getString("projectId");
|
|
|
String classify = tableInfo1.getString("classify");
|
|
|
- String UserId = AuthUtil.getUserId()+"";
|
|
|
- RedisTemplate.opsForValue().set("pdf-" + nodeId+"-"+classify, "1", 300, TimeUnit.SECONDS);
|
|
|
+ String UserId = AuthUtil.getUserId() + "";
|
|
|
+ RedisTemplate.opsForValue().set("pdf-" + nodeId + "-" + classify, "1", 300, TimeUnit.SECONDS);
|
|
|
//构造阻塞器
|
|
|
CountDownLatch cdl = new CountDownLatch(dataArray.size());
|
|
|
// 构造多线程保存用户数据到表中 并生成excel
|
|
|
for (int i = 0; i < dataArray.size(); i++) {
|
|
|
JSONObject jsonObject = dataArray.getJSONObject(i);
|
|
|
- jsonObject.put("UserId",UserId);
|
|
|
+ jsonObject.put("UserId", UserId);
|
|
|
Thread countUserThread = new Thread(() -> {
|
|
|
try {
|
|
|
SaveOneTabInfo(jsonObject);
|
|
@@ -3315,10 +3354,10 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
try {
|
|
|
cdl.await();
|
|
|
//合并pdf加载
|
|
|
- this.getBussPdfs(nodeId+":"+UserId, classify, contractId, projectId);
|
|
|
+ this.getBussPdfs(nodeId + ":" + UserId, classify, contractId, projectId);
|
|
|
//更新缓存
|
|
|
informationQueryClient.delAsyncWbsTree(contractId);
|
|
|
- RedisTemplate.delete("pdf-" + nodeId+"-"+classify);
|
|
|
+ RedisTemplate.delete("pdf-" + nodeId + "-" + classify);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
} finally {
|
|
@@ -3409,10 +3448,10 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
Long sigSize = table.getElementsByAttribute(":readonly").stream().count();
|
|
|
int keySize = keyList.size();
|
|
|
List<String> fills = tableInfo.keySet().stream().filter(e -> StringUtils.isNotEmpty(tableInfo.getString(e)) && e.contains("__") && e.contains("key")).collect(Collectors.toList());
|
|
|
- if (fills.size() != 0 && keyList != null && keyList.size() != 0){
|
|
|
- if (keySize == sigSize){
|
|
|
+ if (fills.size() != 0 && keyList != null && keyList.size() != 0) {
|
|
|
+ if (keySize == sigSize) {
|
|
|
realFillRate = 100;
|
|
|
- }else if (keySize > sigSize) {
|
|
|
+ } else if (keySize > sigSize) {
|
|
|
keySize = keySize - sigSize.intValue();
|
|
|
keyList.retainAll(fills);
|
|
|
Double v = new Double(keyList.size()) / new Double(keySize) * 100;
|
|
@@ -3623,17 +3662,17 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
throw new RuntimeException("字段过长,新增失败");
|
|
|
}
|
|
|
|
|
|
- String fileName ="暂无文件提名1";
|
|
|
+ String fileName = "暂无文件提名1";
|
|
|
// 处理文件提名
|
|
|
try {
|
|
|
WbsTreeContract wbsTreeContractByP = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, nodeId));
|
|
|
//处理文件提名
|
|
|
fileName = this.wbsParamService.createFileTitle(wbsTreeContractByP);
|
|
|
- }catch (Exception exception){
|
|
|
+ } catch (Exception exception) {
|
|
|
|
|
|
- }finally {
|
|
|
+ } finally {
|
|
|
//huangjn 保存成功后调用生成资料查询列表数据
|
|
|
- this.informationQueryClient.saveOrUpdateInformationQueryData(nodeId+":"+UserId, "首件使用字段", "业务ID(主要将来给首件使用)", fileName, Integer.parseInt(classify), 2, "false", "源文件(首件字段)", "pdf文件(首件字段)", "首件上传总结报告名称", new ArrayList<>());
|
|
|
+ this.informationQueryClient.saveOrUpdateInformationQueryData(nodeId + ":" + UserId, "首件使用字段", "业务ID(主要将来给首件使用)", fileName, Integer.parseInt(classify), 2, "false", "源文件(首件字段)", "pdf文件(首件字段)", "首件上传总结报告名称", new ArrayList<>());
|
|
|
}
|
|
|
|
|
|
String file_path = FileUtils.getSysLocalFileUrl();
|
|
@@ -3712,7 +3751,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
* @param parentName
|
|
|
* @return
|
|
|
*/
|
|
@@ -3819,7 +3857,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
FileOutputStream outputStream = new FileOutputStream(excelPath);
|
|
|
workbook.write(outputStream);
|
|
|
FileUtils.excelToPdf(excelPath, pdfPath);
|
|
|
- PdfAddimgUtil.pdfAddImgInfo(pdfPath,String.join(",",sign));
|
|
|
+ PdfAddimgUtil.pdfAddImgInfo(pdfPath, String.join(",", sign));
|
|
|
return R.data(PdfAddimgUtil.getNetUrl(pdfPath));
|
|
|
}
|
|
|
|
|
@@ -3905,14 +3943,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
//数据不为空,构造数据
|
|
|
String fileUrl = wbsTreePrivate.getHtmlUrl();
|
|
|
- File file1 = ResourceUtil.getFile(fileUrl);
|
|
|
- InputStream fileInputStream;
|
|
|
- if (file1.exists()) {
|
|
|
- fileInputStream = new FileInputStream(file1);
|
|
|
- } else {
|
|
|
- String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
|
|
|
- fileInputStream = CommonUtil.getOSSInputStream(path);
|
|
|
- }
|
|
|
+ InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
|
|
|
|
|
|
String htmlString = IoUtil.readToString(fileInputStream);
|
|
|
htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
|
|
@@ -4106,7 +4137,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
if (bladeFile != null) {
|
|
|
String pdfUrl = bladeFile.getLink();
|
|
|
- jdbcTemplate.update("update u_entrust_info set entrust_pdf = '"+pdfUrl+"' where id='"+groupId+"' ");
|
|
|
+ jdbcTemplate.update("update u_entrust_info set entrust_pdf = '" + pdfUrl + "' where id='" + groupId + "' ");
|
|
|
List<InformationQuery> query2 = jdbcTemplate.query("select id from u_information_query where classify = 1 and wbs_id ='" + groupId + "' and contract_id ='" + contractId + "'", new BeanPropertyRowMapper<>(InformationQuery.class));
|
|
|
if (query2.size() > 0) {
|
|
|
jdbcTemplate.execute("update u_information_query set pdf_url ='" + bladeFile.getLink() + "', name ='委托单' where classify='1' and wbs_id='" + groupId + "' and contract_id ='" + contractId + "'");
|
|
@@ -4118,4 +4149,295 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
return "操作失败";
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+ /**
|
|
|
+ * 添加抽取的 数据信息
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public JSONArray addLoadDataInfo(JSONArray jsonArray) {
|
|
|
+ JSONArray json2 = new JSONArray();
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
+ String loadDataId = jsonObject.getString("loadDataId");
|
|
|
+
|
|
|
+ if (loadDataId != null && Func.isNotEmpty(loadDataId)) {
|
|
|
+
|
|
|
+ String pkeyId = jsonObject.getString("pkeyId");
|
|
|
+ String projectId = jsonObject.getString("projectId");
|
|
|
+ WbsTreePrivate wbsTreePrivate = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, pkeyId));
|
|
|
+
|
|
|
+ String sql = "select * from m_wbs_form_element where is_deleted = 0 and dynamic_dict in('1','2','3','4','5','6','7','8','9','10','11') and f_id=" + wbsTreePrivate.getInitTableId()+" order by dynamic_dict";
|
|
|
+ List<Map<String, Object>> wbsFormElements = jdbcTemplate.queryForList(sql);
|
|
|
+
|
|
|
+ String htmlString = null;
|
|
|
+ try {
|
|
|
+ htmlString = IoUtil.readToString(FileUtils.getInputStreamByUrl(wbsTreePrivate.getHtmlUrl()));
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
+
|
|
|
+ List<Map<String, Object>> maps = jdbcTemplate.queryForList("select * from u_view_gather_data_info where id in(" + loadDataId + ")");
|
|
|
+ if (maps != null && maps.size() >= 1) {
|
|
|
+ for (int j = 0; j < maps.size(); j++) {
|
|
|
+ Map<String, Object> dataInfo = maps.get(j);
|
|
|
+ int y1=0;
|
|
|
+ int y2=0;
|
|
|
+ for (Map<String, Object> wb : wbsFormElements) {
|
|
|
+
|
|
|
+ if ((wb.get("dynamic_dict") + "").equals("1")) { //试验压力机_样品编号
|
|
|
+ Elements elements = doc.getElementsByAttributeValueStarting("id", wb.get("e_key") + "");
|
|
|
+ String id = elements.get(j).attr("id");
|
|
|
+ jsonObject.put(id, dataInfo.get("specificationNumber"));
|
|
|
+ y1 = Func.toInt(elements.get(j).attr("y1"));
|
|
|
+ y2 = Func.toInt(elements.get(j).attr("y2"));
|
|
|
+ }
|
|
|
+ if ((wb.get("dynamic_dict") + "").equals("4")) { //试验压力机_设计强度
|
|
|
+ Elements elements = doc.getElementsByAttributeValueStarting("id", wb.get("e_key") + "");
|
|
|
+ Element element = elements.get(j);
|
|
|
+ int valy1 = Func.toInt(element.attr("y1"));
|
|
|
+ int valy2 = Func.toInt(element.attr("y2"));
|
|
|
+ String id = element.attr("id");
|
|
|
+ if( valy1>=y1 && valy2<=y2){
|
|
|
+ jsonObject.put(id, dataInfo.get("desStrength"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ((wb.get("dynamic_dict") + "").equals("3")) { //试验压力机_强度代表值
|
|
|
+ Elements elements = doc.getElementsByAttributeValueStarting("id", wb.get("e_key") + "");
|
|
|
+ Element element = elements.get(0);
|
|
|
+ int valy1 = Func.toInt(element.attr("y1"));
|
|
|
+ int valy2 = Func.toInt(element.attr("y2"));
|
|
|
+ String id= element.attr("id");
|
|
|
+ if( valy1>=y1 && valy2<=y2){
|
|
|
+ jsonObject.put(id, dataInfo.get("strengthAVG"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((wb.get("dynamic_dict") + "").equals("2")) { //试验压力机_荷载(KN)
|
|
|
+ Elements elements = doc.getElementsByAttributeValueStarting("id", wb.get("e_key") + "");
|
|
|
+ int valIndex = 0;
|
|
|
+ for (Element element:elements){
|
|
|
+ int valy1 = Func.toInt(element.attr("y1"));
|
|
|
+ int valy2 = Func.toInt(element.attr("y2"));
|
|
|
+ if( valy1>=y1 && valy2<=y2){
|
|
|
+ if(valIndex==0){
|
|
|
+ String id1 = element.attr("id");
|
|
|
+ jsonObject.put(id1, dataInfo.get("load1"));
|
|
|
+ }
|
|
|
+ if(valIndex==1){
|
|
|
+ String id2 = element.attr("id");
|
|
|
+ jsonObject.put(id2, dataInfo.get("load2"));
|
|
|
+ }
|
|
|
+ if(valIndex==2){
|
|
|
+ String id3 = element.attr("id");
|
|
|
+ jsonObject.put(id3, dataInfo.get("load3"));
|
|
|
+ }
|
|
|
+ valIndex = valIndex+1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((wb.get("dynamic_dict") + "").equals("5")) { //试验压力机_强度单值
|
|
|
+ Elements elements = doc.getElementsByAttributeValueStarting("id", wb.get("e_key") + "");
|
|
|
+ int valIndex = 0;
|
|
|
+ for (Element element:elements){
|
|
|
+ int valy1 = Func.toInt(element.attr("y1"));
|
|
|
+ int valy2 = Func.toInt(element.attr("y2"));
|
|
|
+ if( valy1>=y1 && valy2<=y2){
|
|
|
+ if(valIndex==0){
|
|
|
+ String id1 = element.attr("id");
|
|
|
+ jsonObject.put(id1, dataInfo.get("mpa1"));
|
|
|
+ }
|
|
|
+ if(valIndex==1){
|
|
|
+ String id2 = element.attr("id");
|
|
|
+ jsonObject.put(id2, dataInfo.get("mpa2"));
|
|
|
+ }
|
|
|
+ if(valIndex==2){
|
|
|
+ String id3 = element.attr("id");
|
|
|
+ jsonObject.put(id3, dataInfo.get("mpa3"));
|
|
|
+ }
|
|
|
+ valIndex = valIndex+1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ json2.add(jsonObject);
|
|
|
+ }
|
|
|
+ return json2;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 试验 委托单获取填报信息
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> getBussDataInfoTrialentrust(Long groupId, Long pkeyId, Long contractId) {
|
|
|
+ String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
+ Map<String, Object> reData = new HashMap<>();
|
|
|
+ WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
|
|
|
+ .select(WbsTreePrivate::getInitTableName, WbsTreePrivate::getHtmlUrl, WbsTreePrivate::getPKeyId, WbsTreePrivate::getProjectId)
|
|
|
+ .eq(WbsTreePrivate::getPKeyId, pkeyId));
|
|
|
+ if (wbsTreePrivate == null) {
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ if (wbsTreePrivate.getHtmlUrl() == null) {
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ //表单是否存储在
|
|
|
+ String tabName = wbsTreePrivate.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 list;
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取引用数据信息
|
|
|
+ String loadDataId = "";
|
|
|
+ String sampleId = "";
|
|
|
+ try {
|
|
|
+ String sqlQuery = "select * from u_trial_self_data_record where record_id = " + groupId + " and tab_id = " + pkeyId;
|
|
|
+ List<Map<String, Object>> stringObjectMap = jdbcTemplate.queryForList(sqlQuery);
|
|
|
+ if (stringObjectMap != null && stringObjectMap.size() >= 1) {
|
|
|
+ loadDataId = stringObjectMap.get(0).get("load_data_id") + "";
|
|
|
+ }
|
|
|
+
|
|
|
+ String samQuery = "SELECT * from u_entrust_info where id=" + groupId + " ";
|
|
|
+ List<Map<String, Object>> strbjectMap = jdbcTemplate.queryForList(samQuery);
|
|
|
+ if (strbjectMap != null && strbjectMap.size() >= 1) {
|
|
|
+ sampleId = strbjectMap.get(0).get("sample_id") + "";
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return list;
|
|
|
+ } finally {
|
|
|
+ reData.put("loadDataId", loadDataId);
|
|
|
+ reData.put("sampleId", sampleId);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //实体数据
|
|
|
+ String querySql = "select * from " + wbsTreePrivate.getInitTableName() + " where p_key_id=" + pkeyId + " and group_id = " + groupId;
|
|
|
+ List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
|
|
|
+
|
|
|
+ //匹配关联
|
|
|
+ try {
|
|
|
+ String fileUrl = wbsTreePrivate.getHtmlUrl();
|
|
|
+ File file1 = ResourceUtil.getFile(fileUrl);
|
|
|
+ InputStream fileInputStream;
|
|
|
+ if (file1.exists()) {
|
|
|
+ fileInputStream = new FileInputStream(file1);
|
|
|
+ } else {
|
|
|
+ String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
|
|
|
+ fileInputStream = CommonUtil.getOSSInputStream(path);
|
|
|
+ }
|
|
|
+ String htmlString = IoUtil.readToString(fileInputStream);
|
|
|
+ htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
|
|
|
+ htmlString = htmlString.replaceAll("title", "titlexx");
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
+
|
|
|
+
|
|
|
+ if (dataIn.size() >= 1) {
|
|
|
+ Map<String, Object> mysqlData = dataIn.get(0);
|
|
|
+ for (String key : mysqlData.keySet()) {
|
|
|
+ String tabVal = mysqlData.get(key) + "";
|
|
|
+ // 时间段处理
|
|
|
+ if (StringUtils.isNotEmpty(tabVal) && !tabVal.equals("null")) {
|
|
|
+ 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 (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
+ reData.put(key + "__" + tabData[1], sql);
|
|
|
+ }
|
|
|
+ } else if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z") >= 0) {//时间
|
|
|
+ // 时间和字符串合作
|
|
|
+ if (tabVal.indexOf("☆") >= 0) {
|
|
|
+ String[] mysql = tabVal.split("☆");
|
|
|
+ for (String data : mysql) {
|
|
|
+ String[] tabData = data.split("_\\^_");
|
|
|
+ if (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
+ reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ String[] tabData = tabVal.split("_\\^_");
|
|
|
+ if (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
+ reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (tabVal.indexOf("☆") >= 0) {
|
|
|
+ String[] mysql = tabVal.split("☆");
|
|
|
+ for (String data : mysql) {
|
|
|
+ String[] tabData = data.split("_\\^_");
|
|
|
+ if (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
+ reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (tabVal.indexOf("_^_") >= 0) {
|
|
|
+ String[] tabData = tabVal.split("_\\^_");
|
|
|
+ if (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
+ if (tabVal.contains("[") && tabVal.contains("年")) {
|
|
|
+ String[] strings = StringUtils.strip(tabData[0], "[]").split(",");
|
|
|
+ reData.put(key + "__" + tabData[1], strings);
|
|
|
+ } else {
|
|
|
+ reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ reData.put(key, tabVal);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取默认值
|
|
|
+ QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.select("col_key", "sig_role_name");
|
|
|
+ queryWrapper.eq("type", 4);
|
|
|
+ queryWrapper.eq("tab_id", wbsTreePrivate.getPKeyId());
|
|
|
+ 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
|
|
|
+ reData.remove("id");
|
|
|
+ reData.remove("p_key_id");
|
|
|
+ reData.remove("classify");
|
|
|
+ reData.remove("contractId");
|
|
|
+ reData.remove("pkeyId");
|
|
|
+ reData.remove("projectId");
|
|
|
+ chart(reData, wbsTreePrivate);
|
|
|
+ list.add(reData);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|