Browse Source

中期计量bug修改

zhuwei 9 months ago
parent
commit
93bc74dc4d

+ 54 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

@@ -2214,6 +2214,8 @@ public class TaskController extends BladeController {
                         data.setContractId(Func.toLong(task.getContractId()));
                         data.setMeterPeriodId(Func.toLong(task.getFormDataId()));
                         data.setPrintDate(me.getFormPrintDate());
+                        data.setPeriodNumber(me.getPeriodNumber());
+                        data.setProjectId(me.getProjectId());
                         if(task.getMeterTaskType()==2){
                             data.setRepaymentCause("材料预付款");
                             data.setStatementName("材料预付款--" + me.getPeriodName());
@@ -2241,6 +2243,7 @@ public class TaskController extends BladeController {
                         inData2.setCertificateNumber(task.getFormDataId());
                         inData2.setPeriodNumber(me.getPeriodNumber());
                         inData2.setPrintDate(me.getFormPrintDate());
+                        inData2.setProjectId(me.getProjectId());
                         interimPayCertificateService.save(inData2);
                         reportId = inData2.getId()+"";
                     }
@@ -2745,6 +2748,8 @@ public class TaskController extends BladeController {
                                 }
                                 /*设置表头*/
                                 setTitle(sheet, tile);
+                                /*添加电签*/
+                                setDQInfo(sheet,rs.getUrl());
                                 //去掉表格虚线
                                 sheet.setPrintGridlines(false);
                                 //设置 整个工作表为一页
@@ -2813,6 +2818,55 @@ public class TaskController extends BladeController {
         }
     }
 
+    // 添加电签信息数据
+    public void setDQInfo(Sheet sheet, String htmlUrl) {
+        String file_path = CollectionUtils.getSysLocalFileUrl();
+        // 添加电签关键字Id
+        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
+        File file = null;
+        InputStream fileInputStream;
+        try {
+            file = ResourceUtil.getFile(htmlUrl);
+            if (file.exists()) {
+                fileInputStream = new FileInputStream(file);
+            } else {
+                String path = sys_file_net_url + htmlUrl.replaceAll("//", "/").replaceAll(file_path, "");
+                fileInputStream = CommonUtil.getOSSInputStream(path);
+            }
+            String htmlString = IoUtil.readToString(fileInputStream);
+            org.jsoup.nodes.Document htmldoc = Jsoup.parse(htmlString);
+            Elements dqlist = htmldoc.getElementsByAttribute("dqid");
+            if(dqlist!=null && !dqlist.isEmpty()){
+                dqlist.forEach(element -> {
+                    int y1 = Func.toInt(element.attr("y1"));
+                    int x1 = Func.toInt(element.attr("x1"));
+
+                    Row row = sheet.getRow(y1 - 1);
+                    if (row != null) {
+                        Cell cell = row.getCell(x1 - 1);
+                        if (cell != null) {
+
+                            cell.setCellValue(element.attr("dqid"));
+
+                            Workbook workbook = cell.getSheet().getWorkbook();
+                            CellStyle cellStyle = workbook.createCellStyle();
+                            cellStyle.cloneStyleFrom(cell.getCellStyle());
+
+                            Font newFont = workbook.createFont();
+                            newFont.setColor(IndexedColors.WHITE.getIndex());
+                            newFont.setFontHeightInPoints((short) 2);
+                            cellStyle.setFont(newFont);
+
+                            cell.setCellStyle(cellStyle);
+                        }
+                    }
+                });
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
     @Data
     class Report {
         public final String[] REPORT_TYPE = new String[]{"s_interim_pay_certificate", "s_material_start_statement", "s_material_start_statement"};