【fix sonar】ImportExcelUtil文件
This commit is contained in:
+6
-2
@@ -2,6 +2,7 @@ package com.jero.common.util;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.jero.common.exception.JeroBootException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import com.jero.common.api.vo.Result;
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.common.constant.CommonConstant;
|
import com.jero.common.constant.CommonConstant;
|
||||||
@@ -16,6 +17,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ImportExcelUtil {
|
public class ImportExcelUtil {
|
||||||
|
private ImportExcelUtil(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static Result<T> imporReturnRes(int errorLines, int successLines, List<String> errorMessage) throws IOException {
|
public static Result<T> imporReturnRes(int errorLines, int successLines, List<String> errorMessage) throws IOException {
|
||||||
if (errorLines == 0) {
|
if (errorLines == 0) {
|
||||||
@@ -45,7 +49,7 @@ public class ImportExcelUtil {
|
|||||||
try {
|
try {
|
||||||
boolean save = bean.save(list.get(i));
|
boolean save = bean.save(list.get(i));
|
||||||
if(!save){
|
if(!save){
|
||||||
throw new Exception(errorFlag);
|
throw new JeroBootException(errorFlag);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String message = e.getMessage().toLowerCase();
|
String message = e.getMessage().toLowerCase();
|
||||||
@@ -73,7 +77,7 @@ public class ImportExcelUtil {
|
|||||||
try {
|
try {
|
||||||
boolean save = bean.save(obj);
|
boolean save = bean.save(obj);
|
||||||
if(!save){
|
if(!save){
|
||||||
throw new Exception(errorFlag);
|
throw new JeroBootException(errorFlag);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String message = e.getMessage().toLowerCase();
|
String message = e.getMessage().toLowerCase();
|
||||||
|
|||||||
Reference in New Issue
Block a user