use of io.choerodon.agile.infra.dto.ConfigCodeDTO in project agile-service by open-hand.
the class ConfigCodeServiceImpl method queryByTransformId.
@Override
public List<ConfigCodeVO> queryByTransformId(Long organizationId, Long transformId, String type) {
if (type == null) {
throw new CommonException("error.type.notNull");
}
if (!EnumUtil.contain(ConfigType.class, type)) {
throw new CommonException("error.status.type.illegal");
}
StateMachineConfigDraftDTO config = new StateMachineConfigDraftDTO();
config.setOrganizationId(organizationId);
config.setTransformId(transformId);
config.setType(type);
List<StateMachineConfigDraftDTO> configs = configDraftMapper.select(config);
List<String> configCodes = configs.stream().map(StateMachineConfigDraftDTO::getCode).collect(Collectors.toList());
// 过滤掉已经配置的,返回未配置的code
return queryByType(type).stream().filter(configCodeDTO -> !configCodes.contains(configCodeDTO.getCode())).collect(Collectors.toList());
}
use of io.choerodon.agile.infra.dto.ConfigCodeDTO in project agile-service by open-hand.
the class ConfigCodeServiceImpl method handlePropertyData.
@Override
public void handlePropertyData(PropertyData propertyData) {
String service = propertyData.getServiceName();
if (service == null) {
throw new CommonException("error.handlePropertyData.service.notNull");
}
// 先删除该服务的ConfigCode
ConfigCodeDTO delete = new ConfigCodeDTO();
delete.setService(propertyData.getServiceName());
configCodeMapper.delete(delete);
// 再插入扫描到的ConfigCode
List<ConfigCodeDTO> configCodeVOS = modelMapper.map(propertyData.getList(), new TypeToken<List<ConfigCodeDTO>>() {
}.getType());
configCodeVOS.forEach(configCode -> {
configCode.setService(service);
configCodeMapper.insert(modelMapper.map(configCode, ConfigCodeDTO.class));
logger.info("handlePropertyData service:{} insert code:{} successful", service, configCode.getCode());
});
logger.info("handlePropertyData load service:{} successful", service);
}
use of io.choerodon.agile.infra.dto.ConfigCodeDTO in project agile-service by open-hand.
the class ConfigCodeServiceImpl method queryByType.
@Override
public List<ConfigCodeVO> queryByType(String type) {
if (!EnumUtil.contain(ConfigType.class, type)) {
throw new CommonException("error.status.type.illegal");
}
ConfigCodeDTO configCode = new ConfigCodeDTO();
configCode.setType(type);
List<ConfigCodeDTO> configCodes = configCodeMapper.select(configCode);
return modelMapper.map(configCodes, new TypeToken<List<ConfigCodeVO>>() {
}.getType());
}
Aggregations