فهرست منبع

资料填报表单隐藏,显示附件

qianxb 1 سال پیش
والد
کامیت
0516fe0821

+ 26 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -63,6 +63,7 @@ import org.springblade.resource.vo.NewBladeFile;
 import org.springblade.system.cache.ParamCache;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -1965,13 +1966,17 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "pkeyId", value = "主键id", required = true),
             @ApiImplicitParam(name = "status", value = "状态(1显示 2隐藏)", required = true)
     })
-    public R showBussTab(Long pkeyId, int status) throws FileNotFoundException {
+    @Transactional
+    public R showBussTab(Long pkeyId, int status,String nodeId,String classify) throws Exception {
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
                 .eq(WbsTreeContract::getPKeyId, pkeyId));
         UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
         updateWrapper.in("p_key_id", pkeyId);
         updateWrapper.set("is_buss_show", status);
         wbsTreeContractService.update(updateWrapper);
+        excelTabService.getBussPdfInfo(pkeyId);
+        //重新生成PDF修改queryInfo
+        excelTabService.getBussPdfs(nodeId, classify, wbsTreeContract.getContractId(), wbsTreeContract.getProjectId());
         return R.data("成功");
     }
 
@@ -1984,7 +1989,25 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "contractId", value = "合同段Id", required = true)
     })
     public R getPdfS(String nodeId, String classify, String contractId) throws FileNotFoundException {
-        String sql = "select pdf_url,e_visa_pdf_url,pdf_trial_url,pdf_trial_url_position from u_information_query where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id='" + contractId + "'";
+        //获取节点下的所有表单,和附件,如果表单全是隐藏的,并且没有附件,则提示暂无数据
+//        WbsTreeContract node = wbsTreeContractService.getOne(new LambdaQueryWrapper<WbsTreeContract>().eq(WbsTreeContract::getPKeyId,nodeId));
+//        List<WbsTreeContract> list = wbsTreeContractService.list(new LambdaQueryWrapper<WbsTreeContract>().eq(WbsTreeContract::getParentId, node.getId()).eq(WbsTreeContract::getContractId, contractId));
+//        tableInfoService.list(new LambdaQueryWrapper<ta>())
+//        if (list != null && list.size() > 0){
+//            Boolean isShow = true;
+//            for (WbsTreeContract contract : list) {
+//                if (contract.getIsBussShow() == 1){
+//                    isShow = false;
+//                    break;
+//                }
+//            }
+//            if (isShow){
+//                return R.fail("无历史数据预览,请保存数据");
+//            }
+//        }else {
+//            return R.fail("无历史数据预览,请保存数据");
+//        }
+        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);
         if (maps.size() >= 1) {
             Map<String, Object> stringObjectMap = maps.get(0);
@@ -2000,7 +2023,7 @@ public class ExcelTabController extends BladeController {
             }
 
             if (StringUtils.isEmpty(pdfUrl) || pdfUrl.equals("null")) {
-                return R.fail("获取PDF失败");
+                return R.fail("暂无PDF数据");
             } else {
                 return R.data(pdfUrl);
             }

+ 9 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -1668,7 +1668,13 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         List<TableFile> tableFileList = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getIsDeleted, 0));
         tableFileList.sort(Comparator.comparing(TableFile::getType));
 
-        List<String> dataListPdf = tableFileList.stream().filter(tableFile -> tableFile.getDomainPdfUrl() != null && (tableFile.getType() == 1 || tableFile.getType() == 2)).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
+        List<String> dataListPdf = new ArrayList<>();
+        if(wbsTreeContract.getIsBussShow() == 1){
+            dataListPdf = tableFileList.stream().filter(tableFile -> tableFile.getDomainPdfUrl() != null && (tableFile.getType() == 1 || tableFile.getType() == 2)).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
+        }else{
+            dataListPdf = tableFileList.stream().filter(tableFile -> tableFile.getDomainPdfUrl() != null && tableFile.getType() == 2).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
+        }
+//        List<String> dataListPdf = tableFileList.stream().filter(tableFile -> tableFile.getDomainPdfUrl() != null && (tableFile.getType() == 1 || tableFile.getType() == 2)).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
 
         String pdfPath2 = file_path + "/pdf//" + pkeyId + "_2.pdf";
 
@@ -1705,7 +1711,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         if (wbsTreeContractList != null && wbsTreeContractList.size() >= 1) {
             for (WbsTreeContract wbsInfo : wbsTreeContractList) {
                 // 隐藏的不生成pdf
-                if (wbsInfo.getIsBussShow() == null || wbsInfo.getIsBussShow() != 2) { //
+//                if (wbsInfo.getIsBussShow() == null || wbsInfo.getIsBussShow() != 2) { //
                     if (StringUtils.isNotEmpty(wbsInfo.getPdfUrl())) {
                         data.add(wbsInfo.getPdfUrl());
                     } else {
@@ -1714,7 +1720,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                             data.add(bussPdfInfo.getData() + "");
                         }
                     }
-                }
+//                }
             }
         }