|
|
@@ -27,6 +27,7 @@ import com.uas.report.core.exception.ReportException;
|
|
|
import com.uas.report.jasperreports.engine.export.CustomJRXlsExporter;
|
|
|
import com.uas.report.service.FileService;
|
|
|
import com.uas.report.service.PrintService;
|
|
|
+import com.uas.report.support.SysConf;
|
|
|
import com.uas.report.util.DataSourceUtils;
|
|
|
import com.uas.report.util.FileUtils;
|
|
|
import com.uas.report.util.ReportConstants;
|
|
|
@@ -108,7 +109,7 @@ public class PrintServiceImpl implements PrintService {
|
|
|
// throw new ReportException(e).setDetailedMessage(e);
|
|
|
// }
|
|
|
|
|
|
- String jrxmlFilePath = fileService.getJrxmlFilePath(userName, reportName);
|
|
|
+ String jrxmlFilePath = processJrxmlFilePathOfB2B(userName, reportName);
|
|
|
String jasperFilePath = maybeCompileJrxmlFile(jrxmlFilePath);
|
|
|
|
|
|
// 向报表模板传递参数:报表路径、where条件、其他参数
|
|
|
@@ -200,6 +201,30 @@ 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;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 可能需要编译报表模板文件
|
|
|
*
|