From 14b12f1b2e5f479b7b38be6572f827b890f25624 Mon Sep 17 00:00:00 2001 From: zy_Java <654600784@qq.com> Date: Wed, 3 Mar 2021 11:51:02 +0800 Subject: [PATCH] =?UTF-8?q?20210303=E5=A4=84=E7=90=86=E9=80=89=E7=9F=BF?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=EF=BC=88=E6=9C=AA=E6=B5=8B=E8=AF=95=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/Message/BeneficiationMessageDto.java | 32 +- .../bean/dto/Message/PendingMessage.java | 31 + .../beneficiation/bean/dto/WeightDto.java | 2 + .../beneficiation/bean/po/Equipment.java | 11 - .../bean/po/EquipmentExample.java | 70 -- .../beneficiation/bean/po/EquipmentType.java | 106 +++ .../bean/po/EquipmentTypeExample.java | 681 ++++++++++++++++++ .../ccsens/beneficiation/bean/po/Record.java | 19 +- .../beneficiation/bean/po/RecordExample.java | 90 ++- .../beneficiation/bean/po/ThresholdValue.java | 12 +- .../bean/po/ThresholdValueExample.java | 48 +- .../beneficiation/bean/vo/MessageVo.java | 39 + .../beneficiation/bean/vo/ParameterVo.java | 14 +- .../beneficiation/persist/dao/RecordDao.java | 43 ++ .../persist/mapper/EquipmentTypeMapper.java | 30 + .../rabbitMQ/RabbitController.java | 14 +- .../beneficiation/service/IRecordService.java | 12 +- .../service/ParameterService.java | 204 ++++-- .../beneficiation/service/RecordService.java | 209 +++--- .../main/resources/mapper_dao/RecordDao.xml | 129 ++++ .../main/resources/mapper_dao/WeightDao.xml | 3 +- .../resources/mapper_raw/EquipmentMapper.xml | 27 +- .../mapper_raw/EquipmentTypeMapper.xml | 258 +++++++ .../resources/mapper_raw/RecordMapper.xml | 41 +- .../mapper_raw/ThresholdValueMapper.xml | 28 +- .../test/java/com/ccsens/util/OtherTest.java | 41 ++ 26 files changed, 1812 insertions(+), 382 deletions(-) create mode 100644 beneficiation/src/main/java/com/ccsens/beneficiation/bean/dto/Message/PendingMessage.java create mode 100644 beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/EquipmentType.java create mode 100644 beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/EquipmentTypeExample.java create mode 100644 beneficiation/src/main/java/com/ccsens/beneficiation/bean/vo/MessageVo.java create mode 100644 beneficiation/src/main/java/com/ccsens/beneficiation/persist/mapper/EquipmentTypeMapper.java create mode 100644 beneficiation/src/main/resources/mapper_raw/EquipmentTypeMapper.xml diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/dto/Message/BeneficiationMessageDto.java b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/dto/Message/BeneficiationMessageDto.java index f1a021dd..ffc865a2 100644 --- a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/dto/Message/BeneficiationMessageDto.java +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/dto/Message/BeneficiationMessageDto.java @@ -12,7 +12,7 @@ public class BeneficiationMessageDto { */ private String authId; /** - * 类型 0变频器 1皮带秤 2电磁阀 3流量计 4电耳 5每日称重信息 6界限值 7触碰界限值后更改记录 + * */ private Byte type; /** @@ -22,7 +22,7 @@ public class BeneficiationMessageDto { /** * 类型对应的值, */ - private String value; + private int value; /** * 版本号 */ @@ -32,32 +32,4 @@ public class BeneficiationMessageDto { */ private Long time = System.currentTimeMillis(); - public Byte getType(){ - if(this.type != null){ - return type; - } - switch (addr){ - case 21: - return 0; - case 22: - return 1; - case 23: - return 2; - case 24: - return 3; - case 25: - return 4; - case 26: - return 5; - case 27: - case 28: - case 29: - return 6; - case 30: //触碰到的界限的信息() - return 7; - default: - return type; - } - } - } diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/dto/Message/PendingMessage.java b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/dto/Message/PendingMessage.java new file mode 100644 index 00000000..25de565c --- /dev/null +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/dto/Message/PendingMessage.java @@ -0,0 +1,31 @@ +package com.ccsens.beneficiation.bean.dto.Message; + +import lombok.Data; + +/** + * @author 逗 + */ +@Data +public class PendingMessage { + /** + * 设备编号 + */ + private String authId; + /** + * 寄存器地址 + */ + private int addr; + /** + * 类型对应的值, + */ + private String value; + /** + * 版本号 + */ + private String version; + /** + * 时间 + */ + private Long time = System.currentTimeMillis(); + +} diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/dto/WeightDto.java b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/dto/WeightDto.java index cbb74ed9..1815b093 100644 --- a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/dto/WeightDto.java +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/dto/WeightDto.java @@ -1,5 +1,6 @@ package com.ccsens.beneficiation.bean.dto; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -46,6 +47,7 @@ public class WeightDto { @ApiModel("查询重量累计") public static class GetWeightTotal { @ApiModelProperty("日期 为空则默认当前") + @JsonFormat(pattern = "yyyy-MM-dd") private Date datetime; } diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/Equipment.java b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/Equipment.java index c46e53ea..400f714c 100644 --- a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/Equipment.java +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/Equipment.java @@ -10,8 +10,6 @@ public class Equipment implements Serializable { private String authId; - private String addr; - private String verion; private Long operator; @@ -48,14 +46,6 @@ public class Equipment implements Serializable { this.authId = authId == null ? null : authId.trim(); } - public String getAddr() { - return addr; - } - - public void setAddr(String addr) { - this.addr = addr == null ? null : addr.trim(); - } - public String getVerion() { return verion; } @@ -105,7 +95,6 @@ public class Equipment implements Serializable { sb.append(", id=").append(id); sb.append(", type=").append(type); sb.append(", authId=").append(authId); - sb.append(", addr=").append(addr); sb.append(", verion=").append(verion); sb.append(", operator=").append(operator); sb.append(", createdAt=").append(createdAt); diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/EquipmentExample.java b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/EquipmentExample.java index 9abef3e6..33e2c9a5 100644 --- a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/EquipmentExample.java +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/EquipmentExample.java @@ -295,76 +295,6 @@ public class EquipmentExample { return (Criteria) this; } - public Criteria andAddrIsNull() { - addCriterion("addr is null"); - return (Criteria) this; - } - - public Criteria andAddrIsNotNull() { - addCriterion("addr is not null"); - return (Criteria) this; - } - - public Criteria andAddrEqualTo(String value) { - addCriterion("addr =", value, "addr"); - return (Criteria) this; - } - - public Criteria andAddrNotEqualTo(String value) { - addCriterion("addr <>", value, "addr"); - return (Criteria) this; - } - - public Criteria andAddrGreaterThan(String value) { - addCriterion("addr >", value, "addr"); - return (Criteria) this; - } - - public Criteria andAddrGreaterThanOrEqualTo(String value) { - addCriterion("addr >=", value, "addr"); - return (Criteria) this; - } - - public Criteria andAddrLessThan(String value) { - addCriterion("addr <", value, "addr"); - return (Criteria) this; - } - - public Criteria andAddrLessThanOrEqualTo(String value) { - addCriterion("addr <=", value, "addr"); - return (Criteria) this; - } - - public Criteria andAddrLike(String value) { - addCriterion("addr like", value, "addr"); - return (Criteria) this; - } - - public Criteria andAddrNotLike(String value) { - addCriterion("addr not like", value, "addr"); - return (Criteria) this; - } - - public Criteria andAddrIn(List values) { - addCriterion("addr in", values, "addr"); - return (Criteria) this; - } - - public Criteria andAddrNotIn(List values) { - addCriterion("addr not in", values, "addr"); - return (Criteria) this; - } - - public Criteria andAddrBetween(String value1, String value2) { - addCriterion("addr between", value1, value2, "addr"); - return (Criteria) this; - } - - public Criteria andAddrNotBetween(String value1, String value2) { - addCriterion("addr not between", value1, value2, "addr"); - return (Criteria) this; - } - public Criteria andVerionIsNull() { addCriterion("verion is null"); return (Criteria) this; diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/EquipmentType.java b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/EquipmentType.java new file mode 100644 index 00000000..b7d1678c --- /dev/null +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/EquipmentType.java @@ -0,0 +1,106 @@ +package com.ccsens.beneficiation.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class EquipmentType implements Serializable { + private Long id; + + private Long equipmentId; + + private Byte type; + + private Integer addr; + + private Long operator; + + private Date createdAt; + + private Date updatedAt; + + private Byte recStatus; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getEquipmentId() { + return equipmentId; + } + + public void setEquipmentId(Long equipmentId) { + this.equipmentId = equipmentId; + } + + public Byte getType() { + return type; + } + + public void setType(Byte type) { + this.type = type; + } + + public Integer getAddr() { + return addr; + } + + public void setAddr(Integer addr) { + this.addr = addr; + } + + public Long getOperator() { + return operator; + } + + public void setOperator(Long operator) { + this.operator = operator; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public Byte getRecStatus() { + return recStatus; + } + + public void setRecStatus(Byte recStatus) { + this.recStatus = recStatus; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", equipmentId=").append(equipmentId); + sb.append(", type=").append(type); + sb.append(", addr=").append(addr); + sb.append(", operator=").append(operator); + sb.append(", createdAt=").append(createdAt); + sb.append(", updatedAt=").append(updatedAt); + sb.append(", recStatus=").append(recStatus); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/EquipmentTypeExample.java b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/EquipmentTypeExample.java new file mode 100644 index 00000000..e1a01477 --- /dev/null +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/EquipmentTypeExample.java @@ -0,0 +1,681 @@ +package com.ccsens.beneficiation.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class EquipmentTypeExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public EquipmentTypeExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andEquipmentIdIsNull() { + addCriterion("equipment_id is null"); + return (Criteria) this; + } + + public Criteria andEquipmentIdIsNotNull() { + addCriterion("equipment_id is not null"); + return (Criteria) this; + } + + public Criteria andEquipmentIdEqualTo(Long value) { + addCriterion("equipment_id =", value, "equipmentId"); + return (Criteria) this; + } + + public Criteria andEquipmentIdNotEqualTo(Long value) { + addCriterion("equipment_id <>", value, "equipmentId"); + return (Criteria) this; + } + + public Criteria andEquipmentIdGreaterThan(Long value) { + addCriterion("equipment_id >", value, "equipmentId"); + return (Criteria) this; + } + + public Criteria andEquipmentIdGreaterThanOrEqualTo(Long value) { + addCriterion("equipment_id >=", value, "equipmentId"); + return (Criteria) this; + } + + public Criteria andEquipmentIdLessThan(Long value) { + addCriterion("equipment_id <", value, "equipmentId"); + return (Criteria) this; + } + + public Criteria andEquipmentIdLessThanOrEqualTo(Long value) { + addCriterion("equipment_id <=", value, "equipmentId"); + return (Criteria) this; + } + + public Criteria andEquipmentIdIn(List values) { + addCriterion("equipment_id in", values, "equipmentId"); + return (Criteria) this; + } + + public Criteria andEquipmentIdNotIn(List values) { + addCriterion("equipment_id not in", values, "equipmentId"); + return (Criteria) this; + } + + public Criteria andEquipmentIdBetween(Long value1, Long value2) { + addCriterion("equipment_id between", value1, value2, "equipmentId"); + return (Criteria) this; + } + + public Criteria andEquipmentIdNotBetween(Long value1, Long value2) { + addCriterion("equipment_id not between", value1, value2, "equipmentId"); + return (Criteria) this; + } + + public Criteria andTypeIsNull() { + addCriterion("type is null"); + return (Criteria) this; + } + + public Criteria andTypeIsNotNull() { + addCriterion("type is not null"); + return (Criteria) this; + } + + public Criteria andTypeEqualTo(Byte value) { + addCriterion("type =", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotEqualTo(Byte value) { + addCriterion("type <>", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThan(Byte value) { + addCriterion("type >", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThanOrEqualTo(Byte value) { + addCriterion("type >=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThan(Byte value) { + addCriterion("type <", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThanOrEqualTo(Byte value) { + addCriterion("type <=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeIn(List values) { + addCriterion("type in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotIn(List values) { + addCriterion("type not in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeBetween(Byte value1, Byte value2) { + addCriterion("type between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotBetween(Byte value1, Byte value2) { + addCriterion("type not between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andAddrIsNull() { + addCriterion("addr is null"); + return (Criteria) this; + } + + public Criteria andAddrIsNotNull() { + addCriterion("addr is not null"); + return (Criteria) this; + } + + public Criteria andAddrEqualTo(Integer value) { + addCriterion("addr =", value, "addr"); + return (Criteria) this; + } + + public Criteria andAddrNotEqualTo(Integer value) { + addCriterion("addr <>", value, "addr"); + return (Criteria) this; + } + + public Criteria andAddrGreaterThan(Integer value) { + addCriterion("addr >", value, "addr"); + return (Criteria) this; + } + + public Criteria andAddrGreaterThanOrEqualTo(Integer value) { + addCriterion("addr >=", value, "addr"); + return (Criteria) this; + } + + public Criteria andAddrLessThan(Integer value) { + addCriterion("addr <", value, "addr"); + return (Criteria) this; + } + + public Criteria andAddrLessThanOrEqualTo(Integer value) { + addCriterion("addr <=", value, "addr"); + return (Criteria) this; + } + + public Criteria andAddrIn(List values) { + addCriterion("addr in", values, "addr"); + return (Criteria) this; + } + + public Criteria andAddrNotIn(List values) { + addCriterion("addr not in", values, "addr"); + return (Criteria) this; + } + + public Criteria andAddrBetween(Integer value1, Integer value2) { + addCriterion("addr between", value1, value2, "addr"); + return (Criteria) this; + } + + public Criteria andAddrNotBetween(Integer value1, Integer value2) { + addCriterion("addr not between", value1, value2, "addr"); + return (Criteria) this; + } + + public Criteria andOperatorIsNull() { + addCriterion("operator is null"); + return (Criteria) this; + } + + public Criteria andOperatorIsNotNull() { + addCriterion("operator is not null"); + return (Criteria) this; + } + + public Criteria andOperatorEqualTo(Long value) { + addCriterion("operator =", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorNotEqualTo(Long value) { + addCriterion("operator <>", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorGreaterThan(Long value) { + addCriterion("operator >", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorGreaterThanOrEqualTo(Long value) { + addCriterion("operator >=", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorLessThan(Long value) { + addCriterion("operator <", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorLessThanOrEqualTo(Long value) { + addCriterion("operator <=", value, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorIn(List values) { + addCriterion("operator in", values, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorNotIn(List values) { + addCriterion("operator not in", values, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorBetween(Long value1, Long value2) { + addCriterion("operator between", value1, value2, "operator"); + return (Criteria) this; + } + + public Criteria andOperatorNotBetween(Long value1, Long value2) { + addCriterion("operator not between", value1, value2, "operator"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("created_at is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("created_at is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(Date value) { + addCriterion("created_at =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(Date value) { + addCriterion("created_at <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(Date value) { + addCriterion("created_at >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("created_at >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(Date value) { + addCriterion("created_at <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(Date value) { + addCriterion("created_at <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("created_at in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("created_at not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(Date value1, Date value2) { + addCriterion("created_at between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(Date value1, Date value2) { + addCriterion("created_at not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("updated_at is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("updated_at is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(Date value) { + addCriterion("updated_at =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(Date value) { + addCriterion("updated_at <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(Date value) { + addCriterion("updated_at >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("updated_at >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(Date value) { + addCriterion("updated_at <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(Date value) { + addCriterion("updated_at <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("updated_at in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("updated_at not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(Date value1, Date value2) { + addCriterion("updated_at between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(Date value1, Date value2) { + addCriterion("updated_at not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNull() { + addCriterion("rec_status is null"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNotNull() { + addCriterion("rec_status is not null"); + return (Criteria) this; + } + + public Criteria andRecStatusEqualTo(Byte value) { + addCriterion("rec_status =", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotEqualTo(Byte value) { + addCriterion("rec_status <>", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThan(Byte value) { + addCriterion("rec_status >", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) { + addCriterion("rec_status >=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThan(Byte value) { + addCriterion("rec_status <", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThanOrEqualTo(Byte value) { + addCriterion("rec_status <=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusIn(List values) { + addCriterion("rec_status in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotIn(List values) { + addCriterion("rec_status not in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusBetween(Byte value1, Byte value2) { + addCriterion("rec_status between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotBetween(Byte value1, Byte value2) { + addCriterion("rec_status not between", value1, value2, "recStatus"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/Record.java b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/Record.java index 0c683738..9b3e8e51 100644 --- a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/Record.java +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/Record.java @@ -8,7 +8,7 @@ public class Record implements Serializable { private Long equipmentId; - private String value; + private Integer value; private Date time; @@ -20,6 +20,8 @@ public class Record implements Serializable { private Byte recStatus; + private Byte type; + private static final long serialVersionUID = 1L; public Long getId() { @@ -38,12 +40,12 @@ public class Record implements Serializable { this.equipmentId = equipmentId; } - public String getValue() { + public Integer getValue() { return value; } - public void setValue(String value) { - this.value = value == null ? null : value.trim(); + public void setValue(Integer value) { + this.value = value; } public Date getTime() { @@ -86,6 +88,14 @@ public class Record implements Serializable { this.recStatus = recStatus; } + public Byte getType() { + return type; + } + + public void setType(Byte type) { + this.type = type; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -100,6 +110,7 @@ public class Record implements Serializable { sb.append(", createdAt=").append(createdAt); sb.append(", updatedAt=").append(updatedAt); sb.append(", recStatus=").append(recStatus); + sb.append(", type=").append(type); sb.append("]"); return sb.toString(); } diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/RecordExample.java b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/RecordExample.java index e15570e1..57d4010c 100644 --- a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/RecordExample.java +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/RecordExample.java @@ -235,62 +235,52 @@ public class RecordExample { return (Criteria) this; } - public Criteria andValueEqualTo(String value) { + public Criteria andValueEqualTo(Integer value) { addCriterion("value =", value, "value"); return (Criteria) this; } - public Criteria andValueNotEqualTo(String value) { + public Criteria andValueNotEqualTo(Integer value) { addCriterion("value <>", value, "value"); return (Criteria) this; } - public Criteria andValueGreaterThan(String value) { + public Criteria andValueGreaterThan(Integer value) { addCriterion("value >", value, "value"); return (Criteria) this; } - public Criteria andValueGreaterThanOrEqualTo(String value) { + public Criteria andValueGreaterThanOrEqualTo(Integer value) { addCriterion("value >=", value, "value"); return (Criteria) this; } - public Criteria andValueLessThan(String value) { + public Criteria andValueLessThan(Integer value) { addCriterion("value <", value, "value"); return (Criteria) this; } - public Criteria andValueLessThanOrEqualTo(String value) { + public Criteria andValueLessThanOrEqualTo(Integer value) { addCriterion("value <=", value, "value"); return (Criteria) this; } - public Criteria andValueLike(String value) { - addCriterion("value like", value, "value"); - return (Criteria) this; - } - - public Criteria andValueNotLike(String value) { - addCriterion("value not like", value, "value"); - return (Criteria) this; - } - - public Criteria andValueIn(List values) { + public Criteria andValueIn(List values) { addCriterion("value in", values, "value"); return (Criteria) this; } - public Criteria andValueNotIn(List values) { + public Criteria andValueNotIn(List values) { addCriterion("value not in", values, "value"); return (Criteria) this; } - public Criteria andValueBetween(String value1, String value2) { + public Criteria andValueBetween(Integer value1, Integer value2) { addCriterion("value between", value1, value2, "value"); return (Criteria) this; } - public Criteria andValueNotBetween(String value1, String value2) { + public Criteria andValueNotBetween(Integer value1, Integer value2) { addCriterion("value not between", value1, value2, "value"); return (Criteria) this; } @@ -594,6 +584,66 @@ public class RecordExample { addCriterion("rec_status not between", value1, value2, "recStatus"); return (Criteria) this; } + + public Criteria andTypeIsNull() { + addCriterion("type is null"); + return (Criteria) this; + } + + public Criteria andTypeIsNotNull() { + addCriterion("type is not null"); + return (Criteria) this; + } + + public Criteria andTypeEqualTo(Byte value) { + addCriterion("type =", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotEqualTo(Byte value) { + addCriterion("type <>", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThan(Byte value) { + addCriterion("type >", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThanOrEqualTo(Byte value) { + addCriterion("type >=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThan(Byte value) { + addCriterion("type <", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThanOrEqualTo(Byte value) { + addCriterion("type <=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeIn(List values) { + addCriterion("type in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotIn(List values) { + addCriterion("type not in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeBetween(Byte value1, Byte value2) { + addCriterion("type between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotBetween(Byte value1, Byte value2) { + addCriterion("type not between", value1, value2, "type"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/ThresholdValue.java b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/ThresholdValue.java index 0f81e7bc..6a7a2ff0 100644 --- a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/ThresholdValue.java +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/ThresholdValue.java @@ -6,7 +6,7 @@ import java.util.Date; public class ThresholdValue implements Serializable { private Long id; - private Byte type; + private Long equipmentId; private Byte stages; @@ -32,12 +32,12 @@ public class ThresholdValue implements Serializable { this.id = id; } - public Byte getType() { - return type; + public Long getEquipmentId() { + return equipmentId; } - public void setType(Byte type) { - this.type = type; + public void setEquipmentId(Long equipmentId) { + this.equipmentId = equipmentId; } public Byte getStages() { @@ -103,7 +103,7 @@ public class ThresholdValue implements Serializable { sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); - sb.append(", type=").append(type); + sb.append(", equipmentId=").append(equipmentId); sb.append(", stages=").append(stages); sb.append(", max=").append(max); sb.append(", min=").append(min); diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/ThresholdValueExample.java b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/ThresholdValueExample.java index 16d1850a..8a634037 100644 --- a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/ThresholdValueExample.java +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/po/ThresholdValueExample.java @@ -165,63 +165,63 @@ public class ThresholdValueExample { return (Criteria) this; } - public Criteria andTypeIsNull() { - addCriterion("type is null"); + public Criteria andEquipmentIdIsNull() { + addCriterion("equipment_id is null"); return (Criteria) this; } - public Criteria andTypeIsNotNull() { - addCriterion("type is not null"); + public Criteria andEquipmentIdIsNotNull() { + addCriterion("equipment_id is not null"); return (Criteria) this; } - public Criteria andTypeEqualTo(Byte value) { - addCriterion("type =", value, "type"); + public Criteria andEquipmentIdEqualTo(Long value) { + addCriterion("equipment_id =", value, "equipmentId"); return (Criteria) this; } - public Criteria andTypeNotEqualTo(Byte value) { - addCriterion("type <>", value, "type"); + public Criteria andEquipmentIdNotEqualTo(Long value) { + addCriterion("equipment_id <>", value, "equipmentId"); return (Criteria) this; } - public Criteria andTypeGreaterThan(Byte value) { - addCriterion("type >", value, "type"); + public Criteria andEquipmentIdGreaterThan(Long value) { + addCriterion("equipment_id >", value, "equipmentId"); return (Criteria) this; } - public Criteria andTypeGreaterThanOrEqualTo(Byte value) { - addCriterion("type >=", value, "type"); + public Criteria andEquipmentIdGreaterThanOrEqualTo(Long value) { + addCriterion("equipment_id >=", value, "equipmentId"); return (Criteria) this; } - public Criteria andTypeLessThan(Byte value) { - addCriterion("type <", value, "type"); + public Criteria andEquipmentIdLessThan(Long value) { + addCriterion("equipment_id <", value, "equipmentId"); return (Criteria) this; } - public Criteria andTypeLessThanOrEqualTo(Byte value) { - addCriterion("type <=", value, "type"); + public Criteria andEquipmentIdLessThanOrEqualTo(Long value) { + addCriterion("equipment_id <=", value, "equipmentId"); return (Criteria) this; } - public Criteria andTypeIn(List values) { - addCriterion("type in", values, "type"); + public Criteria andEquipmentIdIn(List values) { + addCriterion("equipment_id in", values, "equipmentId"); return (Criteria) this; } - public Criteria andTypeNotIn(List values) { - addCriterion("type not in", values, "type"); + public Criteria andEquipmentIdNotIn(List values) { + addCriterion("equipment_id not in", values, "equipmentId"); return (Criteria) this; } - public Criteria andTypeBetween(Byte value1, Byte value2) { - addCriterion("type between", value1, value2, "type"); + public Criteria andEquipmentIdBetween(Long value1, Long value2) { + addCriterion("equipment_id between", value1, value2, "equipmentId"); return (Criteria) this; } - public Criteria andTypeNotBetween(Byte value1, Byte value2) { - addCriterion("type not between", value1, value2, "type"); + public Criteria andEquipmentIdNotBetween(Long value1, Long value2) { + addCriterion("equipment_id not between", value1, value2, "equipmentId"); return (Criteria) this; } diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/vo/MessageVo.java b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/vo/MessageVo.java new file mode 100644 index 00000000..0e253cc1 --- /dev/null +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/vo/MessageVo.java @@ -0,0 +1,39 @@ +package com.ccsens.beneficiation.bean.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author 逗 + */ +@Data +public class MessageVo { + + @Data + public static class AddrDispose{ + private Long id; + private Integer startAddr; + private Integer endAddr; + private Integer contentNum; + private String contentLength; + } + + @Data + public static class AchieveMessage{ + private Integer addr; + private Integer value; + } + + @Data + public static class EquipmentType{ + //设备id + private Long id; + //设备类型 + private Byte equipmentType; + //消息类型 + private Byte messageType; + } +} diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/vo/ParameterVo.java b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/vo/ParameterVo.java index af074dc8..2675ffa6 100644 --- a/beneficiation/src/main/java/com/ccsens/beneficiation/bean/vo/ParameterVo.java +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/bean/vo/ParameterVo.java @@ -44,6 +44,9 @@ public class ParameterVo { private String key; @ApiModelProperty("实时值") private BigDecimal currentTimeValue; + @ApiModelProperty("设定值") + private BigDecimal setTimeValue; + public TransducerValue(Long id, String type, String key, BigDecimal currentTimeValue) { this.id = id; @@ -105,7 +108,7 @@ public class ParameterVo { private Long id; @ApiModelProperty("修改时用的类型") private String type; - @ApiModelProperty("实时") + @ApiModelProperty("key") private String key; @ApiModelProperty("实时值") private BigDecimal currentTimeValue; @@ -133,17 +136,20 @@ public class ParameterVo { @ApiModel("阀值") public static class ThresholdValue{ @ApiModelProperty("id") - private Long id = 1L; + private Long id; @ApiModelProperty("修改时用的类型") private String type; @ApiModelProperty("key") private String key; @ApiModelProperty("最小") private BigDecimal minValue; - @ApiModelProperty("最打") + @ApiModelProperty("最大") private BigDecimal maxValue; - public ThresholdValue(BigDecimal minValue, BigDecimal maxValue) { + public ThresholdValue(Long id, String type, String key, BigDecimal minValue, BigDecimal maxValue) { + this.id = id; + this.type = type; + this.key = key; this.minValue = minValue; this.maxValue = maxValue; } diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/persist/dao/RecordDao.java b/beneficiation/src/main/java/com/ccsens/beneficiation/persist/dao/RecordDao.java index 12033671..7525e9c8 100644 --- a/beneficiation/src/main/java/com/ccsens/beneficiation/persist/dao/RecordDao.java +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/persist/dao/RecordDao.java @@ -1,12 +1,55 @@ package com.ccsens.beneficiation.persist.dao; import com.ccsens.beneficiation.bean.po.Record; +import com.ccsens.beneficiation.bean.vo.MessageVo; +import com.ccsens.beneficiation.bean.vo.ParameterVo; import com.ccsens.beneficiation.persist.mapper.RecordMapper; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public interface RecordDao extends RecordMapper { Record getByTypeAndAuthId(@Param("type") byte type,@Param("authId")String authId); + + /** + * 查找tall内的设备信息处理的配置信息 + * @param startAddr 开始的addr + * @return 返回配置信息 + */ + MessageVo.AddrDispose getByStartAddr(@Param("startAddr")int startAddr,@Param("project")byte project); + + /** + * 根据addr查找设备和信息类型 + * @param addr 寄存器地址 + * @return 返回设备类型和消息类型 + */ + MessageVo.EquipmentType getEquipmentTypeByAddr(@Param("addr")int addr); + + /** + * 查询皮带秤和流量计的数据 + * @return + */ + List queryBeltWeigher(); + /** + * 查询变频器和电磁阀的数据 + * @return + */ + List queryTransducer(); + + /** + * 查询电耳的数据 + * @return + */ + List queryParameter(); + + /** + * + * @param equipmentId + * @param stages + * @return + */ + ParameterVo.ThresholdValue getThresholdValue(@Param("equipmentId")Long equipmentId, @Param("stages")int stages); } diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/persist/mapper/EquipmentTypeMapper.java b/beneficiation/src/main/java/com/ccsens/beneficiation/persist/mapper/EquipmentTypeMapper.java new file mode 100644 index 00000000..019346d8 --- /dev/null +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/persist/mapper/EquipmentTypeMapper.java @@ -0,0 +1,30 @@ +package com.ccsens.beneficiation.persist.mapper; + +import com.ccsens.beneficiation.bean.po.EquipmentType; +import com.ccsens.beneficiation.bean.po.EquipmentTypeExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface EquipmentTypeMapper { + long countByExample(EquipmentTypeExample example); + + int deleteByExample(EquipmentTypeExample example); + + int deleteByPrimaryKey(Long id); + + int insert(EquipmentType record); + + int insertSelective(EquipmentType record); + + List selectByExample(EquipmentTypeExample example); + + EquipmentType selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") EquipmentType record, @Param("example") EquipmentTypeExample example); + + int updateByExample(@Param("record") EquipmentType record, @Param("example") EquipmentTypeExample example); + + int updateByPrimaryKeySelective(EquipmentType record); + + int updateByPrimaryKey(EquipmentType record); +} \ No newline at end of file diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/rabbitMQ/RabbitController.java b/beneficiation/src/main/java/com/ccsens/beneficiation/rabbitMQ/RabbitController.java index 6e22769f..790cdc07 100644 --- a/beneficiation/src/main/java/com/ccsens/beneficiation/rabbitMQ/RabbitController.java +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/rabbitMQ/RabbitController.java @@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSONObject; import com.ccsens.beneficiation.bean.dto.Message.BeneficiationMessageDto; +import com.ccsens.beneficiation.bean.vo.MessageVo; import com.ccsens.beneficiation.service.IRecordService; import com.ccsens.util.RedisUtil; import com.ccsens.util.bean.message.common.OutMessage; @@ -26,9 +27,6 @@ import java.util.*; @Component @RabbitListener(queues = RabbitMQConfig.BENEFICIATION) public class RabbitController { - - @Resource - private RedisUtil redisUtil; @Resource private IRecordService recordService; @@ -46,10 +44,18 @@ public class RabbitController { if (CollectionUtil.isEmpty(messageSet)) { return; } + List pendingMessage = new ArrayList<>(); messageSet.forEach(outMessage -> { BeneficiationMessageDto carRecordMessageDto = JSONObject.parseObject(outMessage.getData(), BeneficiationMessageDto.class); - recordService.processMessage(carRecordMessageDto); + pendingMessage.add(carRecordMessageDto); }); + pendingMessage.sort(Comparator.comparingInt(BeneficiationMessageDto::getAddr)); + log.info("接收到的list:{}",pendingMessage); + //处理下位机的信息 + List achieveMessages = recordService.processMessage(pendingMessage); + log.info("处理后的消息:{}",achieveMessages); + //根据业务处理保存消息 + recordService.saveRecord(achieveMessages); } catch (Exception e) { log.error("消息JSON转换异常", e); diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/service/IRecordService.java b/beneficiation/src/main/java/com/ccsens/beneficiation/service/IRecordService.java index 77407727..d3073417 100644 --- a/beneficiation/src/main/java/com/ccsens/beneficiation/service/IRecordService.java +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/service/IRecordService.java @@ -1,10 +1,20 @@ package com.ccsens.beneficiation.service; import com.ccsens.beneficiation.bean.dto.Message.BeneficiationMessageDto; +import com.ccsens.beneficiation.bean.vo.MessageVo; + +import java.util.List; public interface IRecordService { + /** * 处理消息消息 */ - void processMessage(BeneficiationMessageDto carRecordMessageDto); + List processMessage(List carRecordMessageDto); + + /** + * 根据业务保存处理插件 + * @param achieveMessages + */ + void saveRecord(List achieveMessages); } diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/service/ParameterService.java b/beneficiation/src/main/java/com/ccsens/beneficiation/service/ParameterService.java index 4e7dc474..0ca4e4ea 100644 --- a/beneficiation/src/main/java/com/ccsens/beneficiation/service/ParameterService.java +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/service/ParameterService.java @@ -1,12 +1,16 @@ package com.ccsens.beneficiation.service; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; import com.ccsens.beneficiation.bean.dto.ParameterDto; import com.ccsens.beneficiation.bean.vo.ParameterVo; +import com.ccsens.beneficiation.persist.dao.RecordDao; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @@ -18,84 +22,140 @@ import java.util.List; @Service @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public class ParameterService implements IParameterService{ + @Resource + private RecordDao recordDao; @Override public ParameterVo.QueryParameter queryParameter(Object param) { + //查询电耳,皮带秤,流量计,电磁阀,变频器的数据 ParameterVo.QueryParameter parameterInfo = new ParameterVo.QueryParameter(); + //查询皮带秤和流量计的数据 + List beltWeighers = recordDao.queryBeltWeigher(); + if(CollectionUtil.isNotEmpty(beltWeighers)){ + beltWeighers.forEach(beltWeigher -> { + if(CollectionUtil.isNotEmpty(beltWeigher.getValues())){ + int i = beltWeigher.getValues().size() <= 1 ? 0 : 1; + for (ParameterVo.BeltWeigherValue value : beltWeigher.getValues()) { + String a = i == 0 ? "" : Integer.toString(i); + value.setKey("实时/累计" + a); + i++; + } + } + }); + } + parameterInfo.setBeltWeigher(beltWeighers); + //查询变频器和电磁阀 + List transducers = recordDao.queryTransducer(); + if(CollectionUtil.isNotEmpty(transducers)){ + transducers.forEach(transducer -> { + String type = "变频器".equalsIgnoreCase(transducer.getTitle()) ? "transducer" : "solenoidValue"; + if(CollectionUtil.isNotEmpty(transducer.getValues())){ + int i = transducer.getValues().size() <= 1 ? 0 : 1; + for (ParameterVo.TransducerValue value : transducer.getValues()) { + String a = i == 0 ? "" : Integer.toString(i); + value.setKey("实时/设置" + a); + value.setType(type + a); + i++; + } + } + }); + } + parameterInfo.setTransducers(transducers); + //查询变频器和电磁阀 + List parameters = recordDao.queryParameter(); + if(CollectionUtil.isNotEmpty(parameters)){ + parameters.forEach(parameter -> { + if(CollectionUtil.isNotEmpty(parameter.getValues())){ + int i = parameter.getValues().size() <= 1 ? 0 : 1; + for (ParameterVo.ParameterThreshold value : parameter.getValues()) { + String a = i == 0 ? "" : Integer.toString(i); + value.setKey("实时" + a); + value.setType("thresholdValue" + a); + //查询设备的阀值1 + value.setThresholdValue1(recordDao.getThresholdValue(value.getId(),1)); + //阀值2 + value.setThresholdValue2(recordDao.getThresholdValue(value.getId(),2)); + //阀值3 + value.setThresholdValue3(recordDao.getThresholdValue(value.getId(),3)); + i++; + } + } + }); + } + parameterInfo.setParameter(parameters); - List transducerValues = new ArrayList<>(); - ParameterVo.TransducerValue transducer1 = new ParameterVo.TransducerValue(6L,"transducer1","实时/设置1", BigDecimal.valueOf(45)); - ParameterVo.TransducerValue transducer2 = new ParameterVo.TransducerValue(7L,"transducer2","实时/设置2", BigDecimal.valueOf(8)); - ParameterVo.TransducerValue transducer3 = new ParameterVo.TransducerValue(8L,"transducer3","实时/设置3", BigDecimal.valueOf(67)); - ParameterVo.TransducerValue transducer4 = new ParameterVo.TransducerValue(10L,"transducer4","实时/设置4", BigDecimal.valueOf(75)); - transducerValues.add(transducer1); - transducerValues.add(transducer2); - transducerValues.add(transducer3); - transducerValues.add(transducer4); - - List transducers = new ArrayList<>(); - ParameterVo.Transducer transducer = new ParameterVo.Transducer(); - transducer.setTitle("变频器"); - transducer.setValues(transducerValues); - transducers.add(transducer); - - List transducerValues1 = new ArrayList<>(); - ParameterVo.TransducerValue transducer11 = new ParameterVo.TransducerValue(6L,"solenoidValue1","实时/设置1", BigDecimal.valueOf(45)); - ParameterVo.TransducerValue transducer21 = new ParameterVo.TransducerValue(7L,"solenoidValue2","实时/设置2", BigDecimal.valueOf(8)); - transducerValues1.add(transducer11); - transducerValues1.add(transducer21); - - List transducers2 = new ArrayList<>(); - ParameterVo.Transducer transducer12 = new ParameterVo.Transducer(); - transducer12.setTitle("电磁阀"); - transducer12.setValues(transducerValues); - transducers2.add(transducer12); - - parameterInfo.setTransducers(transducers2); - - - List beltWeighers1 = new ArrayList<>(); - ParameterVo.BeltWeigher beltWeigher1 = new ParameterVo.BeltWeigher(); - beltWeigher1.setTitle("皮带秤"); - List beltWeigherValueList1 = new ArrayList<>(); - ParameterVo.BeltWeigherValue beltWeigher01 = new ParameterVo.BeltWeigherValue(1L,"实时/累计", BigDecimal.valueOf(12),BigDecimal.valueOf(1212)); - beltWeigherValueList1.add(beltWeigher01); - beltWeigher1.setValues(beltWeigherValueList1); - beltWeighers1.add(beltWeigher1); - parameterInfo.setBeltWeigher(beltWeighers1); - - List beltWeighers2 = new ArrayList<>(); - ParameterVo.BeltWeigher beltWeigher2 = new ParameterVo.BeltWeigher(); - beltWeigher2.setTitle("流量计"); - List beltWeigherValueList2 = new ArrayList<>(); - ParameterVo.BeltWeigherValue beltWeigher02 = new ParameterVo.BeltWeigherValue(2L,"实时/累计", BigDecimal.valueOf(16),BigDecimal.valueOf(1524)); - ParameterVo.BeltWeigherValue beltWeigher03 = new ParameterVo.BeltWeigherValue(3L,"实时/累计", BigDecimal.valueOf(5),BigDecimal.valueOf(232)); - beltWeigherValueList2.add(beltWeigher02); - beltWeigherValueList2.add(beltWeigher03); - beltWeigher2.setValues(beltWeigherValueList2); - beltWeighers2.add(beltWeigher2); - parameterInfo.setBeltWeigher(beltWeighers2); - - - List parameters = new ArrayList<>(); - ParameterVo.Parameter parameter = new ParameterVo.Parameter(); - parameter.setTitle("电耳"); - List parameterThresholds = new ArrayList<>(); - - ParameterVo.ParameterThreshold parameterThreshold1 = new ParameterVo.ParameterThreshold(11L,"实时","electricEar1",BigDecimal.valueOf(60), - new ParameterVo.ThresholdValue(BigDecimal.valueOf(20),BigDecimal.valueOf(60)), - new ParameterVo.ThresholdValue(BigDecimal.valueOf(30),BigDecimal.valueOf(70)), - new ParameterVo.ThresholdValue(BigDecimal.valueOf(40),BigDecimal.valueOf(80))); - - ParameterVo.ParameterThreshold parameterThreshold2 = new ParameterVo.ParameterThreshold(12L,"实时","electricEar1",BigDecimal.valueOf(65), - new ParameterVo.ThresholdValue(BigDecimal.valueOf(30),BigDecimal.valueOf(70)), - new ParameterVo.ThresholdValue(BigDecimal.valueOf(40),BigDecimal.valueOf(80)), - new ParameterVo.ThresholdValue(BigDecimal.valueOf(50),BigDecimal.valueOf(90))); - parameterThresholds.add(parameterThreshold1); - parameterThresholds.add(parameterThreshold2); - parameter.setValues(parameterThresholds); - parameterInfo.setParameter(parameters); +// +// List transducerValues = new ArrayList<>(); +// ParameterVo.TransducerValue transducer1 = new ParameterVo.TransducerValue(6L,"transducer1","实时/设置1", BigDecimal.valueOf(45)); +// ParameterVo.TransducerValue transducer2 = new ParameterVo.TransducerValue(7L,"transducer2","实时/设置2", BigDecimal.valueOf(8)); +// ParameterVo.TransducerValue transducer3 = new ParameterVo.TransducerValue(8L,"transducer3","实时/设置3", BigDecimal.valueOf(67)); +// ParameterVo.TransducerValue transducer4 = new ParameterVo.TransducerValue(10L,"transducer4","实时/设置4", BigDecimal.valueOf(75)); +// transducerValues.add(transducer1); +// transducerValues.add(transducer2); +// transducerValues.add(transducer3); +// transducerValues.add(transducer4); +// +// List transducers = new ArrayList<>(); +// ParameterVo.Transducer transducer = new ParameterVo.Transducer(); +// transducer.setTitle("变频器"); +// transducer.setValues(transducerValues); +// transducers.add(transducer); +// +// List transducerValues1 = new ArrayList<>(); +// ParameterVo.TransducerValue transducer11 = new ParameterVo.TransducerValue(6L,"solenoidValue1","实时/设置1", BigDecimal.valueOf(45)); +// ParameterVo.TransducerValue transducer21 = new ParameterVo.TransducerValue(7L,"solenoidValue2","实时/设置2", BigDecimal.valueOf(8)); +// transducerValues1.add(transducer11); +// transducerValues1.add(transducer21); +// +// ParameterVo.Transducer transducer12 = new ParameterVo.Transducer(); +// transducer12.setTitle("电磁阀"); +// transducer12.setValues(transducerValues1); +// transducers.add(transducer12); +// +// parameterInfo.setTransducers(transducers); +// +// +// List beltWeighers1 = new ArrayList<>(); +// ParameterVo.BeltWeigher beltWeigher1 = new ParameterVo.BeltWeigher(); +// beltWeigher1.setTitle("皮带秤"); +// List beltWeigherValueList1 = new ArrayList<>(); +// ParameterVo.BeltWeigherValue beltWeigher01 = new ParameterVo.BeltWeigherValue(1L,"实时/累计", BigDecimal.valueOf(12),BigDecimal.valueOf(1212)); +// beltWeigherValueList1.add(beltWeigher01); +// beltWeigher1.setValues(beltWeigherValueList1); +// beltWeighers1.add(beltWeigher1); +// +// +// ParameterVo.BeltWeigher beltWeigher2 = new ParameterVo.BeltWeigher(); +// beltWeigher2.setTitle("流量计"); +// List beltWeigherValueList2 = new ArrayList<>(); +// ParameterVo.BeltWeigherValue beltWeigher02 = new ParameterVo.BeltWeigherValue(2L,"实时/累计", BigDecimal.valueOf(16),BigDecimal.valueOf(1524)); +// ParameterVo.BeltWeigherValue beltWeigher03 = new ParameterVo.BeltWeigherValue(3L,"实时/累计", BigDecimal.valueOf(5),BigDecimal.valueOf(232)); +// beltWeigherValueList2.add(beltWeigher02); +// beltWeigherValueList2.add(beltWeigher03); +// beltWeigher2.setValues(beltWeigherValueList2); +// beltWeighers1.add(beltWeigher2); +// parameterInfo.setBeltWeigher(beltWeighers1); +// +// List parameters = new ArrayList<>(); +// ParameterVo.Parameter parameter = new ParameterVo.Parameter(); +// parameter.setTitle("电耳"); +// List parameterThresholds = new ArrayList<>(); +// +// ParameterVo.ParameterThreshold parameterThreshold1 = new ParameterVo.ParameterThreshold(11L,"electricEar1","实时",BigDecimal.valueOf(60), +// new ParameterVo.ThresholdValue(1L,"thresholdValue1","阀值1",BigDecimal.valueOf(20),BigDecimal.valueOf(60)), +// new ParameterVo.ThresholdValue(2L,"thresholdValue2","阀值2",BigDecimal.valueOf(30),BigDecimal.valueOf(70)), +// new ParameterVo.ThresholdValue(3L,"thresholdValue3","阀值3",BigDecimal.valueOf(40),BigDecimal.valueOf(80))); +// +// ParameterVo.ParameterThreshold parameterThreshold2 = new ParameterVo.ParameterThreshold(12L,"electricEar1","实时",BigDecimal.valueOf(65), +// new ParameterVo.ThresholdValue(4L,"thresholdValue1","阀值1",BigDecimal.valueOf(30),BigDecimal.valueOf(70)), +// new ParameterVo.ThresholdValue(5L,"thresholdValue2","阀值2",BigDecimal.valueOf(40),BigDecimal.valueOf(80)), +// new ParameterVo.ThresholdValue(6L,"thresholdValue3","阀值3",BigDecimal.valueOf(50),BigDecimal.valueOf(90))); +// parameterThresholds.add(parameterThreshold1); +// parameterThresholds.add(parameterThreshold2); +// parameter.setValues(parameterThresholds); +// parameters.add(parameter); +// parameterInfo.setParameter(parameters); return parameterInfo; } diff --git a/beneficiation/src/main/java/com/ccsens/beneficiation/service/RecordService.java b/beneficiation/src/main/java/com/ccsens/beneficiation/service/RecordService.java index c81b9d88..8eba1ead 100644 --- a/beneficiation/src/main/java/com/ccsens/beneficiation/service/RecordService.java +++ b/beneficiation/src/main/java/com/ccsens/beneficiation/service/RecordService.java @@ -2,12 +2,12 @@ package com.ccsens.beneficiation.service; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.ObjectUtil; import com.ccsens.beneficiation.bean.dto.Message.BeneficiationMessageDto; import com.ccsens.beneficiation.bean.po.*; import com.ccsens.beneficiation.bean.po.Record; +import com.ccsens.beneficiation.bean.vo.MessageVo; import com.ccsens.beneficiation.persist.dao.RecordDao; -import com.ccsens.beneficiation.persist.mapper.AdjustRecordMapper; -import com.ccsens.beneficiation.persist.mapper.EquipmentMapper; import com.ccsens.beneficiation.persist.mapper.ThresholdValueMapper; import com.ccsens.beneficiation.persist.mapper.WeightMapper; import lombok.extern.slf4j.Slf4j; @@ -16,9 +16,13 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.Date; import java.util.List; +/** + * @author 逗 + */ @Slf4j @Service @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) @@ -26,104 +30,137 @@ public class RecordService implements IRecordService{ @Resource private RecordDao recordDao; @Resource - private EquipmentMapper equipmentMapper; - @Resource private Snowflake snowflake; @Resource private WeightMapper weightMapper; @Resource private ThresholdValueMapper thresholdValueMapper; - @Resource - private AdjustRecordMapper adjustRecordMapper; + + /** + * 处理下位机消息 + */ @Override - public void processMessage(BeneficiationMessageDto beneficiation) { - //查找设备。没有则添加一个 - Equipment equipment; - EquipmentExample equipmentExample = new EquipmentExample(); - equipmentExample.createCriteria().andTypeEqualTo(beneficiation.getType()).andAuthIdEqualTo(beneficiation.getAuthId()); - List equipmentList = equipmentMapper.selectByExample(equipmentExample); - if(CollectionUtil.isNotEmpty(equipmentList)){ - equipment = equipmentList.get(0); - }else { - equipment = new Equipment(); - equipment.setId(snowflake.nextId()); - equipment.setType(beneficiation.getType()); - equipment.setAuthId(beneficiation.getAuthId()); - equipment.setVerion(beneficiation.getVersion()); - equipmentMapper.insertSelective(equipment); + public List processMessage(List messageDtoList) { + List achieveMessages = new ArrayList<>(); + log.info(""); + int i = 0; + while (i < messageDtoList.size()){ + BeneficiationMessageDto messageDto = messageDtoList.get(i); + //获取该设备的消息处理配置 + MessageVo.AddrDispose addrDispose = recordDao.getByStartAddr(messageDto.getAddr(), (byte) 1); + String[] split = addrDispose.getContentLength().split(","); + if(split.length == 0){ + i++; + continue; + } + for (String s : split) { + if(Integer.parseInt(s) == 0){ + i++; + continue; + } + MessageVo.AchieveMessage achieveMessage = new MessageVo.AchieveMessage(); + achieveMessage.setAddr(messageDto.getAddr()); + int value = 0; + for (int j = 0; j < Integer.parseInt(s); j++) { + value += messageDtoList.get(i + j).getValue(); + } + achieveMessage.setValue(value); + achieveMessages.add(achieveMessage); + i += Integer.parseInt(s); + } } - //判断类型 - switch (beneficiation.getType()){ - case 5: - //称重信息 - Weight weight = new Weight(); - weight.setId(snowflake.nextId()); - weight.setEquipmentId(equipment.getId()); - weight.setWeight(beneficiation.getValue()); - weight.setTime(new Date(beneficiation.getTime())); - weightMapper.insertSelective(weight); - break; - case 6: - //添加界限值信息 - break; - case 7: - //查找界限值信息 - ThresholdValueExample thresholdValueExample = new ThresholdValueExample(); - thresholdValueExample.createCriteria().andTypeEqualTo(equipment.getType()).andStagesEqualTo(Byte.parseByte(beneficiation.getValue())); - List thresholdValueList = thresholdValueMapper.selectByExample(thresholdValueExample); - if(CollectionUtil.isNotEmpty(thresholdValueList)){ - //添加调整记录 - AdjustRecord adjustRecord = new AdjustRecord(); - adjustRecord.setId(snowflake.nextId()); - adjustRecord.setMonitoringId(equipment.getId()); - adjustRecord.setThresholdId(thresholdValueList.get(0).getId()); - adjustRecordMapper.insertSelective(adjustRecord); + + return achieveMessages; + } + + @Override + public void saveRecord(List achieveMessages) { + if(CollectionUtil.isNotEmpty(achieveMessages)){ + achieveMessages.forEach(achieveMessage -> { + //根据addr查找消息类型和设备类型 + MessageVo.EquipmentType equipmentType = recordDao.getEquipmentTypeByAddr(achieveMessage.getAddr()); + if(ObjectUtil.isNull(equipmentType)){ + return; + } + log.info("每条数据都存入记录表"); + saveRecord(achieveMessage.getValue(), equipmentType.getId(),equipmentType.getMessageType()); + //皮带秤的累计值 + if(equipmentType.getEquipmentType() == 4){ + //累计值存入重量表 + if(equipmentType.getMessageType() == 2){ + log.info("保存皮带秤累计值"); + Weight weight = new Weight(); + weight.setId(snowflake.nextId()); + weight.setTime(new Date()); + weight.setEquipmentId(equipmentType.getId()); + weight.setWeight(achieveMessage.getValue().toString()); + weightMapper.insertSelective(weight); + } } - break; - default: - //否则是设备基本信息 - saveEquipmentRecord(beneficiation); + //阀值 + Integer min; + Integer max; + switch (equipmentType.getMessageType()){ + case 3: + case 8: + min = equipmentType.getMessageType() == 3 ? achieveMessage.getValue() : null; + max = equipmentType.getMessageType() == 8 ? achieveMessage.getValue() : null; + + setThreshold(equipmentType.getId(), (byte) 1, min, max); + break; + case 4: + case 9: + min = equipmentType.getMessageType() == 4 ? achieveMessage.getValue() : null; + max = equipmentType.getMessageType() == 9 ? achieveMessage.getValue() : null; + setThreshold(equipmentType.getId(), (byte) 2, min, max); + break; + case 5: + case 10: + min = equipmentType.getMessageType() == 5 ? achieveMessage.getValue() : null; + max = equipmentType.getMessageType() == 10 ? achieveMessage.getValue() : null; + + setThreshold(equipmentType.getId(), (byte) 3, min, max); + break; + default: + break; + } + }); } } - private void saveEquipmentRecord(BeneficiationMessageDto beneficiation) { - //查找设备。没有则添加一个 - Long equipmentId; - EquipmentExample equipmentExample = new EquipmentExample(); - equipmentExample.createCriteria().andTypeEqualTo(beneficiation.getType()).andAuthIdEqualTo(beneficiation.getAuthId()); - List equipmentList = equipmentMapper.selectByExample(equipmentExample); - if(CollectionUtil.isNotEmpty(equipmentList)){ - equipmentId = equipmentList.get(0).getId(); + private void setThreshold(Long equipmentId, byte stages, Integer min, Integer max) { + ThresholdValue thresholdValue; + ThresholdValueExample thresholdValueExample = new ThresholdValueExample(); + thresholdValueExample.createCriteria().andEquipmentIdEqualTo(equipmentId).andStagesEqualTo(stages); + thresholdValueExample.setOrderByClause("created_at DESC limit 1"); + List thresholdValueList = thresholdValueMapper.selectByExample(thresholdValueExample); + if(CollectionUtil.isNotEmpty(thresholdValueList)){ + thresholdValue = thresholdValueList.get(0); + thresholdValue.setMin(min); + thresholdValue.setMax(max); + thresholdValueMapper.updateByPrimaryKeySelective(thresholdValue); }else { - Equipment equipment = new Equipment(); - equipment.setId(snowflake.nextId()); - equipment.setType(beneficiation.getType()); - equipment.setAuthId(beneficiation.getAuthId()); - equipment.setVerion(beneficiation.getVersion()); - equipmentMapper.insertSelective(equipment); - equipmentId = equipment.getId(); - } - // 查询该设备上一条最新信息,如果值相同,则不添加 - RecordExample recordExample = new RecordExample(); - recordExample.createCriteria().andEquipmentIdEqualTo(equipmentId); - recordExample.setOrderByClause("time DESC Limit 1"); - List records = recordDao.selectByExample(recordExample); - if(CollectionUtil.isEmpty(records)){ - Record record = new Record(); - record.setId(snowflake.nextId()); - record.setEquipmentId(equipmentId); - record.setValue(beneficiation.getValue()); - record.setTime(new Date(System.currentTimeMillis())); - recordDao.insertSelective(record); - }else if(!records.get(0).getValue().equalsIgnoreCase(beneficiation.getValue())){ - Record record = new Record(); - record.setId(snowflake.nextId()); - record.setEquipmentId(equipmentId); - record.setValue(beneficiation.getValue()); - record.setTime(new Date(System.currentTimeMillis())); - recordDao.insertSelective(record); + thresholdValue = new ThresholdValue(); + thresholdValue.setId(snowflake.nextId()); + thresholdValue.setEquipmentId(equipmentId); + thresholdValue.setStages(stages); + thresholdValue.setMin(min); + thresholdValue.setMax(max); + thresholdValueMapper.insertSelective(thresholdValue); } } + + + private void saveRecord(int value, Long equipmentId, Byte messageType) { + Record record = new Record(); + record.setId(snowflake.nextId()); + record.setTime(new Date()); + record.setEquipmentId(equipmentId); + record.setValue(value); + record.setType(messageType); + log.info("存入记录表:{}",record); + recordDao.insertSelective(record); + } } diff --git a/beneficiation/src/main/resources/mapper_dao/RecordDao.xml b/beneficiation/src/main/resources/mapper_dao/RecordDao.xml index 4a9fcbb3..2586342b 100644 --- a/beneficiation/src/main/resources/mapper_dao/RecordDao.xml +++ b/beneficiation/src/main/resources/mapper_dao/RecordDao.xml @@ -16,4 +16,133 @@ ORDER BY r.time DESC LIMIT 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/beneficiation/src/main/resources/mapper_dao/WeightDao.xml b/beneficiation/src/main/resources/mapper_dao/WeightDao.xml index d6ed1edf..fcefb45a 100644 --- a/beneficiation/src/main/resources/mapper_dao/WeightDao.xml +++ b/beneficiation/src/main/resources/mapper_dao/WeightDao.xml @@ -5,10 +5,9 @@ select @@ -105,13 +104,11 @@ insert into t_equipment (id, type, auth_id, - addr, verion, operator, - created_at, updated_at, rec_status - ) + verion, operator, created_at, + updated_at, rec_status) values (#{id,jdbcType=BIGINT}, #{type,jdbcType=TINYINT}, #{authId,jdbcType=VARCHAR}, - #{addr,jdbcType=VARCHAR}, #{verion,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, - #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT} - ) + #{verion,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, + #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}) insert into t_equipment @@ -125,9 +122,6 @@ auth_id, - - addr, - verion, @@ -154,9 +148,6 @@ #{authId,jdbcType=VARCHAR}, - - #{addr,jdbcType=VARCHAR}, - #{verion,jdbcType=VARCHAR}, @@ -192,9 +183,6 @@ auth_id = #{record.authId,jdbcType=VARCHAR}, - - addr = #{record.addr,jdbcType=VARCHAR}, - verion = #{record.verion,jdbcType=VARCHAR}, @@ -220,7 +208,6 @@ set id = #{record.id,jdbcType=BIGINT}, type = #{record.type,jdbcType=TINYINT}, auth_id = #{record.authId,jdbcType=VARCHAR}, - addr = #{record.addr,jdbcType=VARCHAR}, verion = #{record.verion,jdbcType=VARCHAR}, operator = #{record.operator,jdbcType=BIGINT}, created_at = #{record.createdAt,jdbcType=TIMESTAMP}, @@ -239,9 +226,6 @@ auth_id = #{authId,jdbcType=VARCHAR}, - - addr = #{addr,jdbcType=VARCHAR}, - verion = #{verion,jdbcType=VARCHAR}, @@ -264,7 +248,6 @@ update t_equipment set type = #{type,jdbcType=TINYINT}, auth_id = #{authId,jdbcType=VARCHAR}, - addr = #{addr,jdbcType=VARCHAR}, verion = #{verion,jdbcType=VARCHAR}, operator = #{operator,jdbcType=BIGINT}, created_at = #{createdAt,jdbcType=TIMESTAMP}, diff --git a/beneficiation/src/main/resources/mapper_raw/EquipmentTypeMapper.xml b/beneficiation/src/main/resources/mapper_raw/EquipmentTypeMapper.xml new file mode 100644 index 00000000..69c176f4 --- /dev/null +++ b/beneficiation/src/main/resources/mapper_raw/EquipmentTypeMapper.xml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, equipment_id, type, addr, operator, created_at, updated_at, rec_status + + + + + delete from t_equipment_type + where id = #{id,jdbcType=BIGINT} + + + delete from t_equipment_type + + + + + + insert into t_equipment_type (id, equipment_id, type, + addr, operator, created_at, + updated_at, rec_status) + values (#{id,jdbcType=BIGINT}, #{equipmentId,jdbcType=BIGINT}, #{type,jdbcType=TINYINT}, + #{addr,jdbcType=INTEGER}, #{operator,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, + #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}) + + + insert into t_equipment_type + + + id, + + + equipment_id, + + + type, + + + addr, + + + operator, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{equipmentId,jdbcType=BIGINT}, + + + #{type,jdbcType=TINYINT}, + + + #{addr,jdbcType=INTEGER}, + + + #{operator,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_equipment_type + + + id = #{record.id,jdbcType=BIGINT}, + + + equipment_id = #{record.equipmentId,jdbcType=BIGINT}, + + + type = #{record.type,jdbcType=TINYINT}, + + + addr = #{record.addr,jdbcType=INTEGER}, + + + operator = #{record.operator,jdbcType=BIGINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_equipment_type + set id = #{record.id,jdbcType=BIGINT}, + equipment_id = #{record.equipmentId,jdbcType=BIGINT}, + type = #{record.type,jdbcType=TINYINT}, + addr = #{record.addr,jdbcType=INTEGER}, + operator = #{record.operator,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_equipment_type + + + equipment_id = #{equipmentId,jdbcType=BIGINT}, + + + type = #{type,jdbcType=TINYINT}, + + + addr = #{addr,jdbcType=INTEGER}, + + + operator = #{operator,jdbcType=BIGINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_equipment_type + set equipment_id = #{equipmentId,jdbcType=BIGINT}, + type = #{type,jdbcType=TINYINT}, + addr = #{addr,jdbcType=INTEGER}, + operator = #{operator,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/beneficiation/src/main/resources/mapper_raw/RecordMapper.xml b/beneficiation/src/main/resources/mapper_raw/RecordMapper.xml index 89d70a9c..65b049cc 100644 --- a/beneficiation/src/main/resources/mapper_raw/RecordMapper.xml +++ b/beneficiation/src/main/resources/mapper_raw/RecordMapper.xml @@ -4,12 +4,13 @@ - + + @@ -70,7 +71,7 @@ - id, equipment_id, value, time, operator, created_at, updated_at, rec_status + id, equipment_id, value, time, operator, created_at, updated_at, rec_status, type @@ -181,7 +190,7 @@ equipment_id = #{record.equipmentId,jdbcType=BIGINT}, - value = #{record.value,jdbcType=VARCHAR}, + value = #{record.value,jdbcType=INTEGER}, time = #{record.time,jdbcType=TIMESTAMP}, @@ -198,6 +207,9 @@ rec_status = #{record.recStatus,jdbcType=TINYINT}, + + type = #{record.type,jdbcType=TINYINT}, + @@ -207,12 +219,13 @@ update t_record set id = #{record.id,jdbcType=BIGINT}, equipment_id = #{record.equipmentId,jdbcType=BIGINT}, - value = #{record.value,jdbcType=VARCHAR}, + value = #{record.value,jdbcType=INTEGER}, time = #{record.time,jdbcType=TIMESTAMP}, operator = #{record.operator,jdbcType=BIGINT}, created_at = #{record.createdAt,jdbcType=TIMESTAMP}, updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, - rec_status = #{record.recStatus,jdbcType=TINYINT} + rec_status = #{record.recStatus,jdbcType=TINYINT}, + type = #{record.type,jdbcType=TINYINT} @@ -224,7 +237,7 @@ equipment_id = #{equipmentId,jdbcType=BIGINT}, - value = #{value,jdbcType=VARCHAR}, + value = #{value,jdbcType=INTEGER}, time = #{time,jdbcType=TIMESTAMP}, @@ -241,18 +254,22 @@ rec_status = #{recStatus,jdbcType=TINYINT}, + + type = #{type,jdbcType=TINYINT}, + where id = #{id,jdbcType=BIGINT} update t_record set equipment_id = #{equipmentId,jdbcType=BIGINT}, - value = #{value,jdbcType=VARCHAR}, + value = #{value,jdbcType=INTEGER}, time = #{time,jdbcType=TIMESTAMP}, operator = #{operator,jdbcType=BIGINT}, created_at = #{createdAt,jdbcType=TIMESTAMP}, updated_at = #{updatedAt,jdbcType=TIMESTAMP}, - rec_status = #{recStatus,jdbcType=TINYINT} + rec_status = #{recStatus,jdbcType=TINYINT}, + type = #{type,jdbcType=TINYINT} where id = #{id,jdbcType=BIGINT} \ No newline at end of file diff --git a/beneficiation/src/main/resources/mapper_raw/ThresholdValueMapper.xml b/beneficiation/src/main/resources/mapper_raw/ThresholdValueMapper.xml index ccddfdd5..1c14a84c 100644 --- a/beneficiation/src/main/resources/mapper_raw/ThresholdValueMapper.xml +++ b/beneficiation/src/main/resources/mapper_raw/ThresholdValueMapper.xml @@ -3,7 +3,7 @@ - + @@ -71,7 +71,7 @@ - id, type, stages, max, min, operator, created_at, updated_at, rec_status + id, equipment_id, stages, max, min, operator, created_at, updated_at, rec_status