diff --git a/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/pojo/TelsalerRenewalRateRecord.java b/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/pojo/TelsalerRenewalRateRecord.java new file mode 100644 index 0000000..9c38c07 --- /dev/null +++ b/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/pojo/TelsalerRenewalRateRecord.java @@ -0,0 +1,179 @@ +/* + * @Author: Kane + * @Date: 2023-10-09 21:45:39 + * @LastEditors: Kane + * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/pojo/TelsalerRenewalRateRecord.java + * @Description: BI导出的续保率Excel文件行记录。 + * + * Copyright (c) ${2023} by Kane, All Rights Reserved. + */ +package com.cpic.xim.mybatis.pojo; + +public class TelsalerRenewalRateRecord +{ + private String 责任人; + private double 机构目标值; + private double 到期数全月; + private double 序时到期数占比; + private double 个车续保率序时; + private double 个车续保率全月; + private double 环比昨日; + private double 环比上月; + + public TelsalerRenewalRateRecord( String 责任人, double 机构目标值, double 到期数全月, double 序时到期数占比, double 个车续保率序时, double 个车续保率全月, double 环比昨日, double 环比上月 ) + { + this.责任人 = 责任人; + this.机构目标值 = 机构目标值; + this.到期数全月 = 到期数全月; + this.序时到期数占比 = 序时到期数占比; + this.个车续保率序时 = 个车续保率序时; + this.个车续保率全月 = 个车续保率全月; + this.环比昨日 = 环比昨日; + this.环比上月 = 环比上月; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + ((责任人 == null) ? 0 : 责任人.hashCode()); + long temp; + temp = Double.doubleToLongBits( 机构目标值 ); + result = prime * result + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits( 到期数全月 ); + result = prime * result + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits( 序时到期数占比 ); + result = prime * result + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits( 个车续保率序时 ); + result = prime * result + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits( 个车续保率全月 ); + result = prime * result + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits( 环比昨日 ); + result = prime * result + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits( 环比上月 ); + result = prime * result + (int) (temp ^ (temp >>> 32)); + return result; + } + + @Override + public boolean equals( Object obj ) + { + if ( this == obj ) + return true; + if ( obj == null ) + return false; + if ( getClass() != obj.getClass() ) + return false; + TelsalerRenewalRateRecord other = (TelsalerRenewalRateRecord) obj; + if ( 责任人 == null ) + { + if ( other.责任人 != null ) + return false; + } + else if ( !责任人.equals( other.责任人 ) ) + return false; + if ( Double.doubleToLongBits( 机构目标值 ) != Double.doubleToLongBits( other.机构目标值 ) ) + return false; + if ( Double.doubleToLongBits( 到期数全月 ) != Double.doubleToLongBits( other.到期数全月 ) ) + return false; + if ( Double.doubleToLongBits( 序时到期数占比 ) != Double.doubleToLongBits( other.序时到期数占比 ) ) + return false; + if ( Double.doubleToLongBits( 个车续保率序时 ) != Double.doubleToLongBits( other.个车续保率序时 ) ) + return false; + if ( Double.doubleToLongBits( 个车续保率全月 ) != Double.doubleToLongBits( other.个车续保率全月 ) ) + return false; + if ( Double.doubleToLongBits( 环比昨日 ) != Double.doubleToLongBits( other.环比昨日 ) ) + return false; + if ( Double.doubleToLongBits( 环比上月 ) != Double.doubleToLongBits( other.环比上月 ) ) + return false; + return true; + } + + @Override + public String toString() + { + return "TelsalerRenewalRateRecord [责任人=" + 责任人 + ", 机构目标值=" + 机构目标值 + ", 到期数全月=" + 到期数全月 + + ", 序时到期数占比=" + 序时到期数占比 + ", 个车续保率序时=" + 个车续保率序时 + ", 个车续保率全月=" + 个车续保率全月 + + ", 环比昨日=" + 环比昨日 + ", 环比上月=" + 环比上月 + "]"; + } + + public String get责任人() + { + return 责任人; + } + + public void set责任人( String 责任人 ) + { + this.责任人 = 责任人; + } + + public double get机构目标值() + { + return 机构目标值; + } + + public void set机构目标值( double 机构目标值 ) + { + this.机构目标值 = 机构目标值; + } + + public double get到期数全月() + { + return 到期数全月; + } + + public void set到期数全月( double 到期数全月 ) + { + this.到期数全月 = 到期数全月; + } + + public double get序时到期数占比() + { + return 序时到期数占比; + } + public void set序时到期数占比( double 序时到期数占比 ) + { + this.序时到期数占比 = 序时到期数占比; + } + + public double get个车续保率序时() + { + return 个车续保率序时; + } + + public void set个车续保率序时( double 个车续保率序时 ) + { + this.个车续保率序时 = 个车续保率序时; + } + + public double get个车续保率全月() + { + return 个车续保率全月; + } + + public void set个车续保率全月( double 个车续保率全月 ) + { + this.个车续保率全月 = 个车续保率全月; + } + + public double get环比昨日() + { + return 环比昨日; + } + + public void set环比昨日( double 环比昨日 ) + { + this.环比昨日 = 环比昨日; + } + + public double get环比上月() + { + return 环比上月; + } + + public void set环比上月( double 环比上月 ) + { + this.环比上月 = 环比上月; + } +} \ No newline at end of file diff --git a/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/utils/data/TelsalerArchievementData.java b/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/utils/data/TelsalerArchievementData.java index 4b1b361..8c7b360 100644 --- a/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/utils/data/TelsalerArchievementData.java +++ b/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/utils/data/TelsalerArchievementData.java @@ -20,7 +20,7 @@ import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; -import com.cpic.xim.mybatis.pojo.TelsalerAttachingRateRecord; +import com.cpic.xim.mybatis.pojo.*; import com.cpic.xim.utils.poi.MyPOIUtils; /** @@ -31,7 +31,7 @@ public class TelsalerArchievementData private static Logger logger = LoggerFactory.getLogger( TelsalerArchievementData.class ); /** - * + * 从excel文件读取坐席的车非渗透率数据 * @param filePath 文件路径 * @param summaryDate 统计日期 * @return 返回一个ArrayList保存的TelsalerAttachingRateRecord记录数组。 @@ -39,7 +39,8 @@ public class TelsalerArchievementData * @throws InvalidFormatException excel单元格格式错误时抛出 */ public static ArrayList importTelsalerAttachingRateRecordFromXlsx( - String filePath, LocalDate summaryDate, boolean hasCaptionRow ) throws IOException, InvalidFormatException + String filePath, LocalDate summaryDate, boolean hasCaptionRow ) + throws IOException, InvalidFormatException { ArrayList records = new ArrayList<>( 200 ); @@ -67,6 +68,7 @@ public class TelsalerArchievementData // 坐席名称 name = MyPOIUtils.getStringCellValue( row, 1 ); + // 忽略坐席名称为空的行 if ( name.equals( "全流程" ) || name.equals( "其他" ) || name.isEmpty() ) { continue; @@ -110,8 +112,8 @@ public class TelsalerArchievementData } catch ( NullPointerException error ) { - String message = "第" + String.valueOf(rowIndex) + "行出现NullPointerException异常"; - logger.error(message, error); + String message = "第" + String.valueOf( rowIndex ) + "行出现NullPointerException异常"; + logger.error( message, error ); } } } @@ -132,4 +134,82 @@ public class TelsalerArchievementData return records; } + + /** + * 从excel文件读取坐席的车非渗透率数据。 + * @param filePath + * @param hasCaptionRow + * @param summaryDate + * @return + */ + public static ArrayList importTelsalerRenewalRateFromXlsx( + String filePath, String sheetName, boolean hasCaptionRow, LocalDate summaryDate ) + throws IOException + { + ArrayList records = new ArrayList<>( 200 ); + + Workbook wb = null; + Sheet sheet = null; + + try + { + wb = WorkbookFactory.create( new File( filePath ) ); + sheet = wb.getSheet( sheetName ); + int rowIndex = 0; + + for ( Row row : sheet ) + { + rowIndex = row.getRowNum(); + + if ( hasCaptionRow == true && rowIndex == 0 ) + { + continue; + } + + try + { + String 责任人 = MyPOIUtils.getStringCellValue( row, 0 ); + + if ( 责任人.isEmpty() == true ) + { + continue; + } + + double 机构目标值 = MyPOIUtils.getNumbericCellValue( row, 1 ); + double 到期数全月 = MyPOIUtils.getNumbericCellValue( row, 2 ); + double 序时到期数占比 = MyPOIUtils.getNumbericCellValue( row, 3 ); + double 个车续保率序时 = MyPOIUtils.getNumbericCellValue( row, 4 ); + double 个车续保率全月 = MyPOIUtils.getNumbericCellValue( row, 5 ); + double 环比昨日 = MyPOIUtils.getNumbericCellValue( row, 6 ); + double 环比上月 = MyPOIUtils.getNumbericCellValue( row, 7 ); + + TelsalerRenewalRateRecord record = new TelsalerRenewalRateRecord(责任人, 机构目标值, 到期数全月, 序时到期数占比, 个车续保率序时, 个车续保率全月, 环比昨日, 环比上月); + + records.add(record); + } + catch ( NullPointerException error ) + { + String message = "第" + String.valueOf( rowIndex ) + "行出现NullPointerException异常"; + + logger.error( message, error ); + } + } + } + finally + { + try + { + if ( wb != null ) + { + wb.close(); + } + } + catch ( Exception error ) + { + error.printStackTrace(); + } + } + + return records; + } }