|
@@ -624,7 +624,7 @@ public class ExcelTabController extends BladeController {
|
|
@ApiImplicitParams(value = {
|
|
@ApiImplicitParams(value = {
|
|
@ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
|
|
@ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
|
|
})
|
|
})
|
|
- public R getExcelHtmlByBuss(Long pkeyId) throws Exception {
|
|
|
|
|
|
+ public R getExcelHtmlByBuss(Long pkeyId){
|
|
|
|
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
.eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
.eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
@@ -635,74 +635,75 @@ public class ExcelTabController extends BladeController {
|
|
return R.fail("暂无表单!");
|
|
return R.fail("暂无表单!");
|
|
}
|
|
}
|
|
|
|
|
|
- String fileUrl = wbsTreeContract.getHtmlUrl();
|
|
|
|
- InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
|
|
|
|
-
|
|
|
|
- String htmlString = IoUtil.readToString(fileInputStream);
|
|
|
|
- htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
|
|
|
|
- htmlString = htmlString.replaceAll("title", "titlexx");
|
|
|
|
-
|
|
|
|
- // 远程搜索配置
|
|
|
|
- Document doc = Jsoup.parse(htmlString);
|
|
|
|
- int maxCol = doc.select("Col").size();
|
|
|
|
- Element table = doc.select("table").first();
|
|
|
|
- Elements hc = doc.select("hc-form-select-search");
|
|
|
|
- if (hc.size() >= 1) {
|
|
|
|
- for (int i = 0; i < hc.size(); i++) {
|
|
|
|
- Element datax = hc.get(i);
|
|
|
|
- datax.removeAttr("pkeyId");
|
|
|
|
- datax.removeAttr("contractId");
|
|
|
|
- datax.attr("pkeyId", pkeyId + "");
|
|
|
|
- datax.attr("contractId", wbsTreeContract.getContractId());
|
|
|
|
|
|
+ try {
|
|
|
|
+ String fileUrl = wbsTreeContract.getHtmlUrl();
|
|
|
|
+ InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
|
|
|
|
+
|
|
|
|
+ String htmlString = IoUtil.readToString(fileInputStream);
|
|
|
|
+ htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
|
|
|
|
+ htmlString = htmlString.replaceAll("title", "titlexx");
|
|
|
|
+
|
|
|
|
+ // 远程搜索配置
|
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
|
+ int maxCol = doc.select("Col").size();
|
|
|
|
+ Element table = doc.select("table").first();
|
|
|
|
+ Elements hc = doc.select("hc-form-select-search");
|
|
|
|
+ if (hc.size() >= 1) {
|
|
|
|
+ for (int i = 0; i < hc.size(); i++) {
|
|
|
|
+ Element datax = hc.get(i);
|
|
|
|
+ datax.removeAttr("pkeyId");
|
|
|
|
+ datax.removeAttr("contractId");
|
|
|
|
+ datax.attr("pkeyId", pkeyId + "");
|
|
|
|
+ datax.attr("contractId", wbsTreeContract.getContractId());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- // 远程搜索配置2-设计强度搜索
|
|
|
|
- Elements hc2 = doc.select("hc-form-select-search2");
|
|
|
|
- if (hc2.size() >= 1) {
|
|
|
|
- for (int i = 0; i < hc2.size(); i++) {
|
|
|
|
- Element datax = hc2.get(i);
|
|
|
|
- datax.removeAttr("contractId");
|
|
|
|
- datax.attr("contractId", wbsTreeContract.getContractId());
|
|
|
|
|
|
+ // 远程搜索配置2-设计强度搜索
|
|
|
|
+ Elements hc2 = doc.select("hc-form-select-search2");
|
|
|
|
+ if (hc2.size() >= 1) {
|
|
|
|
+ for (int i = 0; i < hc2.size(); i++) {
|
|
|
|
+ Element datax = hc2.get(i);
|
|
|
|
+ datax.removeAttr("contractId");
|
|
|
|
+ datax.attr("contractId", wbsTreeContract.getContractId());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- // 标题解决
|
|
|
|
- ProjectInfo projectInfo = projectInfoService.getById(wbsTreeContract.getProjectId());
|
|
|
|
- //判断是否是水利水电表,水利水电项目名14,表名12 。 其他表都是18
|
|
|
|
- Boolean isWater = false;
|
|
|
|
- ExcelTab tab = excelTabMapper.getWaterByTableId(wbsTreeContract.getExcelId());
|
|
|
|
- if (tab != null) {
|
|
|
|
- isWater = true;
|
|
|
|
- }
|
|
|
|
|
|
+ // 标题解决
|
|
|
|
+ ProjectInfo projectInfo = projectInfoService.getById(wbsTreeContract.getProjectId());
|
|
|
|
+ //判断是否是水利水电表,水利水电项目名14,表名12 。 其他表都是18
|
|
|
|
+ Boolean isWater = false;
|
|
|
|
+ ExcelTab tab = excelTabMapper.getWaterByTableId(wbsTreeContract.getExcelId());
|
|
|
|
+ if (tab != null) {
|
|
|
|
+ isWater = true;
|
|
|
|
+ }
|
|
|
|
|
|
- // 添加标题显示
|
|
|
|
- Elements trs = table.select("tr");
|
|
|
|
- for (int i = 1; i < 6; i++) {
|
|
|
|
- Element tr = trs.get(i);
|
|
|
|
- Elements tds = tr.select("td");
|
|
|
|
- for (int j = 0; j < tds.size(); j++) {
|
|
|
|
- Element data = tds.get(j);
|
|
|
|
- int colspan = data.attr("COLSPAN").equals("") ? 0 : Integer.parseInt(data.attr("COLSPAN"));
|
|
|
|
- String style = data.attr("style");
|
|
|
|
- if (style.indexOf("font-size") >= 0) {
|
|
|
|
- int fontsize = Integer.parseInt(style.substring(style.indexOf("font-size:") + 10, style.indexOf(".0pt")));
|
|
|
|
- if (isWater) {
|
|
|
|
- if (StringUtils.isNotEmpty(data.text()) && fontsize >= 12) {
|
|
|
|
- trs.get(i - 1).select("td").get(0).text(projectInfo.getProjectName());
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (StringUtils.isNotEmpty(data.text()) && fontsize >= 14) {
|
|
|
|
- trs.get(i - 1).select("td").get(0).text(projectInfo.getProjectName());
|
|
|
|
|
|
+ // 添加标题显示
|
|
|
|
+ Elements trs = table.select("tr");
|
|
|
|
+ for (int i = 1; i < 6; i++) {
|
|
|
|
+ Element tr = trs.get(i);
|
|
|
|
+ Elements tds = tr.select("td");
|
|
|
|
+ for (int j = 0; j < tds.size(); j++) {
|
|
|
|
+ Element data = tds.get(j);
|
|
|
|
+ int colspan = data.attr("COLSPAN").equals("") ? 0 : Integer.parseInt(data.attr("COLSPAN"));
|
|
|
|
+ String style = data.attr("style");
|
|
|
|
+ if (style.indexOf("font-size") >= 0) {
|
|
|
|
+ int fontsize = Integer.parseInt(style.substring(style.indexOf("font-size:") + 10, style.indexOf(".0pt")));
|
|
|
|
+ if (isWater) {
|
|
|
|
+ if (StringUtils.isNotEmpty(data.text()) && fontsize >= 12) {
|
|
|
|
+ trs.get(i - 1).select("td").get(0).text(projectInfo.getProjectName());
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (StringUtils.isNotEmpty(data.text()) && fontsize >= 14) {
|
|
|
|
+ trs.get(i - 1).select("td").get(0).text(projectInfo.getProjectName());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- // 获取公式颜色
|
|
|
|
- String tabName = wbsTreeContract.getInitTableName();
|
|
|
|
- // 字段查询 获取公式字段
|
|
|
|
|
|
+ // 获取公式颜色
|
|
|
|
+ String tabName = wbsTreeContract.getInitTableName();
|
|
|
|
+ // 字段查询 获取公式字段
|
|
// String colkeys = "SELECT e_key from m_table_info a ,m_wbs_form_element b WHERE a.tab_en_name = '" + tabName + "' and a.id=b.f_id and b.id in(SELECT element_id from m_element_formula_mapping c where c.is_deleted=0) ";
|
|
// String colkeys = "SELECT e_key from m_table_info a ,m_wbs_form_element b WHERE a.tab_en_name = '" + tabName + "' and a.id=b.f_id and b.id in(SELECT element_id from m_element_formula_mapping c where c.is_deleted=0) ";
|
|
//
|
|
//
|
|
// List<Map<String, Object>> maps = jdbcTemplate.queryForList(colkeys);
|
|
// List<Map<String, Object>> maps = jdbcTemplate.queryForList(colkeys);
|
|
@@ -723,16 +724,19 @@ public class ExcelTabController extends BladeController {
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
- WbsTreeContract process = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
|
- .eq(WbsTreeContract::getId, wbsTreeContract.getParentId())
|
|
|
|
- .eq(WbsTreeContract::getContractId, wbsTreeContract.getContractId())
|
|
|
|
- .eq(WbsTreeContract::getWbsId, wbsTreeContract.getWbsId()).last("limit 1"));
|
|
|
|
- if (process != null) {
|
|
|
|
- this.excelTabService.gsColor(pkeyId, process.getPKeyId().toString(), wbsTreeContract.getProjectId(), doc);
|
|
|
|
|
|
+ WbsTreeContract process = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
|
+ .eq(WbsTreeContract::getId, wbsTreeContract.getParentId())
|
|
|
|
+ .eq(WbsTreeContract::getContractId, wbsTreeContract.getContractId())
|
|
|
|
+ .eq(WbsTreeContract::getWbsId, wbsTreeContract.getWbsId()).last("limit 1"));
|
|
|
|
+ if (process != null) {
|
|
|
|
+ this.excelTabService.gsColor(pkeyId, process.getPKeyId().toString(), wbsTreeContract.getProjectId(), doc);
|
|
|
|
+ }
|
|
|
|
+ doc.select("Col").remove();
|
|
|
|
+ fileInputStream.close();
|
|
|
|
+ return R.data(table + "");
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ return R.fail("暂无表单!");
|
|
}
|
|
}
|
|
- doc.select("Col").remove();
|
|
|
|
- fileInputStream.close();
|
|
|
|
- return R.data(table + "");
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2106,7 +2110,7 @@ public class ExcelTabController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- @PostMapping("/save_buss_data")
|
|
|
|
|
|
+ @PostMapping("/save_buss_data2")
|
|
@ApiOperationSupport(order = 13)
|
|
@ApiOperationSupport(order = 13)
|
|
@ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存")
|
|
@ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存")
|
|
public R saveBussData2(@Valid @RequestBody JSONObject dataInfo) throws Exception {
|
|
public R saveBussData2(@Valid @RequestBody JSONObject dataInfo) throws Exception {
|
|
@@ -3541,7 +3545,7 @@ public class ExcelTabController extends BladeController {
|
|
@ApiImplicitParams(value = {
|
|
@ApiImplicitParams(value = {
|
|
@ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
|
|
@ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
|
|
})
|
|
})
|
|
- public R getHtmlBussCols(Long pkeyId) throws Exception {
|
|
|
|
|
|
+ public R getHtmlBussCols(Long pkeyId) {
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
|
|
String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
@@ -3552,51 +3556,54 @@ public class ExcelTabController extends BladeController {
|
|
if (wbsTreeContract.getHtmlUrl() == null) {
|
|
if (wbsTreeContract.getHtmlUrl() == null) {
|
|
return R.fail("暂无表单!");
|
|
return R.fail("暂无表单!");
|
|
}
|
|
}
|
|
|
|
+ try {
|
|
|
|
+ String fileUrl = wbsTreeContract.getHtmlUrl();
|
|
|
|
+ File file1 = ResourceUtil.getFile(fileUrl);
|
|
|
|
+ InputStream fileInputStream = null;
|
|
|
|
+ if (file1.exists()) {
|
|
|
|
+ fileInputStream = new FileInputStream(file1);
|
|
|
|
+ } else {
|
|
|
|
+ String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
|
|
|
|
+ fileInputStream = CommonUtil.getOSSInputStream(path);
|
|
|
|
+ }
|
|
|
|
|
|
- String fileUrl = wbsTreeContract.getHtmlUrl();
|
|
|
|
- File file1 = ResourceUtil.getFile(fileUrl);
|
|
|
|
- InputStream fileInputStream = null;
|
|
|
|
- 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);
|
|
|
|
- // 解析 style
|
|
|
|
- Document doc = Jsoup.parse(htmlString);
|
|
|
|
- Element table = doc.select("table").first();
|
|
|
|
- Elements trs = table.select("tr");
|
|
|
|
|
|
|
|
- List<List<String>> redata = new ArrayList<>();
|
|
|
|
- for (int i = 0; i < trs.size(); i++) {
|
|
|
|
- Element tr = trs.get(i);
|
|
|
|
- Elements tds = tr.select("td");
|
|
|
|
- List<String> tdList = new ArrayList<>();
|
|
|
|
- for (int j = 0; j < tds.size(); j++) {
|
|
|
|
- Element element = tds.get(j);
|
|
|
|
- if (element.html().indexOf("el-tooltip") >= 0) {
|
|
|
|
- element = element.children().get(0);
|
|
|
|
- }
|
|
|
|
- if (element.children().size() >= 1) {
|
|
|
|
- String keyname = element.children().get(0).attr("keyname");
|
|
|
|
- if (StringUtils.isNotEmpty(keyname)) {
|
|
|
|
- tdList.add(keyname);
|
|
|
|
|
|
+ String htmlString = IoUtil.readToString(fileInputStream);
|
|
|
|
+ // 解析 style
|
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
|
+ Element table = doc.select("table").first();
|
|
|
|
+ Elements trs = table.select("tr");
|
|
|
|
+
|
|
|
|
+ List<List<String>> redata = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < trs.size(); i++) {
|
|
|
|
+ Element tr = trs.get(i);
|
|
|
|
+ Elements tds = tr.select("td");
|
|
|
|
+ List<String> tdList = new ArrayList<>();
|
|
|
|
+ for (int j = 0; j < tds.size(); j++) {
|
|
|
|
+ Element element = tds.get(j);
|
|
|
|
+ if (element.html().indexOf("el-tooltip") >= 0) {
|
|
|
|
+ element = element.children().get(0);
|
|
|
|
+ }
|
|
|
|
+ if (element.children().size() >= 1) {
|
|
|
|
+ String keyname = element.children().get(0).attr("keyname");
|
|
|
|
+ if (StringUtils.isNotEmpty(keyname)) {
|
|
|
|
+ tdList.add(keyname);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (tdList != null && tdList.size() >= 1) {
|
|
|
|
+ redata.add(tdList);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (tdList != null && tdList.size() >= 1) {
|
|
|
|
- redata.add(tdList);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
- String[][] res = new String[redata.size()][]; // 存放转换结果的 二维数组
|
|
|
|
- for (int i = 0; i < res.length; i++) { // 转换方法
|
|
|
|
- res[i] = redata.get(i).toArray(new String[redata.get(i).size()]);
|
|
|
|
|
|
+ String[][] res = new String[redata.size()][]; // 存放转换结果的 二维数组
|
|
|
|
+ for (int i = 0; i < res.length; i++) { // 转换方法
|
|
|
|
+ res[i] = redata.get(i).toArray(new String[redata.get(i).size()]);
|
|
|
|
+ }
|
|
|
|
+ return R.data(res);
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ return R.fail("暂无表单!");
|
|
}
|
|
}
|
|
- return R.data(res);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -3843,7 +3850,7 @@ public class ExcelTabController extends BladeController {
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
- @PostMapping("/save_buss_data2")
|
|
|
|
|
|
+ @PostMapping("/save_buss_data")
|
|
@ApiOperationSupport(order = 13)
|
|
@ApiOperationSupport(order = 13)
|
|
@ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存")
|
|
@ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存")
|
|
public R saveBussData(@Valid @RequestBody JSONObject dataInfo) throws Exception {
|
|
public R saveBussData(@Valid @RequestBody JSONObject dataInfo) throws Exception {
|