开发排行榜组件

This commit is contained in:
2023-06-06 17:31:16 +08:00
parent 8b23d4ad4a
commit f9392ea2eb
10 changed files with 284 additions and 89 deletions

View File

@@ -53,7 +53,7 @@ public class CallerRankingList
ResultSet cur_attaching = null;
ResultSet cur_renewal = null;
String sql = """
{call telsale_archievement_pkg.caller_arch_ranking_list(?,?,?)}
{call telsale_archievement_pkg.caller_arch_ranking_list(?,?,?,?,?)}
""";
String monthRegx = "(0[1-9])|(1[0-2])";
String yearRegx = "20[0-2][0-0]";
@@ -106,7 +106,7 @@ public class CallerRankingList
CallerRankingItem caller =
new CallerRankingItem( index, callerName, appraiseValue );
attachingRateRankingList.add( caller );
renewalRateRankingList.add( caller );
index++;
}

View File

@@ -13,15 +13,16 @@
package com.cpic.xim.web.controllers.archievement;
import java.sql.SQLException;
import java.util.Vector;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RequestBody;
import java.sql.SQLException;
import com.cpic.xim.utils.archievement.DepartmentArchievement;
import com.cpic.xim.utils.ranking.CallerRankingItem;
import com.cpic.xim.utils.ranking.CallerRankingList;
import com.cpic.xim.web.controllers.archievement.RankingList.RankingListRequest;
import com.cpic.xim.web.controllers.archievement.RankingList.RankingListResponse;
@@ -81,11 +82,50 @@ public class ArchievementQueryController
return result;
}
@RequestMapping("/query_ranking_list.do")
@RequestMapping( "/query_ranking_list.do" )
@ResponseBody
public RankingListResponse queryCallerArchievementRankingList( @RequestBody RankingListRequest request )
public RankingListResponse queryCallerArchievementRankingList(
@RequestBody RankingListRequest request )
{
RankingListResponse response = new RankingListResponse();
String departmentCode = request.getDepartmentCode();
String year = request.getYear();
String month = request.getMonth();
boolean success = false;
String message = "";
Vector<CallerRankingItem> attachingRateRankingList = null;
Vector<CallerRankingItem> renewalRateRankingList = null;
try
{
CallerRankingList rankingList =
CallerRankingList.getCallerRankingList( departmentCode, year, month );
attachingRateRankingList = rankingList.getAttachingRateRankingList();
renewalRateRankingList = rankingList.getRenewalRateRankingList();
success = true;
message = "调用成功!";
}
catch ( SQLException error )
{
success = false;
message = "获取排行榜失败,原因:" + error.getMessage();
error.printStackTrace();
}
catch ( ClassNotFoundException error )
{
success = false;
message = "获取排行榜失败原因oracle驱动加载失败" + error.getMessage();
error.printStackTrace();
}
RankingListResponse response = new RankingListResponse( success, message, departmentCode,
year, month, attachingRateRankingList, renewalRateRankingList );
return response;
}

View File

@@ -25,6 +25,32 @@ public class RankingListRequest
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;
}
@JsonProperty("departmentCode")
private String departmentCode;
@JsonProperty("year")
private String year;
@JsonProperty("month")
private String month;
}

View File

@@ -16,7 +16,33 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class RankingListResponse extends QueryResult
{
public RankingListResponse() { super(); }
public RankingListResponse()
{
super();
}
public RankingListResponse( boolean success, String message, String departmentCode, String year,
String month, Vector<CallerRankingItem> attachingRateRankingList,
Vector<CallerRankingItem> renewalRateRankingList)
{
super( success, message );
this.departmentCode = departmentCode;
this.year = year;
this.month = month;
this.attachingRateRankingList = attachingRateRankingList;
this.renewalRateRankingList = renewalRateRankingList;
}
public String getDepartmentCode()
{
return departmentCode;
}
public void setDepartmentCode( String departmentCode )
{
this.departmentCode = departmentCode;
}
public String getYear()
{
@@ -58,14 +84,18 @@ public class RankingListResponse extends QueryResult
this.renewalRateRankingList = renewalRateRankingList;
}
// 部门代码
@JsonProperty( "departmentCode" )
private String departmentCode;
// 统计年份
@JsonProperty("year")
@JsonProperty( "year" )
private String year;
// 统计月份
@JsonProperty("month")
@JsonProperty( "month" )
private String month;
// 车非融合率排行
@JsonProperty( "attachingRateRankingList" )
private Vector<CallerRankingItem> attachingRateRankingList;
@@ -73,5 +103,4 @@ public class RankingListResponse extends QueryResult
// 续保率排行
@JsonProperty( "renewalRateRankingList" )
private Vector<CallerRankingItem> renewalRateRankingList;
}
}