加入两个报表读取函数。
This commit is contained in:
		@@ -0,0 +1,275 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-10-10 14:50:55
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/pojo/DepartmentArchievementRecord.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2023} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.mybatis.pojo;
 | 
			
		||||
 | 
			
		||||
public class DepartmentArchievementRecord
 | 
			
		||||
{
 | 
			
		||||
    // 部门
 | 
			
		||||
    private String departmentName;
 | 
			
		||||
    // 目标值-机构
 | 
			
		||||
    private double departmentObject;
 | 
			
		||||
    // 目标差距
 | 
			
		||||
    private double objectGap;
 | 
			
		||||
    // 车险保费(万)
 | 
			
		||||
    private double motoPremium;
 | 
			
		||||
    // 车险保费占比
 | 
			
		||||
    private double motoPremiumProPortion;
 | 
			
		||||
    // 非车保费(万)
 | 
			
		||||
    private double nomotoPremium;
 | 
			
		||||
    // 当月保费渗透率
 | 
			
		||||
    private double attachingRate;
 | 
			
		||||
    // 保费渗透率环比上月
 | 
			
		||||
    private double attachingRateChange;
 | 
			
		||||
    // 当月客户渗透率
 | 
			
		||||
    private double customerHandleRate;
 | 
			
		||||
    // 客户渗透率环比上月
 | 
			
		||||
    private double customerHandleRateChange;
 | 
			
		||||
    // 当月车非客均保费
 | 
			
		||||
    private double premiumPerCustomer;
 | 
			
		||||
    // 客均保费环比上月
 | 
			
		||||
    private double premiumPerCustomerChange;
 | 
			
		||||
 | 
			
		||||
    public DepartmentArchievementRecord( String departmentName, double departmentObject,
 | 
			
		||||
            double objectGap, double motoPremium, double motoPremiumProPortion,
 | 
			
		||||
            double nomotoPremium, double attachingRate, double attachingRateChange,
 | 
			
		||||
            double customerHandleRate, double customerHandleRateChange, double premiumPerCustomer,
 | 
			
		||||
            double premiumPerCustomerChange )
 | 
			
		||||
    {
 | 
			
		||||
        this.departmentName = departmentName;
 | 
			
		||||
        this.departmentObject = departmentObject;
 | 
			
		||||
        this.objectGap = objectGap;
 | 
			
		||||
        this.motoPremium = motoPremium;
 | 
			
		||||
        this.motoPremiumProPortion = motoPremiumProPortion;
 | 
			
		||||
        this.nomotoPremium = nomotoPremium;
 | 
			
		||||
        this.attachingRate = attachingRate;
 | 
			
		||||
        this.attachingRateChange = attachingRateChange;
 | 
			
		||||
        this.customerHandleRate = customerHandleRate;
 | 
			
		||||
        this.customerHandleRateChange = customerHandleRateChange;
 | 
			
		||||
        this.premiumPerCustomer = premiumPerCustomer;
 | 
			
		||||
        this.premiumPerCustomerChange = premiumPerCustomerChange;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String toString()
 | 
			
		||||
    {
 | 
			
		||||
        return "DepartmentArchievementRecord [departmentName=" + departmentName
 | 
			
		||||
                + ", departmentObject=" + departmentObject + ", objectGap=" + objectGap
 | 
			
		||||
                + ", motoPremium=" + motoPremium + ", motoPremiumProPortion="
 | 
			
		||||
                + motoPremiumProPortion + ", nomotoPremium=" + nomotoPremium + ", attachingRate="
 | 
			
		||||
                + attachingRate + ", attachingRateChange=" + attachingRateChange
 | 
			
		||||
                + ", customerHandleRate=" + customerHandleRate + ", customerHandleRateChange="
 | 
			
		||||
                + customerHandleRateChange + ", premiumPerCustomer=" + premiumPerCustomer
 | 
			
		||||
                + ", premiumPerCustomerChange=" + premiumPerCustomerChange + "]";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int hashCode()
 | 
			
		||||
    {
 | 
			
		||||
        final int prime = 31;
 | 
			
		||||
        int result = 1;
 | 
			
		||||
        result = prime * result + ((departmentName == null) ? 0 : departmentName.hashCode());
 | 
			
		||||
        long temp;
 | 
			
		||||
        temp = Double.doubleToLongBits( departmentObject );
 | 
			
		||||
        result = prime * result + (int) (temp ^ (temp >>> 32));
 | 
			
		||||
        temp = Double.doubleToLongBits( objectGap );
 | 
			
		||||
        result = prime * result + (int) (temp ^ (temp >>> 32));
 | 
			
		||||
        temp = Double.doubleToLongBits( motoPremium );
 | 
			
		||||
        result = prime * result + (int) (temp ^ (temp >>> 32));
 | 
			
		||||
        temp = Double.doubleToLongBits( motoPremiumProPortion );
 | 
			
		||||
        result = prime * result + (int) (temp ^ (temp >>> 32));
 | 
			
		||||
        temp = Double.doubleToLongBits( nomotoPremium );
 | 
			
		||||
        result = prime * result + (int) (temp ^ (temp >>> 32));
 | 
			
		||||
        temp = Double.doubleToLongBits( attachingRate );
 | 
			
		||||
        result = prime * result + (int) (temp ^ (temp >>> 32));
 | 
			
		||||
        temp = Double.doubleToLongBits( attachingRateChange );
 | 
			
		||||
        result = prime * result + (int) (temp ^ (temp >>> 32));
 | 
			
		||||
        temp = Double.doubleToLongBits( customerHandleRate );
 | 
			
		||||
        result = prime * result + (int) (temp ^ (temp >>> 32));
 | 
			
		||||
        temp = Double.doubleToLongBits( customerHandleRateChange );
 | 
			
		||||
        result = prime * result + (int) (temp ^ (temp >>> 32));
 | 
			
		||||
        temp = Double.doubleToLongBits( premiumPerCustomer );
 | 
			
		||||
        result = prime * result + (int) (temp ^ (temp >>> 32));
 | 
			
		||||
        temp = Double.doubleToLongBits( premiumPerCustomerChange );
 | 
			
		||||
        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;
 | 
			
		||||
        DepartmentArchievementRecord other = (DepartmentArchievementRecord) obj;
 | 
			
		||||
        if ( departmentName == null )
 | 
			
		||||
        {
 | 
			
		||||
            if ( other.departmentName != null )
 | 
			
		||||
                return false;
 | 
			
		||||
        }
 | 
			
		||||
        else if ( !departmentName.equals( other.departmentName ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( Double.doubleToLongBits( departmentObject ) != Double
 | 
			
		||||
                .doubleToLongBits( other.departmentObject ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( Double.doubleToLongBits( objectGap ) != Double.doubleToLongBits( other.objectGap ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( Double.doubleToLongBits( motoPremium ) != Double
 | 
			
		||||
                .doubleToLongBits( other.motoPremium ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( Double.doubleToLongBits( motoPremiumProPortion ) != Double
 | 
			
		||||
                .doubleToLongBits( other.motoPremiumProPortion ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( Double.doubleToLongBits( nomotoPremium ) != Double
 | 
			
		||||
                .doubleToLongBits( other.nomotoPremium ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( Double.doubleToLongBits( attachingRate ) != Double
 | 
			
		||||
                .doubleToLongBits( other.attachingRate ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( Double.doubleToLongBits( attachingRateChange ) != Double
 | 
			
		||||
                .doubleToLongBits( other.attachingRateChange ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( Double.doubleToLongBits( customerHandleRate ) != Double
 | 
			
		||||
                .doubleToLongBits( other.customerHandleRate ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( Double.doubleToLongBits( customerHandleRateChange ) != Double
 | 
			
		||||
                .doubleToLongBits( other.customerHandleRateChange ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( Double.doubleToLongBits( premiumPerCustomer ) != Double
 | 
			
		||||
                .doubleToLongBits( other.premiumPerCustomer ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( Double.doubleToLongBits( premiumPerCustomerChange ) != Double
 | 
			
		||||
                .doubleToLongBits( other.premiumPerCustomerChange ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getDepartmentName()
 | 
			
		||||
    {
 | 
			
		||||
        return departmentName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setDepartmentName( String departmentName )
 | 
			
		||||
    {
 | 
			
		||||
        this.departmentName = departmentName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getDepartmentObject()
 | 
			
		||||
    {
 | 
			
		||||
        return departmentObject;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setDepartmentObject( double departmentObject )
 | 
			
		||||
    {
 | 
			
		||||
        this.departmentObject = departmentObject;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getObjectGap()
 | 
			
		||||
    {
 | 
			
		||||
        return objectGap;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setObjectGap( double objectGap )
 | 
			
		||||
    {
 | 
			
		||||
        this.objectGap = objectGap;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getMotoPremium()
 | 
			
		||||
    {
 | 
			
		||||
        return motoPremium;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setMotoPremium( double motoPremium )
 | 
			
		||||
    {
 | 
			
		||||
        this.motoPremium = motoPremium;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getMotoPremiumProPortion()
 | 
			
		||||
    {
 | 
			
		||||
        return motoPremiumProPortion;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setMotoPremiumProPortion( double motoPremiumProPortion )
 | 
			
		||||
    {
 | 
			
		||||
        this.motoPremiumProPortion = motoPremiumProPortion;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getNomotoPremium()
 | 
			
		||||
    {
 | 
			
		||||
        return nomotoPremium;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setNomotoPremium( double nomotoPremium )
 | 
			
		||||
    {
 | 
			
		||||
        this.nomotoPremium = nomotoPremium;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getAttachingRate()
 | 
			
		||||
    {
 | 
			
		||||
        return attachingRate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setAttachingRate( double attachingRate )
 | 
			
		||||
    {
 | 
			
		||||
        this.attachingRate = attachingRate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getAttachingRateChange()
 | 
			
		||||
    {
 | 
			
		||||
        return attachingRateChange;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setAttachingRateChange( double attachingRateChange )
 | 
			
		||||
    {
 | 
			
		||||
        this.attachingRateChange = attachingRateChange;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getCustomerHandleRate()
 | 
			
		||||
    {
 | 
			
		||||
        return customerHandleRate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCustomerHandleRate( double customerHandleRate )
 | 
			
		||||
    {
 | 
			
		||||
        this.customerHandleRate = customerHandleRate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getCustomerHandleRateChange()
 | 
			
		||||
    {
 | 
			
		||||
        return customerHandleRateChange;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCustomerHandleRateChange( double customerHandleRateChange )
 | 
			
		||||
    {
 | 
			
		||||
        this.customerHandleRateChange = customerHandleRateChange;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getPremiumPerCustomer()
 | 
			
		||||
    {
 | 
			
		||||
        return premiumPerCustomer;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setPremiumPerCustomer( double premiumPerCustomer )
 | 
			
		||||
    {
 | 
			
		||||
        this.premiumPerCustomer = premiumPerCustomer;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getPremiumPerCustomerChange()
 | 
			
		||||
    {
 | 
			
		||||
        return premiumPerCustomerChange;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setPremiumPerCustomerChange( double premiumPerCustomerChange )
 | 
			
		||||
    {
 | 
			
		||||
        this.premiumPerCustomerChange = premiumPerCustomerChange;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -183,9 +183,10 @@ public class TelsalerArchievementData
 | 
			
		||||
                    double 环比昨日 = MyPOIUtils.getNumbericCellValue( row, 6 );
 | 
			
		||||
                    double 环比上月 = MyPOIUtils.getNumbericCellValue( row, 7 );
 | 
			
		||||
 | 
			
		||||
                    TelsalerRenewalRateRecord record = new TelsalerRenewalRateRecord(责任人, 机构目标值, 到期数全月, 序时到期数占比, 个车续保率序时, 个车续保率全月, 环比昨日, 环比上月);
 | 
			
		||||
                    
 | 
			
		||||
                    records.add(record);
 | 
			
		||||
                    TelsalerRenewalRateRecord record = new TelsalerRenewalRateRecord( 责任人, 机构目标值,
 | 
			
		||||
                            到期数全月, 序时到期数占比, 个车续保率序时, 个车续保率全月, 环比昨日, 环比上月 );
 | 
			
		||||
 | 
			
		||||
                    records.add( record );
 | 
			
		||||
                }
 | 
			
		||||
                catch ( NullPointerException error )
 | 
			
		||||
                {
 | 
			
		||||
@@ -212,4 +213,84 @@ public class TelsalerArchievementData
 | 
			
		||||
 | 
			
		||||
        return records;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static ArrayList<DepartmentArchievementRecord> importDepartmentArchievementRecords(
 | 
			
		||||
            String filePath, String sheetName, boolean hasCaptionRow ) throws IOException
 | 
			
		||||
    {
 | 
			
		||||
        ArrayList<DepartmentArchievementRecord> records = new ArrayList<>( 5 );
 | 
			
		||||
 | 
			
		||||
        Workbook wb = null;
 | 
			
		||||
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            wb = WorkbookFactory.create( new File( filePath ) );
 | 
			
		||||
 | 
			
		||||
            Sheet sheet = wb.getSheet( sheetName );
 | 
			
		||||
            int rowIndex = 0;
 | 
			
		||||
 | 
			
		||||
            for ( Row row : sheet )
 | 
			
		||||
            {
 | 
			
		||||
                rowIndex = row.getRowNum();
 | 
			
		||||
 | 
			
		||||
                if ( hasCaptionRow == true && rowIndex == 0 )
 | 
			
		||||
                {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    String departmentName = MyPOIUtils.getStringCellValue( row, 0 );
 | 
			
		||||
 | 
			
		||||
                    if ( departmentName.isEmpty() )
 | 
			
		||||
                    {
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    double departmentObject = MyPOIUtils.getNumbericCellValue( row, 1 );
 | 
			
		||||
                    double objectGap = MyPOIUtils.getNumbericCellValue( row, 1 );
 | 
			
		||||
                    double motoPremium = MyPOIUtils.getNumbericCellValue( row, 1 );
 | 
			
		||||
                    double motoPremiumProPortion = MyPOIUtils.getNumbericCellValue( row, 1 );
 | 
			
		||||
                    double nomotoPremium = MyPOIUtils.getNumbericCellValue( row, 1 );
 | 
			
		||||
                    double attachingRate = MyPOIUtils.getNumbericCellValue( row, 1 );
 | 
			
		||||
                    double attachingRateChange = MyPOIUtils.getNumbericCellValue( row, 1 );
 | 
			
		||||
                    double customerHandleRate = MyPOIUtils.getNumbericCellValue( row, 1 );
 | 
			
		||||
                    double customerHandleRateChange = MyPOIUtils.getNumbericCellValue( row, 1 );
 | 
			
		||||
                    double premiumPerCustomer = MyPOIUtils.getNumbericCellValue( row, 1 );
 | 
			
		||||
                    double premiumPerCustomerChange = MyPOIUtils.getNumbericCellValue( row, 1 );
 | 
			
		||||
 | 
			
		||||
                    DepartmentArchievementRecord record = new DepartmentArchievementRecord(
 | 
			
		||||
                            departmentName, departmentObject, objectGap, motoPremium,
 | 
			
		||||
                            motoPremiumProPortion, nomotoPremium, attachingRate,
 | 
			
		||||
                            attachingRateChange, customerHandleRate, customerHandleRateChange,
 | 
			
		||||
                            premiumPerCustomer, premiumPerCustomerChange );
 | 
			
		||||
 | 
			
		||||
                    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 )
 | 
			
		||||
            {
 | 
			
		||||
                String message = "关闭" + filePath + "时出现异常!";
 | 
			
		||||
 | 
			
		||||
                logger.error( message, error );
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return records;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user