网关、采集卡和参数租户添加与新增删除刷新功能修改
This commit is contained in:
parent
2a8bff7478
commit
cfbec64bab
@ -49,4 +49,6 @@ public class GatewayInfoSaveReqVO {
|
||||
|
||||
@Schema(description = "机床网关编号")
|
||||
private String gatewayCode;
|
||||
|
||||
private Integer tenantId;
|
||||
}
|
||||
|
@ -56,4 +56,8 @@ public class GatewayCardInfoDO extends BaseDO {
|
||||
*/
|
||||
private String msgType;
|
||||
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
private Long tenantId;
|
||||
}
|
@ -52,4 +52,8 @@ public class GatewayCardParamsDO extends BaseDO {
|
||||
*/
|
||||
private String paramMappingName;
|
||||
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
private Long tenantId;
|
||||
}
|
@ -78,4 +78,8 @@ public class GatewayInfoDO extends BaseDO {
|
||||
*/
|
||||
private String gatewayCode;
|
||||
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
private Long tenantId;
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
package com.inspur.module.system.service.gatewayinfo;
|
||||
|
||||
import com.inspur.framework.common.util.string.StrUtils;
|
||||
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
|
||||
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardParamsDO;
|
||||
import com.inspur.module.system.dal.mysql.gatewayinfo.GatewayCardParamsMapper;
|
||||
import com.inspur.module.system.service.equip.EquipInfoService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
@ -37,10 +40,18 @@ public class GatewayCardInfoServiceImpl implements GatewayCardInfoService {
|
||||
@Resource
|
||||
private GatewayCardParamsMapper gatewayCardParamsMapper;
|
||||
|
||||
@Resource
|
||||
private EquipInfoService equipInfoService;
|
||||
|
||||
@Override
|
||||
public String createGatewayCardInfo(GatewayCardInfoSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
GatewayCardInfoDO gatewayCardInfo = BeanUtils.toBean(createReqVO, GatewayCardInfoDO.class);
|
||||
if(Objects.nonNull(gatewayCardInfo.getEquipId())){
|
||||
EquipInfoDO equipInfo = equipInfoService.getEquipInfo(gatewayCardInfo.getEquipId());
|
||||
Optional<Long> tenantIdOptional = Optional.ofNullable(equipInfo.getTenantId());
|
||||
tenantIdOptional.ifPresent(gatewayCardInfo::setTenantId);
|
||||
}
|
||||
gatewayCardInfoMapper.insert(gatewayCardInfo);
|
||||
// 返回
|
||||
return gatewayCardInfo.getGatewayId();
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.inspur.module.system.service.gatewayinfo;
|
||||
|
||||
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
|
||||
import com.inspur.module.system.service.equip.EquipInfoService;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
@ -8,6 +10,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.inspur.module.system.controller.admin.gatewayinfo.vo.*;
|
||||
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardParamsDO;
|
||||
@ -35,10 +38,18 @@ public class GatewayCardParamsServiceImpl implements GatewayCardParamsService {
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Resource
|
||||
private EquipInfoService equipInfoService;
|
||||
|
||||
@Override
|
||||
public String createGatewayCardParams(GatewayCardParamsSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
GatewayCardParamsDO gatewayCardParams = BeanUtils.toBean(createReqVO, GatewayCardParamsDO.class);
|
||||
if(Objects.nonNull(gatewayCardParams.getEquipId())){
|
||||
EquipInfoDO equipInfo = equipInfoService.getEquipInfo(gatewayCardParams.getEquipId());
|
||||
Optional<Long> tenantIdOptional = Optional.ofNullable(equipInfo.getTenantId());
|
||||
tenantIdOptional.ifPresent(gatewayCardParams::setTenantId);
|
||||
}
|
||||
gatewayCardParamsMapper.insert(gatewayCardParams);
|
||||
// 返回
|
||||
return gatewayCardParams.getChannelId();
|
||||
@ -53,10 +64,16 @@ public class GatewayCardParamsServiceImpl implements GatewayCardParamsService {
|
||||
return true;
|
||||
}
|
||||
String gatewayId = paramsList.get(0).getGatewayId();
|
||||
String equipId = paramsList.get(0).getEquipId();
|
||||
if(Boolean.TRUE.equals(stringRedisTemplate.hasKey("cardmapping_" + gatewayId))){
|
||||
stringRedisTemplate.delete("cardmapping_" + gatewayId);
|
||||
}
|
||||
List<GatewayCardParamsDO> gatewayCardParamsList = BeanUtils.toBean(paramsList, GatewayCardParamsDO.class);
|
||||
if(Objects.nonNull(equipId)){
|
||||
EquipInfoDO equipInfo = equipInfoService.getEquipInfo(equipId);
|
||||
Optional<Long> tenantIdOptional = Optional.ofNullable(equipInfo.getTenantId());
|
||||
gatewayCardParamsList = gatewayCardParamsList.stream().peek(cardParamInfo -> tenantIdOptional.ifPresent(cardParamInfo::setTenantId)).collect(Collectors.toList());
|
||||
}
|
||||
return gatewayCardParamsMapper.insertBatch(gatewayCardParamsList);
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,11 @@ package com.inspur.module.system.service.gatewayinfo;
|
||||
|
||||
import com.inspur.framework.common.util.json.JsonUtils;
|
||||
import com.inspur.framework.tenant.core.aop.TenantIgnore;
|
||||
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
|
||||
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardInfoDO;
|
||||
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardParamsDO;
|
||||
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDetailsDTO;
|
||||
import com.inspur.module.system.service.equip.EquipInfoService;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -43,6 +45,9 @@ public class GatewayInfoServiceImpl implements GatewayInfoService {
|
||||
@Resource
|
||||
private GatewayCardParamsService gatewayCardParamsService;
|
||||
|
||||
@Resource
|
||||
private EquipInfoService equipInfoService;
|
||||
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@ -61,6 +66,11 @@ public class GatewayInfoServiceImpl implements GatewayInfoService {
|
||||
createReqVO.setStatus(0);//默认正常
|
||||
// 插入
|
||||
GatewayInfoDO gatewayInfo = BeanUtils.toBean(createReqVO, GatewayInfoDO.class);
|
||||
if(Objects.nonNull(gatewayInfo.getEquipId())){
|
||||
EquipInfoDO equipInfo = equipInfoService.getEquipInfo(gatewayInfo.getEquipId());
|
||||
Optional<Long> tenantIdOptional = Optional.ofNullable(equipInfo.getTenantId());
|
||||
tenantIdOptional.ifPresent(gatewayInfo::setTenantId);
|
||||
}
|
||||
gatewayInfoMapper.insert(gatewayInfo);
|
||||
// 返回
|
||||
return gatewayInfo.getGatewayId();
|
||||
|
@ -376,6 +376,7 @@ export default {
|
||||
cardLoading: false,
|
||||
expandGateway: {},
|
||||
expandRowKeys: [],
|
||||
selectedGatewayId: null,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@ -401,7 +402,12 @@ export default {
|
||||
},
|
||||
async getCardList(id) {
|
||||
try {
|
||||
this.cardQueryParams.gatewayId = id;
|
||||
if (id) {
|
||||
this.cardQueryParams.gatewayId = id;
|
||||
} else {
|
||||
this.cardQueryParams.gatewayId = this.selectedGatewayId;
|
||||
}
|
||||
|
||||
this.cardLoading = true;
|
||||
const res = await GatewayCardInfoApi.getGatewayCardInfoPage(
|
||||
this.cardQueryParams
|
||||
@ -413,6 +419,7 @@ export default {
|
||||
}
|
||||
},
|
||||
openCardForm(id, row) {
|
||||
this.selectedGatewayId = row.gatewayId;
|
||||
this.$refs["cardFormRef"].open(id, row, this.expandGateway);
|
||||
},
|
||||
async handleCardDelete(row) {
|
||||
@ -422,7 +429,7 @@ export default {
|
||||
);
|
||||
try {
|
||||
await GatewayCardInfoApi.deleteGatewayCardInfo(cardId);
|
||||
await this.getList();
|
||||
await this.getCardList(row.gatewayId);
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
} catch {}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user