|
|
@@ -1,6 +1,7 @@
|
|
|
package com.usoftchina.saas.commons.service.impl;
|
|
|
|
|
|
import com.usoftchina.saas.commons.dto.DocBaseDTO;
|
|
|
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
|
|
|
import com.usoftchina.saas.commons.mapper.SysprintsetMapper;
|
|
|
import com.usoftchina.saas.commons.po.Configs;
|
|
|
import com.usoftchina.saas.commons.po.JasperResult;
|
|
|
@@ -27,6 +28,7 @@ import java.util.List;
|
|
|
public class JasperReportServiceImpl implements JasperReportService{
|
|
|
|
|
|
private static final String PRINTURLCODE = "printUrl";
|
|
|
+ private static final String USERNAME = "dataBase";
|
|
|
|
|
|
@Autowired
|
|
|
private SysprintsetMapper sysprintsetMapper;
|
|
|
@@ -56,11 +58,14 @@ public class JasperReportServiceImpl implements JasperReportService{
|
|
|
printSet = sysprintsetMapper.selectSetByReportName(caller, reportName, companyId);
|
|
|
}
|
|
|
if (StringUtils.isEmpty(printSet)) {
|
|
|
- return null;
|
|
|
+ throw new BizException(BizExceptionCode.BIZ_REPORT_NOCALLER);
|
|
|
}
|
|
|
//取打印地址
|
|
|
Configs config = configsService.getConfigByCode(PRINTURLCODE);
|
|
|
String printUrl = null != config ? config.getData() : "";
|
|
|
+ //取数据库名称
|
|
|
+ Configs db_config = configsService.getConfigByCode(USERNAME);
|
|
|
+ String db_username = null != db_config ? db_config.getData() : "";
|
|
|
//打印限制 TODO
|
|
|
//打印前执行方法
|
|
|
if (!StringUtils.isEmpty(printSet.getHandlermethod())) {
|
|
|
@@ -85,6 +90,7 @@ public class JasperReportServiceImpl implements JasperReportService{
|
|
|
result.setPrinturl(printUrl);
|
|
|
result.setWhereCondition(condition);
|
|
|
result.setPrinttype(StringUtils.isEmpty(printSet.getPrinttype()) ? "" : printSet.getPrinttype());
|
|
|
+ result.setUserName(db_username);
|
|
|
return result;
|
|
|
|
|
|
}
|