完成bi报表导入的controller。
This commit is contained in:
parent
3c807a6efa
commit
cb1c08fff4
@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2023-10-08 15:02:15
|
* @Date: 2023-10-08 15:02:15
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/utils/data/TelsalerArchievementData.java
|
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/utils/data/ImportBIData.java
|
||||||
* @Description: 坐席业绩相关的数据操作方法。
|
* @Description: 坐席业绩相关的数据操作方法。
|
||||||
*
|
*
|
||||||
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
||||||
@ -26,9 +26,9 @@ import com.cpic.xim.utils.poi.MyPOIUtils;
|
|||||||
/**
|
/**
|
||||||
* 坐席业绩相关的数据操作方法。
|
* 坐席业绩相关的数据操作方法。
|
||||||
*/
|
*/
|
||||||
public class ImportBIData
|
public class ImportBIExcelData
|
||||||
{
|
{
|
||||||
private static Logger logger = LoggerFactory.getLogger( ImportBIData.class );
|
private static Logger logger = LoggerFactory.getLogger( ImportBIExcelData.class );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从excel文件读取坐席的车非渗透率数据
|
* 从excel文件读取坐席的车非渗透率数据
|
||||||
@ -39,7 +39,7 @@ public class ImportBIData
|
|||||||
* @throws InvalidFormatException excel单元格格式错误时抛出
|
* @throws InvalidFormatException excel单元格格式错误时抛出
|
||||||
*/
|
*/
|
||||||
public static ArrayList<BITelsalerAttachingRateRecord> importBITelsalerAttachingRateRecordFromXlsx(
|
public static ArrayList<BITelsalerAttachingRateRecord> importBITelsalerAttachingRateRecordFromXlsx(
|
||||||
String filePath, LocalDate summaryDate, boolean hasCaptionRow )
|
String filePath, int SheetIndex, boolean hasCaptionRow )
|
||||||
throws IOException, InvalidFormatException
|
throws IOException, InvalidFormatException
|
||||||
{
|
{
|
||||||
ArrayList<BITelsalerAttachingRateRecord> records = new ArrayList<>( 200 );
|
ArrayList<BITelsalerAttachingRateRecord> records = new ArrayList<>( 200 );
|
||||||
@ -50,7 +50,7 @@ public class ImportBIData
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
wb = WorkbookFactory.create( new File( filePath ) );
|
wb = WorkbookFactory.create( new File( filePath ) );
|
||||||
sheet = wb.getSheet( "经办" );
|
sheet = wb.getSheetAt(SheetIndex);
|
||||||
|
|
||||||
for ( Row row : sheet )
|
for ( Row row : sheet )
|
||||||
{
|
{
|
||||||
@ -95,7 +95,7 @@ public class ImportBIData
|
|||||||
MyPOIUtils.getNumbericCellValue( row, 10 );
|
MyPOIUtils.getNumbericCellValue( row, 10 );
|
||||||
|
|
||||||
BITelsalerAttachingRateRecord record = new BITelsalerAttachingRateRecord(
|
BITelsalerAttachingRateRecord record = new BITelsalerAttachingRateRecord(
|
||||||
summaryDate, name, motoPremium, nomotoPremium, motoPremiumProPortion,
|
LocalDate.now(), name, motoPremium, nomotoPremium, motoPremiumProPortion,
|
||||||
attachingRate, attachingRateChange, customerHandleRateCell,
|
attachingRate, attachingRateChange, customerHandleRateCell,
|
||||||
customerHandleRateChangeCell, noMotoPremiumPerCustomerCell,
|
customerHandleRateChangeCell, noMotoPremiumPerCustomerCell,
|
||||||
noMotoPremiumPerCustomerChangeCell );
|
noMotoPremiumPerCustomerChangeCell );
|
||||||
@ -143,7 +143,7 @@ public class ImportBIData
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static ArrayList<BITelsalerRenewalRateRecord> importBITelsalerRenewalRateFromXlsx(
|
public static ArrayList<BITelsalerRenewalRateRecord> importBITelsalerRenewalRateFromXlsx(
|
||||||
String filePath, String sheetName, boolean hasCaptionRow, LocalDate summaryDate )
|
String filePath, int sheetIndex, boolean hasCaptionRow, LocalDate summaryDate )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
ArrayList<BITelsalerRenewalRateRecord> records = new ArrayList<>( 200 );
|
ArrayList<BITelsalerRenewalRateRecord> records = new ArrayList<>( 200 );
|
||||||
@ -154,7 +154,7 @@ public class ImportBIData
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
wb = WorkbookFactory.create( new File( filePath ) );
|
wb = WorkbookFactory.create( new File( filePath ) );
|
||||||
sheet = wb.getSheet( sheetName );
|
sheet = wb.getSheetAt( sheetIndex );
|
||||||
int rowIndex = 0;
|
int rowIndex = 0;
|
||||||
|
|
||||||
for ( Row row : sheet )
|
for ( Row row : sheet )
|
||||||
@ -215,7 +215,7 @@ public class ImportBIData
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<BIDepartmentArchievementRecord> importBIDepartmentArchievementRecords(
|
public static ArrayList<BIDepartmentArchievementRecord> importBIDepartmentArchievementRecords(
|
||||||
String filePath, String sheetName, boolean hasCaptionRow ) throws IOException
|
String filePath, int sheetIndex, boolean hasCaptionRow ) throws IOException
|
||||||
{
|
{
|
||||||
ArrayList<BIDepartmentArchievementRecord> records = new ArrayList<>( 5 );
|
ArrayList<BIDepartmentArchievementRecord> records = new ArrayList<>( 5 );
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ public class ImportBIData
|
|||||||
{
|
{
|
||||||
wb = WorkbookFactory.create( new File( filePath ) );
|
wb = WorkbookFactory.create( new File( filePath ) );
|
||||||
|
|
||||||
Sheet sheet = wb.getSheet( sheetName );
|
Sheet sheet = wb.getSheetAt( sheetIndex );
|
||||||
int rowIndex = 0;
|
int rowIndex = 0;
|
||||||
|
|
||||||
for ( Row row : sheet )
|
for ( Row row : sheet )
|
@ -1,65 +0,0 @@
|
|||||||
/*
|
|
||||||
* @Author: Kane
|
|
||||||
* @Date: 2023-10-12 00:34:39
|
|
||||||
* @LastEditors: Kane
|
|
||||||
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/controllers/dataimport/TelsalerArchievement/ImportTelsalerArchievementController.java
|
|
||||||
* @Description:
|
|
||||||
*
|
|
||||||
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
|
||||||
*/
|
|
||||||
package com.cpic.xim.web.controllers.dataimport.TelsalerArchievement;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import org.apache.ibatis.session.SqlSession;
|
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
import com.cpic.xim.mybatis.mapper.ImportBIArchievementDataMapper;
|
|
||||||
import com.cpic.xim.mybatis.pojo.BITelsalerAttachingRateRecord;
|
|
||||||
import com.cpic.xim.mybatis.utils.MybatisUtils;
|
|
||||||
import com.cpic.xim.utils.data.ImportBIData;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@RequestMapping(method=RequestMethod.POST, path="/import_telsaler_archievement")
|
|
||||||
public class ImportTelsalerArchievementController
|
|
||||||
{
|
|
||||||
void importTelsalerAttachingRate()
|
|
||||||
{
|
|
||||||
String filePath = "D:\\develop\\cpicxim\\desktop_task_schedule\\数据\\测试用\\坐席车非渗透.xlsx";
|
|
||||||
SqlSession session = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ArrayList<BITelsalerAttachingRateRecord> records = ImportBIData.importBITelsalerAttachingRateRecordFromXlsx( filePath, null,
|
|
||||||
true );
|
|
||||||
session = MybatisUtils.getSqlSessionBatch();
|
|
||||||
ImportBIArchievementDataMapper mapper = session.getMapper( ImportBIArchievementDataMapper.class );
|
|
||||||
|
|
||||||
for ( BITelsalerAttachingRateRecord record : records )
|
|
||||||
{
|
|
||||||
mapper.insertTelsalerAttachingRateDataToDB(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
session.commit();
|
|
||||||
|
|
||||||
assert( true );
|
|
||||||
}
|
|
||||||
catch ( IOException error )
|
|
||||||
{
|
|
||||||
assert (false);
|
|
||||||
}
|
|
||||||
catch ( InvalidFormatException error )
|
|
||||||
{
|
|
||||||
assert (false);
|
|
||||||
}
|
|
||||||
catch (Exception error)
|
|
||||||
{
|
|
||||||
if ( session != null)
|
|
||||||
{
|
|
||||||
session.rollback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,188 @@
|
|||||||
|
/*
|
||||||
|
* @Author: Kane
|
||||||
|
* @Date: 2023-10-12 00:34:39
|
||||||
|
* @LastEditors: Kane
|
||||||
|
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/controllers/dataimport/bi/ImportBIDataController.java
|
||||||
|
* @Description:
|
||||||
|
*
|
||||||
|
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
||||||
|
*/
|
||||||
|
package com.cpic.xim.web.controllers.dataimport.bi;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import org.apache.ibatis.exceptions.PersistenceException;
|
||||||
|
import org.apache.ibatis.session.SqlSession;
|
||||||
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.cpic.xim.mybatis.mapper.ImportBIArchievementDataMapper;
|
||||||
|
import com.cpic.xim.mybatis.pojo.BIDepartmentArchievementRecord;
|
||||||
|
import com.cpic.xim.mybatis.pojo.BITelsalerAttachingRateRecord;
|
||||||
|
import com.cpic.xim.mybatis.pojo.BITelsalerRenewalRateRecord;
|
||||||
|
import com.cpic.xim.mybatis.utils.MybatisUtils;
|
||||||
|
import com.cpic.xim.utils.data.ImportBIExcelData;
|
||||||
|
import com.cpic.xim.web.controllers.dataimport.bi.ImportBIDataRequest.ReportType;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping( method = RequestMethod.POST, path = "/import_bi_data" )
|
||||||
|
public class ImportBIDataController
|
||||||
|
{
|
||||||
|
private static Logger logger = LoggerFactory.getLogger( ImportBIDataRequest.class );
|
||||||
|
|
||||||
|
@RequestMapping( method = RequestMethod.POST, path = "" )
|
||||||
|
@ResponseBody
|
||||||
|
public static ImportBIDataResponse importBIData( @RequestParam ImportBIDataRequest request )
|
||||||
|
{
|
||||||
|
ImportBIDataResponse response = new ImportBIDataResponse();
|
||||||
|
String filePath = request.getFilePath();
|
||||||
|
ReportType type = request.getReportType();
|
||||||
|
boolean hasCaption = request.isHasCaption();
|
||||||
|
int sheetIndex = request.getSheetIndex();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ( type == ReportType.TelsalerAttachingRateReport )
|
||||||
|
{
|
||||||
|
importBITelsalerAttachingRate( filePath, sheetIndex, hasCaption );
|
||||||
|
}
|
||||||
|
else if ( type == ReportType.TelsalerRenewalRateReport )
|
||||||
|
{
|
||||||
|
importBITeslsalerRenewalRate( filePath, sheetIndex, hasCaption );
|
||||||
|
}
|
||||||
|
else if ( type == ReportType.DepartmentAttachingRenewalRateReport )
|
||||||
|
{
|
||||||
|
importBIDepartmentArchievement( filePath, sheetIndex, hasCaption );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch ( IOException error )
|
||||||
|
{
|
||||||
|
String message = "";
|
||||||
|
response.setSuccess( false );
|
||||||
|
response.setMessage( message );
|
||||||
|
}
|
||||||
|
catch ( InvalidFormatException error )
|
||||||
|
{
|
||||||
|
String message = "";
|
||||||
|
response.setSuccess( false );
|
||||||
|
response.setMessage( message );
|
||||||
|
}
|
||||||
|
catch ( PersistenceException error )
|
||||||
|
{
|
||||||
|
String message = "";
|
||||||
|
response.setSuccess( false );
|
||||||
|
response.setMessage( message );
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void importBITelsalerAttachingRate( String filePath, int sheetIndex,
|
||||||
|
boolean hasCaption ) throws PersistenceException, IOException, InvalidFormatException
|
||||||
|
{
|
||||||
|
SqlSession session = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ArrayList<BITelsalerAttachingRateRecord> records =
|
||||||
|
ImportBIExcelData.importBITelsalerAttachingRateRecordFromXlsx( filePath,
|
||||||
|
sheetIndex, hasCaption );
|
||||||
|
|
||||||
|
session = MybatisUtils.getSqlSessionBatch();
|
||||||
|
ImportBIArchievementDataMapper mapper =
|
||||||
|
session.getMapper( ImportBIArchievementDataMapper.class );
|
||||||
|
|
||||||
|
mapper.cleanTelsalerAttachingRateData();
|
||||||
|
|
||||||
|
for ( BITelsalerAttachingRateRecord record : records )
|
||||||
|
{
|
||||||
|
mapper.insertTelsalerAttachingRateDataToDB( record );
|
||||||
|
}
|
||||||
|
|
||||||
|
session.commit();
|
||||||
|
}
|
||||||
|
catch ( Exception error )
|
||||||
|
{
|
||||||
|
if ( session != null )
|
||||||
|
{
|
||||||
|
session.rollback();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void importBITeslsalerRenewalRate( String filePath, int sheetIndex,
|
||||||
|
boolean hasCaption ) throws PersistenceException, IOException, InvalidFormatException
|
||||||
|
{
|
||||||
|
ArrayList<BITelsalerRenewalRateRecord> records = null;
|
||||||
|
SqlSession session = null;
|
||||||
|
ImportBIArchievementDataMapper mapper = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
records = ImportBIExcelData.importBITelsalerRenewalRateFromXlsx( filePath, sheetIndex,
|
||||||
|
hasCaption, LocalDate.now() );
|
||||||
|
|
||||||
|
session = MybatisUtils.getSqlSessionBatch();
|
||||||
|
mapper = session.getMapper( ImportBIArchievementDataMapper.class );
|
||||||
|
|
||||||
|
// 清理数据
|
||||||
|
mapper.cleanTelsalerRenewalRateData();
|
||||||
|
|
||||||
|
for ( BITelsalerRenewalRateRecord record : records )
|
||||||
|
{
|
||||||
|
mapper.insertTelsalerRenewalRateDataToDB( record );
|
||||||
|
}
|
||||||
|
|
||||||
|
session.commit();
|
||||||
|
}
|
||||||
|
catch ( Exception error )
|
||||||
|
{
|
||||||
|
if ( session != null )
|
||||||
|
{
|
||||||
|
session.rollback();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void importBIDepartmentArchievement( String filePath, int sheetIndex,
|
||||||
|
boolean hasCaption ) throws PersistenceException, IOException, InvalidFormatException
|
||||||
|
{
|
||||||
|
ArrayList<BIDepartmentArchievementRecord> records = null;
|
||||||
|
SqlSession session = null;
|
||||||
|
ImportBIArchievementDataMapper mapper = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
records = ImportBIExcelData.importBIDepartmentArchievementRecords( filePath, sheetIndex,
|
||||||
|
hasCaption );
|
||||||
|
session = MybatisUtils.getSqlSessionBatch();
|
||||||
|
mapper = session.getMapper( ImportBIArchievementDataMapper.class );
|
||||||
|
|
||||||
|
mapper.cleanDepartmentAttachingRenewalRateData();
|
||||||
|
|
||||||
|
for ( BIDepartmentArchievementRecord record : records )
|
||||||
|
{
|
||||||
|
mapper.insertDepartmentAttachingRenewalRateDataToDB( record );
|
||||||
|
}
|
||||||
|
|
||||||
|
session.commit();
|
||||||
|
}
|
||||||
|
catch ( Exception error )
|
||||||
|
{
|
||||||
|
if ( session != null )
|
||||||
|
{
|
||||||
|
session.rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,127 @@
|
|||||||
|
/*
|
||||||
|
* @Author: Kane
|
||||||
|
* @Date: 2023-10-13 14:39:06
|
||||||
|
* @LastEditors: Kane
|
||||||
|
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/controllers/dataimport/bi/ImportBIDataRequest.java
|
||||||
|
* @Description:
|
||||||
|
*
|
||||||
|
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
||||||
|
*/
|
||||||
|
package com.cpic.xim.web.controllers.dataimport.bi;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class ImportBIDataRequest
|
||||||
|
{
|
||||||
|
public enum ReportType {
|
||||||
|
TelsalerAttachingRateReport, TelsalerRenewalRateReport, DepartmentAttachingRenewalRateReport
|
||||||
|
};
|
||||||
|
|
||||||
|
// 导入文件的路径
|
||||||
|
@JsonProperty( "filePath" )
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
// 报表名称
|
||||||
|
@JsonProperty( "reportType" )
|
||||||
|
private ReportType reportType;
|
||||||
|
|
||||||
|
// 是否有标题行
|
||||||
|
@JsonProperty( "hasCaption" )
|
||||||
|
private boolean hasCaption;
|
||||||
|
|
||||||
|
// sheet索引
|
||||||
|
@JsonProperty( "sheetIndex" )
|
||||||
|
private int sheetIndex;
|
||||||
|
|
||||||
|
public ImportBIDataRequest()
|
||||||
|
{}
|
||||||
|
|
||||||
|
public boolean isHasCaption()
|
||||||
|
{
|
||||||
|
return hasCaption;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasCaption( boolean hasCaption )
|
||||||
|
{
|
||||||
|
this.hasCaption = hasCaption;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSheetIndex()
|
||||||
|
{
|
||||||
|
return sheetIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSheetIndex( int sheetIndex )
|
||||||
|
{
|
||||||
|
this.sheetIndex = sheetIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFilePath()
|
||||||
|
{
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFilePath( String filePath )
|
||||||
|
{
|
||||||
|
this.filePath = filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReportType getReportType()
|
||||||
|
{
|
||||||
|
return reportType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReportType( ReportType reportType )
|
||||||
|
{
|
||||||
|
this.reportType = reportType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((filePath == null) ? 0 : filePath.hashCode());
|
||||||
|
result = prime * result + ((reportType == null) ? 0 : reportType.hashCode());
|
||||||
|
result = prime * result + (hasCaption ? 1231 : 1237);
|
||||||
|
result = prime * result + sheetIndex;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals( Object obj )
|
||||||
|
{
|
||||||
|
if ( this == obj )
|
||||||
|
return true;
|
||||||
|
if ( obj == null )
|
||||||
|
return false;
|
||||||
|
if ( getClass() != obj.getClass() )
|
||||||
|
return false;
|
||||||
|
ImportBIDataRequest other = (ImportBIDataRequest) obj;
|
||||||
|
if ( filePath == null )
|
||||||
|
{
|
||||||
|
if ( other.filePath != null )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if ( !filePath.equals( other.filePath ) )
|
||||||
|
return false;
|
||||||
|
if ( reportType != other.reportType )
|
||||||
|
return false;
|
||||||
|
if ( hasCaption != other.hasCaption )
|
||||||
|
return false;
|
||||||
|
if ( sheetIndex != other.sheetIndex )
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "ImportBIDataRequest [filePath=" + filePath + ", reportType=" + reportType
|
||||||
|
+ ", hasCaption=" + hasCaption + ", sheetIndex=" + sheetIndex + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* @Author: Kane
|
||||||
|
* @Date: 2023-10-13 14:39:58
|
||||||
|
* @LastEditors: Kane
|
||||||
|
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/controllers/dataimport/bi/ImportBIDataResponse.java
|
||||||
|
* @Description:
|
||||||
|
*
|
||||||
|
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
||||||
|
*/
|
||||||
|
package com.cpic.xim.web.controllers.dataimport.bi;
|
||||||
|
|
||||||
|
import com.cpic.xim.web.controllers.QueryResponse;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class ImportBIDataResponse extends QueryResponse
|
||||||
|
{
|
||||||
|
// 导入数量
|
||||||
|
@JsonProperty( "importedCount" )
|
||||||
|
int importedCount;
|
||||||
|
|
||||||
|
public ImportBIDataResponse()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
|
||||||
|
importedCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImportBIDataResponse( boolean success, String message, int importedCount )
|
||||||
|
{
|
||||||
|
super( success, message );
|
||||||
|
this.importedCount = importedCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImportBIDataResponse( int importedCount )
|
||||||
|
{
|
||||||
|
this.importedCount = importedCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "ImportBIDataResponse [importedCount=" + importedCount + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
final int prime = 31;
|
||||||
|
int result = super.hashCode();
|
||||||
|
result = prime * result + importedCount;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals( Object obj )
|
||||||
|
{
|
||||||
|
if ( this == obj )
|
||||||
|
return true;
|
||||||
|
if ( !super.equals( obj ) )
|
||||||
|
return false;
|
||||||
|
if ( getClass() != obj.getClass() )
|
||||||
|
return false;
|
||||||
|
ImportBIDataResponse other = (ImportBIDataResponse) obj;
|
||||||
|
if ( importedCount != other.importedCount )
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getImportedCount()
|
||||||
|
{
|
||||||
|
return importedCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImportedCount( int importedCount )
|
||||||
|
{
|
||||||
|
this.importedCount = importedCount;
|
||||||
|
}
|
||||||
|
}
|
@ -15,7 +15,7 @@ import org.junit.Test;
|
|||||||
import com.cpic.xim.mybatis.mapper.ImportBIArchievementDataMapper;
|
import com.cpic.xim.mybatis.mapper.ImportBIArchievementDataMapper;
|
||||||
import com.cpic.xim.mybatis.pojo.*;
|
import com.cpic.xim.mybatis.pojo.*;
|
||||||
import com.cpic.xim.mybatis.utils.MybatisUtils;
|
import com.cpic.xim.mybatis.utils.MybatisUtils;
|
||||||
import com.cpic.xim.utils.data.ImportBIData;
|
import com.cpic.xim.utils.data.ImportBIExcelData;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class BatchInsertTest
|
public class BatchInsertTest
|
||||||
@ -30,7 +30,7 @@ public class BatchInsertTest
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
records = ImportBIData.importBITelsalerAttachingRateRecordFromXlsx( filePath, null,
|
records = ImportBIExcelData.importBITelsalerAttachingRateRecordFromXlsx( filePath, 0,
|
||||||
true );
|
true );
|
||||||
session = MybatisUtils.getSqlSessionBatch();
|
session = MybatisUtils.getSqlSessionBatch();
|
||||||
mapper = session.getMapper( ImportBIArchievementDataMapper.class );
|
mapper = session.getMapper( ImportBIArchievementDataMapper.class );
|
||||||
@ -73,7 +73,7 @@ public class BatchInsertTest
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
records = ImportBIData.importBITelsalerRenewalRateFromXlsx( filePath, sheetName, true,
|
records = ImportBIExcelData.importBITelsalerRenewalRateFromXlsx( filePath, 0, true,
|
||||||
null );
|
null );
|
||||||
|
|
||||||
session = MybatisUtils.getSqlSessionBatch();
|
session = MybatisUtils.getSqlSessionBatch();
|
||||||
@ -116,7 +116,7 @@ public class BatchInsertTest
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
records =
|
records =
|
||||||
ImportBIData.importBIDepartmentArchievementRecords( filePath, sheetName, true );
|
ImportBIExcelData.importBIDepartmentArchievementRecords( filePath, 0, true );
|
||||||
session = MybatisUtils.getSqlSessionBatch();
|
session = MybatisUtils.getSqlSessionBatch();
|
||||||
mapper = session.getMapper( ImportBIArchievementDataMapper.class );
|
mapper = session.getMapper( ImportBIArchievementDataMapper.class );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user