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

@@ -1,5 +1,6 @@
package com.njcn.device.biz.pojo.po; package com.njcn.device.biz.pojo.po;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@@ -14,6 +15,7 @@ public class DeviceBak {
/** /**
* 终端Id * 终端Id
*/ */
@TableId("Id")
private String id; private String id;

View File

@@ -4,10 +4,12 @@ import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.pq.api.fallback.PqsTerminalLogsClientFallbackFactory; import com.njcn.device.pq.api.fallback.PqsTerminalLogsClientFallbackFactory;
import com.njcn.device.pq.pojo.po.Node; import com.njcn.device.pq.pojo.po.Node;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; 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.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
@@ -19,8 +21,18 @@ import java.util.List;
public interface NodeClient { public interface NodeClient {
@ApiOperation("获取全部前置机") /**
* 获取全部前置机
* @return
*/
@GetMapping("/nodeAllList") @GetMapping("/nodeAllList")
HttpResult<List<Node>> 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()); log.error("{}异常,降级处理,异常为:{}", "获取全部前置机", throwable.toString());
throw new BusinessException(finalExceptionEnum); 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 io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
/** /**
* 类的介绍: * 类的介绍:
* *
@@ -24,6 +26,12 @@ public class PollutionSubstationDTO {
@ApiModelProperty("电压等级") @ApiModelProperty("电压等级")
private String voltageLevel; private String voltageLevel;
@ApiModelProperty(name ="lng",value = "变电站经度")
private BigDecimal lng;
@ApiModelProperty(name ="lat",value = "变电站纬度")
private BigDecimal lat;
@ApiModelProperty("数据") @ApiModelProperty("数据")
private Double data = 3.14159; private Double data = 3.14159;

View File

@@ -56,4 +56,9 @@ public class SyncTerminalParam {
@ApiModelProperty(name = "lineParam",value = "监测点信息") @ApiModelProperty(name = "lineParam",value = "监测点信息")
private LineParam lineParam; 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 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("获取全部前置机") @ApiOperation("获取全部前置机")
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM) @OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
@GetMapping("nodeAllList") @GetMapping("/nodeAllList")
public HttpResult<List<Node>> nodeAllList(){ public HttpResult<List<Node>> nodeAllList(){
String methodDescribe = getMethodDescribe("nodeAllList"); String methodDescribe = getMethodDescribe("nodeAllList");
List<Node> resList = iNodeService.nodeAllList(); List<Node> resList = iNodeService.nodeAllList();
@@ -155,16 +155,12 @@ public class NodeController extends BaseController {
@ApiOperation("根据id获取前置机") @ApiOperation("根据id获取前置机")
@ApiImplicitParam(value = "前置机id",name = "id",required = true) @ApiImplicitParam(value = "前置机id",name = "id",required = true)
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM) @OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
@GetMapping("getNodeById") @GetMapping("/getNodeById")
public HttpResult<Node> getNodeById(@Validated @NotNull(message = "id不可为空") @RequestParam("id")String id){ public HttpResult<Node> getNodeById(@Validated @NotNull(message = "id不可为空") @RequestParam("id")String id){
String methodDescribe = getMethodDescribe("getNodeById"); String methodDescribe = getMethodDescribe("getNodeById");
Node node = iNodeService.getNodeById(id); 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.pid as 'pid',
line.Pids as 'pids', line.Pids as 'pids',
line.Name AS 'name', line.Name AS 'name',
line.Levelas 'Level', line.Level as 'Level',
pd.Update_Time AS 'updateTime', pd.Update_Time AS 'updateTime',
line.Sort as 'sort', line.Sort as 'sort',
pd.Com_Flag as 'ComFlag', pd.Com_Flag as 'ComFlag',

View File

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

View File

@@ -5,7 +5,7 @@
<select id="getLineIntegrityRate" resultType="LineDataIntegrity"> <select id="getLineIntegrityRate" resultType="LineDataIntegrity">
select line_index lineId, select line_index lineId,
avg(real_time/due_time)*100 integrityData, avg(real_time/due_time)*100 integrityData,
sum(real_time) real, sum(real_time) mysqlReal,
sum(due_time) due sum(due_time) due
from r_stat_integrity_d from r_stat_integrity_d
where line_index in 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.setLoginTime(PubUtils.localDateFormat(deviceParam.getLoginTime()));
deviceDetail.setUpdateTime(LocalDateTime.now()); 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); deviceMapper.insert(deviceDetail);
//装置功能 todo确定devFuction //装置功能 todo确定devFuction
// List<DictData> funList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_FUN.getName()).getData(); // 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); 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获取母线电压等级 //通过监测点id获取母线电压等级
Voltage voltage = lineMapper.getVoltageByLineId(line.getId()); Voltage voltage = lineMapper.getVoltageByLineId(line.getId());
//监测点限值 //监测点限值

View File

@@ -90,5 +90,10 @@ public class AlarmPO implements Serializable {
private float onlineRate; private float onlineRate;
private Integer mysqlReal;
public void setMysqlReal(Integer mysqlReal) {
this.real = mysqlReal;
this.mysqlReal = mysqlReal;
}
} }

View File

@@ -82,7 +82,7 @@
SELECT SELECT
device.id AS deviceId, device.id AS deviceId,
IFNULL(SUM(integrity.due_time),3.14159) AS due, IFNULL(SUM(integrity.due_time),3.14159) AS due,
IFNULL(SUM(integrity.real_time),0) AS real, IFNULL(SUM(integrity.real_time),0) AS mysqlReal,
CONVERT(SUM(integrity.real_time)*100/SUM(integrity.due_time),DECIMAL(15,2)) AS integrity CONVERT(SUM(integrity.real_time)*100/SUM(integrity.due_time),DECIMAL(15,2)) AS integrity
FROM r_stat_integrity_d integrity FROM r_stat_integrity_d integrity
INNER JOIN pq_line line ON integrity.line_index = line.id INNER JOIN pq_line line ON integrity.line_index = line.id

View File

@@ -27,6 +27,9 @@ public enum SupervisionResponseEnum {
DELETE_TO_BE_SUBMITTED("A00550","流程删除失败,只有待提交信息可删除!"), DELETE_TO_BE_SUBMITTED("A00550","流程删除失败,只有待提交信息可删除!"),
EXISTENCE_OR_NOT("A00550","信息查询为空,请检查信息是否存在!"), EXISTENCE_OR_NOT("A00550","信息查询为空,请检查信息是否存在!"),
NAME_EXISTS("A00550","名称重复"), NAME_EXISTS("A00550","名称重复"),
PROJECT_OR_NOT("A00550","项目名称为空,请检查信息是否存在!"),
PROVINCE_OR_NOT("A00550","省级名称为空,请检查信息是否存在!"),
GD_OR_NOT("A00550","供电名称为空,请检查信息是否存在!"),
; ;
private final String code; private final String code;

View File

@@ -0,0 +1,86 @@
package com.njcn.supervision.pojo.param.oracle;
import lombok.Data;
import java.io.Serializable;
/**
*
* @TableName PQ_DEVICE
*/
@Data
public class PqDevice implements Serializable {
/**
* 装置名称(唯一性判断)
*/
private String name;
/**
* 装置通讯状态0中断1正常
*/
private Integer status;
/**
* 关联表PQS_Dicdata装置型号Guid
*/
private String devtype;
/**
* 登录时间
*/
private String logontime;
/**
* 数据更新时间
*/
private String updatetime;
/**
* 关联表NodeInformation服务器表序号表明这台设备运行在哪台服务器上
*/
private String nodeName;
/**
* 端口ID用于端口映射
*/
private Integer portid;
/**
* 装置状态0投运1热备用2停运
*/
private Integer devflag;
/**
* 装置识别码采用3ds加密
*/
private String devSeries;
/**
* 装置秘钥采用3ds加密
*/
private String devKey;
/**
* IP地址
*/
private String ip;
/**
* 装置模型0虚拟设备1实际设备2离线设备默认是实际设备
*/
private Integer devmodel;
/**
* 已召唤标志
*/
private Integer callflag;
/**
* 数据类型0暂态系统1稳态系统2两个系统
*/
private Integer datatype;
}

View File

@@ -0,0 +1,90 @@
package com.njcn.supervision.pojo.param.oracle;
import lombok.Data;
import java.io.Serializable;
/**
*
* @TableName PQ_DEVICEDETAIL
*/
@Data
public class PqDevicedetail implements Serializable {
/**
* 关联PQS_Dicdata设备制造商Guid
*/
private String manufacturer;
/**
* 定检状态0已检 1未检
*/
private Integer checkflag;
/**
* 本次定检时间
*/
private String thistimecheck;
/**
* 下次定检时间假如跟当前时间比少于3个月则定检状态界面显示为待检
*/
private String nexttimecheck;
/**
* 统计在线率总数
*/
private Integer onlineratetj;
/**
* 总套餐流量
*/
private Integer dataplan;
/**
* 新增流量套餐
*/
private Integer newtraffic;
/**
* 电度功能
*/
private Integer electroplate;
/**
* 对时功能
*/
private Integer ontime;
/**
* 合同号
*/
private String contract;
/**
* SIM卡号
*/
private String sim;
/**
* 装置系列
*/
private String devCatena;
/**
* 监测装置安装位置
*/
private String devLocation;
/**
* 监测厂家设备编号
*/
private String devNo;
/**
* 告警功能
*/
private Integer isAlarm;
}

View File

@@ -0,0 +1,36 @@
package com.njcn.supervision.pojo.param.oracle;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
*
* @TableName PQ_DEVTYPEICD
*/
@TableName(value ="PQ_DEVTYPEICD")
@Data
public class PqDevtypeicd implements Serializable {
/**
*
*/
@TableField(value = "DEVTYPE")
private String devtype;
/**
*
*/
@TableField(value = "ICDTEMPLATEBLOB")
private byte[] icdtemplateblob;
/**
*
*/
@TableField(value = "ICDTEMPLATECLOB")
private String icdtemplateclob;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,20 @@
package com.njcn.supervision.pojo.param.oracle;
import lombok.Data;
import java.io.Serializable;
/**
*
* @TableName PQ_GDINFORMATION 供电公司信息表
*/
@Data
public class PqGdinformation implements Serializable {
/**
* (关联表PQS_DICDATA外键)省份Guid
*/
private String name;
}

View File

@@ -0,0 +1,72 @@
package com.njcn.supervision.pojo.param.oracle;
import lombok.Data;
import java.io.Serializable;
/**
*
* @TableName PQ_LINE
*/
@Data
public class PqLine implements Serializable {
/**
* 线路名称
*/
private String name;
/**
* PT一次变比
*/
private Double pt1;
/**
* PT二次变比
*/
private Double pt2;
/**
* CT一次变比
*/
private Double ct1;
/**
* CT二次变比
*/
private Double ct2;
/**
* 设备容量
*/
private Double devcmp;
/**
* 短路容量
*/
private Double dlcmp;
/**
* 基准容量
*/
private Double jzcmp;
/**
* 协议容量
*/
private Double xycmp;
/**
*
*/
private String scale;
/**
* 0投运 1.热备用 2.停运
*/
private Integer status;
}

View File

@@ -0,0 +1,121 @@
package com.njcn.supervision.pojo.param.oracle;
import lombok.Data;
import java.io.Serializable;
/**
*
* @TableName PQ_LINEDETAIL
*/
@Data
public class PqLinedetail implements Serializable {
/**
* 线路名称
*/
private String lineName;
/**
* 接线类型(0:星型接法;1:三角型接法;2:开口三角型接法)
*/
private Integer pttype;
/**
* 上次数据更新时间
*/
private String lastTime;
/**
* 测量间隔1~10
*/
private Integer tinterval;
/**
* 关联PQS_Dicdata表负荷类型Guid
*/
private String loadtype;
/**
* 关联PQS_Dicdata表行业类型Guid
*/
private String businesstype;
/**
* 备注
*/
private String remark;
/**
* 国网谐波监测平台监测点号
*/
private String monitorId;
/**
* 0-电网侧1-非电网侧
*/
private Integer powerid;
/**
* 监测点对象名称
*/
private String objname;
/**
* 统计类型
*/
private Integer statflag;
/**
* 监测点等级
*/
private String lineGrade;
/**
* 电网侧变电站名称
*/
private String powerSubstationName;
/**
* 挂接线路
*/
private String hangLine;
/**
* 监测点拥有者
*/
private String owner;
/**
* 拥有者职务
*/
private String ownerDuty;
/**
* 拥有者联系方式
*/
private String ownerTel;
/**
* 接线图
*/
private String wiringDiagram;
/**
* 上级电站
*/
private String superiorsSubstation;
/**
* 分类等级 内容为Ⅰ、Ⅱ、Ⅲ、Ⅳ
*/
private String classificationGrade;
/**
* 是否并网点
*/
private Integer isGridPoint;
}

View File

@@ -0,0 +1,22 @@
package com.njcn.supervision.pojo.param.oracle;
import lombok.Data;
import java.io.Serializable;
/**
*
* @author web2023
* @TableName PQ_PROJECT 项目信息表
*/
@Data
public class PqProject implements Serializable {
/**
* 项目名称(唯一性判断)
*/
private String name;
}

View File

@@ -0,0 +1,22 @@
package com.njcn.supervision.pojo.param.oracle;
import lombok.Data;
import java.io.Serializable;
/**
*
* @author web2023
* @TableName PQ_PROVINCE 省级信息表
*/
@Data
public class PqProvince implements Serializable {
/**
* 省级名称(唯一性判断)
*/
private String name;
}

View File

@@ -0,0 +1,24 @@
package com.njcn.supervision.pojo.param.oracle;
import lombok.Data;
import java.io.Serializable;
/**
*
* @TableName PQ_SUBSTATION
*/
@Data
public class PqSubstation implements Serializable {
/**
*
*/
private String name;
/**
* 关联PQS_Dictionary表电压等级Guid
*/
private String scale;
}

View File

@@ -0,0 +1,37 @@
package com.njcn.supervision.pojo.param.oracle;
import lombok.Data;
import java.io.Serializable;
/**
*
* @TableName PQ_SUBVOLTAGE
*/
@Data
public class PqSubvoltage implements Serializable {
/**
* 母线名称
*/
private String name;
/**
* 母线号(在同一台设备中的电压通道号)
*/
private Integer subvNum;
/**
* 关联表PQS_Dicdata电压等级Guid
*/
private String scale;
/**
* 母线模型0虚拟母线1实际母线
* 默认是实际母线
*/
private Integer subvmodel;
}

View File

@@ -0,0 +1,31 @@
package com.njcn.supervision.pojo.param.oracle;
import lombok.Data;
import java.io.Serializable;
/**
*
* @TableName PQS_MAP 变电站经纬度
*/
@Data
public class PqsMap implements Serializable {
/**
* 经度
*/
private Double longitude;
/**
* 纬度
*/
private Double latitude;
/**
* 数据状态0删除1正常
*/
private Integer state;
}

View File

@@ -0,0 +1,69 @@
package com.njcn.supervision.pojo.param.oracle;
import lombok.Data;
import java.io.Serializable;
/**
* @author wr
* @description
* @date 2024/10/9 16:37
*/
@Data
public class SyncLedger implements Serializable {
/**
* 线路信息表
*/
private PqLine pqLine;
/**
* 线路参数附加定义表
*/
private PqLinedetail pqLinedetail;
/**
* 母线信息表
*/
private PqSubvoltage pqSubvoltage;
/**
* 装置信息表
*/
private PqDevice pqDevice;
/**
* 装置详细信息表
*/
private PqDevicedetail pqDevicedetail;
/**
* 变电站信息表
*/
private PqSubstation pqSubstation;
/**
* 变电站经纬度
*/
private PqsMap pqsMap;
/**
* 供电公司信息表
*/
private PqGdinformation pqGdinformation;
/**
* 省级信息表,层次高于供电公司
*/
private PqProvince pqProvince;
/**
* 项目信息表,层次高于省级
*/
private PqProject pqProject;
/**
* 线路号(在同一台设备中的监测点号)
*/
private Integer lineNum;
}

View File

@@ -21,17 +21,22 @@ import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO;
import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam; import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam;
import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.biz.enums.DeviceResponseEnum;
import com.njcn.device.pq.api.DeptLineFeignClient; import com.njcn.device.pq.api.DeptLineFeignClient;
import com.njcn.device.pq.api.LineFeignClient; import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.api.NodeClient;
import com.njcn.device.pq.api.TerminalBaseClient; import com.njcn.device.pq.api.TerminalBaseClient;
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
import com.njcn.device.pq.pojo.param.*; import com.njcn.device.pq.pojo.param.*;
import com.njcn.device.pq.pojo.po.Line; import com.njcn.device.pq.pojo.po.Line;
import com.njcn.device.pq.pojo.po.Node;
import com.njcn.supervision.enums.SupervisionKeyEnum; import com.njcn.supervision.enums.SupervisionKeyEnum;
import com.njcn.supervision.enums.SupervisionResponseEnum; import com.njcn.supervision.enums.SupervisionResponseEnum;
import com.njcn.supervision.enums.UserNatureEnum; import com.njcn.supervision.enums.UserNatureEnum;
import com.njcn.supervision.mapper.device.SupervisionTempLineDebugPOMapper; import com.njcn.supervision.mapper.device.SupervisionTempLineDebugPOMapper;
import com.njcn.supervision.mapper.user.UserReportNormalMapper; import com.njcn.supervision.mapper.user.UserReportNormalMapper;
import com.njcn.supervision.pojo.param.device.SupervisionTempLineDebugParam; import com.njcn.supervision.pojo.param.device.SupervisionTempLineDebugParam;
import com.njcn.supervision.pojo.param.oracle.*;
import com.njcn.supervision.pojo.po.device.SupervisionTempDeviceReport; import com.njcn.supervision.pojo.po.device.SupervisionTempDeviceReport;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineDebugPO; import com.njcn.supervision.pojo.po.device.SupervisionTempLineDebugPO;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineReport; import com.njcn.supervision.pojo.po.device.SupervisionTempLineReport;
@@ -47,17 +52,22 @@ import com.njcn.supervision.service.user.UserReportProjectPOService;
import com.njcn.supervision.service.user.UserReportSensitivePOService; import com.njcn.supervision.service.user.UserReportSensitivePOService;
import com.njcn.supervision.service.user.UserReportSubstationPOService; import com.njcn.supervision.service.user.UserReportSubstationPOService;
import com.njcn.supervision.utils.InstanceUtil; import com.njcn.supervision.utils.InstanceUtil;
import com.njcn.system.api.AreaFeignClient;
import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.api.DictTreeFeignClient; import com.njcn.system.api.DictTreeFeignClient;
import com.njcn.system.enums.DicDataTypeEnum; import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.Area;
import com.njcn.system.pojo.po.DictData; import com.njcn.system.pojo.po.DictData;
import com.njcn.system.pojo.po.SysDicTreePO; import com.njcn.system.pojo.po.SysDicTreePO;
import com.njcn.user.api.DeptFeignClient; import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.api.UserFeignClient; import com.njcn.user.api.UserFeignClient;
import com.njcn.web.factory.PageFactory; import com.njcn.web.factory.PageFactory;
import com.njcn.web.utils.RequestUtil; import com.njcn.web.utils.RequestUtil;
import com.njcn.web.utils.RestTemplateUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -91,6 +101,15 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
private final UserReportSensitivePOService userReportSensitivePOService; private final UserReportSensitivePOService userReportSensitivePOService;
private final UserReportNormalMapper userReportNormalMapper; private final UserReportNormalMapper userReportNormalMapper;
private final TerminalBaseClient terminalBaseClient; private final TerminalBaseClient terminalBaseClient;
private final AreaFeignClient areaFeignClient;
private final NodeClient nodeClient;
@Value("${oracle.isSync}")
private Boolean isSync;
@Value("${oracle.syncLedgerLineUrl}")
private String url;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@@ -403,7 +422,15 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
syncTerminalParam.setSubVoltageParam(subVoltageParam); syncTerminalParam.setSubVoltageParam(subVoltageParam);
syncTerminalParam.setLineParam(lineParam); syncTerminalParam.setLineParam(lineParam);
if(isSync){
/***
* oracle http远程调用接口
*/
SyncLedger syncLedger = oracleSyncLedger(syncTerminalParam);
ResponseEntity<String> userEntity = RestTemplateUtil.post(url, syncLedger, String.class);
}
String substation = terminalBaseClient.terminalSync(syncTerminalParam).getData(); String substation = terminalBaseClient.terminalSync(syncTerminalParam).getData();
this.updateProcessStatus(id, 5); this.updateProcessStatus(id, 5);
tempDevice.setSubstation(substation); tempDevice.setSubstation(substation);
supervisionTempDeviceReportService.updateById(tempDevice); supervisionTempDeviceReportService.updateById(tempDevice);
@@ -438,8 +465,165 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
.in(SupervisionTempLineDebugPO::getId, supervisionId)); .in(SupervisionTempLineDebugPO::getId, supervisionId));
} }
private SyncLedger oracleSyncLedger(SyncTerminalParam param) {
SyncLedger ledger = new SyncLedger();
List<Line> data = lineFeignClient.getBaseLineList(Arrays.asList(param.getProjectIndex(),
param.getProvinceIndex(),
param.getGdIndex()
)).getData();
//项目信息表
PqProject pqProject=new PqProject();
List<Line> project = data.stream().filter(x -> x.getId().equals(param.getProjectIndex())).collect(Collectors.toList());
if(CollUtil.isNotEmpty(project)){
pqProject.setName(project.get(0).getName());
}else{
throw new BusinessException(SupervisionResponseEnum.PROJECT_OR_NOT);
}
ledger.setPqProject(pqProject);
//省级项目表
PqProvince pqProvince=new PqProvince();
List<Line> province = data.stream().filter(x -> x.getId().equals(param.getProvinceIndex())).collect(Collectors.toList());
if(CollUtil.isNotEmpty(province)){
Area area = areaFeignClient.selectIdArea(province.get(0).getName()).getData();
pqProvince.setName(area.getName());
}else {
throw new BusinessException(SupervisionResponseEnum.PROVINCE_OR_NOT);
}
ledger.setPqProvince(pqProvince);
//供电公司表
PqGdinformation pqGdinformation=new PqGdinformation();
List<Line> gd = data.stream().filter(x -> x.getId().equals(param.getGdIndex())).collect(Collectors.toList());
if(CollUtil.isNotEmpty(gd)){
pqGdinformation.setName(gd.get(0).getName());
}else{
throw new BusinessException(SupervisionResponseEnum.GD_OR_NOT);
}
ledger.setPqGdinformation(pqGdinformation);
//变电站
PqSubstation pqSubstation=new PqSubstation();
SubStationParam subStation = param.getSubStationParam();
if(ObjectUtil.isNull(subStation)){
PollutionSubstationDTO sub = lineFeignClient.getSubstationInfo(param.getSubIndex()).getData();
subStation =new SubStationParam();
subStation.setName(sub.getName());
subStation.setScale(sub.getVoltageLevel());
subStation.setLng(sub.getLng());
subStation.setLat(sub.getLat());
}
pqSubstation.setName(subStation.getName());
pqSubstation.setScale(subStation.getScale());
ledger.setPqSubstation(pqSubstation);
PqsMap pqsMap=new PqsMap();
pqsMap.setLongitude(subStation.getLng().doubleValue());
pqsMap.setLatitude(subStation.getLat().doubleValue());
pqsMap.setState(1);
ledger.setPqsMap(pqsMap);
//终端
PqDevice pqDevice=new PqDevice();
DeviceParam device = param.getDeviceParam();
pqDevice.setName(device.getName());
pqDevice.setStatus(1);
pqDevice.setDevtype(dictName(device.getDevType()));
pqDevice.setLogontime(device.getLoginTime());
pqDevice.setUpdatetime(device.getLoginTime());
Node node = nodeClient.getNodeById(device.getNodeId()).getData();
if(ObjectUtil.isNotNull(node)){
pqDevice.setNodeName(node.getName());
}
pqDevice.setPortid(device.getPort());
pqDevice.setDevflag(0);
pqDevice.setDevSeries(device.getSeries());
pqDevice.setDevKey(device.getDevKey());
pqDevice.setIp(device.getIp());
pqDevice.setDevmodel(device.getDevModel());
pqDevice.setCallflag(device.getCallFlag());
pqDevice.setDatatype(device.getDevDataType());
ledger.setPqDevice(pqDevice);
PqDevicedetail pqDevicedetail=new PqDevicedetail();
pqDevicedetail.setManufacturer(dictName(device.getManufacturer()));
pqDevicedetail.setThistimecheck(device.getThisTimeCheck());
pqDevicedetail.setNexttimecheck(device.getNextTimeCheck());
pqDevicedetail.setElectroplate(device.getElectroplate());
pqDevicedetail.setContract(device.getContract());
pqDevicedetail.setSim(device.getSim());
pqDevicedetail.setDevCatena(device.getDevSeries());
pqDevicedetail.setDevLocation(device.getDevLocation());
pqDevicedetail.setDevNo(device.getDevNo());
pqDevicedetail.setIsAlarm(device.getIsAlarm());
// pqDevicedetail.setOnlineratetj();
// pqDevicedetail.setDataplan();
// pqDevicedetail.setNewtraffic();
// pqDevicedetail.setOntime();
// pqDevicedetail.setCheckflag();
ledger.setPqDevicedetail(pqDevicedetail);
//母线
PqSubvoltage pqSubvoltage=new PqSubvoltage();
SubVoltageParam subVoltage = param.getSubVoltageParam();
pqSubvoltage.setName(subVoltage.getName());
pqSubvoltage.setSubvNum(subVoltage.getNum());
pqSubvoltage.setScale(dictName(subVoltage.getScale()));
pqSubvoltage.setSubvmodel(subVoltage.getModel());
ledger.setPqSubvoltage(pqSubvoltage);
//监测点
PqLine pqLine=new PqLine();
LineParam line = param.getLineParam();
pqLine.setName(line.getName());
pqLine.setPt1(line.getPt1().doubleValue());
pqLine.setPt2(line.getPt2().doubleValue());
pqLine.setCt1(line.getCt1().doubleValue());
pqLine.setCt2(line.getCt2().doubleValue());
pqLine.setDevcmp(line.getDevCapacity().doubleValue());
pqLine.setDlcmp(line.getShortCapacity().doubleValue());
pqLine.setJzcmp(line.getStandardCapacity().doubleValue());
pqLine.setXycmp(line.getDealCapacity().doubleValue());
pqLine.setScale(dictName(subVoltage.getScale()));
pqLine.setStatus(1);
ledger.setPqLine(pqLine);
PqLinedetail pqLinedetail=new PqLinedetail();
pqLinedetail.setLineName(line.getName());
pqLinedetail.setPttype(line.getPtType());
pqLinedetail.setLastTime(device.getLoginTime());
pqLinedetail.setTinterval(line.getTimeInterval());
pqLinedetail.setLoadtype(dictName(line.getLoadType()));
pqLinedetail.setBusinesstype(dictName(line.getBusinessType()));
pqLinedetail.setRemark(line.getRemark());
pqLinedetail.setMonitorId(line.getMonitorId());
pqLinedetail.setPowerid(line.getPowerFlag());
pqLinedetail.setObjname(line.getObjName());
pqLinedetail.setStatflag(line.getStatFlag());
pqLinedetail.setPowerSubstationName(line.getPowerSubstationName());
pqLinedetail.setHangLine(line.getHangLine());
pqLinedetail.setOwner(line.getOwner());
pqLinedetail.setOwnerDuty(line.getOwnerDuty());
pqLinedetail.setOwnerTel(line.getOwnerTel());
pqLinedetail.setSuperiorsSubstation(line.getSuperiorsSubstation());
pqLinedetail.setClassificationGrade(line.getCalssificationGrade());
pqLinedetail.setIsGridPoint(1);
// pqLinedetail.setLineGrade();
// pqLinedetail.setWiringDiagram();
ledger.setPqLinedetail(pqLinedetail);
ledger.setLineNum(line.getNum());
return ledger;
}
private String dictName(String dicId) {
try {
DictData data = dicDataFeignClient.getDicDataById(dicId).getData();
return data.getName();
} catch (Exception e) {
throw new BusinessException("字典转换异常");
}
}
private void assembleSyncTerminalParam(DeviceParam deviceParam, SupervisionTempDeviceReport tempDevice, SubVoltageParam subVoltageParam, LineParam lineParam, SupervisionTempLineReport tempLine) { private void assembleSyncTerminalParam(DeviceParam deviceParam, SupervisionTempDeviceReport tempDevice, SubVoltageParam subVoltageParam, LineParam lineParam, SupervisionTempLineReport tempLine) {
//包装device //包装device
deviceParam.setDevIndex(tempDevice.getId()); deviceParam.setDevIndex(tempDevice.getId());