use of com.ruoyi.common.exception.UtilException in project RuoYi-Vue-fast by yangzongzhuan.
the class ExcelUtil method exportExcel.
/**
* 对list数据源将其里面的数据导入到excel表单
*
* @return 结果
*/
public AjaxResult exportExcel() {
OutputStream out = null;
try {
writeSheet();
String filename = encodingFilename(sheetName);
out = new FileOutputStream(getAbsoluteFile(filename));
wb.write(out);
return AjaxResult.success(filename);
} catch (Exception e) {
log.error("导出Excel异常{}", e.getMessage());
throw new UtilException("导出Excel失败,请联系网站管理员!");
} finally {
IOUtils.closeQuietly(wb);
IOUtils.closeQuietly(out);
}
}
use of com.ruoyi.common.exception.UtilException in project RuoYi-Vue by yangzongzhuan.
the class ExcelUtil method exportExcel.
/**
* 对list数据源将其里面的数据导入到excel表单
*
* @return 结果
*/
public AjaxResult exportExcel() {
OutputStream out = null;
try {
writeSheet();
String filename = encodingFilename(sheetName);
out = new FileOutputStream(getAbsoluteFile(filename));
wb.write(out);
return AjaxResult.success(filename);
} catch (Exception e) {
log.error("导出Excel异常{}", e.getMessage());
throw new UtilException("导出Excel失败,请联系网站管理员!");
} finally {
IOUtils.closeQuietly(wb);
IOUtils.closeQuietly(out);
}
}
use of com.ruoyi.common.exception.UtilException in project RuoYi-Vue-Plus by JavaLionLi.
the class LoginHelper method getUserId.
/**
* 获取用户id
*/
public static Long getUserId() {
LoginUser loginUser = getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
String loginId = StpUtil.getLoginIdAsString();
String userId = null;
for (UserType value : UserType.values()) {
if (StringUtils.contains(loginId, value.getUserType())) {
String[] strs = StringUtils.split(loginId, JOIN_CODE);
// 用户id在总是在最后
userId = strs[strs.length - 1];
}
}
if (StringUtils.isBlank(userId)) {
throw new UtilException("登录用户: LoginId异常 => " + loginId);
}
return Long.parseLong(userId);
}
return loginUser.getUserId();
}
use of com.ruoyi.common.exception.UtilException in project RuoYi-Vue-Oracle by yangzongzhuan.
the class ExcelUtil method exportExcel.
/**
* 对list数据源将其里面的数据导入到excel表单
*
* @return 结果
*/
public AjaxResult exportExcel() {
OutputStream out = null;
try {
writeSheet();
String filename = encodingFilename(sheetName);
out = new FileOutputStream(getAbsoluteFile(filename));
wb.write(out);
return AjaxResult.success(filename);
} catch (Exception e) {
log.error("导出Excel异常{}", e.getMessage());
throw new UtilException("导出Excel失败,请联系网站管理员!");
} finally {
IOUtils.closeQuietly(wb);
IOUtils.closeQuietly(out);
}
}
use of com.ruoyi.common.exception.UtilException in project RuoYi-Flowable-Plus by KonBAI-Q.
the class LoginHelper method getUserId.
/**
* 获取用户id
*/
public static Long getUserId() {
LoginUser loginUser = getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
String loginId = StpUtil.getLoginIdAsString();
String userId = null;
for (UserType value : UserType.values()) {
if (StringUtils.contains(loginId, value.getUserType())) {
String[] strs = StringUtils.split(loginId, JOIN_CODE);
// 用户id在总是在最后
userId = strs[strs.length - 1];
}
}
if (StringUtils.isBlank(userId)) {
throw new UtilException("登录用户: LoginId异常 => " + loginId);
}
return Long.parseLong(userId);
}
return loginUser.getUserId();
}
Aggregations