|
|
|
@ -65,7 +65,7 @@ public class ReportServiceImpl implements ReportService { |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void addCustomerReport(SearchReportData inData) { |
|
|
|
public SearchReportData addCustomerReport(SearchReportData inData) { |
|
|
|
//公共参数 |
|
|
|
String site = inData.getSite(); |
|
|
|
String currentDate = DateUtil.getStringDate(new Date(), "yyyyMMdd"); |
|
|
|
@ -78,6 +78,7 @@ public class ReportServiceImpl implements ReportService { |
|
|
|
inData.setCreatedDate(new Date()); |
|
|
|
//保存定制报表的对象 |
|
|
|
reportDao.insertCustomerReport(inData); |
|
|
|
return inData; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -139,8 +140,15 @@ public class ReportServiceImpl implements ReportService { |
|
|
|
} |
|
|
|
//处理sql中的字段 |
|
|
|
CustomerReportData customerReportData = reportDao.getCustomerReportByReportId(inData); |
|
|
|
//判断是否存在sql |
|
|
|
String reportSql = customerReportData.getReportSql(); |
|
|
|
if(reportSql == null || "".equals(reportSql.trim())){ |
|
|
|
throw new RRException("请先为当前报表添加SQL语句"); |
|
|
|
}else{ |
|
|
|
reportSql = reportSql.trim(); |
|
|
|
} |
|
|
|
//获取查询条件的字段 |
|
|
|
List<String> tempColumns = this.processReportSqlSearchCon(customerReportData.getReportSql()); |
|
|
|
List<String> tempColumns = this.processReportSqlSearchCon(reportSql); |
|
|
|
//去转Map 保存已经保存在数据中的 |
|
|
|
Map<String, Integer> saveColumnMap = new HashMap<>(); |
|
|
|
for (CustomerSearchColumnData searchColumn : columnList){ |
|
|
|
@ -182,7 +190,7 @@ public class ReportServiceImpl implements ReportService { |
|
|
|
//判断sql是否合法 |
|
|
|
int checkIndex = reportSql.indexOf("${"); |
|
|
|
if(checkIndex <= 0){ |
|
|
|
throw new RRException("自定义报表的SQL语句非法!"); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
//拆分字符串 |
|
|
|
int lastIndex = reportSql.lastIndexOf("}"); |
|
|
|
@ -264,6 +272,10 @@ public class ReportServiceImpl implements ReportService { |
|
|
|
queryColumnSql.append("''"); |
|
|
|
} |
|
|
|
} |
|
|
|
//判断是否替换过查询条件 |
|
|
|
if(startIndex == 0 && endIndex == 0){ |
|
|
|
queryColumnSql = new StringBuilder(columnSql); |
|
|
|
} |
|
|
|
//执行临时的sql 看看返回的sql字段 |
|
|
|
List<String> columnList = this.parseSqlColumns(queryColumnSql.toString(), JdbcConstants.SQL_SERVER); |
|
|
|
//处理数据 |
|
|
|
@ -423,7 +435,9 @@ public class ReportServiceImpl implements ReportService { |
|
|
|
//公共参数 |
|
|
|
String site = inData.getSite(); |
|
|
|
String username = inData.getUsername(); |
|
|
|
return reportDao.getUserCustomerReportList(site, username); |
|
|
|
String reportType = inData.getReportType(); |
|
|
|
String reportName = inData.getReportName().trim(); |
|
|
|
return reportDao.getUserCustomerReportList(site, username, reportType, reportName); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|