测试项数据入库代码
This commit is contained in:
@@ -31,6 +31,12 @@
|
|||||||
<artifactId>detection</artifactId>
|
<artifactId>detection</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn.gather</groupId>
|
||||||
|
<artifactId>storage</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
1
pom.xml
1
pom.xml
@@ -13,6 +13,7 @@
|
|||||||
<module>user</module>
|
<module>user</module>
|
||||||
<module>device</module>
|
<module>device</module>
|
||||||
<module>detection</module>
|
<module>detection</module>
|
||||||
|
<module>storage</module>
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>融合各工具的项目</name>
|
<name>融合各工具的项目</name>
|
||||||
|
|||||||
46
storage/pom.xml
Normal file
46
storage/pom.xml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.njcn.gather</groupId>
|
||||||
|
<artifactId>CN_Gather</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
|
||||||
|
<artifactId>storage</artifactId>
|
||||||
|
<name>storage</name>
|
||||||
|
<description>数据存储</description>
|
||||||
|
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>njcn-common</artifactId>
|
||||||
|
<version>0.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>mybatis-plus</artifactId>
|
||||||
|
<version>0.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>spingboot2.3.12</artifactId>
|
||||||
|
<version>2.3.12</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.njcn.gather.storage.controller;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||||
|
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.web.controller.BaseController;
|
||||||
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "处理数据")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/dataDeal")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DataDealController extends BaseController {
|
||||||
|
|
||||||
|
private final DetectionDataDealService detectionDataDealService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("ttt")
|
||||||
|
public HttpResult<Object> dataDealAndInsert(){
|
||||||
|
String methodDescribe = getMethodDescribe("dataDealAndInsert");
|
||||||
|
|
||||||
|
List<AdHarmonicResult> list2 = new ArrayList<>();
|
||||||
|
AdHarmonicResult adHarmonicResult = new AdHarmonicResult();
|
||||||
|
adHarmonicResult.setDataType("aa");
|
||||||
|
adHarmonicResult.setAdType("aaaa");
|
||||||
|
|
||||||
|
adHarmonicResult.setMonitorId("ss");
|
||||||
|
adHarmonicResult.setScriptDtlsId("ddd");
|
||||||
|
adHarmonicResult.setTimeId(LocalDateTime.now());
|
||||||
|
|
||||||
|
list2.add(adHarmonicResult);
|
||||||
|
AdHarmonicResult adHarmonicResult2 = new AdHarmonicResult();
|
||||||
|
adHarmonicResult2.setDataType("aabb");
|
||||||
|
adHarmonicResult2.setAdType("aaaabb");
|
||||||
|
|
||||||
|
adHarmonicResult2.setMonitorId("ssbb");
|
||||||
|
adHarmonicResult2.setScriptDtlsId("dddbb");
|
||||||
|
adHarmonicResult2.setTimeId(LocalDateTime.now());
|
||||||
|
list2.add(adHarmonicResult2);
|
||||||
|
|
||||||
|
detectionDataDealService.acceptAd(list2,"1");
|
||||||
|
|
||||||
|
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.njcn.gather.storage.controller;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.gather.storage.service.TableGenService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "生成表")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/genTable")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TableGenController extends BaseController {
|
||||||
|
|
||||||
|
private final TableGenService tableGenService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("genAdHarmonicTable")
|
||||||
|
@ApiOperation("生成表")
|
||||||
|
@OperateInfo
|
||||||
|
public HttpResult<Object> genAdHarmonicTable(@RequestParam("code") String code){
|
||||||
|
String methodDescribe = getMethodDescribe("genAdHarmonicTable");
|
||||||
|
tableGenService.genAdNonHarmonicTable(code);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.njcn.gather.storage.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||||
|
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AdNonHarmonicMapper extends BaseMapper<AdNonHarmonicResult> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.njcn.gather.storage.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DetectionDataDealMapper extends BaseMapper<AdHarmonicResult> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.njcn.gather.storage.mapper;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Update;
|
||||||
|
|
||||||
|
public interface TableGenMapper {
|
||||||
|
|
||||||
|
|
||||||
|
void genAdNonHarmonicTable(@Param("code")String code);
|
||||||
|
|
||||||
|
|
||||||
|
void genAdHarmonicTable(@Param("tableSql")String tableSql);
|
||||||
|
|
||||||
|
|
||||||
|
void genAdNonHarmonicResultTable(@Param("code")String code);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?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.gather.storage.mapper.TableGenMapper">
|
||||||
|
|
||||||
|
<update id="genAdNonHarmonicTable" parameterType="string">
|
||||||
|
CREATE TABLE ad_non_harmonic_${code} (
|
||||||
|
Monitor_Id CHAR(32) NOT NULL COMMENT '监测点Id',
|
||||||
|
Time_Id DATETIME NOT NULL COMMENT '时间',
|
||||||
|
Script_Dtls_Id CHAR(32) NOT NULL COMMENT '检测脚本子表Id,字典表',
|
||||||
|
AD_Type CHAR(32) NOT NULL COMMENT '检测指标,字典表',
|
||||||
|
Data_Type CHAR(32) NOT NULL COMMENT '数据指标,只有数据源为分钟统计时候才会使用(最大、最小、平均、CP95,默认平均值),字典表',
|
||||||
|
A_Value FLOAT NOT NULL COMMENT 'A相值',
|
||||||
|
B_Value FLOAT NOT NULL COMMENT 'B相值',
|
||||||
|
C_Value FLOAT NOT NULL COMMENT 'C相值',
|
||||||
|
T_Value FLOAT NOT NULL COMMENT 'T相值(没有相别的则存这里)',
|
||||||
|
PRIMARY KEY (Monitor_Id, Time_Id, Script_Dtls_Id, AD_Type, Data_Type)
|
||||||
|
) COMMENT='监测数据表';
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="genAdHarmonicTable" parameterType="string">
|
||||||
|
${tableSql}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<update id="genAdNonHarmonicResultTable" parameterType="string">
|
||||||
|
CREATE TABLE ad_non_harmonic_result_${code} (
|
||||||
|
Monitor_Id CHAR(32) NOT NULL COMMENT '监测点Id',
|
||||||
|
Time_Id DATETIME NOT NULL COMMENT '时间',
|
||||||
|
Script_Dtls_Id CHAR(32) NOT NULL COMMENT '检测脚本子表Id,字典表',
|
||||||
|
AD_Type CHAR(32) NOT NULL COMMENT '检测指标,字典表',
|
||||||
|
Data_Type CHAR(32) NOT NULL COMMENT '数据指标,只有数据源为分钟统计时候才会使用(最大、最小、平均、CP95,默认平均值),字典表',
|
||||||
|
Result_Flag int(1) NOT NULL COMMENT '0.不合格 1.合格',
|
||||||
|
A_Value FLOAT NOT NULL COMMENT 'A相值',
|
||||||
|
B_Value FLOAT NOT NULL COMMENT 'B相值',
|
||||||
|
C_Value FLOAT NOT NULL COMMENT 'C相值',
|
||||||
|
T_Value FLOAT NOT NULL COMMENT 'T相值(没有相别的则存这里)',
|
||||||
|
PRIMARY KEY (Monitor_Id, Time_Id, Script_Dtls_Id, AD_Type, Data_Type)
|
||||||
|
) COMMENT='监测数据表';
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="genAdHarmonicResultTable" parameterType="string">
|
||||||
|
${tableSql}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
||||||
@@ -0,0 +1,805 @@
|
|||||||
|
package com.njcn.gather.storage.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 监测数据表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @since 2024-12-24
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName("ad_harmonic_xx")
|
||||||
|
public class AdHarmonicResult {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点Id
|
||||||
|
*/
|
||||||
|
private String monitorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime timeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测脚本子表Id,字典表
|
||||||
|
*/
|
||||||
|
private String scriptDtlsId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测指标,字典表
|
||||||
|
*/
|
||||||
|
private String adType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据指标,只有数据源为分钟统计时候才会使用(最大、最小、平均、CP95,默认平均值),字典表
|
||||||
|
*/
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0.不合格 1.合格
|
||||||
|
*/
|
||||||
|
private Integer resultFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A相基波
|
||||||
|
*/
|
||||||
|
private Float aValue1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 6次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 7次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue7;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 8次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 9次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue9;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 10次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 11次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue11;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 12次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue12;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 13次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue13;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 14次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue14;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 15次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue15;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 16次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 17次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue17;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 18次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue18;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 19次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue19;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 20次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue20;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 21次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue21;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 22次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue22;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 23次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue23;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 24次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue24;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 25次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue25;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 26次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue26;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 27次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue27;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 28次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue28;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 29次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue29;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 30次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue30;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 31次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue31;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 32次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue32;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 33次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue33;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 34次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue34;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 35次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue35;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 36次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue36;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 37次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue37;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 38次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue38;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 39次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue39;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 40次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue40;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 41次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue41;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 42次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue42;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 43次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue43;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 44次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue44;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 45次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue45;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 46次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue46;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 47次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue47;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 48次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue48;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 49次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue49;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 50次A相谐波
|
||||||
|
*/
|
||||||
|
private Float aValue50;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* B相基波
|
||||||
|
*/
|
||||||
|
private Float bValue1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 6次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 7次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue7;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 8次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 9次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue9;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 10次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 11次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue11;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 12次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue12;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 13次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue13;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 14次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue14;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 15次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue15;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 16次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 17次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue17;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 18次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue18;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 19次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue19;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 20次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue20;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 21次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue21;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 22次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue22;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 23次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue23;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 24次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue24;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 25次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue25;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 26次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue26;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 27次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue27;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 28次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue28;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 29次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue29;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 30次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue30;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 31次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue31;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 32次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue32;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 33次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue33;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 34次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue34;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 35次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue35;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 36次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue36;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 37次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue37;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 38次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue38;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 39次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue39;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 40次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue40;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 41次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue41;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 42次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue42;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 43次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue43;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 44次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue44;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 45次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue45;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 46次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue46;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 47次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue47;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 48次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue48;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 49次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue49;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 50次B相谐波
|
||||||
|
*/
|
||||||
|
private Float bValue50;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* C相基波
|
||||||
|
*/
|
||||||
|
private Float cValue1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 6次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 7次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue7;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 8次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 9次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue9;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 10次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 11次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue11;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 12次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue12;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 13次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue13;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 14次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue14;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 15次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue15;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 16次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 17次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue17;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 18次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue18;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 19次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue19;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 20次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue20;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 21次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue21;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 22次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue22;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 23次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue23;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 24次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue24;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 25次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue25;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 26次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue26;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 27次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue27;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 28次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue28;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 29次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue29;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 30次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue30;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 31次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue31;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 32次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue32;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 33次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue33;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 34次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue34;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 35次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue35;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 36次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue36;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 37次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue37;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 38次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue38;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 39次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue39;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 40次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue40;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 41次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue41;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 42次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue42;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 43次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue43;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 44次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue44;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 45次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue45;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 46次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue46;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 47次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue47;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 48次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue48;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 49次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue49;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 50次C相谐波
|
||||||
|
*/
|
||||||
|
private Float cValue50;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.njcn.gather.storage.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 监测数据表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @since 2024-12-24
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName(value = "ad_harmonic_xx")
|
||||||
|
public class AdNonHarmonicResult {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点Id
|
||||||
|
*/
|
||||||
|
private String monitorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime timeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测脚本子表Id,字典表
|
||||||
|
*/
|
||||||
|
private String scriptDtlsId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测指标,字典表
|
||||||
|
*/
|
||||||
|
private String adType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据指标,只有数据源为分钟统计时候才会使用(最大、最小、平均、CP95,默认平均值),字典表
|
||||||
|
*/
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0.不合格 1.合格
|
||||||
|
*/
|
||||||
|
private Integer resultFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A相值
|
||||||
|
*/
|
||||||
|
private Float aValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* B相值
|
||||||
|
*/
|
||||||
|
private Float bValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* C相值
|
||||||
|
*/
|
||||||
|
private Float cValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* T相值(没有相别的则存这里)
|
||||||
|
*/
|
||||||
|
private Float tValue;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.njcn.gather.storage.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||||
|
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface AdNonHarmonicService extends IService<AdNonHarmonicResult> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.njcn.gather.storage.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||||
|
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface DetectionDataDealService extends IService<AdHarmonicResult> {
|
||||||
|
|
||||||
|
|
||||||
|
Boolean acceptAdNon(List<AdNonHarmonicResult> adNonHarmonicResultList,String code);
|
||||||
|
|
||||||
|
Boolean acceptAd(List<AdHarmonicResult> adHarmonicResultList,String code);
|
||||||
|
|
||||||
|
|
||||||
|
Boolean acceptAdNonResult(List<AdNonHarmonicResult> adNonHarmonicResultList,String code);
|
||||||
|
|
||||||
|
Boolean acceptAdResult(List<AdHarmonicResult> adHarmonicResultList,String code);
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.njcn.gather.storage.service;
|
||||||
|
|
||||||
|
public interface TableGenService {
|
||||||
|
|
||||||
|
|
||||||
|
void genAdNonHarmonicTable(String code);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.njcn.gather.storage.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||||
|
import com.njcn.gather.storage.mapper.AdNonHarmonicMapper;
|
||||||
|
import com.njcn.gather.storage.mapper.DetectionDataDealMapper;
|
||||||
|
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||||
|
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||||
|
import com.njcn.gather.storage.service.AdNonHarmonicService;
|
||||||
|
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, AdNonHarmonicResult> implements AdNonHarmonicService {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.njcn.gather.storage.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||||
|
import com.njcn.gather.storage.mapper.DetectionDataDealMapper;
|
||||||
|
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||||
|
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||||
|
import com.njcn.gather.storage.service.AdNonHarmonicService;
|
||||||
|
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author chendaofei
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DetectionDataServiceImpl extends ServiceImpl<DetectionDataDealMapper, AdHarmonicResult> implements DetectionDataDealService {
|
||||||
|
|
||||||
|
private final AdNonHarmonicService adNonHarmonicService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean acceptAdNon(List<AdNonHarmonicResult> adNonHarmonicResultList,String code) {
|
||||||
|
String adNonTable = "ad_non_harmonic_";
|
||||||
|
DynamicTableNameHandler.setTableName(adNonTable +code);
|
||||||
|
adNonHarmonicService.saveBatch(adNonHarmonicResultList,100);
|
||||||
|
DynamicTableNameHandler.remove();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean acceptAd(List<AdHarmonicResult> adHarmonicResultList,String code) {
|
||||||
|
String adTable = "ad_harmonic_";
|
||||||
|
DynamicTableNameHandler.setTableName(adTable +code);
|
||||||
|
this.saveBatch(adHarmonicResultList,100);
|
||||||
|
DynamicTableNameHandler.remove();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean acceptAdNonResult(List<AdNonHarmonicResult> adNonHarmonicResultList,String code) {
|
||||||
|
String adNonTableResult = "ad_non_harmonic_";
|
||||||
|
DynamicTableNameHandler.setTableName(adNonTableResult +code);
|
||||||
|
adNonHarmonicService.saveBatch(adNonHarmonicResultList,100);
|
||||||
|
DynamicTableNameHandler.remove();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean acceptAdResult(List<AdHarmonicResult> adHarmonicResultList,String code) {
|
||||||
|
String adTableResult = "ad_harmonic_";
|
||||||
|
DynamicTableNameHandler.setTableName(adTableResult +code);
|
||||||
|
this.saveBatch(adHarmonicResultList,100);
|
||||||
|
DynamicTableNameHandler.remove();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package com.njcn.gather.storage.service.impl;
|
||||||
|
|
||||||
|
import com.njcn.gather.storage.mapper.TableGenMapper;
|
||||||
|
import com.njcn.gather.storage.service.TableGenService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TableGenServiceImpl implements TableGenService {
|
||||||
|
|
||||||
|
private final TableGenMapper tableGenMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void genAdNonHarmonicTable(String code) {
|
||||||
|
//TODO 判断是否存在该表
|
||||||
|
tableGenMapper.genAdNonHarmonicTable(code);
|
||||||
|
tableGenMapper.genAdNonHarmonicResultTable(code);
|
||||||
|
|
||||||
|
//TODO 判断是否存在该表
|
||||||
|
|
||||||
|
StringBuilder A = new StringBuilder();
|
||||||
|
StringBuilder B = new StringBuilder();
|
||||||
|
StringBuilder C = new StringBuilder();
|
||||||
|
for(int i=1;i<=50;i++){
|
||||||
|
if(i == 1){
|
||||||
|
A.append("A_Value_").append(i).append(" FLOAT NOT NULL COMMENT 'A相基波',");
|
||||||
|
B.append("B_Value_").append(i).append(" FLOAT NOT NULL COMMENT 'B相基波',");
|
||||||
|
C.append("C_Value_").append(i).append(" FLOAT NOT NULL COMMENT 'C相基波',");
|
||||||
|
}else {
|
||||||
|
A.append("A_Value_").append(i).append(" FLOAT NOT NULL COMMENT '").append(i).append("次A相谐波',");
|
||||||
|
B.append("B_Value_").append(i).append(" FLOAT NOT NULL COMMENT '").append(i).append("次B相谐波',");
|
||||||
|
C.append("C_Value_").append(i).append(" FLOAT NOT NULL COMMENT '").append(i).append("次C相谐波',");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String sql = "CREATE TABLE AD_Harmonic_"+code+" (\n" +
|
||||||
|
" Monitor_Id CHAR(32) NOT NULL COMMENT '监测点Id',\n" +
|
||||||
|
" Time_Id DATETIME NOT NULL COMMENT '时间',\n" +
|
||||||
|
" Script_Dtls_Id CHAR(32) NOT NULL COMMENT '检测脚本子表Id,字典表',\n" +
|
||||||
|
" AD_Type CHAR(32) NOT NULL COMMENT '检测指标,字典表',\n" +
|
||||||
|
" Data_Type CHAR(32) NOT NULL COMMENT '数据指标,只有数据源为分钟统计时候才会使用(最大、最小、平均、CP95,默认平均值),字典表',\n" +
|
||||||
|
A+B+C+
|
||||||
|
" PRIMARY KEY (Monitor_Id, Time_Id, Script_Dtls_Id, AD_Type, Data_Type)\n" +
|
||||||
|
") COMMENT='监测数据表';";
|
||||||
|
tableGenMapper.genAdHarmonicTable(sql);
|
||||||
|
|
||||||
|
String sql2 = "CREATE TABLE AD_Harmonic_Result_"+code+" (\n" +
|
||||||
|
" Monitor_Id CHAR(32) NOT NULL COMMENT '监测点Id',\n" +
|
||||||
|
" Time_Id DATETIME NOT NULL COMMENT '时间',\n" +
|
||||||
|
" Script_Dtls_Id CHAR(32) NOT NULL COMMENT '检测脚本子表Id,字典表',\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_Dtls_Id, AD_Type, Data_Type)\n" +
|
||||||
|
") COMMENT='监测数据表';";
|
||||||
|
tableGenMapper.genAdHarmonicTable(sql2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.njcn.gather.storage;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class StorageApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user