代码优化
This commit is contained in:
@@ -91,6 +91,12 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
||||
json = JsonUtil.convertStreamToString(file.getInputStream());
|
||||
Gson gson = new Gson();
|
||||
TemplateDto templateDto = gson.fromJson(json, TemplateDto.class);
|
||||
//判断设备型号
|
||||
String devType = templateDto.getDevType();
|
||||
DictTreeVO dictTreeVO = dictTreeFeignClient.queryByCode(devType).getData();
|
||||
if (Objects.isNull(dictTreeVO)){
|
||||
throw new BusinessException(AccessResponseEnum.DEV_TYPE_NOT_FIND);
|
||||
}
|
||||
logDto.setOperate("新增设备模板,模板名称:" + templateDto.getDevType());
|
||||
//模板文件存入文件服务器
|
||||
String filePath = fileStorageUtil.uploadMultipart(file, OssPath.DEV_MODEL + templateDto.getDevType() + "_");
|
||||
@@ -838,9 +844,6 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
||||
List<DataSetDto> dataSetList = templateDto.getDataSet();
|
||||
String devType = templateDto.getDevType();
|
||||
DictTreeVO dictTreeVO = dictTreeFeignClient.queryByCode(devType).getData();
|
||||
if (Objects.isNull(dictTreeVO)){
|
||||
throw new BusinessException(AccessResponseEnum.DEV_TYPE_NOT_FIND);
|
||||
}
|
||||
String code = dictTreeFeignClient.queryById(dictTreeVO.getPid()).getData().getCode();
|
||||
//逻辑设备录入
|
||||
if (CollectionUtil.isNotEmpty(dataSetList)){
|
||||
|
||||
Reference in New Issue
Block a user