diff --git a/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java b/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
index 108f0e4..66a1eae 100644
--- a/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
+++ b/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
@@ -2,6 +2,9 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.casic.missiles.model.ProductInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
*
@@ -14,4 +17,6 @@
public interface ProductInfoMapper extends BaseMapper {
Long selectMaxNo();
+
+ int batchLogicDeleteIds(@Param("ids") List ids);
}
diff --git a/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java b/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
index 108f0e4..66a1eae 100644
--- a/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
+++ b/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
@@ -2,6 +2,9 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.casic.missiles.model.ProductInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
*
@@ -14,4 +17,6 @@
public interface ProductInfoMapper extends BaseMapper {
Long selectMaxNo();
+
+ int batchLogicDeleteIds(@Param("ids") List ids);
}
diff --git a/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml b/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml
index 26f3cb3..a841252 100644
--- a/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml
+++ b/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml
@@ -25,6 +25,13 @@
from product_info
+
+ UPDATE product_info set valid = 0
+ WHERE id IN
+
+ #{id}
+
+
diff --git a/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java b/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
index 108f0e4..66a1eae 100644
--- a/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
+++ b/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
@@ -2,6 +2,9 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.casic.missiles.model.ProductInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
*
@@ -14,4 +17,6 @@
public interface ProductInfoMapper extends BaseMapper {
Long selectMaxNo();
+
+ int batchLogicDeleteIds(@Param("ids") List ids);
}
diff --git a/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml b/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml
index 26f3cb3..a841252 100644
--- a/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml
+++ b/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml
@@ -25,6 +25,13 @@
from product_info
+
+ UPDATE product_info set valid = 0
+ WHERE id IN
+
+ #{id}
+
+
diff --git a/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java b/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java
index 932c13a..09d6d9a 100644
--- a/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java
+++ b/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java
@@ -50,7 +50,7 @@
@ApiModelProperty(value = "设备类型 ", dataType = "String")
@DictCodeField(message = "设备类型不合法", cacheName = DEVICE_TYPE)
@TableField("device_type")
- private Integer deviceType;
+ private String deviceType;
@ExcelProperty(value = "设备类型", order = 4)
@ApiModelProperty(value = "设备类型", dataType = "String")
@@ -60,7 +60,7 @@
@ApiModelProperty(value = "设备型号", dataType = "Integer")
@DictCodeField(message = "型号类型不合法", cacheName = MODEL)
@TableField("model")
- private Integer model;
+ private String model;
@ExcelProperty(value = "设备型号", order = 5)
@ApiModelProperty(value = "设备型号", dataType = "String")
@@ -92,7 +92,7 @@
@ApiModelProperty(value = "加密方式", dataType = "String")
@DictCodeField(message = "加密方式不合法", cacheName = ENCIPHER_TYPE)
@TableField(exist = false)
- private Integer encipherType;
+ private String encipherType;
@ExcelProperty(value = "加密方式", order = 9)
@ApiModelProperty(value = "加密方式", dataType = "String")
diff --git a/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java b/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
index 108f0e4..66a1eae 100644
--- a/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
+++ b/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
@@ -2,6 +2,9 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.casic.missiles.model.ProductInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
*
@@ -14,4 +17,6 @@
public interface ProductInfoMapper extends BaseMapper {
Long selectMaxNo();
+
+ int batchLogicDeleteIds(@Param("ids") List ids);
}
diff --git a/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml b/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml
index 26f3cb3..a841252 100644
--- a/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml
+++ b/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml
@@ -25,6 +25,13 @@
from product_info
+
+ UPDATE product_info set valid = 0
+ WHERE id IN
+
+ #{id}
+
+
diff --git a/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java b/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java
index 932c13a..09d6d9a 100644
--- a/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java
+++ b/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java
@@ -50,7 +50,7 @@
@ApiModelProperty(value = "设备类型 ", dataType = "String")
@DictCodeField(message = "设备类型不合法", cacheName = DEVICE_TYPE)
@TableField("device_type")
- private Integer deviceType;
+ private String deviceType;
@ExcelProperty(value = "设备类型", order = 4)
@ApiModelProperty(value = "设备类型", dataType = "String")
@@ -60,7 +60,7 @@
@ApiModelProperty(value = "设备型号", dataType = "Integer")
@DictCodeField(message = "型号类型不合法", cacheName = MODEL)
@TableField("model")
- private Integer model;
+ private String model;
@ExcelProperty(value = "设备型号", order = 5)
@ApiModelProperty(value = "设备型号", dataType = "String")
@@ -92,7 +92,7 @@
@ApiModelProperty(value = "加密方式", dataType = "String")
@DictCodeField(message = "加密方式不合法", cacheName = ENCIPHER_TYPE)
@TableField(exist = false)
- private Integer encipherType;
+ private String encipherType;
@ExcelProperty(value = "加密方式", order = 9)
@ApiModelProperty(value = "加密方式", dataType = "String")
diff --git a/casic-iot-model/src/main/java/com/casic/missiles/model/ProductInfo.java b/casic-iot-model/src/main/java/com/casic/missiles/model/ProductInfo.java
index d831622..bc07ebd 100644
--- a/casic-iot-model/src/main/java/com/casic/missiles/model/ProductInfo.java
+++ b/casic-iot-model/src/main/java/com/casic/missiles/model/ProductInfo.java
@@ -53,7 +53,7 @@
@TableField("access_type")
@DictCodeField(message = "接入类型不合法", cacheName = ACCESS_TYPE)
@ApiModelProperty(value = "接入类型", dataType = "Integer")
- private Integer accessType;
+ private String accessType;
@TableField(exist = false)
@ApiModelProperty(value = " 接入类型 直连,集中器,AEP电信平台等", dataType = "String")
@@ -65,7 +65,7 @@
@TableField("power_type")
@ApiModelProperty(value = "供电方式", dataType = "Integer")
@DictCodeField(message = "供电方式不合法", cacheName = POWER_TYPE)
- private Integer powerType;
+ private String powerType;
@TableField(exist = false)
@ApiModelProperty(value = "供电方式 直流、电池", dataType = "String")
@@ -77,7 +77,7 @@
@TableField("encipher_type")
@ApiModelProperty(value = "加密类型", dataType = "Integer")
@DictCodeField(message = "加密类型不合法", cacheName = ENCIPHER_TYPE)
- private Integer encipherType;
+ private String encipherType;
@TableField(exist = false)
@ApiModelProperty(value = "加密类型 加密类型-tea.sm4,明文", dataType = "String")
@@ -89,7 +89,7 @@
@TableField("communication_protocol")
@ApiModelProperty(value = "协议类型", dataType = "Integer")
@DictCodeField(message = "加密类型不合法", cacheName = COMMUNICATION_PROTOCOL)
- private Integer communicationProtocol;
+ private String communicationProtocol;
@TableField(exist = false)
@ApiModelProperty(value = "加密类型 加密类型-tea.sm4,明文", dataType = "String")
@@ -99,9 +99,9 @@
* 产品类别
*/
@TableField("product_type")
- @ApiModelProperty(value = "产品类别", dataType = "Integer")
+ @ApiModelProperty(value = "产品类别(不用了,用设备类型替代)", dataType = "Integer")
@DictCodeField(message = "产品类别不合法", cacheName = PRODUCT_TYPE)
- private Integer productType;
+ private String productType;
@TableField(exist = false)
@@ -109,12 +109,31 @@
private String productTypeName;
/**
+ * 设备类型
+ */
+ @TableField("device_type")
+ @ApiModelProperty(value = "设备类型", dataType = "Integer")
+ @DictCodeField(message = "设备类型不合法", cacheName = DEVICE_TYPE)
+ private String deviceType;
+
+
+ @TableField(exist = false)
+ @ApiModelProperty(value = "设备类型", dataType = "String")
+ private String deviceTypeName;
+
+ /**
* 型号
*/
@TableField("model")
@ApiModelProperty(value = "型号", dataType = "String")
private String model;
+ /**
+ * 离线规则
+ */
+ @TableField("offline_rule")
+ @ApiModelProperty(value = "离线规则", dataType = "Integer")
+ private Integer offlineRule;
/**
* 产品描述 产品介绍描述
@@ -150,4 +169,11 @@
@TableField("create_user_id")
private Long createUserId;
+ /**
+ * 是否有效
+ */
+ @TableField("valid")
+ @ApiModelProperty(value = "是否有效", dataType = "Integer")
+ private Integer valid;
+
}
diff --git a/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java b/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
index 108f0e4..66a1eae 100644
--- a/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
+++ b/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
@@ -2,6 +2,9 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.casic.missiles.model.ProductInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
*
@@ -14,4 +17,6 @@
public interface ProductInfoMapper extends BaseMapper {
Long selectMaxNo();
+
+ int batchLogicDeleteIds(@Param("ids") List ids);
}
diff --git a/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml b/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml
index 26f3cb3..a841252 100644
--- a/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml
+++ b/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml
@@ -25,6 +25,13 @@
from product_info
+
+ UPDATE product_info set valid = 0
+ WHERE id IN
+
+ #{id}
+
+
diff --git a/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java b/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java
index 932c13a..09d6d9a 100644
--- a/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java
+++ b/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java
@@ -50,7 +50,7 @@
@ApiModelProperty(value = "设备类型 ", dataType = "String")
@DictCodeField(message = "设备类型不合法", cacheName = DEVICE_TYPE)
@TableField("device_type")
- private Integer deviceType;
+ private String deviceType;
@ExcelProperty(value = "设备类型", order = 4)
@ApiModelProperty(value = "设备类型", dataType = "String")
@@ -60,7 +60,7 @@
@ApiModelProperty(value = "设备型号", dataType = "Integer")
@DictCodeField(message = "型号类型不合法", cacheName = MODEL)
@TableField("model")
- private Integer model;
+ private String model;
@ExcelProperty(value = "设备型号", order = 5)
@ApiModelProperty(value = "设备型号", dataType = "String")
@@ -92,7 +92,7 @@
@ApiModelProperty(value = "加密方式", dataType = "String")
@DictCodeField(message = "加密方式不合法", cacheName = ENCIPHER_TYPE)
@TableField(exist = false)
- private Integer encipherType;
+ private String encipherType;
@ExcelProperty(value = "加密方式", order = 9)
@ApiModelProperty(value = "加密方式", dataType = "String")
diff --git a/casic-iot-model/src/main/java/com/casic/missiles/model/ProductInfo.java b/casic-iot-model/src/main/java/com/casic/missiles/model/ProductInfo.java
index d831622..bc07ebd 100644
--- a/casic-iot-model/src/main/java/com/casic/missiles/model/ProductInfo.java
+++ b/casic-iot-model/src/main/java/com/casic/missiles/model/ProductInfo.java
@@ -53,7 +53,7 @@
@TableField("access_type")
@DictCodeField(message = "接入类型不合法", cacheName = ACCESS_TYPE)
@ApiModelProperty(value = "接入类型", dataType = "Integer")
- private Integer accessType;
+ private String accessType;
@TableField(exist = false)
@ApiModelProperty(value = " 接入类型 直连,集中器,AEP电信平台等", dataType = "String")
@@ -65,7 +65,7 @@
@TableField("power_type")
@ApiModelProperty(value = "供电方式", dataType = "Integer")
@DictCodeField(message = "供电方式不合法", cacheName = POWER_TYPE)
- private Integer powerType;
+ private String powerType;
@TableField(exist = false)
@ApiModelProperty(value = "供电方式 直流、电池", dataType = "String")
@@ -77,7 +77,7 @@
@TableField("encipher_type")
@ApiModelProperty(value = "加密类型", dataType = "Integer")
@DictCodeField(message = "加密类型不合法", cacheName = ENCIPHER_TYPE)
- private Integer encipherType;
+ private String encipherType;
@TableField(exist = false)
@ApiModelProperty(value = "加密类型 加密类型-tea.sm4,明文", dataType = "String")
@@ -89,7 +89,7 @@
@TableField("communication_protocol")
@ApiModelProperty(value = "协议类型", dataType = "Integer")
@DictCodeField(message = "加密类型不合法", cacheName = COMMUNICATION_PROTOCOL)
- private Integer communicationProtocol;
+ private String communicationProtocol;
@TableField(exist = false)
@ApiModelProperty(value = "加密类型 加密类型-tea.sm4,明文", dataType = "String")
@@ -99,9 +99,9 @@
* 产品类别
*/
@TableField("product_type")
- @ApiModelProperty(value = "产品类别", dataType = "Integer")
+ @ApiModelProperty(value = "产品类别(不用了,用设备类型替代)", dataType = "Integer")
@DictCodeField(message = "产品类别不合法", cacheName = PRODUCT_TYPE)
- private Integer productType;
+ private String productType;
@TableField(exist = false)
@@ -109,12 +109,31 @@
private String productTypeName;
/**
+ * 设备类型
+ */
+ @TableField("device_type")
+ @ApiModelProperty(value = "设备类型", dataType = "Integer")
+ @DictCodeField(message = "设备类型不合法", cacheName = DEVICE_TYPE)
+ private String deviceType;
+
+
+ @TableField(exist = false)
+ @ApiModelProperty(value = "设备类型", dataType = "String")
+ private String deviceTypeName;
+
+ /**
* 型号
*/
@TableField("model")
@ApiModelProperty(value = "型号", dataType = "String")
private String model;
+ /**
+ * 离线规则
+ */
+ @TableField("offline_rule")
+ @ApiModelProperty(value = "离线规则", dataType = "Integer")
+ private Integer offlineRule;
/**
* 产品描述 产品介绍描述
@@ -150,4 +169,11 @@
@TableField("create_user_id")
private Long createUserId;
+ /**
+ * 是否有效
+ */
+ @TableField("valid")
+ @ApiModelProperty(value = "是否有效", dataType = "Integer")
+ private Integer valid;
+
}
diff --git a/casic-iot-service/src/main/java/com/casic/missiles/service/impl/ProductInfoServiceImpl.java b/casic-iot-service/src/main/java/com/casic/missiles/service/impl/ProductInfoServiceImpl.java
index 99cd389..1799192 100644
--- a/casic-iot-service/src/main/java/com/casic/missiles/service/impl/ProductInfoServiceImpl.java
+++ b/casic-iot-service/src/main/java/com/casic/missiles/service/impl/ProductInfoServiceImpl.java
@@ -46,6 +46,7 @@
"product_name", request.getProductName());
queryWrapper.like(StringUtils.isNotBlank(request.getProductNo()),
"product_no", request.getProductNo());
+ queryWrapper.eq("valid", 1);
page = this.baseMapper.selectPage(page, queryWrapper);
for (ProductInfo productInfo : page.getRecords()) {
DictCodeUtils.convertDictCodeToName(productInfo);
@@ -58,10 +59,15 @@
public ReturnDTO addProduct(ProductInfo productInfo) {
AuthUser shiroUser = ShiroKit.getUser();
Long maxNo = this.baseMapper.selectMaxNo();
- String productNo = NumberGeneratorUtil.getContactNo(PrefixCodeEnum.DEVICE_GROUP, maxNo);
+ String productNo = NumberGeneratorUtil.getContactNo(PrefixCodeEnum.PRODUCT, maxNo);
productInfo.setProductNo(productNo);
productInfo.setCreateUserName(shiroUser.getName());
productInfo.setCreateUserId(shiroUser.getId());
+
+ if (this.baseMapper.insert(productInfo) > 0) {
+ return ReturnUtil.success();
+ }
+
throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED);
}
@@ -83,7 +89,7 @@
@Override
public ReturnDTO deleteProduct(List ids) {
- if ((this.baseMapper.deleteBatchIds(ids)) > 0) {
+ if ((this.baseMapper.batchLogicDeleteIds(ids)) > 0) {
return ReturnUtil.success();
}
throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED);
diff --git a/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java b/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
index 108f0e4..66a1eae 100644
--- a/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
+++ b/casic-iot-dao/src/main/java/com/casic/missiles/mapper/ProductInfoMapper.java
@@ -2,6 +2,9 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.casic.missiles.model.ProductInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
*
@@ -14,4 +17,6 @@
public interface ProductInfoMapper extends BaseMapper {
Long selectMaxNo();
+
+ int batchLogicDeleteIds(@Param("ids") List ids);
}
diff --git a/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml b/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml
index 26f3cb3..a841252 100644
--- a/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml
+++ b/casic-iot-dao/src/main/resources/mapper/ProductInfoMapper.xml
@@ -25,6 +25,13 @@
from product_info
+
+ UPDATE product_info set valid = 0
+ WHERE id IN
+
+ #{id}
+
+
diff --git a/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java b/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java
index 932c13a..09d6d9a 100644
--- a/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java
+++ b/casic-iot-model/src/main/java/com/casic/missiles/dto/device/DeviceListVO.java
@@ -50,7 +50,7 @@
@ApiModelProperty(value = "设备类型 ", dataType = "String")
@DictCodeField(message = "设备类型不合法", cacheName = DEVICE_TYPE)
@TableField("device_type")
- private Integer deviceType;
+ private String deviceType;
@ExcelProperty(value = "设备类型", order = 4)
@ApiModelProperty(value = "设备类型", dataType = "String")
@@ -60,7 +60,7 @@
@ApiModelProperty(value = "设备型号", dataType = "Integer")
@DictCodeField(message = "型号类型不合法", cacheName = MODEL)
@TableField("model")
- private Integer model;
+ private String model;
@ExcelProperty(value = "设备型号", order = 5)
@ApiModelProperty(value = "设备型号", dataType = "String")
@@ -92,7 +92,7 @@
@ApiModelProperty(value = "加密方式", dataType = "String")
@DictCodeField(message = "加密方式不合法", cacheName = ENCIPHER_TYPE)
@TableField(exist = false)
- private Integer encipherType;
+ private String encipherType;
@ExcelProperty(value = "加密方式", order = 9)
@ApiModelProperty(value = "加密方式", dataType = "String")
diff --git a/casic-iot-model/src/main/java/com/casic/missiles/model/ProductInfo.java b/casic-iot-model/src/main/java/com/casic/missiles/model/ProductInfo.java
index d831622..bc07ebd 100644
--- a/casic-iot-model/src/main/java/com/casic/missiles/model/ProductInfo.java
+++ b/casic-iot-model/src/main/java/com/casic/missiles/model/ProductInfo.java
@@ -53,7 +53,7 @@
@TableField("access_type")
@DictCodeField(message = "接入类型不合法", cacheName = ACCESS_TYPE)
@ApiModelProperty(value = "接入类型", dataType = "Integer")
- private Integer accessType;
+ private String accessType;
@TableField(exist = false)
@ApiModelProperty(value = " 接入类型 直连,集中器,AEP电信平台等", dataType = "String")
@@ -65,7 +65,7 @@
@TableField("power_type")
@ApiModelProperty(value = "供电方式", dataType = "Integer")
@DictCodeField(message = "供电方式不合法", cacheName = POWER_TYPE)
- private Integer powerType;
+ private String powerType;
@TableField(exist = false)
@ApiModelProperty(value = "供电方式 直流、电池", dataType = "String")
@@ -77,7 +77,7 @@
@TableField("encipher_type")
@ApiModelProperty(value = "加密类型", dataType = "Integer")
@DictCodeField(message = "加密类型不合法", cacheName = ENCIPHER_TYPE)
- private Integer encipherType;
+ private String encipherType;
@TableField(exist = false)
@ApiModelProperty(value = "加密类型 加密类型-tea.sm4,明文", dataType = "String")
@@ -89,7 +89,7 @@
@TableField("communication_protocol")
@ApiModelProperty(value = "协议类型", dataType = "Integer")
@DictCodeField(message = "加密类型不合法", cacheName = COMMUNICATION_PROTOCOL)
- private Integer communicationProtocol;
+ private String communicationProtocol;
@TableField(exist = false)
@ApiModelProperty(value = "加密类型 加密类型-tea.sm4,明文", dataType = "String")
@@ -99,9 +99,9 @@
* 产品类别
*/
@TableField("product_type")
- @ApiModelProperty(value = "产品类别", dataType = "Integer")
+ @ApiModelProperty(value = "产品类别(不用了,用设备类型替代)", dataType = "Integer")
@DictCodeField(message = "产品类别不合法", cacheName = PRODUCT_TYPE)
- private Integer productType;
+ private String productType;
@TableField(exist = false)
@@ -109,12 +109,31 @@
private String productTypeName;
/**
+ * 设备类型
+ */
+ @TableField("device_type")
+ @ApiModelProperty(value = "设备类型", dataType = "Integer")
+ @DictCodeField(message = "设备类型不合法", cacheName = DEVICE_TYPE)
+ private String deviceType;
+
+
+ @TableField(exist = false)
+ @ApiModelProperty(value = "设备类型", dataType = "String")
+ private String deviceTypeName;
+
+ /**
* 型号
*/
@TableField("model")
@ApiModelProperty(value = "型号", dataType = "String")
private String model;
+ /**
+ * 离线规则
+ */
+ @TableField("offline_rule")
+ @ApiModelProperty(value = "离线规则", dataType = "Integer")
+ private Integer offlineRule;
/**
* 产品描述 产品介绍描述
@@ -150,4 +169,11 @@
@TableField("create_user_id")
private Long createUserId;
+ /**
+ * 是否有效
+ */
+ @TableField("valid")
+ @ApiModelProperty(value = "是否有效", dataType = "Integer")
+ private Integer valid;
+
}
diff --git a/casic-iot-service/src/main/java/com/casic/missiles/service/impl/ProductInfoServiceImpl.java b/casic-iot-service/src/main/java/com/casic/missiles/service/impl/ProductInfoServiceImpl.java
index 99cd389..1799192 100644
--- a/casic-iot-service/src/main/java/com/casic/missiles/service/impl/ProductInfoServiceImpl.java
+++ b/casic-iot-service/src/main/java/com/casic/missiles/service/impl/ProductInfoServiceImpl.java
@@ -46,6 +46,7 @@
"product_name", request.getProductName());
queryWrapper.like(StringUtils.isNotBlank(request.getProductNo()),
"product_no", request.getProductNo());
+ queryWrapper.eq("valid", 1);
page = this.baseMapper.selectPage(page, queryWrapper);
for (ProductInfo productInfo : page.getRecords()) {
DictCodeUtils.convertDictCodeToName(productInfo);
@@ -58,10 +59,15 @@
public ReturnDTO addProduct(ProductInfo productInfo) {
AuthUser shiroUser = ShiroKit.getUser();
Long maxNo = this.baseMapper.selectMaxNo();
- String productNo = NumberGeneratorUtil.getContactNo(PrefixCodeEnum.DEVICE_GROUP, maxNo);
+ String productNo = NumberGeneratorUtil.getContactNo(PrefixCodeEnum.PRODUCT, maxNo);
productInfo.setProductNo(productNo);
productInfo.setCreateUserName(shiroUser.getName());
productInfo.setCreateUserId(shiroUser.getId());
+
+ if (this.baseMapper.insert(productInfo) > 0) {
+ return ReturnUtil.success();
+ }
+
throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED);
}
@@ -83,7 +89,7 @@
@Override
public ReturnDTO deleteProduct(List ids) {
- if ((this.baseMapper.deleteBatchIds(ids)) > 0) {
+ if ((this.baseMapper.batchLogicDeleteIds(ids)) > 0) {
return ReturnUtil.success();
}
throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED);
diff --git a/sensorhub-core/src/main/java/com/casic/missiles/service/impl/GeneralServiceImpl.java b/sensorhub-core/src/main/java/com/casic/missiles/service/impl/GeneralServiceImpl.java
index 997971c..d189343 100644
--- a/sensorhub-core/src/main/java/com/casic/missiles/service/impl/GeneralServiceImpl.java
+++ b/sensorhub-core/src/main/java/com/casic/missiles/service/impl/GeneralServiceImpl.java
@@ -162,6 +162,7 @@
switch (operationType) {
case UP_GET_REQUEST:
// 请求远程升级固件程序的数据
+ updateOTATaskState();
break;
case UP_TRAP_REQUEST:
@@ -176,7 +177,7 @@
case UP_STARTUP_REQUEST:
// 上报三码数据后处理 保存三码记录 更新device表的对应字段
- saveSensorDevCodeAndImei((BirmmStartupRequest) baseFrame, frameLogId);
+ saveSensorDevCodeAndImei((BirmmStartupRequest) baseFrame);
break;
case UP_SET_RESPONSE:
@@ -189,6 +190,10 @@
}
}
+ private void updateOTATaskState() {
+
+ }
+
/**
* 保存业务数据
* @param trapRequest
@@ -213,9 +218,8 @@
* 保存三码到数据库
* 更新对应设备编号的IMEI和ICCID
* @param startupRequest
- * @param frameLogId
*/
- private void saveSensorDevCodeAndImei(BirmmStartupRequest startupRequest, Long frameLogId) {
+ private void saveSensorDevCodeAndImei(BirmmStartupRequest startupRequest) {
List imeiTags = startupRequest.getTagList().get(SensorStartupTag.class.getSimpleName());
if (ObjectUtil.isNotNull(imeiTags) && !imeiTags.isEmpty()) {
SensorStartupTag imeiTag = (SensorStartupTag) imeiTags.get(0);
@@ -229,7 +233,15 @@
List softwareTags = onlineRequest.getTagList().get(SoftwareVersionTag.class.getSimpleName());
if (ObjectUtil.isNotNull(softwareTags) && !softwareTags.isEmpty()) {
SoftwareVersionTag softwareTag = (SoftwareVersionTag) softwareTags.get(0);
+
+ // 更新设备的固件版本信息
deviceService.updateDeviceVersion(onlineRequest.getDevCode(), softwareTag.getVersion());
+
+ // 更新升级任务的状态
+ Device device = deviceService.getDeviceByDeviceCode(onlineRequest.getDevCode());
+ if (ObjectUtil.isNotNull(device)) {
+ DeviceUpgradeTask otaTask = otaService.getByDeviceId(device.getId());
+ }
}
}