|
@@ -22,7 +22,6 @@ import org.springblade.manager.entity.WbsTreeContract;
|
|
|
import org.springblade.manager.feign.ContractClient;
|
|
|
import org.springblade.manager.service.IWbsTreeContractService;
|
|
|
import org.springblade.manager.service.impl.WbsTreeContractServiceImpl;
|
|
|
-import org.springblade.manager.utils.CssSelectorEscaper;
|
|
|
import org.springblade.manager.utils.ExcelParser;
|
|
|
import org.springblade.manager.vo.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -248,15 +247,40 @@ public class WbsTreeContractController extends BladeController {
|
|
|
ExcelTab excelTab = jdbcTemplate.queryForObject("select file_url,name from m_excel_tab where id = " + tab.getExcelId(), new BeanPropertyRowMapper<>(ExcelTab.class));
|
|
|
if (excelTab != null) {
|
|
|
InputStream inputStream = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
|
|
|
- try (Workbook workbook = parseExcelFile(inputStream)) {
|
|
|
+ if (inputStream != null) {
|
|
|
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
|
|
response.setCharacterEncoding("UTF-8");
|
|
|
response.setHeader("Content-disposition", ";filename=" + URLEncoder.encode(excelTab.getName().replace(" ", ""), "UTF-8") + ".xlsx");
|
|
|
ServletOutputStream servletOutputStream = response.getOutputStream();
|
|
|
- workbook.write(servletOutputStream);
|
|
|
+ byte[] buffer = new byte[4096];
|
|
|
+ int bytesRead;
|
|
|
+ while ((bytesRead = inputStream.read(buffer)) != -1) {
|
|
|
+ servletOutputStream.write(buffer, 0, bytesRead);
|
|
|
+ }
|
|
|
servletOutputStream.flush();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ inputStream.close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /*public void downloadExcel(@RequestParam String pKeyId, HttpServletResponse response) throws Exception {
|
|
|
+ WbsTreeContract tab = iWbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, pKeyId));
|
|
|
+ if (tab != null && Objects.nonNull(tab.getExcelId())) {
|
|
|
+ ExcelTab excelTab = jdbcTemplate.queryForObject("select file_url,name from m_excel_tab where id = " + tab.getExcelId(), new BeanPropertyRowMapper<>(ExcelTab.class));
|
|
|
+ if (excelTab != null) {
|
|
|
+ InputStream inputStream = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
|
|
|
+ if (inputStream != null) {
|
|
|
+ try (Workbook workbook = parseExcelFile(inputStream)) {
|
|
|
+ response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
|
|
+ response.setCharacterEncoding("UTF-8");
|
|
|
+ response.setHeader("Content-disposition", ";filename=" + URLEncoder.encode(excelTab.getName().replace(" ", ""), "UTF-8") + ".xlsx");
|
|
|
+ ServletOutputStream servletOutputStream = response.getOutputStream();
|
|
|
+ workbook.write(servletOutputStream);
|
|
|
+ servletOutputStream.flush();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -278,7 +302,7 @@ public class WbsTreeContractController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
return workbook;
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
@PostMapping("/import-excel")
|
|
|
@ApiOperationSupport(order = 14)
|
|
@@ -299,13 +323,6 @@ public class WbsTreeContractController extends BladeController {
|
|
|
for (Map.Entry<String, String> stringStringEntry : stringStringMap.entrySet()) {
|
|
|
String value = stringStringEntry.getValue();
|
|
|
if (StringUtils.isNotEmpty(value)) {
|
|
|
- /*String escape = CssSelectorEscaper.escape(value);
|
|
|
- String selectorTitle = "td:containsOwn(" + escape + ")";
|
|
|
- Elements tdElementsTitle = doc.select(selectorTitle);
|
|
|
- //如果找到了匹配的<td>元素,说明是固定的标题,跳过当前循环,只保留填写的excel数据
|
|
|
- if (!tdElementsTitle.isEmpty()) {
|
|
|
- continue;
|
|
|
- }*/
|
|
|
String[] split = stringStringEntry.getKey().split("_");
|
|
|
int row = Integer.parseInt(split[0]) + 1;
|
|
|
int cell = Integer.parseInt(split[1]) + 1;
|
|
@@ -374,5 +391,12 @@ public class WbsTreeContractController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/getConcealedWorksNodeTree")
|
|
|
+ @ApiOperationSupport(order = 15)
|
|
|
+ @ApiOperation(value = "获取合同段隐蔽工程节点树", notes = "传入合同段id")
|
|
|
+ public R<List<WbsTreeContractLazyVO>> getConcealedWorksNodeTree(@RequestParam String contractId) {
|
|
|
+ List<WbsTreeContractLazyVO> result = iWbsTreeContractService.getConcealedWorksNodeTree(contractId);
|
|
|
+ return R.data(result);
|
|
|
+ }
|
|
|
|
|
|
}
|