refactor(plcData): 重构 PlcDataDto 类

- 在 CommonQuery 中支持 Boolean 类型- 修复 DataCollectorService 中的消息发送逻辑
- 重构 PlcDataDto 类,添加多个字符串、整数、浮点数和布尔类型的字段
- 在 WarehouseReceiptService 中使用 NumberUtils.round2 方法进行金额计算
This commit is contained in:
2025-05-10 21:51:24 +08:00
parent 099c26e606
commit bc04cba494
4 changed files with 230 additions and 5 deletions

View File

@@ -52,6 +52,7 @@ public class CommonQuery {
private static final List<Class> supportTypes =
List.of(
String.class,
Boolean.class,
Integer.class,
Long.class,
Double.class,

View File

@@ -246,6 +246,6 @@ public class DataCollectorService
"sign",
new HmacUtils(HmacAlgorithms.HMAC_SHA_256, entity.getAppSecret())
.hmacHex(message.getBody()));
rabbitTemplate.send(message);
rabbitTemplate.send(dto.getExchange(), dto.getRoutingKey(), message );
}
}

View File

@@ -1,8 +1,231 @@
package cn.lihongjie.coal.plcData.dto;
import cn.lihongjie.coal.base.dto.OrgCommonDto;
import cn.lihongjie.coal.base.dto.SimpleDto;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class PlcDataDto extends OrgCommonDto {}
public class PlcDataDto extends OrgCommonDto {
private SimpleDto device;
private LocalDateTime time;
private String str1;
private String str2;
private String str3;
private String str4;
private String str5;
private String str6;
private String str7;
private String str8;
private String str9;
private String str10;
private String str11;
private String str12;
private String str13;
private String str14;
private String str15;
private String str16;
private String str17;
private String str18;
private String str19;
private String str20;
private String str21;
private String str22;
private String str23;
private String str24;
private String str25;
private String str26;
private String str27;
private String str28;
private String str29;
private String str30;
private String str31;
private String str32;
private String str33;
private String str34;
private String str35;
private String str36;
private String str37;
private String str38;
private String str39;
private String str40;
private String str41;
private String str42;
private String str43;
private String str44;
private String str45;
private String str46;
private String str47;
private String str48;
private String str49;
private String str50;
private Integer int1;
private Integer int2;
private Integer int3;
private Integer int4;
private Integer int5;
private Integer int6;
private Integer int7;
private Integer int8;
private Integer int9;
private Integer int10;
private Integer int11;
private Integer int12;
private Integer int13;
private Integer int14;
private Integer int15;
private Integer int16;
private Integer int17;
private Integer int18;
private Integer int19;
private Integer int20;
private Integer int21;
private Integer int22;
private Integer int23;
private Integer int24;
private Integer int25;
private Integer int26;
private Integer int27;
private Integer int28;
private Integer int29;
private Integer int30;
private Integer int31;
private Integer int32;
private Integer int33;
private Integer int34;
private Integer int35;
private Integer int36;
private Integer int37;
private Integer int38;
private Integer int39;
private Integer int40;
private Integer int41;
private Integer int42;
private Integer int43;
private Integer int44;
private Integer int45;
private Integer int46;
private Integer int47;
private Integer int48;
private Integer int49;
private Integer int50;
private Double double1;
private Double double2;
private Double double3;
private Double double4;
private Double double5;
private Double double6;
private Double double7;
private Double double8;
private Double double9;
private Double double10;
private Double double11;
private Double double12;
private Double double13;
private Double double14;
private Double double15;
private Double double16;
private Double double17;
private Double double18;
private Double double19;
private Double double20;
private Double double21;
private Double double22;
private Double double23;
private Double double24;
private Double double25;
private Double double26;
private Double double27;
private Double double28;
private Double double29;
private Double double30;
private Double double31;
private Double double32;
private Double double33;
private Double double34;
private Double double35;
private Double double36;
private Double double37;
private Double double38;
private Double double39;
private Double double40;
private Double double41;
private Double double42;
private Double double43;
private Double double44;
private Double double45;
private Double double46;
private Double double47;
private Double double48;
private Double double49;
private Double double50;
private Boolean bool1;
private Boolean bool2;
private Boolean bool3;
private Boolean bool4;
private Boolean bool5;
private Boolean bool6;
private Boolean bool7;
private Boolean bool8;
private Boolean bool9;
private Boolean bool10;
private Boolean bool11;
private Boolean bool12;
private Boolean bool13;
private Boolean bool14;
private Boolean bool15;
private Boolean bool16;
private Boolean bool17;
private Boolean bool18;
private Boolean bool19;
private Boolean bool20;
private Boolean bool21;
private Boolean bool22;
private Boolean bool23;
private Boolean bool24;
private Boolean bool25;
private Boolean bool26;
private Boolean bool27;
private Boolean bool28;
private Boolean bool29;
private Boolean bool30;
private Boolean bool31;
private Boolean bool32;
private Boolean bool33;
private Boolean bool34;
private Boolean bool35;
private Boolean bool36;
private Boolean bool37;
private Boolean bool38;
private Boolean bool39;
private Boolean bool40;
private Boolean bool41;
private Boolean bool42;
private Boolean bool43;
private Boolean bool44;
private Boolean bool45;
private Boolean bool46;
private Boolean bool47;
private Boolean bool48;
private Boolean bool49;
private Boolean bool50;
}

View File

@@ -305,9 +305,10 @@ public class WarehouseReceiptService
}
entity.setAmount(
entity.getDetail().stream()
.map(WarehouseReceiptDetailEntity::getAmount)
.reduce(0.0, Double::sum));
NumberUtils.round2(
entity.getDetail().stream()
.map(WarehouseReceiptDetailEntity::getAmount)
.reduce(0.0, Double::sum)));
entity.setNumber(
entity.getDetail().stream()