Feature: 对接前端控制台.

pull/10/head
chen.ma 3 years ago
parent 09aa3f2e53
commit ca42e2b522

@ -0,0 +1,29 @@
package com.github.dynamic.threadpool.config.model.biz.threadpool;
import lombok.Data;
/**
* ThreadPool del req dto.
*
* @author chen.ma
* @date 2021/11/11 21:40
*/
@Data
public class ThreadPoolDelReqDTO {
/**
* tenantId
*/
private String tenantId;
/**
* itemId
*/
private String itemId;
/**
* tpId
*/
private String tpId;
}

@ -9,9 +9,11 @@ import com.github.dynamic.threadpool.config.event.LocalDataChangeEvent;
import com.github.dynamic.threadpool.config.model.CacheItem;
import com.github.dynamic.threadpool.config.model.ConfigAllInfo;
import com.github.dynamic.threadpool.config.notify.NotifyCenter;
import com.github.dynamic.threadpool.config.toolkit.MapUtil;
import com.google.common.collect.Maps;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@ -82,6 +84,9 @@ public class ConfigCacheService {
CacheItem cache = makeSure(groupKey, ip);
if (cache.md5 == null || !cache.md5.equals(md5)) {
cache.md5 = md5;
String[] split = groupKey.split("\\+");
ConfigAllInfo config = configService.findConfigAllInfo(split[0], split[1], split[2]);
cache.configAllInfo = config;
cache.lastModifiedTs = System.currentTimeMillis();
NotifyCenter.publishEvent(new LocalDataChangeEvent(ip, groupKey));
}
@ -102,4 +107,11 @@ public class ConfigCacheService {
return tmp;
}
public static Map<String, CacheItem> getContent(String identification) {
List<String> identificationList = MapUtil.parseMapForFilter(CACHE, identification);
Map<String, CacheItem> returnStrCacheItemMap = Maps.newHashMap();
identificationList.forEach(each -> returnStrCacheItemMap.putAll(CACHE.get(each)));
return returnStrCacheItemMap;
}
}

@ -1,6 +1,7 @@
package com.github.dynamic.threadpool.config.service.biz;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.dynamic.threadpool.config.model.biz.threadpool.ThreadPoolDelReqDTO;
import com.github.dynamic.threadpool.config.model.biz.threadpool.ThreadPoolQueryReqDTO;
import com.github.dynamic.threadpool.config.model.biz.threadpool.ThreadPoolRespDTO;
import com.github.dynamic.threadpool.config.model.biz.threadpool.ThreadPoolSaveOrUpdateReqDTO;
@ -47,4 +48,11 @@ public interface ThreadPoolService {
*/
void saveOrUpdateThreadPoolConfig(String identify, ThreadPoolSaveOrUpdateReqDTO reqDTO);
/**
* Delete pool.
*
* @param reqDTO
*/
void deletePool(ThreadPoolDelReqDTO reqDTO);
}

@ -1,13 +1,13 @@
package com.github.dynamic.threadpool.config.service.biz.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.dynamic.threadpool.config.enums.DelEnum;
import com.github.dynamic.threadpool.config.mapper.ConfigInfoMapper;
import com.github.dynamic.threadpool.config.model.ConfigAllInfo;
import com.github.dynamic.threadpool.config.model.biz.threadpool.ThreadPoolDelReqDTO;
import com.github.dynamic.threadpool.config.model.biz.threadpool.ThreadPoolQueryReqDTO;
import com.github.dynamic.threadpool.config.model.biz.threadpool.ThreadPoolRespDTO;
import com.github.dynamic.threadpool.config.model.biz.threadpool.ThreadPoolSaveOrUpdateReqDTO;
@ -64,4 +64,14 @@ public class ThreadPoolServiceImpl implements ThreadPoolService {
configService.insertOrUpdate(identify, BeanUtil.convert(reqDTO, ConfigAllInfo.class));
}
@Override
public void deletePool(ThreadPoolDelReqDTO reqDTO) {
configInfoMapper.delete(
Wrappers.lambdaUpdate(ConfigAllInfo.class)
.eq(ConfigAllInfo::getTenantId, reqDTO.getTenantId())
.eq(ConfigAllInfo::getItemId, reqDTO.getItemId())
.eq(ConfigAllInfo::getTpId, reqDTO.getTpId())
);
}
}

Loading…
Cancel
Save