Commit 91ac7bfe authored by 赵啸非's avatar 赵啸非

修改部分消息结构

parent 2a76bdb1
...@@ -110,6 +110,11 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb ...@@ -110,6 +110,11 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb
try { try {
DefaultTbQueueMsg msg = new DefaultTbQueueMsg(); DefaultTbQueueMsg msg = new DefaultTbQueueMsg();
// DefaultTbQueueMsg msg = gson.fromJson(new String(message.getBody()), DefaultTbQueueMsg.class); // DefaultTbQueueMsg msg = gson.fromJson(new String(message.getBody()), DefaultTbQueueMsg.class);
if(ObjectUtils.isEmpty(message.getBody())){
log.info("message is empty");
return null;
}
Map<String, Object> map = JSON.parseObject(new String(message.getBody()), HashMap.class); Map<String, Object> map = JSON.parseObject(new String(message.getBody()), HashMap.class);
msg.setKey((String)map.get("key")); msg.setKey((String)map.get("key"));
String payloadStr = (String)map.get("data"); String payloadStr = (String)map.get("data");
...@@ -121,10 +126,11 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb ...@@ -121,10 +126,11 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb
HashMap<String, String> hashMap = JSON.parseObject(headerStr, HashMap.class); HashMap<String, String> hashMap = JSON.parseObject(headerStr, HashMap.class);
headers.setData(hashMap); headers.setData(hashMap);
msg.setHeaders(headers); msg.setHeaders(headers);
log.debug("msg:" + msg.toString()); log.info("msg:" + msg.toString());
return decoder.decode(msg); return decoder.decode(msg);
} catch (Exception e) { } catch (Exception e) {
log.error("反序列化异常!", e); log.error("反序列化异常!", e);
log.error("message:",JSON.toJSONString(message));
return null; return null;
} }
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
DROP TABLE IF EXISTS `mortals_xhx_device`; DROP TABLE IF EXISTS `mortals_xhx_device`;
CREATE TABLE mortals_xhx_device( CREATE TABLE mortals_xhx_device(
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长', `id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`deviceName` varchar(20) NOT NULL COMMENT '设备名称', `deviceName` varchar(20) COMMENT '设备名称',
`deviceCode` varchar(256) COMMENT '设备编码,SN码等,默认为MAC地址', `deviceCode` varchar(256) NOT NULL COMMENT '设备编码,SN码等,默认为MAC地址',
`deviceMac` varchar(64) COMMENT '设备的MAC地址', `deviceMac` varchar(64) COMMENT '设备的MAC地址',
`siteId` bigint(20) COMMENT '站点Id,来源基础服务平台', `siteId` bigint(20) COMMENT '站点Id,来源基础服务平台',
`siteCode` varchar(256) COMMENT '站点编号,来源基础服务平台', `siteCode` varchar(256) COMMENT '站点编号,来源基础服务平台',
...@@ -37,7 +37,8 @@ CREATE TABLE mortals_xhx_device( ...@@ -37,7 +37,8 @@ CREATE TABLE mortals_xhx_device(
`deviceRemark` varchar(256) COMMENT '备注', `deviceRemark` varchar(256) COMMENT '备注',
`onlineTime` datetime COMMENT '最近上线时间', `onlineTime` datetime COMMENT '最近上线时间',
`offlineTime` datetime COMMENT '最近离线时间', `offlineTime` datetime COMMENT '最近离线时间',
`deleted` tinyint(2) COMMENT '是否删除,(0.否,1.是)', `deleted` tinyint(2) COMMENT '是否删除(0.否,1.是)',
`source` tinyint(2) COMMENT '收不来源(0.旧设备,1.新设备)',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户', `createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`createTime` datetime NOT NULL COMMENT '创建时间', `createTime` datetime NOT NULL COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户', `updateUserId` bigint(20) COMMENT '更新用户',
...@@ -45,10 +46,6 @@ CREATE TABLE mortals_xhx_device( ...@@ -45,10 +46,6 @@ CREATE TABLE mortals_xhx_device(
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备';
-- ---------------------------- -- ----------------------------
-- 平台系统表 -- 平台系统表
-- ---------------------------- -- ----------------------------
...@@ -76,9 +73,9 @@ PRIMARY KEY (`id`) ...@@ -76,9 +73,9 @@ PRIMARY KEY (`id`)
DROP TABLE IF EXISTS `mortals_xhx_product`; DROP TABLE IF EXISTS `mortals_xhx_product`;
CREATE TABLE mortals_xhx_product( CREATE TABLE mortals_xhx_product(
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长', `id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`platformId` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '关联平台',
`productName` varchar(20) NOT NULL COMMENT '产品名称,名称唯一', `productName` varchar(20) NOT NULL COMMENT '产品名称,名称唯一',
`productCode` varchar(256) NOT NULL COMMENT '产品编码', `productCode` varchar(256) COMMENT '产品编码',
`exchangeName` varchar(256) NOT NULL COMMENT '交换机名称,英文必填',
`productRemark` varchar(256) COMMENT '备注', `productRemark` varchar(256) COMMENT '备注',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户', `createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`createTime` datetime NOT NULL COMMENT '创建时间', `createTime` datetime NOT NULL COMMENT '创建时间',
...@@ -87,6 +84,8 @@ CREATE TABLE mortals_xhx_product( ...@@ -87,6 +84,8 @@ CREATE TABLE mortals_xhx_product(
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品';
-- ---------------------------- -- ----------------------------
-- 设备生产厂商表 -- 设备生产厂商表
-- ---------------------------- -- ----------------------------
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<Field :span="20" label="平台名称" prop="platformName" v-model="form.platformName" placeholder="请输入平台名称,名称唯一"/> <Field :span="20" label="平台名称" prop="platformName" v-model="form.platformName" placeholder="请输入平台名称,名称唯一"/>
<Field :span="20" label="平台编码" prop="platformSn" v-model="form.platformSn" placeholder="请输入平台编码,编码唯一"/> <Field :span="20" label="平台编码" prop="platformSn" v-model="form.platformSn" placeholder="请输入平台编码,编码唯一"/>
<Field :span="20" label="发送地址" prop="sendUrl" v-model="form.sendUrl" placeholder="请输入发送httpurl地址"/> <Field :span="20" label="发送地址" prop="sendUrl" v-model="form.sendUrl" placeholder="请输入发送httpurl地址"/>
<Field :span="20" label="首页地址" prop="homeUrl" v-model="form.homeUrl" placeholder="请输入首页地址"/> <!-- <Field :span="20" label="首页地址" prop="homeUrl" v-model="form.homeUrl" placeholder="请输入首页地址"/> -->
<!-- <Field :span="20" label="发送消息类型" prop="sendMsgType" v-model="form.sendMsgType" type="radio" :enumData="dict.sendMsgType" placeholder="请选择发送第三方平台消息类型"/> --> <!-- <Field :span="20" label="发送消息类型" prop="sendMsgType" v-model="form.sendMsgType" type="radio" :enumData="dict.sendMsgType" placeholder="请选择发送第三方平台消息类型"/> -->
<Field :span="20" label="是否发送消息" prop="sendSwitch" v-model="form.sendSwitch" type="radio" :enumData="dict.sendSwitch" placeholder="请选择是否启用发送消息"/> <Field :span="20" label="是否发送消息" prop="sendSwitch" v-model="form.sendSwitch" type="radio" :enumData="dict.sendSwitch" placeholder="请选择是否启用发送消息"/>
......
...@@ -3,17 +3,17 @@ ...@@ -3,17 +3,17 @@
<LayoutTable :data="tableData" :config="tableConfig"> <LayoutTable :data="tableData" :config="tableConfig">
</LayoutTable> </LayoutTable>
<dialog-show ref="dialogform" @ok="getData" /> <drawer-show ref="drawerform" @ok="getData" />
</div> </div>
</template> </template>
<script> <script>
/** 表单弹出框模式需引入 */ /** 表单弹出框模式需引入 */
import dialogShow from "./dialogshow"; import drawerShow from "./drawershow";
import table from "@/assets/mixins/table"; import table from "@/assets/mixins/table";
export default { export default {
name: "Platform", name: "Platform",
components: {dialogShow }, components: {drawerShow },
mixins: [table], mixins: [table],
created() { created() {
}, },
...@@ -21,17 +21,17 @@ ...@@ -21,17 +21,17 @@
/** 重写新增方法 */ /** 重写新增方法 */
toAdd(row) { toAdd(row) {
this.$refs.dialogform.add(row); this.$refs.drawerform.add(row);
}, },
/** 重写编辑方法 */ /** 重写编辑方法 */
toEdit(row) { toEdit(row) {
this.$refs.dialogform.edit(row); this.$refs.drawerform.edit(row);
}, },
/** 重写查看方法 */ /** 重写查看方法 */
// toView(row) { toView(row) {
// this.$refs.dialogform.view(row); this.$refs.drawerform.view(row);
// }, },
}, },
data() { data() {
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
<el-dialog :title="title" :visible.sync="open" width="90%" append-to-body> <el-dialog :title="title" :visible.sync="open" width="90%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row> <el-row>
<Field :span="20" label="产品名称" prop="productName" v-model="form.productName" placeholder="请输入产品名称,名称唯一,如排号机"/> <Field label="产品名称,名称唯一" prop="productName" v-model="form.productName" placeholder="请输入产品名称,名称唯一"/>
<Field :span="20" label="产品编码" prop="productCode" v-model="form.productCode" placeholder="请输入产品编码,编码唯已,如phj"/> <Field label="产品编码" prop="productCode" v-model="form.productCode" type="textarea" placeholder="请输入产品编码"/>
<Field :span="20" label="备注" prop="productRemark" v-model="form.productRemark" type="textarea" placeholder="请输入备注"/> <Field label="备注" prop="productRemark" v-model="form.productRemark" type="textarea" placeholder="请输入备注"/>
</el-row> </el-row>
...@@ -41,14 +41,6 @@ ...@@ -41,14 +41,6 @@
{required: true,message: "请输入产品名称,名称唯一", trigger: "blur" }, {required: true,message: "请输入产品名称,名称唯一", trigger: "blur" },
{max: 20,message: "最多只能录入20个字符",trigger: "blur",}, {max: 20,message: "最多只能录入20个字符",trigger: "blur",},
], ],
productCode: [
{required: true,message: "请输入产品编码,编码唯一", trigger: "blur" },
{max: 256,message: "最多只能录入256个字符",trigger: "blur",},
],
exchangeName: [
{required: true,message: "请输入交换机名称,英文必填,默认产品编码", trigger: "blur" },
{max: 256,message: "最多只能录入256个字符",trigger: "blur",},
],
createTime: [ createTime: [
{required: true,message: "请选择创建时间" }, {required: true,message: "请选择创建时间" },
], ],
...@@ -61,7 +53,7 @@ ...@@ -61,7 +53,7 @@
edit(row) { edit(row) {
this.reset() this.reset()
this.query = { id: row.id }; this.query = { id: row.id };
this.urls.currUrl =this.pageInfo.editUrl;; this.urls.currUrl ="product/edit";
this.getData(); this.getData();
this.pageInfo.type="edit" this.pageInfo.type="edit"
this.title = "修改产品"; this.title = "修改产品";
...@@ -69,8 +61,7 @@ ...@@ -69,8 +61,7 @@
/** 新增 */ /** 新增 */
add(row) { add(row) {
this.reset() this.reset()
this.query = { id: row.id }; this.urls.currUrl = "product/add";
this.urls.currUrl = this.pageInfo.addUrl;
this.getData(); this.getData();
this.pageInfo.type="add" this.pageInfo.type="add"
this.title = "新增产品"; this.title = "新增产品";
...@@ -79,7 +70,7 @@ ...@@ -79,7 +70,7 @@
view(row) { view(row) {
this.reset() this.reset()
this.query = { id: row.id }; this.query = { id: row.id };
this.urls.currUrl =this.pageInfo.viewUrl;; this.urls.currUrl ="product/view";
this.getData(); this.getData();
this.pageInfo.type="view" this.pageInfo.type="view"
this.title = "产品详细"; this.title = "产品详细";
...@@ -101,9 +92,9 @@ ...@@ -101,9 +92,9 @@
// 表单重置 // 表单重置
reset() { reset() {
this.form = { this.form = {
platformId : null,
productName : "", productName : "",
productCode : "", productCode : "",
exchangeName : "",
productRemark : "", productRemark : "",
}; };
this.resetForm("form"); this.resetForm("form");
......
<template> <template>
<div class="page"> <div class="page">
<LayoutTable :data="tableData" notAdd notDel notSearch :config="tableConfig"> <LayoutTable :data="tableData" notDel notSearch :config="tableConfig">
</LayoutTable> </LayoutTable>
<dialog-show ref="dialogform" @ok="getData" />
<drawer-show ref="drawerform" @ok="getData" />
</div> </div>
</template> </template>
<script> <script>
/** 表单弹出框模式需引入 */ /** 表单弹出框模式需引入 */
import dialogShow from "./dialogshow";
import drawerShow from "./drawershow";
import table from "@/assets/mixins/table"; import table from "@/assets/mixins/table";
export default { export default {
name: "Product", name: "ProductList",
components: {dialogShow }, components: {
drawerShow
},
mixins: [table], mixins: [table],
created() { created() {
}, },
methods: { methods: {
/** 重写新增方法 */ /** 重写新增方法 */
toAdd(row) { toAdd(row) {
this.$refs.dialogform.add(row); this.$refs.drawerform.add(row);
}, },
/** 重写编辑方法 */ /** 重写编辑方法 */
toEdit(row) { toEdit(row) {
this.$refs.dialogform.edit(row); this.$refs.drawerform.edit(row);
}, },
/** 重写查看方法 */ /** 重写查看方法 */
// toView(row) { toView(row) {
// this.$refs.dialogform.view(row); this.$refs.drawerform.view(row);
// }, },
}, },
data() { data() {
...@@ -40,11 +42,25 @@ ...@@ -40,11 +42,25 @@
search: [ search: [
], ],
columns: [ columns: [
// {type: "selection", width: 60},
{type: "index",label: "序号",width: 50},
{label: "关联平台", prop: "platformId", formatter: this.formatter},
{label: "产品名称", prop: "productName"}, {label: "产品名称", prop: "productName"},
{label: "产品编码", prop: "productCode"}, {label: "产品编码", prop: "productCode"},
{label: "备注", prop: "productRemark"},
{
label: "操作",
width: 240,
formatter: row => {
return (
<table-buttons noAdd row={row} onEdit={this.toEdit} onView={this.toView} onDel={this.toDel} />
);
}
}
] ]
} }
}; };
......
...@@ -18,14 +18,14 @@ public class DeviceReq implements Serializable { ...@@ -18,14 +18,14 @@ public class DeviceReq implements Serializable {
*/ */
private Integer receiveMethod; private Integer receiveMethod;
/** // /**
* 平台系统id // * 平台系统id
*/ // */
private Long platformId; // private Long platformId;
/** // /**
* 平台系统编码 // * 平台系统编码
*/ // */
private String platformCode; // private String platformCode;
/** /**
* 产品id * 产品id
*/ */
...@@ -121,4 +121,9 @@ public class DeviceReq implements Serializable { ...@@ -121,4 +121,9 @@ public class DeviceReq implements Serializable {
@JsonDeserialize(using = CustomJsonDateDeserializer.class) @JsonDeserialize(using = CustomJsonDateDeserializer.class)
private Date defectsLiabilityPeriod; private Date defectsLiabilityPeriod;
/**
* 设备来源(默认为新设备)
*/
private Integer source;
} }
package com.mortals.xhx.busiz.rsp;
import lombok.Data;
import java.io.Serializable;
/**
* 设备基础信息
* @author: zxfei
* @date: 2022/7/11 10:36
* @description:
**/
@Data
public class DeviceInfo implements Serializable {
/**
* 站点ID
*/
private Long siteId;
/**
* 站点编码
*/
private String siteCode;
/**
* 站点名称
*/
private String siteName;
/**
* 设备产品类型Id
*/
private Long productId;
/**
* 设备产品类型
*/
private String productName;
}
...@@ -17,6 +17,10 @@ public class RegisterResp implements Serializable { ...@@ -17,6 +17,10 @@ public class RegisterResp implements Serializable {
*/ */
private ServerInfo serviceInfo; private ServerInfo serviceInfo;
/**
* 设备基础信息
*/
private DeviceInfo deviceInfo;
} }
package com.mortals.xhx.common.exception.api;
import com.mortals.framework.exception.AppException;
/**
* @author: zxfei
* @date: 2022/7/11 10:16
* @description:
**/
public class DeviceRegisterException extends AppException {
public DeviceRegisterException(int code, String message) {
super(code, message);
}
}
...@@ -28,7 +28,10 @@ public interface ErrorCode { ...@@ -28,7 +28,10 @@ public interface ErrorCode {
public static final int STATUS_TEL_ALREADY_REGI = 12; public static final int STATUS_TEL_ALREADY_REGI = 12;
public static final int STATUS_SAFETY_RISK = 13; public static final int STATUS_SAFETY_RISK = 13;
public static final int STATUS_LOGIN_CODE = 15; public static final int STATUS_LOGIN_CODE = 15;
public static final int BOOK_FAKUAN_CODE = 16;//还有未付款的订单code public static final int BOOK_FAKUAN_CODE = 16;
public static final String ERROR_TOKEN_EXPIRED = "登陆过期,请重新登录"; public static final String ERROR_TOKEN_EXPIRED = "登陆过期,请重新登录";
public static final String ERROR_TRADE_PWD_OVER_THREE_TIME = "支付密码错误,请15分钟后再试"; public static final String ERROR_TRADE_PWD_OVER_THREE_TIME = "支付密码错误,请15分钟后再试";
...@@ -75,4 +78,27 @@ public interface ErrorCode { ...@@ -75,4 +78,27 @@ public interface ErrorCode {
public static final String NOWER="没有权限"; public static final String NOWER="没有权限";
public static final String PAGEDATA="分页参数不能为空"; public static final String PAGEDATA="分页参数不能为空";
public static final String CARADD_MEMBERS="该司机已有绑定车辆,不能绑定多个"; public static final String CARADD_MEMBERS="该司机已有绑定车辆,不能绑定多个";
public static final int DEVICE_CODE_IS_EMPTY = 1001;
public static final String DEVICE_CODE_IS_EMPTY_CONTENT = "当前设备编码不存在!";
public static final int DEVICE_CODE_IS_EXIST = 1002;
public static final String DEVICE_CODE_IS_EXIST_CONTENT = "当前设备编码已存在!";
public static final int PRODUCT_IS_EMPTY = 1003;
public static final String PRODUCT_IS_EMPTY_CONTENT = "所属产品编码不存在!";
public static final int DEVICE_UNACTIVE = 1004;
public static final String DEVICE_UNACTIVE_CONTENT = "当前设备未激活,请在后台配置后再激活!";
public static final int PLATFORM_IS_EMPTY = 1005;
public static final String PLATFORM_IS_EMPTY_CONTENT = "当前设备编码不存在!";
public static final int PLATFORM_UNEXIST = 1006;
public static final String PLATFORM_UNEXIST_CONTENT = "当前设备所属产品平台未配置,请在后台配置后再激活!";
public static final int SITEID_IS_EMPTY = 1007;
public static final String SITEID_IS_EMPTY_CONTENT = "站点ID为空!";
} }
...@@ -83,7 +83,7 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi ...@@ -83,7 +83,7 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
} }
).collect(Collectors.toSet()); ).collect(Collectors.toSet());
mainConsumer.subscribe(topicPartitionInfoSet); mainConsumer.subscribe(topicPartitionInfoSet);
topicPartitionInfoSet.stream().forEach(item->{ topicPartitionInfoSet.stream().forEach(item -> {
log.info("消费线程订阅topic:{}", item.getTopic()); log.info("消费线程订阅topic:{}", item.getTopic());
}); });
this.consumersExecutor = Executors.newCachedThreadPool(IotThreadFactory.forName("消费queue线程")); this.consumersExecutor = Executors.newCachedThreadPool(IotThreadFactory.forName("消费queue线程"));
...@@ -156,9 +156,13 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi ...@@ -156,9 +156,13 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
for (TbQueueMsg queueMsg : messages) { for (TbQueueMsg queueMsg : messages) {
log.info("[WRITE MESSAGE] ->message:{}", JSON.toJSONString(queueMsg)); log.info("[WRITE MESSAGE] ->message:{}", JSON.toJSONString(queueMsg));
//做相应业务,做日志操作 //做相应业务,做日志操作
DeviceReq deviceReq = JSON.parseObject(new String(queueMsg.getData()), DeviceReq.class); // TODO: 2022/7/12 设备来源从设备编码中获取,内容不做处理
String deviceCode = queueMsg.getHeaders().get("deviceCode");
String messageType = queueMsg.getHeaders().get(MESSAGETYPE);
//DeviceReq deviceReq = JSON.parseObject(new String(queueMsg.getData()), DeviceReq.class);
boolean bool = false; boolean bool = false;
DeviceEntity deviceEntity = deviceService.getExtCache(deviceReq.getDeviceCode()); DeviceEntity deviceEntity = deviceService.getExtCache(deviceCode);
if (!ObjectUtils.isEmpty(deviceEntity)) { if (!ObjectUtils.isEmpty(deviceEntity)) {
cacheService.setnx(RedisKey.KEY_DEVICE_ONLINE_CACHE + deviceEntity.getDeviceCode(), "", GlobalSysInfo.getParamIntValue(Constant.HEARTBEAT_TIMEOUT, 180)); cacheService.setnx(RedisKey.KEY_DEVICE_ONLINE_CACHE + deviceEntity.getDeviceCode(), "", GlobalSysInfo.getParamIntValue(Constant.HEARTBEAT_TIMEOUT, 180));
if (deviceEntity.getDeviceStatus() == DeviceStatusEnum.离线.getValue()) { if (deviceEntity.getDeviceStatus() == DeviceStatusEnum.离线.getValue()) {
...@@ -176,14 +180,14 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi ...@@ -176,14 +180,14 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
deviceService.sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.OFFLINE); deviceService.sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.OFFLINE);
} }
} }
if (!Constant.MESSAGETYPE_HEARTBEAT.equals(queueMsg.getHeaders().getData().get(MESSAGETYPE))) { if (!Constant.MESSAGETYPE_HEARTBEAT.equals(messageType)) {
DeviceLogEntity deviceLogEntity = new DeviceLogEntity(); DeviceLogEntity deviceLogEntity = new DeviceLogEntity();
deviceLogEntity.initAttrValue(); deviceLogEntity.initAttrValue();
deviceLogEntity.setDeviceId(deviceEntity.getId()); deviceLogEntity.setDeviceId(deviceEntity.getId());
deviceLogEntity.setDeviceName(deviceEntity.getDeviceName()); deviceLogEntity.setDeviceName(deviceEntity.getDeviceName());
deviceLogEntity.setDeviceCode(deviceEntity.getDeviceCode()); deviceLogEntity.setDeviceCode(deviceEntity.getDeviceCode());
deviceLogEntity.setMessageHead(queueMsg.getHeaders().getData().get(MESSAGETYPE)); deviceLogEntity.setMessageHead(queueMsg.getHeaders().getData().get(MESSAGETYPE));
deviceLogEntity.setContent(JSONObject.toJSONString(deviceReq)); deviceLogEntity.setContent(new String(queueMsg.getData()));
deviceLogEntity.setLogType(LogTypeEnum.上报事件.getValue()); deviceLogEntity.setLogType(LogTypeEnum.上报事件.getValue());
deviceLogEntity.setCreateUserId(1L); deviceLogEntity.setCreateUserId(1L);
deviceLogEntity.setCreateTime(new Date()); deviceLogEntity.setCreateTime(new Date());
......
...@@ -4,17 +4,15 @@ import java.util.Date; ...@@ -4,17 +4,15 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.mortals.framework.annotation.Excel; import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.base.framework.CustomJsonDateDeserializer;
import com.mortals.xhx.module.device.model.vo.DeviceVo; import com.mortals.xhx.module.device.model.vo.DeviceVo;
/** /**
* 设备实体对象 * 设备实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-07-01 * @date 2022-07-11
*/ */
public class DeviceEntity extends DeviceVo { public class DeviceEntity extends DeviceVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -27,7 +25,7 @@ public class DeviceEntity extends DeviceVo { ...@@ -27,7 +25,7 @@ public class DeviceEntity extends DeviceVo {
/** /**
* 设备编码,SN码等,默认为MAC地址 * 设备编码,SN码等,默认为MAC地址
*/ */
@Excel(name = "设备编码") @Excel(name = "设备编码,SN码等,默认为MAC地址")
private String deviceCode; private String deviceCode;
/** /**
* 设备的MAC地址 * 设备的MAC地址
...@@ -36,7 +34,6 @@ public class DeviceEntity extends DeviceVo { ...@@ -36,7 +34,6 @@ public class DeviceEntity extends DeviceVo {
/** /**
* 站点Id,来源基础服务平台 * 站点Id,来源基础服务平台
*/ */
//@Excel(name = "站点名称",cacheDict = "siteDict")
private Long siteId; private Long siteId;
/** /**
* 站点编号,来源基础服务平台 * 站点编号,来源基础服务平台
...@@ -69,6 +66,7 @@ public class DeviceEntity extends DeviceVo { ...@@ -69,6 +66,7 @@ public class DeviceEntity extends DeviceVo {
/** /**
* 设备生产厂商名称 * 设备生产厂商名称
*/ */
@Excel(name = "设备生产厂商名称")
private String deviceFirmname; private String deviceFirmname;
/** /**
* 设备来源(0.子设备,1.网关设备,2.直连设备) * 设备来源(0.子设备,1.网关设备,2.直连设备)
...@@ -97,7 +95,6 @@ public class DeviceEntity extends DeviceVo { ...@@ -97,7 +95,6 @@ public class DeviceEntity extends DeviceVo {
/** /**
* 保修期至 * 保修期至
*/ */
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
private Date defectsLiabilityPeriod; private Date defectsLiabilityPeriod;
/** /**
* 负责人 * 负责人
...@@ -114,7 +111,6 @@ public class DeviceEntity extends DeviceVo { ...@@ -114,7 +111,6 @@ public class DeviceEntity extends DeviceVo {
/** /**
* 设备图片 * 设备图片
*/ */
@Excel(name = "设备图片",height = 90, type = Excel.Type.EXPORT, cellType = Excel.ColumnType.IMAGE)
private String devicePhotoPath; private String devicePhotoPath;
/** /**
* 设备访问ip * 设备访问ip
...@@ -157,9 +153,13 @@ public class DeviceEntity extends DeviceVo { ...@@ -157,9 +153,13 @@ public class DeviceEntity extends DeviceVo {
*/ */
private Date offlineTime; private Date offlineTime;
/** /**
* 是否删除,(0.否,1.是) * 是否删除(0.否,1.是)
*/ */
private Integer deleted; private Integer deleted;
/**
* 收不来源(0.旧设备,1.新设备)
*/
private Integer source;
...@@ -627,19 +627,33 @@ public class DeviceEntity extends DeviceVo { ...@@ -627,19 +627,33 @@ public class DeviceEntity extends DeviceVo {
this.offlineTime = offlineTime; this.offlineTime = offlineTime;
} }
/** /**
* 获取 是否删除,(0.否,1.是) * 获取 是否删除(0.否,1.是)
* @return Integer * @return Integer
*/ */
public Integer getDeleted(){ public Integer getDeleted(){
return deleted; return deleted;
} }
/** /**
* 设置 是否删除,(0.否,1.是) * 设置 是否删除(0.否,1.是)
* @param deleted * @param deleted
*/ */
public void setDeleted(Integer deleted){ public void setDeleted(Integer deleted){
this.deleted = deleted; this.deleted = deleted;
} }
/**
* 获取 收不来源(0.旧设备,1.新设备)
* @return Integer
*/
public Integer getSource(){
return source;
}
/**
* 设置 收不来源(0.旧设备,1.新设备)
* @param source
*/
public void setSource(Integer source){
this.source = source;
}
...@@ -696,6 +710,7 @@ public class DeviceEntity extends DeviceVo { ...@@ -696,6 +710,7 @@ public class DeviceEntity extends DeviceVo {
sb.append(",onlineTime:").append(getOnlineTime()); sb.append(",onlineTime:").append(getOnlineTime());
sb.append(",offlineTime:").append(getOfflineTime()); sb.append(",offlineTime:").append(getOfflineTime());
sb.append(",deleted:").append(getDeleted()); sb.append(",deleted:").append(getDeleted());
sb.append(",source:").append(getSource());
return sb.toString(); return sb.toString();
} }
...@@ -725,7 +740,7 @@ public class DeviceEntity extends DeviceVo { ...@@ -725,7 +740,7 @@ public class DeviceEntity extends DeviceVo {
this.deviceFirmname = ""; this.deviceFirmname = "";
this.deviceSrc = 0; this.deviceSrc = 2;
this.deviceDataSourceWay = 0; this.deviceDataSourceWay = 0;
...@@ -768,5 +783,7 @@ public class DeviceEntity extends DeviceVo { ...@@ -768,5 +783,7 @@ public class DeviceEntity extends DeviceVo {
this.offlineTime = null; this.offlineTime = null;
this.deleted = 0; this.deleted = 0;
this.source = 1;
} }
} }
\ No newline at end of file
...@@ -4,11 +4,11 @@ import java.util.Date; ...@@ -4,11 +4,11 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.mortals.xhx.module.device.model.DeviceEntity; import com.mortals.xhx.module.device.model.DeviceEntity;
/** /**
* 设备查询对象 * 设备查询对象
* *
* @author zxfei * @author zxfei
* @date 2022-07-01 * @date 2022-07-11
*/ */
public class DeviceQuery extends DeviceEntity { public class DeviceQuery extends DeviceEntity {
/** 开始 主键ID,主键,自增长 */ /** 开始 主键ID,主键,自增长 */
private Long idStart; private Long idStart;
...@@ -229,18 +229,30 @@ public class DeviceQuery extends DeviceEntity { ...@@ -229,18 +229,30 @@ public class DeviceQuery extends DeviceEntity {
/** 结束 最近离线时间 */ /** 结束 最近离线时间 */
private String offlineTimeEnd; private String offlineTimeEnd;
/** 开始 是否删除(0.否,1.是) */ /** 开始 是否删除(0.否,1.是) */
private Integer deletedStart; private Integer deletedStart;
/** 结束 是否删除(0.否,1.是) */ /** 结束 是否删除(0.否,1.是) */
private Integer deletedEnd; private Integer deletedEnd;
/** 增加 是否删除(0.否,1.是) */ /** 增加 是否删除(0.否,1.是) */
private Integer deletedIncrement; private Integer deletedIncrement;
/** 是否删除(0.否,1.是)列表 */ /** 是否删除(0.否,1.是)列表 */
private List <Integer> deletedList; private List <Integer> deletedList;
/** 开始 收不来源(0.旧设备,1.新设备) */
private Integer sourceStart;
/** 结束 收不来源(0.旧设备,1.新设备) */
private Integer sourceEnd;
/** 增加 收不来源(0.旧设备,1.新设备) */
private Integer sourceIncrement;
/** 收不来源(0.旧设备,1.新设备)列表 */
private List <Integer> sourceList;
/** 开始 创建用户 */ /** 开始 创建用户 */
private Long createUserIdStart; private Long createUserIdStart;
...@@ -1435,7 +1447,7 @@ public class DeviceQuery extends DeviceEntity { ...@@ -1435,7 +1447,7 @@ public class DeviceQuery extends DeviceEntity {
} }
/** /**
* 获取 开始 是否删除,(0.否,1.是) * 获取 开始 是否删除(0.否,1.是)
* @return deletedStart * @return deletedStart
*/ */
public Integer getDeletedStart(){ public Integer getDeletedStart(){
...@@ -1443,7 +1455,7 @@ public class DeviceQuery extends DeviceEntity { ...@@ -1443,7 +1455,7 @@ public class DeviceQuery extends DeviceEntity {
} }
/** /**
* 设置 开始 是否删除,(0.否,1.是) * 设置 开始 是否删除(0.否,1.是)
* @param deletedStart * @param deletedStart
*/ */
public void setDeletedStart(Integer deletedStart){ public void setDeletedStart(Integer deletedStart){
...@@ -1451,7 +1463,7 @@ public class DeviceQuery extends DeviceEntity { ...@@ -1451,7 +1463,7 @@ public class DeviceQuery extends DeviceEntity {
} }
/** /**
* 获取 结束 是否删除,(0.否,1.是) * 获取 结束 是否删除(0.否,1.是)
* @return $deletedEnd * @return $deletedEnd
*/ */
public Integer getDeletedEnd(){ public Integer getDeletedEnd(){
...@@ -1459,7 +1471,7 @@ public class DeviceQuery extends DeviceEntity { ...@@ -1459,7 +1471,7 @@ public class DeviceQuery extends DeviceEntity {
} }
/** /**
* 设置 结束 是否删除,(0.否,1.是) * 设置 结束 是否删除(0.否,1.是)
* @param deletedEnd * @param deletedEnd
*/ */
public void setDeletedEnd(Integer deletedEnd){ public void setDeletedEnd(Integer deletedEnd){
...@@ -1467,7 +1479,7 @@ public class DeviceQuery extends DeviceEntity { ...@@ -1467,7 +1479,7 @@ public class DeviceQuery extends DeviceEntity {
} }
/** /**
* 获取 增加 是否删除,(0.否,1.是) * 获取 增加 是否删除(0.否,1.是)
* @return deletedIncrement * @return deletedIncrement
*/ */
public Integer getDeletedIncrement(){ public Integer getDeletedIncrement(){
...@@ -1475,7 +1487,7 @@ public class DeviceQuery extends DeviceEntity { ...@@ -1475,7 +1487,7 @@ public class DeviceQuery extends DeviceEntity {
} }
/** /**
* 设置 增加 是否删除,(0.否,1.是) * 设置 增加 是否删除(0.否,1.是)
* @param deletedIncrement * @param deletedIncrement
*/ */
public void setDeletedIncrement(Integer deletedIncrement){ public void setDeletedIncrement(Integer deletedIncrement){
...@@ -1483,7 +1495,7 @@ public class DeviceQuery extends DeviceEntity { ...@@ -1483,7 +1495,7 @@ public class DeviceQuery extends DeviceEntity {
} }
/** /**
* 获取 是否删除,(0.否,1.是) * 获取 是否删除(0.否,1.是)
* @return deletedList * @return deletedList
*/ */
public List<Integer> getDeletedList(){ public List<Integer> getDeletedList(){
...@@ -1491,13 +1503,77 @@ public class DeviceQuery extends DeviceEntity { ...@@ -1491,13 +1503,77 @@ public class DeviceQuery extends DeviceEntity {
} }
/** /**
* 设置 是否删除,(0.否,1.是) * 设置 是否删除(0.否,1.是)
* @param deletedList * @param deletedList
*/ */
public void setDeletedList(List<Integer> deletedList){ public void setDeletedList(List<Integer> deletedList){
this.deletedList = deletedList; this.deletedList = deletedList;
} }
/**
* 获取 开始 收不来源(0.旧设备,1.新设备)
* @return sourceStart
*/
public Integer getSourceStart(){
return this.sourceStart;
}
/**
* 设置 开始 收不来源(0.旧设备,1.新设备)
* @param sourceStart
*/
public void setSourceStart(Integer sourceStart){
this.sourceStart = sourceStart;
}
/**
* 获取 结束 收不来源(0.旧设备,1.新设备)
* @return $sourceEnd
*/
public Integer getSourceEnd(){
return this.sourceEnd;
}
/**
* 设置 结束 收不来源(0.旧设备,1.新设备)
* @param sourceEnd
*/
public void setSourceEnd(Integer sourceEnd){
this.sourceEnd = sourceEnd;
}
/**
* 获取 增加 收不来源(0.旧设备,1.新设备)
* @return sourceIncrement
*/
public Integer getSourceIncrement(){
return this.sourceIncrement;
}
/**
* 设置 增加 收不来源(0.旧设备,1.新设备)
* @param sourceIncrement
*/
public void setSourceIncrement(Integer sourceIncrement){
this.sourceIncrement = sourceIncrement;
}
/**
* 获取 收不来源(0.旧设备,1.新设备)
* @return sourceList
*/
public List<Integer> getSourceList(){
return this.sourceList;
}
/**
* 设置 收不来源(0.旧设备,1.新设备)
* @param sourceList
*/
public void setSourceList(List<Integer> sourceList){
this.sourceList = sourceList;
}
/** /**
* 获取 开始 创建用户 * 获取 开始 创建用户
* @return createUserIdStart * @return createUserIdStart
...@@ -2595,7 +2671,7 @@ public class DeviceQuery extends DeviceEntity { ...@@ -2595,7 +2671,7 @@ public class DeviceQuery extends DeviceEntity {
/** /**
* 设置 是否删除,(0.否,1.是) * 设置 是否删除(0.否,1.是)
* @param deleted * @param deleted
*/ */
public DeviceQuery deleted(Integer deleted){ public DeviceQuery deleted(Integer deleted){
...@@ -2604,7 +2680,7 @@ public class DeviceQuery extends DeviceEntity { ...@@ -2604,7 +2680,7 @@ public class DeviceQuery extends DeviceEntity {
} }
/** /**
* 设置 开始 是否删除,(0.否,1.是) * 设置 开始 是否删除(0.否,1.是)
* @param deletedStart * @param deletedStart
*/ */
public DeviceQuery deletedStart(Integer deletedStart){ public DeviceQuery deletedStart(Integer deletedStart){
...@@ -2613,7 +2689,7 @@ public class DeviceQuery extends DeviceEntity { ...@@ -2613,7 +2689,7 @@ public class DeviceQuery extends DeviceEntity {
} }
/** /**
* 设置 结束 是否删除,(0.否,1.是) * 设置 结束 是否删除(0.否,1.是)
* @param deletedEnd * @param deletedEnd
*/ */
public DeviceQuery deletedEnd(Integer deletedEnd){ public DeviceQuery deletedEnd(Integer deletedEnd){
...@@ -2622,7 +2698,7 @@ public class DeviceQuery extends DeviceEntity { ...@@ -2622,7 +2698,7 @@ public class DeviceQuery extends DeviceEntity {
} }
/** /**
* 设置 增加 是否删除,(0.否,1.是) * 设置 增加 是否删除(0.否,1.是)
* @param deletedIncrement * @param deletedIncrement
*/ */
public DeviceQuery deletedIncrement(Integer deletedIncrement){ public DeviceQuery deletedIncrement(Integer deletedIncrement){
...@@ -2631,7 +2707,7 @@ public class DeviceQuery extends DeviceEntity { ...@@ -2631,7 +2707,7 @@ public class DeviceQuery extends DeviceEntity {
} }
/** /**
* 设置 是否删除,(0.否,1.是) * 设置 是否删除(0.否,1.是)
* @param deletedList * @param deletedList
*/ */
public DeviceQuery deletedList(List<Integer> deletedList){ public DeviceQuery deletedList(List<Integer> deletedList){
...@@ -2639,6 +2715,51 @@ public class DeviceQuery extends DeviceEntity { ...@@ -2639,6 +2715,51 @@ public class DeviceQuery extends DeviceEntity {
return this; return this;
} }
/**
* 设置 收不来源(0.旧设备,1.新设备)
* @param source
*/
public DeviceQuery source(Integer source){
setSource(source);
return this;
}
/**
* 设置 开始 收不来源(0.旧设备,1.新设备)
* @param sourceStart
*/
public DeviceQuery sourceStart(Integer sourceStart){
this.sourceStart = sourceStart;
return this;
}
/**
* 设置 结束 收不来源(0.旧设备,1.新设备)
* @param sourceEnd
*/
public DeviceQuery sourceEnd(Integer sourceEnd){
this.sourceEnd = sourceEnd;
return this;
}
/**
* 设置 增加 收不来源(0.旧设备,1.新设备)
* @param sourceIncrement
*/
public DeviceQuery sourceIncrement(Integer sourceIncrement){
this.sourceIncrement = sourceIncrement;
return this;
}
/**
* 设置 收不来源(0.旧设备,1.新设备)
* @param sourceList
*/
public DeviceQuery sourceList(List<Integer> sourceList){
this.sourceList = sourceList;
return this;
}
/** /**
* 设置 创建用户 * 设置 创建用户
* @param createUserId * @param createUserId
......
...@@ -210,7 +210,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -210,7 +210,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
BeanUtils.copyProperties(entity, deviceReq, BeanUtil.getNullPropertyNames(entity)); BeanUtils.copyProperties(entity, deviceReq, BeanUtil.getNullPropertyNames(entity));
deviceReq.setReceiveMethod(update.getValue()); deviceReq.setReceiveMethod(update.getValue());
deviceReq.setProductCode(productEntity.getProductCode()); deviceReq.setProductCode(productEntity.getProductCode());
deviceReq.setPlatformCode(platformEntity.getPlatformSn()); //deviceReq.setPlatformCode(platformEntity.getPlatformSn());
if (!ObjectUtils.isEmpty(platformEntity.getSendUrl()) if (!ObjectUtils.isEmpty(platformEntity.getSendUrl())
//&& platformEntity.getSendSwitch() == SendSwitchEnum.启用.getValue() //&& platformEntity.getSendSwitch() == SendSwitchEnum.启用.getValue()
&& entity.getSwitchSend()) { && entity.getSwitchSend()) {
......
package com.mortals.xhx.module.platform.service.impl; package com.mortals.xhx.module.platform.service.impl;
import cn.hutool.core.lang.PatternPool;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.platform.dao.PlatformDao; import com.mortals.xhx.module.platform.dao.PlatformDao;
import com.mortals.xhx.module.platform.model.PlatformEntity; import com.mortals.xhx.module.platform.model.PlatformEntity;
import com.mortals.xhx.module.platform.service.PlatformService; import com.mortals.xhx.module.platform.service.PlatformService;
import org.springframework.util.ObjectUtils;
/** /**
* PlatformService * PlatformService
* 平台系统 service实现 * 平台系统 service实现
...@@ -13,5 +18,16 @@ import com.mortals.xhx.module.platform.service.PlatformService; ...@@ -13,5 +18,16 @@ import com.mortals.xhx.module.platform.service.PlatformService;
*/ */
@Service("platformService") @Service("platformService")
public class PlatformServiceImpl extends AbstractCRUDServiceImpl<PlatformDao, PlatformEntity, Long> implements PlatformService { public class PlatformServiceImpl extends AbstractCRUDServiceImpl<PlatformDao, PlatformEntity, Long> implements PlatformService {
@Override
protected void validData(PlatformEntity entity, Context context) throws AppException {
if(!ObjectUtils.isEmpty(entity.getSendUrl())){
//UrlValidator urlValidator = new UrlValidator();
}
super.validData(entity, context);
}
} }
\ No newline at end of file
...@@ -7,15 +7,19 @@ import com.mortals.framework.annotation.Excel; ...@@ -7,15 +7,19 @@ import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.product.model.vo.ProductVo; import com.mortals.xhx.module.product.model.vo.ProductVo;
/** /**
* 产品实体对象 * 产品实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-07-01 * @date 2022-07-11
*/ */
public class ProductEntity extends ProductVo { public class ProductEntity extends ProductVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* 关联平台
*/
private Long platformId;
/** /**
* 产品名称,名称唯一 * 产品名称,名称唯一
*/ */
...@@ -26,10 +30,6 @@ public class ProductEntity extends ProductVo { ...@@ -26,10 +30,6 @@ public class ProductEntity extends ProductVo {
*/ */
private String productCode; private String productCode;
/** /**
* 交换机名称,英文必填
*/
private String exchangeName;
/**
* 备注 * 备注
*/ */
private String productRemark; private String productRemark;
...@@ -37,6 +37,20 @@ public class ProductEntity extends ProductVo { ...@@ -37,6 +37,20 @@ public class ProductEntity extends ProductVo {
public ProductEntity(){} public ProductEntity(){}
/**
* 获取 关联平台
* @return Long
*/
public Long getPlatformId(){
return platformId;
}
/**
* 设置 关联平台
* @param platformId
*/
public void setPlatformId(Long platformId){
this.platformId = platformId;
}
/** /**
* 获取 产品名称,名称唯一 * 获取 产品名称,名称唯一
* @return String * @return String
...@@ -66,20 +80,6 @@ public class ProductEntity extends ProductVo { ...@@ -66,20 +80,6 @@ public class ProductEntity extends ProductVo {
this.productCode = productCode; this.productCode = productCode;
} }
/** /**
* 获取 交换机名称,英文必填
* @return String
*/
public String getExchangeName(){
return exchangeName;
}
/**
* 设置 交换机名称,英文必填
* @param exchangeName
*/
public void setExchangeName(String exchangeName){
this.exchangeName = exchangeName;
}
/**
* 获取 备注 * 获取 备注
* @return String * @return String
*/ */
...@@ -115,21 +115,21 @@ public class ProductEntity extends ProductVo { ...@@ -115,21 +115,21 @@ public class ProductEntity extends ProductVo {
public String toString(){ public String toString(){
StringBuilder sb = new StringBuilder(""); StringBuilder sb = new StringBuilder("");
sb.append(",platformId:").append(getPlatformId());
sb.append(",productName:").append(getProductName()); sb.append(",productName:").append(getProductName());
sb.append(",productCode:").append(getProductCode()); sb.append(",productCode:").append(getProductCode());
sb.append(",exchangeName:").append(getExchangeName());
sb.append(",productRemark:").append(getProductRemark()); sb.append(",productRemark:").append(getProductRemark());
return sb.toString(); return sb.toString();
} }
public void initAttrValue(){ public void initAttrValue(){
this.platformId = null;
this.productName = ""; this.productName = "";
this.productCode = ""; this.productCode = "";
this.exchangeName = "";
this.productRemark = ""; this.productRemark = "";
} }
} }
\ No newline at end of file
...@@ -3,11 +3,11 @@ package com.mortals.xhx.module.product.model; ...@@ -3,11 +3,11 @@ package com.mortals.xhx.module.product.model;
import java.util.List; import java.util.List;
import com.mortals.xhx.module.product.model.ProductEntity; import com.mortals.xhx.module.product.model.ProductEntity;
/** /**
* 产品查询对象 * 产品查询对象
* *
* @author zxfei * @author zxfei
* @date 2022-07-01 * @date 2022-07-11
*/ */
public class ProductQuery extends ProductEntity { public class ProductQuery extends ProductEntity {
/** 开始 主键ID,主键,自增长 */ /** 开始 主键ID,主键,自增长 */
private Long idStart; private Long idStart;
...@@ -21,15 +21,24 @@ public class ProductQuery extends ProductEntity { ...@@ -21,15 +21,24 @@ public class ProductQuery extends ProductEntity {
/** 主键ID,主键,自增长列表 */ /** 主键ID,主键,自增长列表 */
private List <Long> idList; private List <Long> idList;
/** 开始 关联平台 */
private Long platformIdStart;
/** 结束 关联平台 */
private Long platformIdEnd;
/** 增加 关联平台 */
private Long platformIdIncrement;
/** 关联平台列表 */
private List <Long> platformIdList;
/** 产品名称,名称唯一 */ /** 产品名称,名称唯一 */
private List<String> productNameList; private List<String> productNameList;
/** 产品编码 */ /** 产品编码 */
private List<String> productCodeList; private List<String> productCodeList;
/** 交换机名称,英文必填 */
private List<String> exchangeNameList;
/** 备注 */ /** 备注 */
private List<String> productRemarkList; private List<String> productRemarkList;
...@@ -141,6 +150,70 @@ public class ProductQuery extends ProductEntity { ...@@ -141,6 +150,70 @@ public class ProductQuery extends ProductEntity {
this.idList = idList; this.idList = idList;
} }
/**
* 获取 开始 关联平台
* @return platformIdStart
*/
public Long getPlatformIdStart(){
return this.platformIdStart;
}
/**
* 设置 开始 关联平台
* @param platformIdStart
*/
public void setPlatformIdStart(Long platformIdStart){
this.platformIdStart = platformIdStart;
}
/**
* 获取 结束 关联平台
* @return $platformIdEnd
*/
public Long getPlatformIdEnd(){
return this.platformIdEnd;
}
/**
* 设置 结束 关联平台
* @param platformIdEnd
*/
public void setPlatformIdEnd(Long platformIdEnd){
this.platformIdEnd = platformIdEnd;
}
/**
* 获取 增加 关联平台
* @return platformIdIncrement
*/
public Long getPlatformIdIncrement(){
return this.platformIdIncrement;
}
/**
* 设置 增加 关联平台
* @param platformIdIncrement
*/
public void setPlatformIdIncrement(Long platformIdIncrement){
this.platformIdIncrement = platformIdIncrement;
}
/**
* 获取 关联平台
* @return platformIdList
*/
public List<Long> getPlatformIdList(){
return this.platformIdList;
}
/**
* 设置 关联平台
* @param platformIdList
*/
public void setPlatformIdList(List<Long> platformIdList){
this.platformIdList = platformIdList;
}
/** /**
* 获取 产品名称,名称唯一 * 获取 产品名称,名称唯一
* @return productNameList * @return productNameList
...@@ -172,21 +245,6 @@ public class ProductQuery extends ProductEntity { ...@@ -172,21 +245,6 @@ public class ProductQuery extends ProductEntity {
this.productCodeList = productCodeList; this.productCodeList = productCodeList;
} }
/** /**
* 获取 交换机名称,英文必填
* @return exchangeNameList
*/
public List<String> getExchangeNameList(){
return this.exchangeNameList;
}
/**
* 设置 交换机名称,英文必填
* @param exchangeNameList
*/
public void setExchangeNameList(List<String> exchangeNameList){
this.exchangeNameList = exchangeNameList;
}
/**
* 获取 备注 * 获取 备注
* @return productRemarkList * @return productRemarkList
*/ */
...@@ -438,6 +496,51 @@ public class ProductQuery extends ProductEntity { ...@@ -438,6 +496,51 @@ public class ProductQuery extends ProductEntity {
return this; return this;
} }
/**
* 设置 关联平台
* @param platformId
*/
public ProductQuery platformId(Long platformId){
setPlatformId(platformId);
return this;
}
/**
* 设置 开始 关联平台
* @param platformIdStart
*/
public ProductQuery platformIdStart(Long platformIdStart){
this.platformIdStart = platformIdStart;
return this;
}
/**
* 设置 结束 关联平台
* @param platformIdEnd
*/
public ProductQuery platformIdEnd(Long platformIdEnd){
this.platformIdEnd = platformIdEnd;
return this;
}
/**
* 设置 增加 关联平台
* @param platformIdIncrement
*/
public ProductQuery platformIdIncrement(Long platformIdIncrement){
this.platformIdIncrement = platformIdIncrement;
return this;
}
/**
* 设置 关联平台
* @param platformIdList
*/
public ProductQuery platformIdList(List<Long> platformIdList){
this.platformIdList = platformIdList;
return this;
}
/** /**
* 设置 产品名称,名称唯一 * 设置 产品名称,名称唯一
...@@ -477,25 +580,6 @@ public class ProductQuery extends ProductEntity { ...@@ -477,25 +580,6 @@ public class ProductQuery extends ProductEntity {
} }
/**
* 设置 交换机名称,英文必填
* @param exchangeName
*/
public ProductQuery exchangeName(String exchangeName){
setExchangeName(exchangeName);
return this;
}
/**
* 设置 交换机名称,英文必填
* @param exchangeNameList
*/
public ProductQuery exchangeNameList(List<String> exchangeNameList){
this.exchangeNameList = exchangeNameList;
return this;
}
/** /**
* 设置 备注 * 设置 备注
* @param productRemark * @param productRemark
......
package com.mortals.xhx.module.product.service.impl; package com.mortals.xhx.module.product.service.impl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.product.model.ProductQuery;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.product.dao.ProductDao; import com.mortals.xhx.module.product.dao.ProductDao;
import com.mortals.xhx.module.product.model.ProductEntity; import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.service.ProductService; import com.mortals.xhx.module.product.service.ProductService;
import org.springframework.util.ObjectUtils;
/** /**
* ProductService * ProductService
* 产品 service实现 * 产品 service实现
...@@ -14,4 +19,23 @@ import com.mortals.xhx.module.product.service.ProductService; ...@@ -14,4 +19,23 @@ import com.mortals.xhx.module.product.service.ProductService;
@Service("productService") @Service("productService")
public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, ProductEntity, Long> implements ProductService { public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, ProductEntity, Long> implements ProductService {
@Override
protected void saveBefore(ProductEntity entity, Context context) throws AppException {
//新增产品编码不能重复
ProductEntity productEntity = this.selectOne(new ProductQuery().productCode(entity.getProductCode()));
if(!ObjectUtils.isEmpty(productEntity))throw new AppException("当前产品编码已存在!");
super.saveBefore(entity, context);
}
@Override
protected void updateBefore(ProductEntity entity, Context context) throws AppException {
ProductEntity productEntity = this.get(entity.getId());
if(!productEntity.getProductCode().equals(entity.getProductCode())){
ProductEntity productEntity1 = this.selectOne(new ProductQuery().productCode(entity.getProductCode()));
if(!ObjectUtils.isEmpty(productEntity1))throw new AppException("当前产品编码已存在!");
}
super.updateBefore(entity, context);
}
} }
\ No newline at end of file
...@@ -3,6 +3,8 @@ package com.mortals.xhx.module.product.web; ...@@ -3,6 +3,8 @@ package com.mortals.xhx.module.product.web;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.platform.model.PlatformQuery;
import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.model.ProductEntity; import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.service.ProductService; import com.mortals.xhx.module.product.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -10,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -10,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* *
* 产品 * 产品
...@@ -23,6 +27,8 @@ public class ProductController extends BaseCRUDJsonBodyMappingController<Product ...@@ -23,6 +27,8 @@ public class ProductController extends BaseCRUDJsonBodyMappingController<Product
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
@Autowired
private PlatformService platformService;
public ProductController(){ public ProductController(){
super.setModuleDesc( "产品"); super.setModuleDesc( "产品");
...@@ -30,6 +36,7 @@ public class ProductController extends BaseCRUDJsonBodyMappingController<Product ...@@ -30,6 +36,7 @@ public class ProductController extends BaseCRUDJsonBodyMappingController<Product
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model,"platformId",platformService.find(new PlatformQuery()).stream().collect(Collectors.toMap(x->x.getId().toString(),y->y.getPlatformName())));
super.init(model, context); super.init(model, context);
} }
......
...@@ -77,7 +77,9 @@ cookie: ...@@ -77,7 +77,9 @@ cookie:
port: 11010 port: 11010
upload: upload:
path: @profiles.filepath@ path: @profiles.filepath@
feign:
hystrix:
enabled: true
queue: queue:
type: @profiles.queue.type@ # memory or kafka (Apache Kafka) or rabbitmq (RabbitMQ) type: @profiles.queue.type@ # memory or kafka (Apache Kafka) or rabbitmq (RabbitMQ)
core: core:
......
...@@ -136,7 +136,7 @@ Content-Type: application/json ...@@ -136,7 +136,7 @@ Content-Type: application/json
Authorization: {{authToken}} Authorization: {{authToken}}
{ {
"deviceCode": "c12345678", "deviceCode": "a101",
"action": "upload" "action": "upload"
} }
......
...@@ -315,9 +315,8 @@ data|object|数据对象|- ...@@ -315,9 +315,8 @@ data|object|数据对象|-
deviceName|String|否|设备名称 deviceName|String|否|设备名称
deviceCode|String|是|设备编码,默认为MAC地址 deviceCode|String|是|设备编码,默认为MAC地址
siteId|Long|是|站点Id siteId|Long|是|站点Id
siteCode|String|是|站点编号 siteCode|String|否|站点编号
siteName|String|是|站点名称 siteName|String|否|站点名称
platformId|Long|是|平台系统Id
productId|Long|是|产品Id productId|Long|是|产品Id
deviceFirmId|Long|否|设备生产厂商ID deviceFirmId|Long|否|设备生产厂商ID
deviceFirmname|String|否|设备生产厂商名称 deviceFirmname|String|否|设备生产厂商名称
...@@ -328,6 +327,7 @@ deviceInFloor|Integer|否|所属楼层 ...@@ -328,6 +327,7 @@ deviceInFloor|Integer|否|所属楼层
defectsLiabilityPeriod|Date|否|保修期,如2020-08-12 15:00:00 defectsLiabilityPeriod|Date|否|保修期,如2020-08-12 15:00:00
leadingOfficial|String|否|负责人 leadingOfficial|String|否|负责人
leadingOfficialTelephone|String|否|联系电话 leadingOfficialTelephone|String|否|联系电话
source|Integer|否|设备来源,默认1(0.旧设备,1.新设备)
**请求样例:** **请求样例:**
``` ```
...@@ -337,7 +337,6 @@ leadingOfficialTelephone|String|否|联系电话 ...@@ -337,7 +337,6 @@ leadingOfficialTelephone|String|否|联系电话
"siteId":1, "siteId":1,
"siteCode":"510105521000-0001", "siteCode":"510105521000-0001",
"siteName":"测试站点1", "siteName":"测试站点1",
"platformId":1,
"productId":1, "productId":1,
"deviceFirmId":1, "deviceFirmId":1,
"lon":"12", "lon":"12",
...@@ -346,7 +345,8 @@ leadingOfficialTelephone|String|否|联系电话 ...@@ -346,7 +345,8 @@ leadingOfficialTelephone|String|否|联系电话
"deviceInFloor":22, "deviceInFloor":22,
"defectsLiabilityPeriod":"2022-06-30", "defectsLiabilityPeriod":"2022-06-30",
"leadingOfficial":"张三", "leadingOfficial":"张三",
"leadingOfficialTelephone":"13281114856" "leadingOfficialTelephone":"13281114856",,
"source":1
} }
``` ```
...@@ -354,7 +354,7 @@ leadingOfficialTelephone|String|否|联系电话 ...@@ -354,7 +354,7 @@ leadingOfficialTelephone|String|否|联系电话
参数名称 |参数类型|备注|其它 参数名称 |参数类型|备注|其它
---|---|---|--- ---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|- code|Integer|结果码|见附录码表
msg|String|消息|- msg|String|消息|-
data|object|数据对象|- data|object|数据对象|-
&emsp;content|String|加密后的内容|AES加密 &emsp;content|String|加密后的内容|AES加密
...@@ -416,7 +416,7 @@ password|String|平台用户密码|是|- ...@@ -416,7 +416,7 @@ password|String|平台用户密码|是|-
参数名称 |参数类型|备注|其它 参数名称 |参数类型|备注|其它
---|---|---|--- ---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|- code|Integer|结果码|见附录码表
msg|String|消息|- msg|String|消息|-
data|object|数据对象|- data|object|数据对象|-
...@@ -464,7 +464,7 @@ deviceRemark|String|备注|是|- ...@@ -464,7 +464,7 @@ deviceRemark|String|备注|是|-
参数名称 |参数类型|备注|其它 参数名称 |参数类型|备注|其它
---|---|---|--- ---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|- code|Integer|结果码|见附录码表
msg|String|消息|- msg|String|消息|-
data|object|数据对象|- data|object|数据对象|-
...@@ -490,7 +490,7 @@ data|object|数据对象|- ...@@ -490,7 +490,7 @@ data|object|数据对象|-
:------|:---|:---|:---|:--- :------|:---|:---|:---|:---
deviceCode|String|设备编码,如MAC地址|是|- deviceCode|String|设备编码,如MAC地址|是|-
messageType|String|消息类型|是|如heart_beat messageType|String|消息类型|是|如heart_beat
timestamp|Long|产品编码|是|见产品编码附录 timestamp|Long|时间戳|是|-
data|String|数据体,内容自行定义|否|- data|String|数据体,内容自行定义|否|-
...@@ -516,7 +516,7 @@ data|String|数据体,内容自行定义|否|- ...@@ -516,7 +516,7 @@ data|String|数据体,内容自行定义|否|-
参数名称 |参数类型|备注|其它 参数名称 |参数类型|备注|其它
---|---|---|--- ---|---|---|---
code|Integer|结果码(-1.失败,1.接收成功)|- code|Integer|结果码|见附录码表
msg|String|消息|- msg|String|消息|-
**响应消息样例:** **响应消息样例:**
...@@ -545,7 +545,6 @@ data|object|数据对象|是|- ...@@ -545,7 +545,6 @@ data|object|数据对象|是|-
&emsp;deviceStatus|Integer||是|状态,1:新增,2:修改,3:删除,4:激活,5:启用,6:停用,7:上线,8:下线 &emsp;deviceStatus|Integer||是|状态,1:新增,2:修改,3:删除,4:激活,5:启用,6:停用,7:上线,8:下线
&emsp;deviceName|String|设备名称|否|- &emsp;deviceName|String|设备名称|否|-
&emsp;deviceCode|String|设备编码,如MAC地址|是|- &emsp;deviceCode|String|设备编码,如MAC地址|是|-
&emsp;platformCode|String|平台系统编码|是|见附录
&emsp;productCode|String|产品编码|是|见附录 &emsp;productCode|String|产品编码|是|见附录
&emsp;ip|String|设备访问ip|否|- &emsp;ip|String|设备访问ip|否|-
&emsp;port|String|设备端口|否|- &emsp;port|String|设备端口|否|-
...@@ -563,7 +562,7 @@ data|object|数据对象|是|- ...@@ -563,7 +562,7 @@ data|object|数据对象|是|-
参数名称 |参数类型|备注|其它 参数名称 |参数类型|备注|其它
---|---|---|--- ---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|- code|Integer|结果码|见附录码表
msg|String|消息|- msg|String|消息|-
data|object|数据对象|- data|object|数据对象|-
...@@ -657,4 +656,26 @@ key|String|消息唯一标识|是|- ...@@ -657,4 +656,26 @@ key|String|消息唯一标识|是|-
} }
``` ```
## 码表
### 响应结果码表
结果码|结果|其它
---|---|---
1|成功|-
1001|当前设备编码不存在|-
1002|当前设备编码已存在|-
1003|所属产品编码不存在|-
1004|当前设备未激活,请在后台配置后再激活|-
1005|所属平台不存在!请在后台添加后再激活|-
1006|当前设备所属产品平台未配置,请在后台配置后再激活|-
1007|站点ID为空|-
-1|系统内部异常|-
## 附录
### 业务上行下行消息类型
编码|说明|其它
---|---|---
HEART_BEAT|设备心跳消息|设备上行发送
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment