perf: 归类业务错误处理

haikang
huangfeng 1 year ago
parent 7138f5a1a2
commit 220608341a

@ -1,6 +1,7 @@
package com.xydl.cac.controller;
import com.xydl.cac.entity.Bdz;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.model.Response;
import com.xydl.cac.service.BdzService;
import io.swagger.annotations.Api;
@ -40,7 +41,7 @@ public class BdzController extends BasicController {
@ApiOperation("更新")
public Response<String> update(@Validated @RequestBody Bdz item) throws Exception {
if (item.getId() == null) {
throw new Exception("ID不能为空!");
throw new BusinessException("ID不能为空!");
}
service.update(item);
return Response.success("OK");

@ -1,6 +1,7 @@
package com.xydl.cac.controller;
import com.xydl.cac.entity.Jg;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.model.Response;
import com.xydl.cac.service.JgService;
import io.swagger.annotations.Api;
@ -40,7 +41,7 @@ public class JgController extends BasicController {
@ApiOperation("更新")
public Response<String> update(@Validated @RequestBody Jg item) throws Exception {
if (item.getId() == null) {
throw new Exception("ID不能为空!");
throw new BusinessException("ID不能为空!");
}
service.update(item);
return Response.success("OK");

@ -1,6 +1,7 @@
package com.xydl.cac.controller;
import com.xydl.cac.entity.Lx;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.model.Response;
import com.xydl.cac.service.LxService;
import io.swagger.annotations.Api;
@ -40,7 +41,7 @@ public class LxController extends BasicController {
@ApiOperation("更新")
public Response<String> update(@Validated @RequestBody Lx item) throws Exception {
if (item.getId() == null) {
throw new Exception("ID不能为空!");
throw new BusinessException("ID不能为空!");
}
service.update(item);
return Response.success("OK");

@ -2,6 +2,7 @@ package com.xydl.cac.controller;
import com.xydl.cac.entity.Modev;
import com.xydl.cac.entity.ModevType;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.model.Response;
import com.xydl.cac.service.ModevService;
import com.xydl.cac.service.ModevTypeService;
@ -43,7 +44,7 @@ public class ModevController extends BasicController {
@ApiOperation("更新")
public Response<String> update(@Validated @RequestBody Modev item) throws Exception {
if (item.getId() == null) {
throw new Exception("ID不能为空!");
throw new BusinessException("ID不能为空!");
}
service.update(item);
return Response.success("OK");

@ -1,6 +1,7 @@
package com.xydl.cac.controller;
import com.xydl.cac.entity.ModevType;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.model.Response;
import com.xydl.cac.service.ModevTypeService;
import io.swagger.annotations.Api;
@ -40,7 +41,7 @@ public class ModevTypeController extends BasicController {
@ApiOperation("更新")
public Response<String> update(@Validated @RequestBody ModevType item) throws Exception {
if (item.getId() == null) {
throw new Exception("ID不能为空!");
throw new BusinessException("ID不能为空!");
}
service.update(item);
return Response.success("OK");

@ -1,6 +1,7 @@
package com.xydl.cac.controller;
import com.xydl.cac.entity.Zsb;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.model.Response;
import com.xydl.cac.service.ZsbService;
import io.swagger.annotations.Api;
@ -40,7 +41,7 @@ public class ZsbController extends BasicController {
@ApiOperation("更新")
public Response<String> update(@Validated @RequestBody Zsb item) throws Exception {
if (item.getId() == null) {
throw new Exception("ID不能为空!");
throw new BusinessException("ID不能为空!");
}
service.update(item);
return Response.success("OK");

@ -0,0 +1,8 @@
package com.xydl.cac.exception;
public class BusinessException extends Exception {
public BusinessException(String message) {
super(message);
}
}

@ -24,11 +24,18 @@ public class GlobalExceptionHandler {
}
@ExceptionHandler(HttpMessageConversionException.class)
public Response<String> handleValidationExceptions(HttpMessageConversionException ex) {
public Response<String> handleHttpMessageConversionException(HttpMessageConversionException ex) {
String message = "类型转换异常:" + ex.getRootCause().getLocalizedMessage();
return Response.fail(message);
}
@ExceptionHandler(Exception.class)
public Response<String> handleBusinessException(BusinessException ex) {
String message = ex.getMessage();
log.error(message);
return Response.fail(message);
}
@ExceptionHandler(Exception.class)
public Response<String> handleException(Exception ex) {
log.error("", ex);

@ -2,6 +2,7 @@ package com.xydl.cac.service.impl;
import com.xydl.cac.entity.Bdz;
import com.xydl.cac.entity.Jg;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.repository.BdzRepository;
import com.xydl.cac.repository.JgRepository;
import com.xydl.cac.service.BdzService;
@ -33,7 +34,7 @@ public class BdzServiceImpl implements BdzService {
item.setId(null);
List<Bdz> list = repository.findByMc(item.getMc());
if (!CollectionUtils.isEmpty(list)) {
throw new Exception("该名称已被使用");
throw new BusinessException("该名称已被使用");
}
return repository.save(item);
}
@ -42,7 +43,7 @@ public class BdzServiceImpl implements BdzService {
public void update(Bdz item) throws Exception {
List<Bdz> list = repository.findByMcAndIdIsNot(item.getMc(), item.getId());
if (!CollectionUtils.isEmpty(list)) {
throw new Exception("该名称已被使用");
throw new BusinessException("该名称已被使用");
}
repository.save(item);
}
@ -51,7 +52,7 @@ public class BdzServiceImpl implements BdzService {
public void delete(Integer id) throws Exception {
List<Jg> jgList = jgRepository.findByBdzid(id);
if (!CollectionUtils.isEmpty(jgList)) {
throw new Exception("已被区域使用不能删除");
throw new BusinessException("已被区域使用不能删除");
}
repository.deleteById(id);
}

@ -1,6 +1,7 @@
package com.xydl.cac.service.impl;
import com.xydl.cac.entity.*;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.repository.*;
import com.xydl.cac.service.IcdFileConfigService;
import com.xydl.cac.util.IcdXmlUtil;
@ -97,7 +98,7 @@ public class IcdFileConfigServiceImpl implements IcdFileConfigService {
public void update(IcdConfigType item) throws Exception {
Optional<IcdConfigType> optional = repository.findById(item.getId());
if (!optional.isPresent()) {
throw new Exception("未找到该项");
throw new BusinessException("未找到该项");
}
IcdConfigType r = optional.get();
if (r.getTableName() != null && !r.getTableName().equals(item.getTableName())) {
@ -115,7 +116,7 @@ public class IcdFileConfigServiceImpl implements IcdFileConfigService {
public void updateAtt(IcdConfigTypeAtt item) throws Exception {
Optional<IcdConfigTypeAtt> optional = attRepository.findById(item.getId());
if (!optional.isPresent()) {
throw new Exception("未找到该项");
throw new BusinessException("未找到该项");
}
IcdConfigTypeAtt r = optional.get();
r.setColName(item.getColName());

@ -3,6 +3,7 @@ package com.xydl.cac.service.impl;
import com.xydl.cac.entity.Bdz;
import com.xydl.cac.entity.Jg;
import com.xydl.cac.entity.Zsb;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.repository.BdzRepository;
import com.xydl.cac.repository.JgRepository;
import com.xydl.cac.repository.ZsbRepository;
@ -65,11 +66,11 @@ public class JgServiceImpl implements JgService {
item.setId(null);
Optional<Bdz> optionalBdz = bdzRepository.findById(item.getBdzid());
if (!optionalBdz.isPresent()) {
throw new Exception("未找到该变电站");
throw new BusinessException("未找到该变电站");
}
List<Jg> list = repository.findByBdzidAndMc(item.getBdzid(), item.getMc());
if (!CollectionUtils.isEmpty(list)) {
throw new Exception("该名称已被使用");
throw new BusinessException("该名称已被使用");
}
return repository.save(item);
}
@ -78,11 +79,11 @@ public class JgServiceImpl implements JgService {
public void update(Jg item) throws Exception {
Optional<Bdz> optionalBdz = bdzRepository.findById(item.getBdzid());
if (!optionalBdz.isPresent()) {
throw new Exception("未找到该变电站");
throw new BusinessException("未找到该变电站");
}
List<Jg> list = repository.findByBdzidAndMcAndIdIsNot(item.getBdzid(), item.getMc(), item.getId());
if (!CollectionUtils.isEmpty(list)) {
throw new Exception("该名称已被使用");
throw new BusinessException("该名称已被使用");
}
repository.save(item);
}
@ -91,7 +92,7 @@ public class JgServiceImpl implements JgService {
public void delete(Integer id) throws Exception {
List<Zsb> zsbList = zsbRepository.findByJgid(id);
if (!CollectionUtils.isEmpty(zsbList)) {
throw new Exception("已被主设备使用不能删除");
throw new BusinessException("已被主设备使用不能删除");
}
repository.deleteById(id);
}
@ -100,7 +101,7 @@ public class JgServiceImpl implements JgService {
public Jg detail(Integer id) throws Exception {
Optional<Jg> optional = repository.findById(id);
if (!optional.isPresent()) {
throw new Exception("未找到该区域");
throw new BusinessException("未找到该区域");
}
Jg jg = optional.get();
Optional<Bdz> optionalBdz = bdzRepository.findById(jg.getBdzid());

@ -1,6 +1,7 @@
package com.xydl.cac.service.impl;
import com.xydl.cac.entity.Lx;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.repository.LxRepository;
import com.xydl.cac.service.LxService;
import lombok.extern.slf4j.Slf4j;
@ -29,7 +30,7 @@ public class LxServiceImpl implements LxService {
item.setId(null);
List<Lx> list = repository.findByMc(item.getMc());
if (!CollectionUtils.isEmpty(list)) {
throw new Exception("该名称已被使用");
throw new BusinessException("该名称已被使用");
}
return repository.save(item);
}
@ -38,7 +39,7 @@ public class LxServiceImpl implements LxService {
public void update(Lx item) throws Exception {
List<Lx> list = repository.findByMcAndIdIsNot(item.getMc(), item.getId());
if (!CollectionUtils.isEmpty(list)) {
throw new Exception("该名称已被使用");
throw new BusinessException("该名称已被使用");
}
repository.save(item);
}

@ -3,6 +3,7 @@ package com.xydl.cac.service.impl;
import com.xydl.cac.entity.Modev;
import com.xydl.cac.entity.ModevType;
import com.xydl.cac.entity.Zsb;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.repository.ModevRepository;
import com.xydl.cac.repository.ModevTypeRepository;
import com.xydl.cac.repository.ZsbRepository;
@ -52,7 +53,7 @@ public class ModevServiceImpl implements ModevService {
item.setId(null);
List<Modev> byZsbidAndName = repository.findByZsbidAndName(item.getZsbid(), item.getName());
if (!CollectionUtils.isEmpty(byZsbidAndName)) {
throw new Exception("该监测装置已存在");
throw new BusinessException("该监测装置已存在");
}
return repository.save(item);
}
@ -63,7 +64,7 @@ public class ModevServiceImpl implements ModevService {
if (!CollectionUtils.isEmpty(byMc)) {
for (Modev it : byMc) {
if (it.getId().intValue() != item.getId().intValue()) {
throw new Exception("该监测装置类型已存在");
throw new BusinessException("该监测装置类型已存在");
}
}
}
@ -79,7 +80,7 @@ public class ModevServiceImpl implements ModevService {
public Modev detail(Integer id) throws Exception {
Optional<Modev> optional = repository.findById(id);
if (!optional.isPresent()) {
throw new Exception("未找到该类型");
throw new BusinessException("未找到该类型");
}
return optional.get();
}
@ -92,7 +93,7 @@ public class ModevServiceImpl implements ModevService {
entity.setIcdid(icdid);
repository.save(entity);
} else {
throw new Exception("未找到对应的检测装置");
throw new BusinessException("未找到对应的检测装置");
}
}
}

@ -1,6 +1,7 @@
package com.xydl.cac.service.impl;
import com.xydl.cac.entity.ModevType;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.repository.ModevTypeRepository;
import com.xydl.cac.service.ModevTypeService;
import lombok.extern.slf4j.Slf4j;
@ -30,7 +31,7 @@ public class ModevTypeServiceImpl implements ModevTypeService {
item.setId(null);
List<ModevType> byMc = repository.findByMc(item.getMc());
if (!CollectionUtils.isEmpty(byMc)) {
throw new Exception("该监测装置类型已存在");
throw new BusinessException("该监测装置类型已存在");
}
return repository.save(item);
}
@ -41,7 +42,7 @@ public class ModevTypeServiceImpl implements ModevTypeService {
if (!CollectionUtils.isEmpty(byMc)) {
for (ModevType it : byMc) {
if (it.getId().intValue() != item.getId().intValue()) {
throw new Exception("该监测装置类型已存在");
throw new BusinessException("该监测装置类型已存在");
}
}
}
@ -57,7 +58,7 @@ public class ModevTypeServiceImpl implements ModevTypeService {
public ModevType detail(Integer id) throws Exception {
Optional<ModevType> optional = repository.findById(id);
if (!optional.isPresent()) {
throw new Exception("未找到该类型");
throw new BusinessException("未找到该类型");
}
return optional.get();
}

@ -2,6 +2,7 @@ package com.xydl.cac.service.impl;
import com.xydl.cac.entity.NiecPoint;
import com.xydl.cac.entity.NiecSensor;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.model.ConditionModel;
import com.xydl.cac.model.OnePage;
import com.xydl.cac.model.SensorDetail;
@ -73,24 +74,24 @@ public class NiecSensorServiceImpl implements NiecSensorService {
public SensorDetail<Map<String, Object>> getDetail(ConditionModel model) throws Exception {
Optional<NiecSensor> optional = repository.findById(model.getId());
if (!optional.isPresent()) {
throw new Exception("未找到该装置");
throw new BusinessException("未找到该装置");
}
NiecSensor sensor = optional.get();
if (StringUtils.isBlank(sensor.getDtimeFieldName())) {
throw new Exception("该装置缺少采样时间字段名信息");
throw new BusinessException("该装置缺少采样时间字段名信息");
}
if (StringUtils.isBlank(sensor.getTableName())) {
throw new Exception("该装置缺少table_name信息");
throw new BusinessException("该装置缺少table_name信息");
}
if (StringUtils.isBlank(sensor.getDevidFieldName())) {
throw new Exception("该装置缺少sensor_id的字段名信息");
throw new BusinessException("该装置缺少sensor_id的字段名信息");
}
if (sensor.getDevId() == null) {
throw new Exception("该装置缺少dev_id信息");
throw new BusinessException("该装置缺少dev_id信息");
}
List<NiecPoint> points = pointService.getList(sensor.getId(), 2);
if (CollectionUtils.isEmpty(points)) {
throw new Exception("该装置缺少业务点表配置信息");
throw new BusinessException("该装置缺少业务点表配置信息");
}
SensorDetail<Map<String, Object>> result = this.getData(sensor, points, model);

@ -1,6 +1,7 @@
package com.xydl.cac.service.impl;
import com.xydl.cac.entity.*;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.model.BindDetail;
import com.xydl.cac.model.BindingModel;
import com.xydl.cac.model.ColumnModel;
@ -87,22 +88,22 @@ public class ParamBindServiceImpl implements ParamBindService {
public Response preview(BindingModel item) throws Exception {
Optional<Modev> optionalModev = modevRepository.findById(item.getEqmid());
if (!optionalModev.isPresent()) {
throw new Exception("未找到该监测装置, eqmid=" + item.getEqmid());
throw new BusinessException("未找到该监测装置, eqmid=" + item.getEqmid());
}
Modev modev = optionalModev.get();
Optional<ModevType> optionalModevType = modevTypeRepository.findById(modev.getModevtid());
if (!optionalModevType.isPresent()) {
throw new Exception("该监测装置类型不正确, 请先修正");
throw new BusinessException("该监测装置类型不正确, 请先修正");
}
ModevType modevType = optionalModevType.get();
Optional<IcdConfigTypeInst> optionalInst = instRepository.findById(item.getIcdid());
if (!optionalInst.isPresent()) {
throw new Exception("未找到该ICD逻辑设备实例, icdid=" + item.getIcdid());
throw new BusinessException("未找到该ICD逻辑设备实例, icdid=" + item.getIcdid());
}
IcdConfigTypeInst inst = optionalInst.get();
Optional<IcdConfigType> optionalType = typeRepository.findById(inst.getIcdConfigTypeId());
if (!optionalType.isPresent()) {
throw new Exception("未找到该实例对应的ICD配置类型, icdid=" + item.getIcdid());
throw new BusinessException("未找到该实例对应的ICD配置类型, icdid=" + item.getIcdid());
}
IcdConfigType type = optionalType.get();
@ -117,7 +118,7 @@ public class ParamBindServiceImpl implements ParamBindService {
// String paramindex = param + "$" + att.getParam();
// Optional<Rptparamindex> optionalRpt = rptparamindexRepository.findById(paramindex);
// if (!optionalRpt.isPresent()) {
// throw new Exception("未找到该Rptparamindex对象参引=" + paramindex);
// throw new BusinessException("未找到该Rptparamindex对象参引=" + paramindex);
// }
}
}
@ -139,24 +140,24 @@ public class ParamBindServiceImpl implements ParamBindService {
public void bind(BindingModel item) throws Exception {
Optional<Modev> optionalModev = modevRepository.findById(item.getEqmid());
if (!optionalModev.isPresent()) {
throw new Exception("未找到该监测装置, eqmid=" + item.getEqmid());
throw new BusinessException("未找到该监测装置, eqmid=" + item.getEqmid());
}
Modev modev = optionalModev.get();
Optional<IcdConfigTypeInst> optionalInst = instRepository.findById(item.getIcdid());
if (!optionalInst.isPresent()) {
throw new Exception("未找到该ICD逻辑设备实例, icdid=" + item.getIcdid());
throw new BusinessException("未找到该ICD逻辑设备实例, icdid=" + item.getIcdid());
}
IcdConfigTypeInst inst = optionalInst.get();
Optional<IcdConfigType> optionalType = typeRepository.findById(inst.getIcdConfigTypeId());
if (!optionalType.isPresent()) {
throw new Exception("未找到该实例对应的ICD配置类型, icdid=" + item.getIcdid());
throw new BusinessException("未找到该实例对应的ICD配置类型, icdid=" + item.getIcdid());
}
IcdConfigType type = optionalType.get();
List<Modev> list = modevRepository.findByIcdidAndIdIsNot(item.getIcdid(), item.getEqmid());
if (!CollectionUtils.isEmpty(list)) {
throw new Exception("该逻辑设备实例已被" + list.get(0).getName() + "绑定");
throw new BusinessException("该逻辑设备实例已被" + list.get(0).getName() + "绑定");
}
List<IcdConfigTypeAtt> attList = attRepository.findByIcdConfigTypeId(type.getId());
@ -175,7 +176,7 @@ public class ParamBindServiceImpl implements ParamBindService {
}
}
if (!found) {
throw new Exception("当前监控设备对应的表" + modevType.getTablename() + "里不存在配置属性"
throw new BusinessException("当前监控设备对应的表" + modevType.getTablename() + "里不存在配置属性"
+ att.getDoName() + "绑定的字段" + att.getColName());
}
}
@ -191,7 +192,7 @@ public class ParamBindServiceImpl implements ParamBindService {
public void unbind(Integer eqmid) throws Exception {
Optional<Modev> optionalModev = modevRepository.findById(eqmid);
if (!optionalModev.isPresent()) {
throw new Exception("未找到该监测装置, eqmid=" + eqmid);
throw new BusinessException("未找到该监测装置, eqmid=" + eqmid);
}
Modev modev = optionalModev.get();
modev.setIcdid(null);
@ -202,7 +203,7 @@ public class ParamBindServiceImpl implements ParamBindService {
public BindDetail getBind(Integer eqmid) throws Exception {
Optional<Modev> optionalModev = modevRepository.findById(eqmid);
if (!optionalModev.isPresent()) {
throw new Exception("未找到该监测装置");
throw new BusinessException("未找到该监测装置");
}
Modev modev = optionalModev.get();
@ -248,12 +249,12 @@ public class ParamBindServiceImpl implements ParamBindService {
private void generateOne(Modev item) throws Exception {
Optional<IcdConfigTypeInst> optionalInst = instRepository.findById(item.getIcdid());
if (!optionalInst.isPresent()) {
throw new Exception("未找到该ICD逻辑设备实例, eqmid=" + item.getId() + ", icdid=" + item.getIcdid());
throw new BusinessException("未找到该ICD逻辑设备实例, eqmid=" + item.getId() + ", icdid=" + item.getIcdid());
}
IcdConfigTypeInst inst = optionalInst.get();
Optional<IcdConfigType> optionalType = typeRepository.findById(inst.getIcdConfigTypeId());
if (!optionalType.isPresent()) {
throw new Exception("未找到该实例对应的ICD配置类型, icdid=" + item.getIcdid());
throw new BusinessException("未找到该实例对应的ICD配置类型, icdid=" + item.getIcdid());
}
IcdConfigType type = optionalType.get();
String param = type.getIedName() + type.getLdeviceInst() + "/" + type.getLnClass()
@ -264,7 +265,7 @@ public class ParamBindServiceImpl implements ParamBindService {
String paramindex = param + "$" + att.getParam();
Optional<Rptparamindex> optionalRpt = rptparamindexRepository.findById(paramindex);
if (!optionalRpt.isPresent()) {
throw new Exception(item.getName() + "的字段" + att.getColName() + "对应的属性"
throw new BusinessException(item.getName() + "的字段" + att.getColName() + "对应的属性"
+ att.getDoName() + "未找到该Rptparamindex对象参引=" + paramindex);
}
Rptparamindex rpt = optionalRpt.get();

@ -4,6 +4,7 @@ import com.xydl.cac.entity.Jg;
import com.xydl.cac.entity.Lx;
import com.xydl.cac.entity.Modev;
import com.xydl.cac.entity.Zsb;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.repository.LxRepository;
import com.xydl.cac.repository.ModevRepository;
import com.xydl.cac.repository.ZsbRepository;
@ -89,11 +90,11 @@ public class ZsbServiceImpl implements ZsbService {
item.setBdzid(jg.getBdzid());
Optional<Lx> optionalLx = lxRepository.findById(item.getLxid());
if (!optionalLx.isPresent()) {
throw new Exception("未找到该设备类型");
throw new BusinessException("未找到该设备类型");
}
List<Zsb> list = repository.findByJgidAndMc(item.getJgid(), item.getMc());
if (!CollectionUtils.isEmpty(list)) {
throw new Exception("该名称已被使用");
throw new BusinessException("该名称已被使用");
}
return repository.save(item);
}
@ -104,11 +105,11 @@ public class ZsbServiceImpl implements ZsbService {
item.setBdzid(jg.getBdzid());
Optional<Lx> optionalLx = lxRepository.findById(item.getLxid());
if (!optionalLx.isPresent()) {
throw new Exception("未找到该设备类型");
throw new BusinessException("未找到该设备类型");
}
List<Zsb> list = repository.findByJgidAndMcAndIdIsNot(item.getJgid(), item.getMc(), item.getId());
if (!CollectionUtils.isEmpty(list)) {
throw new Exception("该名称已被使用");
throw new BusinessException("该名称已被使用");
}
repository.save(item);
}
@ -117,7 +118,7 @@ public class ZsbServiceImpl implements ZsbService {
public void delete(Integer id) throws Exception {
List<Modev> modevList = modevRepository.findByZsbid(id);
if (!CollectionUtils.isEmpty(modevList)) {
throw new Exception("已被监测装置使用不能删除");
throw new BusinessException("已被监测装置使用不能删除");
}
repository.deleteById(id);
}
@ -126,7 +127,7 @@ public class ZsbServiceImpl implements ZsbService {
public Zsb detail(Integer id) throws Exception {
Optional<Zsb> optional = repository.findById(id);
if (!optional.isPresent()) {
throw new Exception("未找到该主设备");
throw new BusinessException("未找到该主设备");
}
Zsb zsb = optional.get();
Jg jg = jgService.detail(zsb.getJgid());

@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.xydl.cac.entity.IcdConfigType;
import com.xydl.cac.exception.BusinessException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
@ -19,7 +20,7 @@ public class IcdXmlUtil {
try {
root = xmlMapper.readTree(xml);
} catch (Exception ex) {
throw new Exception("ICD文件解析失败请上传正确的xml类型文件");
throw new BusinessException("ICD文件解析失败请上传正确的xml类型文件");
}
LinkedHashMap<String, IcdConfigType> result = processTypeRoot(root);
return result;

Loading…
Cancel
Save