更新 UTC 时间 转成 GMT+8 东八区时间
This commit is contained in:
parent
ed054a2bf2
commit
60a46c3248
21
README.md
21
README.md
@ -1,23 +1,4 @@
|
|||||||
**项目说明**
|
spc 主项目
|
||||||
- 这是根据renren框架重新修改出来的框架
|
|
||||||
- 采用SpringBoot、MyBatis、spring security框架
|
|
||||||
- 提供了代码生成器,只需编写30%左右代码,其余的代码交给系统自动生成,可快速完成开发任务
|
|
||||||
- 代码生成器是用的Velocity模版引擎,如果需要可以在ym-generator模块中进行vm模板的修改和一些包名等基础修改
|
|
||||||
<br>
|
|
||||||
|
|
||||||
**新增业务模块需要注意**
|
|
||||||
- 新增业务模块时,业务模块需要依赖ym-admin,并且ym-gateway模块maven需要依赖新建模块
|
|
||||||
- 自动生成的controller接口都带鉴权注解,如果开发阶段可以先注释掉,后面开发完成之后再把鉴权添加到数据库
|
|
||||||
<br>
|
|
||||||
|
|
||||||
**技术选型:**
|
|
||||||
- 核心框架:Spring Boot 2.7
|
|
||||||
- 安全框架:Spring Security
|
|
||||||
- 持久层框架:MyBatis 3.5
|
|
||||||
- 定时器:Quartz 2.3
|
|
||||||
- 数据库连接池:HikariCP
|
|
||||||
- 日志管理:log4j2
|
|
||||||
- 页面交互:Vue2.x
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package com.cnbm.common.spc.util;
|
package com.cnbm.common.spc.util;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -13,14 +18,18 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class DataUtils {
|
public class DataUtils {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
ArrayList<Integer> arrs = new ArrayList<>();
|
// ArrayList<Integer> arrs = new ArrayList<>();
|
||||||
|
//
|
||||||
for(int i=0;i<100;i++){
|
// for(int i=0;i<100;i++){
|
||||||
arrs.add(i);
|
// arrs.add(i);
|
||||||
}
|
// }
|
||||||
List<List<Integer>> lists = fixedGroup(arrs, 10);
|
// List<List<Integer>> lists = fixedGroup(arrs, 10);
|
||||||
System.out.println();
|
// System.out.println();
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
Instant instant1 = now.atZone(ZoneId.systemDefault()).toInstant();
|
||||||
|
Instant instant2 = now.toInstant(ZoneOffset.UTC);
|
||||||
|
Instant instant3 = StringToInstant("2024-01-22 12:00:00");
|
||||||
|
System.out.println(instant1+" - "+instant2+" - "+instant3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +55,20 @@ public class DataUtils {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
public static final Instant StringToInstant(String string) {
|
||||||
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime parse = LocalDateTime.parse(string, dateTimeFormatter);
|
||||||
|
//return parse.toInstant(ZoneOffset.UTC);
|
||||||
|
return parse.atZone(ZoneId.systemDefault()).toInstant();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static final Instant StringToInstantPlus8(String string) {
|
||||||
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||||
|
//LocalDateTime parse = LocalDateTime.parse(string, dateTimeFormatter).plusHours(8);
|
||||||
|
LocalDateTime parse = LocalDateTime.parse(string, dateTimeFormatter).minusHours(8);
|
||||||
|
return parse.toInstant(ZoneOffset.UTC);
|
||||||
|
}
|
||||||
public static String splitToNeed(String s,Integer type){
|
public static String splitToNeed(String s,Integer type){
|
||||||
String[] s1 = s.split(" ");
|
String[] s1 = s.split(" ");
|
||||||
String[] split = s1[0].split("-");
|
String[] split = s1[0].split("-");
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.cnbm.influx.config;
|
package com.cnbm.influx.config;
|
||||||
|
|
||||||
|
import com.cnbm.common.spc.util.DataUtils;
|
||||||
import com.cnbm.influx.constant.Constant;
|
import com.cnbm.influx.constant.Constant;
|
||||||
import com.cnbm.influx.param.*;
|
import com.cnbm.influx.param.*;
|
||||||
import com.cnbm.influx.template.Event;
|
import com.cnbm.influx.template.Event;
|
||||||
@ -118,6 +119,8 @@ public enum InfluxClient {
|
|||||||
.addTag("argName", event.getArgName())
|
.addTag("argName", event.getArgName())
|
||||||
.addField("argValue", event.getArgValue())
|
.addField("argValue", event.getArgValue())
|
||||||
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
|
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
|
||||||
|
//.time(DataUtils.StringToInstantPlus8(event.getTime().toString()).toEpochMilli(), WritePrecision.MS);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
point = Point.measurement(measurement)
|
point = Point.measurement(measurement)
|
||||||
.addTag("transationId", event.getTransationId()==null ? "" : event.getTransationId())
|
.addTag("transationId", event.getTransationId()==null ? "" : event.getTransationId())
|
||||||
@ -130,6 +133,7 @@ public enum InfluxClient {
|
|||||||
.addTag("argName", event.getArgName())
|
.addTag("argName", event.getArgName())
|
||||||
.addField("argValue", event.getArgValue())
|
.addField("argValue", event.getArgValue())
|
||||||
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
|
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
|
||||||
|
//.time(DataUtils.StringToInstantPlus8(event.getTime().toString()).toEpochMilli(), WritePrecision.MS);
|
||||||
}
|
}
|
||||||
list.add(point);
|
list.add(point);
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,8 @@ public class ProcessInspectionController {
|
|||||||
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
|
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
|
||||||
// queryDataParam.setMeasurement(Constant.measurement);
|
// queryDataParam.setMeasurement(Constant.measurement);
|
||||||
queryDataParam.setMeasurement(graphArg.getProcedureName());
|
queryDataParam.setMeasurement(graphArg.getProcedureName());
|
||||||
queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
|
//queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
|
||||||
|
queryDataParam.setRange(new Range( DataUtils.StringToInstant(graphArg.getBegin()) , DataUtils.StringToInstant(graphArg.getEnd()) ));
|
||||||
queryDataParam.setTimeType(graphArg.getGroupType());
|
queryDataParam.setTimeType(graphArg.getGroupType());
|
||||||
npGraph.initialDate(queryDataParam);
|
npGraph.initialDate(queryDataParam);
|
||||||
|
|
||||||
@ -310,7 +311,9 @@ public class ProcessInspectionController {
|
|||||||
QueryDataParam queryDataParam = new QueryDataParam();
|
QueryDataParam queryDataParam = new QueryDataParam();
|
||||||
// queryDataParam.setMeasurement(Constant.measurement);
|
// queryDataParam.setMeasurement(Constant.measurement);
|
||||||
queryDataParam.setMeasurement(graphArg.getProcedureName());
|
queryDataParam.setMeasurement(graphArg.getProcedureName());
|
||||||
queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant()));
|
//queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant()));
|
||||||
|
queryDataParam.setRange(new Range( DataUtils.StringToInstant(graphArg.getBegin()) , DataUtils.StringToInstant(graphArg.getEnd()) ));
|
||||||
|
|
||||||
meanStandardDeviationGraph.initialDate(queryDataParam);
|
meanStandardDeviationGraph.initialDate(queryDataParam);
|
||||||
|
|
||||||
XbarSGraphData xbarSGraphData = new XbarSGraphData(
|
XbarSGraphData xbarSGraphData = new XbarSGraphData(
|
||||||
@ -347,7 +350,8 @@ public class ProcessInspectionController {
|
|||||||
// queryDataParam.setMeasurement(Constant.measurement);
|
// queryDataParam.setMeasurement(Constant.measurement);
|
||||||
queryDataParam.setMeasurement(graphArg.getProcedureName());
|
queryDataParam.setMeasurement(graphArg.getProcedureName());
|
||||||
|
|
||||||
queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant()));
|
//queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant()));
|
||||||
|
queryDataParam.setRange(new Range( DataUtils.StringToInstant(graphArg.getBegin()) , DataUtils.StringToInstant(graphArg.getEnd()) ));
|
||||||
meanRGraph.initialDate(queryDataParam);
|
meanRGraph.initialDate(queryDataParam);
|
||||||
|
|
||||||
|
|
||||||
@ -383,7 +387,8 @@ public class ProcessInspectionController {
|
|||||||
QueryDataParam queryDataParam = new QueryDataParam();
|
QueryDataParam queryDataParam = new QueryDataParam();
|
||||||
// queryDataParam.setMeasurement(Constant.measurement);
|
// queryDataParam.setMeasurement(Constant.measurement);
|
||||||
queryDataParam.setMeasurement(graphArg.getProcedureName());
|
queryDataParam.setMeasurement(graphArg.getProcedureName());
|
||||||
queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant()));
|
//queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant()));
|
||||||
|
queryDataParam.setRange(new Range( DataUtils.StringToInstant(graphArg.getBegin()) , DataUtils.StringToInstant(graphArg.getEnd()) ));
|
||||||
xmrGraph.initialDate(queryDataParam);
|
xmrGraph.initialDate(queryDataParam);
|
||||||
|
|
||||||
XMRGraphData xmrGraphData = new XMRGraphData(
|
XMRGraphData xmrGraphData = new XMRGraphData(
|
||||||
@ -413,7 +418,8 @@ public class ProcessInspectionController {
|
|||||||
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
|
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
|
||||||
// queryDataParam.setMeasurement(Constant.measurement);
|
// queryDataParam.setMeasurement(Constant.measurement);
|
||||||
queryDataParam.setMeasurement(graphArg.getProcedureName());
|
queryDataParam.setMeasurement(graphArg.getProcedureName());
|
||||||
queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
|
//queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
|
||||||
|
queryDataParam.setRange(new Range( DataUtils.StringToInstant(graphArg.getBegin()) , DataUtils.StringToInstant(graphArg.getEnd()) ));
|
||||||
queryDataParam.setTimeType(graphArg.getGroupType());
|
queryDataParam.setTimeType(graphArg.getGroupType());
|
||||||
pGraph.initialDate(queryDataParam);
|
pGraph.initialDate(queryDataParam);
|
||||||
|
|
||||||
@ -435,7 +441,8 @@ public class ProcessInspectionController {
|
|||||||
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
|
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
|
||||||
// queryDataParam.setMeasurement(Constant.measurement);
|
// queryDataParam.setMeasurement(Constant.measurement);
|
||||||
queryDataParam.setMeasurement(graphArg.getProcedureName());
|
queryDataParam.setMeasurement(graphArg.getProcedureName());
|
||||||
queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
|
//queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
|
||||||
|
queryDataParam.setRange(new Range( DataUtils.StringToInstant(graphArg.getBegin()) , DataUtils.StringToInstant(graphArg.getEnd()) ));
|
||||||
queryDataParam.setTimeType(graphArg.getGroupType());
|
queryDataParam.setTimeType(graphArg.getGroupType());
|
||||||
cGraph.initialDate(queryDataParam);
|
cGraph.initialDate(queryDataParam);
|
||||||
|
|
||||||
@ -458,7 +465,8 @@ public class ProcessInspectionController {
|
|||||||
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
|
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
|
||||||
// queryDataParam.setMeasurement(Constant.measurement);
|
// queryDataParam.setMeasurement(Constant.measurement);
|
||||||
queryDataParam.setMeasurement(graphArg.getProcedureName());
|
queryDataParam.setMeasurement(graphArg.getProcedureName());
|
||||||
queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
|
//queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
|
||||||
|
queryDataParam.setRange(new Range( DataUtils.StringToInstant(graphArg.getBegin()) , DataUtils.StringToInstant(graphArg.getEnd()) ));
|
||||||
queryDataParam.setTimeType(graphArg.getGroupType());
|
queryDataParam.setTimeType(graphArg.getGroupType());
|
||||||
uGraph.initialDate(queryDataParam);
|
uGraph.initialDate(queryDataParam);
|
||||||
|
|
||||||
|
@ -23,15 +23,25 @@ public class GraphArg {
|
|||||||
@NotNull(message = "检验特性Id 不能为空")
|
@NotNull(message = "检验特性Id 不能为空")
|
||||||
private Long productFeaturesId;
|
private Long productFeaturesId;
|
||||||
|
|
||||||
|
// @ApiModelProperty(value = "查询时间段,开始")
|
||||||
|
// @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
|
||||||
|
// @NotNull(message = "时间段,开始 不能为空")
|
||||||
|
// private Date begin;
|
||||||
|
//
|
||||||
|
// @ApiModelProperty(value = "查询时间段,结束")
|
||||||
|
// @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
|
||||||
|
// @NotNull(message = "时间段,结束 不能为空")
|
||||||
|
// private Date end;
|
||||||
|
|
||||||
@ApiModelProperty(value = "查询时间段,开始")
|
@ApiModelProperty(value = "查询时间段,开始")
|
||||||
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
|
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
@NotNull(message = "时间段,开始 不能为空")
|
@NotNull(message = "时间段,开始 不能为空")
|
||||||
private Date begin;
|
private String begin;
|
||||||
|
|
||||||
@ApiModelProperty(value = "查询时间段,结束")
|
@ApiModelProperty(value = "查询时间段,结束")
|
||||||
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
|
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
@NotNull(message = "时间段,结束 不能为空")
|
@NotNull(message = "时间段,结束 不能为空")
|
||||||
private Date end;
|
private String end;
|
||||||
|
|
||||||
@ApiModelProperty(value = "判读方案列表,只用于 计量型")
|
@ApiModelProperty(value = "判读方案列表,只用于 计量型")
|
||||||
private List<InterpretationListArg> interpretationScheme;
|
private List<InterpretationListArg> interpretationScheme;
|
||||||
|
Loading…
Reference in New Issue
Block a user