Compare commits

...

4 Commits

Author SHA1 Message Date
caixiang
ed054a2bf2 瑞昌SPC - 定版 2024-01-19 10:14:16 +08:00
caixiang
6ebe466df1 Merge branch 'master' of http://git.picaiba.com/CaiXiang/SPC 2023-06-25 16:40:52 +08:00
caixiang
bc685ccf45 commit for pull 2023-06-25 16:40:38 +08:00
caixiang
fced72a94f mark 2023-06-21 14:12:07 +08:00
15 changed files with 73 additions and 77 deletions

View File

@ -73,6 +73,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/webjars/**",
"/websocket/**",
"/influx/**",
"/spcData/**",
// "/basic/**",
// "/qualityPlanning/**",

View File

@ -52,10 +52,10 @@ public class LoginServiceImpl implements LoginService {
@Override
public Result login(HttpServletRequest request, LoginParam loginParam) {
//验证码是否正确
boolean flag = captchaService.validate(loginParam.getUuid(), loginParam.getCaptcha());
if(!flag){
return new Result<>().error(ErrorCode.CAPTCHA_ERROR, "验证码错误");
}
// boolean flag = captchaService.validate(loginParam.getUuid(), loginParam.getCaptcha());
// if(!flag){
// return new Result<>().error(ErrorCode.CAPTCHA_ERROR, "验证码错误");
// }
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginParam.getUsername(),loginParam.getPassword());
Authentication authenticate = authenticationManager.authenticate(authenticationToken);
//登录日志

View File

@ -2,9 +2,15 @@ spring:
datasource:
#MySQL
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://mysql.picaiba.com:30307/spc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: root
password: 1qaz@WSX3edc$RFV
# url: jdbc:mysql://mysql.picaiba.com:30307/spc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
# username: root
# password: 1qaz@WSX3edc$RFV
url: jdbc:mysql://172.16.21.131:3306/spc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: spcw
password: fxltsblXSSXYBY
# url: jdbc:mysql://172.16.21.131:3306/spc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
# username: spcw
# password: fxltsblXSSXYBY
# #Oracle
# driver-class-name: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@192.168.10.10:1521:xe
@ -77,4 +83,4 @@ spring:
# writeTimeout: 5s # Write timeout for OkHttpClient. (Default: 10s)
# connectTimeout: 5s # Connection timeout for OkHttpClient. (Default: 10s)
# management.health.influx.enabled=true # Whether to enable InfluxDB 2.x health check.
# management.health.influx.enabled=true # Whether to enable InfluxDB 2.x health check.

View File

@ -2,9 +2,12 @@ spring:
datasource:
#MySQL
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://mysql.picaiba.com:30307/ym_pass?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: root
password: 1qaz@WSX3edc$RFV
# url: jdbc:mysql://mysql.picaiba.com:30307/ym_pass?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
# username: root
# password: 1qaz@WSX3edc$RFV
url: jdbc:mysql://172.16.21.131:3306/spc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: spcw
password: fxltsblXSSXYBY
# #Oracle
# driver-class-name: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@192.168.10.10:1521:xe

View File

@ -5,9 +5,9 @@ server:
threads:
max: 1000
min-spare: 30
port: 8080
port: 8999
servlet:
context-path: /ym-spc
context-path: /spcserver
session:
cookie:
http-only: true
@ -33,9 +33,12 @@ spring:
enabled: true
redis:
database: 2
host: 127.0.0.1
port: 6379
password: '' # 密码(默认为空)
# host: 127.0.0.1
# port: 6379
# password: ''
host: 172.16.21.99
port: 6380
password: '@WSXcde3' # 密码(默认为空)
timeout: 6000ms # 连接超时时长(毫秒)
jedis:
pool:

View File

@ -19,8 +19,10 @@ public enum InfluxClient {
/**
* influxdb 读写客户端如果write比较繁忙后续可以考虑维护 client一个线程池
* */
Client("http://192.168.0.170:8086","lkBsC27QZr1W50BSPlGxpTqNNpwuUk5uz1dZZRPSPbCG5VmNDDUo8P3UkZIhGWwfJwkuz6ZGZ7Et4_KBaG3gHw==","qgs","qgs-bucket"),
//Client("http://192.168.0.171:8086","lkq32gtomiKd4nu-kwZVUBEbn1HLdigjRPfuA6p8c29KFfqRs8JcR3IDLDsKzVFA-TDHbG1W6EP3EcJKKqpDPg==","qgs","qgs-bucket"),
//瑞昌-cdte spc-all-token
Client("http://172.16.21.111:8086","XLTjiVj368gLL0j-hTcAS6HE17M7tY5fj3ipt1gXTjgVqdGRE5pEhpGMABzchYFZpmaQsGTUckR5Rs8Erz8nKQ==","qgs","qgs-bucket"),
;
private String url;
private String token;
@ -129,8 +131,6 @@ public enum InfluxClient {
.addField("argValue", event.getArgValue())
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
}
list.add(point);
}
writeApi.writePoints(list);

