From 5a9f5ee38b455a271b7be48af1a8e5b59491e0b7 Mon Sep 17 00:00:00 2001 From: caixiang <939387484@qq.com> Date: Tue, 9 May 2023 14:24:13 +0800 Subject: [PATCH] mark --- .../java/com/cnbm/config/SwaggerConfig.java | 4 +-- ym-gateway/src/main/resources/application.yml | 6 ++-- .../controller/InspectionSheetController.java | 9 ------ .../com/cnbm/influx/config/InfluxClient.java | 4 +-- .../influx/controller/S7DemoController.java | 29 +++++-------------- .../cnbm/influx/controller/SPCController.java | 9 +----- .../controller/InspectionSheetController.java | 8 ----- .../graphAnalyzed/forCount/np/NPGraph.java | 2 ++ 8 files changed, 17 insertions(+), 54 deletions(-) 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-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-influx/src/main/java/com/cnbm/influx/config/InfluxClient.java b/ym-influx/src/main/java/com/cnbm/influx/config/InfluxClient.java index 662c45b..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); - } /** @@ -181,6 +180,7 @@ public enum InfluxClient { return queryApi.query(flux); } + // public List queryByGroup(QueryDataParam param){ // String measurement = param.getMeasurement(); // List dropedTagNames = param.getDropedTagNames(); 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 cbabd12..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 @@ -26,7 +20,6 @@ public class SPCController { @PostMapping("/getData") public Result getData(@RequestBody QueryDataParam param){ - List query = InfluxClient.Client.query(param); return new Result>().ok(query); } 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/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 里面读取数据,然后 加工处理成 我需要的