diff --git a/ym-gateway/pom.xml b/ym-gateway/pom.xml index 79ca07b..56339fe 100644 --- a/ym-gateway/pom.xml +++ b/ym-gateway/pom.xml @@ -86,4 +86,61 @@ + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + 2.5.12 + + + com.cnbm.YmApplication + + + true + ${project.basedir}/src/main/resources/layers.xml + + + + org.projectlombok + lombok + + + + + + + repackage + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + com.spotify + docker-maven-plugin + ${docker.plugin.version} + + ym-pass/${project.artifactId} + ${project.basedir}/ + + + / + ${project.build.directory} + ${project.build.finalName}.jar + + + + + + \ No newline at end of file diff --git a/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java b/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java index 2154162..96a07b2 100644 --- a/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java +++ b/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java @@ -21,14 +21,11 @@ import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.spring.web.plugins.WebFluxRequestHandlerProvider; import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider; - import java.lang.reflect.Field; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import static com.google.common.collect.Lists.newArrayList; - /** * @Author weihongyang * @Date 2022/6/21 10:56 AM @@ -128,6 +125,7 @@ public class SwaggerConfig { .securitySchemes(Arrays.asList(new ApiKey("token", "token", "header"))); } + @Bean public Docket processInspectionApi() { return new Docket(DocumentationType.SWAGGER_2) diff --git a/ym-gateway/src/main/resources/application.yml b/ym-gateway/src/main/resources/application.yml index 4e71122..d4c978f 100644 --- a/ym-gateway/src/main/resources/application.yml +++ b/ym-gateway/src/main/resources/application.yml @@ -33,9 +33,9 @@ spring: enabled: true redis: database: 2 - host: redis.picaiba.com - port: 6380 - password: '@WSXcde3' # 密码(默认为空) + host: 127.0.0.1 + port: 6379 + password: '' # 密码(默认为空) timeout: 6000ms # 连接超时时长(毫秒) jedis: pool: diff --git a/ym-gateway/src/main/resources/layers.xml b/ym-gateway/src/main/resources/layers.xml new file mode 100644 index 0000000..25736ee --- /dev/null +++ b/ym-gateway/src/main/resources/layers.xml @@ -0,0 +1,27 @@ + + + + org/springframework/boot/loader/** + + + + + + *:*:*SNAPSHOT + + + com.cnbm:* + + + + + dependencies + spring-boot-loader + snapshot-dependencies + company-dependencies + application + + diff --git a/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java b/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java index 070557f..2aff475 100644 --- a/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java +++ b/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java @@ -19,7 +19,7 @@ public class CodeGenerator { @Test public void test(){ - mybatisPlusGenerator(new String[]{"inspection_sheet"}); + mybatisPlusGenerator(new String[]{"unit"}); } public static void mybatisPlusGenerator(String[] include){ diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/controller/InspectionSheetController.java b/ym-generator/src/main/java/com/cnbm/generator/code/controller/InspectionSheetController.java index 6078d67..ab798ce 100644 --- a/ym-generator/src/main/java/com/cnbm/generator/code/controller/InspectionSheetController.java +++ b/ym-generator/src/main/java/com/cnbm/generator/code/controller/InspectionSheetController.java @@ -51,7 +51,6 @@ public class InspectionSheetController { @PreAuthorize("@ex.hasAuthority('code:inspectionSheet:page')") public Result> page(@ApiIgnore @RequestParam Map params){ PageData page = inspectionSheetService.page(params); - return new Result>().ok(page); } @@ -60,7 +59,6 @@ public class InspectionSheetController { @PreAuthorize("@ex.hasAuthority('code:inspectionSheet:info')") public Result get(@PathVariable("id") Long id){ InspectionSheetDTO data = inspectionSheetService.get(id); - return new Result().ok(data); } @@ -71,7 +69,6 @@ public class InspectionSheetController { public Result save(@RequestBody InspectionSheetDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - try { inspectionSheetService.save(dto); }catch (Exception e){ @@ -86,9 +83,7 @@ public class InspectionSheetController { public Result update(@RequestBody InspectionSheetDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); - inspectionSheetService.update(dto); - return new Result().ok(dto.getId()); } @@ -99,9 +94,7 @@ public class InspectionSheetController { public Result delete(@RequestBody Long[] ids){ //效验数据 AssertUtils.isArrayEmpty(ids, "id"); - inspectionSheetService.delete(ids); - return new Result(); } @@ -111,8 +104,6 @@ public class InspectionSheetController { @PreAuthorize("@ex.hasAuthority('code:inspectionSheet:export')") public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { List list = inspectionSheetService.list(params); - ExcelUtils.exportExcelToTarget(response, null, list, InspectionSheetExcel.class); } - } \ No newline at end of file diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/controller/UnitController.java b/ym-generator/src/main/java/com/cnbm/generator/code/controller/UnitController.java index a617f93..0d2ce35 100644 --- a/ym-generator/src/main/java/com/cnbm/generator/code/controller/UnitController.java +++ b/ym-generator/src/main/java/com/cnbm/generator/code/controller/UnitController.java @@ -31,7 +31,7 @@ import java.util.Map; * 单位 表 前端控制器 * * @author why - * @since 2022-06-30 + * @since 2023-01-12 */ @RestController @RequestMapping("/code/unit") @@ -68,26 +68,26 @@ public class UnitController { @ApiOperation("保存") @LogOperation("保存") @PreAuthorize("@ex.hasAuthority('code:unit:save')") - public Result save(@RequestBody UnitDTO dto){ + public Result save(@RequestBody UnitDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); unitService.save(dto); - return new Result(); + return new Result().ok(dto.getId()); } @PutMapping @ApiOperation("修改") @LogOperation("修改") @PreAuthorize("@ex.hasAuthority('code:unit:update')") - public Result update(@RequestBody UnitDTO dto){ + public Result update(@RequestBody UnitDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); unitService.update(dto); - return new Result(); + return new Result().ok(dto.getId()); } @DeleteMapping diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/dto/UnitDTO.java b/ym-generator/src/main/java/com/cnbm/generator/code/dto/UnitDTO.java index 73789dd..fc702ef 100644 --- a/ym-generator/src/main/java/com/cnbm/generator/code/dto/UnitDTO.java +++ b/ym-generator/src/main/java/com/cnbm/generator/code/dto/UnitDTO.java @@ -14,7 +14,7 @@ import java.math.BigDecimal; * 单位 表 * * @author why - * @since 2022-06-30 + * @since 2023-01-12 */ @Data @ApiModel(value = "单位 表DTO对象") @@ -23,8 +23,8 @@ public class UnitDTO implements Serializable { - @ApiModelProperty(value = "ID") - private BigDecimal id; + @ApiModelProperty(value = "") + private Long id; @ApiModelProperty(value = "单位 名") private String name; @@ -33,19 +33,19 @@ public class UnitDTO implements Serializable { private String code; @ApiModelProperty(value = "单位类型,1 可计数,2 不可计数") - private BigDecimal type; + private Integer type; @ApiModelProperty(value = "1 可用,0 不可用") - private BigDecimal status; + private Integer status; @ApiModelProperty(value = "备注") private String remark; @ApiModelProperty(value = "删除标志,是否有效:1 可用 0不可用") - private BigDecimal valid; + private Integer valid; - @ApiModelProperty(value = "创建人") - private BigDecimal creatorId; + @ApiModelProperty(value = "") + private Long creatorId; @ApiModelProperty(value = "创建人姓名") private String creatorName; @@ -53,8 +53,8 @@ public class UnitDTO implements Serializable { @ApiModelProperty(value = "创建时间") private LocalDateTime createTime; - @ApiModelProperty(value = "更新人") - private BigDecimal updaterId; + @ApiModelProperty(value = "") + private Long updaterId; @ApiModelProperty(value = "更新人姓名") private String updaterName; @@ -63,6 +63,6 @@ public class UnitDTO implements Serializable { private LocalDateTime updateTime; @ApiModelProperty(value = "版本号") - private BigDecimal version; + private Integer version; } \ No newline at end of file diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/entity/Unit.java b/ym-generator/src/main/java/com/cnbm/generator/code/entity/Unit.java index 17f9f8d..7e3663e 100644 --- a/ym-generator/src/main/java/com/cnbm/generator/code/entity/Unit.java +++ b/ym-generator/src/main/java/com/cnbm/generator/code/entity/Unit.java @@ -1,7 +1,7 @@ package com.cnbm.generator.code.entity; +import com.baomidou.mybatisplus.annotation.TableLogic; import java.io.Serializable; -import java.math.BigDecimal; import java.time.LocalDateTime; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -13,7 +13,7 @@ import lombok.Data; *

* * @author why - * @since 2022-06-30 + * @since 2023-01-12 */ @Data @ApiModel(value = "Unit对象", description = "单位 表") @@ -21,8 +21,7 @@ public class Unit implements Serializable { private static final long serialVersionUID = 1L; - @ApiModelProperty("ID") - private BigDecimal id; + private Long id; @ApiModelProperty("单位 名") private String name; @@ -31,19 +30,19 @@ public class Unit implements Serializable { private String code; @ApiModelProperty("单位类型,1 可计数,2 不可计数") - private BigDecimal type; + private Integer type; @ApiModelProperty("1 可用,0 不可用") - private BigDecimal status; + private Integer status; @ApiModelProperty("备注") private String remark; @ApiModelProperty("删除标志,是否有效:1 可用 0不可用") - private BigDecimal valid; + @TableLogic + private Integer valid; - @ApiModelProperty("创建人") - private BigDecimal creatorId; + private Long creatorId; @ApiModelProperty("创建人姓名") private String creatorName; @@ -51,8 +50,7 @@ public class Unit implements Serializable { @ApiModelProperty("创建时间") private LocalDateTime createTime; - @ApiModelProperty("更新人") - private BigDecimal updaterId; + private Long updaterId; @ApiModelProperty("更新人姓名") private String updaterName; @@ -61,7 +59,7 @@ public class Unit implements Serializable { private LocalDateTime updateTime; @ApiModelProperty("版本号") - private BigDecimal version; + private Integer version; } diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/excel/UnitExcel.java b/ym-generator/src/main/java/com/cnbm/generator/code/excel/UnitExcel.java index 0772fea..8c7596a 100644 --- a/ym-generator/src/main/java/com/cnbm/generator/code/excel/UnitExcel.java +++ b/ym-generator/src/main/java/com/cnbm/generator/code/excel/UnitExcel.java @@ -12,37 +12,37 @@ import java.util.Date; * 单位 表 * * @author why - * @since 2022-06-30 + * @since 2023-01-12 */ @Data public class UnitExcel { - @Excel(name = "ID") - private BigDecimal id; + @Excel(name = "") + private Long id; @Excel(name = "单位 名") private String name; @Excel(name = "单位 编码") private String code; @Excel(name = "单位类型,1 可计数,2 不可计数") - private BigDecimal type; + private Integer type; @Excel(name = "1 可用,0 不可用") - private BigDecimal status; + private Integer status; @Excel(name = "备注") private String remark; @Excel(name = "删除标志,是否有效:1 可用 0不可用") - private BigDecimal valid; - @Excel(name = "创建人") - private BigDecimal creatorId; + private Integer valid; + @Excel(name = "") + private Long creatorId; @Excel(name = "创建人姓名") private String creatorName; @Excel(name = "创建时间") private LocalDateTime createTime; - @Excel(name = "更新人") - private BigDecimal updaterId; + @Excel(name = "") + private Long updaterId; @Excel(name = "更新人姓名") private String updaterName; @Excel(name = "更新时间") private LocalDateTime updateTime; @Excel(name = "版本号") - private BigDecimal version; + private Integer version; } \ No newline at end of file diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UnitMapper.java b/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UnitMapper.java index f4fa7cd..841862c 100644 --- a/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UnitMapper.java +++ b/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UnitMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Mapper; * 单位 表 * * @author why - * @since 2022-06-30 + * @since 2023-01-12 */ @Mapper public interface UnitMapper extends BaseDao { diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UnitMapper.xml b/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UnitMapper.xml index 42c18b6..90705bd 100644 --- a/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UnitMapper.xml +++ b/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UnitMapper.xml @@ -1,5 +1,21 @@ + + + + + + + + + + + + + + + + diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/service/IUnitService.java b/ym-generator/src/main/java/com/cnbm/generator/code/service/IUnitService.java index bc12537..6a10408 100644 --- a/ym-generator/src/main/java/com/cnbm/generator/code/service/IUnitService.java +++ b/ym-generator/src/main/java/com/cnbm/generator/code/service/IUnitService.java @@ -8,7 +8,7 @@ import com.cnbm.generator.code.entity.Unit; * 单位 表 * * @author why - * @since 2022-06-30 + * @since 2023-01-12 */ public interface IUnitService extends CrudService { diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/service/impl/UnitServiceImpl.java b/ym-generator/src/main/java/com/cnbm/generator/code/service/impl/UnitServiceImpl.java index 05263d4..87f9aa1 100644 --- a/ym-generator/src/main/java/com/cnbm/generator/code/service/impl/UnitServiceImpl.java +++ b/ym-generator/src/main/java/com/cnbm/generator/code/service/impl/UnitServiceImpl.java @@ -15,7 +15,7 @@ import java.util.Map; * 单位 表 * * @author why - * @since 2022-06-30 + * @since 2023-01-12 */ @Service public class UnitServiceImpl extends CrudServiceImpl implements IUnitService { 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 0a144ca..35f6278 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 @@ -74,7 +74,7 @@ public enum InfluxClient { } /** - * desc: 异步批量 写入数据/更新数据 + * desc: 异步批量 写入数据 / 更新数据 * notes: 如果是更新数据,要保证time字段不能改变 * auth: caixaing * */ @@ -99,7 +99,6 @@ public enum InfluxClient { .time(event.getTime().toEpochMilli(), WritePrecision.MS); } writeApi.writePoint(point); - } /** @@ -120,7 +119,7 @@ public enum InfluxClient { }else { point = Point.measurement(measurement) .addTag("transationId", event.getTransationId()==null ? "" : event.getTransationId()) - .addTag("inspectionSheetId", event.getInspectionSheetId()) + .addTag("inspectionSheetId", event.getInspectionSheetId()==null ? "" : event.getInspectionSheetId()) // .addTag("batchNum", event.getBatchNum()) .addTag("sampleNumber", event.getSampleNumber()) @@ -181,43 +180,44 @@ public enum InfluxClient { return queryApi.query(flux); } - public List queryByGroup(QueryDataParam param){ - String measurement = param.getMeasurement(); - List dropedTagNames = param.getDropedTagNames(); - Range range = param.getRange(); - String bucket = param.getBucket(); - - - 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+"\")"; - -// 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+"\"])"; - } - flux += "|> sort(columns: [\"_time\"], desc: true)"; - if(pageInfo!=null){ - flux += "|> limit(n: "+pageInfo.getSize()+", offset: "+(pageInfo.getCurrent()-1)* pageInfo.getSize()+")"; - } - return queryApi.query(flux); - } +// public List queryByGroup(QueryDataParam param){ +// String measurement = param.getMeasurement(); +// List dropedTagNames = param.getDropedTagNames(); +// Range range = param.getRange(); +// String bucket = param.getBucket(); +// +// +// +// 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+"\")"; +// +//// 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+"\"])"; +// } +// flux += "|> sort(columns: [\"_time\"], desc: true)"; +// if(pageInfo!=null){ +// flux += "|> limit(n: "+pageInfo.getSize()+", offset: "+(pageInfo.getCurrent()-1)* pageInfo.getSize()+")"; +// } +// return queryApi.query(flux); +// } public List queryGroupByTime(QueryDataGroupByTimeParam param){ String measurement = param.getMeasurement(); diff --git a/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java b/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java index ed17a2d..d3eaa00 100644 --- a/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java +++ b/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java @@ -63,10 +63,9 @@ public class S7DemoController { } @PostMapping("/insertDemoOne") - public void insertDemoOne() throws InterruptedException { + public void insertDemoOne(){ + List list = new ArrayList<>(); - - Event event = new Event(); event.setTime(new Date(1670554110451L).toInstant()); event.setArgName("failDayDay"); @@ -81,22 +80,9 @@ public class S7DemoController { event2.setSampleNumber("10001"); list.add(event2); InfluxClient.Client.batchInsert(list,"Weight"); - -// Thread.sleep(10000); -// -// List 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 { + public void readDemoOne() { List dropNames = new ArrayList<>(); dropNames.add("transationId"); // dropNames.add("inspectionSheetId"); @@ -114,7 +100,7 @@ public class S7DemoController { } @PostMapping("/getFlux") - public Result getFlux() throws InterruptedException { + public Result getFlux() { List dropNames = new ArrayList<>(); dropNames.add("transationId"); dropNames.add("inspectionSheetId"); @@ -133,7 +119,7 @@ public class S7DemoController { } @PostMapping("/saveFlux1") - public Result saveFlux1() throws InterruptedException { + public Result saveFlux1() { List list = new ArrayList<>(); Event event2 = new Event(); @@ -146,8 +132,9 @@ public class S7DemoController { InfluxClient.Client.batchInsert(list,"Weight"); return new Result().ok(instant); } + @PostMapping("/saveFlux2") - public void saveFlux2(@RequestBody TIMETest timeTest) throws InterruptedException { + public void saveFlux2(@RequestBody TIMETest timeTest) { List list = new ArrayList<>(); Event event2 = new Event(); @@ -209,7 +196,7 @@ public class S7DemoController { // public void insertAndQuery() throws InterruptedException { // Event event = new Event(); // -//// long l = System.currentTimeMillis(); +// long l = System.currentTimeMillis(); //// System.out.println("l:"+l); //// event.setTime(new Date(1669874900889l).toInstant()); //// diff --git a/ym-influx/src/main/java/com/cnbm/influx/controller/SPCController.java b/ym-influx/src/main/java/com/cnbm/influx/controller/SPCController.java index ebd608c..5b2cdc6 100644 --- a/ym-influx/src/main/java/com/cnbm/influx/controller/SPCController.java +++ b/ym-influx/src/main/java/com/cnbm/influx/controller/SPCController.java @@ -1,13 +1,9 @@ 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.QueryDataParam; -import com.cnbm.influx.param.Range; -import com.cnbm.influx.param.Tag; -import com.cnbm.influx.template.Event; import com.influxdb.query.FluxTable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -15,8 +11,6 @@ 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.*; @RestController @@ -24,9 +18,8 @@ import java.util.*; public class SPCController { private static final Logger logger = LoggerFactory.getLogger(SPCController.class); - @PostMapping("/getData") - public Result getData(@RequestBody QueryDataParam param) throws InterruptedException { + public Result getData(@RequestBody QueryDataParam param){ List query = InfluxClient.Client.query(param); return new Result>().ok(query); } diff --git a/ym-influx/src/main/java/com/cnbm/influx/param/PageInfo.java b/ym-influx/src/main/java/com/cnbm/influx/param/PageInfo.java index 5123a6a..92cf5b4 100644 --- a/ym-influx/src/main/java/com/cnbm/influx/param/PageInfo.java +++ b/ym-influx/src/main/java/com/cnbm/influx/param/PageInfo.java @@ -21,4 +21,7 @@ public class PageInfo { this.current = current; this.size = size; } + + public PageInfo() { + } } diff --git a/ym-influx/src/main/java/com/cnbm/influx/param/QueryDataParam.java b/ym-influx/src/main/java/com/cnbm/influx/param/QueryDataParam.java index 6195ad5..116a281 100644 --- a/ym-influx/src/main/java/com/cnbm/influx/param/QueryDataParam.java +++ b/ym-influx/src/main/java/com/cnbm/influx/param/QueryDataParam.java @@ -31,7 +31,9 @@ public class QueryDataParam extends BaseParam{ //查询的时候,需要忽略的字段。(transationId是唯一标识会对 最终的查询结果集产生影响) private List dropedTagNames; private String bucket; - private String groupName; //private String inspectionSheetId; + + public QueryDataParam() { + } } diff --git a/ym-influx/src/main/java/com/cnbm/influx/param/Range.java b/ym-influx/src/main/java/com/cnbm/influx/param/Range.java index 4450c46..1378b6b 100644 --- a/ym-influx/src/main/java/com/cnbm/influx/param/Range.java +++ b/ym-influx/src/main/java/com/cnbm/influx/param/Range.java @@ -23,7 +23,9 @@ public class Range { this.end = end; } -// public static void main(String[] args) { + public Range() { + } + // public static void main(String[] args) { // Date date = new Date(); // System.out.println(date.toInstant().toString()); // } diff --git a/ym-influx/src/main/java/com/cnbm/influx/param/Tag.java b/ym-influx/src/main/java/com/cnbm/influx/param/Tag.java index fea0ab9..357d4e7 100644 --- a/ym-influx/src/main/java/com/cnbm/influx/param/Tag.java +++ b/ym-influx/src/main/java/com/cnbm/influx/param/Tag.java @@ -16,4 +16,7 @@ public class Tag { this.tagName = tagName; this.tagValue = tagValue; } + + public Tag() { + } } diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/constant/Constant.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/constant/Constant.java index e03f8fd..a6e5e18 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/constant/Constant.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/constant/Constant.java @@ -7,4 +7,4 @@ package com.cnbm.processInspection.constant; */ public class Constant { public String measureMent = "WeightHeiHei"; -} +} \ No newline at end of file diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/InspectionSheetController.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/InspectionSheetController.java index 33b9dc8..3e027d8 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/InspectionSheetController.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/InspectionSheetController.java @@ -13,8 +13,6 @@ 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.processInspection.dto.InspectionSampleDTO; import com.cnbm.processInspection.dto.InspectionSampleDTO2; import com.cnbm.processInspection.dto.InspectionSampleDTO3; @@ -22,7 +20,6 @@ import com.cnbm.processInspection.dto.InspectionSheetDTO; import com.cnbm.processInspection.entity.InspectionSheet; import com.cnbm.processInspection.excel.InspectionSheetExcel; import com.cnbm.processInspection.service.IInspectionSheetService; -import com.influxdb.query.FluxTable; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -71,7 +68,6 @@ public class InspectionSheetController { @PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:page')") public Result> page(@ApiIgnore @RequestParam Map params){ PageData page = inspectionSheetService.page(params); - return new Result>().ok(page); } @@ -80,7 +76,6 @@ public class InspectionSheetController { @PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:info')") public Result get(@PathVariable("id") Long id){ InspectionSheetDTO data = inspectionSheetService.get(id); - return new Result().ok(data); } @@ -91,7 +86,6 @@ public class InspectionSheetController { public Result save(@RequestBody InspectionSheetDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - // try { // inspectionSheetService.saveSheet(dto); // }catch (Exception e){ @@ -195,7 +189,6 @@ public class InspectionSheetController { @PostMapping("saveFluxParamList2") @ApiOperation("将样本检测参数写入influxdb2") public Result saveFluxParamList2(@RequestBody InspectionSampleDTO2[] lists) throws InterruptedException{ - inspectionSheetService.saveFluxParamList2(lists); Thread.sleep(1000); //样本数据更新后 计算检验单缺陷数不良数 @@ -206,7 +199,6 @@ public class InspectionSheetController { @PostMapping("saveFluxParamList3") @ApiOperation("将样本检测参数写入influxdb3") public Result saveFluxParamList3(@RequestBody InspectionSampleDTO3[] lists) throws InterruptedException{ - inspectionSheetService.saveFluxParamList3(lists); Thread.sleep(1000); //样本数据更新后 计算检验单缺陷数不良数 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 f92f0f0..10d588b 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 @@ -6,13 +6,10 @@ import com.cnbm.basic.service.IProductFeaturesService; import com.cnbm.common.spc.math.StandardDiviation; import com.cnbm.common.spc.util.DataUtils; import com.cnbm.common.vo.R; -import com.cnbm.influx.config.InfluxClient; import com.cnbm.influx.constant.Constant; import com.cnbm.influx.param.QueryDataGroupByTimeParam; 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.*; import com.cnbm.processInspection.graphAnalyzed.forCount.c.CGraph; import com.cnbm.processInspection.graphAnalyzed.forCount.np.NPGraph; @@ -22,8 +19,6 @@ import com.cnbm.processInspection.graphAnalyzed.forMeterage.mr.MeanRGraph; import com.cnbm.processInspection.graphAnalyzed.forMeterage.ms.MeanStandardDeviationGraph; import com.cnbm.processInspection.graphAnalyzed.forMeterage.xmr.XMRGraph; import com.cnbm.qualityPlanning.entity.ControlLimitDetail; -import com.influxdb.query.FluxRecord; -import com.influxdb.query.FluxTable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; @@ -32,12 +27,8 @@ 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.Arrays; import java.util.List; -import java.util.Random; @RestController @RequestMapping("/processInspection") @@ -227,7 +218,8 @@ public class ProcessInspectionController { NPGraph npGraph = new NPGraph(productFeatures); QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam(); - queryDataParam.setMeasurement(Constant.measurement); +// queryDataParam.setMeasurement(Constant.measurement); + queryDataParam.setMeasurement(graphArg.getProcedureName()); queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() )); queryDataParam.setTimeType(graphArg.getGroupType()); npGraph.initialDate(queryDataParam); @@ -354,7 +346,8 @@ public class ProcessInspectionController { meanStandardDeviationGraph.isNeedInterpretation(graphArg.getInterpretationScheme()); } QueryDataParam queryDataParam = new QueryDataParam(); - queryDataParam.setMeasurement(Constant.measurement); +// queryDataParam.setMeasurement(Constant.measurement); + queryDataParam.setMeasurement(graphArg.getProcedureName()); queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant())); meanStandardDeviationGraph.initialDate(queryDataParam); @@ -389,7 +382,9 @@ public class ProcessInspectionController { } QueryDataParam queryDataParam = new QueryDataParam(); - queryDataParam.setMeasurement(Constant.measurement); +// queryDataParam.setMeasurement(Constant.measurement); + queryDataParam.setMeasurement(graphArg.getProcedureName()); + queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant())); meanRGraph.initialDate(queryDataParam); @@ -424,7 +419,8 @@ public class ProcessInspectionController { } QueryDataParam queryDataParam = new QueryDataParam(); - queryDataParam.setMeasurement(Constant.measurement); +// queryDataParam.setMeasurement(Constant.measurement); + queryDataParam.setMeasurement(graphArg.getProcedureName()); queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant())); xmrGraph.initialDate(queryDataParam); @@ -453,7 +449,8 @@ public class ProcessInspectionController { PGraph pGraph = new PGraph(productFeatures); QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam(); - queryDataParam.setMeasurement(Constant.measurement); +// queryDataParam.setMeasurement(Constant.measurement); + queryDataParam.setMeasurement(graphArg.getProcedureName()); queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() )); queryDataParam.setTimeType(graphArg.getGroupType()); pGraph.initialDate(queryDataParam); @@ -474,7 +471,8 @@ public class ProcessInspectionController { CGraph cGraph = new CGraph(productFeatures); QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam(); - queryDataParam.setMeasurement(Constant.measurement); +// queryDataParam.setMeasurement(Constant.measurement); + queryDataParam.setMeasurement(graphArg.getProcedureName()); queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() )); queryDataParam.setTimeType(graphArg.getGroupType()); cGraph.initialDate(queryDataParam); @@ -496,7 +494,8 @@ public class ProcessInspectionController { UGraph uGraph = new UGraph(productFeatures); QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam(); - queryDataParam.setMeasurement(Constant.measurement); +// queryDataParam.setMeasurement(Constant.measurement); + queryDataParam.setMeasurement(graphArg.getProcedureName()); queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() )); 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 0720310..bd085ac 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 @@ -41,4 +41,7 @@ public class GraphArg { @ApiModelProperty(value = "分组类别(1=年 , 2=月 , 3=日)(用于计数型控制图)") private Integer groupType; + + @ApiModelProperty(value = "工序名") + private String procedureName; } diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/np/NPGraph.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/np/NPGraph.java index b43ebc0..2390815 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/np/NPGraph.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forCount/np/NPGraph.java @@ -86,6 +86,8 @@ public class NPGraph { return totalFailNum/totalN; } + + /** * name : 初始化数据函数 * desc : 从influxdb 里面读取数据,然后 加工处理成 我需要的 diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/mr/MeanRGraph.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/mr/MeanRGraph.java index e7c9970..31d179c 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/mr/MeanRGraph.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/mr/MeanRGraph.java @@ -116,7 +116,12 @@ public class MeanRGraph { List records = fluxTable.getRecords(); for (FluxRecord fluxRecord : records) { //因为 传进去的就是Double 类型,所以取出来,自然而然就是Double - originData.add(Double.parseDouble(fluxRecord.getValueByKey("_value").toString())); + Object value = fluxRecord.getValueByKey("_value"); + + if(value!=null){ + originData.add(Double.parseDouble(value.toString())); + } + } }