liuyc 2 vuotta sitten
vanhempi
commit
d17673c19d

+ 2 - 2
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDetectionDataServiceImpl.java

@@ -213,7 +213,7 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
         List<String> names = trialSampleInfoList.stream().map(TrialSampleInfo::getMaterialName).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
         List<String> numbers = trialSampleInfoList.stream().map(TrialSampleInfo::getSpecificationNumber).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
         List<String> descriptions = trialSampleInfoList.stream().map(TrialSampleInfo::getSampleDescription).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
-        List<String> counts = trialSampleInfoList.stream().map(TrialSampleInfo::getMaterialCount).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
+        List<Integer> counts = trialSampleInfoList.stream().map(TrialSampleInfo::getMaterialCount).filter(ObjectUtil::isNotEmpty).map(Integer::valueOf).collect(Collectors.toList());
         List<Date> samplingDate = trialSampleInfoList.stream().map(TrialSampleInfo::getSamplingDate).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
 
         List<Map<String, String>> resultMapList = new ArrayList<>();
@@ -257,7 +257,7 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
                         for (Element element : ypCount) {
                             int trIndex = Integer.parseInt(element.attr("trindex"));
                             if (trIndex <= 6) {
-                                map.put(element.attr("keyName"), ObjectUtils.isNotEmpty(counts) ? counts.stream().map(Integer::valueOf).reduce(Integer::sum).orElse(0).toString() : "");
+                                map.put(element.attr("keyName"), ObjectUtils.isNotEmpty(counts) ? counts.stream().reduce(Integer::sum).orElse(0).toString() : "");
                             }
                         }
                     }

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/TableFileController.java

@@ -130,7 +130,7 @@ public class TableFileController extends BladeController {
 
         Long pkeyId = Long.parseLong(tableFile.getTabId() + "");
         //单pdf
-        excelTabService.getBussPDFTrial(pkeyId, contractId, id);
+        excelTabService.getBussPDFTrial(pkeyId, contractId, id, 0, 0);
 
         WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
                 .eq(WbsTreePrivate::getPKeyId, pkeyId));

+ 3 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ExcelTabClientImpl.java

@@ -51,7 +51,7 @@ public class ExcelTabClientImpl implements ExcelTabClient {
     }
 
     @Override
