mark for pull
This commit is contained in:
parent
13020d05c9
commit
2b34011129
1
pom.xml
1
pom.xml
@ -16,6 +16,7 @@
|
||||
<module>ym-schedule-task</module>
|
||||
<module>ym-influx</module>
|
||||
<module>ym-quality-planning</module>
|
||||
<module>ym-process-inspection</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
105
ym-common/src/main/java/com/cnbm/common/vo/ApiErrorCode.java
Normal file
105
ym-common/src/main/java/com/cnbm/common/vo/ApiErrorCode.java
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 2018.
|
||||
* http://www.ulabcare.com
|
||||
*/
|
||||
|
||||
package com.cnbm.common.vo;
|
||||
|
||||
|
||||
/**
|
||||
* REST API 错误码
|
||||
*
|
||||
* @author jiff
|
||||
* @date 2018/11/1
|
||||
* @since 1.0
|
||||
*/
|
||||
public enum ApiErrorCode implements IErrorCode {
|
||||
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
SUCCESSFUL(CODE_SUCCESSFUL, "成功"),
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
FAILED(CODE_FAILED, "失败"),
|
||||
/**
|
||||
* 无效的请求参数
|
||||
*/
|
||||
//INVALID_PARAMETER(CODE_INVALID_PARAMETER, "无效的请求参数"),
|
||||
INVALID_PARAMETER(CODE_INVALID_PARAMETER, "Invalid request parameter"),
|
||||
/**
|
||||
* 数据未授权
|
||||
*/
|
||||
FORBIDDEN_DATA(CODE_FORBIDDEN_DATA, "数据未授权"),
|
||||
/**
|
||||
* 用户已存在
|
||||
*/
|
||||
USER_EXISTENT(CODE_USER_EXISTENT, "用户已存在"),
|
||||
/**
|
||||
* 用户不存在
|
||||
*/
|
||||
//USER_NON_EXISTENT(CODE_USER_NON_EXISTENT, "用户不存在"),
|
||||
USER_NON_EXISTENT(CODE_USER_NON_EXISTENT, "User does not exist"),
|
||||
/**
|
||||
* 用户已停用
|
||||
*/
|
||||
USER_DISABLED(CODE_FAILED, "用户已停用"),
|
||||
/**
|
||||
* 用户不存在或密码错误
|
||||
*/
|
||||
USER_NON_EXISTENT_OR_INVALID_PASSWORD(CODE_FAILED, "The user does not exist or the password is wrong"),
|
||||
//USER_NON_EXISTENT_OR_INVALID_PASSWORD(CODE_FAILED, "用户不存在或密码错误"),
|
||||
/**
|
||||
* 密码错误
|
||||
*/
|
||||
//INVALID_PASSWORD(CODE_FAILED, "密码错误"),
|
||||
INVALID_PASSWORD(CODE_FAILED, "Wrong password"),
|
||||
|
||||
/**
|
||||
* 电话号码不能为空
|
||||
*/
|
||||
MOBILE_IS_EMPTY(CODE_FAILED, "手机号码不能为空"),
|
||||
|
||||
/**
|
||||
* 用户未登录
|
||||
*/
|
||||
UNAUTHORIZED(CODE_UNAUTHORIZED, "用户未登录"),
|
||||
/**
|
||||
* 用户未授权
|
||||
*/
|
||||
FORBIDDEN(CODE_FORBIDDEN, "用户未授权");
|
||||
|
||||
private final int code;
|
||||
private final String msg;
|
||||
|
||||
ApiErrorCode(final int code, final String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static ApiErrorCode fromCode(int code) {
|
||||
ApiErrorCode[] apiErrorCodes = ApiErrorCode.values();
|
||||
for (ApiErrorCode apiErrorCode : apiErrorCodes) {
|
||||
if (apiErrorCode.getCode() == code) {
|
||||
return apiErrorCode;
|
||||
}
|
||||
}
|
||||
return SUCCESSFUL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format(" ErrorCode:{code=%s, msg=%s} ", code, msg);
|
||||
}
|
||||
}
|
78
ym-common/src/main/java/com/cnbm/common/vo/CommonVo.java
Normal file
78
ym-common/src/main/java/com/cnbm/common/vo/CommonVo.java
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 2018.
|
||||
* http://www.ulabcare.com
|
||||
*/
|
||||
|
||||
package com.cnbm.common.vo;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 公共视图对象
|
||||
*
|
||||
* @author jiff
|
||||
* @date 2018/11/9
|
||||
* @since 1.0
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
@ApiModel("公共视图对象")
|
||||
public class CommonVo {
|
||||
|
||||
/**
|
||||
* 启用状态:0 、停用,1、启用
|
||||
*/
|
||||
@ApiModelProperty(value = "启用状态:0 、停用,1、启用", example = "1", position = Integer.MAX_VALUE - 1)
|
||||
private Integer enabled;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注", position = Integer.MAX_VALUE - 1)
|
||||
private String remark;
|
||||
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@ApiModelProperty(value = "创建人", example = "1", position = Integer.MAX_VALUE)
|
||||
private Long creatorId;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
@ApiModelProperty(value = "创建人姓名", example = "ulabcare", position = Integer.MAX_VALUE)
|
||||
private String creatorName;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间", position = Integer.MAX_VALUE)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@ApiModelProperty(value = "更新人", example = "1", position = Integer.MAX_VALUE)
|
||||
private Long updaterId;
|
||||
|
||||
/**
|
||||
* 更新人姓名
|
||||
*/
|
||||
@ApiModelProperty(value = "更新人姓名", example = "ulabcare", position = Integer.MAX_VALUE)
|
||||
private String updaterName;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间", position = Integer.MAX_VALUE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
24
ym-common/src/main/java/com/cnbm/common/vo/DictDataVo.java
Normal file
24
ym-common/src/main/java/com/cnbm/common/vo/DictDataVo.java
Normal file
@ -0,0 +1,24 @@
|
||||
package com.cnbm.common.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </P>
|
||||
*
|
||||
* @author FanYi
|
||||
* @date 2020/7/6
|
||||
* @since 1.0
|
||||
*/
|
||||
@ApiModel("字典值对象")
|
||||
@Data
|
||||
public class DictDataVo {
|
||||
@ApiModelProperty("字典编码")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty("字典名称")
|
||||
private String name;
|
||||
}
|
63
ym-common/src/main/java/com/cnbm/common/vo/IErrorCode.java
Normal file
63
ym-common/src/main/java/com/cnbm/common/vo/IErrorCode.java
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2018.
|
||||
* http://www.ulabcare.com
|
||||
*/
|
||||
|
||||
package com.cnbm.common.vo;
|
||||
|
||||
|
||||
/**
|
||||
* api错误码定义
|
||||
*
|
||||
* @author jiff
|
||||
* @date 2018/11/1
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface IErrorCode {
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
int CODE_SUCCESSFUL = 0;
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
int CODE_FAILED = 1;
|
||||
/**
|
||||
* 无效的请求参数
|
||||
*/
|
||||
int CODE_INVALID_PARAMETER = 2;
|
||||
/**
|
||||
* 数据未授权
|
||||
*/
|
||||
int CODE_FORBIDDEN_DATA = 9;
|
||||
/**
|
||||
* 用户已存在
|
||||
*/
|
||||
int CODE_USER_EXISTENT = 10;
|
||||
/**
|
||||
* 用户不存在
|
||||
*/
|
||||
int CODE_USER_NON_EXISTENT = 11;
|
||||
/**
|
||||
* 用户未登录
|
||||
*/
|
||||
int CODE_UNAUTHORIZED = 401;
|
||||
/**
|
||||
* 用户未授权
|
||||
*/
|
||||
int CODE_FORBIDDEN = 403;
|
||||
|
||||
/**
|
||||
* 错误编码:0、成功 否则失败
|
||||
*
|
||||
* @return 错误码:0、成功 否则失败
|
||||
*/
|
||||
int getCode();
|
||||
|
||||
/**
|
||||
* 错误描述
|
||||
*
|
||||
* @return 错误描述
|
||||
*/
|
||||
String getMsg();
|
||||
}
|
33
ym-common/src/main/java/com/cnbm/common/vo/IdListVo.java
Normal file
33
ym-common/src/main/java/com/cnbm/common/vo/IdListVo.java
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2018.
|
||||
* http://www.ulabcare.com
|
||||
*/
|
||||
|
||||
package com.cnbm.common.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 主键列表对象
|
||||
*
|
||||
* @author jiff
|
||||
* @date 2018/11/14
|
||||
* @since 1.0
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
@Builder
|
||||
@ApiModel("主键列表视图对象")
|
||||
public class IdListVo {
|
||||
@ApiModelProperty(value = "主键列表", required = true, example = "[1]", notes = "根据实际接口返回不同对象的主键列表")
|
||||
private List<Long> ids;
|
||||
}
|
32
ym-common/src/main/java/com/cnbm/common/vo/IdVo.java
Normal file
32
ym-common/src/main/java/com/cnbm/common/vo/IdVo.java
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2018.
|
||||
* http://www.ulabcare.com
|
||||
*/
|
||||
|
||||
package com.cnbm.common.vo;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
||||
/**
|
||||
* 主键对象
|
||||
*
|
||||
* @author jiff
|
||||
* @date 2018/11/7
|
||||
* @since 1.0
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
@Builder
|
||||
@ApiModel("主键视图对象")
|
||||
public class IdVo {
|
||||
@ApiModelProperty(value = "主键", required = true, example = "1", notes = "根据实际接口返回不同对象的主键")
|
||||
private Long id;
|
||||
}
|
102
ym-common/src/main/java/com/cnbm/common/vo/R.java
Normal file
102
ym-common/src/main/java/com/cnbm/common/vo/R.java
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2018.
|
||||
* http://www.ulabcare.com
|
||||
*/
|
||||
|
||||
package com.cnbm.common.vo;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 处理结果类
|
||||
*
|
||||
* @param <T> 返回的数据类型
|
||||
* @author jiff
|
||||
* @date 2018/11/7
|
||||
* @since 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
@ApiModel("处理结果类")
|
||||
@Accessors
|
||||
public class R<T> implements Serializable {
|
||||
@NonNull
|
||||
@ApiModelProperty(value = "结果码", example = "0")
|
||||
private int code = IErrorCode.CODE_SUCCESSFUL;
|
||||
@ApiModelProperty(value = "结果说明", example = "成功")
|
||||
private String msg;
|
||||
@ApiModelProperty(value = "业务数据")
|
||||
private T data;
|
||||
|
||||
public R<T> code(int code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public R<T> msg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public R<T> data(T data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean ok() {
|
||||
return code == IErrorCode.CODE_SUCCESSFUL;
|
||||
}
|
||||
|
||||
public static <T> R<T> failed() {
|
||||
return failed("系统错误!");
|
||||
}
|
||||
|
||||
public static <T> R<T> failed(String msg) {
|
||||
return failed(ApiErrorCode.FAILED.getCode(), msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> failed(int code, String msg) {
|
||||
return failed(code, msg, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> failed(int code, String msg, T data) {
|
||||
return r(code == ApiErrorCode.SUCCESSFUL.getCode() ? ApiErrorCode.FAILED.getCode() : code, msg, data);
|
||||
}
|
||||
|
||||
public static <T> R<T> failed(IErrorCode errorCode) {
|
||||
return r(errorCode, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> r(IErrorCode errorCode, T data) {
|
||||
return r(errorCode.getCode(), errorCode.getMsg(), data);
|
||||
}
|
||||
|
||||
public static <T> R<T> r(int code, String msg, T data) {
|
||||
return new R<T>().code(code).msg(msg).data(data);
|
||||
}
|
||||
|
||||
public static <T> R<T> unauthorized() {
|
||||
return failed(ApiErrorCode.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
public static <T> R<T> forbidden() {
|
||||
return failed(ApiErrorCode.FORBIDDEN);
|
||||
}
|
||||
|
||||
public static <T> R<T> ok(T data) {
|
||||
return new R<T>().data(data);
|
||||
}
|
||||
|
||||
public static <T> R<T> ok(String msg, T data) {
|
||||
return new R<T>().msg(msg).data(data);
|
||||
}
|
||||
|
||||
}
|
26
ym-common/src/main/java/com/cnbm/common/vo/SelectVo.java
Normal file
26
ym-common/src/main/java/com/cnbm/common/vo/SelectVo.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.cnbm.common.vo;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </P>
|
||||
*
|
||||
* @author FanYi
|
||||
* @date 2020/7/6
|
||||
* @since 1.0
|
||||
*/
|
||||
@ApiModel("下拉选择列表对象")
|
||||
@Data
|
||||
public class SelectVo {
|
||||
@ApiModelProperty("key值,用于传给后端")
|
||||
private Object k;
|
||||
|
||||
@ApiModelProperty("value值,用于前端显示")
|
||||
private Object v;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.cnbm.common.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </P>
|
||||
*
|
||||
* @author FanYi
|
||||
* @date 2020/4/28
|
||||
* @since 1.0
|
||||
*/
|
||||
@Data
|
||||
public class SmsSignCodeVo {
|
||||
private Long sceneId;
|
||||
|
||||
private String signName;
|
||||
|
||||
private String templateCode;
|
||||
|
||||
private Integer templateType;
|
||||
|
||||
private String templateContent;
|
||||
}
|
30
ym-common/src/main/java/com/cnbm/common/vo/WhetherVo.java
Normal file
30
ym-common/src/main/java/com/cnbm/common/vo/WhetherVo.java
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2018.
|
||||
* http://www.ulabcare.com
|
||||
*/
|
||||
|
||||
package com.cnbm.common.vo;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
||||
/**
|
||||
* 是否对象
|
||||
*
|
||||
* @author jiff
|
||||
* @date 2018/11/11
|
||||
* @since 1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Builder
|
||||
@ApiModel("是否对象")
|
||||
public class WhetherVo {
|
||||
@ApiModelProperty(value = "是否:true、是,false、否", required = true, example = "true")
|
||||
private Boolean whether;
|
||||
}
|
@ -42,7 +42,13 @@
|
||||
<artifactId>ym-quality-planning</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.cnbm</groupId>
|
||||
<artifactId>ym-process-inspection</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-actuator-autoconfigure</artifactId>-->
|
||||
<!-- <version>2.7.0</version>-->
|
||||
|
@ -128,6 +128,22 @@ public class SwaggerConfig {
|
||||
.securitySchemes(Arrays.asList(new ApiKey("token", "token", "header")));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Docket processInspectionApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.groupName("ym-process-inspection")
|
||||
.apiInfo(apiInfos("过程检验", "过程检验模块"))
|
||||
.useDefaultResponseMessages(true)
|
||||
.forCodeGeneration(false)
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("com.cnbm.processInspection"))
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
.securityContexts(Arrays.asList(securityContext()))
|
||||
// ApiKey的name需与SecurityReference的reference保持一致
|
||||
.securitySchemes(Arrays.asList(new ApiKey("token", "token", "header")));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建该API的基本信息(这些基本信息会展现在文档页面中)
|
||||
* 访问地址:http://ip:port/swagger-ui.html
|
||||
|
@ -27,7 +27,7 @@ public class CodeGenerator {
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
mybatisPlusGenerator(new String[]{"product_type"});
|
||||
mybatisPlusGenerator(new String[]{"product_features"});
|
||||
}
|
||||
|
||||
public static void mybatisPlusGenerator(String[] include){
|
||||
|
@ -7,14 +7,12 @@ 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.influxdb.client.InfluxDBClient;
|
||||
import com.influxdb.client.domain.WritePrecision;
|
||||
import com.influxdb.client.write.Point;
|
||||
import com.influxdb.query.FluxRecord;
|
||||
import com.influxdb.query.FluxTable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
36
ym-process-inspection/pom.xml
Normal file
36
ym-process-inspection/pom.xml
Normal file
@ -0,0 +1,36 @@
|
||||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ym-pass</artifactId>
|
||||
<groupId>com.cnbm</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ym-process-inspection</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.cnbm</groupId>
|
||||
<artifactId>ym-influx</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cnbm</groupId>
|
||||
<artifactId>ym-baisc</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cnbm</groupId>
|
||||
<artifactId>ym-common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -1,4 +1,4 @@
|
||||
package com.cnbm.qualityPlanning.constant;
|
||||
package com.cnbm.processInspection.controlCoefficientConstant;
|
||||
|
||||
/**
|
||||
* @Desc: " "x bar - R" 控制系数 "
|
@ -1,6 +1,7 @@
|
||||
package com.cnbm.qualityPlanning.constant;
|
||||
package com.cnbm.processInspection.controlCoefficientConstant;
|
||||
|
||||
/**
|
||||
* 均值-标准差 控制图 常数系数
|
||||
* @Desc: " "x bar - s" 控制系数 "
|
||||
* @Author: caixiang
|
||||
* @DATE: 2022/6/30 10:44
|
@ -0,0 +1,46 @@
|
||||
package com.cnbm.processInspection.graphAnalyzed;
|
||||
|
||||
import com.cnbm.processInspection.controlCoefficientConstant.XBarSCoefficients;
|
||||
|
||||
/**
|
||||
* @Desc: ""
|
||||
* @Author: caixiang
|
||||
* @DATE: 2022/7/20 14:26
|
||||
*
|
||||
* 步骤:
|
||||
* ① 先读mysql表,查询 product_features 表,先读到 sample_size(样本量)
|
||||
* ② 再依据 influx.argName == mysql.product_feature.name && 时间段 查询所有的 参数数据
|
||||
* ③ 拿到参数数据后,分组 整合成List<Point>,
|
||||
* 计算控制限
|
||||
* 计算 母体 的 \sigma 、 bar{x} 。。。
|
||||
* 计算CPK 、CPU 、CPL这些
|
||||
* ④ 如果配置了判读方案,还要 调用 StatisticalControlledTest Function 检验。
|
||||
* ⑤
|
||||
*/
|
||||
|
||||
public class MeanStandardDeviationGraph {
|
||||
private Double sbar;
|
||||
private Double xbarbar;
|
||||
private Double as;
|
||||
private Double bu;
|
||||
private Double bl;
|
||||
private Integer sampleSize;
|
||||
private String argName;
|
||||
|
||||
MeanStandardDeviationGraph(Integer sampleSize){
|
||||
this.sampleSize = sampleSize;
|
||||
this.as = XBarSCoefficients.getAS(sampleSize);
|
||||
this.bu = XBarSCoefficients.getBU(sampleSize);
|
||||
this.bl = XBarSCoefficients.getBU(sampleSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* name : 初始化数据函数
|
||||
* desc : 从influxdb 里面读取数据,然后 加工处理成 我需要的
|
||||
* 步骤:
|
||||
* ①
|
||||
* */
|
||||
public void initialDate(){
|
||||
|
||||
}
|
||||
}
|
@ -4,13 +4,13 @@ package com.cnbm.qualityPlanning.common;
|
||||
import com.cnbm.qualityPlanning.entity.ControlLimit;
|
||||
import com.cnbm.qualityPlanning.entity.ControlLimitDetail;
|
||||
import com.cnbm.qualityPlanning.entity.Point;
|
||||
import io.swagger.models.auth.In;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Desc: "检测参数统计受控 检验类"
|
||||
* @Author: caixiang
|
||||
* todo : ① 开头第一组,和最后一组 是否漏掉 问题;② 中间情况 时候把最后一个元素漏掉。
|
||||
* @DATE: 2022/7/11 15:27
|
||||
*/
|
||||
public class StatisticalControlledTest {
|
||||
@ -26,18 +26,18 @@ public class StatisticalControlledTest {
|
||||
private static final Integer rule10Number = 10;
|
||||
|
||||
public static List<Point> createData(){
|
||||
Point point = new Point(1,new Double(1.7));
|
||||
Point point2 = new Point(2,new Double(8));
|
||||
Point point3 = new Point(3,new Double(8));
|
||||
Point point4 = new Point(4,new Double(1.7));
|
||||
Point point5 = new Point(5,new Double(1.7));
|
||||
Point point6 = new Point(6,new Double(1.7)); //3
|
||||
Point point7 = new Point(7,new Double(1.7)); //3
|
||||
Point point8 = new Point(8,new Double(1.7)); //3 //3
|
||||
Point point9 = new Point(9,new Double(1.7));
|
||||
Point point10 = new Point(10,new Double(1.7));
|
||||
Point point11 = new Point(11,new Double(1.7));
|
||||
Point point12 = new Point(12,new Double(1.7));
|
||||
Point point = new Point(1,new Double(0.7));
|
||||
Point point2 = new Point(2,new Double(0.7));
|
||||
Point point3 = new Point(3,new Double(3.7));
|
||||
Point point4 = new Point(4,new Double(0.7));
|
||||
Point point5 = new Point(5,new Double(0.7));
|
||||
Point point6 = new Point(6,new Double(3.7)); //3
|
||||
Point point7 = new Point(7,new Double(3.7)); //3
|
||||
Point point8 = new Point(8,new Double(3.7)); //3 //3
|
||||
Point point9 = new Point(9,new Double(3.7));
|
||||
Point point10 = new Point(10,new Double(3.7));
|
||||
Point point11 = new Point(11,new Double(3.7));
|
||||
Point point12 = new Point(12,new Double(3.7));
|
||||
List<Point> list = new ArrayList<>();
|
||||
list.add(point);
|
||||
list.add(point2);
|
||||
@ -62,8 +62,8 @@ public class StatisticalControlledTest {
|
||||
// Boolean aBoolean1 = rule1(list, controlLimit);
|
||||
//
|
||||
//TEST FOR RULE2
|
||||
Boolean aBoolean2 = rule2(list, controlLimit, 9);
|
||||
System.out.println();
|
||||
// Boolean aBoolean2 = rule2(list, controlLimit, 9);
|
||||
// System.out.println();
|
||||
//
|
||||
//
|
||||
// //TEST FOR RULE3
|
||||
@ -72,7 +72,7 @@ public class StatisticalControlledTest {
|
||||
//
|
||||
//
|
||||
// //TEST FOR RULE4
|
||||
// Boolean aBoolean4 = rule4(list, 4);
|
||||
// Boolean aBoolean4 = rule4(list, 5);
|
||||
// System.out.println();
|
||||
|
||||
// //TEST FOR RULE5
|
||||
@ -88,6 +88,10 @@ public class StatisticalControlledTest {
|
||||
Boolean aBoolean7 = rule7(list, controlLimit,7);
|
||||
System.out.println();
|
||||
|
||||
//TEST FOR RULE8
|
||||
// Boolean aBoolean8 = rule8(list, controlLimit,8);
|
||||
// System.out.println();
|
||||
|
||||
// int[] array={1,2,3,4,5,6};
|
||||
// int[] ret=new int[3];
|
||||
// System.arraycopy(array,0,ret,0,3);
|
||||
@ -123,7 +127,6 @@ public class StatisticalControlledTest {
|
||||
* name : 规则2
|
||||
* desc : 连续 n 点落在中心线的用一侧 (默认:9)
|
||||
* 注意: 如果存在满足rule2的点,会在原数组 Point.unsatisfiedRules 里标注出来。
|
||||
* //todo 存在bug while((upi+1) < data.size()){ ,最后一个点轮询不到
|
||||
* return :
|
||||
* 存在满足rule2的点 => true
|
||||
* 不存在满足rule2的点 => false
|
||||
@ -160,7 +163,7 @@ public class StatisticalControlledTest {
|
||||
//1.
|
||||
for (Point key:forMarkPoints){
|
||||
for(Point j:data){
|
||||
if(key.getPosition()== j.getPosition()){
|
||||
if(key.getPosition().equals(j.getPosition())){
|
||||
j.getUnsatisfiedRules().add(rule2Number);
|
||||
continue;
|
||||
}
|
||||
@ -197,7 +200,7 @@ public class StatisticalControlledTest {
|
||||
|
||||
for (Point key:forMarkPoints){
|
||||
for(Point j:data){
|
||||
if(key.getPosition()== j.getPosition()){
|
||||
if(key.getPosition().equals(j.getPosition())){
|
||||
j.getUnsatisfiedRules().add(rule2Number);
|
||||
continue;
|
||||
}
|
||||
@ -280,7 +283,6 @@ public class StatisticalControlledTest {
|
||||
* name : 规则4
|
||||
* desc : 连续 n 点中 相邻点 交替上下 ( 默认:14 )
|
||||
* 注意: 如果存在满足rule4的点,会在原数组 Point.unsatisfiedRules 里标注出来。
|
||||
* //todo 有bug while((upi+1) < data.size()) 这里 upi+1 会存在问题
|
||||
* return :
|
||||
* 存在满足rule4的点 => true
|
||||
* 不存在满足rule4的点 => false
|
||||
@ -301,6 +303,24 @@ public class StatisticalControlledTest {
|
||||
|
||||
while((upi+1) < data.size()){
|
||||
if(isBetween( data.get(upi),data.get(upi+1) )){
|
||||
//
|
||||
if(forMarkKey.size()==(n-1)){
|
||||
Double u1 = data.get(upi-2).getValue();
|
||||
Double u2 = data.get(upi-1).getValue();
|
||||
Double u3 = data.get(upi).getValue();
|
||||
if(isUpAndDown(u1,u2,u3)){
|
||||
forMarkKey.add(upi);
|
||||
times++;
|
||||
}
|
||||
if(times >= n){
|
||||
for(Integer key:forMarkKey){
|
||||
data.get(key).getUnsatisfiedRules().add(rule4Number);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//A-B<0 True
|
||||
//A-B>0 False
|
||||
if(isSmall(data.get(upi),data.get(upi+1))){
|
||||
@ -313,7 +333,19 @@ public class StatisticalControlledTest {
|
||||
if (current.equals(nextNeeded)){
|
||||
times++;
|
||||
forMarkKey.add(upi);
|
||||
if(times == n){
|
||||
//加入最后一个元素的判断
|
||||
if((upi+1)==(data.size()-1)){
|
||||
Double u0 = data.get(upi - 1).getValue();
|
||||
Double u1 = data.get(upi).getValue();
|
||||
Double u2 = data.get(upi + 1).getValue();
|
||||
if(isUpAndDown(u0,u1,u2)){
|
||||
forMarkKey.add(upi+1);
|
||||
times++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(times >= n){
|
||||
for(Integer key:forMarkKey){
|
||||
data.get(key).getUnsatisfiedRules().add(rule4Number);
|
||||
}
|
||||
@ -334,6 +366,8 @@ public class StatisticalControlledTest {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* name : 规则5
|
||||
* desc : 连续 m 点中 有 n 点 落在中心线同一侧,B区以外。( 默认 m:3 , n:2 )
|
||||
@ -403,7 +437,7 @@ public class StatisticalControlledTest {
|
||||
/**
|
||||
* name : 规则6
|
||||
* desc : 连续 m 点中 有 n 点 落在中心线同一侧,C区以外。( 默认 m:5 , n:4 )
|
||||
* 注意: 如果存在满足rule5的点,会在原数组 Point.unsatisfiedRules 里标注出来。
|
||||
* 注意: 如果存在满足rule6的点,会在原数组 Point.unsatisfiedRules 里标注出来。
|
||||
* return :
|
||||
* 存在满足rule6的点 => true
|
||||
* 不存在满足rule6的点 => false
|
||||
@ -469,7 +503,7 @@ public class StatisticalControlledTest {
|
||||
/**
|
||||
* name : 规则7
|
||||
* desc : 连续 n 点 落在中心线两侧的C区内。( 默认 n:15 )
|
||||
* 注意: 如果存在满足rule5的点,会在原数组 Point.unsatisfiedRules 里标注出来。
|
||||
* 注意: 如果存在满足rule7的点,会在原数组 Point.unsatisfiedRules 里标注出来。
|
||||
* return :
|
||||
* 存在满足rule7的点 => true
|
||||
* 不存在满足rule7的点 => false
|
||||
@ -477,7 +511,7 @@ public class StatisticalControlledTest {
|
||||
private static Boolean rule7(List<Point> data,ControlLimit controlLimit, Integer n){
|
||||
|
||||
|
||||
Integer upi = 0;
|
||||
//Integer upi = 0;
|
||||
ControlLimitDetail controlLimitDetail = new ControlLimitDetail(controlLimit.getUCL(), controlLimit.getCL(), controlLimit.getLCL());
|
||||
System.out.println(controlLimitDetail.toString());
|
||||
Integer times = 0;
|
||||
@ -486,12 +520,12 @@ public class StatisticalControlledTest {
|
||||
|
||||
for(int i=0;i<data.size();i++){
|
||||
//判断最后一次
|
||||
if((upi+1) == data.size()){
|
||||
Point point = data.get(upi);
|
||||
if((i+1) == data.size()){
|
||||
Point point = data.get(i);
|
||||
if(point.getValue()>controlLimitDetail.getLC()[0] && point.getValue()<controlLimitDetail.getUC()[1]){
|
||||
times++;
|
||||
markKey.add(point);
|
||||
if(times==n){
|
||||
if(times.equals(n)){
|
||||
for(Point j:markKey){
|
||||
j.getUnsatisfiedRules().add(rule7Number);
|
||||
}
|
||||
@ -506,11 +540,11 @@ public class StatisticalControlledTest {
|
||||
|
||||
//通常情况
|
||||
Point point = data.get(i);
|
||||
if( isBetween( data.get(upi),data.get(upi+1) ) ){
|
||||
if( isBetween( data.get(i),data.get(i+1) ) ){
|
||||
if(point.getValue()>controlLimitDetail.getLC()[0] && point.getValue()<controlLimitDetail.getUC()[1]){
|
||||
times++;
|
||||
markKey.add(point);
|
||||
if(times==n){
|
||||
if(times.equals(n)){
|
||||
for(Point j:markKey){
|
||||
j.getUnsatisfiedRules().add(rule7Number);
|
||||
}
|
||||
@ -528,8 +562,68 @@ public class StatisticalControlledTest {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* name : 规则8
|
||||
* desc : 连续 n 点 落在中心线两侧,且无一点在C区内。( 默认 n:8 )
|
||||
* 注意: 如果存在满足rule8的点,会在原数组 Point.unsatisfiedRules 里标注出来。
|
||||
* return :
|
||||
* 存在满足rule8的点 => true
|
||||
* 不存在满足rule8的点 => false
|
||||
* */
|
||||
private static Boolean rule8(List<Point> data,ControlLimit controlLimit, Integer n){
|
||||
|
||||
|
||||
//Integer upi = 0;
|
||||
ControlLimitDetail controlLimitDetail = new ControlLimitDetail(controlLimit.getUCL(), controlLimit.getCL(), controlLimit.getLCL());
|
||||
System.out.println(controlLimitDetail.toString());
|
||||
Integer times = 0;
|
||||
List<Point> markKey = new ArrayList<>();
|
||||
|
||||
|
||||
for(int i=0;i<data.size();i++){
|
||||
//判断最后一次
|
||||
if((i+1) == data.size()){
|
||||
Point point = data.get(i);
|
||||
if( point.getValue()>controlLimitDetail.getUC()[1] || point.getValue()<controlLimitDetail.getLC()[0] ){
|
||||
times++;
|
||||
markKey.add(point);
|
||||
if(times.equals(n)){
|
||||
for(Point j:markKey){
|
||||
j.getUnsatisfiedRules().add(rule8Number);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}else {
|
||||
times = 0;
|
||||
markKey = new ArrayList<>();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//通常情况
|
||||
Point point = data.get(i);
|
||||
if( isBetween( data.get(i),data.get(i+1) ) ){
|
||||
if( point.getValue()>controlLimitDetail.getUC()[1] || point.getValue()<controlLimitDetail.getLC()[0] ){
|
||||
times++;
|
||||
markKey.add(point);
|
||||
if(times.equals(n)){
|
||||
for(Point j:markKey){
|
||||
j.getUnsatisfiedRules().add(rule8Number);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}else {
|
||||
times = 0;
|
||||
markKey = new ArrayList<>();
|
||||
}
|
||||
}else {
|
||||
times = 0;
|
||||
markKey = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果 这两个点是相邻的 ==》 true
|
||||
* */
|
||||
@ -549,4 +643,19 @@ public class StatisticalControlledTest {
|
||||
return (head.getValue()- after.getValue()) > 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 如果这三个参数 是起伏的 ====> true
|
||||
*
|
||||
* */
|
||||
private static boolean isUpAndDown(Double u1,Double u2,Double u3){
|
||||
Boolean r1 = ((u1-u2)>0);
|
||||
Boolean r2 = ((u2-u3)>0);
|
||||
if(!r1.equals(r2)){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user