1.河北临时台账处理代码,后期需要删除
This commit is contained in:
@@ -2,6 +2,7 @@ package com.njcn.device.biz.commApi;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.biz.commApi.fallback.CommLineClientFallbackFactory;
|
||||
import com.njcn.device.biz.commApi.fallback.CommTerminalGeneralClientFallbackFactory;
|
||||
import com.njcn.device.biz.pojo.dto.LineDTO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
@@ -21,7 +22,7 @@ import java.util.List;
|
||||
value = ServerInfo.DEVICE,
|
||||
path = "commLine",
|
||||
contextId = "commLine",
|
||||
fallbackFactory = CommTerminalGeneralClientFallbackFactory.class)
|
||||
fallbackFactory = CommLineClientFallbackFactory.class)
|
||||
public interface CommLineClient {
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
package com.njcn.device.pms.pojo.excel;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.handler.inter.IExcelModel;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
|
||||
import com.njcn.device.pq.pojo.bo.excel.OracleTerminalExcel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2024/2/1
|
||||
*/
|
||||
@Data
|
||||
@Deprecated
|
||||
public class PmsLedgerExcel implements Serializable, IExcelModel {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 监测点名称
|
||||
*/
|
||||
@Excel(name = "监测点名称", width = 30)
|
||||
@NotBlank(message = "监测点名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 组织机构名称
|
||||
*/
|
||||
@Excel(name = "组织机构名称", width = 30)
|
||||
@NotBlank(message = "组织机构名称不能为空")
|
||||
private String orgName;
|
||||
|
||||
|
||||
/**
|
||||
* 运维单位名称
|
||||
*/
|
||||
@Excel(name = "运维单位名称", width = 30)
|
||||
@NotBlank(message = "运维单位名称不能为空")
|
||||
private String operationName;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 变电站名称
|
||||
*/
|
||||
@Excel(name = "变电站名称", width = 30)
|
||||
@NotBlank(message = "变电站名称不能为空")
|
||||
private String powerrName;
|
||||
|
||||
|
||||
/**
|
||||
* 装置的ip
|
||||
*/
|
||||
@Excel(name = "装置IP", width = 30)
|
||||
@NotBlank(message = "装置的ip不能为空")
|
||||
private String devIp;
|
||||
|
||||
/**
|
||||
* 是否是上送国网监测点,0-否 1-是
|
||||
*/
|
||||
@Excel(name = "是否具备上送国网条件", width = 30,replace = {"是_1","否_0"})
|
||||
private Integer isUpToGrid;
|
||||
|
||||
/**
|
||||
* 中台母线ID
|
||||
*/
|
||||
@Excel(name = "母线/线路编号", width = 30)
|
||||
private String busId;
|
||||
|
||||
|
||||
/**
|
||||
* 监测母线名称
|
||||
*/
|
||||
@Excel(name = "母线/线路名称", width = 30)
|
||||
@NotBlank(message = "监测母线名称不能为空")
|
||||
private String lineName;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 电压等级(字典)
|
||||
*/
|
||||
@Excel(name = "电压等级", width = 30)
|
||||
@NotBlank(message = "电压等级不能为空")
|
||||
private String voltageLevel;
|
||||
|
||||
/**
|
||||
* 监测点状态(字典)
|
||||
*/
|
||||
@Excel(name = "监测点状态", width = 30)
|
||||
@NotBlank(message = "监测点状态不能为空")
|
||||
private String monitorState;
|
||||
|
||||
/**
|
||||
* 监测点类型(字典)
|
||||
*/
|
||||
@Excel(name = "监测点类型", width = 30)
|
||||
@NotBlank(message = "监测点类型不能为空")
|
||||
private String monitorType;
|
||||
|
||||
/**
|
||||
* 最小短路容量
|
||||
*/
|
||||
@Excel(name = "最小短路容量", width = 30)
|
||||
@NotNull(message = "最小短路容量不能为空")
|
||||
private Float minShortCircuitCapacity;
|
||||
|
||||
/**
|
||||
* 供电设备容量
|
||||
*/
|
||||
@Excel(name = "供电设备容量", width = 30)
|
||||
@NotNull(message = "供电设备容量不能为空")
|
||||
private Float powerSupplyEqCapacity;
|
||||
|
||||
|
||||
/**
|
||||
* 用户协议容量
|
||||
*/
|
||||
@Excel(name = "用户协议容量", width = 30)
|
||||
@NotNull(message = "用户协议容量不能为空")
|
||||
private Float userAgreementCapacity;
|
||||
|
||||
/**
|
||||
* 电压偏差限值(上)
|
||||
*/
|
||||
@Excel(name = "电压偏差限值(上)", width = 30)
|
||||
@NotNull(message = "电压偏差限值(上)不能为空")
|
||||
private Float voltageDeviationUpperLimit;
|
||||
|
||||
/**
|
||||
* 电压偏差限值(下)
|
||||
*/
|
||||
@Excel(name = "电压偏差限值(下)", width = 30)
|
||||
@NotNull(message = "电压偏差限值(下)不能为空")
|
||||
private Float voltageDeviationLowerLimit;
|
||||
|
||||
/**
|
||||
* 电压互感器类型(字典)
|
||||
*/
|
||||
@Excel(name = "电压互感器类型", width = 30)
|
||||
@NotBlank(message = "电压互感器类型不能为空")
|
||||
private String potentialTransFormerType;
|
||||
|
||||
/**
|
||||
* 中性点接地方式(字典)
|
||||
*/
|
||||
@Excel(name = "中性点接地方式", width = 30)
|
||||
@NotBlank(message = "中性点接地方式不能为空")
|
||||
private String neutralGroundingMode;
|
||||
|
||||
/**
|
||||
* 是否用户专线(字典)
|
||||
*/
|
||||
@Excel(name = "是否用户专线", width = 30,replace = {"是_1","否_0"})
|
||||
@NotNull(message = "是否用户专线不能为空")
|
||||
private Integer isSpecialSupplyElectricity;
|
||||
|
||||
/**
|
||||
* 监测点标签
|
||||
*/
|
||||
@Excel(name = "监测对象标签", width = 30)
|
||||
@NotBlank(message = "监测点标签不能为空")
|
||||
private String monitorTag;
|
||||
|
||||
|
||||
/**
|
||||
* 三级级监测对象类型
|
||||
*/
|
||||
@Excel(name = "对象类型", width = 30)
|
||||
@NotBlank(message = "监测对象类型不能为空")
|
||||
private String objType;
|
||||
|
||||
/**
|
||||
* 行业类型
|
||||
*/
|
||||
@Excel(name = "行业分类编码", width = 30)
|
||||
private String tradeCode;
|
||||
|
||||
|
||||
/**
|
||||
* 监测对象名称
|
||||
*/
|
||||
@Excel(name = "监测对象名称", width = 30)
|
||||
private String monitorObjectName;
|
||||
|
||||
|
||||
/**
|
||||
* 监测终端接线方式(字典)
|
||||
*/
|
||||
@Excel(name = "监测终端接线方式", width = 30)
|
||||
@NotBlank(message = "监测终端接线方式不能为空")
|
||||
private String terminalWiringMethod;
|
||||
|
||||
/**
|
||||
* 统计间隔
|
||||
*/
|
||||
@Excel(name = "统计间隔(min)", width = 30)
|
||||
@NotNull(message = "统计间隔不能为空")
|
||||
private Integer statisticalInterval;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 关联的监测终端同源编号(外键)
|
||||
*/
|
||||
@Excel(name = "关联的监测终端编号", width = 30)
|
||||
private String terminalCode;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 场站属性
|
||||
*/
|
||||
@Excel(name = "新能源场", width = 30)
|
||||
private String fieldStation;
|
||||
|
||||
|
||||
/**
|
||||
* 牵引站id
|
||||
*/
|
||||
@Excel(name = "关联牵引站编号", width = 30)
|
||||
private String tractionId;
|
||||
|
||||
@Excel(name = "错误信息", width = 30)
|
||||
private String errorMsg;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.njcn.device.pms.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
* 数据中心监测点与河北pms系统监测点关系实体(后期有数据需要删除)
|
||||
* @author cdf
|
||||
* @date 2024/1/30
|
||||
*/
|
||||
@Data
|
||||
@TableName("a_test_relation_monitor")
|
||||
@Deprecated
|
||||
public class ATestRelationMonitor {
|
||||
|
||||
|
||||
private String lineId;
|
||||
|
||||
private String lineVoltageLevel;
|
||||
|
||||
@TableId
|
||||
private String monitorId;
|
||||
|
||||
private String monitorVoltageLevel;
|
||||
|
||||
}
|
||||
@@ -2,7 +2,9 @@ package com.njcn.device.pms.controller.ledgerManger;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
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;
|
||||
@@ -10,14 +12,13 @@ import com.njcn.device.pms.mapper.majornetwork.StatationStatMapper;
|
||||
import com.njcn.device.pms.pojo.po.*;
|
||||
import com.njcn.device.pms.service.majornetwork.*;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.user.pojo.vo.DeptTreeVO;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
@@ -153,5 +154,22 @@ public class PmsLedgerDeptController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取部门树(存在监测点的)
|
||||
* @author cdf
|
||||
* @date 2024/2/26
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/existMonitorDeptTree")
|
||||
@ApiOperation("获取部门树(存在监测点的)")
|
||||
public HttpResult<List<String>> existMonitorDeptTree() {
|
||||
String methodDescribe = getMethodDescribe("existMonitorDeptTree");
|
||||
List<String> result = iMonitorService.existMonitorDeptTree();
|
||||
//删除返回失败,查不到数据返回空数组,兼容治理项目没有部门直接报错的bug
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -291,8 +291,28 @@ public class PmsMonitorController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 附件批量修改台账信息(地市核验过的台账信息excel通过此接口导入表中,后续3.0完善后需要删除)
|
||||
* @author cdf
|
||||
* @date 2024/2/26
|
||||
*/
|
||||
@PostMapping("/importUpdateLedger")
|
||||
@ApiOperation("附件批量修改台账信息")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPLOAD)
|
||||
public HttpResult<Object> importUpdateLedger(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importUpdateLedger");
|
||||
String result = monitorService.importUpdateLedger(file,response);
|
||||
|
||||
if (Objects.isNull(result)) {
|
||||
return null;
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
try {
|
||||
/*try {
|
||||
// 创建一个临时文件,前缀为"temp_",后缀为".txt",存储在默认的临时文件夹中
|
||||
File tempFile = File.createTempFile("temp_", ".txt");
|
||||
|
||||
@@ -303,7 +323,7 @@ public class PmsMonitorController extends BaseController {
|
||||
tempFile.deleteOnExit();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.device.pms.mapper.majornetwork;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.pms.pojo.po.ATestRelationMonitor;
|
||||
import com.njcn.device.pq.pojo.po.LineBak;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
* 数据中心监测点与河北pms系统监测点关系实体(后期有数据需要删除)
|
||||
* @author cdf
|
||||
* @since 2022-01-04
|
||||
*/
|
||||
@Deprecated
|
||||
public interface ATestRelationMonitorMapper extends BaseMapper<ATestRelationMonitor> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -156,6 +156,9 @@ public interface IMonitorService extends IService<Monitor> {
|
||||
String importOracleLedgerToMysql(MultipartFile file, HttpServletResponse response);
|
||||
|
||||
|
||||
String importUpdateLedger(MultipartFile file, HttpServletResponse response);
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 获取所有监测点限值
|
||||
* @param
|
||||
@@ -185,4 +188,12 @@ public interface IMonitorService extends IService<Monitor> {
|
||||
* 批量根据监测点id获取监测点信息
|
||||
*/
|
||||
List<LineDTO> getLineDetailBatch(List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 获取部门树(存在监测点的)
|
||||
* @author cdf
|
||||
* @date 2024/2/26
|
||||
*/
|
||||
List<String> existMonitorDeptTree();
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.njcn.device.pms.mapper.majornetwork.*;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
|
||||
import com.njcn.device.pms.pojo.excel.PmsLedgerExcel;
|
||||
import com.njcn.device.pms.pojo.param.*;
|
||||
import com.njcn.device.pms.pojo.po.*;
|
||||
import com.njcn.device.pms.pojo.vo.MonitorVO;
|
||||
@@ -52,6 +53,7 @@ import com.njcn.system.enums.SystemResponseEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.user.pojo.vo.DeptTreeVO;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -487,6 +489,30 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String importUpdateLedger(MultipartFile file, HttpServletResponse response) {
|
||||
ImportParams importParams = new ImportParams();
|
||||
importParams.setHeadRows(1);
|
||||
importParams.setTitleRows(1);
|
||||
importParams.setNeedVerify(true);
|
||||
|
||||
try {
|
||||
ExcelImportResult<PmsLedgerExcel> terminalExcelExcelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), PmsLedgerExcel.class, importParams);
|
||||
|
||||
//如果存在非法数据,将不合格的数据导出
|
||||
if (terminalExcelExcelImportResult.isVerifyFail()) {
|
||||
PoiUtil.exportFileByWorkbook(terminalExcelExcelImportResult.getFailWorkbook(), "非法台账信息.xlsx", response);
|
||||
return null;
|
||||
} else {
|
||||
//执行台账信息导入(不考虑,存在监测点却不存在限值信息)
|
||||
return dealDataBatchUpdate(terminalExcelExcelImportResult.getList());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new BusinessException(DeviceResponseEnum.IMPORT_ORACLE_EXCEPTION);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Overlimit> getAllLineOverLimit() {
|
||||
return overlimitMapper.selectList(null);
|
||||
@@ -546,6 +572,206 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
return lineDTOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> existMonitorDeptTree() {
|
||||
DictData dictData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.LINE_STATE.getName(), DicDataEnum.RUN.getName()).getData();
|
||||
List<Dept> deptList = deptFeignClient.getAllDept().getData();
|
||||
List<String> monitorList = this.lambdaQuery().select(Monitor::getOrgId).eq(Monitor::getMonitorState,dictData.getId()).list().stream().map(Monitor::getOrgId).distinct().collect(Collectors.toList());
|
||||
List<Dept> deptTem = deptList.stream().filter(it->monitorList.contains(it.getCode())).collect(Collectors.toList());
|
||||
|
||||
|
||||
return deptTem.stream().map(Dept::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
private String dealDataBatchUpdate(List<PmsLedgerExcel> pmsLedgerExcelList) {
|
||||
List<PmsLedgerExcel> oracleTerminalExcelMsg = new ArrayList<>();
|
||||
|
||||
List<DeptDTO> allDept = deptFeignClient.getDeptDescendantIndexes(deptFeignClient.getRootDept().getData().getId(), Stream.of(0, 1, 2).collect(Collectors.toList())).getData();
|
||||
Map<String, DeptDTO> mapDept = allDept.stream().collect(Collectors.toMap(DeptDTO::getName, Function.identity()));
|
||||
|
||||
List<DictData> voltageLevelDic = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||
Map<String, DictData> voltageLevelMap = voltageLevelDic.stream().collect(Collectors.toMap(DictData::getName, Function.identity()));
|
||||
|
||||
//装置型号
|
||||
List<DictData> devTypelDic = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_TYPE.getCode()).getData();
|
||||
Map<String, DictData> devTypelDicMap = devTypelDic.stream().collect(Collectors.toMap(DictData::getName, Function.identity()));
|
||||
|
||||
//装置类别
|
||||
DictData devCategoryDic = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.DEV_CATEGORY.getName(), DicDataEnum.Monitor_Terminals.getName()).getData();
|
||||
|
||||
//装置状态
|
||||
List<DictData> devStatelDic = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_STATUS.getCode()).getData();
|
||||
Map<String, DictData> devStateDicMap = devStatelDic.stream().collect(Collectors.toMap(DictData::getName, Function.identity()));
|
||||
|
||||
//监测点状态
|
||||
List<DictData> monitorStatelDic = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_STATE.getCode()).getData();
|
||||
Map<String, DictData> monitorStateDicMap = monitorStatelDic.stream().collect(Collectors.toMap(DictData::getName, Function.identity()));
|
||||
|
||||
//检测点对象类型(原监测点标签)
|
||||
List<DictData> objTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.MONITORING_LABELS.getCode()).getData();
|
||||
Map<String, DictData> objTypeDicMap = objTypeList.stream().collect(Collectors.toMap(DictData::getName, Function.identity()));
|
||||
|
||||
//装置厂家
|
||||
List<DictData> manList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_MANUFACTURER.getCode()).getData();
|
||||
Map<String, DictData> manDicMap = manList.stream().collect(Collectors.toMap(DictData::getName, Function.identity()));
|
||||
|
||||
//装作等级
|
||||
DictData devGrade = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.DEV_GRADE.getName(), DicDataEnum.MOST_IMPORMENT.getName()).getData();
|
||||
|
||||
//
|
||||
DictData devInputType = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.INPUT_SIGNAL.getName(), DicDataEnum.SIMULATION_SIGNAL.getName()).getData();
|
||||
|
||||
//监测点类型
|
||||
DictData monitorType = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.LINE_TYPE.getName(), DicDataEnum.Power_Supply_Point.getName()).getData();
|
||||
|
||||
//接线方式
|
||||
List<DictData> wireList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_CONNECT.getCode()).getData();
|
||||
Map<String, DictData> wireListMap = wireList.stream().collect(Collectors.toMap(DictData::getName, Function.identity()));
|
||||
|
||||
//电压互感器类型
|
||||
List<DictData> potentialDic = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.VOLTAGE_TRANSFORMER.getCode()).getData();
|
||||
Map<String, DictData> potentialDicMap = potentialDic.stream().collect(Collectors.toMap(DictData::getName, Function.identity()));
|
||||
|
||||
//中性点接地方式
|
||||
List<DictData> neutralDic = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.Neutral_Point.getCode()).getData();
|
||||
Map<String, DictData> neutralDicMap = neutralDic.stream().collect(Collectors.toMap(DictData::getName, Function.identity()));
|
||||
|
||||
|
||||
//行业分类
|
||||
List<DictData> businessType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.INDUSTRY_TYPE.getCode()).getData();
|
||||
Map<String, DictData> businessDicMap = businessType.stream().collect(Collectors.toMap(DictData::getName, Function.identity()));
|
||||
|
||||
|
||||
//TODO 零时处理
|
||||
List<SysDicTreePO> dicTree = dictTreeFeignClient.queryAll().getData();
|
||||
dicTree = dicTree.stream().filter(item->item.getCode()!="Device_Unit" && !item.getCode().contains("@")).collect(Collectors.toList());
|
||||
Map<String,SysDicTreePO> objTypeMap = dicTree.stream().collect(Collectors.toMap(SysDicTreePO::getName,Function.identity()));
|
||||
|
||||
int count = 0;
|
||||
for (PmsLedgerExcel pmsLedgerExcel : pmsLedgerExcelList) {
|
||||
|
||||
|
||||
LambdaQueryWrapper<Monitor> monitorLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
monitorLambdaQueryWrapper.eq(Monitor::getName,pmsLedgerExcel.getName()).eq(Monitor::getPowerrName,pmsLedgerExcel.getPowerrName());
|
||||
|
||||
Monitor monitor = this.getOne(monitorLambdaQueryWrapper);
|
||||
if(Objects.nonNull(monitor)){
|
||||
|
||||
Monitor po = new Monitor();
|
||||
po.setId(monitor.getId());
|
||||
po.setMinShortCircuitCapacity(pmsLedgerExcel.getMinShortCircuitCapacity());
|
||||
po.setPowerSupplyEqCapacity(pmsLedgerExcel.getPowerSupplyEqCapacity());
|
||||
po.setUserAgreementCapacity(pmsLedgerExcel.getUserAgreementCapacity());
|
||||
|
||||
|
||||
String monitorStateId= monitorStateDicMap.get(pmsLedgerExcel.getMonitorState()).getId();
|
||||
if(StrUtil.isBlank(monitorStateId)){
|
||||
throw new BusinessException("监测点状态为空");
|
||||
}
|
||||
po.setMonitorState(monitorStateId);
|
||||
|
||||
String getPotentialTransFormerTypeId= potentialDicMap.get(pmsLedgerExcel.getPotentialTransFormerType()).getId();
|
||||
|
||||
if(StrUtil.isBlank(getPotentialTransFormerTypeId)){
|
||||
throw new BusinessException("电压互感器类型缺失");
|
||||
}
|
||||
po.setPotentialTransFormerType(getPotentialTransFormerTypeId);
|
||||
|
||||
|
||||
String neutralDicMapId= neutralDicMap.get(pmsLedgerExcel.getNeutralGroundingMode()).getId();
|
||||
|
||||
if(StrUtil.isBlank(neutralDicMapId)){
|
||||
throw new BusinessException("中性点接地方式缺失");
|
||||
}
|
||||
po.setPotentialTransFormerType(getPotentialTransFormerTypeId);
|
||||
po.setIsSpecialSupplyElectricity(pmsLedgerExcel.getIsSpecialSupplyElectricity());
|
||||
|
||||
String getMonitorTagId = objTypeDicMap.get(pmsLedgerExcel.getMonitorTag()).getId();
|
||||
if(StrUtil.isBlank(getMonitorTagId)){
|
||||
throw new BusinessException("监测点标签缺失");
|
||||
}
|
||||
po.setMonitorTag(getMonitorTagId);
|
||||
|
||||
|
||||
String getObjTypeId = objTypeMap.get(pmsLedgerExcel.getObjType()).getId();
|
||||
if(StrUtil.isBlank(getObjTypeId)){
|
||||
throw new BusinessException("对象类型缺少");
|
||||
}
|
||||
po.setObjType(getObjTypeId);
|
||||
|
||||
|
||||
//行业分类
|
||||
if(businessDicMap.containsKey(pmsLedgerExcel.getTradeCode())){
|
||||
String getTradeCodeId = businessDicMap.get(pmsLedgerExcel.getTradeCode()).getId();
|
||||
po.setTradeCode(getTradeCodeId);
|
||||
}else {
|
||||
po.setTradeCode("");
|
||||
}
|
||||
|
||||
|
||||
//监测对象名称
|
||||
po.setMonitorObjectName(pmsLedgerExcel.getMonitorObjectName());
|
||||
|
||||
|
||||
|
||||
|
||||
//装置
|
||||
/* PmsTerminal pmsTerminal = terminalMapper.selectOne(new LambdaQueryWrapper<PmsTerminal>().eq(PmsTerminal::getId,monitor.getTerminalId()));
|
||||
|
||||
if(Objects.nonNull(pmsTerminal)){
|
||||
PmsTerminal t = new PmsTerminal();
|
||||
t.setId(pmsTerminal.getId());
|
||||
t.setTerminalCode(pmsLedgerExcel.getTerminalCode());
|
||||
t.setIp(pmsLedgerExcel.getDevIp());
|
||||
terminalMapper.updateById(t);
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
po.setTerminalCode(pmsLedgerExcel.getTerminalCode());
|
||||
|
||||
|
||||
if(StrUtil.isNotBlank(po.getTerminalCode())){
|
||||
po.setIsUpToGrid(1);
|
||||
}
|
||||
|
||||
|
||||
if(StrUtil.isBlank(pmsLedgerExcel.getBusId())){
|
||||
po.setIsUpToGrid(0);
|
||||
}
|
||||
|
||||
|
||||
this.updateById(po);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
count++;
|
||||
}else {
|
||||
|
||||
System.out.println("4444444444444444");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(oracleTerminalExcelMsg)) {
|
||||
ExcelUtil.exportExcel("失败列表.xlsx", OracleTerminalExcel.OracleTerminalExcelMsg.class, oracleTerminalExcelMsg);
|
||||
return null;
|
||||
}
|
||||
return CommonResponseEnum.SUCCESS.getMessage();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取主配网监测点id集合
|
||||
|
||||
Reference in New Issue
Block a user