diff --git a/beneficiation/src/main/resources/application.yml b/beneficiation/src/main/resources/application.yml index ac92adb9..1ac895fc 100644 --- a/beneficiation/src/main/resources/application.yml +++ b/beneficiation/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - active: test - include: common, util-test + active: prod + include: common, util-prod diff --git a/cloudutil/src/main/resources/application-util-prod.yml b/cloudutil/src/main/resources/application-util-prod.yml index 189c4bef..6fd2ea14 100644 --- a/cloudutil/src/main/resources/application-util-prod.yml +++ b/cloudutil/src/main/resources/application-util-prod.yml @@ -22,7 +22,7 @@ eureka: #defaultZone: http://admin:admin@peer1:8761/eureka/,http://admin:admin@peer2:8762/eureka/ # defaultZone: http://admin:admin@81.70.54.64:7010/eureka/ - defaultZone: http://admin:admin@192.144.182.42:7010/eureka/ + defaultZone: http://admin:admin@121.36.3.207:7010/eureka/ instance: # 是否注册IP到eureka server,如不指定或设为false,那就回注册主机名到eureka server diff --git a/cloudutil/src/main/resources/application-util-test.yml b/cloudutil/src/main/resources/application-util-test.yml index 5401183c..3429f03e 100644 --- a/cloudutil/src/main/resources/application-util-test.yml +++ b/cloudutil/src/main/resources/application-util-test.yml @@ -83,7 +83,7 @@ eureka: # 指定eureka server通信地址,注意/eureka/小尾巴不能少 #defaultZone: http://admin:admin@peer1:8761/eureka/,http://admin:admin@peer2:8762/eureka/ # defaultZone: http://admin:admin@49.232.6.143:7010/eureka/ - defaultZone: http://admin:admin@192.168.0.99:7010/eureka/ + defaultZone: http://admin:admin@192.168.31.13:7010/eureka/ # defaultZone: http://admin:admin@test.tall.wiki:7010/eureka/ instance: # 是否注册IP到eureka server,如不指定或设为false,那就回注册主机名到eureka server diff --git a/game/src/main/resources/application-prod.yml b/game/src/main/resources/application-prod.yml index 25d923e2..21a31e26 100644 --- a/game/src/main/resources/application-prod.yml +++ b/game/src/main/resources/application-prod.yml @@ -32,7 +32,7 @@ swagger: enable: true eureka: instance: - ip-address: 192.144.182.42 + ip-address: 121.36.3.207 gatewayUrl: https://www.tall.wiki/gateway/ notGatewayUrl: https://www.tall.wiki/ diff --git a/game/src/main/resources/application-prodsd.yml b/game/src/main/resources/application-prodsd.yml index ebd7485c..4e218684 100644 --- a/game/src/main/resources/application-prodsd.yml +++ b/game/src/main/resources/application-prodsd.yml @@ -31,7 +31,7 @@ swagger: enable: true eureka: instance: - ip-address: 81.70.54.64 + ip-address: 121.36.3.207 gatewayUrl: https://www.tall.wiki/gateway/ notGatewayUrl: https://www.tall.wiki/ diff --git a/game/src/main/resources/application.yml b/game/src/main/resources/application.yml index 6c2249b0..d082c0ea 100644 --- a/game/src/main/resources/application.yml +++ b/game/src/main/resources/application.yml @@ -1,4 +1,4 @@ spring: profiles: - active: prodapi + active: prod include: common, util-prod \ No newline at end of file diff --git a/ht/src/main/resources/application-prod.yml b/ht/src/main/resources/application-prod.yml index c3cc8976..d14db72c 100644 --- a/ht/src/main/resources/application-prod.yml +++ b/ht/src/main/resources/application-prod.yml @@ -39,5 +39,5 @@ ht: name: 认知功能评测云平台系统 eureka: instance: - ip-address: 81.70.54.64 + ip-address: 121.36.3.207 diff --git a/mt/src/main/resources/application-dev.yml b/mt/src/main/resources/application-dev.yml index 646ecd0c..45fd1c45 100644 --- a/mt/src/main/resources/application-dev.yml +++ b/mt/src/main/resources/application-dev.yml @@ -8,7 +8,7 @@ spring: datasource: type: com.alibaba.druid.pool.DruidDataSource rabbitmq: - host: 81.70.54.64 + host: 121.36.3.207 password: 111111 port: 5672 username: admin diff --git a/mt/src/main/resources/application.yml b/mt/src/main/resources/application.yml index a47f2a7b..1ac895fc 100644 --- a/mt/src/main/resources/application.yml +++ b/mt/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - active: dev - include: common, util-dev + active: prod + include: common, util-prod diff --git a/ocr/src/main/resources/application-prodsd.yml b/ocr/src/main/resources/application-prodsd.yml index 0e72ae87..b3d23b27 100644 --- a/ocr/src/main/resources/application-prodsd.yml +++ b/ocr/src/main/resources/application-prodsd.yml @@ -31,7 +31,7 @@ swagger: enable: false eureka: instance: - ip-address: 81.70.54.64 + ip-address: 121.36.3.207 gatewayUrl: https://www.tall.wiki/gateway/ notGatewayUrl: https://www.tall.wiki/ diff --git a/ocr/src/test/java/com/ccsens/orc/test/OrcTest.java b/ocr/src/test/java/com/ccsens/orc/test/OrcTest.java index 4d4a73ec..cc01df11 100644 --- a/ocr/src/test/java/com/ccsens/orc/test/OrcTest.java +++ b/ocr/src/test/java/com/ccsens/orc/test/OrcTest.java @@ -53,8 +53,9 @@ public class OrcTest { // 反色操作 Core.bitwise_not(mat, mat); // 将反色结果作为掩膜 - Mat target = new Mat(mat.height(), mat.width(), CvType.CV_8UC3); - + Mat bg = Imgcodecs.imread("D:\\img\\e2669de7219943b8ac37f79dd8fef2f8.png"); + Imgproc.resize(bg, bg, mat.size()); + bg.copyTo(mat,mat); Imgcodecs.imwrite("D:\\img\\1.png", mat); } } diff --git a/pom.xml b/pom.xml index 3a1adf27..886f407b 100644 --- a/pom.xml +++ b/pom.xml @@ -9,9 +9,9 @@ cloudutil util tall - - - + ht + game + mt wisdomcar beneficiation diff --git a/tall/src/main/resources/application-prodsd.yml b/tall/src/main/resources/application-prodsd.yml index 1177ad28..fc50b900 100644 --- a/tall/src/main/resources/application-prodsd.yml +++ b/tall/src/main/resources/application-prodsd.yml @@ -31,7 +31,7 @@ swagger: enable: false eureka: instance: - ip-address: 81.70.54.64 + ip-address: 121.36.3.207 gatewayUrl: https://www.tall.wiki/gateway/ notGatewayUrl: https://www.tall.wiki/ diff --git a/tall/src/main/resources/application-test.yml b/tall/src/main/resources/application-test.yml index 0d2c66c4..c6f9600e 100644 --- a/tall/src/main/resources/application-test.yml +++ b/tall/src/main/resources/application-test.yml @@ -32,7 +32,7 @@ swagger: enable: true eureka: instance: - ip-address: 192.168.0.99 + ip-address: 127.0.0.1 # ip-address: 49.233.89.188 #gatewayUrl: http://192.168.0.99/gateway/ #notGatewayUrl: http://192.168.0.99/ diff --git a/tall/src/main/resources/application.yml b/tall/src/main/resources/application.yml index b5408a3a..e75cc2c3 100644 --- a/tall/src/main/resources/application.yml +++ b/tall/src/main/resources/application.yml @@ -1,5 +1,5 @@ spring: profiles: - active: dev - include: util-dev,common + active: prod + include: util-prod,common diff --git a/util/src/main/java/com/ccsens/util/PoiUtil.java b/util/src/main/java/com/ccsens/util/PoiUtil.java index ddb69837..654acf07 100644 --- a/util/src/main/java/com/ccsens/util/PoiUtil.java +++ b/util/src/main/java/com/ccsens/util/PoiUtil.java @@ -186,7 +186,6 @@ public class PoiUtil { if(ObjectUtil.isNull(cell.value)) { log.info("单元格内容为空:{}", cell.value); }else { - log.info("单元格内容:{}", cell.value); if (cell.value.length() <= 14 && cell.value.matches("\\d+")) { newCell.setCellValue(Long.parseLong(cell.value)); } else { diff --git a/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/RecordDto.java b/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/RecordDto.java index 2a8b0fdc..c0c265ef 100644 --- a/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/RecordDto.java +++ b/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/RecordDto.java @@ -26,6 +26,9 @@ public class RecordDto { private Long startTime; @ApiModelProperty("结束时间, 默认当前时间") private Long endTime; + @ApiModelProperty("数据类型 0开始 1体重 2rfid, 3称重一 4称重二 5称重三 6称重四 7震动 8剂量") + private byte[] types = {1,2}; + // @ApiModelProperty("当前页,默认1") // private int pageNum=1; // @ApiModelProperty("每页数量,默认100") @@ -55,6 +58,8 @@ public class RecordDto { private Long startTime; @ApiModelProperty("结束时间, 默认当前时间") private Long endTime; + @ApiModelProperty("数据类型 0开始 1体重 2rfid, 3称重一 4称重二 5称重三 6称重四 7震动 8剂量") + private byte[] types = {1,2}; { endTime = System.currentTimeMillis(); diff --git a/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/RecordVo.java b/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/RecordVo.java index 2a0259e4..1dad8cd8 100644 --- a/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/RecordVo.java +++ b/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/RecordVo.java @@ -1,12 +1,9 @@ package com.ccsens.wisdomcar.bean.vo; -import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; - /** * @description: 数据记录 * @author: whj @@ -21,7 +18,7 @@ public class RecordVo { @ApiModelProperty("时间") private Long time; @ApiModelProperty("类型:1体重 2rfid") - private Byte type; + private byte type; private String value; private String name; } diff --git a/wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/WisdomCarRecordDao.java b/wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/WisdomCarRecordDao.java index 41f5dbe1..97e5d3f1 100644 --- a/wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/WisdomCarRecordDao.java +++ b/wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/WisdomCarRecordDao.java @@ -20,4 +20,15 @@ public interface WisdomCarRecordDao extends WisdomCarRecordMapper { * @return 称重和rfid记录 */ List queryWeightAndRfid(@Param("carId") Long carId, @Param("startTime") Long startTime, @Param("endTime") Long endTime); + + /** + * 根据类型查询平车记录 + * @param carId 平车ID + * @param startTime 开始时间 + * @param endTime 结束时间 + * @param type 数据类型 + * @return 记录 + */ + List queryRecords(@Param("carId") Long carId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("type") byte type); + } diff --git a/wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java b/wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java index 52ddfa1e..9498902a 100644 --- a/wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java +++ b/wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java @@ -151,9 +151,56 @@ public class RecordService implements IRecordService{ @Override public List queryWeightAndRfid(RecordDto.WeightAndRfid param, Long userId) { - List list = queryWeightAndRfid(param.getCarId(), param.getStartTime(), param.getEndTime()); + List list = queryRecord(param.getCarId(), param.getStartTime(), param.getEndTime(), param.getTypes()); return list; } + private List queryRecord(Long carId, Long startTime, Long endTime, byte[] types) { + List records = new ArrayList<>(); + if (types == null || types.length == 0) { + log.info("没有输入查询记录类型,直接返回"); + return records; + } + + for (byte type : types) { + List list = wisdomCarRecordDao.queryRecords(carId, startTime, endTime, type); + RecordVo.WeightAndRfid prev = null; + for (int i = 0; i < list.size(); i++) { + RecordVo.WeightAndRfid cur = list.get(i); + if (i == 0) { + records.add(cur); + prev = cur; + continue; + } + // i > 0 && cur.type == prev.type + //称重 + if (cur.getType() == Constant.CAR_RECORD_WEIGHT) { + // 重量差大于10KG或时间间隔大于10分钟,保留 + if (Math.abs(Integer.parseInt(cur.getValue()) - Integer.parseInt(prev.getValue())) > weightMinus + || Math.abs(cur.getTime() - prev.getTime()) > timeMinus) { + records.add(cur); + prev = cur; + } + continue; + } + // 非称重 值不重复 或 非称重 值重复 最后一条数据 + if(!cur.getValue().equals(prev.getValue()) || i == list.size() -1){ + records.add(cur); + + } else if (!cur.getValue().equals(list.get(i+1).getValue()) ) { + // 非称重 值重复 非最后一条数据 + // 判断与下一个是否一致,一致,则不保留第一个和最后一个 + records.add(cur); + } + prev = cur; + } + } + if (types.length > 1) { + log.info("重新排序"); + Collections.sort(records, (o1, o2) -> (int) (o1.getTime() - o2.getTime())); + } + return records; + } + /** * 查询数据 @@ -218,7 +265,7 @@ public class RecordService implements IRecordService{ @Override public Workbook exportWeightAndRfid(RecordDto.WeightAndRfidExport param) { log.info("数据导出:{}", param); - List list = queryWeightAndRfid(param.getCarId(), param.getStartTime(), param.getEndTime()); + List list = queryRecord(param.getCarId(), param.getStartTime(), param.getEndTime(), param.getTypes()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 参数封装 List> rows = new ArrayList<>(); @@ -246,7 +293,18 @@ public class RecordService implements IRecordService{ Date time = new Date(); time.setTime(record.getTime()); row.add(new PoiUtil.PoiUtilCell(sdf.format(time))); - row.add(new PoiUtil.PoiUtilCell(record.getType() == Constant.CAR_RECORD_WEIGHT ? "称重" : "rfid")); + String type = "称重"; + switch (record.getType()) { + case Constant.CAR_RECORD_WEIGHT: type = "称重";break; + case Constant.CAR_RECORD_RFID: type = "rfid";break; + case Constant.WEIGHT_SENSOR_1: type = "称重1";break; + case Constant.WEIGHT_SENSOR_2: type = "称重2";break; + case Constant.WEIGHT_SENSOR_3: type = "称重3";break; + case Constant.WEIGHT_SENSOR_4: type = "称重4";break; + case Constant.SHAKE_SENSOR: type = "震动";break; + case Constant.THROMBOLYTIC: type = "剂量";break; + } + row.add(new PoiUtil.PoiUtilCell(type)); row.add(new PoiUtil.PoiUtilCell(record.getType() == Constant.CAR_RECORD_WEIGHT ? new BigDecimal(record.getValue()).divide(new BigDecimal(1000), 3).toString() + "Kg" : record.getName())); rows.add(row); } diff --git a/wisdomcar/src/main/resources/application-test.yml b/wisdomcar/src/main/resources/application-test.yml index 9af9b909..55574b45 100644 --- a/wisdomcar/src/main/resources/application-test.yml +++ b/wisdomcar/src/main/resources/application-test.yml @@ -28,7 +28,7 @@ swagger: enable: true eureka: instance: - ip-address: 192.168.0.99 + ip-address: 127.0.0.1 file: path: /home/cloud/wisdomcar/uploads/ signUpUrl: https://test.tall.wiki/compete/ diff --git a/wisdomcar/src/main/resources/mapper_dao/WisdomCarRecordDao.xml b/wisdomcar/src/main/resources/mapper_dao/WisdomCarRecordDao.xml index a292f581..dada4965 100644 --- a/wisdomcar/src/main/resources/mapper_dao/WisdomCarRecordDao.xml +++ b/wisdomcar/src/main/resources/mapper_dao/WisdomCarRecordDao.xml @@ -11,4 +11,31 @@ ) t order by time + \ No newline at end of file