瀏覽代碼

增加报表菜单与与页面逻辑

CodeLife Leno 3 周之前
父節點
當前提交
c9dea2c04d

+ 26 - 3
DBScript/李庚谱/002-DML.sql

@@ -94,9 +94,32 @@ INSERT INTO sys_roleright (ROLEID, FUNCCODE, DATASCOPE, BLINE) VALUES ('sysadmin
 INSERT INTO sys_roleright (ROLEID, FUNCCODE, DATASCOPE, BLINE) VALUES ('sysadmin', 'BL100004', null, '0');
 INSERT INTO sys_roleright (ROLEID, FUNCCODE, DATASCOPE, BLINE) VALUES ('sysadmin', 'BL100006', null, '0');
 
--- 监管报表菜单
+-- 监管报表菜单 G4B-2 G4B-5
 delete from sys_funinfo where FUNCCODE in ('M150002','M150003');
-insert into sys_funinfo (FUNCCODE, FUNCNAME, PARENTCODE, ORDERNO, LEAF, URL, LEVELCODE, REMARK, ORGTYPE, TERMINALTYPE) values ('M150002', '第二档银行:G4B-2表外信用风险加权资产计算表(权重法)', 'M150000', 4.000000000000000000000000000000, '1', '/rdp/rdpAnalysis/analTemplate/query/SupplementPlanQuery', 2.000000000000000000000000000000, null, '4tailbranch', 'null');
-insert into sys_funinfo (FUNCCODE, FUNCNAME, PARENTCODE, ORDERNO, LEAF, URL, LEVELCODE, REMARK, ORGTYPE, TERMINALTYPE) values ('M150003', '第二档银行:G4B-2表外信用风险加权资产计算表(权重法)', 'M150000', 6.000000000000000000000000000000, '1', '/rdp/rdpAnalysis/analTemplate/query/SupplementResultQuery', 2.000000000000000000000000000000, null, '4tailbranch', 'null');
+insert into sys_funinfo (FUNCCODE, FUNCNAME, PARENTCODE, ORDERNO, LEAF, URL, LEVELCODE, REMARK, ORGTYPE, TERMINALTYPE) values ('M150002', '第二档银行:G4B-2表外信用风险加权资产计算表(权重法)', 'M150000', 4.000000000000000000000000000000, '1', '/G4B_2', 2.000000000000000000000000000000, null, '4tailbranch', 'null');
+insert into sys_funinfo (FUNCCODE, FUNCNAME, PARENTCODE, ORDERNO, LEAF, URL, LEVELCODE, REMARK, ORGTYPE, TERMINALTYPE) values ('M150003', '第二档银行:G4B-5表外信用风险加权资产计算表(权重法)', 'M150000', 6.000000000000000000000000000000, '1', '/G4B_5', 2.000000000000000000000000000000, null, '4tailbranch', 'null');
 
+delete from sys_funorginfo where FUNCCODE in ('M150002','M150003');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150002', '000000');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150002', '351001');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150002', '355001');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150002', '355101');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150002', '355102');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150002', '355103');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150002', '355104');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150002', '355105');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150002', '355106');
 
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150003', '000000');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150003', '351001');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150003', '355001');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150003', '355101');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150003', '355102');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150003', '355103');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150003', '355104');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150003', '355105');
+insert into sys_funorginfo (FUNCCODE, ORGCODE) values ('M150003', '355106');
+
+delete from sys_roleright where FUNCCODE in ('M150003','M150002');
+INSERT INTO sys_roleright (ROLEID, FUNCCODE, DATASCOPE, BLINE) VALUES ('sysadmin', 'M150003', null, '0');
+INSERT INTO sys_roleright (ROLEID, FUNCCODE, DATASCOPE, BLINE) VALUES ('sysadmin', 'M150002', null, '0');

+ 7 - 0
Procedure/backend/project/src/main/java/com/sundata/product/rwa/calc/service/ReportCalcService.java

@@ -5,6 +5,8 @@ import cn.hutool.core.date.TimeInterval;
 import cn.hutool.core.lang.UUID;
 import cn.hutool.extra.spring.SpringUtil;
 import com.sundata.common.util.DBExecutor;
+import com.sundata.common.util.FileUtil;
+import com.sundata.common.util.JavaRuntimeUtils;
 import com.sundata.product.rwa.calc.model.ReportUnitParamCalcModel;
 import com.sundata.product.rwa.reportformconfigreportcreater.model.ReportCalculationModel;
 import com.sundata.product.rwa.reportformconfigreportcreater.model.ReportDefinitionModel;
@@ -254,6 +256,11 @@ public class ReportCalcService {
                 tempTmpWorkbook.write(Files.newOutputStream(resultFile.toPath()));
                 tempTmpWorkbook.close();
                 log.debug("报告生成到:{}", resultFile.getAbsolutePath());
+                if (!JavaRuntimeUtils.isDebug()){
+                    // 如果不是 DEBUG 模式,则删除临时文件
+                    String tempDir = templatePath + File.separator + "tempTmp";
+                    FileUtil.deletePath(tempDir);
+                }
             }
             log.debug("开始处理集成报表");
 

+ 15 - 17
Procedure/backend/project/src/main/java/com/sundata/product/rwa/reportformconfigreportcreater/action/ReportFileExportController.java

