编写坐席排行榜接口
This commit is contained in:
		@@ -11,11 +11,8 @@ package com.cpic.xim.utils.archievement;
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
@@ -80,7 +77,6 @@ public class DepartmentArchievement
 | 
			
		||||
            connection = DriverManager.getConnection( jdbcURL, userName, password );
 | 
			
		||||
            statement = connection.prepareCall( sql );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            statement.setString( 1, departmentCode );
 | 
			
		||||
            statement.registerOutParameter( 2, java.sql.Types.VARCHAR );
 | 
			
		||||
            statement.registerOutParameter( 3, java.sql.Types.VARCHAR );
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,23 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-06-05 10:36:30
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/utils/exception/DepartmentCodeNotFoundException.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.utils.exception;
 | 
			
		||||
 | 
			
		||||
public class DepartmentCodeNotFoundException extends Exception
 | 
			
		||||
{
 | 
			
		||||
    public DepartmentCodeNotFoundException()
 | 
			
		||||
    {
 | 
			
		||||
        super("部门代码无效!");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public DepartmentCodeNotFoundException( String message )
 | 
			
		||||
    {
 | 
			
		||||
        super( message );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,23 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-06-05 10:56:33
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/utils/exception/ParameterExecption.java
 | 
			
		||||
 * @Description: 用于表示参数错误的异常对象。
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.utils.exception;
 | 
			
		||||
 | 
			
		||||
public class ParameterExecption extends Exception
 | 
			
		||||
{
 | 
			
		||||
    public ParameterExecption()
 | 
			
		||||
    {
 | 
			
		||||
        super("参数错误!");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public ParameterExecption(String message )
 | 
			
		||||
    {
 | 
			
		||||
        super( message );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -2,18 +2,19 @@
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-06-03 20:02:28
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/controllers/archievement/RankingList/CallerRanking.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/utils/ranking/CallerRanking.java
 | 
			
		||||
 * @Description: 坐席排行榜项目
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.web.controllers.archievement.RankingList;
 | 
			
		||||
package com.cpic.xim.utils.ranking;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
public class CallerRanking
 | 
			
		||||
public class CallerRankingItem
 | 
			
		||||
{
 | 
			
		||||
    public CallerRanking() {}
 | 
			
		||||
 | 
			
		||||
    public CallerRankingItem() {}
 | 
			
		||||
    
 | 
			
		||||
    public int getIndex()
 | 
			
		||||
    {
 | 
			
		||||
@@ -0,0 +1,131 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-06-05 08:55:06
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/utils/ranking/CallerRankingList.java
 | 
			
		||||
 * @Description: 坐席排行榜对象
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.utils.ranking;
 | 
			
		||||
 | 
			
		||||
import java.util.Vector;
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
public class CallerRankingList
 | 
			
		||||
{
 | 
			
		||||
    // 以后要改
 | 
			
		||||
    private static String jdbcURL = "jdbc:oracle:thin:@10.39.0.86:1521:xmcx1";
 | 
			
		||||
    private static String userName = "desktop_archievement_admin";
 | 
			
		||||
    private static String password = "Cpic123456";
 | 
			
		||||
 | 
			
		||||
    private CallerRankingList( Vector<CallerRankingItem> attachingRateRankingList,
 | 
			
		||||
            Vector<CallerRankingItem> renewalRateRankingList)
 | 
			
		||||
    {
 | 
			
		||||
        this.attachingRateRankingList = attachingRateRankingList;
 | 
			
		||||
        this.renewalRateRankingList = renewalRateRankingList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief static方法,用于查询部门坐席排行榜
 | 
			
		||||
     * @param departmentCode 部门代码
 | 
			
		||||
     * @param year 排行榜年份
 | 
			
		||||
     * @param month 排行榜月份
 | 
			
		||||
     * @return CallerRankingList的实例对象
 | 
			
		||||
     */
 | 
			
		||||
    public static CallerRankingList getCallerRankingList( String departmentCode, String year,
 | 
			
		||||
            String month ) throws ClassNotFoundException, SQLException
 | 
			
		||||
    {
 | 
			
		||||
        CallerRankingList rankingList = null;
 | 
			
		||||
 | 
			
		||||
        Connection connection = null;
 | 
			
		||||
        CallableStatement statement = null;
 | 
			
		||||
        ResultSet result = 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]";
 | 
			
		||||
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            Class.forName( "oracle.jdbc.driver.OracleDriver" );
 | 
			
		||||
            connection = DriverManager.getConnection( jdbcURL, userName, password );
 | 
			
		||||
            statement = connection.prepareCall(sql);
 | 
			
		||||
 | 
			
		||||
            statement.setString( 1, departmentCode );
 | 
			
		||||
            statement.registerOutParameter(2, OracleTypes.CURSOR );
 | 
			
		||||
            statement.registerOutParameter(3, OracleTypes.CURSOR );
 | 
			
		||||
        }
 | 
			
		||||
        finally
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                if ( result != null )
 | 
			
		||||
                {
 | 
			
		||||
                    result.close();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch ( Exception exception )
 | 
			
		||||
            {
 | 
			
		||||
                exception.printStackTrace();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                if ( statement != null )
 | 
			
		||||
                {
 | 
			
		||||
                    statement.close();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch ( Exception exception )
 | 
			
		||||
            {
 | 
			
		||||
                exception.printStackTrace();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                if ( connection != null )
 | 
			
		||||
                {
 | 
			
		||||
                    connection.close();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch ( Exception exception )
 | 
			
		||||
            {
 | 
			
		||||
                exception.printStackTrace();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        return rankingList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 部门代码
 | 
			
		||||
    private String departmentCode;
 | 
			
		||||
 | 
			
		||||
    // 排行榜年份
 | 
			
		||||
    private String year;
 | 
			
		||||
 | 
			
		||||
    // 排行榜统计月份
 | 
			
		||||
    private String month;
 | 
			
		||||
 | 
			
		||||
    // 车非融合率排行
 | 
			
		||||
    @JsonProperty( "attachingRateRankingList" )
 | 
			
		||||
    private Vector<CallerRankingItem> attachingRateRankingList;
 | 
			
		||||
 | 
			
		||||
    // 续保率排行
 | 
			
		||||
    @JsonProperty( "renewalRateRankingList" )
 | 
			
		||||
    private Vector<CallerRankingItem> renewalRateRankingList;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -22,6 +22,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
import java.sql.SQLException;
 | 
			
		||||
 | 
			
		||||
import com.cpic.xim.utils.archievement.DepartmentArchievement;
 | 
			
		||||
import com.cpic.xim.web.controllers.archievement.RankingList.RankingListRequest;
 | 
			
		||||
import com.cpic.xim.web.controllers.archievement.RankingList.RankingListResponse;
 | 
			
		||||
 | 
			
		||||
@Controller
 | 
			
		||||
@RequestMapping( "/archievement" )
 | 
			
		||||
@@ -80,8 +82,11 @@ public class ArchievementQueryController
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequestMapping("/query_ranking_list.do")
 | 
			
		||||
    public void queryCallerArchievementRankingList( )
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public RankingListResponse queryCallerArchievementRankingList( @RequestBody RankingListRequest request )
 | 
			
		||||
    {
 | 
			
		||||
        RankingListResponse response = new RankingListResponse();
 | 
			
		||||
 | 
			
		||||
        return response;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -10,9 +10,9 @@
 | 
			
		||||
package com.cpic.xim.web.controllers.archievement.RankingList;
 | 
			
		||||
 | 
			
		||||
import java.util.Vector;
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
import com.cpic.xim.utils.ranking.CallerRankingItem;
 | 
			
		||||
import com.cpic.xim.web.controllers.QueryResult;
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
public class RankingListResponse extends QueryResult
 | 
			
		||||
{
 | 
			
		||||
@@ -38,22 +38,22 @@ public class RankingListResponse extends QueryResult
 | 
			
		||||
        this.month = month;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Vector<CallerRanking> getAttachingRateRankingList()
 | 
			
		||||
    public Vector<CallerRankingItem> getAttachingRateRankingList()
 | 
			
		||||
    {
 | 
			
		||||
        return attachingRateRankingList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setAttachingRateRankingList( Vector<CallerRanking> attachingRateRankingList )
 | 
			
		||||
    public void setAttachingRateRankingList( Vector<CallerRankingItem> attachingRateRankingList )
 | 
			
		||||
    {
 | 
			
		||||
        this.attachingRateRankingList = attachingRateRankingList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Vector<CallerRanking> getRenewalRateRankingList()
 | 
			
		||||
    public Vector<CallerRankingItem> getRenewalRateRankingList()
 | 
			
		||||
    {
 | 
			
		||||
        return renewalRateRankingList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setRenewalRateRankingList( Vector<CallerRanking> renewalRateRankingList )
 | 
			
		||||
    public void setRenewalRateRankingList( Vector<CallerRankingItem> renewalRateRankingList )
 | 
			
		||||
    {
 | 
			
		||||
        this.renewalRateRankingList = renewalRateRankingList;
 | 
			
		||||
    }
 | 
			
		||||
@@ -67,11 +67,11 @@ public class RankingListResponse extends QueryResult
 | 
			
		||||
    private String month;
 | 
			
		||||
    
 | 
			
		||||
    // 车非融合率排行
 | 
			
		||||
    @JsonProperty("attachingRateRankingList")
 | 
			
		||||
    private Vector<CallerRanking> attachingRateRankingList;
 | 
			
		||||
    @JsonProperty( "attachingRateRankingList" )
 | 
			
		||||
    private Vector<CallerRankingItem> attachingRateRankingList;
 | 
			
		||||
 | 
			
		||||
    // 续保率排行
 | 
			
		||||
    @JsonProperty("renewalRateRankingList")
 | 
			
		||||
    private Vector<CallerRanking> renewalRateRankingList;
 | 
			
		||||
    @JsonProperty( "renewalRateRankingList" )
 | 
			
		||||
    private Vector<CallerRankingItem> renewalRateRankingList;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user