网关网卡参数能够配置功能更新
This commit is contained in:
parent
cb9f7bae8b
commit
8584e5eb42
@ -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 客户端创建完成##############");
|
||||
|
@ -25,7 +25,7 @@ public interface GatewayCardInfoMapper extends BaseMapperX<GatewayCardInfoDO> {
|
||||
.eqIfPresent(GatewayCardInfoDO::getCardName, reqVO.getCardName())
|
||||
.eqIfPresent(GatewayCardInfoDO::getCardTableMapping, reqVO.getCardTableMapping())
|
||||
.eqIfPresent(GatewayCardInfoDO::getMsgType, reqVO.getMsgType())
|
||||
.orderByDesc(GatewayCardInfoDO::getCardId));
|
||||
.orderByAsc(GatewayCardInfoDO::getCreateTime));
|
||||
}
|
||||
|
||||
}
|
@ -27,4 +27,15 @@ public interface GatewayCardParamsMapper extends BaseMapperX<GatewayCardParamsDO
|
||||
.orderByDesc(GatewayCardParamsDO::getChannelId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过采集卡id查询参数列表
|
||||
* @param cardId 采集卡id
|
||||
* @return 参数列表
|
||||
*/
|
||||
default List<GatewayCardParamsDO> selectList(String cardId) {
|
||||
return selectList(new LambdaQueryWrapperX<GatewayCardParamsDO>()
|
||||
.eqIfPresent(GatewayCardParamsDO::getCardId, cardId)
|
||||
.orderByAsc(GatewayCardParamsDO::getCreateTime)
|
||||
);
|
||||
}
|
||||
}
|
@ -99,7 +99,7 @@ public class GatewayCardParamsServiceImpl implements GatewayCardParamsService {
|
||||
*/
|
||||
@Override
|
||||
public List<GatewayCardParamsDO> getGatewayCardParamsByCardId(String cardId){
|
||||
return gatewayCardParamsMapper.selectList("cardId",cardId);
|
||||
return gatewayCardParamsMapper.selectList(cardId);
|
||||
}
|
||||
|
||||
}
|
@ -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",
|
||||
});
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ export default {
|
||||
mobile: "",
|
||||
mobileCode: "",
|
||||
rememberMe: false,
|
||||
tenantName: "芋道源码",
|
||||
tenantName: "浪潮智能生产",
|
||||
},
|
||||
scene: 21,
|
||||
|
||||
|
@ -93,12 +93,6 @@
|
||||
</el-col>
|
||||
</el-form>
|
||||
<div class="add-table">
|
||||
<el-button
|
||||
class="mb10"
|
||||
size="mini"
|
||||
type="primary"
|
||||
@click="addTableRow"
|
||||
>新 增</el-button>
|
||||
<el-form
|
||||
:model="paramsForm"
|
||||
ref="paramsForm"
|
||||
@ -174,6 +168,13 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
<div style="margin-top:10px">
|
||||
<el-button
|
||||
class="mb10"
|
||||
type="info"
|
||||
@click="addTableRow"
|
||||
>新增参数行</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
slot="footer"
|
||||
@ -197,6 +198,18 @@ export default {
|
||||
name: "GatewayCardInfoForm",
|
||||
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 {
|
||||
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 = {
|
||||
|
Loading…
Reference in New Issue
Block a user