diff --git a/README.md b/README.md index 185a4bd..f499a4e 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,4 @@ -**项目说明** -- 这是根据renren框架重新修改出来的框架 -- 采用SpringBoot、MyBatis、spring security框架 -- 提供了代码生成器,只需编写30%左右代码,其余的代码交给系统自动生成,可快速完成开发任务 -- 代码生成器是用的Velocity模版引擎,如果需要可以在ym-generator模块中进行vm模板的修改和一些包名等基础修改 -
- -**新增业务模块需要注意** -- 新增业务模块时,业务模块需要依赖ym-admin,并且ym-gateway模块maven需要依赖新建模块 -- 自动生成的controller接口都带鉴权注解,如果开发阶段可以先注释掉,后面开发完成之后再把鉴权添加到数据库 -
- -**技术选型:** -- 核心框架:Spring Boot 2.7 -- 安全框架:Spring Security -- 持久层框架:MyBatis 3.5 -- 定时器:Quartz 2.3 -- 数据库连接池:HikariCP -- 日志管理:log4j2 -- 页面交互:Vue2.x +spc 主项目
diff --git a/ym-common/src/main/java/com/cnbm/common/spc/util/DataUtils.java b/ym-common/src/main/java/com/cnbm/common/spc/util/DataUtils.java index 4f64b95..9b4886f 100644 --- a/ym-common/src/main/java/com/cnbm/common/spc/util/DataUtils.java +++ b/ym-common/src/main/java/com/cnbm/common/spc/util/DataUtils.java @@ -1,6 +1,11 @@ package com.cnbm.common.spc.util; 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.Calendar; import java.util.Date; @@ -13,14 +18,18 @@ import java.util.List; */ public class DataUtils { public static void main(String[] args) { - ArrayList arrs = new ArrayList<>(); - - for(int i=0;i<100;i++){ - arrs.add(i); - } - List> lists = fixedGroup(arrs, 10); - System.out.println(); - +// ArrayList arrs = new ArrayList<>(); +// +// for(int i=0;i<100;i++){ +// arrs.add(i); +// } +// List> lists = fixedGroup(arrs, 10); +// 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; } + 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){ String[] s1 = s.split(" "); String[] split = s1[0].split("-"); diff --git a/ym-influx/src/main/java/com/cnbm/influx/config/InfluxClient.java b/ym-influx/src/main/java/com/cnbm/influx/config/InfluxClient.java index d5a3032..b8390fa 100644 --- a/ym-influx/src/main/java/com/cnbm/influx/config/InfluxClient.java +++ b/ym-influx/src/main/java/com/cnbm/influx/config/InfluxClient.java @@ -1,5 +1,6 @@ package com.cnbm.influx.config; +import com.cnbm.common.spc.util.DataUtils; import com.cnbm.influx.constant.Constant; import com.cnbm.influx.param.*; import com.cnbm.influx.template.Event; @@ -118,6 +119,8 @@ public enum InfluxClient { .addTag("argName", event.getArgName()) .addField("argValue", event.getArgValue()) .time(event.getTime().toEpochMilli(), WritePrecision.MS); + //.time(DataUtils.StringToInstantPlus8(event.getTime().toString()).toEpochMilli(), WritePrecision.MS); + }else { point = Point.measurement(measurement) .addTag("transationId", event.getTransationId()==null ? "" : event.getTransationId()) @@ -130,6 +133,7 @@ public enum InfluxClient { .addTag("argName", event.getArgName()) .addField("argValue", event.getArgValue()) .time(event.getTime().toEpochMilli(), WritePrecision.MS); + //.time(DataUtils.StringToInstantPlus8(event.getTime().toString()).toEpochMilli(), WritePrecision.MS); } list.add(point); } diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/ProcessInspectionController.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/ProcessInspectionController.java index e064bad..3e14722 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/ProcessInspectionController.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/ProcessInspectionController.java @@ -182,7 +182,8 @@ public class ProcessInspectionController { QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam(); // queryDataParam.setMeasurement(Constant.measurement); 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()); npGraph.initialDate(queryDataParam); @@ -310,7 +311,9 @@ public class ProcessInspectionController { QueryDataParam queryDataParam = new QueryDataParam(); // queryDataParam.setMeasurement(Constant.measurement); 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); XbarSGraphData xbarSGraphData = new XbarSGraphData( @@ -347,7 +350,8 @@ public class ProcessInspectionController { // queryDataParam.setMeasurement(Constant.measurement); 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); @@ -383,7 +387,8 @@ public class ProcessInspectionController { QueryDataParam queryDataParam = new QueryDataParam(); // queryDataParam.setMeasurement(Constant.measurement); 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); XMRGraphData xmrGraphData = new XMRGraphData( @@ -413,7 +418,8 @@ public class ProcessInspectionController { QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam(); // queryDataParam.setMeasurement(Constant.measurement); 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()); pGraph.initialDate(queryDataParam); @@ -435,7 +441,8 @@ public class ProcessInspectionController { QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam(); // queryDataParam.setMeasurement(Constant.measurement); 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()); cGraph.initialDate(queryDataParam); @@ -458,7 +465,8 @@ public class ProcessInspectionController { QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam(); // queryDataParam.setMeasurement(Constant.measurement); 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()); uGraph.initialDate(queryDataParam); diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/dto/GraphArg.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/dto/GraphArg.java index bd085ac..d89511f 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/dto/GraphArg.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/dto/GraphArg.java @@ -23,15 +23,25 @@ public class GraphArg { @NotNull(message = "检验特性Id 不能为空") 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 = "查询时间段,开始") - @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 = "时间段,开始 不能为空") - private Date begin; + private String begin; @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 = "时间段,结束 不能为空") - private Date end; + private String end; @ApiModelProperty(value = "判读方案列表,只用于 计量型") private List interpretationScheme;