完成排行榜代码,还没测试
This commit is contained in:
@@ -15,6 +15,13 @@ public class CallerRankingItem
|
||||
{
|
||||
|
||||
public CallerRankingItem() {}
|
||||
|
||||
public CallerRankingItem( int index, String callName, String appraiseValue )
|
||||
{
|
||||
this.index = index;
|
||||
this.callerName = callName;
|
||||
this.appraiseValue = appraiseValue;
|
||||
}
|
||||
|
||||
public int getIndex()
|
||||
{
|
||||
|
@@ -9,17 +9,12 @@
|
||||
*/
|
||||
package com.cpic.xim.utils.ranking;
|
||||
|
||||
import java.util.Vector;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.CallableStatement;
|
||||
|
||||
import java.util.Vector;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import oracle.jdbc.OracleCallableStatement;
|
||||
import oracle.jdbc.OracleTypes;
|
||||
|
||||
@@ -30,9 +25,13 @@ public class CallerRankingList
|
||||
private static String userName = "desktop_archievement_admin";
|
||||
private static String password = "Cpic123456";
|
||||
|
||||
private CallerRankingList( Vector<CallerRankingItem> attachingRateRankingList,
|
||||
private CallerRankingList( String departmentCode, String year, String month,
|
||||
Vector<CallerRankingItem> attachingRateRankingList,
|
||||
Vector<CallerRankingItem> renewalRateRankingList)
|
||||
{
|
||||
this.departmentCode = departmentCode;
|
||||
this.year = year;
|
||||
this.month = month;
|
||||
this.attachingRateRankingList = attachingRateRankingList;
|
||||
this.renewalRateRankingList = renewalRateRankingList;
|
||||
}
|
||||
@@ -51,30 +50,77 @@ public class CallerRankingList
|
||||
|
||||
Connection connection = null;
|
||||
CallableStatement statement = null;
|
||||
ResultSet result = null;
|
||||
ResultSet cur_attaching = null;
|
||||
ResultSet cur_renewal = null;
|
||||
String sql = """
|
||||
{call telsale_archievement_pkg.caller_arch_ranking_list(?,?,?)}
|
||||
""";
|
||||
String monthRegx = "(0[1-9])|(1[0-2])";
|
||||
String yearRegx = "20[0-2][0-0]";
|
||||
|
||||
Vector<CallerRankingItem> attachingRateRankingList = new Vector<>();
|
||||
Vector<CallerRankingItem> renewalRateRankingList = new Vector<>();
|
||||
|
||||
int index = 1;
|
||||
|
||||
try
|
||||
{
|
||||
Class.forName( "oracle.jdbc.driver.OracleDriver" );
|
||||
connection = DriverManager.getConnection( jdbcURL, userName, password );
|
||||
statement = connection.prepareCall(sql);
|
||||
statement = connection.prepareCall( sql );
|
||||
|
||||
statement.setString( 1, departmentCode );
|
||||
statement.registerOutParameter(2, OracleTypes.CURSOR );
|
||||
statement.registerOutParameter(3, OracleTypes.CURSOR );
|
||||
statement.setString( 2, year );
|
||||
statement.setString( 3, month );
|
||||
statement.registerOutParameter( 4, OracleTypes.CURSOR );
|
||||
statement.registerOutParameter( 5, OracleTypes.CURSOR );
|
||||
|
||||
statement.execute();
|
||||
|
||||
// 车非渗透率
|
||||
cur_attaching = ((OracleCallableStatement) statement).getCursor( 4 );
|
||||
index = 1;
|
||||
|
||||
while ( cur_attaching.next())
|
||||
{
|
||||
String callerName = cur_attaching.getString( 1 );
|
||||
String appraiseValue = cur_attaching.getString( 2 );
|
||||
|
||||
CallerRankingItem caller =
|
||||
new CallerRankingItem( index, callerName, appraiseValue );
|
||||
|
||||
attachingRateRankingList.add( caller );
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
// 续保率
|
||||
cur_renewal = ((OracleCallableStatement) statement).getCursor( 5 );
|
||||
index = 1;
|
||||
|
||||
while ( cur_renewal.next())
|
||||
{
|
||||
String callerName = cur_renewal.getString( 1 );
|
||||
String appraiseValue = cur_renewal.getString( 2 );
|
||||
|
||||
CallerRankingItem caller =
|
||||
new CallerRankingItem( index, callerName, appraiseValue );
|
||||
|
||||
attachingRateRankingList.add( caller );
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
rankingList = new CallerRankingList( departmentCode, year, month,
|
||||
attachingRateRankingList, renewalRateRankingList );
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( result != null )
|
||||
if ( cur_attaching != null )
|
||||
{
|
||||
result.close();
|
||||
cur_attaching.close();
|
||||
}
|
||||
}
|
||||
catch ( Exception exception )
|
||||
@@ -111,6 +157,56 @@ public class CallerRankingList
|
||||
return rankingList;
|
||||
}
|
||||
|
||||
public String getDepartmentCode()
|
||||
{
|
||||
return departmentCode;
|
||||
}
|
||||
|
||||
public void setDepartmentCode( String departmentCode )
|
||||
{
|
||||
this.departmentCode = departmentCode;
|
||||
}
|
||||
|
||||
public String getYear()
|
||||
{
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear( String year )
|
||||
{
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public String getMonth()
|
||||
{
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth( String month )
|
||||
{
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public Vector<CallerRankingItem> getAttachingRateRankingList()
|
||||
{
|
||||
return attachingRateRankingList;
|
||||
}
|
||||
|
||||
public void setAttachingRateRankingList( Vector<CallerRankingItem> attachingRateRankingList )
|
||||
{
|
||||
this.attachingRateRankingList = attachingRateRankingList;
|
||||
}
|
||||
|
||||
public Vector<CallerRankingItem> getRenewalRateRankingList()
|
||||
{
|
||||
return renewalRateRankingList;
|
||||
}
|
||||
|
||||
public void setRenewalRateRankingList( Vector<CallerRankingItem> renewalRateRankingList )
|
||||
{
|
||||
this.renewalRateRankingList = renewalRateRankingList;
|
||||
}
|
||||
|
||||
// 部门代码
|
||||
private String departmentCode;
|
||||
|
||||
@@ -121,11 +217,9 @@ public class CallerRankingList
|
||||
private String month;
|
||||
|
||||
// 车非融合率排行
|
||||
@JsonProperty( "attachingRateRankingList" )
|
||||
private Vector<CallerRankingItem> attachingRateRankingList;
|
||||
|
||||
// 续保率排行
|
||||
@JsonProperty( "renewalRateRankingList" )
|
||||
private Vector<CallerRankingItem> renewalRateRankingList;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user