From 8584e5eb422f6c14bcab72a01a625fb21cfaa5e5 Mon Sep 17 00:00:00 2001 From: zhangjunwen Date: Mon, 23 Sep 2024 15:05:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=BD=91=E5=85=B3=E7=BD=91=E5=8D=A1?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E8=83=BD=E5=A4=9F=E9=85=8D=E7=BD=AE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/data/mqtt/MqttAutoStart.java | 4 +- .../gatewayinfo/GatewayCardInfoMapper.java | 2 +- .../gatewayinfo/GatewayCardParamsMapper.java | 11 +++ .../GatewayCardParamsServiceImpl.java | 2 +- imt-ui/src/api/system/gatewayinfo/params.js | 4 +- imt-ui/src/views/login.vue | 2 +- .../system/gatewayinfo/GatewayCardForm.vue | 72 ++++++++++++++----- 7 files changed, 74 insertions(+), 23 deletions(-) diff --git a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/mqtt/MqttAutoStart.java b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/mqtt/MqttAutoStart.java index b2daef1..876c10b 100644 --- a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/mqtt/MqttAutoStart.java +++ b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/mqtt/MqttAutoStart.java @@ -39,9 +39,11 @@ public class MqttAutoStart implements ApplicationRunner { @Value("${imt.data.mqtt.Qos}") private int Qos; + private static final boolean START = false; + @Override public void run(ApplicationArguments args) throws MqttException { - if(true){ + if(START){ // 创建MQTT客户端 MyMqttClient myMqttClient = new MyMqttClient(host, userName, password, clientId, timeOut, keepAlive); logger.info("############## 1、mqtt 客户端创建完成##############"); diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayCardInfoMapper.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayCardInfoMapper.java index 053cf91..c87de70 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayCardInfoMapper.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayCardInfoMapper.java @@ -25,7 +25,7 @@ public interface GatewayCardInfoMapper extends BaseMapperX { .eqIfPresent(GatewayCardInfoDO::getCardName, reqVO.getCardName()) .eqIfPresent(GatewayCardInfoDO::getCardTableMapping, reqVO.getCardTableMapping()) .eqIfPresent(GatewayCardInfoDO::getMsgType, reqVO.getMsgType()) - .orderByDesc(GatewayCardInfoDO::getCardId)); + .orderByAsc(GatewayCardInfoDO::getCreateTime)); } } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayCardParamsMapper.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayCardParamsMapper.java index cd2318f..6cfdccf 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayCardParamsMapper.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayCardParamsMapper.java @@ -27,4 +27,15 @@ public interface GatewayCardParamsMapper extends BaseMapperX selectList(String cardId) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(GatewayCardParamsDO::getCardId, cardId) + .orderByAsc(GatewayCardParamsDO::getCreateTime) + ); + } } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/gatewayinfo/GatewayCardParamsServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/gatewayinfo/GatewayCardParamsServiceImpl.java index 873e428..65e4b8d 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/gatewayinfo/GatewayCardParamsServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/gatewayinfo/GatewayCardParamsServiceImpl.java @@ -99,7 +99,7 @@ public class GatewayCardParamsServiceImpl implements GatewayCardParamsService { */ @Override public List getGatewayCardParamsByCardId(String cardId){ - return gatewayCardParamsMapper.selectList("cardId",cardId); + return gatewayCardParamsMapper.selectList(cardId); } } \ No newline at end of file diff --git a/imt-ui/src/api/system/gatewayinfo/params.js b/imt-ui/src/api/system/gatewayinfo/params.js index 6be744a..8da20cd 100644 --- a/imt-ui/src/api/system/gatewayinfo/params.js +++ b/imt-ui/src/api/system/gatewayinfo/params.js @@ -36,9 +36,9 @@ export function deleteGatewayCardParams(id) { } // 获得机床网关采集卡参数 -export function getGatewayCardParams(id) { +export function getGatewayCardParamsByCardId(cardId) { return request({ - url: "/imt/gateway-card-params/get?id=" + id, + url: "/imt/gateway-card-params/getByCardId?cardId=" + cardId, method: "get", }); } diff --git a/imt-ui/src/views/login.vue b/imt-ui/src/views/login.vue index c38269f..e65c809 100644 --- a/imt-ui/src/views/login.vue +++ b/imt-ui/src/views/login.vue @@ -236,7 +236,7 @@ export default { mobile: "", mobileCode: "", rememberMe: false, - tenantName: "芋道源码", + tenantName: "浪潮智能生产", }, scene: 21, diff --git a/imt-ui/src/views/system/gatewayinfo/GatewayCardForm.vue b/imt-ui/src/views/system/gatewayinfo/GatewayCardForm.vue index 9744ef0..38b057c 100644 --- a/imt-ui/src/views/system/gatewayinfo/GatewayCardForm.vue +++ b/imt-ui/src/views/system/gatewayinfo/GatewayCardForm.vue @@ -93,12 +93,6 @@
- 新 增 +
+ 新增参数行 +
{ + console.log("需要检查的字段:", value); + const repeatName = this.paramsForm.paramsList.filter( + (e) => e.channelName == value + ); + console.log("结果:", repeatName); + if (repeatName.length > 1) { + callback(new Error("通道名称不允许重复")); + } else { + callback(); + } + }; return { // 弹出层标题 dialogTitle: "", @@ -294,6 +307,7 @@ export default { message: "通道名称长度不能超过30个字符", trigger: "blur", }, + { validator: checkRepeatName, trigger: "blur" }, ], paramMappingName: [ { @@ -338,9 +352,15 @@ export default { cancelButtonText: "取消", type: "warning", }) - .then(() => { - if (rows[index].id) { + .then(async () => { + // console.log("rows:", rows); + // console.log("index:", index); + // console.log("删除参数:", rows[index].channelId); + if (rows[index].channelId) { //调用删除接口删除 + await GatewayCardParamsApi.deleteGatewayCardParams( + rows[index].channelId + ); } rows.splice(index, 1); this.$message({ @@ -369,7 +389,11 @@ export default { this.formLoading = true; try { const res = await GatewayCardInfoApi.getGatewayCardInfo(id); - // const paramsRes = await GatewayCardParamsApi.getGatewayCardParams(); + const paramsRes = + await GatewayCardParamsApi.getGatewayCardParamsByCardId(id); + if (paramsRes.data.length > 0) { + this.paramsForm.paramsList = paramsRes.data; + } this.formData = res.data; this.dialogTitle = "修改机床网关采集卡信息"; } finally { @@ -380,7 +404,7 @@ export default { }, /** 提交按钮 */ async submitForm() { - console.log("paramsList", this.paramsList); + // console.log("paramsList", this.paramsList); // 校验主表 await this.$refs["formRef"].validate(); await this.$refs["paramsForm"].validate(); @@ -390,6 +414,13 @@ export default { // 修改的提交 if (data.cardId) { await GatewayCardInfoApi.updateGatewayCardInfo(data); + if (this.paramsForm.paramsList) { + this.refreshGatewayCardParams( + this.paramsForm.paramsList, + this.formData, + data.cardId + ); + } this.$modal.msgSuccess("修改成功"); this.dialogVisible = false; this.$emit("success"); @@ -400,13 +431,10 @@ export default { const cardId = cardInfo.data; //新增参数 if (this.paramsForm.paramsList) { - this.paramsForm.paramsList.forEach((e) => { - e.equipId = this.formData.equipId; - e.gatewayId = this.formData.gatewayId; - e.cardId = cardId; - }); - await GatewayCardParamsApi.submitGatewayCardParams( - this.paramsForm.paramsList + this.refreshGatewayCardParams( + this.paramsForm.paramsList, + this.formData, + cardId ); } this.$modal.msgSuccess("新增成功"); @@ -416,6 +444,16 @@ export default { this.formLoading = false; } }, + async refreshGatewayCardParams(paramsList, formData, cardId) { + paramsList.forEach((e) => { + e.equipId = formData.equipId; + e.gatewayId = formData.gatewayId; + e.cardId = cardId; + }); + await GatewayCardParamsApi.submitGatewayCardParams( + this.paramsForm.paramsList + ); + }, /** 表单重置 */ reset() { this.formData = { From f5c12be04d304684735e4fdea6c240597c901dc9 Mon Sep 17 00:00:00 2001 From: zhangjunwen Date: Mon, 23 Sep 2024 17:03:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=BD=91=E5=85=B3=E7=BD=91=E5=8D=A1?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E8=83=BD=E5=A4=9F=E9=85=8D=E7=BD=AE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gatewayinfo/GatewayCardParamsMapper.java | 2 +- .../system/gatewayinfo/GatewayCardForm.vue | 2 -- imt-ui/src/views/system/gatewayinfo/index.vue | 32 +++++++++++++++++-- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayCardParamsMapper.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayCardParamsMapper.java index 6cfdccf..b8e3b8e 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayCardParamsMapper.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayCardParamsMapper.java @@ -35,7 +35,7 @@ public interface GatewayCardParamsMapper extends BaseMapperX selectList(String cardId) { return selectList(new LambdaQueryWrapperX() .eqIfPresent(GatewayCardParamsDO::getCardId, cardId) - .orderByAsc(GatewayCardParamsDO::getCreateTime) + .orderByAsc(GatewayCardParamsDO::getChannelName) ); } } \ No newline at end of file diff --git a/imt-ui/src/views/system/gatewayinfo/GatewayCardForm.vue b/imt-ui/src/views/system/gatewayinfo/GatewayCardForm.vue index 38b057c..49c4dc0 100644 --- a/imt-ui/src/views/system/gatewayinfo/GatewayCardForm.vue +++ b/imt-ui/src/views/system/gatewayinfo/GatewayCardForm.vue @@ -199,11 +199,9 @@ export default { components: {}, data() { const checkRepeatName = (rule, value, callback) => { - console.log("需要检查的字段:", value); const repeatName = this.paramsForm.paramsList.filter( (e) => e.channelName == value ); - console.log("结果:", repeatName); if (repeatName.length > 1) { callback(new Error("通道名称不允许重复")); } else { diff --git a/imt-ui/src/views/system/gatewayinfo/index.vue b/imt-ui/src/views/system/gatewayinfo/index.vue index 62f5964..9d52666 100644 --- a/imt-ui/src/views/system/gatewayinfo/index.vue +++ b/imt-ui/src/views/system/gatewayinfo/index.vue @@ -101,6 +101,8 @@ :data="list" :stripe="true" :show-overflow-tooltip="true" + :row-key="rowKey" + :expand-row-keys="expandRowKeys" @expand-change="tableExpandChange" > 采集卡信息修改 + 删除 @@ -366,6 +375,7 @@ export default { ], cardLoading: false, expandGateway: {}, + expandRowKeys: [], }; }, created() { @@ -374,14 +384,21 @@ export default { methods: { tableExpandChange(row, e) { if (e.length != 0) { - console.log("展开数据:", row); - console.log("展开数据e:", e); + // console.log("展开数据:", row); + // console.log("展开数据e:", e); + if (e.length == 2) { + e.shift(); + } this.expandGateway = row; this.cardLoading = true; //加载该网关下的采集卡 this.getCardList(row.gatewayId); + this.expandRowKeys = e.map((item) => item.gatewayId); } }, + rowKey(row) { + return row.gatewayId; + }, async getCardList(id) { try { this.cardQueryParams.gatewayId = id; @@ -398,6 +415,17 @@ export default { openCardForm(id, row) { this.$refs["cardFormRef"].open(id, row, this.expandGateway); }, + async handleCardDelete(row) { + const cardId = row.cardId; + await this.$modal.confirm( + '是否确认删除机床网关信息编号为"' + cardId + '"的数据项?' + ); + try { + await GatewayCardInfoApi.deleteGatewayCardInfo(cardId); + await this.getList(); + this.$modal.msgSuccess("删除成功"); + } catch {} + }, /** 查询列表 */ async getList() { try {