use of org.modelmapper.TypeToken in project agile-service by open-hand.
the class WikiRelationServiceImpl method create.
@Override
public void create(Long projectId, List<WikiRelationVO> wikiRelationVOList) {
List<WikiRelationDTO> wikiRelationDTOList = modelMapper.map(wikiRelationVOList, new TypeToken<List<WikiRelationDTO>>() {
}.getType());
if (wikiRelationDTOList != null && !wikiRelationDTOList.isEmpty()) {
for (WikiRelationDTO wikiRelationDTO : wikiRelationDTOList) {
if (!checkRepeat(wikiRelationDTO)) {
iWikiRelationService.createBase(wikiRelationDTO);
BaseFieldUtil.updateIssueLastUpdateInfo(wikiRelationDTO.getIssueId(), wikiRelationDTO.getProjectId());
}
}
}
}
use of org.modelmapper.TypeToken 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());
}
use of org.modelmapper.TypeToken in project agile-service by open-hand.
the class CustomChartServiceImpl method queryListByProject.
@Override
public List<CustomChartVO> queryListByProject(Long projectId) {
CustomChartDTO customChartRecord = new CustomChartDTO();
customChartRecord.setProjectId(projectId);
List<CustomChartDTO> customChartList = customChartMapper.select(customChartRecord);
if (CollectionUtils.isEmpty(customChartList)) {
return new ArrayList<>();
}
List<CustomChartVO> results = modelMapper.map(customChartList, new TypeToken<List<CustomChartVO>>() {
}.getType());
results.forEach(customChartVO -> {
if (customChartVO.getSearchJson() != null) {
customChartVO.setSearchJson(EncryptionUtils.handlerPersonFilterJson(customChartVO.getSearchJson(), true));
}
});
return results;
}
use of org.modelmapper.TypeToken in project agile-service by open-hand.
the class StateMachineSchemeServiceImpl method querySchemeWithConfigById.
@Override
public StateMachineSchemeVO querySchemeWithConfigById(Boolean isDraft, Long organizationId, Long schemeId, Long projectId) {
StateMachineSchemeDTO scheme = schemeMapper.selectByPrimaryKey(schemeId);
if (scheme == null) {
throw new CommonException("error.stateMachineScheme.notFound");
}
StateMachineSchemeVO schemeVO = modelMapper.map(scheme, StateMachineSchemeVO.class);
// 处理配置信息
List<StatusMachineSchemeConfigVO> configs = configService.queryBySchemeId(isDraft, organizationId, schemeId);
Map<Long, List<IssueTypeDTO>> map = new HashMap<>(configs.size());
// 取默认配置到第一个
Long defaultStateMachineId = null;
for (StatusMachineSchemeConfigVO config : configs) {
List<IssueTypeDTO> issueTypes = map.get(config.getStateMachineId());
if (issueTypes == null) {
issueTypes = new ArrayList<>();
}
IssueTypeDTO issueType;
if (!config.getDefault()) {
issueType = issueTypeMapper.selectWithAlias(config.getIssueTypeId(), projectId);
} else {
// 若为默认配置,则匹配的是所有为分配的问题类型
issueType = new IssueTypeDTO();
issueType.setName(WITHOUT_CONFIG_ISSUE_TYPE_NAME);
issueType.setIcon(WITHOUT_CONFIG_ISSUE_TYPE_ICON);
issueType.setColour(WITHOUT_CONFIG_ISSUE_TYPE_COLOUR);
defaultStateMachineId = config.getStateMachineId();
}
issueTypes.add(issueType);
map.put(config.getStateMachineId(), issueTypes);
}
List<StateMachineSchemeConfigViewVO> viewVOS = new ArrayList<>();
// 处理默认配置
viewVOS.add(handleDefaultConfig(organizationId, defaultStateMachineId, map));
for (Map.Entry<Long, List<IssueTypeDTO>> entry : map.entrySet()) {
Long stateMachineId = entry.getKey();
List<IssueTypeDTO> issueTypes = entry.getValue();
StatusMachineVO statusMachineVO = stateMachineService.queryStateMachineById(organizationId, stateMachineId);
StateMachineSchemeConfigViewVO viewVO = new StateMachineSchemeConfigViewVO();
viewVO.setStatusMachineVO(statusMachineVO);
List<IssueTypeVO> issueTypeVOS = modelMapper.map(issueTypes, new TypeToken<List<IssueTypeVO>>() {
}.getType());
viewVO.setIssueTypeVOS(issueTypeVOS);
viewVOS.add(viewVO);
}
schemeVO.setViewVOS(viewVOS);
AgilePluginService agilePluginService = SpringBeanUtil.getExpandBean(AgilePluginService.class);
if (agilePluginService != null) {
agilePluginService.addApplyTypesToStateMachine(schemeVO, schemeId);
}
return schemeVO;
}
use of org.modelmapper.TypeToken in project agile-service by open-hand.
the class LookupValueServiceImpl method queryLookupValueByCode.
@Override
public LookupTypeWithValuesVO queryLookupValueByCode(String typeCode, Long projectId) {
LookupTypeWithValuesDTO typeWithValues = lookupValueMapper.queryLookupValueByCode(typeCode);
if (LookupType.CONTEXT.equals(typeCode) && !ObjectUtils.isEmpty(projectId)) {
List<LookupValueDTO> backlogs = filterBacklog(projectId, typeWithValues);
List<LookupValueDTO> lookupValues = filterProjectType(projectId, typeWithValues);
lookupValues.addAll(backlogs);
typeWithValues.setLookupValues(lookupValues);
}
LookupTypeWithValuesVO result = modelMapper.map(typeWithValues, new TypeToken<LookupTypeWithValuesVO>() {
}.getType());
result.setLookupValues(modelMapper.map(typeWithValues.getLookupValues(), new TypeToken<List<LookupValueVO>>() {
}.getType()));
return result;
}
Aggregations