1.解决mysql语句关键字问题

2.mysql台账同步oracle
This commit is contained in:
wr
2024-10-11 16:42:02 +08:00
parent f291c85e27
commit 08c5e44755
27 changed files with 887 additions and 15 deletions

View File

@@ -4,10 +4,12 @@ import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.pq.api.fallback.PqsTerminalLogsClientFallbackFactory;
import com.njcn.device.pq.pojo.po.Node;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
@@ -19,8 +21,18 @@ import java.util.List;
public interface NodeClient {
@ApiOperation("获取全部前置机")
/**
* 获取全部前置机
* @return
*/
@GetMapping("/nodeAllList")
HttpResult<List<Node>> nodeAllList();
/**
* 根据id获取前置机
* @param id
* @return
*/
@GetMapping("/getNodeById")
HttpResult<Node> getNodeById(@Validated @NotNull(message = "id不可为空") @RequestParam("id")String id);
}

View File

@@ -39,6 +39,12 @@ public class NodeClientFallbackFactory implements FallbackFactory<NodeClient> {
log.error("{}异常,降级处理,异常为:{}", "获取全部前置机", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<Node> getNodeById(String id) {
log.error("{}异常,降级处理,异常为:{}", "根据id获取前置机", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};

View File

@@ -3,6 +3,8 @@ package com.njcn.device.pq.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 类的介绍:
*
@@ -24,6 +26,12 @@ public class PollutionSubstationDTO {
@ApiModelProperty("电压等级")
private String voltageLevel;
@ApiModelProperty(name ="lng",value = "变电站经度")
private BigDecimal lng;
@ApiModelProperty(name ="lat",value = "变电站纬度")
private BigDecimal lat;
@ApiModelProperty("数据")
private Double data = 3.14159;

View File

@@ -56,4 +56,9 @@ public class SyncTerminalParam {
@ApiModelProperty(name = "lineParam",value = "监测点信息")
private LineParam lineParam;
@ApiModelProperty(name = "oracleLineId",value = "oracle监测点id")
private Integer oracleLineId;
@ApiModelProperty(name = "oracleDevId",value = "oracle终端id")
private Integer oracleDevId;
}

View File

@@ -41,4 +41,11 @@ public class LineDataIntegrity implements Serializable {
*/
private Double integrityData;
private Double mysqlReal;
public void setMysqlReal(Double mysqlReal) {
this.real = mysqlReal;
this.mysqlReal = mysqlReal;
}
}

View File

@@ -140,7 +140,7 @@ public class NodeController extends BaseController {
*/
@ApiOperation("获取全部前置机")
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
@GetMapping("nodeAllList")
@GetMapping("/nodeAllList")
public HttpResult<List<Node>> nodeAllList(){
String methodDescribe = getMethodDescribe("nodeAllList");
List<Node> resList = iNodeService.nodeAllList();
@@ -155,15 +155,11 @@ public class NodeController extends BaseController {
@ApiOperation("根据id获取前置机")
@ApiImplicitParam(value = "前置机id",name = "id",required = true)
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
@GetMapping("getNodeById")
@GetMapping("/getNodeById")
public HttpResult<Node> getNodeById(@Validated @NotNull(message = "id不可为空") @RequestParam("id")String id){
String methodDescribe = getMethodDescribe("getNodeById");
Node node = iNodeService.getNodeById(id);
if(Objects.isNull(node)){
throw new BusinessException(CommonResponseEnum.FAIL);
}else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, node, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, node, methodDescribe);
}

View File

@@ -71,7 +71,7 @@
line.pid as 'pid',
line.Pids as 'pids',
line.Name AS 'name',
line.Levelas 'Level',
line.Level as 'Level',
pd.Update_Time AS 'updateTime',
line.Sort as 'sort',
pd.Com_Flag as 'ComFlag',

View File

@@ -650,7 +650,9 @@
<select id="getSubstationInfo" resultType="PollutionSubstationDTO">
SELECT A.id,
A.Name name,
C.Name voltageLevel
C.Name voltageLevel,
b.Lng,
b.lat
FROM pq_line A,
pq_substation B,
sys_dict_data C

View File

@@ -5,7 +5,7 @@
<select id="getLineIntegrityRate" resultType="LineDataIntegrity">
select line_index lineId,
avg(real_time/due_time)*100 integrityData,
sum(real_time) real,
sum(real_time) mysqlReal,
sum(due_time) due
from r_stat_integrity_d
where line_index in

View File

@@ -1898,8 +1898,14 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
deviceDetail.setLoginTime(PubUtils.localDateFormat(deviceParam.getLoginTime()));
deviceDetail.setUpdateTime(LocalDateTime.now());
//处理终端oracle关系
if (ObjectUtil.isNotNull(syncTerminalParam.getOracleDevId())) {
DeviceBak back = new DeviceBak();
back.setId(deviceDetail.getId());
back.setDevId(syncTerminalParam.getOracleDevId());
deviceBakService.saveOrUpdate(back);
}
//处理装置识别码秘钥
deviceMapper.insert(deviceDetail);
//装置功能 todo确定devFuction
// List<DictData> funList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_FUN.getName()).getData();
@@ -1963,7 +1969,13 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
}
lineDetailMapper.insert(lineDetail);
//处理终端oracle关系
if (ObjectUtil.isNotNull(syncTerminalParam.getOracleLineId())) {
LineBak back = new LineBak();
back.setId(lineDetail.getId());
back.setLineId(syncTerminalParam.getOracleLineId());
lineBakService.saveOrUpdate(back);
}
//通过监测点id获取母线电压等级
Voltage voltage = lineMapper.getVoltageByLineId(line.getId());
//监测点限值