Class CompanyExcelService
java.lang.Object
es.kukenan.smartfi.microservice.onboarding.service.CompanyExcelService
Excel management service definition.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classInternal class for manage excel row data. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringAdvance constant.private InternalBackofficeApiClientInternal backoffice endpoint.private BackofficeServiceBackoffice service.private StringExcel files destination. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddDataToUser(CompanyExcelService.ExcelRow excelRow, int cellIndex, Object value) Populate User and Bank Account from Excel Cell.private voidcopyRow(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet worksheet, org.apache.poi.ss.usermodel.Sheet resultSheet, int sourceRowNum, int destinationRowNum, CompanyExcelService.ExcelRow excelRow, Boolean header, Boolean addFailReason) Copy an Excel Row to another.voidreadCompanyEmployeeExcelFile(String ruc, org.springframework.web.multipart.MultipartFile file, javax.servlet.http.HttpServletResponse response, String userIp, String userAgent) Load an excel file with employee data from a company.private StringtranslateReason(CompanyExcelService.ExcelRow excelRow) Get fail reason from ExcelRow.
-
Field Details
-
ADVANCE_PRODUCT
Advance constant.- See Also:
-
excelFolderPath
Excel files destination. -
backofficeService
Backoffice service. -
backofficeApiClient
Internal backoffice endpoint.
-
-
Constructor Details
-
CompanyExcelService
public CompanyExcelService()
-
-
Method Details
-
addDataToUser
Populate User and Bank Account from Excel Cell.- Parameters:
excelRow- ExcelRow object created with User and Bank Account.cellIndex- Excel cell index.value- Value from excel cell.
-
readCompanyEmployeeExcelFile
public void readCompanyEmployeeExcelFile(String ruc, org.springframework.web.multipart.MultipartFile file, javax.servlet.http.HttpServletResponse response, String userIp, String userAgent) throws IOException Load an excel file with employee data from a company.- Parameters:
ruc- Company RUC identifier.file- Excel file.response- response.userIp- user real ipuserAgent- user-agent header- Throws:
IOException- file to write response.
-
copyRow
private void copyRow(org.apache.poi.ss.usermodel.Workbook workbook, org.apache.poi.ss.usermodel.Sheet worksheet, org.apache.poi.ss.usermodel.Sheet resultSheet, int sourceRowNum, int destinationRowNum, CompanyExcelService.ExcelRow excelRow, Boolean header, Boolean addFailReason) Copy an Excel Row to another.- Parameters:
workbook- Actual Workbook.worksheet- Actual WorkSheet.resultSheet- New WorkSheet.sourceRowNum- Actual row number.destinationRowNum- New row number.excelRow- All data from excel and error reason.header- flag for header row.addFailReason- flag for add reason column at the left.
-
translateReason
Get fail reason from ExcelRow.- Parameters:
excelRow- Excel row data.- Returns:
- value of reason
-