This commit is contained in:
huangzj
2023-07-13 13:41:21 +08:00
parent 55b40c0ce8
commit 595474ee10
18 changed files with 540 additions and 146 deletions

View File

@@ -0,0 +1,32 @@
package com.njcn.csdevice.api;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.ServerInfo;
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.api.fallback.EquipmentFeignClientFallbackFactory;
import com.njcn.csdevice.api.fallback.RoleEngineerDevClientFallbackFactory;
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author xy
*/
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/roleEngineerDev", fallbackFactory = RoleEngineerDevClientFallbackFactory.class,contextId = "roleEngineerDev")
public interface RoleEngineerDevFeignClient {
@PostMapping("/getRoleengineer")
public HttpResult<List<String>> getRoleengineer();
@PostMapping("/getDevice")
public HttpResult<List<String>> getDevice();
}

View File

@@ -0,0 +1,47 @@
package com.njcn.csdevice.api.fallback;
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.EquipmentFeignClient;
import com.njcn.csdevice.api.RoleEngineerDevFeignClient;
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author xy
*/
@Slf4j
@Component
public class RoleEngineerDevClientFallbackFactory implements FallbackFactory<RoleEngineerDevFeignClient> {
@Override
public RoleEngineerDevFeignClient create(Throwable cause) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (cause.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) cause.getCause();
// exceptionEnum = UserEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new RoleEngineerDevFeignClient() {
@Override
public HttpResult<List<String>> getRoleengineer() {
log.error("{}异常,降级处理,异常为:{}","查询角色工程异常",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<String>> getDevice() {
log.error("{}异常,降级处理,异常为:{}","查询角色设备异常",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,51 @@
package com.njcn.csdevice.pojo.param;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
/**
*
* Description:
* Date: 2023/7/10 18:30【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
@NoArgsConstructor
public class CsLineTopologyTemplateParm {
/**
* 拓扑图模板Id
*/
@NotBlank(message="拓扑图模板Id不能为空")
private String topoId;
/**
* 监测点位置
*/
private String linePostion;
/**
* 监测点中心点经度
*/
@ApiModelProperty(value="监测点中心点经度")
@NotBlank(message="监测点中心点经度不能为空!")
private BigDecimal lng;
/**
* 监测点中心点纬度
*/
@ApiModelProperty(value="监测点中心点纬度")
@NotBlank(message="监测点中心点纬度不能为空!")
private BigDecimal lat;
}

View File

@@ -24,13 +24,15 @@ import java.math.BigDecimal;
@TableName(value = "cs_line_topology_template")
public class CsLineTopologyTemplate extends BaseEntity {
/**
* 拓扑图Id
* 模板Id
*/
@TableId(value = "id", type = IdType.INPUT)
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
@TableField(value = "topo_id")
private String topoId;
/**
* 监测点Id
* 监测点位置
*/
@TableField(value = "line_postion")
private String linePostion;

View File

@@ -0,0 +1,51 @@
package com.njcn.csdevice.pojo.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
*
* Description:
* Date: 2023/7/10 18:30【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
@NoArgsConstructor
public class CsLineTopologyTemplateVO {
/**
* 模板id
*/
private String id;
private String topoId;
/**
* 监测点位置
*/
private String linePostion;
/**
* 中心点经度
*/
@ApiModelProperty(value="中心点经度")
private BigDecimal lng;
/**
* 中心点纬度
*/
@ApiModelProperty(value="中心点纬度")
private BigDecimal lat;
}

View File

@@ -3,6 +3,8 @@ package com.njcn.csdevice.pojo.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.util.List;
/**
*
* Description:
@@ -35,5 +37,6 @@ public class CsTopologyDiagramTemplateVO {
@TableField(value = "`status`")
private String status;
private List<CsLineTopologyTemplateVO> csLineTopologyTemplateVOList;
}