Commit dad2a8c2 by 谢海旭

调整抛出的异常类

1 parent 403ad1a4
......@@ -9,7 +9,9 @@ import com.glsx.plat.exception.SystemMessage;
*/
public enum ResultEnum {
PARAM_ERROR(1001, "参数错误");
PARAM_ERROR(1001, "参数错误"),
FEIGN_REQUEST_ERROR(1002, "feign请求异常"),
DATA_HANDLE_ERROR(1003, "数据处理异常");
private final Integer code;
private final String message;
......
......@@ -28,8 +28,6 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.glsx.plat.core.enums.SysConstants;
import com.glsx.plat.core.web.Result;
import com.glsx.plat.exception.BusinessException;
import com.glsx.plat.exception.SystemMessage;
import com.glsx.plat.office.excel.EasyExcelUtils;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -362,7 +360,7 @@ public class SopInstService {
String sopJourneyId = search.getSopJourneyId();
SopInst sopInst = sopInstMapper.selectByPrimaryKey(sopJourneyId);
if (Objects.isNull(sopInst)) {
throw BusinessException.create(SystemMessage.ARGS_ERROR.getCode(), "该模板实例不存在!");
throw new AdminException(ResultEnum.PARAM_ERROR.getCode(), "该模板实例不存在!");
}
SopTplGrant sopTplGrant = sopTplGrantMapper.selectByPrimaryKey(sopInst.getGrantId());
......@@ -414,12 +412,12 @@ public class SopInstService {
String oneId = body.getOneId();
Result<CustomerSopJourneyDetailDTO> detail = customerSopJourneyFeignClient.detail(orgId, sopJourneyId, oneId);
if (!SysConstants.ResultStatus.success.getCode().equals(detail.getCode())) {
throw BusinessException.create(SystemMessage.ARGS_ERROR.getCode(), "查询客户信息异常");
throw new AdminException(ResultEnum.FEIGN_REQUEST_ERROR.getCode(), "查询客户信息异常");
}
CustomerSopJourneyDetailDTO customerDetail = detail.getData();
if (Objects.isNull(customerDetail)) {
throw BusinessException.create(SystemMessage.ARGS_ERROR.getCode(), "客户信息不存在");
throw new AdminException(ResultEnum.PARAM_ERROR.getCode(), "客户信息不存在");
}
ModifySopJourneyStageRequest request = new ModifySopJourneyStageRequest();
......@@ -450,7 +448,7 @@ public class SopInstService {
search.setPageSize(5000);
SopInst sopInst = sopInstMapper.selectByPrimaryKey(search.getSopJourneyId());
if (Objects.isNull(sopInst)) {
throw BusinessException.create(SystemMessage.ARGS_ERROR.getCode(), "模板实例不存在");
throw new AdminException(ResultEnum.PARAM_ERROR.getCode(), "模板实例不存在");
}
List<SopCustomerExcelDTO> data = new ArrayList<>();
......@@ -482,14 +480,14 @@ public class SopInstService {
FileUploadServerData fileUploadServerData = FileUploadUtil.uploadToFileSystem(String.format("客户数据_%d", now.getTime()), bytes, "xlsx");
return fileUploadServerData;
} catch (Exception e) {
throw BusinessException.create(SystemMessage.DATA_HANDLE_ERROR.getCode(), "客户数据导出处理异常");
throw new AdminException(ResultEnum.DATA_HANDLE_ERROR.getCode(), "客户数据导出处理异常");
}
}
private void getCustomersForExcel(SopCustomerSearch search, List<CustomerSopJourneyDTO> customerSopJourneyDTOList) {
Result<PageInfo<CustomerSopJourneyDTO>> customersResult = customers(search);
if (!SysConstants.ResultStatus.success.getCode().equals(customersResult.getCode())) {
throw BusinessException.create(SystemMessage.MICROSERVICE_CALL_FAIL.getCode(), "查询客户数据接口异常");
throw new AdminException(ResultEnum.FEIGN_REQUEST_ERROR.getCode(), "查询客户数据接口异常");
}
PageInfo<CustomerSopJourneyDTO> pageInfo = customersResult.getData();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!