完成部门业绩和坐席排行榜的mybatis改造!

This commit is contained in:
unknown 2023-07-30 22:11:00 +08:00
parent 8fd60d6b24
commit dcc925bb41
3 changed files with 17 additions and 22 deletions

View File

@ -42,7 +42,7 @@ public class CallerRankingList
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static CallerRankingList getCallerRankingList2( String departmentCode, String year, public static CallerRankingList getCallerRankingList( String departmentCode, String year,
String month ) throws IOException String month ) throws IOException
{ {
CallerRankingList rankingList = null; CallerRankingList rankingList = null;
@ -75,7 +75,7 @@ public class CallerRankingList
* @param month 排行榜月份 * @param month 排行榜月份
* @return CallerRankingList的实例对象 * @return CallerRankingList的实例对象
*/ */
public static CallerRankingList getCallerRankingList( String departmentCode, String year, public static CallerRankingList getCallerRankingList2( String departmentCode, String year,
String month ) throws ClassNotFoundException, SQLException String month ) throws ClassNotFoundException, SQLException
{ {
CallerRankingList rankingList = null; CallerRankingList rankingList = null;

View File

@ -14,8 +14,9 @@
package com.cpic.xim.web.controllers.archievement; package com.cpic.xim.web.controllers.archievement;
import java.io.IOException; import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -31,6 +32,9 @@ import com.cpic.xim.web.controllers.archievement.RankingList.RankingListResponse
@RequestMapping( "/archievement" ) @RequestMapping( "/archievement" )
public class ArchievementQueryController public class ArchievementQueryController
{ {
//日志
private static Logger logger = LoggerFactory.getLogger(ArchievementQueryController.class);
/** /**
* 查询坐席业绩 * 查询坐席业绩
*/ */
@ -106,19 +110,12 @@ public class ArchievementQueryController
success = true; success = true;
message = "调用成功!"; message = "调用成功!";
} }
catch ( SQLException error ) catch ( IOException error )
{ {
success = false; success = false;
message = "获取排行榜失败,原因:" + error.getMessage(); message = "获取排行榜失败,原因:" + error.getMessage();
error.printStackTrace(); logger.error(message, error);
}
catch ( ClassNotFoundException error )
{
success = false;
message = "获取排行榜失败原因oracle驱动加载失败" + error.getMessage();
error.printStackTrace();
} }
RankingListResponse response = new RankingListResponse( success, message, departmentCode, RankingListResponse response = new RankingListResponse( success, message, departmentCode,

View File

@ -13,25 +13,25 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; 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.util.ArrayList; 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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cpic.xim.mybatis.mapper.ArchievementMapper; import com.cpic.xim.mybatis.mapper.ArchievementMapper;
import com.cpic.xim.mybatis.pojo.MensualArchievementItem; import com.cpic.xim.mybatis.pojo.MensualArchievementItem;
import com.cpic.xim.utils.ranking.CallerRankingList;
import com.cpic.xim.utils.archievement.DepartmentArchievement; import com.cpic.xim.utils.archievement.DepartmentArchievement;
import com.cpic.xim.utils.ranking.CallerRankingList;
@SuppressWarnings( "all" ) @SuppressWarnings( "all" )
public class DesktopArchievementTest public class DesktopArchievementTest
{ {
private static String configFilePath = "mybatis/mybatis-config.xml"; private static String configFilePath = "mybatis/mybatis-config.xml";
private static Logger logger = LoggerFactory.getLogger(DesktopArchievementTest.class);
@Test @Test
public void testCallerRankingList() public void testCallerRankingList()
@ -42,13 +42,11 @@ public class DesktopArchievementTest
{ {
rankingList = CallerRankingList.getCallerRankingList( "QDI", "2023", "06" ); rankingList = CallerRankingList.getCallerRankingList( "QDI", "2023", "06" );
} }
catch ( SQLException error ) catch ( IOException error )
{ {
error.printStackTrace(); String message = "获取排行榜失败,原因:" + error.getMessage();
}
catch ( ClassNotFoundException error ) logger.error(message, error);
{
error.printStackTrace();
} }
assertNotNull( rankingList ); assertNotNull( rankingList );