Compare commits
6 Commits
37f0dbe548
...
69f911c07c
Author | SHA1 | Date | |
---|---|---|---|
|
69f911c07c | ||
|
5e8110ad2c | ||
|
7e3e028eb0 | ||
|
ff63c194ee | ||
|
1798ba8d1d | ||
|
652812d3ba |
@ -182,41 +182,6 @@ public class Main {
|
||||
return day;
|
||||
}
|
||||
|
||||
private static List<FluxTable> query(QueryDataParam param,InfluxDBClient influxDBClient){
|
||||
String measurement = param.getMeasurement();
|
||||
List<String> dropedTagName = param.getDropedTagNames();
|
||||
Range range = param.getRange();
|
||||
String bucket = param.getBucket();
|
||||
String tagName = param.getTag().getTagName();
|
||||
String tagValue = param.getTag().getTagValue();
|
||||
PageInfo pageInfo = param.getPageInfo();
|
||||
|
||||
String flux = "from(bucket:\""+bucket+"\")";
|
||||
flux += "|> range(start: "+range.getBegin().toString()+",stop:"+range.getEnd().toString()+") \n";
|
||||
flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\") \n";
|
||||
flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\") \n";
|
||||
for(String dropName:dropedTagName){
|
||||
flux += "|> drop(columns: [\""+ dropName +"\"]) \n";
|
||||
}
|
||||
flux += "|> sort(columns: [\"_time\"], desc: true) \n";
|
||||
flux += "|> window(every: 1y) \n";
|
||||
if(pageInfo!=null){
|
||||
flux += "|> limit(n: "+pageInfo.getSize()+", offset: "+(pageInfo.getCurrent()-1)* pageInfo.getSize()+")";
|
||||
}
|
||||
|
||||
QueryApi queryApi = influxDBClient.getQueryApi();
|
||||
|
||||
List<FluxTable> tables = queryApi.query(flux);
|
||||
for (FluxTable fluxTable : tables) {
|
||||
List<FluxRecord> records = fluxTable.getRecords();
|
||||
for (FluxRecord fluxRecord : records) {
|
||||
System.out.println("time: "+fluxRecord.getTime() +" key:"+fluxRecord.getField()+" value: " + fluxRecord.getValueByKey("_value")+" measurement: " + fluxRecord.getMeasurement());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return tables;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
package com.cnbm.influx.config;
|
||||
|
||||
import com.cnbm.influx.constant.Constant;
|
||||
import com.cnbm.influx.param.PageInfo;
|
||||
import com.cnbm.influx.param.QueryDataGroupByTimeParam;
|
||||
import com.cnbm.influx.param.QueryDataParam;
|
||||
import com.cnbm.influx.param.Range;
|
||||
import com.cnbm.influx.param.*;
|
||||
import com.cnbm.influx.template.Event;
|
||||
import com.influxdb.client.InfluxDBClient;
|
||||
import com.influxdb.client.InfluxDBClientFactory;
|
||||
@ -141,6 +138,7 @@ public enum InfluxClient {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<FluxTable> query(QueryDataParam param){
|
||||
String measurement = param.getMeasurement();
|
||||
List<String> dropedTagNames = param.getDropedTagNames();
|
||||
@ -152,10 +150,12 @@ public enum InfluxClient {
|
||||
flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
|
||||
flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")";
|
||||
|
||||
if(param.getTag()!=null){
|
||||
String tagName = param.getTag().getTagName();
|
||||
String tagValue = param.getTag().getTagValue();
|
||||
flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
|
||||
if(param.getTags()!=null && param.getTags().size()>0){
|
||||
for(Tag tag:param.getTags()){
|
||||
String tagName = tag.getTagName();
|
||||
String tagValue = tag.getTagValue();
|
||||
flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
|
||||
}
|
||||
}
|
||||
|
||||
//调整时区,查询出的结果 +8个小时
|
||||
@ -177,16 +177,28 @@ public enum InfluxClient {
|
||||
List<String> dropedTagNames = param.getDropedTagNames();
|
||||
Range range = param.getRange();
|
||||
String bucket = param.getBucket();
|
||||
String tagName = param.getTag().getTagName();
|
||||
String tagValue = param.getTag().getTagValue();
|
||||
|
||||
|
||||
|
||||
String groupName = param.getGroupName();
|
||||
PageInfo pageInfo = param.getPageInfo();
|
||||
|
||||
String flux = "from(bucket:\""+bucket+"\")";
|
||||
flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
|
||||
flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")";
|
||||
flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
|
||||
flux += "|> timeShift(duration: 8h)";
|
||||
|
||||
// String tagName = param.getTag().getTagName();
|
||||
// String tagValue = param.getTag().getTagValue();
|
||||
// flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
|
||||
if(param.getTags()!=null && param.getTags().size()>0){
|
||||
for(Tag tag:param.getTags()){
|
||||
String tagName = tag.getTagName();
|
||||
String tagValue = tag.getTagValue();
|
||||
flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
|
||||
}
|
||||
}
|
||||
|
||||
// flux += "|> timeShift(duration: 8h)";
|
||||
flux += "|> group(columns: [\""+groupName+"\"], mode: \"except\")";
|
||||
for(String dropName:dropedTagNames){
|
||||
flux += "|> drop(columns: [\""+dropName+"\"])";
|
||||
@ -203,15 +215,25 @@ public enum InfluxClient {
|
||||
List<String> dropedTagNames = param.getDropedTagNames();
|
||||
Range range = param.getRange();
|
||||
String bucket = param.getBucket();
|
||||
String tagName = param.getTag().getTagName();
|
||||
String tagValue = param.getTag().getTagValue();
|
||||
|
||||
PageInfo pageInfo = param.getPageInfo();
|
||||
|
||||
String flux = "from(bucket:\""+bucket+"\")";
|
||||
flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
|
||||
flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")";
|
||||
flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
|
||||
flux += "|> timeShift(duration: 8h)";
|
||||
|
||||
// String tagName = param.getTag().getTagName();
|
||||
// String tagValue = param.getTag().getTagValue();
|
||||
// flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
|
||||
// flux += "|> timeShift(duration: 8h)";
|
||||
if(param.getTags()!=null && param.getTags().size()>0){
|
||||
for(Tag tag:param.getTags()){
|
||||
String tagName = tag.getTagName();
|
||||
String tagValue = tag.getTagValue();
|
||||
flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
|
||||
}
|
||||
}
|
||||
|
||||
for(String dropName:dropedTagNames){
|
||||
flux += "|> drop(columns: [\""+dropName+"\"])";
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import com.influxdb.query.FluxTable;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -69,7 +70,7 @@ public class Main {
|
||||
dropNames.add("transationId");
|
||||
dropNames.add("inspectionSheetId");
|
||||
queryDataParam.setDropedTagNames(dropNames);
|
||||
queryDataParam.setTag(new Tag("argName","forUpdate"));
|
||||
queryDataParam.setTags(Arrays.asList(new Tag("argName","forUpdate")));
|
||||
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(),DataUtils.getAfterDate(999).toInstant()));
|
||||
queryDataParam.setPageInfo(new PageInfo(1,10));
|
||||
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.cnbm.influx.controller;
|
||||
|
||||
import com.cnbm.common.spc.util.DataUtils;
|
||||
import com.cnbm.common.utils.Result;
|
||||
import com.cnbm.influx.config.InfluxClient;
|
||||
import com.cnbm.influx.constant.Constant;
|
||||
import com.cnbm.influx.param.PageInfo;
|
||||
@ -15,14 +16,12 @@ import com.influxdb.query.FluxTable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
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 java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/influx")
|
||||
@ -30,9 +29,9 @@ public class S7DemoController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(S7DemoController.class);
|
||||
|
||||
|
||||
//for 常规计量型
|
||||
@PostMapping("/insertDemoDataForMetering")
|
||||
public void insertDemoDataForMetering() throws InterruptedException {
|
||||
//for 常规计数型
|
||||
@PostMapping("/insertDemoDataForCount")
|
||||
public void insertDemoDataForCount() throws InterruptedException {
|
||||
List<Event> list = new ArrayList<>();
|
||||
Random r = new Random();
|
||||
|
||||
@ -54,54 +53,117 @@ public class S7DemoController {
|
||||
InfluxClient.Client.batchInsert(list,"Weight");
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
long l1 = System.currentTimeMillis();
|
||||
System.out.println(l1);
|
||||
Date date = new Date(l1);
|
||||
Thread.sleep(1000);
|
||||
Date date2 = new Date(l1);
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
@PostMapping("/insertDemoOne")
|
||||
public void insertDemoOne() throws InterruptedException {
|
||||
List<Event> list = new ArrayList<>();
|
||||
Random r = new Random();
|
||||
Thread.sleep(10);
|
||||
Instant time = new Date().toInstant();
|
||||
Event event = new Event();
|
||||
event.setTime(time);
|
||||
|
||||
|
||||
Event event = new Event();
|
||||
event.setTime(new Date(1670554110451L).toInstant());
|
||||
event.setArgName("failDayDay");
|
||||
event.setArgValue("1");
|
||||
event.setArgValue("30089");
|
||||
event.setSampleNumber("10001");
|
||||
list.add(event);
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
Event event2 = new Event();
|
||||
event2.setTime(time);
|
||||
|
||||
event2.setTime(new Date(1670555006702L).toInstant());
|
||||
event2.setArgName("failDayDay");
|
||||
event2.setArgValue("2");
|
||||
event2.setArgValue("40088");
|
||||
event2.setSampleNumber("10001");
|
||||
list.add(event2);
|
||||
|
||||
InfluxClient.Client.batchInsert(list,"Weight");
|
||||
|
||||
// Thread.sleep(10000);
|
||||
//
|
||||
// List<Event> list2 = new ArrayList<>();
|
||||
// Event event2 = new Event();
|
||||
// event2.setTime(time);
|
||||
//
|
||||
// event2.setArgName("failDayDay");
|
||||
// event2.setArgValue("20087");
|
||||
// event2.setSampleNumber("10001");
|
||||
// list2.add(event2);
|
||||
//
|
||||
// InfluxClient.Client.batchInsert(list2,"Weight");
|
||||
}
|
||||
@PostMapping("/readDemoOne")
|
||||
public void readDemoOne() throws InterruptedException {
|
||||
List<String> dropNames = new ArrayList<>();
|
||||
dropNames.add("transationId");
|
||||
// dropNames.add("inspectionSheetId");
|
||||
// dropNames.add("batchNum");
|
||||
|
||||
QueryDataParam queryDataParam = new QueryDataParam();
|
||||
queryDataParam.setMeasurement("PID2");
|
||||
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(), DataUtils.getAfterDate(999).toInstant() ));
|
||||
|
||||
queryDataParam.setDropedTagNames(dropNames);
|
||||
queryDataParam.setTags(Arrays.asList(new Tag("argName","LTWeight"),new Tag("inspectionSheetId","1601123134690340865")));
|
||||
queryDataParam.setBucket(Constant.bucket);
|
||||
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/getFlux")
|
||||
public Result<Instant> getFlux() throws InterruptedException {
|
||||
List<String> dropNames = new ArrayList<>();
|
||||
dropNames.add("transationId");
|
||||
dropNames.add("inspectionSheetId");
|
||||
dropNames.add("batchNum");
|
||||
// dropNames.add("batchNum");
|
||||
|
||||
QueryDataParam queryDataParam = new QueryDataParam();
|
||||
queryDataParam.setMeasurement(Constant.measurement);
|
||||
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(), DataUtils.getAfterDate(999).toInstant() ));
|
||||
|
||||
queryDataParam.setDropedTagNames(dropNames);
|
||||
queryDataParam.setTag(new Tag("argName","failDayDay"));
|
||||
queryDataParam.setTags(Arrays.asList(new Tag("argName","failDayDay")));
|
||||
queryDataParam.setBucket(Constant.bucket);
|
||||
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
|
||||
Instant time = query.get(0).getRecords().get(0).getTime();
|
||||
return new Result<Instant>().ok(time);
|
||||
}
|
||||
|
||||
@PostMapping("/saveFlux1")
|
||||
public Result<Instant> saveFlux1() throws InterruptedException {
|
||||
|
||||
List<Event> list = new ArrayList<>();
|
||||
Event event2 = new Event();
|
||||
Instant instant = new Date().toInstant();
|
||||
event2.setTime(instant);
|
||||
event2.setArgName("failDayDay");
|
||||
event2.setArgValue("");
|
||||
event2.setSampleNumber("10001");
|
||||
list.add(event2);
|
||||
InfluxClient.Client.batchInsert(list,"Weight");
|
||||
return new Result<Instant>().ok(instant);
|
||||
}
|
||||
@PostMapping("/saveFlux2")
|
||||
public void saveFlux2(@RequestBody TIMETest timeTest) throws InterruptedException {
|
||||
|
||||
List<Event> list = new ArrayList<>();
|
||||
Event event2 = new Event();
|
||||
event2.setTime(timeTest.getTime2());
|
||||
event2.setArgName("failDayDay");
|
||||
event2.setArgValue("40091");
|
||||
event2.setSampleNumber("10001");
|
||||
list.add(event2);
|
||||
InfluxClient.Client.batchInsert(list,"Weight");
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
|
||||
//for 常规计数型
|
||||
@PostMapping("/insertDemoDataForCount")
|
||||
public void insertDemoDataForCount() throws InterruptedException {
|
||||
//for 常规计量型
|
||||
@PostMapping("/insertDemoDataForMetering")
|
||||
public void insertDemoDataForMetering() throws InterruptedException {
|
||||
List<Event> list = new ArrayList<>();
|
||||
Random r = new Random();
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.cnbm.influx.controller;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* @Desc: ""
|
||||
* @Author: caixiang
|
||||
* @DATE: 2022/12/9 15:53
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "检验样本 DTO对象")
|
||||
public class TIMETest {
|
||||
@ApiModelProperty(value = "时间2")
|
||||
private Instant time2;
|
||||
|
||||
}
|
@ -25,7 +25,8 @@ import java.util.List;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class QueryDataGroupByTimeParam extends BaseParam{
|
||||
private Tag tag;
|
||||
|
||||
private List<Tag> tags;
|
||||
//查询的时候,需要忽略的字段。(transationId是唯一标识会对 最终的查询结果集产生影响)
|
||||
private List<String> dropedTagNames;
|
||||
private String bucket;
|
||||
|
@ -25,8 +25,9 @@ import java.util.List;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class QueryDataParam extends BaseParam{
|
||||
//如果tag不传,就是查询所有
|
||||
private Tag tag;
|
||||
//如果tag不传,就是查询所有, 多条件查询influxdb数据
|
||||
private List<Tag> tags;
|
||||
//private Tag tag;
|
||||
//查询的时候,需要忽略的字段。(transationId是唯一标识会对 最终的查询结果集产生影响)
|
||||
private List<String> dropedTagNames;
|
||||
private String bucket;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.cnbm.processInspection.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import com.cnbm.admin.annotation.LogOperation;
|
||||
import com.cnbm.basic.dto.FeaturesProcedureDTO;
|
||||
|
||||
import com.cnbm.basic.dto.ProductFeaturesDTO;
|
||||
import com.cnbm.common.constant.Constant;
|
||||
import com.cnbm.common.page.PageData;
|
||||
@ -13,9 +13,10 @@ import com.cnbm.common.validator.ValidatorUtils;
|
||||
import com.cnbm.common.validator.group.AddGroup;
|
||||
import com.cnbm.common.validator.group.DefaultGroup;
|
||||
import com.cnbm.common.validator.group.UpdateGroup;
|
||||
import com.cnbm.influx.param.QueryDataParam;
|
||||
import com.cnbm.influx.template.Event;
|
||||
|
||||
|
||||
import com.cnbm.processInspection.dto.InspectionSampleDTO;
|
||||
import com.cnbm.processInspection.dto.InspectionSampleDTO2;
|
||||
import com.cnbm.processInspection.dto.InspectionSheetDTO;
|
||||
import com.cnbm.processInspection.entity.InspectionSheet;
|
||||
import com.cnbm.processInspection.excel.InspectionSheetExcel;
|
||||
@ -184,6 +185,17 @@ public class InspectionSheetController {
|
||||
return new Result();
|
||||
}
|
||||
|
||||
@PostMapping("saveFluxParamList2")
|
||||
@ApiOperation("将样本检测参数写入influxdb2")
|
||||
public Result saveFluxParamList2(@RequestBody InspectionSampleDTO2[] lists) throws InterruptedException{
|
||||
|
||||
inspectionSheetService.saveFluxParamList2(lists);
|
||||
Thread.sleep(1000);
|
||||
//样本数据更新后 计算检验单缺陷数不良数
|
||||
inspectionSheetService.calculate(Long.valueOf(lists[0].getInspectionSheetId()));
|
||||
return new Result();
|
||||
}
|
||||
|
||||
@PostMapping("getInspectionSheetFeaturesList")
|
||||
@ApiOperation("获取检验单对应检验属性")
|
||||
@ApiImplicitParams({
|
||||
|
@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@ -116,6 +117,7 @@ public class ProcessInspectionController {
|
||||
|
||||
return R.ok("成功",xbarSGraphData);
|
||||
}
|
||||
|
||||
@PostMapping("/XMRGraphTest")
|
||||
public R<XMRGraphData> XMRGraphTest() throws Exception {
|
||||
ProductFeatures productFeatures = new ProductFeatures();
|
||||
@ -147,7 +149,6 @@ public class ProcessInspectionController {
|
||||
(xmrGraph.getXigma()==null||xmrGraph.getTotalXigma()==null)?null:new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma())
|
||||
|
||||
);
|
||||
|
||||
return R.ok("成功",xmrGraphData);
|
||||
}
|
||||
|
||||
@ -172,7 +173,9 @@ public class ProcessInspectionController {
|
||||
dropNames.add("inspectionSheetId");
|
||||
dropNames.add("argName");
|
||||
queryDataParam.setDropedTagNames(dropNames);
|
||||
queryDataParam.setTag(new Tag("argName","LTWeight"));
|
||||
|
||||
queryDataParam.setTags(Arrays.asList(new Tag("argName","LTWeight")));
|
||||
|
||||
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(100).toInstant(),Instant.now()));
|
||||
// queryDataParam.setPageInfo(new PageInfo(1,10));
|
||||
List<FluxTable> query = InfluxClient.Client.queryByGroup(queryDataParam);
|
||||
|
@ -0,0 +1,40 @@
|
||||
package com.cnbm.processInspection.dto;
|
||||
|
||||
import com.cnbm.influx.template.Event;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验样本 表
|
||||
*
|
||||
* @author yanyang
|
||||
* @since 2022-11-24
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "检验样本 DTO对象")
|
||||
public class InspectionSampleDTO2 implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "工序名称,关联working_procedure表")
|
||||
private String workingProcedureName;
|
||||
|
||||
@ApiModelProperty(value = "检验单id")
|
||||
private String inspectionSheetId;
|
||||
|
||||
@ApiModelProperty(value = "检验参数")
|
||||
private List<Event> events;
|
||||
|
||||
@ApiModelProperty(value = "批次号")
|
||||
private String batchNum;
|
||||
|
||||
@ApiModelProperty(value = "取样时间")
|
||||
private Instant sampleTime;
|
||||
|
||||
@ApiModelProperty(value = "样本号")
|
||||
private String sampleNumber;
|
||||
|
||||
}
|
@ -15,6 +15,7 @@ import com.influxdb.query.FluxTable;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -104,9 +105,9 @@ public class CGraph {
|
||||
List<String> dropNames = new ArrayList<>();
|
||||
dropNames.add("transationId");
|
||||
dropNames.add("inspectionSheetId");
|
||||
dropNames.add("batchNum");
|
||||
// dropNames.add("batchNum");
|
||||
queryDataParam.setDropedTagNames(dropNames);
|
||||
queryDataParam.setTag(new Tag("argName",argName));
|
||||
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
|
||||
|
||||
List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
|
||||
//1. 先从fluxdb 里面提取原始数据
|
||||
|
@ -12,6 +12,7 @@ import com.influxdb.query.FluxTable;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -96,10 +97,10 @@ public class NPGraph {
|
||||
List<String> dropNames = new ArrayList<>();
|
||||
dropNames.add("transationId");
|
||||
dropNames.add("inspectionSheetId");
|
||||
dropNames.add("batchNum");
|
||||
//dropNames.add("batchNum");
|
||||
queryDataParam.setDropedTagNames(dropNames);
|
||||
queryDataParam.setTag(new Tag("argName",argName));
|
||||
|
||||
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
|
||||
List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
|
||||
//1. 先从fluxdb 里面提取原始数据
|
||||
List<Double> originData = new ArrayList<>();
|
||||
|
@ -15,6 +15,7 @@ import com.influxdb.query.FluxTable;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -109,9 +110,9 @@ public class PGraph {
|
||||
List<String> dropNames = new ArrayList<>();
|
||||
dropNames.add("transationId");
|
||||
dropNames.add("inspectionSheetId");
|
||||
dropNames.add("batchNum");
|
||||
//dropNames.add("batchNum");
|
||||
queryDataParam.setDropedTagNames(dropNames);
|
||||
queryDataParam.setTag(new Tag("argName",argName));
|
||||
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
|
||||
|
||||
List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
|
||||
//1. 先从fluxdb 里面提取原始数据
|
||||
|
@ -15,6 +15,7 @@ import com.influxdb.query.FluxTable;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -108,10 +109,10 @@ public class UGraph {
|
||||
List<String> dropNames = new ArrayList<>();
|
||||
dropNames.add("transationId");
|
||||
dropNames.add("inspectionSheetId");
|
||||
dropNames.add("batchNum");
|
||||
//dropNames.add("batchNum");
|
||||
queryDataParam.setDropedTagNames(dropNames);
|
||||
queryDataParam.setTag(new Tag("argName",argName));
|
||||
|
||||
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
|
||||
List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
|
||||
//1. 先从fluxdb 里面提取原始数据
|
||||
//计算p bar
|
||||
|
@ -17,6 +17,7 @@ import com.influxdb.query.FluxTable;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -102,9 +103,9 @@ public class MeanRGraph {
|
||||
List<String> dropNames = new ArrayList<>();
|
||||
dropNames.add("transationId");
|
||||
dropNames.add("inspectionSheetId");
|
||||
dropNames.add("batchNum");
|
||||
//dropNames.add("batchNum");
|
||||
queryDataParam.setDropedTagNames(dropNames);
|
||||
queryDataParam.setTag(new Tag("argName",argName));
|
||||
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
|
||||
|
||||
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
|
||||
if(query.size() == 0){
|
||||
|
@ -18,6 +18,7 @@ import com.influxdb.query.FluxTable;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -99,9 +100,9 @@ public class MeanStandardDeviationGraph {
|
||||
List<String> dropNames = new ArrayList<>();
|
||||
dropNames.add("transationId");
|
||||
dropNames.add("inspectionSheetId");
|
||||
dropNames.add("batchNum");
|
||||
//dropNames.add("batchNum");
|
||||
queryDataParam.setDropedTagNames(dropNames);
|
||||
queryDataParam.setTag(new Tag("argName",argName));
|
||||
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
|
||||
|
||||
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
|
||||
//1. 先从fluxdb 里面提取原始数据
|
||||
|
@ -15,6 +15,7 @@ import com.influxdb.query.FluxTable;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
@ -96,9 +97,9 @@ public class XMRGraph {
|
||||
List<String> dropNames = new ArrayList<>();
|
||||
dropNames.add("transationId");
|
||||
dropNames.add("inspectionSheetId");
|
||||
dropNames.add("batchNum");
|
||||
//dropNames.add("batchNum");
|
||||
queryDataParam.setDropedTagNames(dropNames);
|
||||
queryDataParam.setTag(new Tag("argName",argName));
|
||||
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
|
||||
|
||||
|
||||
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
|
||||
|
@ -7,6 +7,7 @@ import com.cnbm.common.service.CrudService;
|
||||
import com.cnbm.influx.param.QueryDataParam;
|
||||
import com.cnbm.influx.template.Event;
|
||||
import com.cnbm.processInspection.dto.InspectionSampleDTO;
|
||||
import com.cnbm.processInspection.dto.InspectionSampleDTO2;
|
||||
import com.cnbm.processInspection.dto.InspectionSheetDTO;
|
||||
import com.cnbm.processInspection.entity.InspectionSheet;
|
||||
import com.influxdb.query.FluxTable;
|
||||
@ -38,7 +39,7 @@ public interface IInspectionSheetService extends CrudService<InspectionSheet, In
|
||||
List<InspectionSampleDTO> getFluxParamList(Long inspectionSheetId);
|
||||
|
||||
void saveFluxParamList(InspectionSampleDTO[] lists);
|
||||
|
||||
void saveFluxParamList2(InspectionSampleDTO2[] lists);
|
||||
List<ProductFeaturesDTO> getInspectionSheetFeaturesList(Map<String, Object> params);
|
||||
|
||||
void calculate(Long inspectionSheetId);
|
||||
|
@ -22,14 +22,15 @@ import com.cnbm.influx.config.InfluxClient;
|
||||
import com.cnbm.influx.param.PageInfo;
|
||||
import com.cnbm.influx.param.QueryDataParam;
|
||||
import com.cnbm.influx.param.Range;
|
||||
|
||||
import com.cnbm.influx.param.Tag;
|
||||
import com.cnbm.influx.template.Event;
|
||||
import com.cnbm.processInspection.dto.InspectionSampleDTO;
|
||||
import com.cnbm.processInspection.dto.InspectionSampleDTO2;
|
||||
import com.cnbm.processInspection.dto.InspectionSheetDTO;
|
||||
import com.cnbm.processInspection.entity.InspectionSheet;
|
||||
import com.cnbm.processInspection.mapper.InspectionSheetMapper;
|
||||
import com.cnbm.processInspection.service.IInspectionSheetService;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.influxdb.query.FluxRecord;
|
||||
import com.influxdb.query.FluxTable;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -209,7 +210,7 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
|
||||
queryDataParam.setMeasurement(workingProcedureName);
|
||||
//queryDataParam.setInspectionSheetId(inspectionSheetId);
|
||||
queryDataParam.setBucket("qgs-bucket");
|
||||
queryDataParam.setTag(new Tag("inspectionSheetId", inspectionSheetId));
|
||||
queryDataParam.setTags(Arrays.asList(new Tag("inspectionSheetId", inspectionSheetId)));
|
||||
List<String> dropNames = new ArrayList<>();
|
||||
dropNames.add("transationId");
|
||||
queryDataParam.setDropedTagNames(dropNames);
|
||||
@ -290,6 +291,24 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
|
||||
// calculate(Long.valueOf(lists[0].getInspectionSheetId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveFluxParamList2(InspectionSampleDTO2[] lists){
|
||||
for (InspectionSampleDTO2 dto : lists) {
|
||||
//String jsonData = {"workingProcedureName":"test","inspectionSheetId":"116","param1":"0.47","param2":"0.687","param2":"0.53"};
|
||||
String workingProcedureName = dto.getWorkingProcedureName();
|
||||
String inspectionSheetId = dto.getInspectionSheetId();
|
||||
// String batchNum = dto.getBatchNum();
|
||||
String sampleNumber = dto.getSampleNumber();
|
||||
|
||||
// LocalDateTime sampleTime = dto.getSampleTime();
|
||||
// Instant eventTime = sampleTime.toInstant(ZoneOffset.UTC);
|
||||
InfluxClient.Client.batchInsert(dto.getEvents(), workingProcedureName);
|
||||
}
|
||||
// //样本数据更新后 计算检验单缺陷数不良数
|
||||
// System.out.println("--------------------------------------");
|
||||
// calculate(Long.valueOf(lists[0].getInspectionSheetId()));
|
||||
}
|
||||
|
||||
private Event newEvent(Instant time, String inspectionSheetId, String argName, String argValue, String sampleNo) {
|
||||
Event event = new Event();
|
||||
event.setInspectionSheetId(inspectionSheetId);
|
||||
|
@ -88,13 +88,13 @@
|
||||
LEFT JOIN product_features pf ON pf.id=fspr.product_features_id
|
||||
<where>
|
||||
pf.valid = 1 and fspr.valid = 1
|
||||
<if test="productId != null">
|
||||
<if test="productId != null and productId.trim() != ''">
|
||||
and pf.product_id = #{productId}
|
||||
</if>
|
||||
<if test="inspectionStage != null">
|
||||
<if test="inspectionStage != null and inspectionStage.trim() != ''">
|
||||
and fspr.inspection_stage = #{inspectionStage}
|
||||
</if>
|
||||
<if test="workingProcedureId != null">
|
||||
<if test="workingProcedureId != null and workingProcedureId.trim() != ''">
|
||||
and fspr.working_procedure_id = #{workingProcedureId}
|
||||
</if>
|
||||
</where>
|
||||
|
Loading…
Reference in New Issue
Block a user