保存进度!

This commit is contained in:
Kane Wang 2023-12-19 18:30:32 +08:00
parent a9c6e0476b
commit c7ae33222d
14 changed files with 248 additions and 60 deletions

View File

@ -0,0 +1,28 @@
CREATE OR REPLACE PACKAGE TELSALER_TWR_UTILS IS
-- Author : KANE
-- Created : 2023/12/19 16:27:20
-- Purpose : twr数据报表相关的工具函数
PROCEDURE 清理TWR坐席清单;
PROCEDURE 清理TWR团队清单;
END TELSALER_TWR_UTILS;
/
CREATE OR REPLACE PACKAGE BODY TELSALER_TWR_UTILS IS
PROCEDURE 清理TWR坐席清单 IS
BEGIN
EXECUTE IMMEDIATE 'truncate table twr_telsaler_dev';
END;
PROCEDURE 清理TWR团队清单 IS
BEGIN
EXECUTE IMMEDIATE 'truncate table twr_telsaler_team_dev';
END;
BEGIN
NULL;
END TELSALER_TWR_UTILS;
/

View File

@ -104,19 +104,19 @@ export default {
selectedReportType: 0, selectedReportType: 0,
reportType: [ reportType: [
{ {
reportTypeCode: 0, reportTypeCode: 1,
reportTypeName: "坐席车非渗透率", reportTypeName: "坐席车非渗透率",
}, },
{ {
reportTypeCode: 1, reportTypeCode: 2,
reportTypeName: "坐席续保率", reportTypeName: "坐席续保率",
}, },
{ {
reportTypeCode: 2, reportTypeCode: 3,
reportTypeName: "部门车非渗透率", reportTypeName: "部门车非渗透率",
}, },
{ {
reportTypeCode: 3, reportTypeCode: 4,
reportTypeName: "当月个车续保率跟踪报表【机构】", reportTypeName: "当月个车续保率跟踪报表【机构】",
}, },
{ {

View File

@ -92,7 +92,7 @@
:close-on-press-escape="false" :close-on-press-escape="false"
:show-close="true" :show-close="true"
> >
<DataUploadView :report-type="2" /> <DataUploadView :report-type="3" />
</el-dialog> </el-dialog>
</div> </div>
</div> </div>

View File

@ -108,7 +108,7 @@
:close-on-press-escape="false" :close-on-press-escape="false"
:show-close="true" :show-close="true"
> >
<DataUploadView :report-type="3" /> <DataUploadView :report-type="4" />
</el-dialog> </el-dialog>
</div> </div>
</div> </div>

View File

@ -109,7 +109,7 @@
:close-on-press-escape="false" :close-on-press-escape="false"
:show-close="true" :show-close="true"
> >
<DataUploadView :report-type="0" /> <DataUploadView :report-type="1" />
</el-dialog> </el-dialog>
</div> </div>
</div> </div>

View File

@ -99,7 +99,7 @@
:close-on-press-escape="false" :close-on-press-escape="false"
:show-close="true" :show-close="true"
> >
<DataUploadView :report-type="1" /> <DataUploadView :report-type="2" />
</el-dialog> </el-dialog>
</div> </div>
</div> </div>

View File

@ -17,4 +17,8 @@ public interface TWrTelsalerMapper
public TWrTelsalerRecord queryTWrTelsalerInfo( @Param("telsaler") String telsaler ); public TWrTelsalerRecord queryTWrTelsalerInfo( @Param("telsaler") String telsaler );
public void insertTWrTelsalerRecordToDB( TWrTelsalerRecord record ); public void insertTWrTelsalerRecordToDB( TWrTelsalerRecord record );
public void cleanTWrTelsalerRecord();
public void cleanTWrTelsalerTeamRecord();
} }

View File

@ -32,7 +32,7 @@ public class ImportTWRTelsalerData
"学历类型", "用工性质名称", "合同种类", "合同类型", "合同性质", "合同签订次数", "合同生效日期", "合同到期日期", "人员属性", "保代员工号", "学历类型", "用工性质名称", "合同种类", "合同类型", "合同性质", "合同签订次数", "合同生效日期", "合同到期日期", "人员属性", "保代员工号",
"职场属性", "办公性质", "保代人员属性", "人员状态",}; "职场属性", "办公性质", "保代人员属性", "人员状态",};
public static void importTWrTelsalerDataFromExcel( String filePath, int sheetIndex, public static ArrayList<TWrTelsalerRecord> importTWrTelsalerDataFromExcel( String filePath, int sheetIndex,
int firstRow ) throws IOException, InvalidFormatException int firstRow ) throws IOException, InvalidFormatException
{ {
ArrayList<TWrTelsalerRecord> records = new ArrayList<>( 200 ); ArrayList<TWrTelsalerRecord> records = new ArrayList<>( 200 );
@ -132,6 +132,8 @@ public class ImportTWRTelsalerData
error.printStackTrace(); error.printStackTrace();
} }
} }
return records;
} }
private static boolean checkExcelFormat( Sheet sheet, String caption, int captionRowIndex, private static boolean checkExcelFormat( Sheet sheet, String caption, int captionRowIndex,

View File

@ -0,0 +1,35 @@
package com.cpic.xim.web.controllers.dataimport;
public enum ReportType {
BiTelsalerAttachingRateReport(1,"坐席车非渗透率"),
BiTelsalerRenewalRateReport(2,"坐席续保率"),
BiDepartmentAttachingRateReport(3,"部门车非渗透率"),
BiDepartmentRenewalRateReport(4,"当月个车续保率跟踪报表【机构】"),
TWrTelsalerList(10,"TWr坐席清单"); // Twr坐席清单
private int reportTypeCode;
private String reportTypeName;
private ReportType( final int code, final String name )
{
this.reportTypeCode = code;
this.reportTypeName = name;
}
public int getReportTypeCode()
{
return reportTypeCode;
}
public void setReportTypeCode( int reportTypeCode )
{
this.reportTypeCode = reportTypeCode;
}
public String getReportTypeName()
{
return reportTypeName;
}
public void setReportTypeName( String reportTypeName )
{
this.reportTypeName = reportTypeName;
}
}

View File

@ -10,7 +10,6 @@
package com.cpic.xim.web.controllers.dataimport.bi; package com.cpic.xim.web.controllers.dataimport.bi;
import java.io.IOException; import java.io.IOException;
import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
@ -23,13 +22,16 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.cpic.xim.mybatis.mapper.ImportBIArchievementDataMapper; import com.cpic.xim.mybatis.mapper.ImportBIArchievementDataMapper;
import com.cpic.xim.mybatis.mapper.TWrTelsalerMapper;
import com.cpic.xim.mybatis.pojo.BIDepartmentAttachingRateRecord; import com.cpic.xim.mybatis.pojo.BIDepartmentAttachingRateRecord;
import com.cpic.xim.mybatis.pojo.BIDepartmentRenewalRateRecord; import com.cpic.xim.mybatis.pojo.BIDepartmentRenewalRateRecord;
import com.cpic.xim.mybatis.pojo.BITelsalerAttachingRateRecord; import com.cpic.xim.mybatis.pojo.BITelsalerAttachingRateRecord;
import com.cpic.xim.mybatis.pojo.BITelsalerRenewalRateRecord; import com.cpic.xim.mybatis.pojo.BITelsalerRenewalRateRecord;
import com.cpic.xim.mybatis.pojo.TWrTelsalerRecord;
import com.cpic.xim.mybatis.utils.MybatisUtils; import com.cpic.xim.mybatis.utils.MybatisUtils;
import com.cpic.xim.utils.data.ImportBIExcelData; import com.cpic.xim.utils.data.ImportBIExcelData;
import com.cpic.xim.web.controllers.dataimport.bi.ImportBIDataRequest.ReportType; import com.cpic.xim.utils.data.ImportTWRTelsalerData;
import com.cpic.xim.web.controllers.dataimport.ReportType;;
@Controller @Controller
@RequestMapping( method = RequestMethod.POST, path = "/import_bi_data" ) @RequestMapping( method = RequestMethod.POST, path = "/import_bi_data" )
@ -43,29 +45,33 @@ public class ImportBIDataController
{ {
ImportBIDataResponse response = new ImportBIDataResponse(); ImportBIDataResponse response = new ImportBIDataResponse();
String filePath = request.getFilePath(); String filePath = request.getFilePath();
ReportType type = request.getReportType(); int type = request.getReportType();
int firstRow = request.getFirstRow(); int firstRow = request.getFirstRow();
int sheetIndex = request.getSheetIndex(); int sheetIndex = request.getSheetIndex();
int importedCount = 0; int importedCount = 0;
try try
{ {
if ( type == ReportType.TelsalerAttachingRateReport ) if ( type == ReportType.BiTelsalerAttachingRateReport.getReportTypeCode() )
{ {
importedCount = importBITelsalerAttachingRate( filePath, sheetIndex, firstRow ); importedCount = importBITelsalerAttachingRate( filePath, sheetIndex, firstRow );
} }
else if ( type == ReportType.TelsalerRenewalRateReport ) else if ( type == ReportType.BiTelsalerRenewalRateReport.getReportTypeCode() )
{ {
importedCount = importBITeslsalerRenewalRate( filePath, sheetIndex, firstRow ); importedCount = importBITeslsalerRenewalRate( filePath, sheetIndex, firstRow );
} }
else if ( type == ReportType.DepartmentAttachingRateReport ) else if ( type == ReportType.BiDepartmentAttachingRateReport.getReportTypeCode() )
{ {
importedCount = importBIDepartmentAttachingRate( filePath, sheetIndex, firstRow ); importedCount = importBIDepartmentAttachingRate( filePath, sheetIndex, firstRow );
} }
else if ( type == ReportType.DepartmentRenewalRateReport ) else if ( type == ReportType.BiDepartmentRenewalRateReport.getReportTypeCode() )
{ {
importedCount = importBIDepartmentRenewalRate( filePath, sheetIndex, firstRow ); importedCount = importBIDepartmentRenewalRate( filePath, sheetIndex, firstRow );
} }
else if ( type == ReportType.TWrTelsalerList.getReportTypeCode() )
{
importedCount = importTWrTelsalerList( filePath, sheetIndex, firstRow );
}
response.setImportedCount( importedCount ); response.setImportedCount( importedCount );
response.setSuccess( true ); response.setSuccess( true );
@ -254,4 +260,43 @@ public class ImportBIDataController
return importedCount; return importedCount;
} }
private static int importTWrTelsalerList( String filePath, int sheetIndex, int firstRow )
throws PersistenceException, IOException, InvalidFormatException
{
ArrayList<TWrTelsalerRecord> records = null;
SqlSession session = null;
TWrTelsalerMapper mapper = null;
int importedCount = 0;
try
{
records = ImportTWRTelsalerData.importTWrTelsalerDataFromExcel(filePath, sheetIndex, firstRow);
session = MybatisUtils.getSqlSessionBatch();
mapper = session.getMapper(TWrTelsalerMapper.class);
mapper.cleanTWrTelsalerTeamRecord();
for ( TWrTelsalerRecord record : records )
{
mapper.insertTWrTelsalerRecordToDB(record);
importedCount++;
}
session.commit();
}
catch ( Exception error)
{
if ( session != null )
{
session.rollback();
}
throw error;
}
return importedCount;
}
} }

View File

@ -9,72 +9,59 @@
*/ */
package com.cpic.xim.web.controllers.dataimport.bi; package com.cpic.xim.web.controllers.dataimport.bi;
import org.springframework.stereotype.Controller;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.stereotype.Controller;
@Controller @Controller
public class ImportBIDataRequest public class ImportBIDataRequest {
{
public enum ReportType {
TelsalerAttachingRateReport, TelsalerRenewalRateReport, DepartmentAttachingRateReport, DepartmentRenewalRateReport
};
// 导入文件的路径 // 导入文件的路径
@JsonProperty( "filePath" ) @JsonProperty("filePath")
private String filePath; private String filePath;
// 报表名称 // 报表名称
@JsonProperty( "reportType" ) @JsonProperty("reportType")
private ReportType reportType; private int reportType;
// 是否有标题行 // 是否有标题行
@JsonProperty( "firstRow" ) @JsonProperty("firstRow")
private int firstRow; private int firstRow;
// sheet索引 // sheet索引
@JsonProperty( "sheetIndex" ) @JsonProperty("sheetIndex")
private int sheetIndex; private int sheetIndex;
public ImportBIDataRequest() public ImportBIDataRequest() {}
{}
public int getFirstRow() public int getFirstRow() {
{
return firstRow; return firstRow;
} }
public void setFirstRow( int firstRow ) public void setFirstRow(int firstRow) {
{
this.firstRow = firstRow; this.firstRow = firstRow;
} }
public int getSheetIndex() public int getSheetIndex() {
{
return sheetIndex; return sheetIndex;
} }
public void setSheetIndex( int sheetIndex ) public void setSheetIndex(int sheetIndex) {
{
this.sheetIndex = sheetIndex; this.sheetIndex = sheetIndex;
} }
public String getFilePath() public String getFilePath() {
{
return filePath; return filePath;
} }
public void setFilePath( String filePath ) public void setFilePath(String filePath) {
{
this.filePath = filePath; this.filePath = filePath;
} }
public ReportType getReportType() public int getReportType() {
{
return reportType; return reportType;
} }
public void setReportType( ReportType reportType ) public void setReportType(int reportType) {
{
this.reportType = reportType; this.reportType = reportType;
} }
@ -84,7 +71,7 @@ public class ImportBIDataRequest
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((filePath == null) ? 0 : filePath.hashCode()); result = prime * result + ((filePath == null) ? 0 : filePath.hashCode());
result = prime * result + ((reportType == null) ? 0 : reportType.hashCode()); result = prime * result + reportType;
result = prime * result + firstRow; result = prime * result + firstRow;
result = prime * result + sheetIndex; result = prime * result + sheetIndex;
return result; return result;
@ -117,11 +104,17 @@ public class ImportBIDataRequest
} }
@Override @Override
public String toString() public String toString() {
{ return (
return "ImportBIDataRequest [filePath=" + filePath + ", reportType=" + reportType "ImportBIDataRequest [filePath=" +
+ ", firstRow=" + firstRow + ", sheetIndex=" + sheetIndex + "]"; filePath +
", reportType=" +
reportType +
", firstRow=" +
firstRow +
", sheetIndex=" +
sheetIndex +
"]"
);
} }
} }

