From 863423679cad6a58b01c9a0c18321648175e901c Mon Sep 17 00:00:00 2001 From: lijiarao Date: Mon, 1 Nov 2021 19:08:25 +0800 Subject: [PATCH] =?UTF-8?q?fix=20bug=2041843=20=E5=AF=BC=E5=85=A5--?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E7=9A=84=E6=96=87=E4=BB=B6=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=EF=BC=8C=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA=E2=80=9C=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=88=90=E5=8A=9F=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/PayPaymentRecordServiceImpl.java | 3 ++- .../modules/system/controller/SysDepartController.java | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayPaymentRecordServiceImpl.java b/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayPaymentRecordServiceImpl.java index fa9de9fa..4a3ec778 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayPaymentRecordServiceImpl.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayPaymentRecordServiceImpl.java @@ -63,6 +63,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -77,7 +78,7 @@ import java.util.stream.Collectors; * @Date: 2021-08-31 * @Version: V1.0 */ -@Transactional(propagation = Propagation.REQUIRES_NEW,rollbackFor = Exception.class) +@Transactional(rollbackFor = Exception.class) @Service public class PayPaymentRecordServiceImpl extends ServiceImpl implements IPayPaymentRecordService { @Resource diff --git a/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysDepartController.java b/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysDepartController.java index 0e3b3937..e6f0fc39 100644 --- a/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysDepartController.java +++ b/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysDepartController.java @@ -15,6 +15,7 @@ import com.jero.common.util.ValidUtil; import com.jero.modules.system.model.SysDepartExcel; import com.jero.modules.system.util.FindsDepartsChildrenUtil; import io.swagger.models.auth.In; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import com.jero.common.api.vo.Result; @@ -403,14 +404,20 @@ public class SysDepartController { params.setNeedSave(true); //导入Excel格式校验,看匹配的字段文本概率 Boolean t = ExcelImportCheckUtil.check(file.getInputStream(), SysDepartExcel.class, params,1.0); + if (t == null){ + return Result.error("文件导入失败: 导入数据为空"); + } if(!t){ - return Result.error("表头有误!"); + return Result.error("文件导入失败: 表头有误!"); } try { // orgCode编码长度 int codeLength = YouBianCodeUtil.zhanweiLength; listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), SysDepartExcel.class, params); listSysDeparts = listSysDeparts.stream().filter(i -> !oConvertUtils.checkObjAllFieldsIsNull(i)).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(listSysDeparts)){ + return Result.error("文件导入失败: 导入数据为空"); + } //按长度排序 Collections.sort(listSysDeparts, new Comparator() { @Override