@@ -41,18 +41,20 @@ public class ReportFileExportController extends BaseAction {
         try {
             if (!reportResultDirPath.exists()) {
                 rsp.put("flag", false);
+                FileUtil.getContent(tempFileDir.listFiles()[0].getName(), response, Files.newInputStream(tempFileDir.listFiles()[0].toPath()));
+                return;
             }
             if (reportResultDirPath.listFiles() == null || reportResultDirPath.listFiles().length == 0) {
                 rsp.put("flag", false);
+                FileUtil.getContent(tempFileDir.listFiles()[0].getName(), response, Files.newInputStream(tempFileDir.listFiles()[0].toPath()));
+                return;
             }
-            File report = reportResultDirPath.listFiles()[0];
-            if (!report.exists()) {
-                rsp.put("flag", false);
-            }
+
             if (rsp.get("flag").toString().equals("false")) {
-                FileUtil.getContent(report.getName(), response, Files.newInputStream(tempFileDir.listFiles()[0].toPath()));
+                FileUtil.getContent(tempFileDir.listFiles()[0].getName(), response, Files.newInputStream(tempFileDir.listFiles()[0].toPath()));
                 return;
             }
+            File report = reportResultDirPath.listFiles()[0];
             FileUtil.getContent(report.getName(), response, Files.newInputStream(report.toPath()));
         } catch (IOException e) {
             log.error("读取文件出现异常,请检查是否存在权限问题:{}", e.getMessage(), e);
@@ -72,27 +74,23 @@ public class ReportFileExportController extends BaseAction {
             Map<String, Object> rsp = new HashMap<>();
             rsp.put("flag", true);
             File tempFileDir = new File(templatePath + File.separator + "reportuploadconfig" + File.separator + model.getReportNo() + "/" + "default");
+            ToHtml toHtml = null;
             if (!reportResultDirPath.exists()) {
                 rsp.put("flag", false);
             }
             if (reportResultDirPath.listFiles() == null || reportResultDirPath.listFiles().length == 0) {
                 rsp.put("flag", false);
             }
-            File report = reportResultDirPath.listFiles()[0];
-            if (!report.exists()) {
-                rsp.put("flag", false);
-            }
+
             StringWriter writer = new StringWriter();
             if (rsp.get("flag").toString().equals("false")) {
-                ToHtml toHtml = ToHtml.create(Files.newInputStream(tempFileDir.listFiles()[0].toPath()), writer);
-                toHtml.setCompleteHTML(false);
-                toHtml.printPage();
-                rsp.put("flag", true);
-                rsp.put("htmlString", writer.toString());
-                sendData(response, rsp);
-                return;
+                toHtml = ToHtml.create(Files.newInputStream(tempFileDir.listFiles()[0].toPath()), writer);
+
+            } else {
+                File report = reportResultDirPath.listFiles()[0];
+                toHtml = ToHtml.create(Files.newInputStream(report.toPath()), writer);
             }
-            ToHtml toHtml = ToHtml.create(Files.newInputStream(report.toPath()), writer);
+
             toHtml.setCompleteHTML(false);
             toHtml.printPage();
             rsp.put("flag", true);

+ 2 - 2
Procedure/frontend/projectb/src/pages/product/rwa/reportResult/G4B_1.tsx

@@ -9,7 +9,7 @@ const G4B_1: React.FC<any> = () => {
   const [term, setTerm] = useState<string | undefined>();
   const downloadFile = () => {
     if (term) {
-      downloadReportFile({ term: term, reportNo: 'G4B_1' });
+      downloadReportFile({ term: term, reportNo: 'G4B_1_001' });
     }
   };
 
@@ -61,7 +61,7 @@ const G4B_1: React.FC<any> = () => {
           overflowY: 'auto',
         }}
       >
-        {term && <ReportFileShow term={term} reportNo="G4B_1" />}
+        {term && <ReportFileShow term={term} reportNo="G4B_1_001" />}
       </SDLayout>
       <SDLayout></SDLayout>
     </SDPage>

+ 2 - 2
Procedure/frontend/projectb/src/pages/product/rwa/reportResult/G4B_2.tsx

@@ -9,7 +9,7 @@ const G4B_2: React.FC<any> = () => {
   const [term, setTerm] = useState<string | undefined>();
   const downloadFile = () => {
     if (term) {
-      downloadReportFile({ term: term, reportNo: 'G4B_1' });
+      downloadReportFile({ term: term, reportNo: 'G4B_2_001' });
     }
   };
 
@@ -61,7 +61,7 @@ const G4B_2: React.FC<any> = () => {
           overflowY: 'auto',
         }}
       >
-        {term && <ReportFileShow term={term} reportNo="G4B_2" />}
+        {term && <ReportFileShow term={term} reportNo="G4B_2_001" />}
       </SDLayout>
       <SDLayout></SDLayout>
     </SDPage>

+ 2 - 2
Procedure/frontend/projectb/src/pages/product/rwa/reportResult/G4B_5.tsx

@@ -9,7 +9,7 @@ const G4B_5: React.FC<any> = () => {
   const [term, setTerm] = useState<string | undefined>();
   const downloadFile = () => {
     if (term) {
-      downloadReportFile({ term: term, reportNo: 'G4B_1' });
+      downloadReportFile({ term: term, reportNo: 'G4B_5_001' });
     }
   };
 
@@ -61,7 +61,7 @@ const G4B_5: React.FC<any> = () => {
           overflowY: 'auto',
         }}
       >
-        {term && <ReportFileShow term={term} reportNo="G4B_5" />}
+        {term && <ReportFileShow term={term} reportNo="G4B_5_001" />}
       </SDLayout>
       <SDLayout></SDLayout>
     </SDPage>