View File

@ -29,6 +29,27 @@ public class S7DemoController {
private static final Logger logger = LoggerFactory.getLogger(S7DemoController.class);
//for 常规计量型
@PostMapping("/insertDemoDataForMetering")
public void insertDemoDataForMetering() throws InterruptedException {
List<Event> list = new ArrayList<>();
Random r = new Random();
for(int i=0;i<999;i++){
Thread.sleep(10);
Event event = new Event();
event.setTime(DataUtils.getAfterDate(i).toInstant());
event.setTransationId("forbatch"+i);
event.setArgName("LTWeight");
Double d = r.nextDouble() * 2.5 + 66;
event.setArgValue(d.toString());
event.setInspectionSheetId(i+"");
list.add(event);
}
InfluxClient.Client.batchInsert(list,"Weight");
}
//for 常规计数型
@PostMapping("/insertDemoDataForCount")
public void insertDemoDataForCount() throws InterruptedException {
@ -148,26 +169,7 @@ public class S7DemoController {
}
//for 常规计量型
@PostMapping("/insertDemoDataForMetering")
public void insertDemoDataForMetering() throws InterruptedException {
List<Event> list = new ArrayList<>();
Random r = new Random();
for(int i=0;i<99;i++){
Thread.sleep(10);
Event event = new Event();
event.setTime(Instant.now());
event.setTransationId("forbatch"+i);
event.setArgName("LTWeight");
Double d = r.nextDouble() * 2.5 + 66;
event.setArgValue(d.toString());
event.setInspectionSheetId(i+"");
list.add(event);
}
InfluxClient.Client.batchInsert(list,"Weight");
}
//
// @PostMapping("/insertBatchJYD")
// public void insertBatchJYD() throws InterruptedException {

View File

@ -16,7 +16,7 @@ public class BaseParam implements Serializable {
//page 信息可选
private PageInfo pageInfo;
@NotEmpty(message = "measurement 不能为空")
@NotEmpty(message = "measurement 不能为空, 设备名一个设备一个measurement一个表")
private String measurement;
@NotNull(message = "查询时间段不能为空")

View File

@ -142,44 +142,6 @@ public class ProcessInspectionController {
return R.ok("成功",xmrGraphData);
}
// @PostMapping("/getBatchs")
// public R<List<String>> getBatchs() throws InterruptedException {
// List<Event> list = new ArrayList<>();
// Random r = new Random();
// Instant instant = DataUtils.getBeforeDate(400).toInstant();
// List<String> res = new ArrayList<>();
//
// QueryDataParam queryDataParam = new QueryDataParam();
// queryDataParam.setBucket("qgs-bucket");
// queryDataParam.setMeasurement("Weight");
// List<String> dropNames = new ArrayList<>();
// dropNames.add("transationId");
// dropNames.add("_value");
// dropNames.add("_start");
// dropNames.add("_stop");
// dropNames.add("_time");
// dropNames.add("_field");
// dropNames.add("_measurement");
// dropNames.add("inspectionSheetId");
// dropNames.add("argName");
// queryDataParam.setDropedTagNames(dropNames);
//
// 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);
//
//
// for (FluxTable fluxTable : query) {
// List<FluxRecord> records = fluxTable.getRecords();
// if(records.size()!=0){
// res.add((String) records.get(0).getValueByKey("batchNum"));
// continue;
// }
// }
// return R.ok(res);
// }
@PostMapping("/NPGraphTest")

View File

@ -110,6 +110,9 @@ public class CGraph {
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
if(query.size() == 0){
return;
}
//1. 先从fluxdb 里面提取原始数据
//计算p bar
this.cbar = computeCbar(query);

View File

@ -104,6 +104,9 @@ public class NPGraph {
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
if(query.size() == 0){
return;
}
//1. 先从fluxdb 里面提取原始数据
List<Double> originData = new ArrayList<>();
//计算p bar

View File

@ -115,6 +115,9 @@ public class PGraph {
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
if(query.size() == 0){
return;
}
//1. 先从fluxdb 里面提取原始数据
//计算p bar
this.pbar = computePbar(query);

View File

@ -114,6 +114,9 @@ public class UGraph {
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
if(query.size() == 0){
return;
}
//1. 先从fluxdb 里面提取原始数据
//计算p bar
this.ubar = computeUbar(query);

View File

@ -103,8 +103,12 @@ public class MeanStandardDeviationGraph {
queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
if(query.size() == 0){
return;
}
//1. 先从fluxdb 里面提取原始数据
List<Double> originData = new ArrayList<>();
for (FluxTable fluxTable : query) {
List<FluxRecord> records = fluxTable.getRecords();
for (FluxRecord fluxRecord : records) {

View File

@ -100,6 +100,9 @@ public class XMRGraph {
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
if(query.size() == 0){
return;
}
//1. 先从fluxdb 里面提取原始数据
List<Double> originData = new ArrayList<>();
for (FluxTable fluxTable : query) {