fix(service): 修复导出 Excel 时未捕获异常的问题- 在查询数据时添加了异常捕获处理,避免因数据库查询异常导致的系统错误
- 对 TOC 销售、TOB 销售、TOC 退货和 TOB 退货四种业务类型分别进行了异常处理 - 在异常发生时记录日志,返回空列表,确保系统稳定性
This commit is contained in:
parent
f39fdb7761
commit
36c5da2cf5
|
@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -149,11 +150,21 @@ public class TocofsSaleoutServiceImpl extends BaseService<TocofsSaleoutEntity, S
|
|||
//Excel导出模式,加载全部的数据,交给上层方法最终转换为Excel文件提供给前端下载
|
||||
if (businessType.equals("TOC_ORDER")) {
|
||||
//TOC销售
|
||||
List<TocofsSaleoutDetailedDto> tocofsSaleoutDetailedDtos = iTocofsSaleoutDetailedDao.queryEntityListBaseToc(tocofsSaleoutDetailedEntity);
|
||||
List<TocofsSaleoutDetailedDto> tocofsSaleoutDetailedDtos = new ArrayList<>();
|
||||
try {
|
||||
tocofsSaleoutDetailedDtos = iTocofsSaleoutDetailedDao.queryEntityListBaseToc(tocofsSaleoutDetailedEntity);
|
||||
} catch (Exception e) {
|
||||
logger.error("queryEntityListBaseToc方法抛出异常", e);
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("查询成功", tocofsSaleoutDetailedDtos);
|
||||
} else if (businessType.equals("TOB_ORDER")) {
|
||||
//TOB销售
|
||||
List<TobofsSaleoutDetailedDto> tobofsSaleoutDetailedDtos = iTocofsSaleoutDetailedDao.queryEntityListBaseTob(tocofsSaleoutDetailedEntity);
|
||||
List<TobofsSaleoutDetailedDto> tobofsSaleoutDetailedDtos = null;
|
||||
try {
|
||||
tobofsSaleoutDetailedDtos = iTocofsSaleoutDetailedDao.queryEntityListBaseTob(tocofsSaleoutDetailedEntity);
|
||||
} catch (Exception e) {
|
||||
logger.error("queryEntityListBaseTob方法抛出异常", e);
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("查询成功", tobofsSaleoutDetailedDtos);
|
||||
} else {
|
||||
return BaseResult.getFailureMessageEntity("查询失败,无法确定TOB、TOC!请选择:TOC_ORDER、或者TOB_ORDER!");
|
||||
|
@ -334,11 +345,21 @@ public class TocofsSaleoutServiceImpl extends BaseService<TocofsSaleoutEntity, S
|
|||
} else if ("excel".equals(qType)) {
|
||||
if (businessType.equals("TOC_RETURN")) {
|
||||
//TOC退货
|
||||
List<TocofsReturnGoodsDetailedDto> tocofsReturnGoodsDetailedDtos = iTocofsReturngoodsDetailedDao.queryEntityListBaseToc(tocofsSaleoutDetailedEntity);
|
||||
List<TocofsReturnGoodsDetailedDto> tocofsReturnGoodsDetailedDtos = new ArrayList<>();
|
||||
try {
|
||||
tocofsReturnGoodsDetailedDtos = iTocofsReturngoodsDetailedDao.queryEntityListBaseToc(tocofsSaleoutDetailedEntity);
|
||||
} catch (Exception e) {
|
||||
logger.error("queryEntityListBaseToc方法抛出异常", e);
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("查询成功", tocofsReturnGoodsDetailedDtos);
|
||||
} else if (businessType.equals("TOB_RETURN")) {
|
||||
//TOB退货
|
||||
List<TobofsReturnGoodsDetailedDto> tobofsReturnGoodsDetailedDtos = iTocofsReturngoodsDetailedDao.queryEntityListBaseTob(tocofsSaleoutDetailedEntity);
|
||||
List<TobofsReturnGoodsDetailedDto> tobofsReturnGoodsDetailedDtos = new ArrayList<>();
|
||||
try {
|
||||
tobofsReturnGoodsDetailedDtos = iTocofsReturngoodsDetailedDao.queryEntityListBaseTob(tocofsSaleoutDetailedEntity);
|
||||
} catch (Exception e) {
|
||||
logger.error("queryEntityListBaseTob方法抛出异常", e);
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("查询成功", tobofsReturnGoodsDetailedDtos);
|
||||
} else {
|
||||
return BaseResult.getFailureMessageEntity("查询失败,无法确定TOB、TOC!请选择:TOC_ORDER、或者TOB_ORDER!");
|
||||
|
|
Loading…
Reference in New Issue