mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 08:13:44 +08:00 
			
		
		
		
	update 优化 excel导入 适配异常结构
This commit is contained in:
		@@ -5,8 +5,11 @@ import cn.hutool.core.util.ObjectUtil;
 | 
			
		||||
import cn.hutool.crypto.digest.BCrypt;
 | 
			
		||||
import com.alibaba.excel.context.AnalysisContext;
 | 
			
		||||
import com.alibaba.excel.event.AnalysisEventListener;
 | 
			
		||||
import jakarta.validation.ConstraintViolation;
 | 
			
		||||
import jakarta.validation.ConstraintViolationException;
 | 
			
		||||
import org.dromara.common.core.exception.ServiceException;
 | 
			
		||||
import org.dromara.common.core.utils.SpringUtils;
 | 
			
		||||
import org.dromara.common.core.utils.StreamUtils;
 | 
			
		||||
import org.dromara.common.core.utils.ValidatorUtils;
 | 
			
		||||
import org.dromara.common.excel.core.ExcelListener;
 | 
			
		||||
import org.dromara.common.excel.core.ExcelResult;
 | 
			
		||||
@@ -80,7 +83,11 @@ public class SysUserImportListener extends AnalysisEventListener<SysUserImportVo
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            failureNum++;
 | 
			
		||||
            String msg = "<br/>" + failureNum + "、账号 " + userVo.getUserName() + " 导入失败:";
 | 
			
		||||
            failureMsg.append(msg).append(e.getMessage());
 | 
			
		||||
            String message = e.getMessage();
 | 
			
		||||
            if (e instanceof ConstraintViolationException cvException) {
 | 
			
		||||
                message = StreamUtils.join(cvException.getConstraintViolations(), ConstraintViolation::getMessage, ", ");
 | 
			
		||||
            }
 | 
			
		||||
            failureMsg.append(msg).append(message);
 | 
			
		||||
            log.error(msg, e);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user