|
|
@@ -31,6 +31,7 @@ import com.uas.report.support.SysConf;
|
|
|
import com.uas.report.util.DataSourceUtils;
|
|
|
import com.uas.report.util.FileUtils;
|
|
|
import com.uas.report.util.ReportConstants;
|
|
|
+import com.uas.report.util.ReportUtils;
|
|
|
|
|
|
import net.sf.jasperreports.engine.JRException;
|
|
|
import net.sf.jasperreports.engine.JasperCompileManager;
|
|
|
@@ -59,6 +60,9 @@ public class PrintServiceImpl implements PrintService {
|
|
|
@Autowired
|
|
|
private FileService fileService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysConf sysConf;
|
|
|
+
|
|
|
// @Autowired
|
|
|
// private ResourceService resourceService;
|
|
|
|
|
|
@@ -109,7 +113,8 @@ public class PrintServiceImpl implements PrintService {
|
|
|
// throw new ReportException(e).setDetailedMessage(e);
|
|
|
// }
|
|
|
|
|
|
- String jrxmlFilePath = processJrxmlFilePathOfB2B(userName, reportName);
|
|
|
+ userName = processMasterOfB2B(userName, reportName);
|
|
|
+ String jrxmlFilePath = fileService.getJrxmlFilePath(userName, reportName);
|
|
|
String jasperFilePath = maybeCompileJrxmlFile(jrxmlFilePath);
|
|
|
|
|
|
// 向报表模板传递参数:报表路径、where条件、其他参数
|
|
|
@@ -201,30 +206,6 @@ public class PrintServiceImpl implements PrintService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
- private SysConf sysConf;
|
|
|
-
|
|
|
- /**
|
|
|
- * 处理B2B的模板路径,如果企业没有自己的模板,则使用B2B的标准模板
|
|
|
- *
|
|
|
- * @param userName
|
|
|
- * 账套名称
|
|
|
- * @param reportName
|
|
|
- * 模板名称
|
|
|
- * @return 模板路径
|
|
|
- */
|
|
|
- private String processJrxmlFilePathOfB2B(String userName, String reportName) {
|
|
|
- String jrxmlFilePath = fileService.getJrxmlFilePath(userName, reportName);
|
|
|
- if (userName.startsWith("B2B")) {
|
|
|
- File jrxmlFile = new File(jrxmlFilePath);
|
|
|
- // 报表模板不存在,返回B2B标准模板路径
|
|
|
- if (!jrxmlFile.exists()) {
|
|
|
- return fileService.getJrxmlFilePath(sysConf.getStandardMaster() + "/B2B", reportName);
|
|
|
- }
|
|
|
- }
|
|
|
- return jrxmlFilePath;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 可能需要编译报表模板文件
|
|
|
*
|
|
|
@@ -367,4 +348,18 @@ public class PrintServiceImpl implements PrintService {
|
|
|
return pageSize;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String processMasterOfB2B(String userName, String reportName) {
|
|
|
+ ReportUtils.checkParameters(userName, reportName);
|
|
|
+ if (userName.startsWith("B2B")) {
|
|
|
+ String jrxmlFilePath = fileService.getJrxmlFilePath(userName, reportName);
|
|
|
+ File jrxmlFile = new File(jrxmlFilePath);
|
|
|
+ // 报表模板不存在,返回B2B标准模板账套
|
|
|
+ if (!jrxmlFile.exists()) {
|
|
|
+ return sysConf.getStandardMaster() + "/B2B";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return userName;
|
|
|
+ }
|
|
|
+
|
|
|
}
|