注释掉离线数据上传入库的代码(因为现阶段用的库并没有切换)

This commit is contained in:
guofeihu
2024-08-05 16:40:04 +08:00
parent c1d351498d
commit 843bbc338c
2 changed files with 17 additions and 9 deletions

View File

@@ -34,6 +34,7 @@ import com.njcn.system.pojo.po.DictData;
import com.njcn.system.pojo.po.EleEvtParm; import com.njcn.system.pojo.po.EleEvtParm;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@@ -42,6 +43,7 @@ import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -54,6 +56,7 @@ import java.util.stream.Stream;
* @author guofeihu * @author guofeihu
* @since 2024-07-03 * @since 2024-07-03
*/ */
@Slf4j
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMapper, PortableOfflLog> implements IPortableOfflLogService { public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMapper, PortableOfflLog> implements IPortableOfflLogService {
@@ -112,7 +115,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
//实际返回的是List<Response> 也即:该文件夹下所有解析的文件对应的结果集 //实际返回的是List<Response> 也即:该文件夹下所有解析的文件对应的结果集
List<Response> response = (List<Response>) obj; List<Response> response = (List<Response>) obj;
//临时记录下cfg结果集(用作log绑定对应的cfg波形文件) //临时记录下cfg结果集(用作log绑定对应的cfg波形文件)
if(OfflineConstant.LOG.equals(dictData.getCode())){ if(OfflineConstant.COMTRADE.equals(dictData.getCode())){
cfgResponse.addAll(response); cfgResponse.addAll(response);
} }
responses.addAll(response); responses.addAll(response);
@@ -163,7 +166,8 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
portableOfflLog.setRealCount(pqdData.size()); portableOfflLog.setRealCount(pqdData.size());
if(minFlag){ if(minFlag){
//高频谐波数据入库 //高频谐波数据入库
pqdDataMapper.insertBatch(pqdData); //pqdDataMapper.insertBatch(pqdData);
log.info("插入min-pqdData,其长度为:"+pqdData.size());
//min结果集解析入库后就不需要在解析了 //min结果集解析入库后就不需要在解析了
minFlag = false; minFlag = false;
} }
@@ -228,14 +232,14 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
String wavePath = null; String wavePath = null;
//设置波形文件(去cfg结果集里面去找) //设置波形文件(去cfg结果集里面去找)
for (Response res : cfgResponse) { for (Response res : cfgResponse) {
String cfg = res.getFilename();
String dat = cfg.substring(0,cfg.lastIndexOf("."))+OfflineConstant.DAT;
String sharPath = OfflineConstant.COMTRADE+"/"+DataParam.wlRecordPath+uploadDataParam.getDevId()+"/"+uploadDataParam.getLineId()+"/"+getFolderName()+"/";
tagComtradeCfg sing = (tagComtradeCfg) res.getObj(); tagComtradeCfg sing = (tagComtradeCfg) res.getObj();
Date date = Date.from(newTaglogbuffer.getStart().atZone( ZoneId.systemDefault()).toInstant()); Date date = Date.from(newTaglogbuffer.getStart().atZone( ZoneId.systemDefault()).toInstant());
//如果匹配上则需要将当前cfg文件及对应的dat文件上传到comtrade文件夹中 //如果匹配上则需要将当前cfg文件及对应的dat文件上传到comtrade文件夹中
if (sing.getTimeTrigger().compareTo(date) <= 0 && sing.getTimeEnd().compareTo(date) >= 0) { if ((sing!= null && sing.getTimeStart()!= null && sing.getTimeEnd() !=null && sing.getTimeTrigger().compareTo(date) <= 0 && sing.getTimeEnd().compareTo(date) >= 0)) {
for(MultipartFile f : uploadDataParam.getFiles()){ for(MultipartFile f : uploadDataParam.getFiles()){
String cfg = res.getFilename();
String dat = cfg.substring(0,cfg.lastIndexOf("."))+OfflineConstant.CFG;
String sharPath = OfflineConstant.COMTRADE+"/"+DataParam.wlRecordPath+uploadDataParam.getDevId()+"/"+uploadDataParam.getLineId()+"/"+getFolderName()+"/";
if(f.getOriginalFilename().equals(cfg) || f.getOriginalFilename().equals(dat)){ if(f.getOriginalFilename().equals(cfg) || f.getOriginalFilename().equals(dat)){
fileStorageUtil.uploadMultipart(f, sharPath); fileStorageUtil.uploadMultipart(f, sharPath);
wavePath = sharPath; wavePath = sharPath;
@@ -254,6 +258,8 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
csEventPO.setProcess(data1.get(0).getProcess()); csEventPO.setProcess(data1.get(0).getProcess());
csEventPOS.add(csEventPO); csEventPOS.add(csEventPO);
EntData entData = new EntData(); EntData entData = new EntData();
entData.setLineId(uploadDataParam.getLineId());
entData.setTime(newTaglogbuffer.getStart().toInstant(ZoneOffset.UTC));
for(NewBodyTaglogbuffer newBodyTaglogbuffer : newTaglogbuffer.getNewBodyTaglogbuffers()){ for(NewBodyTaglogbuffer newBodyTaglogbuffer : newTaglogbuffer.getNewBodyTaglogbuffers()){
if(newBodyTaglogbuffer.getParaCode() == 0) entData.setEvtVvadepth(newBodyTaglogbuffer.getParaValue()/65536D); if(newBodyTaglogbuffer.getParaCode() == 0) entData.setEvtVvadepth(newBodyTaglogbuffer.getParaValue()/65536D);
if(newBodyTaglogbuffer.getParaCode() == 1) entData.setEvtVvatm(newBodyTaglogbuffer.getParaValue()/65536D); if(newBodyTaglogbuffer.getParaCode() == 1) entData.setEvtVvatm(newBodyTaglogbuffer.getParaValue()/65536D);
@@ -284,9 +290,11 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
} }
} }
} }
evtDataMapper.insertOne(entData); log.info("插入"+entData.toString());
//evtDataMapper.insertOne(entData);
} }
eventFeignClient.saveBatchEventList(csEventPOS); log.info("插旗"+csEventPOS.toString());
//eventFeignClient.saveBatchEventList(csEventPOS);
} }
} }
} }

View File

@@ -68,7 +68,7 @@ public class EventController extends BaseController {
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/saveBatchEventList") @PostMapping("/saveBatchEventList")
@ApiOperation("批量新增事件") @ApiOperation("批量新增事件")
@ApiImplicitParam(name = "csEventPOS", value = "事件集合", required = true) @ApiImplicitParam(name = "csEventPOS", value = "事件集合", required = true)
public HttpResult<String> saveBatchEventList(@RequestBody List<CsEventPO> csEventPOS) { public HttpResult<String> saveBatchEventList(@RequestBody List<CsEventPO> csEventPOS) {