保存进度!
This commit is contained in:
		@@ -9,22 +9,32 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
package com.cpic.xim.utils.archievement;
 | 
					package com.cpic.xim.utils.archievement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.sql.Connection;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.sql.DriverManager;
 | 
					 | 
				
			||||||
import java.sql.ResultSet;
 | 
					 | 
				
			||||||
import java.sql.SQLException;
 | 
					import java.sql.SQLException;
 | 
				
			||||||
import java.util.Vector;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					import java.util.HashMap;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import org.apache.ibatis.session.SqlSession;
 | 
				
			||||||
 | 
					import org.slf4j.Logger;
 | 
				
			||||||
 | 
					import org.slf4j.LoggerFactory;
 | 
				
			||||||
 | 
					import com.cpic.xim.mybatis.mapper.ArchievementMapper;
 | 
				
			||||||
 | 
					import com.cpic.xim.mybatis.pojo.MensualArchievementItem;
 | 
				
			||||||
 | 
					import com.cpic.xim.mybatis.utils.MybatisUtils;
 | 
				
			||||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
					import com.fasterxml.jackson.annotation.JsonProperty;
 | 
				
			||||||
import oracle.jdbc.OracleCallableStatement;
 | 
					 | 
				
			||||||
import oracle.jdbc.OracleTypes;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class DepartmentArchievement
 | 
					public class DepartmentArchievement
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 以后要改
 | 
					    // 以后要改
 | 
				
			||||||
    private static String jdbcURL = "jdbc:oracle:thin:@10.39.0.86:1521:xmcx1";
 | 
					    // private static String jdbcURL = "jdbc:oracle:thin:@10.39.0.86:1521:xmcx1";
 | 
				
			||||||
    private static String userName = "desktop_archievement_admin";
 | 
					    // private static String userName = "desktop_archievement_admin";
 | 
				
			||||||
    private static String password = "Cpic123456";
 | 
					    // private static String password = "Cpic123456";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // mybatis配置文件路径
 | 
				
			||||||
 | 
					    private static String mybatisConfigFile = "mybatis/mybatis-config.xml";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // log4j2
 | 
				
			||||||
 | 
					    private static Logger logger = LoggerFactory.getLogger(DepartmentArchievement.class);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 默认的构造函数,提供给json使用。
 | 
					     * 默认的构造函数,提供给json使用。
 | 
				
			||||||
