暂降事件

This commit is contained in:
huangzj
2023-09-06 14:21:47 +08:00
parent 61a9a99e47
commit 61ebd8830e
25 changed files with 478 additions and 64 deletions

View File

@@ -3,9 +3,12 @@ package com.njcn.csdevice.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.csdevice.api.fallback.CsLedgerFeignClientFallbackFactory;
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
import com.njcn.csdevice.pojo.dto.LineParamDTO;
import com.njcn.csdevice.pojo.param.CsLedgerParam;
import com.njcn.csdevice.pojo.po.CsLedger;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
@@ -29,5 +32,7 @@ public interface CsLedgerFeignClient {
@PostMapping("/queryLine")
HttpResult<List<CsLedger>> queryLine(@RequestBody @Validated LineParamDTO lineParamdto);
@PostMapping("/queryDevDetail")
HttpResult<DevDetailDTO> queryDevDetail(@RequestParam("devId") String devId);
}

View File

@@ -4,6 +4,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.csdevice.api.CsLedgerFeignClient;
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
import com.njcn.csdevice.pojo.dto.LineParamDTO;
import com.njcn.csdevice.pojo.param.CsLedgerParam;
import com.njcn.csdevice.pojo.po.CsLedger;
@@ -48,6 +49,12 @@ public class CsLedgerFeignClientFallbackFactory implements FallbackFactory<CsLed
log.error("{}异常,降级处理,异常为:{}","查询监测点",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<DevDetailDTO> queryDevDetail(String devId) {
log.error("{}异常,降级处理,异常为:{}","查询设备详情",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,34 @@
package com.njcn.csdevice.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* Description:
* Date: 2023/9/6 13:59【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
public class DevDetailDTO {
@ApiModelProperty(value = "工程id")
private String engineeringid;
/**
* 工程名称
*/
@ApiModelProperty(value = "工程名称")
private String engineeringName;
@ApiModelProperty(value = "项目id")
private String projectId;
@ApiModelProperty(value = "项目名称")
private String projectName;
@ApiModelProperty(value = "设备id")
private String equipmentId;
@ApiModelProperty(value = "设备名称")
private String equipmentName;
}

View File

@@ -6,6 +6,7 @@ import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
import com.njcn.csdevice.pojo.dto.LineParamDTO;
import com.njcn.csdevice.pojo.param.CsLedgerParam;
import com.njcn.csdevice.pojo.po.CsLedger;
@@ -125,5 +126,15 @@ public class CsLedgerController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryDevDetail")
@ApiOperation("根据设备号查询工程,项目,设备")
@ApiImplicitParam(name = "devId", value = "查询条件", required = true)
public HttpResult<DevDetailDTO> queryDevDetail(@RequestParam @Validated String devId){
String methodDescribe = getMethodDescribe("queryDevDetail");
DevDetailDTO details = csLedgerService.queryDevDetail(devId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, details, methodDescribe);
}
}

View File

@@ -1,6 +1,7 @@
package com.njcn.csdevice.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
import com.njcn.csdevice.pojo.dto.LineParamDTO;
import com.njcn.csdevice.pojo.param.CsLedgerParam;
import com.njcn.csdevice.pojo.po.CsLedger;
@@ -71,4 +72,6 @@ public interface ICsLedgerService extends IService<CsLedger> {
List<CsLedgerVO> getProjectTree();
List<CsLedger> queryLine(LineParamDTO lineParamdto);
DevDetailDTO queryDevDetail(String devId);
}

View File

@@ -9,6 +9,7 @@ import com.njcn.csdevice.mapper.AppProjectMapper;
import com.njcn.csdevice.mapper.AppTopologyDiagramMapper;
import com.njcn.csdevice.mapper.CsEngineeringMapper;
import com.njcn.csdevice.mapper.CsLedgerMapper;
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
import com.njcn.csdevice.pojo.dto.LineParamDTO;
import com.njcn.csdevice.pojo.param.CsLedgerParam;
import com.njcn.csdevice.pojo.po.AppProjectPO;
@@ -213,6 +214,22 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
return lineIds;
}
@Override
public DevDetailDTO queryDevDetail(String devId) {
DevDetailDTO device = new DevDetailDTO();
CsLedger dev = this.findDataById(devId);
device.setEquipmentName(dev.getId());
device.setEquipmentId(devId);
CsLedger project = this.findDataById(dev.getPid());
device.setProjectId(project.getId());
device.setProjectName(project.getName());
CsLedger engineer = this.findDataById(project.getPid());
device.setEngineeringid(engineer.getId());
device.setEngineeringName(engineer.getName());
return device;
}
/**
* 获取子节点
*/