代码调整
This commit is contained in:
@@ -7,7 +7,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.device.pms.service.DeptLineService;
|
||||
import com.njcn.device.pms.service.ledgerManger.DeptLineService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.DeptLineParam;
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
@@ -20,17 +20,17 @@ import com.njcn.device.pms.service.majornetwork.IMonitorService;
|
||||
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -283,6 +283,22 @@ public class PmsMonitorController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* oracle系统监测点转mysql主网监测点
|
||||
* @author cdf
|
||||
* @date 2023/6/8
|
||||
*/
|
||||
@PostMapping("/importOracleLedgerToMysql")
|
||||
@ApiOperation("获取台账和终端信息(波形专用)")
|
||||
@ApiImplicitParam(name = "param", value = "主网监测点实体", required = true)
|
||||
public void importOracleLedgerToMysql(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importOracleLedgerToMysql");
|
||||
monitorService.importOracleLedgerToMysql(file,response);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.device.pms.service;
|
||||
package com.njcn.device.pms.service.ledgerManger;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.njcn.device.pms.service.ledgerManger.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
||||
@@ -15,7 +14,7 @@ import com.njcn.device.biz.utils.COverlimitUtil;
|
||||
import com.njcn.device.pms.mapper.majornetwork.*;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO;
|
||||
import com.njcn.device.pms.pojo.po.*;
|
||||
import com.njcn.device.pms.service.DeptLineService;
|
||||
import com.njcn.device.pms.service.ledgerManger.DeptLineService;
|
||||
import com.njcn.device.pms.service.ledgerManger.CommTerminalService;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.njcn.device.pms.service.impl;
|
||||
package com.njcn.device.pms.service.ledgerManger.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.pms.mapper.DeptLineMapper;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.device.pms.service.DeptLineService;
|
||||
import com.njcn.device.pms.service.ledgerManger.DeptLineService;
|
||||
import com.njcn.web.pojo.param.DeptLineParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -13,8 +13,10 @@ import com.njcn.device.pms.pojo.po.Monitor;
|
||||
import com.njcn.device.pms.pojo.vo.MonitorVO;
|
||||
import com.njcn.device.pms.pojo.vo.PmsMonitorVO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -144,5 +146,12 @@ public interface IMonitorService extends IService<Monitor> {
|
||||
List<DeptGetChildrenDTO> deptMonitor(DeptGetLineParam param);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/6/8
|
||||
*/
|
||||
void importOracleLedgerToMysql(MultipartFile file, HttpServletResponse response);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.njcn.device.pms.service.majornetwork.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -10,6 +13,7 @@ import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.biz.utils.COverlimit;
|
||||
@@ -25,9 +29,12 @@ import com.njcn.device.pms.pojo.vo.MonitorVO;
|
||||
import com.njcn.device.pms.pojo.vo.PmsMonitorVO;
|
||||
import com.njcn.device.pms.service.majornetwork.IDistributionMonitorService;
|
||||
import com.njcn.device.pms.service.majornetwork.IMonitorService;
|
||||
import com.njcn.device.pq.pojo.bo.excel.NodeExcel;
|
||||
import com.njcn.device.pq.pojo.bo.excel.OverLimitExcel;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.po.Voltage;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
@@ -44,7 +51,9 @@ import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -369,6 +378,41 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
return deviceInfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importOracleLedgerToMysql(MultipartFile file, HttpServletResponse response) {
|
||||
/* ImportParams importParams = new ImportParams();
|
||||
importParams.setHeadRows(1);
|
||||
importParams.setTitleRows(1);
|
||||
importParams.setNeedVerify(true);
|
||||
|
||||
try {
|
||||
ExcelImportResult<OracleTerminalExcel> terminalExcelExcelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), OracleTerminalExcel.class, importParams);
|
||||
|
||||
//如果存在非法数据,将不合格的数据导出
|
||||
if (terminalExcelExcelImportResult.isVerifyFail()) {
|
||||
PoiUtil.exportFileByWorkbook(terminalExcelExcelImportResult.getFailWorkbook(), "非法台账信息.xlsx", response);
|
||||
} else {
|
||||
//执行台账信息导入(不考虑,存在监测点却不存在限值信息)
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(DeviceResponseEnum.IMPORT_ORACLE_EXCEPTION);
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
/*private void dealData(List<OracleTerminalExcel> oracleTerminalExcelList){
|
||||
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()));
|
||||
for(OracleTerminalExcel oracleTerminalExcel : oracleTerminalExcelList){
|
||||
//单位
|
||||
if(oracleTerminalExcel.get)
|
||||
|
||||
//电站
|
||||
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 获取主配网监测点id集合
|
||||
* @param deptDTO
|
||||
|
||||
Reference in New Issue
Block a user