FIX Data truncation: Data too long for column 'tp_id' at row (#738) (#804)

* add BeanUtilTest test case

* add BeanUtilTest test case

* add BeanUtilTest test case

* add ClassUtilTest test case

* add ConfigExecutorTest test case

* Revert "add ConfigExecutorTest test case"

This reverts commit ffc00ff4

* add ConfigExecutorTest test case

* add EnvUtilTest test case

* add ConfigExecutorTest test case

* add Md5ConfigUtilTest test case

* Revert "add Md5ConfigUtilTest test case"

This reverts commit ee949adc

* add Md5ConfigUtilTest test case

* Revert "add Md5ConfigUtilTest test case"

This reverts commit ed638916

* add Md5ConfigUtilTest test case

* FIX Data truncation: Data too long for column 'tp_id' at row (#738)

* FIX Data truncation: Data too long for column 'tp_id' at row (#738)
pull/806/head
Gdk666 2 years ago committed by GitHub
parent 0f358a9b77
commit 2283b4a50d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -68,6 +68,23 @@ public class ConfigCacheService {
return Objects.equals(contentMd5, md5);
}
/**
* check TpId.
*
* @param groupKey
* @param tpId
* @param clientIdentify
* @return
*/
public static boolean checkTpId(String groupKey, String tpId, String clientIdentify) {
Map<String, CacheItem> cacheItemMap = Optional.ofNullable(CLIENT_CONFIG_CACHE.get(groupKey)).orElse(new HashMap<>());
CacheItem cacheItem;
if (CollectionUtil.isNotEmpty(cacheItemMap) && (cacheItem = cacheItemMap.get(clientIdentify)) != null) {
return Objects.equals(tpId, cacheItem.configAllInfo.getTpId());
}
return Boolean.FALSE;
}
/**
* Get Md5.
*

@ -32,6 +32,7 @@ import cn.hippo4j.config.model.biz.monitor.MonitorActiveRespDTO;
import cn.hippo4j.config.model.biz.monitor.MonitorQueryReqDTO;
import cn.hippo4j.config.model.biz.monitor.MonitorRespDTO;
import cn.hippo4j.config.monitor.QueryMonitorExecuteChoose;
import cn.hippo4j.config.service.ConfigCacheService;
import cn.hippo4j.config.service.biz.HisRunDataService;
import cn.hippo4j.common.toolkit.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -150,11 +151,14 @@ public class HisRunDataServiceImpl extends ServiceImpl<HisRunDataMapper, HisRunD
runtimeMessages.forEach(each -> {
HisRunDataInfo hisRunDataInfo = BeanUtil.convert(each, HisRunDataInfo.class);
String[] parseKey = GroupKey.parseKey(each.getGroupKey());
hisRunDataInfo.setTpId(parseKey[0]);
hisRunDataInfo.setItemId(parseKey[1]);
hisRunDataInfo.setTenantId(parseKey[2]);
hisRunDataInfo.setInstanceId(parseKey[3]);
hisRunDataInfos.add(hisRunDataInfo);
boolean checkFlag = ConfigCacheService.checkTpId(each.getGroupKey(), parseKey[0], parseKey[3]);
if (checkFlag) {
hisRunDataInfo.setTpId(parseKey[0]);
hisRunDataInfo.setItemId(parseKey[1]);
hisRunDataInfo.setTenantId(parseKey[2]);
hisRunDataInfo.setInstanceId(parseKey[3]);
hisRunDataInfos.add(hisRunDataInfo);
}
});
this.saveBatch(hisRunDataInfos);
}

Loading…
Cancel
Save