From 82acf165933890f14f8610ce3e938d1604398c78 Mon Sep 17 00:00:00 2001 From: chendaofei <857448963@qq.com> Date: Fri, 3 Jan 2025 13:21:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PreDetectionController.java | 10 +- .../handler/SocketDevResponseService.java | 137 ++++++++++++++---- .../handler/SocketSourceResponseService.java | 15 +- .../service/impl/DetectionServiceImpl.java | 10 +- .../detection/util/socket/SocketManager.java | 2 +- .../impl/PqScriptCheckDataServiceImpl.java | 11 +- .../service/impl/PqScriptDtlsServiceImpl.java | 3 +- .../impl/DetectionDataServiceImpl.java | 35 +++++ .../service/impl/TableGenServiceImpl.java | 7 +- .../gather/system/pojo/enums/DicDataEnum.java | 39 +++++ 10 files changed, 217 insertions(+), 52 deletions(-) create mode 100644 system/src/main/java/com/njcn/gather/system/pojo/enums/DicDataEnum.java diff --git a/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java b/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java index fddb4783..d6a23c5f 100644 --- a/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java +++ b/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java @@ -96,11 +96,11 @@ public class PreDetectionController extends BaseController { List devDataList = new ArrayList<>(); DevData aa = JSON.parseObject(a, DevData.class); - DevData bb = JSON.parseObject(a, DevData.class); - DevData cc = JSON.parseObject(a, DevData.class); - DevData dd = JSON.parseObject(a, DevData.class); - DevData ee = JSON.parseObject(a, DevData.class); - DevData ff = JSON.parseObject(a, DevData.class); + DevData bb = JSON.parseObject(b, DevData.class); + DevData cc = JSON.parseObject(c, DevData.class); + DevData dd = JSON.parseObject(d, DevData.class); + DevData ee = JSON.parseObject(e, DevData.class); + DevData ff = JSON.parseObject(f, DevData.class); devDataList.add(aa); devDataList.add(bb); devDataList.add(cc); diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java index 41d2664a..6837c99e 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java @@ -27,9 +27,11 @@ import com.njcn.gather.storage.pojo.po.AdHarmonicResult; import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult; import com.njcn.gather.storage.service.DetectionDataDealService; import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum; +import com.njcn.gather.system.pojo.enums.DicDataEnum; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import java.lang.reflect.Field; import java.math.BigDecimal; import java.time.LocalDateTime; import java.time.ZoneId; @@ -37,8 +39,11 @@ import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; import java.util.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.function.Function; import java.util.stream.Collectors; +import java.util.stream.Stream; @Service @@ -49,6 +54,8 @@ public class SocketDevResponseService { private final String handlerStr = "_Dev"; private final String handlerSourceStr = "_Source"; + //private final List dicDataList = Stream.of(DicDataEnum.FREQ.getCode(),DicDataEnum.V.getCode()) + private final WebSocketHandler webSocketHandler; private final IPqDevService iPqDevService; private final IPqScriptDtlsService scriptDtlsService; @@ -58,6 +65,10 @@ public class SocketDevResponseService { private final DetectionDataDealService detectionDataDealService; + private final ExecutorService executorPool = Executors.newFixedThreadPool(5); + + + /** @@ -235,7 +246,7 @@ public class SocketDevResponseService { //successXieyi = new ArrayList<>(); List devList = iPqDevService.getDevInfo(param.getDevIds()); - Map> map = new HashMap(1); + Map> map = new HashMap<>(1); map.put("deviceList", devList); String jsonString = JSON.toJSONString(map); socketMsg.setRequestId(SourceOperateCodeEnum.YJC_XYJY.getValue()); @@ -451,6 +462,10 @@ public class SocketDevResponseService { if (successComm.size() == monitorIdListComm.size()) { System.out.println(sourceIssue.getType() +"_"+ sourceIssue.getIndex() + "当前测试小项读取数据已经全部结束。。。。。。。。。"); + + //原始数据入库 + baseDataInsert(devDataList,sourceIssue,param); + System.out.println(JSON.toJSONString(sourceIssue)); //开启线程进行入库原始数据操作 @@ -459,15 +474,11 @@ public class SocketDevResponseService { long tem = SocketManager.getSourceTarget(sourceIssue.getType()) - 1; SocketManager.addTargetMap(sourceIssue.getType(), tem); - System.out.println("该大项还有"+tem+"个小项没有进行检测!!!!!!!!"); if (tem == 0) { System.out.println(sourceIssue.getType() + sourceIssue.getIndex() + "当前测试大项已经全部结束》》》》》》》》"); - - baseDataInsert(devDataList,sourceIssue,param); - //当val为0则认为大项中的小项已经全部跑完,开始组装信息推送给前端 WebSocketVO> webSocketVO = new WebSocketVO<>(); webSocketVO.setRequestId(socketDataMsg.getRequestId().split("&&")[1] + "_End"); @@ -491,15 +502,16 @@ public class SocketDevResponseService { webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(webSocketVO)); } + System.out.println("当前小项结束进行删除============"+sourceIssue.getType()+"_"+sourceIssue.getIndex()); - - //开始进行下一个大项检测 + //当小项结束后需要删除集合中的小项 + SocketManager.delSource(sourceIssue.getIndex()); + //开始进行下一项检测 List sourceIssueList = SocketManager.getSourceList(); if (CollUtil.isNotEmpty(sourceIssueList)) { SocketMsg xuMsg = new SocketMsg<>(); xuMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue()); - //正式检测 SourceIssue sourceIssues = SocketManager.getSourceList().get(0); xuMsg.setData(JSON.toJSONString(sourceIssues)); @@ -507,13 +519,10 @@ public class SocketDevResponseService { SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, MsgUtil.toJsonWithNewLinePlain(xuMsg)); } - //当小项结束后需要删除集合中的小项 - SocketManager.delSource(sourceIssue.getIndex()); - System.out.println("当前小项结束进行删除============"+sourceIssue.getType()+"_"+sourceIssue.getIndex()); successComm.clear(); devDataList.clear(); - } + } break; case UNPROCESSED_BUSINESS: @@ -746,32 +755,104 @@ public class SocketDevResponseService { * @date 2024/12/29 */ private void baseDataInsert(List devDataList,SourceIssue sourceIssue,PreDetectionParam param){ - Runnable runnable = new Runnable() { - @Override - public void run() { - DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME; // ISO 8601格式 + Runnable runnable = () -> { + DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME; // ISO 8601格式 - List adHarmonicResultList = new ArrayList<>(); - for(DevData data : devDataList){ - AdNonHarmonicResult adNonHarmonicResult = new AdNonHarmonicResult(); + List adNonHarmonicResultList = new ArrayList<>(); + List adHarmonicResultList = new ArrayList<>(); + for(DevData data : devDataList){ + LocalDateTime localDateTime = timeFormat(data.getTime(),formatter); + if(Objects.nonNull(localDateTime)){ - LocalDateTime localDateTime = timeFormat(data.getTime(),formatter); - if(Objects.nonNull(localDateTime)){ + if(Stream.of("FREQ","V","IMBA","P","I","IMBV").collect(Collectors.toList()).contains(sourceIssue.getType())){ + AdNonHarmonicResult adNonHarmonicResult = new AdNonHarmonicResult(); adNonHarmonicResult.setTimeId(localDateTime); adNonHarmonicResult.setMonitorId(data.getId()); adNonHarmonicResult.setScriptId(param.getScriptId()); adNonHarmonicResult.setSort(sourceIssue.getIndex()); - adNonHarmonicResult.setAdType(sourceIssue.getSourceId()); - adNonHarmonicResult.setAValue(data.getSqlData().get(0).getList().getA().toString()); - adNonHarmonicResult.setBValue(data.getSqlData().get(0).getList().getB().toString()); - adNonHarmonicResult.setCValue(data.getSqlData().get(0).getList().getC().toString()); - adHarmonicResultList.add(adNonHarmonicResult); + adNonHarmonicResult.setAdType(sourceIssue.getId()); + adNonHarmonicResult.setDataType("avg"); + DevData.SqlDataDTO.ListDTO tem = data.getSqlData().get(0).getList(); + + + Double a = tem.getA(); + Double b = tem.getB(); + Double c = tem.getC(); + Double d = tem.getT(); + if(Objects.nonNull(a)){ + adNonHarmonicResult.setAValue(String.format("%.7f", a)); + } + if(Objects.nonNull(b)){ + adNonHarmonicResult.setBValue(String.format("%.7f", b)); + } + if(Objects.nonNull(c)){ + adNonHarmonicResult.setCValue(String.format("%.7f", c)); + } + if(Objects.nonNull(d)){ + adNonHarmonicResult.setTValue(String.format("%.7f", d)); + } + adNonHarmonicResultList.add(adNonHarmonicResult); + }else { + //DevData.SqlDataDTO.ListDTO vvv = data.getSqlData().get(0).getList(); + AdHarmonicResult adHarmonicResult = new AdHarmonicResult(); + adHarmonicResult.setTimeId(localDateTime); + adHarmonicResult.setMonitorId(data.getId()); + adHarmonicResult.setScriptId(param.getScriptId()); + adHarmonicResult.setSort(sourceIssue.getIndex()); + adHarmonicResult.setAdType(sourceIssue.getId()); + adHarmonicResult.setDataType("avg"); + + /* Double aV = vvv.getA(); + Double bV = vvv.getB(); + Double cV = vvv.getC(); + if(Objects.nonNull(aV)){ + adHarmonicResult.setAValue1(aV.toString()); + } + if(Objects.nonNull(bV)){ + adHarmonicResult.setBValue1(bV.toString()); + } + if(Objects.nonNull(cV)){ + adHarmonicResult.setCValue1(cV.toString()); + }*/ + DevData.SqlDataHarmDTO.ListDTO tem = data.getSqlDataHarm().get(0).getList(); + List a = tem.getA(); + List b = tem.getB(); + List c = tem.getC(); + + Class example = (Class) adHarmonicResult.getClass(); + for(int i = 2;i<=50;i++){ + // 通过反射设置name字段的值 + try { + // 假设这些字段已经以正确的方式定义在AdHarmonicResult类中 + Field aField = example.getDeclaredField("aValue" + i); + Field bField = example.getDeclaredField("bValue" + i); + Field cField = example.getDeclaredField("cValue" + i); + + aField.setAccessible(true); + aField.set(adHarmonicResult,a.get(i - 2)); + bField.setAccessible(true); + bField.set(adHarmonicResult,b.get(i - 2)); + cField.setAccessible(true); + cField.set(adHarmonicResult,c.get(i - 2)); + + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + } + adHarmonicResultList.add(adHarmonicResult); } + } - detectionDataDealService.acceptAdNon(adHarmonicResultList,"1"); + } + + if(CollUtil.isNotEmpty(adNonHarmonicResultList)){ + detectionDataDealService.acceptAdNon(adNonHarmonicResultList,"1"); + } + if(CollUtil.isNotEmpty(adHarmonicResultList)){ + detectionDataDealService.acceptAd(adHarmonicResultList,"1"); } }; - runnable.run(); + executorPool.submit(runnable); } diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java index a1a94fc6..9ed63436 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java @@ -18,6 +18,7 @@ import com.njcn.gather.detection.util.socket.web.WebSocketHandler; import com.njcn.gather.device.device.pojo.vo.PreDetection; import com.njcn.gather.device.device.service.IPqDevService; import com.njcn.gather.device.script.pojo.po.SourceIssue; +import com.njcn.gather.system.pojo.enums.DicDataEnum; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -186,16 +187,24 @@ public class SocketSourceResponseService { String s = param.getUserPageId() + DEV; SourceIssue sourceIssue = SocketManager.getSourceList().get(0); - String comm = sourceIssue.getDevValueTypeList().get(0); + List comm = sourceIssue.getDevValueTypeList(); socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue()+"&&"+sourceIssue.getType()); - socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue()); + + if(sourceIssue.getType().equals(DicDataEnum.HP.getCode())||sourceIssue.getType().equals(DicDataEnum.F.getCode())){ + socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_01.getValue()); + }else if(DicDataEnum.VOLTAGE.getCode().equals(sourceIssue.getType())){ + socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_03.getValue()); + }else { + socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue()); + } + List moniterIdList = devList.stream().flatMap(x -> x.getMonitorList().stream()).map(PreDetection.MonitorListDTO::getLineId).collect(Collectors.toList()); DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam(); System.out.println("向装置下发的参数"+comm); phaseSequenceParam.setMoniterIdList(moniterIdList); - phaseSequenceParam.setDataType(Arrays.asList(comm)); + phaseSequenceParam.setDataType(comm); phaseSequenceParam.setReadCount(2); phaseSequenceParam.setIgnoreCount(10); socketMsg.setData(JSON.toJSONString(phaseSequenceParam)); diff --git a/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java b/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java index 717e8434..cfb2da85 100644 --- a/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java @@ -635,7 +635,7 @@ public class DetectionServiceImpl { } }); devMap.forEach((harm, harmDataList) -> { - PqErrSysDtls errSysDtl = errSysDtlMap.get(harm); + PqErrSysDtls errSysDtl = errSysDtlMap.get(num==1?harm+0.5:harm); DetectionData data = new DetectionData(); data.setIsData(4); data.setNum(harm); @@ -708,7 +708,11 @@ public class DetectionServiceImpl { .sorted().distinct().collect(Collectors.toList()); } for (DevData devData : dev) { - DevData.SqlDataDTO fund = devData.getSqlData().stream().collect(Collectors.toList()).stream().findFirst().get(); + Optional first = devData.getSqlData().stream().collect(Collectors.toList()).stream().findFirst(); + DevData.SqlDataDTO fund = null; + if (first.isPresent()){ + fund = devData.getSqlData().stream().collect(Collectors.toList()).stream().findFirst().get(); + } DevData.SqlDataHarmDTO harm = devData.getSqlDataHarm().stream().filter(x -> 49 == x.getNum()).collect(Collectors.toList()).stream().findFirst().get(); if (ObjectUtil.isNotNull(fund)) { harmPut(TYPE_A, map, harmNum, harm, String.valueOf(fund.getList().getA()), num); @@ -875,7 +879,7 @@ public class DetectionServiceImpl { } public Double multiply(Double devData, Double channelData, Integer type) { - if (ObjectUtil.isNotNull(type)) { + if (ObjectUtil.isNotNull(devData)) { if (0 == type) { return BigDecimal.valueOf(devData).multiply(BigDecimal.valueOf(channelData)) .setScale(4, RoundingMode.HALF_UP).doubleValue(); diff --git a/detection/src/main/java/com/njcn/gather/detection/util/socket/SocketManager.java b/detection/src/main/java/com/njcn/gather/detection/util/socket/SocketManager.java index 9bcca27b..e2e06fdf 100644 --- a/detection/src/main/java/com/njcn/gather/detection/util/socket/SocketManager.java +++ b/detection/src/main/java/com/njcn/gather/detection/util/socket/SocketManager.java @@ -79,7 +79,7 @@ public class SocketManager { public static void addSourceList(List sList) { sourceIssueList = sList; - System.out.println(sList); + // System.out.println(sList); } public static List getSourceList() { diff --git a/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptCheckDataServiceImpl.java b/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptCheckDataServiceImpl.java index 43277f40..a6362b8a 100644 --- a/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptCheckDataServiceImpl.java +++ b/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptCheckDataServiceImpl.java @@ -28,10 +28,8 @@ import java.util.stream.Collectors; @RequiredArgsConstructor public class PqScriptCheckDataServiceImpl extends ServiceImpl implements IPqScriptCheckDataService { - private final String V="V2-50$real"; - private final String SV="SV_1-49$real"; - private final String I="I2-50$real"; - private final String IV="SI_1-49$real"; + private final String V="real$V2-50"; + private final String SV="real$SV_1-49"; @Override public List getValueType(PqScriptCheckDataParam param) { @@ -49,10 +47,7 @@ public class PqScriptCheckDataServiceImpl extends ServiceImpl checkData = pqScriptCheckData.stream().map(x -> x.getDataType() + "$" + x.getValueType()).distinct().collect(Collectors.toList()); if(checkData.contains(V)||checkData.contains(SV)){ - checkData.add("U1$real"); - } - if(checkData.contains(I)||checkData.contains(IV)){ - checkData.add("I1$real"); + checkData.add("real$U1"); } return checkData; } else { diff --git a/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptDtlsServiceImpl.java b/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptDtlsServiceImpl.java index dc9dabf1..f7ab7500 100644 --- a/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptDtlsServiceImpl.java +++ b/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptDtlsServiceImpl.java @@ -212,7 +212,8 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl queryWrapper = new MPJLambdaWrapper<>(); queryWrapper.selectAll(PqScriptDtls.class) .selectAs(DictTree::getCode, PqScriptDtls::getScriptCode) - .leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType); + .leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType) + .eq(PqScriptDtls::getEnable, 1);; if (isPhaseSequence) { queryWrapper.eq(PqScriptDtls::getIndex, -1) .eq(PqScriptDtls::getEnable, 1); diff --git a/storage/src/main/java/com/njcn/gather/storage/service/impl/DetectionDataServiceImpl.java b/storage/src/main/java/com/njcn/gather/storage/service/impl/DetectionDataServiceImpl.java index 13d68fa4..a58eb839 100644 --- a/storage/src/main/java/com/njcn/gather/storage/service/impl/DetectionDataServiceImpl.java +++ b/storage/src/main/java/com/njcn/gather/storage/service/impl/DetectionDataServiceImpl.java @@ -1,5 +1,6 @@ package com.njcn.gather.storage.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler; import com.njcn.db.mybatisplus.service.impl.ReplenishMybatisServiceImpl; import com.njcn.gather.storage.mapper.DetectionDataDealMapper; @@ -27,6 +28,14 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl adNonHarmonicResultList,String code) { String adNonTable = "ad_non_harmonic_"; DynamicTableNameHandler.setTableName(adNonTable +code); + for(AdNonHarmonicResult item :adNonHarmonicResultList){ + adNonHarmonicService.remove(new LambdaQueryWrapper() + .eq(AdNonHarmonicResult::getMonitorId,item.getMonitorId()) + .eq(AdNonHarmonicResult::getSort,item.getSort()) + .eq(AdNonHarmonicResult::getScriptId,item.getScriptId()) + ); + } + adNonHarmonicService.saveBatch(adNonHarmonicResultList,100); DynamicTableNameHandler.remove(); return true; @@ -36,6 +45,15 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl adHarmonicResultList,String code) { String adTable = "ad_harmonic_"; DynamicTableNameHandler.setTableName(adTable +code); + + for(AdHarmonicResult item :adHarmonicResultList){ + this.remove(new LambdaQueryWrapper() + .eq(AdHarmonicResult::getMonitorId,item.getMonitorId()) + .eq(AdHarmonicResult::getSort,item.getSort()) + .eq(AdHarmonicResult::getScriptId,item.getScriptId()) + ); + } + this.saveBatch(adHarmonicResultList,100); DynamicTableNameHandler.remove(); return true; @@ -45,6 +63,15 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl adNonHarmonicResultList,String code) { String adNonTableResult = "ad_non_harmonic_result_"; DynamicTableNameHandler.setTableName(adNonTableResult +code); + + for(AdNonHarmonicResult item :adNonHarmonicResultList){ + adNonHarmonicService.remove(new LambdaQueryWrapper() + .eq(AdNonHarmonicResult::getMonitorId,item.getMonitorId()) + .eq(AdNonHarmonicResult::getSort,item.getSort()) + .eq(AdNonHarmonicResult::getScriptId,item.getScriptId()) + + ); + } adNonHarmonicService.saveBatch(adNonHarmonicResultList,100); DynamicTableNameHandler.remove(); return true; @@ -54,6 +81,14 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl adHarmonicResultList,String code) { String adTableResult = "ad_harmonic_result_"; DynamicTableNameHandler.setTableName(adTableResult +code); + for(AdHarmonicResult item :adHarmonicResultList){ + this.remove(new LambdaQueryWrapper() + .eq(AdHarmonicResult::getMonitorId,item.getMonitorId()) + .eq(AdHarmonicResult::getSort,item.getSort()) + .eq(AdHarmonicResult::getScriptId,item.getScriptId()) + + ); + } this.saveBatch(adHarmonicResultList,100); DynamicTableNameHandler.remove(); return true; diff --git a/storage/src/main/java/com/njcn/gather/storage/service/impl/TableGenServiceImpl.java b/storage/src/main/java/com/njcn/gather/storage/service/impl/TableGenServiceImpl.java index bcff7d2d..b3c973f1 100644 --- a/storage/src/main/java/com/njcn/gather/storage/service/impl/TableGenServiceImpl.java +++ b/storage/src/main/java/com/njcn/gather/storage/service/impl/TableGenServiceImpl.java @@ -37,11 +37,12 @@ public class TableGenServiceImpl implements TableGenService { String sql = "CREATE TABLE AD_Harmonic_"+code+" (\n" + " Monitor_Id CHAR(60) NOT NULL COMMENT '监测点Id',\n" + - " Time_Id DATETIME NULL COMMENT '时间',\n" + + " Time_Id DATETIME NOT NULL COMMENT '时间',\n" + " Script_Id CHAR(32) NOT NULL COMMENT '检测脚本子表Id,字典表',\n" + " Sort int(5) NOT NULL COMMENT '总检测脚本中的测试项序号',\n" + " AD_Type CHAR(32) NOT NULL COMMENT '检测指标,字典表',\n" + " Data_Type CHAR(32) NOT NULL COMMENT '数据指标,只有数据源为分钟统计时候才会使用(最大、最小、平均、CP95,默认平均值),字典表',\n" + + " Result_Flag int(1) NULL COMMENT '0.不合格 1.合格',\n" + A+B+C+ " PRIMARY KEY (Monitor_Id, Script_Id, Sort, Data_Type)\n" + ") COMMENT='监测数据表';"; @@ -49,14 +50,14 @@ public class TableGenServiceImpl implements TableGenService { String sql2 = "CREATE TABLE AD_Harmonic_Result_"+code+" (\n" + " Monitor_Id CHAR(60) NOT NULL COMMENT '监测点Id',\n" + - " Time_Id DATETIME NOT NULL COMMENT '时间',\n" + + " Time_Id DATETIME NULL COMMENT '时间',\n" + " Script_Id CHAR(32) NOT NULL COMMENT '检测脚本子表Id,字典表',\n" + " Sort int(5) NOT NULL COMMENT '总检测脚本中的测试项序号',\n" + " AD_Type CHAR(32) NOT NULL COMMENT '检测指标,字典表',\n" + " Data_Type CHAR(32) NOT NULL COMMENT '数据指标,只有数据源为分钟统计时候才会使用(最大、最小、平均、CP95,默认平均值),字典表',\n" + " Result_Flag int(1) NOT NULL COMMENT '0.不合格 1.合格',\n" + A+B+C+ - " PRIMARY KEY (Monitor_Id,Time_Id, Script_Id, Sort, Data_Type)\n" + + " PRIMARY KEY (Monitor_Id, Script_Id, Sort, Data_Type)\n" + ") COMMENT='监测数据表';"; tableGenMapper.genAdHarmonicTable(sql2); } diff --git a/system/src/main/java/com/njcn/gather/system/pojo/enums/DicDataEnum.java b/system/src/main/java/com/njcn/gather/system/pojo/enums/DicDataEnum.java new file mode 100644 index 00000000..2bf353f8 --- /dev/null +++ b/system/src/main/java/com/njcn/gather/system/pojo/enums/DicDataEnum.java @@ -0,0 +1,39 @@ +package com.njcn.gather.system.pojo.enums; + +import lombok.Getter; + +/** + * @author cdf + * @version 1.0.0 + */ +@Getter +public enum DicDataEnum { + + + FREQ("FREQ","频率"), + V("V","电压"), + HV("HV","谐波电压"), + HI("HI","谐波电流"), + HP("HP","谐波有功功率"), + HSV("HSV","间谐波电压"), + HSI("V","间谐波电流"), + VOLTAGE("VOLTAGE","暂态"), + I("I","电流"), + IMBV("IMBV","三相电压不平衡度"), + IMBA("IMBA","三相电流不平衡度"), + F("F","闪变"), + + + + ; + + + private final String code; + + private final String message; + + DicDataEnum(String code, String message) { + this.code = code; + this.message = message; + } +}