保存进度!
This commit is contained in:
parent
a9c6e0476b
commit
c7ae33222d
|
@ -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;
|
||||
/
|
|
@ -104,19 +104,19 @@ export default {
|
|||
selectedReportType: 0,
|
||||
reportType: [
|
||||
{
|
||||
reportTypeCode: 0,
|
||||
reportTypeCode: 1,
|
||||
reportTypeName: "坐席车非渗透率",
|
||||
},
|
||||
{
|
||||
reportTypeCode: 1,
|
||||
reportTypeCode: 2,
|
||||
reportTypeName: "坐席续保率",
|
||||
},
|
||||
{
|
||||
reportTypeCode: 2,
|
||||
reportTypeCode: 3,
|
||||
reportTypeName: "部门车非渗透率",
|
||||
},
|
||||
{
|
||||
reportTypeCode: 3,
|
||||
reportTypeCode: 4,
|
||||
reportTypeName: "当月个车续保率跟踪报表【机构】",
|
||||
},
|
||||
{
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
:close-on-press-escape="false"
|
||||
:show-close="true"
|
||||
>
|
||||
<DataUploadView :report-type="2" />
|
||||
<DataUploadView :report-type="3" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
:close-on-press-escape="false"
|
||||
:show-close="true"
|
||||
>
|
||||
<DataUploadView :report-type="3" />
|
||||
<DataUploadView :report-type="4" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
:close-on-press-escape="false"
|
||||
:show-close="true"
|
||||
>
|
||||
<DataUploadView :report-type="0" />
|
||||
<DataUploadView :report-type="1" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
:close-on-press-escape="false"
|
||||
:show-close="true"
|
||||
>
|
||||
<DataUploadView :report-type="1" />
|
||||
<DataUploadView :report-type="2" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -17,4 +17,8 @@ public interface TWrTelsalerMapper
|
|||
public TWrTelsalerRecord queryTWrTelsalerInfo( @Param("telsaler") String telsaler );
|
||||
|
||||
public void insertTWrTelsalerRecordToDB( TWrTelsalerRecord record );
|
||||
|
||||
public void cleanTWrTelsalerRecord();
|
||||
|
||||
public void cleanTWrTelsalerTeamRecord();
|
||||
}
|
|
@ -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
|
||||
{
|
||||
ArrayList<TWrTelsalerRecord> records = new ArrayList<>( 200 );
|
||||
|
@ -132,6 +132,8 @@ public class ImportTWRTelsalerData
|
|||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
private static boolean checkExcelFormat( Sheet sheet, String caption, int captionRowIndex,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -10,7 +10,6 @@
|
|||
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;
|
||||
|
@ -23,13 +22,16 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
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.BIDepartmentRenewalRateRecord;
|
||||
import com.cpic.xim.mybatis.pojo.BITelsalerAttachingRateRecord;
|
||||
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.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
|
||||
@RequestMapping( method = RequestMethod.POST, path = "/import_bi_data" )
|
||||
|
@ -43,29 +45,33 @@ public class ImportBIDataController
|
|||
{
|
||||
ImportBIDataResponse response = new ImportBIDataResponse();
|
||||
String filePath = request.getFilePath();
|
||||
ReportType type = request.getReportType();
|
||||
int type = request.getReportType();
|
||||
int firstRow = request.getFirstRow();
|
||||
int sheetIndex = request.getSheetIndex();
|
||||
int importedCount = 0;
|
||||
|
||||
try
|
||||
{
|
||||
if ( type == ReportType.TelsalerAttachingRateReport )
|
||||
if ( type == ReportType.BiTelsalerAttachingRateReport.getReportTypeCode() )
|
||||
{
|
||||
importedCount = importBITelsalerAttachingRate( filePath, sheetIndex, firstRow );
|
||||
}
|
||||
else if ( type == ReportType.TelsalerRenewalRateReport )
|
||||
else if ( type == ReportType.BiTelsalerRenewalRateReport.getReportTypeCode() )
|
||||
{
|
||||
importedCount = importBITeslsalerRenewalRate( filePath, sheetIndex, firstRow );
|
||||
}
|
||||
else if ( type == ReportType.DepartmentAttachingRateReport )
|
||||
else if ( type == ReportType.BiDepartmentAttachingRateReport.getReportTypeCode() )
|
||||
{
|
||||
importedCount = importBIDepartmentAttachingRate( filePath, sheetIndex, firstRow );
|
||||
}
|
||||
else if ( type == ReportType.DepartmentRenewalRateReport )
|
||||
else if ( type == ReportType.BiDepartmentRenewalRateReport.getReportTypeCode() )
|
||||
{
|
||||
importedCount = importBIDepartmentRenewalRate( filePath, sheetIndex, firstRow );
|
||||
}
|
||||
else if ( type == ReportType.TWrTelsalerList.getReportTypeCode() )
|
||||
{
|
||||
importedCount = importTWrTelsalerList( filePath, sheetIndex, firstRow );
|
||||
}
|
||||
|
||||
response.setImportedCount( importedCount );
|
||||
response.setSuccess( true );
|
||||
|
@ -254,4 +260,43 @@ public class ImportBIDataController
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,15 +9,11 @@
|
|||
*/
|
||||
package com.cpic.xim.web.controllers.dataimport.bi;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
@Controller
|
||||
public class ImportBIDataRequest
|
||||
{
|
||||
public enum ReportType {
|
||||
TelsalerAttachingRateReport, TelsalerRenewalRateReport, DepartmentAttachingRateReport, DepartmentRenewalRateReport
|
||||
};
|
||||
public class ImportBIDataRequest {
|
||||
|
||||
// 导入文件的路径
|
||||
@JsonProperty("filePath")
|
||||
|
@ -25,7 +21,7 @@ public class ImportBIDataRequest
|
|||
|
||||
// 报表名称
|
||||
@JsonProperty("reportType")
|
||||
private ReportType reportType;
|
||||
private int reportType;
|
||||
|
||||
// 是否有标题行
|
||||
@JsonProperty("firstRow")
|
||||
|
@ -35,46 +31,37 @@ public class ImportBIDataRequest
|
|||
@JsonProperty("sheetIndex")
|
||||
private int sheetIndex;
|
||||
|
||||
public ImportBIDataRequest()
|
||||
{}
|
||||
public ImportBIDataRequest() {}
|
||||
|
||||
public int getFirstRow()
|
||||
{
|
||||
public int getFirstRow() {
|
||||
return firstRow;
|
||||
}
|
||||
|
||||
public void setFirstRow( int firstRow )
|
||||
{
|
||||
public void setFirstRow(int firstRow) {
|
||||
this.firstRow = firstRow;
|
||||
}
|
||||
|
||||
public int getSheetIndex()
|
||||
{
|
||||
public int getSheetIndex() {
|
||||
return sheetIndex;
|
||||
}
|
||||
|
||||
public void setSheetIndex( int sheetIndex )
|
||||
{
|
||||
public void setSheetIndex(int sheetIndex) {
|
||||
this.sheetIndex = sheetIndex;
|
||||
}
|
||||
|
||||
public String getFilePath()
|
||||
{
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public void setFilePath( String filePath )
|
||||
{
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
public ReportType getReportType()
|
||||
{
|
||||
public int getReportType() {
|
||||
return reportType;
|
||||
}
|
||||
|
||||
public void setReportType( ReportType reportType )
|
||||
{
|
||||
public void setReportType(int reportType) {
|
||||
this.reportType = reportType;
|
||||
}
|
||||
|
||||
|
@ -84,7 +71,7 @@ public class ImportBIDataRequest
|
|||
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 + reportType;
|
||||
result = prime * result + firstRow;
|
||||
result = prime * result + sheetIndex;
|
||||
return result;
|
||||
|
@ -117,11 +104,17 @@ public class ImportBIDataRequest
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "ImportBIDataRequest [filePath=" + filePath + ", reportType=" + reportType
|
||||
+ ", firstRow=" + firstRow + ", sheetIndex=" + sheetIndex + "]";
|
||||
public String toString() {
|
||||
return (
|
||||
"ImportBIDataRequest [filePath=" +
|
||||
filePath +
|
||||
", reportType=" +
|
||||
reportType +
|
||||
", firstRow=" +
|
||||
firstRow +
|
||||
", sheetIndex=" +
|
||||
sheetIndex +
|
||||
"]"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -79,6 +79,86 @@
|
|||
</resultMap>
|
||||
|
||||
<!-- insertTWrTelsalerRecordToDB -->
|
||||
<insert id="insertTWrTelsalerRecordToDB">
|
||||
<insert id="insertTWrTelsalerRecordToDB" parameterType="TWrTelsalerRecord">
|
||||
insert into TWR_TELSALER_DEV(
|
||||
人员姓名,
|
||||
人员工号,
|
||||
籍贯,
|
||||
参加工作时间,
|
||||
入职日期,
|
||||
入司日期,
|
||||
业务类型,
|
||||
办公地省,
|
||||
办公地市,
|
||||
人员类别,
|
||||
现任岗位,
|
||||
现任职级,
|
||||
机构名称,
|
||||
职场分类,
|
||||
片区名称,
|
||||
团队名称,
|
||||
对口分公司,
|
||||
展业地区,
|
||||
招聘渠道,
|
||||
渠道明细,
|
||||
全日制最高学历,
|
||||
学历类型,
|
||||
用工性质名称,
|
||||
合同种类,
|
||||
合同类型,
|
||||
合同性质,
|
||||
合同签订次数,
|
||||
合同生效日期,
|
||||
合同到期日期,
|
||||
人员属性,
|
||||
保代员工号,
|
||||
职场属性,
|
||||
办公性质,
|
||||
保代人员属性,
|
||||
人员状态)
|
||||
values (
|
||||
#{人员姓名},
|
||||
#{人员工号},
|
||||
#{籍贯},
|
||||
#{参加工作时间},
|
||||
#{入职日期},
|
||||
#{入司日期},
|
||||
#{业务类型},
|
||||
#{办公地省},
|
||||
#{办公地市},
|
||||
#{人员类别},
|
||||
#{现任岗位},
|
||||
#{现任职级},
|
||||
#{机构名称},
|
||||
#{职场分类},
|
||||
#{片区名称},
|
||||
#{团队名称},
|
||||
#{对口分公司},
|
||||
#{展业地区},
|
||||
#{招聘渠道},
|
||||
#{渠道明细},
|
||||
#{全日制最高学历},
|
||||
#{学历类型},
|
||||
#{用工性质名称},
|
||||
#{合同种类},
|
||||
#{合同类型},
|
||||
#{合同性质},
|
||||
#{合同签订次数},
|
||||
#{合同生效日期},
|
||||
#{合同到期日期},
|
||||
#{人员属性},
|
||||
#{保代员工号},
|
||||
#{职场属性},
|
||||
#{办公性质},
|
||||
#{保代人员属性},
|
||||
#{人员状态} )
|
||||
</insert>
|
||||
|
||||
<select id="cleanTWrTelsalerRecord" statementType="CALLABLE">
|
||||
call TELSALER_TWR_UTILS.清理TWR坐席清单()
|
||||
</select>
|
||||
|
||||
<select id="cleanTWrTelsalerTeamRecord" statementType="CALLABLE">
|
||||
call TELSALER_TWR_UTILS.清理TWR团队清单()
|
||||
</select>
|
||||
</mapper>
|
|
@ -33,6 +33,7 @@
|
|||
<mapper resource="mybatis/mapper/RewardsMapper.xml" />
|
||||
<mapper resource="mybatis/mapper/ImportBIArchievementDataMapper.xml" />
|
||||
<mapper resource="mybatis/mapper/QueryBIArchievementDataMapper.xml" />
|
||||
<mapper resource="mybatis/mapper/TWrTelsalerMapper.xml" />
|
||||
</mappers>
|
||||
|
||||
</configuration>
|
Binary file not shown.
Loading…
Reference in New Issue