-    public String saveTabData(TrialSelfInspectionRecordDTO dto, Integer isBatchSave,Integer type, String tableType, Long id, String tabIds) throws Exception {
+    public String saveTabData(TrialSelfInspectionRecordDTO dto, Integer isBatchSave, Integer type, String tableType, Long id, String tabIds) throws Exception {
         //通用参数
         String pdfUrl = "";
         JSONArray dataArray = dto.getDataInfo().getJSONArray("orderList");
@@ -79,7 +79,7 @@ public class ExcelTabClientImpl implements ExcelTabClient {
             assert tableInfo != null;
             if (tabIds.contains(tableInfo.getPkeyId())) {
                 //构造pdf
-                excelTabService.getBussPDFTrial(Long.valueOf(tableInfo.getPkeyId()), contractId, id);
+                excelTabService.getBussPDFTrial(Long.valueOf(tableInfo.getPkeyId()), contractId, id, 0, 0);
 
                 //重新合并pdf
                 String sql = "select pdf_url from u_trial_self_data_record where record_id = " + id;
@@ -130,7 +130,7 @@ public class ExcelTabClientImpl implements ExcelTabClient {
 
     @Override
     public void getBussPDFTrial(Long pkeyId, String contractId, String id) throws Exception {
-        excelTabService.getBussPDFTrial(pkeyId, contractId, Long.parseLong(id));
+        excelTabService.getBussPDFTrial(pkeyId, contractId, Long.parseLong(id), 0, 0);
     }
 
     @Override

+ 3 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IExcelTabService.java

@@ -106,7 +106,7 @@ public interface IExcelTabService extends BaseService<ExcelTab> {
     Map<String, String> getTablbCols(String pkeyid, String colkey) throws FileNotFoundException;
 
     // 获取用户端 单个表单接口数据
-    R getBussDataInfo(Long pkeyId,int type);
+    R getBussDataInfo(Long pkeyId, int type);
 
     // 单个pdf 生成
     R getBussPdfInfo(Long pkeyId) throws Exception;
@@ -129,7 +129,7 @@ public interface IExcelTabService extends BaseService<ExcelTab> {
     /**
      * 获取试验用户端 单个表单接口数据
      */
-    List<Map<String, Object>> getBussDataInfoTrial(Long id, Long pkeyId,Long contractId);
+    List<Map<String, Object>> getBussDataInfoTrial(Long id, Long pkeyId, Long contractId);
 
     /**
      * 获取试验用户端 单个表单接口数据 - 关联施工
@@ -139,7 +139,7 @@ public interface IExcelTabService extends BaseService<ExcelTab> {
     /**
      * 单PDF 生成 - 试验
      */
-    String getBussPDFTrial(Long pKeyId, String contractId, Long id) throws Exception;
+    String getBussPDFTrial(Long pKeyId, String contractId, Long id, int pageNumber, int pageNumberCount) throws Exception;
 
     /**
      * 多PDF 合并 - 试验

+ 32 - 26
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -30,6 +30,7 @@ import com.mixsmart.utils.RegexUtils;
 import com.spire.xls.CellRange;
 import com.spire.xls.Workbook;
 import com.spire.xls.*;
+import com.spire.xls.core.spreadsheet.collections.XlsHeaderFooterShapeCollection;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang3.ObjectUtils;
@@ -796,7 +797,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 //保存操作记录
                 this.operationLogClient.saveUserOperationLog(1, "资料填报", "工序填报页面", json);
                 // 更新redis
-                informationQueryClient.AsyncWbsTree(wbsTreeContract.getParentId()+"",wbsTreeContract.getParentId()+"",wbsTreeContract.getContractId(),"","1");
+                informationQueryClient.AsyncWbsTree(wbsTreeContract.getParentId() + "", wbsTreeContract.getParentId() + "", wbsTreeContract.getContractId(), "", "1");
             } catch (Exception e) {
                 e.printStackTrace();
                 return R.fail("操作失败");
@@ -1877,7 +1878,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
      * 试验 单pdf
      */
     @Override
-    public String getBussPDFTrial(Long pkeyId, String contractId, Long id) throws Exception {
+    public String getBussPDFTrial(Long pkeyId, String contractId, Long id, int pageNumber, int pageNumberCount) throws Exception {
         String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
         WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
                 .eq(WbsTreePrivate::getPKeyId, pkeyId));
@@ -1911,16 +1912,12 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
         //获取工作表
         Worksheet sheet = wb.getWorksheets().get(0);
-        /*//标题添加
-        ProjectInfo projectInfo = projectInfoService.getById(wbsTreePrivate.getProjectId());
-        CellRange[] columns = sheet.getMergedCells();
-        for (CellRange cellRange : columns) {
-            if (cellRange.getStyle().getFont().getSize() >= 17) {
-                cellRange.setText(projectInfo.getProjectName());
-                cellRange.getStyle().getFont().setSize(20);
-                break;
-            }
-        }*/
+
+        //页码
+        PageSetup pageSetup = sheet.getPageSetup();
+        if (pageNumber != 0 && pageNumberCount != 0) {
+            pageSetup.setRightHeader("第" + pageNumber + "页,共" + pageNumberCount + "页");
+        }
 
         //数据不为空
         if (StringUtils.isNotEmpty(wbsTreePrivate.getHtmlUrl())) {
@@ -2135,23 +2132,32 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         List<WbsTreePrivate> recordTable = queryList.stream().filter(f -> f.getTableType() == 1).collect(Collectors.toList());
 
         if (queryList.size() > 0) {
-            for (WbsTreePrivate report : reportTable) {
-                //没有excel表单的不生成pdf
-                if (StringUtils.isNotEmpty(report.getHtmlUrl())) {
-                    //生成报告单pdf
-                    String bussPdfInfo = this.getBussPDFTrial(report.getPKeyId(), contractId, id);
-                    if (StringUtils.isNotEmpty(bussPdfInfo)) {
-                        dataPdfUrls.add(bussPdfInfo);
+            int reportPageNumber = 1;
+            int reportPageNumberCount = reportTable.size();
+            if (reportTable.size() > 0) {
+                for (WbsTreePrivate report : reportTable) {
+                    //没有excel表单的不生成pdf
+                    if (StringUtils.isNotEmpty(report.getHtmlUrl())) {
+                        //生成报告单pdf
+                        String bussPdfInfo = this.getBussPDFTrial(report.getPKeyId(), contractId, id, reportPageNumber++, reportPageNumberCount);
+                        if (StringUtils.isNotEmpty(bussPdfInfo)) {
+                            dataPdfUrls.add(bussPdfInfo);
+                        }
                     }
                 }
             }
-            for (WbsTreePrivate record : recordTable) {
-                //没有excel表单的不生成pdf
-                if (StringUtils.isNotEmpty(record.getHtmlUrl())) {
-                    //生成记录表pdf
-                    String bussPdfInfo = this.getBussPDFTrial(record.getPKeyId(), contractId, id);
-                    if (StringUtils.isNotEmpty(bussPdfInfo)) {
-                        dataPdfUrls.add(bussPdfInfo);
+
+            int recordPageNumber = 1;
+            int recordPageNumberCount = recordTable.size();
+            if (recordTable.size() > 0) {
+                for (WbsTreePrivate record : recordTable) {
+                    //没有excel表单的不生成pdf
+                    if (StringUtils.isNotEmpty(record.getHtmlUrl())) {
+                        //生成记录表pdf
+                        String bussPdfInfo = this.getBussPDFTrial(record.getPKeyId(), contractId, id, recordPageNumber++, recordPageNumberCount);
+                        if (StringUtils.isNotEmpty(bussPdfInfo)) {
+                            dataPdfUrls.add(bussPdfInfo);
+                        }
                     }
                 }
             }