...
This commit is contained in:
parent
83c26ecec9
commit
92d5d75e59
@ -25,9 +25,8 @@ public class DataImport
|
|||||||
* @Author: 王炜
|
* @Author: 王炜
|
||||||
* @Date: 2021/6/21
|
* @Date: 2021/6/21
|
||||||
*/
|
*/
|
||||||
public static ArrayList<TelsalePolicyRecord> readTelsalePolicyDataFromXlsx(String fileName, int sheetIndex) throws
|
public static ArrayList<TelsalePolicyRecord> readTelsalePolicyDataFromXlsx( String fileName, int sheetIndex )
|
||||||
IOException,
|
throws IOException,
|
||||||
SQLException,
|
|
||||||
XlsFileFormatException
|
XlsFileFormatException
|
||||||
{
|
{
|
||||||
ArrayList<TelsalePolicyRecord> policyList = new ArrayList<TelsalePolicyRecord>();
|
ArrayList<TelsalePolicyRecord> policyList = new ArrayList<TelsalePolicyRecord>();
|
||||||
@ -41,30 +40,77 @@ public class DataImport
|
|||||||
|
|
||||||
int rowIndex = 0;
|
int rowIndex = 0;
|
||||||
int rowCount = 0;
|
int rowCount = 0;
|
||||||
|
int errorCount = 0;
|
||||||
|
String errorMessage = "数据错误,请修正后重新上传!<br>\n";
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
xlsxFile = new FileInputStream( fileName );
|
xlsxFile = new FileInputStream( fileName );
|
||||||
workBook = new HSSFWorkbook( xlsxFile );
|
workBook = new HSSFWorkbook( xlsxFile );
|
||||||
sheet = workBook.getSheetAt( sheetIndex );
|
sheet = workBook.getSheetAt( sheetIndex );
|
||||||
rowIndex = sheet.getFirstRowNum() + 1;
|
rowIndex = sheet.getFirstRowNum();
|
||||||
rowCount = sheet.getLastRowNum();
|
rowCount = sheet.getLastRowNum();
|
||||||
row = sheet.getRow(rowIndex);
|
|
||||||
|
|
||||||
while (rowIndex <= rowCount) {
|
while ( rowIndex <= rowCount )
|
||||||
|
{
|
||||||
//用第一个单元格判断是不是空行,如果cell为null视为空行
|
//用第一个单元格判断是不是空行,如果cell为null视为空行
|
||||||
|
row = sheet.getRow( rowIndex );
|
||||||
HSSFCell cell = row.getCell( 0 );
|
HSSFCell cell = row.getCell( 0 );
|
||||||
|
|
||||||
if (cell == null) {
|
if ( cell == null )
|
||||||
|
{
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String policyNo = cell.getStringCellValue();
|
String policyNo = cell.getStringCellValue();
|
||||||
String operatorCode = getStringValueFromHSSFCell( row.getCell( 1 ) );
|
String operatorCode = getStringValueFromHSSFCell( row.getCell( 1 ) );
|
||||||
|
|
||||||
|
//判断数据是否有效
|
||||||
|
if ( policyNo.length() != 20 || operatorCode.length() == 0 || operatorCode.length() > 6 )
|
||||||
|
{
|
||||||
|
errorMessage += "第" + ( rowIndex + 1 ) + "行,";
|
||||||
|
|
||||||
|
if ( policyNo.length() != 20 )
|
||||||
|
{
|
||||||
|
//以后再加入正则表达式判断
|
||||||
|
errorMessage += "保单号" + policyNo + "错误!";
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException error) {
|
if ( operatorCode.length() == 0 || operatorCode.length() > 6 )
|
||||||
|
{
|
||||||
|
errorMessage += "经办人" + operatorCode + "错误!";
|
||||||
|
}
|
||||||
|
|
||||||
|
errorMessage += "<br>\n";
|
||||||
|
|
||||||
|
rowIndex++;
|
||||||
|
errorCount++;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//读取数据
|
||||||
|
record = new TelsalePolicyRecord( policyNo, operatorCode );
|
||||||
|
|
||||||
|
policyList.add( record );
|
||||||
|
|
||||||
|
rowIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if ( workBook != null )
|
||||||
|
{
|
||||||
|
workBook.close();
|
||||||
|
xlsxFile.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断是否要抛出读取错误
|
||||||
|
if ( errorCount > 0 )
|
||||||
|
{
|
||||||
|
throw new XlsFileFormatException( errorMessage );
|
||||||
}
|
}
|
||||||
|
|
||||||
return policyList;
|
return policyList;
|
||||||
@ -84,8 +130,8 @@ public class DataImport
|
|||||||
*/
|
*/
|
||||||
public static String importTelsalePolicyDataFromXlsx( String fileName,
|
public static String importTelsalePolicyDataFromXlsx( String fileName,
|
||||||
String telsalePolicyOperatorListTableName,
|
String telsalePolicyOperatorListTableName,
|
||||||
String informixURL) throws
|
String informixURL )
|
||||||
IOException,
|
throws IOException,
|
||||||
ClassNotFoundException,
|
ClassNotFoundException,
|
||||||
SQLException,
|
SQLException,
|
||||||
XlsFileFormatException
|
XlsFileFormatException
|
||||||
@ -103,14 +149,16 @@ public class DataImport
|
|||||||
HSSFSheet sheet = null;
|
HSSFSheet sheet = null;
|
||||||
HSSFRow row = null;
|
HSSFRow row = null;
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
xlsFileIn = new FileInputStream( fileName );
|
xlsFileIn = new FileInputStream( fileName );
|
||||||
xlsFile = new HSSFWorkbook( xlsFileIn );
|
xlsFile = new HSSFWorkbook( xlsFileIn );
|
||||||
sheet = xlsFile.getSheetAt( 0 ); //第一个sheet
|
sheet = xlsFile.getSheetAt( 0 ); //第一个sheet
|
||||||
rowIndex = sheet.getFirstRowNum() + 1;
|
rowIndex = sheet.getFirstRowNum() + 1;
|
||||||
rowCount = sheet.getLastRowNum();
|
rowCount = sheet.getLastRowNum();
|
||||||
row = sheet.getRow( rowIndex );
|
row = sheet.getRow( rowIndex );
|
||||||
} catch (IOException error) //有文件格式错误的可能。
|
}
|
||||||
|
catch ( IOException error ) //有文件格式错误的可能。
|
||||||
{
|
{
|
||||||
xlsFile.close();
|
xlsFile.close();
|
||||||
xlsFileIn.close();
|
xlsFileIn.close();
|
||||||
@ -164,11 +212,13 @@ public class DataImport
|
|||||||
StaffInfo staff = null;
|
StaffInfo staff = null;
|
||||||
boolean isSuccess = true; //标志位,用来指示在保存过程中是否出现错误。
|
boolean isSuccess = true; //标志位,用来指示在保存过程中是否出现错误。
|
||||||
|
|
||||||
while (rowIndex <= rowCount) {
|
while ( rowIndex <= rowCount )
|
||||||
|
{
|
||||||
//用来判断是不是空行
|
//用来判断是不是空行
|
||||||
HSSFCell cell = row.getCell( 0 );
|
HSSFCell cell = row.getCell( 0 );
|
||||||
|
|
||||||
if (cell == null) {
|
if ( cell == null )
|
||||||
|
{
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -177,14 +227,16 @@ public class DataImport
|
|||||||
operatorCode = getStringValueFromHSSFCell( row.getCell( 1 ) );
|
operatorCode = getStringValueFromHSSFCell( row.getCell( 1 ) );
|
||||||
|
|
||||||
//判断一下是不是空的单元格
|
//判断一下是不是空的单元格
|
||||||
if (policyNo.length() == 0 || operatorCode.length() == 0) {
|
if ( policyNo.length() == 0 || operatorCode.length() == 0 )
|
||||||
|
{
|
||||||
importResult = importResult + "第" + rowIndex + "行数据为空。<br>";
|
importResult = importResult + "第" + rowIndex + "行数据为空。<br>";
|
||||||
|
|
||||||
//isSuccess = false;
|
//isSuccess = false;
|
||||||
}
|
}
|
||||||
else //不是空单元格,进行处理
|
else //不是空单元格,进行处理
|
||||||
{
|
{
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
//取得经办人信息
|
//取得经办人信息
|
||||||
staff = new StaffInfo( operatorCode );
|
staff = new StaffInfo( operatorCode );
|
||||||
|
|
||||||
@ -206,7 +258,9 @@ public class DataImport
|
|||||||
importResult = importResult + "第" + rowIndex + "行,保单号" + policyNo + ",转介绍信息入成功!<br>";
|
importResult = importResult + "第" + rowIndex + "行,保单号" + policyNo + ",转介绍信息入成功!<br>";
|
||||||
|
|
||||||
successCount++;
|
successCount++;
|
||||||
} catch (StaffCodeNotExistException error) {
|
}
|
||||||
|
catch ( StaffCodeNotExistException error )
|
||||||
|
{
|
||||||
//经办人不存在
|
//经办人不存在
|
||||||
importResult = importResult + "第" + rowIndex + "行,保单号" + policyNo + ",经办人" + operatorCode + "不存在。<br>";
|
importResult = importResult + "第" + rowIndex + "行,保单号" + policyNo + ",经办人" + operatorCode + "不存在。<br>";
|
||||||
|
|
||||||
@ -215,7 +269,9 @@ public class DataImport
|
|||||||
|
|
||||||
//计数
|
//计数
|
||||||
failCount++;
|
failCount++;
|
||||||
} catch (OracleConnectionException error) {
|
}
|
||||||
|
catch ( OracleConnectionException error )
|
||||||
|
{
|
||||||
//查询工号失败
|
//查询工号失败
|
||||||
importResult = importResult + "第" + rowIndex + "行,保单号" + policyNo + ",经办人" + operatorCode + ",查询工号失败。<br>";
|
importResult = importResult + "第" + rowIndex + "行,保单号" + policyNo + ",经办人" + operatorCode + ",查询工号失败。<br>";
|
||||||
|
|
||||||
@ -224,10 +280,13 @@ public class DataImport
|
|||||||
|
|
||||||
//计数
|
//计数
|
||||||
failCount++;
|
failCount++;
|
||||||
} catch (SQLException error) {
|
}
|
||||||
|
catch ( SQLException error )
|
||||||
|
{
|
||||||
int errorCode = error.getErrorCode();
|
int errorCode = error.getErrorCode();
|
||||||
|
|
||||||
switch (errorCode) {
|
switch ( errorCode )
|
||||||
|
{
|
||||||
case -268: //保单号重复
|
case -268: //保单号重复
|
||||||
importResult = importResult + "第" + rowIndex + "行,保单号" + policyNo + ",已录入过转介绍信息!" + error.getCause() + "。<br>";
|
importResult = importResult + "第" + rowIndex + "行,保单号" + policyNo + ",已录入过转介绍信息!" + error.getCause() + "。<br>";
|
||||||
break;
|
break;
|
||||||
@ -243,7 +302,9 @@ public class DataImport
|
|||||||
|
|
||||||
//计数
|
//计数
|
||||||
failCount++;
|
failCount++;
|
||||||
} catch (Exception error) {
|
}
|
||||||
|
catch ( Exception error )
|
||||||
|
{
|
||||||
//写入错误
|
//写入错误
|
||||||
importResult = importResult + "第" + rowIndex + "行,保单号" + policyNo + ",数据库写入错误,错误信息:" + error.getMessage() + "。<br>";
|
importResult = importResult + "第" + rowIndex + "行,保单号" + policyNo + ",数据库写入错误,错误信息:" + error.getMessage() + "。<br>";
|
||||||
|
|
||||||
@ -252,7 +313,9 @@ public class DataImport
|
|||||||
|
|
||||||
//计数
|
//计数
|
||||||
failCount++;
|
failCount++;
|
||||||
} finally {
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
ifxConn.commit();
|
ifxConn.commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -302,33 +365,41 @@ public class DataImport
|
|||||||
{
|
{
|
||||||
String value = null;
|
String value = null;
|
||||||
|
|
||||||
if (cell == null) {
|
if ( cell == null )
|
||||||
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (cell.getCellType()) {
|
switch ( cell.getCellType() )
|
||||||
case HSSFCell.CELL_TYPE_NUMERIC: {
|
{
|
||||||
|
case HSSFCell.CELL_TYPE_NUMERIC:
|
||||||
|
{
|
||||||
//判断是不是整数
|
//判断是不是整数
|
||||||
double dValue = cell.getNumericCellValue();
|
double dValue = cell.getNumericCellValue();
|
||||||
|
|
||||||
if (dValue == (int) dValue) {
|
if ( dValue == (int) dValue )
|
||||||
|
{
|
||||||
value = String.valueOf( (int) dValue );
|
value = String.valueOf( (int) dValue );
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
value = String.valueOf( dValue );
|
value = String.valueOf( dValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HSSFCell.CELL_TYPE_STRING: {
|
case HSSFCell.CELL_TYPE_STRING:
|
||||||
|
{
|
||||||
value = cell.getStringCellValue();
|
value = cell.getStringCellValue();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HSSFCell.CELL_TYPE_BLANK: {
|
case HSSFCell.CELL_TYPE_BLANK:
|
||||||
|
{
|
||||||
value = "";
|
value = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default:
|
||||||
|
{
|
||||||
value = "";
|
value = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -336,6 +407,14 @@ public class DataImport
|
|||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void saveTelsalePolicyDataToOracle( String dbURL,
|
||||||
|
String userName,
|
||||||
|
String password,
|
||||||
|
ArrayList<TelsalePolicyRecord> policyList )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +16,138 @@ public class TelsalePolicyRecord
|
|||||||
* @Date: 2021/6/21 */
|
* @Date: 2021/6/21 */
|
||||||
public TelsalePolicyRecord( String policyNo, String operatorCode )
|
public TelsalePolicyRecord( String policyNo, String operatorCode )
|
||||||
{
|
{
|
||||||
|
this.policyNo = policyNo;
|
||||||
|
this.operatorCode = operatorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPolicyNo()
|
||||||
|
{
|
||||||
|
return policyNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolicyNo( String policyNo )
|
||||||
|
{
|
||||||
|
this.policyNo = policyNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOperatorCode()
|
||||||
|
{
|
||||||
|
return operatorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperatorCode( String operatorCode )
|
||||||
|
{
|
||||||
|
this.operatorCode = operatorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOperatorName()
|
||||||
|
{
|
||||||
|
return operatorName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperatorName( String operatorName )
|
||||||
|
{
|
||||||
|
this.operatorName = operatorName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOperatorSectionOfficeCode()
|
||||||
|
{
|
||||||
|
return operatorSectionOfficeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperatorSectionOfficeCode( String operatorSectionOfficeCode )
|
||||||
|
{
|
||||||
|
this.operatorSectionOfficeCode = operatorSectionOfficeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOperatorSectionOfficeName()
|
||||||
|
{
|
||||||
|
return operatorSectionOfficeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperatorSectionOfficeName( String operatorSectionOfficeName )
|
||||||
|
{
|
||||||
|
this.operatorSectionOfficeName = operatorSectionOfficeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOperatorSectionDepartmentCode()
|
||||||
|
{
|
||||||
|
return operatorSectionDepartmentCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperatorSectionDepartmentCode( String operatorSectionDepartmentCode )
|
||||||
|
{
|
||||||
|
this.operatorSectionDepartmentCode = operatorSectionDepartmentCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOperatorSectionDepartmentName()
|
||||||
|
{
|
||||||
|
return operatorSectionDepartmentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperatorSectionDepartmentName( String operatorSectionDepartmentName )
|
||||||
|
{
|
||||||
|
this.operatorSectionDepartmentName = operatorSectionDepartmentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEntryStaffCode()
|
||||||
|
{
|
||||||
|
return entryStaffCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntryStaffCode( String entryStaffCode )
|
||||||
|
{
|
||||||
|
this.entryStaffCode = entryStaffCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEntryStaffName()
|
||||||
|
{
|
||||||
|
return entryStaffName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntryStaffName( String entryStaffName )
|
||||||
|
{
|
||||||
|
this.entryStaffName = entryStaffName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEntryStaffSectionOfficeCode()
|
||||||
|
{
|
||||||
|
return entryStaffSectionOfficeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntryStaffSectionOfficeCode( String entryStaffSectionOfficeCode )
|
||||||
|
{
|
||||||
|
this.entryStaffSectionOfficeCode = entryStaffSectionOfficeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEntryStaffSectionOfficeName()
|
||||||
|
{
|
||||||
|
return entryStaffSectionOfficeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntryStaffSectionOfficeName( String entryStaffSectionOfficeName )
|
||||||
|
{
|
||||||
|
this.entryStaffSectionOfficeName = entryStaffSectionOfficeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEntryStaffSectionDepartmentCode()
|
||||||
|
{
|
||||||
|
return entryStaffSectionDepartmentCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntryStaffSectionDepartmentCode( String entryStaffSectionDepartmentCode )
|
||||||
|
{
|
||||||
|
this.entryStaffSectionDepartmentCode = entryStaffSectionDepartmentCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEntryStaffSectionDepartmentName()
|
||||||
|
{
|
||||||
|
return entryStaffSectionDepartmentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntryStaffSectionDepartmentName( String entryStaffSectionDepartmentName )
|
||||||
|
{
|
||||||
|
this.entryStaffSectionDepartmentName = entryStaffSectionDepartmentName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String policyNo;
|
private String policyNo;
|
||||||
|
@ -4,6 +4,7 @@ package com.cpic.telsale.uploadData;
|
|||||||
* Created by Kane on 2017/3/27.
|
* Created by Kane on 2017/3/27.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import com.cpic.telsale.TelsalePolicyRecord;
|
||||||
import org.apache.commons.fileupload.*;
|
import org.apache.commons.fileupload.*;
|
||||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||||
import org.apache.commons.fileupload.servlet.ServletFileUpload;
|
import org.apache.commons.fileupload.servlet.ServletFileUpload;
|
||||||
@ -26,7 +27,9 @@ public class uploadDataProcessor extends HttpServlet
|
|||||||
private String telsalePolicyOperatorListTableName; //informix库电销转介绍表名
|
private String telsalePolicyOperatorListTableName; //informix库电销转介绍表名
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init( ServletConfig config ) throws ServletException
|
public void init( ServletConfig config )
|
||||||
|
throws
|
||||||
|
ServletException
|
||||||
{
|
{
|
||||||
//获取参数
|
//获取参数
|
||||||
oracleURL = (String) config.getServletContext().getInitParameter( "oracleURL" );
|
oracleURL = (String) config.getServletContext().getInitParameter( "oracleURL" );
|
||||||
@ -35,14 +38,20 @@ public class uploadDataProcessor extends HttpServlet
|
|||||||
|
|
||||||
//informix
|
//informix
|
||||||
informixURL = (String) config.getServletContext().getInitParameter( "informixURL" );
|
informixURL = (String) config.getServletContext().getInitParameter( "informixURL" );
|
||||||
telsalePolicyOperatorListTableName = (String)config.getServletContext().getInitParameter( "telsalePolicyOperatorListTableName" );
|
telsalePolicyOperatorListTableName = (String) config.getServletContext()
|
||||||
|
.getInitParameter( "telsalePolicyOperatorListTableName" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException
|
public void doPost( HttpServletRequest request, HttpServletResponse response )
|
||||||
|
throws
|
||||||
|
ServletException,
|
||||||
|
IOException
|
||||||
{
|
{
|
||||||
tempPathRoot = (String) request.getSession().getAttribute( "临时文件根目录" );
|
tempPathRoot = (String) request.getSession().getAttribute( "临时文件根目录" );
|
||||||
|
|
||||||
String importMessage = null;
|
String importMessage = null;
|
||||||
|
ArrayList<TelsalePolicyRecord> policyRecordList = new ArrayList<TelsalePolicyRecord>();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -64,9 +73,12 @@ public class uploadDataProcessor extends HttpServlet
|
|||||||
//保存上传的文件,返回文件完整路径。
|
//保存上传的文件,返回文件完整路径。
|
||||||
String upLoadedFileName = saveUploadedFile( fileItem );
|
String upLoadedFileName = saveUploadedFile( fileItem );
|
||||||
|
|
||||||
importMessage = DataImport.importTelsalePolicyDataFromXlsx( upLoadedFileName,
|
//测试
|
||||||
telsalePolicyOperatorListTableName,
|
policyRecordList = DataImport.readTelsalePolicyDataFromXlsx( upLoadedFileName, 0 );
|
||||||
informixURL );
|
|
||||||
|
// importMessage = DataImport.importTelsalePolicyDataFromXlsx( upLoadedFileName,
|
||||||
|
// telsalePolicyOperatorListTableName,
|
||||||
|
// informixURL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,7 +116,9 @@ public class uploadDataProcessor extends HttpServlet
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private String saveUploadedFile( FileItem item ) throws Exception
|
private String saveUploadedFile( FileItem item )
|
||||||
|
throws
|
||||||
|
Exception
|
||||||
{
|
{
|
||||||
String fileName = item.getName();
|
String fileName = item.getName();
|
||||||
|
|
||||||
|
@ -4,14 +4,51 @@ CREATE OR REPLACE PACKAGE telsale_policy_check_pkg IS
|
|||||||
-- Created : 2021/6/21 10:18:01
|
-- Created : 2021/6/21 10:18:01
|
||||||
-- Purpose : µçÏú±£µ¥Êý¾ÝÑéÖ¤
|
-- Purpose : µçÏú±£µ¥Êý¾ÝÑéÖ¤
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
--定义异常
|
||||||
|
--保单号不存在
|
||||||
|
POLICYNO_NOT_EXIST_EXCEPT_CODE CONSTANT INTEGER := -20000;
|
||||||
|
POLICYNO_NOT_EXIST_EXCEPT_TEXT CONSTANT VARCHAR2(100) := '保单号不存在。';
|
||||||
|
|
||||||
|
--经办人不存在
|
||||||
|
OPERATOE_CODE_NOT_EXIST_EXCEPT_CODE CONSTANT INTEGER := -20001;
|
||||||
|
OPERATOE_CODE_NOT_EXIST_EXCEPT_TEXT CONSTANT VARCHAR2(100) := '经办人工号不存在。';
|
||||||
|
|
||||||
|
--录入人不存在
|
||||||
|
ENTRY_STAFF_CODE_NOT_EXIST_EXCEPT_CODE CONSTANT INTEGER := -20002;
|
||||||
|
ENTRY_STAFF_CODE_NOT_EXIST_EXCEPT_TEXT CONSTANT VARCHAR2(100) := '录入人工号不存在。';
|
||||||
|
|
||||||
|
--经办人工号所在科室与保单不匹配
|
||||||
|
OPERATOE_CODE_NOT_MATCH_EXCEPT_CODE CONSTANT INTEGER := -20003;
|
||||||
|
OPERATOE_CODE_NOT_MATCH_EXCEPT_TEXT CONSTANT VARCHAR2(100) := '经办人工号所在科室与保单归属不匹配。';
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
FUNCTION policy_check(a_policy_no VARCHAR2) RETURN BOOLEAN;
|
FUNCTION policy_check(a_policy_no VARCHAR2) RETURN BOOLEAN;
|
||||||
|
|
||||||
FUNCTION staff_check(a_stuff_code VARCHAR2) RETURN BOOLEAN;
|
FUNCTION staff_check(a_stuff_code VARCHAR2) RETURN BOOLEAN;
|
||||||
|
|
||||||
|
PROCEDURE save_policy
|
||||||
|
(
|
||||||
|
a_policy_no IN VARCHAR2,
|
||||||
|
a_operator_code IN VARCHAR2,
|
||||||
|
a_operator_name OUT VARCHAR2,
|
||||||
|
a_operator_sectionoffice_code OUT VARCHAR2,
|
||||||
|
a_operator_sectionoffice_name OUT VARCHAR2,
|
||||||
|
a_operator_department_code OUT VARCHAR2,
|
||||||
|
a_operator_department_name OUT VARCHAR2,
|
||||||
|
a_entry_staff_code IN VARCHAR2,
|
||||||
|
a_entry_staff_name OUT VARCHAR2,
|
||||||
|
a_entry_staff_sectionoffice_code OUT VARCHAR2,
|
||||||
|
a_entry_staff_sectionoffice_name OUT VARCHAR2,
|
||||||
|
a_entry_staff_department_code OUT VARCHAR2,
|
||||||
|
a_entry_staff_department_name OUT VARCHAR2
|
||||||
|
);
|
||||||
|
|
||||||
END telsale_policy_check_pkg;
|
END telsale_policy_check_pkg;
|
||||||
/
|
/
|
||||||
CREATE OR REPLACE PACKAGE BODY telsale_policy_check_pkg IS
|
CREATE OR REPLACE PACKAGE BODY telsale_policy_check_pkg IS
|
||||||
|
|
||||||
|
/*********************************************************************************/
|
||||||
FUNCTION staff_check(a_stuff_code VARCHAR2) RETURN BOOLEAN IS
|
FUNCTION staff_check(a_stuff_code VARCHAR2) RETURN BOOLEAN IS
|
||||||
l_count INTEGER;
|
l_count INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -28,6 +65,7 @@ CREATE OR REPLACE PACKAGE BODY telsale_policy_check_pkg IS
|
|||||||
RETURN TRUE;
|
RETURN TRUE;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
/*********************************************************************************/
|
||||||
FUNCTION policy_check(a_policy_no VARCHAR2) RETURN BOOLEAN IS
|
FUNCTION policy_check(a_policy_no VARCHAR2) RETURN BOOLEAN IS
|
||||||
l_count INTEGER;
|
l_count INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -43,6 +81,33 @@ CREATE OR REPLACE PACKAGE BODY telsale_policy_check_pkg IS
|
|||||||
|
|
||||||
RETURN TRUE;
|
RETURN TRUE;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
/*********************************************************************************/
|
||||||
|
PROCEDURE save_policy
|
||||||
|
(
|
||||||
|
a_policy_no IN VARCHAR2,
|
||||||
|
a_operator_code IN VARCHAR2,
|
||||||
|
a_operator_name OUT VARCHAR2,
|
||||||
|
a_operator_sectionoffice_code OUT VARCHAR2,
|
||||||
|
a_operator_sectionoffice_name OUT VARCHAR2,
|
||||||
|
a_operator_department_code OUT VARCHAR2,
|
||||||
|
a_operator_department_name OUT VARCHAR2,
|
||||||
|
a_entry_staff_code IN VARCHAR2,
|
||||||
|
a_entry_staff_name OUT VARCHAR2,
|
||||||
|
a_entry_staff_sectionoffice_code OUT VARCHAR2,
|
||||||
|
a_entry_staff_sectionoffice_name OUT VARCHAR2,
|
||||||
|
a_entry_staff_department_code OUT VARCHAR2,
|
||||||
|
a_entry_staff_department_name OUT VARCHAR2
|
||||||
|
) IS
|
||||||
|
l_policy_section_code VARCHAR2(6);
|
||||||
|
l_policy_department_code VARCHAR2(6);
|
||||||
|
BEGIN
|
||||||
|
NULL;
|
||||||
|
|
||||||
|
--判断保单号是否存在,以及保单号的科室部门和经办人是否相同
|
||||||
|
|
||||||
|
END;
|
||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
NULL;
|
NULL;
|
||||||
END telsale_policy_check_pkg;
|
END telsale_policy_check_pkg;
|
||||||
|
100
代码/oracle/项目/包/telsale_policy_check_pkg.~pck
Normal file
100
代码/oracle/项目/包/telsale_policy_check_pkg.~pck
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
CREATE OR REPLACE PACKAGE telsale_policy_check_pkg IS
|
||||||
|
|
||||||
|
-- Author : 王炜
|
||||||
|
-- Created : 2021/6/21 10:18:01
|
||||||
|
-- Purpose : 电销保单数据验证
|
||||||
|
|
||||||
|
--定义异常
|
||||||
|
--保单号不存在
|
||||||
|
POLICYNO_NOT_EXIST_EXCEPT_CODE CONSTANT INTEGER := -20000;
|
||||||
|
POLICYNO_NOT_EXIST_EXCEPT_TEXT CONSTANT VARCHAR2(100) := '保单号不存在。';
|
||||||
|
|
||||||
|
FUNCTION policy_check(a_policy_no VARCHAR2) RETURN BOOLEAN;
|
||||||
|
|
||||||
|
FUNCTION staff_check(a_stuff_code VARCHAR2) RETURN BOOLEAN;
|
||||||
|
|
||||||
|
PROCEDURE save_policy
|
||||||
|
(
|
||||||
|
a_policy_no IN VARCHAR2,
|
||||||
|
a_operator_code IN VARCHAR2,
|
||||||
|
a_operator_name OUT VARCHAR2,
|
||||||
|
a_operator_sectionoffice_code OUT VARCHAR2,
|
||||||
|
a_operator_sectionoffice_name OUT VARCHAR2,
|
||||||
|
a_operator_department_code OUT VARCHAR2,
|
||||||
|
a_operator_department_name OUT VARCHAR2,
|
||||||
|
a_entry_staff_code IN VARCHAR2,
|
||||||
|
a_entry_staff_name OUT VARCHAR2,
|
||||||
|
a_entry_staff_sectionoffice_code OUT VARCHAR2,
|
||||||
|
a_entry_staff_sectionoffice_name OUT VARCHAR2,
|
||||||
|
a_entry_staff_department_code OUT VARCHAR2,
|
||||||
|
a_entry_staff_department_name OUT VARCHAR2
|
||||||
|
);
|
||||||
|
|
||||||
|
END telsale_policy_check_pkg;
|
||||||
|
/
|
||||||
|
CREATE OR REPLACE PACKAGE BODY telsale_policy_check_pkg IS
|
||||||
|
|
||||||
|
/*********************************************************************************/
|
||||||
|
FUNCTION staff_check(a_stuff_code VARCHAR2) RETURN BOOLEAN IS
|
||||||
|
l_count INTEGER;
|
||||||
|
BEGIN
|
||||||
|
SELECT COUNT(*)
|
||||||
|
INTO l_count
|
||||||
|
FROM idst0.rydm_t@xmcx1.cpicxm ry
|
||||||
|
WHERE ry.staff_code = a_stuff_code;
|
||||||
|
|
||||||
|
IF l_count = 0
|
||||||
|
THEN
|
||||||
|
RETURN FALSE;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
RETURN TRUE;
|
||||||
|
END;
|
||||||
|
|
||||||
|
/*********************************************************************************/
|
||||||
|
FUNCTION policy_check(a_policy_no VARCHAR2) RETURN BOOLEAN IS
|
||||||
|
l_count INTEGER;
|
||||||
|
BEGIN
|
||||||
|
SELECT COUNT(*)
|
||||||
|
INTO l_count
|
||||||
|
FROM idst0.auto_agreement_t@xmcx1.cpicxm a
|
||||||
|
WHERE a.policy_no = a_policy_no;
|
||||||
|
|
||||||
|
IF l_count = 0
|
||||||
|
THEN
|
||||||
|
RETURN FALSE;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
RETURN TRUE;
|
||||||
|
END;
|
||||||
|
|
||||||
|
/*********************************************************************************/
|
||||||
|
PROCEDURE save_policy
|
||||||
|
(
|
||||||
|
a_policy_no IN VARCHAR2,
|
||||||
|
a_operator_code IN VARCHAR2,
|
||||||
|
a_operator_name OUT VARCHAR2,
|
||||||
|
a_operator_sectionoffice_code OUT VARCHAR2,
|
||||||
|
a_operator_sectionoffice_name OUT VARCHAR2,
|
||||||
|
a_operator_department_code OUT VARCHAR2,
|
||||||
|
a_operator_department_name OUT VARCHAR2,
|
||||||
|
a_entry_staff_code IN VARCHAR2,
|
||||||
|
a_entry_staff_name OUT VARCHAR2,
|
||||||
|
a_entry_staff_sectionoffice_code OUT VARCHAR2,
|
||||||
|
a_entry_staff_sectionoffice_name OUT VARCHAR2,
|
||||||
|
a_entry_staff_department_code OUT VARCHAR2,
|
||||||
|
a_entry_staff_department_name OUT VARCHAR2
|
||||||
|
) IS
|
||||||
|
l_policy_section_code VARCHAR2(6);
|
||||||
|
l_policy_department_code VARCHAR2(6);
|
||||||
|
BEGIN
|
||||||
|
NULL;
|
||||||
|
|
||||||
|
--判断保单号是否存在,以及保单号的科室部门和经办人是否相同
|
||||||
|
|
||||||
|
END;
|
||||||
|
|
||||||
|
BEGIN
|
||||||
|
NULL;
|
||||||
|
END telsale_policy_check_pkg;
|
||||||
|
/
|
@ -3,10 +3,30 @@ PL/SQL Developer Project Desktop
|
|||||||
[Desktop]
|
[Desktop]
|
||||||
SavePath=D:\develop\projects_win\2018\telsale_management_2017\代码\oracle\项目\
|
SavePath=D:\develop\projects_win\2018\telsale_management_2017\代码\oracle\项目\
|
||||||
|
|
||||||
|
Index=1
|
||||||
|
Filename=D:\develop\projects_win\2018\telsale_management_2017\덜쯤\oracle\淃커\관\telsale_policy_check_pkg.pck
|
||||||
|
VCSDBObject=0
|
||||||
|
Connection=282441544404455840724370446043583456492241804558450434903180323832003290342849744968477032763302336047784788
|
||||||
|
DPI=96
|
||||||
|
Left=0
|
||||||
|
Top=0
|
||||||
|
Width=1329
|
||||||
|
Height=719
|
||||||
|
State=0
|
||||||
|
Type=3
|
||||||
|
ChildListIndex=1
|
||||||
|
Pinned=0
|
||||||
|
|
||||||
|
Index=2
|
||||||
|
Filename=
|
||||||
|
Connection=226450024772463846324866505249184048433046445054493639223676363836323754389245424568427437403734382438343844
|
||||||
|
|
||||||
[Files]
|
[Files]
|
||||||
|
|
||||||
[MRU]
|
[MRU]
|
||||||
|
3,D:\develop\projects_win\2018\telsale_management_2017\덜쯤\oracle\淃커\관\telsale_policy_check_pkg.pck
|
||||||
1,D:\develop\projects_win\2018\telsale_management_2017\代码\oracle\项目\建表\电销保单信息表.sql
|
1,D:\develop\projects_win\2018\telsale_management_2017\代码\oracle\项目\建表\电销保单信息表.sql
|
||||||
|
1,D:\develop\projects_win\2018\telsale_management_2017\덜쯤\oracle\淃커\쉔깊\든饋괏데斤口쩌흙휑羚깊.sql
|
||||||
|
|
||||||
[Layout]
|
[Layout]
|
||||||
Group=
|
Group=
|
||||||
|
BIN
数据/测试数据/有空行.xls
Normal file
BIN
数据/测试数据/有空行.xls
Normal file
Binary file not shown.
BIN
数据/测试数据/有空行,有保单号错误.xls
Normal file
BIN
数据/测试数据/有空行,有保单号错误.xls
Normal file
Binary file not shown.
BIN
数据/测试数据/转介绍模板.xls
Normal file
BIN
数据/测试数据/转介绍模板.xls
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user