中台母线获取接口信息调整
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.njcn.syncdata.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.syncdata.pojo.po.SysDeptTeam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2024-05-11
|
||||
*/
|
||||
public interface SysDeptTeamMapper extends BaseMapper<SysDeptTeam> {
|
||||
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
sys_dict_type sys_dict_type
|
||||
WHERE sys_dict_data.type_id = sys_dict_type.id
|
||||
AND sys_dict_type.code = #{code}
|
||||
|
||||
AND sys_dict_data.state = 1
|
||||
order by sort
|
||||
</select>
|
||||
<select id="selectUserList" resultType="com.njcn.syncdata.pojo.po.Dept">
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.device.mapper.SysDeptTeamMapper">
|
||||
|
||||
</mapper>
|
||||
24
src/main/java/com/njcn/syncdata/pojo/po/BusbarAsset.java
Normal file
24
src/main/java/com/njcn/syncdata/pojo/po/BusbarAsset.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.njcn.syncdata.pojo.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description 变电站内母线资产
|
||||
* @date 2023/11/10 14:44
|
||||
*/
|
||||
@Data
|
||||
public class BusbarAsset {
|
||||
/**
|
||||
* 外部系统ID
|
||||
*/
|
||||
private String ACCOUNT_ID;
|
||||
|
||||
/**
|
||||
* 资产编码
|
||||
*/
|
||||
private String ASSET_NO;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package com.njcn.syncdata.pojo.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description 母线台账获取
|
||||
@@ -20,9 +22,25 @@ public class BusbarPSR {
|
||||
private String NAME;
|
||||
|
||||
/**
|
||||
* 运行单位
|
||||
* 所属地市
|
||||
*/
|
||||
private String district;
|
||||
|
||||
/**
|
||||
* 所属县局
|
||||
*/
|
||||
private String depart;
|
||||
|
||||
/**
|
||||
* 运行单位
|
||||
*/
|
||||
private String section;
|
||||
|
||||
/**
|
||||
* 维护班组
|
||||
*/
|
||||
private String maintenance_team;
|
||||
|
||||
/**
|
||||
* 根设备
|
||||
*/
|
||||
@@ -37,4 +55,13 @@ public class BusbarPSR {
|
||||
*/
|
||||
private String VOLTAGELEVEL_ID;
|
||||
|
||||
/**
|
||||
* 运行时间
|
||||
*/
|
||||
private LocalDateTime RUN_DATE;
|
||||
|
||||
/**
|
||||
* 外部系统ID
|
||||
*/
|
||||
private String ACCOUNT_ID;
|
||||
}
|
||||
|
||||
@@ -43,17 +43,54 @@ public class PmsMidLedger {
|
||||
private String pids;
|
||||
|
||||
/**
|
||||
* 运行单位
|
||||
* 所属地市id
|
||||
*/
|
||||
@TableField("cityOrg")
|
||||
private String cityOrg;
|
||||
|
||||
/**
|
||||
* 所属地市名称
|
||||
*/
|
||||
@TableField("cityOrgName")
|
||||
private String cityOrgName;
|
||||
|
||||
/**
|
||||
* 所属县局id
|
||||
*/
|
||||
@TableField("SectionId")
|
||||
private String SectionId;
|
||||
|
||||
/**
|
||||
* 运行单位
|
||||
* 所属县局名称
|
||||
*/
|
||||
@TableField("Section")
|
||||
private String section;
|
||||
|
||||
/**
|
||||
* 运维班组
|
||||
*/
|
||||
@TableField("maintCrew")
|
||||
private String maintCrew;
|
||||
|
||||
/**
|
||||
* 运维班组名称
|
||||
*/
|
||||
@TableField("maintCrewName")
|
||||
private String maintCrewName;
|
||||
|
||||
|
||||
/**
|
||||
* 运维单位ID(外键)
|
||||
*/
|
||||
@TableField(value = "Operation_Id")
|
||||
private String operationId;
|
||||
|
||||
/**
|
||||
* 运维单位名称
|
||||
*/
|
||||
@TableField(value = "Operation_Name")
|
||||
private String operationName;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@@ -95,6 +132,20 @@ public class PmsMidLedger {
|
||||
*/
|
||||
@TableField("voltage_Level")
|
||||
private String voltageLevel;
|
||||
|
||||
/**
|
||||
* 投运时间
|
||||
*/
|
||||
@TableField("Operation_Date")
|
||||
private LocalDateTime operationDate;
|
||||
|
||||
|
||||
/**
|
||||
* 资产编号
|
||||
*/
|
||||
@TableField("Asset_No")
|
||||
private String Asset_No;
|
||||
|
||||
/**
|
||||
* 创建用户
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.njcn.syncdata.pojo.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description 变电站获取
|
||||
@@ -20,10 +22,26 @@ public class Substation {
|
||||
*/
|
||||
private String NAME;
|
||||
|
||||
|
||||
/**
|
||||
* 所属地市
|
||||
*/
|
||||
private String district;
|
||||
|
||||
/**
|
||||
* 所属县局
|
||||
*/
|
||||
private String depart;
|
||||
|
||||
/**
|
||||
* 运行单位
|
||||
*/
|
||||
private String depart;
|
||||
private String section;
|
||||
|
||||
/**
|
||||
* 维护班组
|
||||
*/
|
||||
private String maintenance_team;
|
||||
/**
|
||||
* 运行状态
|
||||
*/
|
||||
@@ -32,4 +50,9 @@ public class Substation {
|
||||
* 电压等级
|
||||
*/
|
||||
private String VOLTAGELEVEL_ID;
|
||||
|
||||
/**
|
||||
* 投运日期
|
||||
*/
|
||||
private LocalDateTime RUN_DATE;
|
||||
}
|
||||
|
||||
49
src/main/java/com/njcn/syncdata/pojo/po/SysDeptTeam.java
Normal file
49
src/main/java/com/njcn/syncdata/pojo/po/SysDeptTeam.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package com.njcn.syncdata.pojo.po;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
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 java.io.Serializable;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2024-05-11
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("sys_dept_team")
|
||||
public class SysDeptTeam {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 部门表Id
|
||||
*/
|
||||
@TableId("Id")
|
||||
@ExcelProperty("ISC_ID")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 父节点Id
|
||||
*/
|
||||
@TableField("Pid")
|
||||
@ExcelProperty("上级部门ID")
|
||||
private String pid;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
@TableField("Name")
|
||||
@ExcelProperty("部门名称")
|
||||
private String name;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.syncdata.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.syncdata.pojo.po.SysDeptTeam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2024-05-11
|
||||
*/
|
||||
public interface ISysDeptTeamService extends IService<SysDeptTeam> {
|
||||
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import com.njcn.syncdata.pojo.enums.DicDataTypeEnum;
|
||||
import com.njcn.syncdata.pojo.po.*;
|
||||
import com.njcn.syncdata.service.IPmsMidLedgerService;
|
||||
import com.njcn.syncdata.service.IPowerDistributionareaService;
|
||||
import com.njcn.syncdata.service.ISysDeptTeamService;
|
||||
import com.njcn.syncdata.utils.RestTemplateUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -23,6 +24,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -41,6 +43,7 @@ public class PmsMidLedgerServiceImpl extends ReplenishMybatisServiceImpl<PmsMidL
|
||||
|
||||
private final IPowerDistributionareaService powerService;
|
||||
private final DictDataMapper dictDataMapper;
|
||||
private final ISysDeptTeamService sysDeptTeamService;
|
||||
|
||||
@Override
|
||||
public Boolean insertMidLedger() {
|
||||
@@ -51,7 +54,9 @@ public class PmsMidLedgerServiceImpl extends ReplenishMybatisServiceImpl<PmsMidL
|
||||
List<DictData> state = dictDataMapper.selectList(DicDataTypeEnum.LINE_STATE.getCode());
|
||||
//2.1.1获取电压字典
|
||||
List<DictData> devVoltage = dictDataMapper.selectList(DicDataTypeEnum.DEV_VOLTAGE.getCode());
|
||||
|
||||
//部门信息
|
||||
List<SysDeptTeam> teamList = sysDeptTeamService.list();
|
||||
Map<String, String> teamMap = teamList.stream().collect(Collectors.toMap(SysDeptTeam::getId, SysDeptTeam::getName));
|
||||
Integer numPum = 1;
|
||||
//定义每页返回数据条数
|
||||
Integer size = 20000;
|
||||
@@ -73,14 +78,23 @@ public class PmsMidLedgerServiceImpl extends ReplenishMybatisServiceImpl<PmsMidL
|
||||
mid.setId(sub.getID());
|
||||
mid.setPid("0");
|
||||
mid.setPids("0");
|
||||
|
||||
mid.setCityOrg(sub.getDistrict());
|
||||
mid.setCityOrgName(getDeptName(sub.getDistrict(), depts,teamMap));
|
||||
mid.setSectionId(sub.getDepart());
|
||||
mid.setSection(getDeptName(sub.getDepart(), depts));
|
||||
mid.setSection(getDeptName(sub.getDepart(), depts,teamMap));
|
||||
mid.setMaintCrew(sub.getMaintenance_team());
|
||||
mid.setMaintCrewName(getDeptName(sub.getMaintenance_team(), depts,teamMap));
|
||||
mid.setOperationId(sub.getSection());
|
||||
mid.setOperationName(getDeptName(sub.getSection(), depts,teamMap));
|
||||
|
||||
mid.setName(sub.getNAME());
|
||||
mid.setLevel(0);
|
||||
mid.setSort(0);
|
||||
mid.setState(1);
|
||||
mid.setVoltageLevel(getAlgoDescribe(sub.getVOLTAGELEVEL_ID(), devVoltage));
|
||||
mid.setRunStatus(getValue(sub.getRUN_STATUS(),state));
|
||||
mid.setOperationDate(sub.getRUN_DATE());
|
||||
mid.setCreateTime(LocalDateTime.now());
|
||||
mid.setUpdateTime(LocalDateTime.now());
|
||||
info.add(mid);
|
||||
@@ -92,7 +106,7 @@ public class PmsMidLedgerServiceImpl extends ReplenishMybatisServiceImpl<PmsMidL
|
||||
|
||||
log.info(Thread.currentThread().getName() + "变电站数量返回体 getResourceData:" + subID.size() + "结束----!");
|
||||
log.info(Thread.currentThread().getName() + "变电站数量ids返回体 getResourceData:" + subID + "结束----!");
|
||||
|
||||
//母线信息
|
||||
List<List<String>> subIdList = ListUtil.split(subID, 1000);
|
||||
List<BusbarPSR> bars=new ArrayList<>();
|
||||
for (List<String> list : subIdList) {
|
||||
@@ -104,7 +118,20 @@ public class PmsMidLedgerServiceImpl extends ReplenishMybatisServiceImpl<PmsMidL
|
||||
List<BusbarPSR> result = JSONArray.parseArray(JSONArray.toJSONString(busbarPSR.get("result")), BusbarPSR.class);
|
||||
bars.addAll(result);
|
||||
}
|
||||
|
||||
//母线资产信息
|
||||
List<String> assetList = bars.stream().map(BusbarPSR::getACCOUNT_ID).distinct().collect(Collectors.toList());
|
||||
List<List<String>> assetIdList = ListUtil.split(assetList, 1000);
|
||||
List<BusbarAsset> assets=new ArrayList<>();
|
||||
for (List<String> list : assetIdList) {
|
||||
map=new HashMap<>();
|
||||
map.put("fieldName", "account_id");
|
||||
map.put("compare", "in");
|
||||
map.put("fieldValue", String.join(",", list));
|
||||
Map busbarPSR = this.getResourceData("BusbarAsset", 1, size, map);
|
||||
List<BusbarAsset> result = JSONArray.parseArray(JSONArray.toJSONString(busbarPSR.get("result")), BusbarAsset.class);
|
||||
assets.addAll(result);
|
||||
}
|
||||
Map<String, BusbarAsset> assetMap = assets.stream().collect(Collectors.toMap(BusbarAsset::getACCOUNT_ID, Function.identity()));
|
||||
for (BusbarPSR bar : bars) {
|
||||
if(subMap.containsKey(bar.getRoot_id())){
|
||||
String pidSub = subMap.get(bar.getRoot_id());
|
||||
@@ -112,14 +139,28 @@ public class PmsMidLedgerServiceImpl extends ReplenishMybatisServiceImpl<PmsMidL
|
||||
mid.setId(bar.getID());
|
||||
mid.setPid(pidSub);
|
||||
mid.setPids("0,"+pidSub);
|
||||
|
||||
mid.setCityOrg(bar.getDistrict());
|
||||
mid.setCityOrgName(getDeptName(bar.getDistrict(), depts,teamMap));
|
||||
mid.setSectionId(bar.getDepart());
|
||||
mid.setSection(getDeptName(bar.getDepart(), depts));
|
||||
mid.setSection(getDeptName(bar.getDepart(), depts,teamMap));
|
||||
mid.setMaintCrew(bar.getMaintenance_team());
|
||||
mid.setMaintCrewName(getDeptName(bar.getMaintenance_team(), depts,teamMap));
|
||||
mid.setOperationId(bar.getSection());
|
||||
mid.setOperationName(getDeptName(bar.getSection(), depts,teamMap));
|
||||
|
||||
|
||||
mid.setName(bar.getNAME());
|
||||
mid.setLevel(1);
|
||||
mid.setSort(0);
|
||||
mid.setState(1);
|
||||
mid.setRunStatus(getValue(bar.getRUN_STATUS(),state));
|
||||
mid.setVoltageLevel(getAlgoDescribe(bar.getVOLTAGELEVEL_ID(),devVoltage));
|
||||
mid.setOperationDate(bar.getRUN_DATE());
|
||||
if(assetMap.containsKey(bar.getACCOUNT_ID())){
|
||||
BusbarAsset assetNo = assetMap.get(bar.getACCOUNT_ID());
|
||||
mid.setAsset_No(assetNo.getASSET_NO());
|
||||
}
|
||||
mid.setCreateTime(LocalDateTime.now());
|
||||
mid.setUpdateTime(LocalDateTime.now());
|
||||
info.add(mid);
|
||||
@@ -177,10 +218,14 @@ public class PmsMidLedgerServiceImpl extends ReplenishMybatisServiceImpl<PmsMidL
|
||||
return body;
|
||||
}
|
||||
|
||||
public String getDeptName(String name, List<Dept> depts) {
|
||||
public String getDeptName(String name, List<Dept> depts,Map<String, String> teamMap) {
|
||||
Map<String, String> deptMap = depts.stream().collect(Collectors.toMap(Dept::getCode, Dept::getName, (key1, key2) -> key1));
|
||||
if (deptMap.containsKey(name)) {
|
||||
return deptMap.get(name);
|
||||
}else{
|
||||
if(teamMap.containsKey(name)){
|
||||
return teamMap.get(name);
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
@@ -190,6 +235,13 @@ public class PmsMidLedgerServiceImpl extends ReplenishMybatisServiceImpl<PmsMidL
|
||||
Map<String, String> voltageMap = voltageLevel.stream().filter(x -> x.getValue() != null).collect(Collectors.toMap(DictData::getValue, DictData::getId, (key1, key2) -> key1));
|
||||
if (voltageMap.containsKey(name)) {
|
||||
return voltageMap.get(name);
|
||||
}else{
|
||||
if("20".equals(name)){
|
||||
return voltageMap.get("01");
|
||||
}
|
||||
if("30".equals(name)){
|
||||
return voltageMap.get("05");
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.syncdata.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.syncdata.mapper.SysDeptTeamMapper;
|
||||
import com.njcn.syncdata.pojo.po.SysDeptTeam;
|
||||
import com.njcn.syncdata.service.ISysDeptTeamService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2024-05-11
|
||||
*/
|
||||
@Service
|
||||
public class SysDeptTeamServiceImpl extends ServiceImpl<SysDeptTeamMapper, SysDeptTeam> implements ISysDeptTeamService {
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
|
||||
<!--日志输出格式-->
|
||||
<property name="log.homeDir" value="D:\logs"/>
|
||||
<property name="log.homeDir" value="E:\logs"/>
|
||||
<property name="log.pattern"
|
||||
value="|-%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%level} ${log.projectName} -- %t %logger{100}.%M ==> %m%n${Log_EXCEPTION_CONVERSION_WORD:-%ec}}}"/>
|
||||
<property name="log.maxHistory" value="30"/>
|
||||
|
||||
Reference in New Issue
Block a user