|
|
@ -1,5 +1,7 @@
|
|
|
|
package com.docus.server.service.impl;
|
|
|
|
package com.docus.server.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.docus.core.util.ListUtils;
|
|
|
|
|
|
|
|
import com.docus.core.util.property.Setters;
|
|
|
|
import com.docus.infrastructure.redis.service.IdService;
|
|
|
|
import com.docus.infrastructure.redis.service.IdService;
|
|
|
|
import com.docus.infrastructure.web.request.SearchDTO;
|
|
|
|
import com.docus.infrastructure.web.request.SearchDTO;
|
|
|
|
import com.docus.infrastructure.web.response.PageResult;
|
|
|
|
import com.docus.infrastructure.web.response.PageResult;
|
|
|
@ -8,12 +10,18 @@ import com.docus.server.dto.scheduling.management.schcollectorconfig.AddSchColle
|
|
|
|
import com.docus.server.dto.scheduling.management.schcollectorconfig.DeleteSchCollectorConfigDTO;
|
|
|
|
import com.docus.server.dto.scheduling.management.schcollectorconfig.DeleteSchCollectorConfigDTO;
|
|
|
|
import com.docus.server.dto.scheduling.management.schcollectorconfig.EditSchCollectorConfigDTO;
|
|
|
|
import com.docus.server.dto.scheduling.management.schcollectorconfig.EditSchCollectorConfigDTO;
|
|
|
|
import com.docus.server.entity.scheduling.management.SchCollectorConfig;
|
|
|
|
import com.docus.server.entity.scheduling.management.SchCollectorConfig;
|
|
|
|
|
|
|
|
import com.docus.server.entity.scheduling.management.SchSystemParams;
|
|
|
|
|
|
|
|
import com.docus.server.enums.ConfigTypeEnum;
|
|
|
|
import com.docus.server.infrastructure.dao.ISchCollectorConfigDao;
|
|
|
|
import com.docus.server.infrastructure.dao.ISchCollectorConfigDao;
|
|
|
|
|
|
|
|
import com.docus.server.infrastructure.dao.ISchSystemParamsDao;
|
|
|
|
import com.docus.server.service.ISchCollectorConfigService;
|
|
|
|
import com.docus.server.service.ISchCollectorConfigService;
|
|
|
|
import com.docus.server.vo.scheduling.management.schcollectorconfig.SchCollectorConfigVO;
|
|
|
|
import com.docus.server.vo.scheduling.management.schcollectorconfig.SchCollectorConfigVO;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 采集器配置 服务实现类
|
|
|
|
* 采集器配置 服务实现类
|
|
|
@ -26,6 +34,8 @@ public class SchCollectorConfigServiceImpl implements ISchCollectorConfigService
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private ISchCollectorConfigDao iSchCollectorConfigDao;
|
|
|
|
private ISchCollectorConfigDao iSchCollectorConfigDao;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private ISchSystemParamsDao iSchSystemParamsDao;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private IdService idService;
|
|
|
|
private IdService idService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -47,7 +57,25 @@ public class SchCollectorConfigServiceImpl implements ISchCollectorConfigService
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public PageResult<SchCollectorConfigVO> search(SearchDTO searchDTO) {
|
|
|
|
public PageResult<SchCollectorConfigVO> search(SearchDTO searchDTO) {
|
|
|
|
return SchCollectorConfigConvert.INSTANCE.convertVO(iSchCollectorConfigDao.search(searchDTO));
|
|
|
|
|
|
|
|
|
|
|
|
PageResult<SchCollectorConfigVO> result = SchCollectorConfigConvert.INSTANCE.convertVO(iSchCollectorConfigDao.search(searchDTO));
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(result.getList())) {
|
|
|
|
|
|
|
|
return new PageResult<>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SchSystemParams> schSystemParams = iSchSystemParamsDao.findBy("paramValue", ListUtils.distinctSelect(result.getList(), SchCollectorConfigVO::getCollectorId));
|
|
|
|
|
|
|
|
Map<String, SchSystemParams> taskConfigRetryLogMap = ListUtils.toMap(schSystemParams, SchSystemParams::getParamValue);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Setters.<SchCollectorConfigVO>instance().list(result.getList()).cycleSetProperties(p -> {
|
|
|
|
|
|
|
|
String collectorId = String.valueOf(p.getCollectorId());
|
|
|
|
|
|
|
|
if (taskConfigRetryLogMap.containsKey(collectorId)) {
|
|
|
|
|
|
|
|
p.setCollectorName(taskConfigRetryLogMap.get(collectorId).getParamName());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
p.setCollectorName("公共");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -59,15 +87,18 @@ public class SchCollectorConfigServiceImpl implements ISchCollectorConfigService
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean add(AddSchCollectorConfigDTO addSchCollectorConfigDTO) {
|
|
|
|
public boolean add(AddSchCollectorConfigDTO addSchCollectorConfigDTO) {
|
|
|
|
|
|
|
|
|
|
|
|
String collectorCode = addSchCollectorConfigDTO.getCollectorCode();
|
|
|
|
Long collectorId = addSchCollectorConfigDTO.getCollectorId();
|
|
|
|
|
|
|
|
|
|
|
|
SchCollectorConfig schCollectorConfigDO = iSchCollectorConfigDao.findOneBy("collectorCode", collectorCode);
|
|
|
|
SchCollectorConfig schCollectorConfigDO = iSchCollectorConfigDao.findOneBy("collectorId", collectorId);
|
|
|
|
|
|
|
|
|
|
|
|
if (null == schCollectorConfigDO) {
|
|
|
|
if (null == schCollectorConfigDO) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SchCollectorConfig schCollectorConfig = SchCollectorConfigConvert.INSTANCE.convertDO(addSchCollectorConfigDTO);
|
|
|
|
SchCollectorConfig schCollectorConfig = SchCollectorConfigConvert.INSTANCE.convertDO(addSchCollectorConfigDTO);
|
|
|
|
schCollectorConfig.setId(idService.getDateSeq());
|
|
|
|
schCollectorConfig.setId(idService.getDateSeq());
|
|
|
|
|
|
|
|
if (addSchCollectorConfigDTO.getConfigType().equals(ConfigTypeEnum.PUBLIC_CONFIG)) {
|
|
|
|
|
|
|
|
schCollectorConfig.setCollectorId(0L); //共有类型
|
|
|
|
|
|
|
|
}
|
|
|
|
return iSchCollectorConfigDao.add(schCollectorConfig);
|
|
|
|
return iSchCollectorConfigDao.add(schCollectorConfig);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
@ -84,7 +115,8 @@ public class SchCollectorConfigServiceImpl implements ISchCollectorConfigService
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean edit(EditSchCollectorConfigDTO editSchCollectorConfigDTO) {
|
|
|
|
public boolean edit(EditSchCollectorConfigDTO editSchCollectorConfigDTO) {
|
|
|
|
SchCollectorConfig schCollectorConfig = SchCollectorConfigConvert.INSTANCE.convertDO(editSchCollectorConfigDTO);
|
|
|
|
SchCollectorConfig schCollectorConfig = iSchCollectorConfigDao.findById(editSchCollectorConfigDTO.getId());
|
|
|
|
|
|
|
|
schCollectorConfig.setConfigJson(editSchCollectorConfigDTO.getConfigJson());
|
|
|
|
return iSchCollectorConfigDao.edit(schCollectorConfig);
|
|
|
|
return iSchCollectorConfigDao.edit(schCollectorConfig);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|