|
@@ -64,6 +64,8 @@ import org.springblade.resource.feign.IOSSClient;
|
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
|
import org.springblade.resource.vo.NewBladeFile;
|
|
|
import org.springblade.system.cache.ParamCache;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -117,15 +119,12 @@ public class ExcelTabController extends BladeController {
|
|
|
// 元素信息表-
|
|
|
private final IWbsTreeContractService wbsTreeContractService;
|
|
|
|
|
|
- private final WbsTreeContractServiceImpl wbsTreeContractServiceImpl;
|
|
|
-
|
|
|
private final WbsTreePrivateMapper wbsTreePrivateMapper;
|
|
|
|
|
|
private final JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
private final ExcelTabMapper excelTabMapper;
|
|
|
|
|
|
-
|
|
|
// 表单附件信息
|
|
|
private final ITableFileService tableFileService;
|
|
|
|
|
@@ -148,6 +147,8 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
private final IWbsParamService wbsParamService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ StringRedisTemplate RedisTemplate;
|
|
|
|
|
|
/**
|
|
|
* 详情
|
|
@@ -624,7 +625,7 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiImplicitParams(value = {
|
|
|
@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()
|
|
|
.eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
@@ -635,74 +636,75 @@ public class ExcelTabController extends BladeController {
|
|
|
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) ";
|
|
|
//
|
|
|
// List<Map<String, Object>> maps = jdbcTemplate.queryForList(colkeys);
|
|
@@ -723,16 +725,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 + "");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1815,7 +1820,7 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
|
|
|
})
|
|
|
public R getBussDataInfo(Long pkeyId) throws FileNotFoundException {
|
|
|
- return excelTabService.getBussDataInfo(pkeyId, 0);
|
|
|
+ return R.data(excelTabService.getBussDataInfo(pkeyId, 0));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -2011,6 +2016,12 @@ public class ExcelTabController extends BladeController {
|
|
|
})
|
|
|
public R getPdfS(String nodeId, String classify, String contractId) throws FileNotFoundException {
|
|
|
String file_path = FileUtils.getSysLocalFileUrl();
|
|
|
+ Boolean aBoolean = RedisTemplate.hasKey("pdf-" + nodeId+"-"+classify);
|
|
|
+ if(aBoolean){
|
|
|
+ Long expire = RedisTemplate.getExpire("pdf-" + nodeId + "-" + classify);
|
|
|
+ return R.fail("pdf正在生成,还有"+expire+"秒");
|
|
|
+ }
|
|
|
+
|
|
|
//获取节点下的所有表单,和附件,如果表单全是隐藏的,并且没有附件,则提示暂无数据
|
|
|
String sql = "select pdf_url,e_visa_pdf_url,pdf_trial_url,pdf_trial_url_position,status from u_information_query where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id='" + contractId + "'";
|
|
|
List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
|
|
@@ -2106,7 +2117,7 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @PostMapping("/save_buss_data")
|
|
|
+ @PostMapping("/save_buss_data111")
|
|
|
@ApiOperationSupport(order = 13)
|
|
|
@ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存")
|
|
|
public R saveBussData2(@Valid @RequestBody JSONObject dataInfo) throws Exception {
|
|
@@ -2175,6 +2186,7 @@ public class ExcelTabController extends BladeController {
|
|
|
if (tableInfoList != null) {
|
|
|
for (TableInfo tableInfo : tableInfoList) {
|
|
|
R bussPdfInfo = excelTabService.getBussPdfInfo(Long.parseLong(tableInfo.getPkeyId()));
|
|
|
+
|
|
|
if (ObjectUtil.isEmpty(bussPdfInfo) || bussPdfInfo.getCode() != 200) {
|
|
|
//如果返回的单张pdfUrl为空,那么表示发生异常,返回异常信息
|
|
|
errorPKeyIds.add(tableInfo.getPkeyId());
|
|
@@ -3541,7 +3553,7 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiImplicitParams(value = {
|
|
|
@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 sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
|
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
@@ -3552,51 +3564,54 @@ public class ExcelTabController extends BladeController {
|
|
|
if (wbsTreeContract.getHtmlUrl() == null) {
|
|
|
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 +3858,7 @@ public class ExcelTabController extends BladeController {
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
- @PostMapping("/save_buss_data2")
|
|
|
+ @PostMapping("/save_buss_data")
|
|
|
@ApiOperationSupport(order = 13)
|
|
|
@ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存")
|
|
|
public R saveBussData(@Valid @RequestBody JSONObject dataInfo) throws Exception {
|
|
@@ -3855,7 +3870,11 @@ public class ExcelTabController extends BladeController {
|
|
|
dataArray.add(dataInfo);
|
|
|
}
|
|
|
this.excelTabService.formulaFillData2(dataArray, ExecuteType.INSPECTION);
|
|
|
- return excelTabService.saveBussData(dataArray);
|
|
|
+ if(dataArray!=null && dataArray.size()>=1){
|
|
|
+ return excelTabService.saveBussData(dataArray);
|
|
|
+ }else{
|
|
|
+ return R.fail("公式报错,导致保存接口无入参数");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -3896,7 +3915,6 @@ public class ExcelTabController extends BladeController {
|
|
|
} else {
|
|
|
return R.data("请上传pdf");
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -3937,8 +3955,7 @@ public class ExcelTabController extends BladeController {
|
|
|
if (tableAll != null && tableAll.size() >= 1) {
|
|
|
for (AppWbsTreeContractVO tab : tableAll) {
|
|
|
try {
|
|
|
- R bussDataInfo = excelTabService.getBussDataInfo(tab.getPKeyId(), 0);
|
|
|
- Map<String, Object> jo = (Map<String, Object>) bussDataInfo.getData();
|
|
|
+ Map<String, Object> jo = excelTabService.getBussDataInfo(tab.getPKeyId(), 0);
|
|
|
String s = new Gson().toJson(jo);
|
|
|
//字符串转jsonobject
|
|
|
JSONObject obj = JSON.parseObject(s);
|