|  | @ -2,6 +2,7 @@ package irbs.reports.service.impl; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | import dm.jdbc.util.StringUtil; |  |  | import dm.jdbc.util.StringUtil; | 
			
		
	
		
		
			
				
					|  |  | import io.sc.platform.core.util.DateUtil; |  |  | import io.sc.platform.core.util.DateUtil; | 
			
		
	
		
		
			
				
					|  |  |  |  |  | import io.sc.platform.jdbc.DatabaseType; | 
			
		
	
		
		
			
				
					|  |  | import irbs.reports.jpa.entity.ReportSqlConfig; |  |  | import irbs.reports.jpa.entity.ReportSqlConfig; | 
			
		
	
		
		
			
				
					|  |  | import irbs.reports.jpa.repository.ReportSqlConfigRepository; |  |  | import irbs.reports.jpa.repository.ReportSqlConfigRepository; | 
			
		
	
		
		
			
				
					|  |  | import irbs.reports.jpa.support.RptModelMonitorStableVo; |  |  | import irbs.reports.jpa.support.RptModelMonitorStableVo; | 
			
		
	
	
		
		
			
				
					|  | @ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
		
			
				
					|  |  | import org.springframework.jdbc.core.JdbcTemplate; |  |  | import org.springframework.jdbc.core.JdbcTemplate; | 
			
		
	
		
		
			
				
					|  |  | import org.springframework.stereotype.Service; |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  | import javax.sql.DataSource; | 
			
		
	
		
		
			
				
					|  |  | import java.sql.DatabaseMetaData; |  |  | import java.sql.DatabaseMetaData; | 
			
		
	
		
		
			
				
					|  |  | import java.sql.SQLException; |  |  | import java.sql.SQLException; | 
			
		
	
		
		
			
				
					|  |  | import java.util.Date; |  |  | import java.util.Date; | 
			
		
	
	
		
		
			
				
					|  | @ -30,8 +32,11 @@ public class RptModelMonitorStableServiceImpl implements RptModelMonitorStableSe | 
			
		
	
		
		
			
				
					|  |  |     private JdbcTemplate jdbcTemplate; |  |  |     private JdbcTemplate jdbcTemplate; | 
			
		
	
		
		
			
				
					|  |  |     @Autowired |  |  |     @Autowired | 
			
		
	
		
		
			
				
					|  |  |     private ReportSqlConfigRepository reportSqlConfigRepository; |  |  |     private ReportSqlConfigRepository reportSqlConfigRepository; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     @Autowired | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     private DataSource dataSource; | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     @Override |  |  |     @Override | 
			
		
	
		
		
			
				
					
					|  |  |     public List<RptModelMonitorStableVo> query(QueryParams queryParams) throws SQLException { |  |  |     public List<RptModelMonitorStableVo> query(QueryParams queryParams) throws Exception { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         //设置默认查询条件,默认查询当前所在月份的数据
 |  |  |         //设置默认查询条件,默认查询当前所在月份的数据
 | 
			
		
	
		
		
			
				
					|  |  |         if(StringUtil.isEmpty(queryParams.getRatingMonth())){ |  |  |         if(StringUtil.isEmpty(queryParams.getRatingMonth())){ | 
			
		
	
		
		
			
				
					|  |  |             queryParams.setRatingMonth("2023-07-01"); |  |  |             queryParams.setRatingMonth("2023-07-01"); | 
			
		
	
	
		
		
			
				
					|  | @ -40,9 +45,10 @@ public class RptModelMonitorStableServiceImpl implements RptModelMonitorStableSe | 
			
		
	
		
		
			
				
					|  |  |         if(StringUtil.isEmpty(queryParams.getModelCode())){ |  |  |         if(StringUtil.isEmpty(queryParams.getModelCode())){ | 
			
		
	
		
		
			
				
					|  |  |             queryParams.setModelCode("WHM18"); |  |  |             queryParams.setModelCode("WHM18"); | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |         DatabaseMetaData md = jdbcTemplate.getDataSource().getConnection().getMetaData(); |  |  | //        DatabaseMetaData md = jdbcTemplate.getDataSource().getConnection().getMetaData();
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |         String dataBaseType = md.getDatabaseProductName(); |  |  | //        String dataBaseType = md.getDatabaseProductName();
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |         ReportSqlConfig reportSqlConfig = reportSqlConfigRepository.findByReportIdAndDataBaseType("rptModelMonitorStable", dataBaseType); |  |  |         DatabaseType type = DatabaseType.fromMetaData(dataSource); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |         ReportSqlConfig reportSqlConfig = reportSqlConfigRepository.findByReportIdAndDataBaseType("rptModelMonitorStable", type.getProductName()); | 
			
		
	
		
		
			
				
					|  |  |         if(reportSqlConfig != null){ |  |  |         if(reportSqlConfig != null){ | 
			
		
	
		
		
			
				
					|  |  |             String sql = reportSqlConfig.getSqlText(); |  |  |             String sql = reportSqlConfig.getSqlText(); | 
			
		
	
		
		
			
				
					|  |  |             Map<String, String> params = new HashMap<>(); |  |  |             Map<String, String> params = new HashMap<>(); | 
			
		
	
	
		
		
			
				
					|  | 
 |