1.监测点表新增两个字段

2.无线bug提交
This commit is contained in:
2024-09-29 08:48:57 +08:00
parent 162f39543e
commit f13c8670cb
14 changed files with 201 additions and 38 deletions

View File

@@ -0,0 +1,25 @@
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.CsCommTerminalFeignClientFallbackFactory;
import com.njcn.csdevice.api.fallback.CsDeviceUserClientFallbackFactory;
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author xy
*/
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/commTerminal", fallbackFactory = CsCommTerminalFeignClientFallbackFactory.class,contextId = "deviceUser")
public interface CsCommTerminalFeignClient {
@GetMapping("lineUnitDetail")
HttpResult<PqsDeviceUnit> lineUnitDetail(@RequestParam("lineId") String lineId);
}

View File

@@ -7,6 +7,7 @@ import com.njcn.csdevice.pojo.po.CsDataSet;
import com.njcn.csdevice.pojo.vo.LineTargetVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -27,4 +28,8 @@ public interface DataSetFeignClient {
@PostMapping("/getModuleDataSet")
HttpResult<List<CsDataSet>> getModuleDataSet(@RequestParam("modelId") String modelId);
@PostMapping("/getDataSetBySetIds")
HttpResult<List<CsDataSet>> getDataSetBySetIds(@RequestBody List<String> lineIds);
}

View File

@@ -0,0 +1,36 @@
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.CsCommTerminalFeignClient;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author xy
*/
@Slf4j
@Component
public class CsCommTerminalFeignClientFallbackFactory implements FallbackFactory<CsCommTerminalFeignClient> {
@Override
public CsCommTerminalFeignClient create(Throwable cause) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (cause.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) cause.getCause();
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new CsCommTerminalFeignClient() {
@Override
public HttpResult<PqsDeviceUnit> lineUnitDetail(String lineId) {
log.error("{}异常,降级处理,异常为:{}","查询分组",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -50,6 +50,12 @@ public class DataSetFeignClientFallbackFactory implements FallbackFactory<DataSe
log.error("{}异常,降级处理,异常为:{}","获取子模块数据集",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<CsDataSet>> getDataSetBySetIds(List<String> lineIds) {
log.error("{}异常,降级处理,异常为:{}","根据数据集ids获取数据集",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -44,6 +44,16 @@ public class CsLinePO extends BaseEntity {
@TableField(value = "`position`")
private String position;
/**
* 数据集id
*/
private String dataSetId;
/**
* 模板id
*/
private String dataModelId;
/**
* 电压等级
*/

View File

@@ -1,12 +1,15 @@
package com.njcn.csdevice.utils;
/**
* 类的介绍:用来将二次值转成一次值
* 类的介绍:
* @author xuyang
* @version 1.0.0
*/
public class DataChangeUtil {
/**
* 用来将二次值转成一次值
*/
public static double secondaryToPrimary(String formula, Double data,Double pt, Double ct) {
switch (formula) {
case "*PT":
@@ -23,4 +26,24 @@ public class DataChangeUtil {
}
return data;
}
/**
* 用来将一次值转成二次值
*/
public static double primaryToSecondary(String formula, Double data,Double pt, Double ct) {
switch (formula) {
case "*PT":
data = data / pt;
break;
case "*CT":
data = data / ct;
break;
case "*PT*CT":
data = data / pt / ct;
break;
default:
break;
}
return data;
}
}