@@ -32,27 +42,69 @@ public class DepartmentArchievement
 | 
				
			|||||||
    public DepartmentArchievement()
 | 
					    public DepartmentArchievement()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        this.totalArchievement = 0;
 | 
					        this.totalArchievement = 0;
 | 
				
			||||||
        this.mensualArchievementList = new Vector<>();
 | 
					        this.mensualArchievementList = new ArrayList<>();
 | 
				
			||||||
        this.insuranceRenewalRate = "";
 | 
					        this.insuranceRenewalRate = "";
 | 
				
			||||||
        this.attachingRate = "";
 | 
					        this.attachingRate = "";
 | 
				
			||||||
 | 
					        this.departmentCode = "";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief 构造函数,提供所有成员对象的值。
 | 
					     * @brief 构造函数,提供所有成员对象的值。
 | 
				
			||||||
     * @param totalArchievement
 | 
					     * @param departmentCode 部门代码
 | 
				
			||||||
     * @param mensualArchievementList
 | 
					     * @param totalArchievement 总业绩
 | 
				
			||||||
     * @param insuranceRenewalRate
 | 
					     * @param mensualArchievementList 每月业绩表
 | 
				
			||||||
     * @param attachingRate
 | 
					     * @param insuranceRenewalRate 续保率
 | 
				
			||||||
 | 
					     * @param attachingRate 车非渗透率
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public DepartmentArchievement( long totalArchievement, Vector<Long> mensualArchievementList,
 | 
					    public DepartmentArchievement( String departmentCode, long totalArchievement,
 | 
				
			||||||
            String insuranceRenewalRate, String attachingRate)
 | 
					            List<MensualArchievementItem> mensualArchievementList, String insuranceRenewalRate, String attachingRate)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        this.departmentCode = departmentCode;
 | 
				
			||||||
        this.totalArchievement = totalArchievement;
 | 
					        this.totalArchievement = totalArchievement;
 | 
				
			||||||
        this.mensualArchievementList = mensualArchievementList;
 | 
					        this.mensualArchievementList = mensualArchievementList;
 | 
				
			||||||
        this.insuranceRenewalRate = insuranceRenewalRate;
 | 
					        this.insuranceRenewalRate = insuranceRenewalRate;
 | 
				
			||||||
        this.attachingRate = attachingRate;
 | 
					        this.attachingRate = attachingRate;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static DepartmentArchievement getDepartmentArchievement( String departmentCode )
 | 
				
			||||||
 | 
					            throws IOException
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        DepartmentArchievement archievement = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            SqlSession session = MybatisUtils.getSqlSession( mybatisConfigFile );
 | 
				
			||||||
 | 
					            ArchievementMapper mapper = session.getMapper(ArchievementMapper.class);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // 参数集合
 | 
				
			||||||
 | 
					            HashMap<String, Object> params = new HashMap<>(5);
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            params.put("a_department_code", departmentCode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            mapper.getDepartmentArchievement(params);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            String totalArchievement = (String)params.get("a_total");
 | 
				
			||||||
 | 
					            String attachingRate = (String)params.get("a_attaching_rate");
 | 
				
			||||||
 | 
					            String renewalRate = (String)params.get("a_renewal_rate");
 | 
				
			||||||
 | 
					            List<MensualArchievementItem> mensual = (List<MensualArchievementItem>)params.get("a_mensual_cur");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            archievement = new DepartmentArchievement(departmentCode, 0, mensual, renewalRate, attachingRate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        catch ( IOException error )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            String errorMessage = "查询" + departmentCode + "业绩时出现错误。";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            logger.error(errorMessage, error);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            throw error;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return archievement;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 静态方法,用于根据部门代码,查询部门业绩,生成一个 DepartmentArchievement 对象。
 | 
					     * 静态方法,用于根据部门代码,查询部门业绩,生成一个 DepartmentArchievement 对象。
 | 
				
			||||||
     * @param departmentCode 部门代码
 | 
					     * @param departmentCode 部门代码
 | 
				
			||||||
@@ -60,87 +112,87 @@ public class DepartmentArchievement
 | 
				
			|||||||
     * @throws SQLException
 | 
					     * @throws SQLException
 | 
				
			||||||
     * @throws ClassNotFoundException
 | 
					     * @throws ClassNotFoundException
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static DepartmentArchievement queryDepartmentArchievement( String departmentCode )
 | 
					    // public static DepartmentArchievement queryDepartmentArchievement( String departmentCode )
 | 
				
			||||||
            throws SQLException, ClassNotFoundException
 | 
					    //         throws SQLException, ClassNotFoundException
 | 
				
			||||||
    {
 | 
					    // {
 | 
				
			||||||
        Connection connection = null;
 | 
					    //     Connection connection = null;
 | 
				
			||||||
        java.sql.CallableStatement statement = null;
 | 
					    //     java.sql.CallableStatement statement = null;
 | 
				
			||||||
        ResultSet menusual_cursor = null;
 | 
					    //     ResultSet menusual_cursor = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        DepartmentArchievement archievement = null;
 | 
					    //     DepartmentArchievement archievement = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String sql = "{call telsale_archievement_pkg.department_archievement(?,?,?,?,?)}";
 | 
					    //     String sql = "{call telsale_archievement_pkg.department_archievement(?,?,?,?,?)}";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try
 | 
					    //     try
 | 
				
			||||||
        {
 | 
					    //     {
 | 
				
			||||||
            Class.forName( "oracle.jdbc.driver.OracleDriver" );
 | 
					    //         Class.forName( "oracle.jdbc.driver.OracleDriver" );
 | 
				
			||||||
            connection = DriverManager.getConnection( jdbcURL, userName, password );
 | 
					    //         connection = DriverManager.getConnection( jdbcURL, userName, password );
 | 
				
			||||||
            statement = connection.prepareCall( sql );
 | 
					    //         statement = connection.prepareCall( sql );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            statement.setString( 1, departmentCode );
 | 
					    //         statement.setString( 1, departmentCode );
 | 
				
			||||||
            statement.registerOutParameter( 2, java.sql.Types.VARCHAR );
 | 
					    //         statement.registerOutParameter( 2, java.sql.Types.VARCHAR );
 | 
				
			||||||
            statement.registerOutParameter( 3, java.sql.Types.VARCHAR );
 | 
					    //         statement.registerOutParameter( 3, java.sql.Types.VARCHAR );
 | 
				
			||||||
            statement.registerOutParameter( 4, java.sql.Types.INTEGER );
 | 
					    //         statement.registerOutParameter( 4, java.sql.Types.INTEGER );
 | 
				
			||||||
            statement.registerOutParameter( 5, OracleTypes.CURSOR );
 | 
					    //         statement.registerOutParameter( 5, OracleTypes.CURSOR );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            statement.execute();
 | 
					    //         statement.execute();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Vector<Long> menusual_list = new Vector<Long>();
 | 
					    //         Vector<Long> menusual_list = new Vector<Long>();
 | 
				
			||||||
            String attach_rate = statement.getString( 2 );
 | 
					    //         String attach_rate = statement.getString( 2 );
 | 
				
			||||||
            String renewal_rate = statement.getString( 3 );
 | 
					    //         String renewal_rate = statement.getString( 3 );
 | 
				
			||||||
            long totalArchievement = statement.getInt( 4 );
 | 
					    //         long totalArchievement = statement.getInt( 4 );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            menusual_cursor = ((OracleCallableStatement) statement).getCursor( 5 );
 | 
					    //         menusual_cursor = ((OracleCallableStatement) statement).getCursor( 5 );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            while ( menusual_cursor.next())
 | 
					    //         while ( menusual_cursor.next())
 | 
				
			||||||
            {
 | 
					    //         {
 | 
				
			||||||
                menusual_list.add( menusual_cursor.getLong( 2 ) );
 | 
					    //             menusual_list.add( menusual_cursor.getLong( 2 ) );
 | 
				
			||||||
            }
 | 
					    //         }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            archievement = new DepartmentArchievement( totalArchievement, menusual_list,
 | 
					    //         archievement = new DepartmentArchievement( departmentCode, totalArchievement,
 | 
				
			||||||
                    renewal_rate, attach_rate );
 | 
					    //                 menusual_list, renewal_rate, attach_rate );
 | 
				
			||||||
        }
 | 
					    //     }
 | 
				
			||||||
        finally
 | 
					    //     finally
 | 
				
			||||||
        {
 | 
					    //     {
 | 
				
			||||||
            try
 | 
					    //         try
 | 
				
			||||||
            {
 | 
					    //         {
 | 
				
			||||||
                if ( menusual_cursor != null )
 | 
					    //             if ( menusual_cursor != null )
 | 
				
			||||||
                {
 | 
					    //             {
 | 
				
			||||||
                    menusual_cursor.close();
 | 
					    //                 menusual_cursor.close();
 | 
				
			||||||
                }
 | 
					    //             }
 | 
				
			||||||
            }
 | 
					    //         }
 | 
				
			||||||
            catch ( Exception exception )
 | 
					    //         catch ( Exception exception )
 | 
				
			||||||
            {
 | 
					    //         {
 | 
				
			||||||
                exception.printStackTrace();
 | 
					    //             exception.printStackTrace();
 | 
				
			||||||
            }
 | 
					    //         }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            try
 | 
					    //         try
 | 
				
			||||||
            {
 | 
					    //         {
 | 
				
			||||||
                if ( statement != null )
 | 
					    //             if ( statement != null )
 | 
				
			||||||
                {
 | 
					    //             {
 | 
				
			||||||
                    statement.close();
 | 
					    //                 statement.close();
 | 
				
			||||||
                }
 | 
					    //             }
 | 
				
			||||||
            }
 | 
					    //         }
 | 
				
			||||||
            catch ( Exception exception )
 | 
					    //         catch ( Exception exception )
 | 
				
			||||||
            {
 | 
					    //         {
 | 
				
			||||||
                exception.printStackTrace();
 | 
					    //             exception.printStackTrace();
 | 
				
			||||||
            }
 | 
					    //         }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            try
 | 
					    //         try
 | 
				
			||||||
            {
 | 
					    //         {
 | 
				
			||||||
                if ( connection != null )
 | 
					    //             if ( connection != null )
 | 
				
			||||||
                {
 | 
					    //             {
 | 
				
			||||||
                    connection.close();
 | 
					    //                 connection.close();
 | 
				
			||||||
                }
 | 
					    //             }
 | 
				
			||||||
            }
 | 
					    //         }
 | 
				
			||||||
            catch ( Exception exception )
 | 
					    //         catch ( Exception exception )
 | 
				
			||||||
            {
 | 
					    //         {
 | 
				
			||||||
                exception.printStackTrace();
 | 
					    //             exception.printStackTrace();
 | 
				
			||||||
            }
 | 
					    //         }
 | 
				
			||||||
        }
 | 
					    //     }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return archievement;
 | 
					    //     return archievement;
 | 
				
			||||||
    }
 | 
					    // }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public long getTotalArchievement()
 | 
					    public long getTotalArchievement()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -152,12 +204,12 @@ public class DepartmentArchievement
 | 
				
			|||||||
        this.totalArchievement = totalArchievement;
 | 
					        this.totalArchievement = totalArchievement;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Vector<Long> getMensualArchievementList()
 | 
					    public List<MensualArchievementItem> getMensualArchievementList()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return mensualArchievementList;
 | 
					        return mensualArchievementList;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void setMensualArchievementList( Vector<Long> mensualArchievementList )
 | 
					    public void setMensualArchievementList( List<MensualArchievementItem> mensualArchievementList )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        this.mensualArchievementList = mensualArchievementList;
 | 
					        this.mensualArchievementList = mensualArchievementList;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -182,13 +234,26 @@ public class DepartmentArchievement
 | 
				
			|||||||
        this.attachingRate = attachingRate;
 | 
					        this.attachingRate = attachingRate;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getDepartmentCode()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return departmentCode;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setDepartmentCode( String departmentCode )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.departmentCode = departmentCode;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty( "department_code" )
 | 
				
			||||||
 | 
					    private String departmentCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @JsonProperty( "total_archievement" )
 | 
					    @JsonProperty( "total_archievement" )
 | 
				
			||||||
    private long totalArchievement; // 总业绩
 | 
					    private long totalArchievement; // 总业绩
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 每月业绩列表
 | 
					    // 每月业绩列表
 | 
				
			||||||
    // 要保证数据是按照月份排序。
 | 
					    // 要保证数据是按照月份排序。
 | 
				
			||||||
    @JsonProperty( "mensual_archievement_list" )
 | 
					    @JsonProperty( "mensual_archievement_list" )
 | 
				
			||||||
    private Vector<Long> mensualArchievementList;
 | 
					    private List<MensualArchievementItem> mensualArchievementList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @JsonProperty( "insurance_renewal_rate" )
 | 
					    @JsonProperty( "insurance_renewal_rate" )
 | 
				
			||||||
    private String insuranceRenewalRate; // 续保率
 | 
					    private String insuranceRenewalRate; // 续保率
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * @Author: Kane
 | 
				
			||||||
 | 
					 * @Date: 2023-07-28 18:39:50
 | 
				
			||||||
 | 
					 * @LastEditors: Kane
 | 
				
			||||||
 | 
					 * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/utils/exception/ConfigFileExecption.java
 | 
				
			||||||
 | 
					 * @Description: 配置文件异常
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package com.cpic.xim.utils.exception;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class ConfigFileExecption extends Exception
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public ConfigFileExecption()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        super("配置文件错误!");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ConfigFileExecption( String message )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        super( message );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -13,6 +13,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package com.cpic.xim.web.controllers.archievement;
 | 
					package com.cpic.xim.web.controllers.archievement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.sql.SQLException;
 | 
					import java.sql.SQLException;
 | 
				
			||||||
import java.util.Vector;
 | 
					import java.util.Vector;
 | 
				
			||||||
import org.springframework.stereotype.Controller;
 | 
					import org.springframework.stereotype.Controller;
 | 
				
			||||||
@@ -56,7 +57,7 @@ public class ArchievementQueryController
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            // 查询业绩
 | 
					            // 查询业绩
 | 
				
			||||||
            departmentArch = DepartmentArchievement
 | 
					            departmentArch = DepartmentArchievement
 | 
				
			||||||
                    .queryDepartmentArchievement( request.getDepartmentCode() );
 | 
					                    .getDepartmentArchievement( request.getDepartmentCode() );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            result.setTotalArchievement( departmentArch.getTotalArchievement() );
 | 
					            result.setTotalArchievement( departmentArch.getTotalArchievement() );
 | 
				
			||||||
            result.setInsuranceRenewalRate( departmentArch.getInsuranceRenewalRate() );
 | 
					            result.setInsuranceRenewalRate( departmentArch.getInsuranceRenewalRate() );
 | 
				
			||||||
@@ -67,11 +68,7 @@ public class ArchievementQueryController
 | 
				
			|||||||
            result.addBackwardStaff( "王炜" );
 | 
					            result.addBackwardStaff( "王炜" );
 | 
				
			||||||
            result.setMensualArchievementList( departmentArch.getMensualArchievementList() );
 | 
					            result.setMensualArchievementList( departmentArch.getMensualArchievementList() );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        catch ( SQLException error )
 | 
					        catch ( IOException error )
 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        catch ( ClassNotFoundException error )
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,9 +10,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package com.cpic.xim.web.controllers.archievement;
 | 
					package com.cpic.xim.web.controllers.archievement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.LinkedList;
 | 
				
			||||||
import java.util.Vector;
 | 
					import java.util.Vector;
 | 
				
			||||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
					import com.cpic.xim.mybatis.pojo.MensualArchievementItem;
 | 
				
			||||||
import com.cpic.xim.web.controllers.QueryResult;
 | 
					import com.cpic.xim.web.controllers.QueryResult;
 | 
				
			||||||
 | 
					import com.fasterxml.jackson.annotation.JsonProperty;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 查询部门业绩返回结果。
 | 
					 * 查询部门业绩返回结果。
 | 
				
			||||||
@@ -22,7 +24,7 @@ public class DepartmentArchievementQueryResult extends QueryResult
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    DepartmentArchievementQueryResult()
 | 
					    DepartmentArchievementQueryResult()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        mensualArchievementList = new Vector<Long>();
 | 
					        mensualArchievementList = new LinkedList<MensualArchievementItem>();
 | 
				
			||||||
        advanceRewardGainers = new Vector<String>();
 | 
					        advanceRewardGainers = new Vector<String>();
 | 
				
			||||||
        leadingRewardGainers = new Vector<String>();
 | 
					        leadingRewardGainers = new Vector<String>();
 | 
				
			||||||
        backwardList = new Vector<String>();
 | 
					        backwardList = new Vector<String>();
 | 
				
			||||||
@@ -38,12 +40,12 @@ public class DepartmentArchievementQueryResult extends QueryResult
 | 
				
			|||||||
        this.totalArchievement = totalArchievement;
 | 
					        this.totalArchievement = totalArchievement;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Vector<Long> getMensualArchievementList()
 | 
					    public LinkedList<MensualArchievementItem> getMensualArchievementList()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return mensualArchievementList;
 | 
					        return mensualArchievementList;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void setMensualArchievementList( Vector<Long> mensualArchievementList )
 | 
					    public void setMensualArchievementList( LinkedList<MensualArchievementItem> mensualArchievementList )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        this.mensualArchievementList = mensualArchievementList;
 | 
					        this.mensualArchievementList = mensualArchievementList;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -119,7 +121,7 @@ public class DepartmentArchievementQueryResult extends QueryResult
 | 
				
			|||||||
    // 每月业绩列表
 | 
					    // 每月业绩列表
 | 
				
			||||||
    // 要保证数据是按照月份排序。
 | 
					    // 要保证数据是按照月份排序。
 | 
				
			||||||
    @JsonProperty( "mensual_archievement_list" )
 | 
					    @JsonProperty( "mensual_archievement_list" )
 | 
				
			||||||
    private Vector<Long> mensualArchievementList;
 | 
					    private LinkedList<MensualArchievementItem> mensualArchievementList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @JsonProperty( "insurance_renewal_rate" )
 | 
					    @JsonProperty( "insurance_renewal_rate" )
 | 
				
			||||||
    private String insuranceRenewalRate; // 续保率
 | 
					    private String insuranceRenewalRate; // 续保率
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,14 +14,16 @@ import static org.junit.Assert.assertTrue;
 | 
				
			|||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.io.InputStream;
 | 
					import java.io.InputStream;
 | 
				
			||||||
import java.sql.SQLException;
 | 
					import java.sql.SQLException;
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.HashMap;
 | 
					import java.util.HashMap;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
import org.apache.ibatis.io.Resources;
 | 
					import org.apache.ibatis.io.Resources;
 | 
				
			||||||
import org.apache.ibatis.session.SqlSession;
 | 
					import org.apache.ibatis.session.SqlSession;
 | 
				
			||||||
import org.apache.ibatis.session.SqlSessionFactory;
 | 
					import org.apache.ibatis.session.SqlSessionFactory;
 | 
				
			||||||
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
 | 
					import org.apache.ibatis.session.SqlSessionFactoryBuilder;
 | 
				
			||||||
import org.junit.Test;
 | 
					import org.junit.Test;
 | 
				
			||||||
import com.cpic.xim.mybatis.mapper.ArchievementMapper;
 | 
					import com.cpic.xim.mybatis.mapper.ArchievementMapper;
 | 
				
			||||||
import com.cpic.xim.utils.archievement.DepartmentArchievement;
 | 
					import com.cpic.xim.mybatis.pojo.MensualArchievementItem;
 | 
				
			||||||
import com.cpic.xim.utils.ranking.CallerRankingList;
 | 
					import com.cpic.xim.utils.ranking.CallerRankingList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -31,23 +33,6 @@ public class DesktopArchievementTest
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    private static String configFilePath = "mybatis/mybatis-config.xml";
 | 
					    private static String configFilePath = "mybatis/mybatis-config.xml";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    public void testQueryArchievement()
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        try
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            DepartmentArchievement.queryDepartmentArchievement( "QDI" );
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        catch ( SQLException error )
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            System.out.println( error.getMessage() );
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        catch ( ClassNotFoundException error )
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            System.out.println( error.getMessage() );
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    public void testCallerRankingList()
 | 
					    public void testCallerRankingList()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -80,19 +65,23 @@ public class DesktopArchievementTest
 | 
				
			|||||||
            SqlSession session = factory.openSession();
 | 
					            SqlSession session = factory.openSession();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ArchievementMapper mapper = session.getMapper( ArchievementMapper.class );
 | 
					            ArchievementMapper mapper = session.getMapper( ArchievementMapper.class );
 | 
				
			||||||
 | 
					            ArrayList<MensualArchievementItem> mensual = null;
 | 
				
			||||||
 | 
					            HashMap<String, Object> params = new HashMap<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            HashMap<String,Object> params = new HashMap<>();
 | 
					            params.put( "a_department_code", "QDI" );
 | 
				
			||||||
            params.put("a_department_code", "QDI");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            mapper.getDepartmentArchievement( params );
 | 
					            mapper.getDepartmentArchievement( params );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            System.out.println(params.toString());
 | 
					            mensual = (List<MensualArchievementItem>)params.get("a_mensual_cur");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            System.out.println( params.toString() );
 | 
				
			||||||
 | 
					            System.out.println( mensual.toString() );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            assertTrue( params.size() > 1 );
 | 
					            assertTrue( params.size() > 1 );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        catch (IOException error )
 | 
					        catch ( IOException error )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            assert( false );
 | 
					            assert (false);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user