Skip to content

Commit

Permalink
refactor($POI): move annotation class
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymillergh committed Sep 26, 2021
1 parent e0c08b7 commit 2729771
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.jmsoftware.maf.authcenter.role.entity;

import com.jmsoftware.maf.authcenter.role.entity.persistence.Role;
import com.jmsoftware.maf.springcloudstarter.annotation.ExcelColumn;
import com.jmsoftware.maf.springcloudstarter.poi.ExcelColumn;
import lombok.Data;
import lombok.val;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.jmsoftware.maf.springcloudstarter.poi;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelWriter;
Expand All @@ -9,7 +9,6 @@
import com.google.common.collect.Maps;
import com.jmsoftware.maf.common.bean.ExcelImportResult;
import com.jmsoftware.maf.common.bean.ResponseBodyBean;
import com.jmsoftware.maf.springcloudstarter.annotation.ExcelColumn;
import com.jmsoftware.maf.springcloudstarter.util.CaseConversionUtil;
import io.swagger.annotations.ApiOperation;
import lombok.Cleanup;
Expand Down Expand Up @@ -160,7 +159,7 @@ protected void initContext() {
for (var index = 0; index < declaredFields.length; index++) {
val declaredField = declaredFields[index];
fieldNames[index] = declaredField.getName();
final ExcelColumn excelColumn = declaredField.getAnnotation(ExcelColumn.class);
val excelColumn = declaredField.getAnnotation(ExcelColumn.class);
var columnName = excelColumn.name();
if (StrUtil.isBlank(columnName)) {
columnName = CaseConversionUtil.convertToStartCase(StrUtil.toSymbolCase(declaredField.getName(), ' '));
Expand Down Expand Up @@ -328,8 +327,8 @@ private void handlePreviousException() {

private void exeDatabaseOperation() {
// if no error message (errorMessageList if empty) or not denyAll, then execute DB operation
if (CollectionUtil.isEmpty(this.errorMessageList.get()) || !this.denyAll) {
if (CollectionUtil.isNotEmpty(this.beanList.get())) {
if (CollUtil.isEmpty(this.errorMessageList.get()) || !this.denyAll) {
if (CollUtil.isNotEmpty(this.beanList.get())) {
this.setReturnMessageList("Starting - Import data…");
try {
this.executeDatabaseOperation(this.beanList.get());
Expand Down Expand Up @@ -445,7 +444,7 @@ private void uploadWorkbook() {
*/
@SuppressWarnings("RedundantThrows")
private void bindData(Workbook workbook) {
for (int index = 0; index < workbook.getNumberOfSheets(); index++) {
for (var index = 0; index < workbook.getNumberOfSheets(); index++) {
val sheet = workbook.getSheetAt(index);
val excelReader = new ExcelReader(workbook, index);
excelReader.setHeaderAlias(this.importingFieldAliasMap);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.jmsoftware.maf.springcloudstarter.annotation;
package com.jmsoftware.maf.springcloudstarter.poi;

import org.apache.poi.ss.usermodel.CellType;

Expand Down

0 comments on commit 2729771

Please sign in to comment.