View File

@ -79,6 +79,86 @@
</resultMap> </resultMap>
<!-- insertTWrTelsalerRecordToDB --> <!-- insertTWrTelsalerRecordToDB -->
<insert id="insertTWrTelsalerRecordToDB"> <insert id="insertTWrTelsalerRecordToDB" parameterType="TWrTelsalerRecord">
insert into TWR_TELSALER_DEV(
人员姓名,
人员工号,
籍贯,
参加工作时间,
入职日期,
入司日期,
业务类型,
办公地省,
办公地市,
人员类别,
现任岗位,
现任职级,
机构名称,
职场分类,
片区名称,
团队名称,
对口分公司,
展业地区,
招聘渠道,
渠道明细,
全日制最高学历,
学历类型,
用工性质名称,
合同种类,
合同类型,
合同性质,
合同签订次数,
合同生效日期,
合同到期日期,
人员属性,
保代员工号,
职场属性,
办公性质,
保代人员属性,
人员状态)
values (
#{人员姓名},
#{人员工号},
#{籍贯},
#{参加工作时间},
#{入职日期},
#{入司日期},
#{业务类型},
#{办公地省},
#{办公地市},
#{人员类别},
#{现任岗位},
#{现任职级},
#{机构名称},
#{职场分类},
#{片区名称},
#{团队名称},
#{对口分公司},
#{展业地区},
#{招聘渠道},
#{渠道明细},
#{全日制最高学历},
#{学历类型},
#{用工性质名称},
#{合同种类},
#{合同类型},
#{合同性质},
#{合同签订次数},
#{合同生效日期},
#{合同到期日期},
#{人员属性},
#{保代员工号},
#{职场属性},
#{办公性质},
#{保代人员属性},
#{人员状态} )
</insert> </insert>
<select id="cleanTWrTelsalerRecord" statementType="CALLABLE">
call TELSALER_TWR_UTILS.清理TWR坐席清单()
</select>
<select id="cleanTWrTelsalerTeamRecord" statementType="CALLABLE">
call TELSALER_TWR_UTILS.清理TWR团队清单()
</select>
</mapper> </mapper>

View File

@ -33,6 +33,7 @@
<mapper resource="mybatis/mapper/RewardsMapper.xml" /> <mapper resource="mybatis/mapper/RewardsMapper.xml" />
<mapper resource="mybatis/mapper/ImportBIArchievementDataMapper.xml" /> <mapper resource="mybatis/mapper/ImportBIArchievementDataMapper.xml" />
<mapper resource="mybatis/mapper/QueryBIArchievementDataMapper.xml" /> <mapper resource="mybatis/mapper/QueryBIArchievementDataMapper.xml" />
<mapper resource="mybatis/mapper/TWrTelsalerMapper.xml" />
</mappers> </mappers>
</configuration> </configuration>