use of io.choerodon.agile.infra.dto.CustomChartDTO in project agile-service by open-hand.
the class CustomChartServiceImpl method updateCustomChart.
@Override
public CustomChartVO updateCustomChart(Long projectId, Long customChartId, CustomChartUpdateVO customChartUpdate) {
CustomChartDTO customChartDTO = modelMapper.map(customChartUpdate, CustomChartDTO.class);
customChartDTO.setId(customChartId);
deleteCustomChartRedisById(projectId, customChartId);
if (customChartDTO.getAnalysisField() != null && customChartDTO.getAnalysisFieldPredefined() == null) {
throw new CommonException("error.customChart.analysisFieldPredefinedNotNull");
}
customChartDTO.setProjectId(projectId);
validAndSetJson(customChartDTO);
if (customChartMapper.updateByPrimaryKeySelective(customChartDTO) != 1) {
throw new CommonException("error.CustomChart.update");
}
return queryById(customChartId);
}
use of io.choerodon.agile.infra.dto.CustomChartDTO in project agile-service by open-hand.
the class CustomChartServiceImpl method validNameRepeat.
private boolean validNameRepeat(CustomChartDTO customChartDTO) {
CustomChartDTO customChartRecord = new CustomChartDTO();
customChartRecord.setName(customChartDTO.getName());
customChartRecord.setProjectId(customChartDTO.getProjectId());
List<CustomChartDTO> results = customChartMapper.select(customChartRecord);
if (CollectionUtils.isEmpty(results)) {
return false;
}
if (results.size() > (customChartDTO.getId() == null ? 0 : 1)) {
return true;
}
return !results.get(0).getId().equals(customChartDTO.getId());
}
use of io.choerodon.agile.infra.dto.CustomChartDTO in project agile-service by open-hand.
the class CustomChartServiceImpl method createCustomChart.
@Override
public CustomChartVO createCustomChart(Long projectId, CustomChartCreateVO customChartCreate) {
CustomChartDTO customChartDTO = modelMapper.map(customChartCreate, CustomChartDTO.class);
customChartDTO.setProjectId(projectId);
customChartDTO.setOrganizationId(ConvertUtil.getOrganizationId(projectId));
validAndSetJson(customChartDTO);
if (customChartMapper.insertSelective(customChartDTO) != 1) {
throw new CommonException("error.customChart.insert");
}
return queryById(customChartDTO.getId());
}
use of io.choerodon.agile.infra.dto.CustomChartDTO in project agile-service by open-hand.
the class CustomChartServiceImpl method deleteCustomChartRedisById.
private void deleteCustomChartRedisById(Long projectId, Long customChartId) {
CustomChartDTO customChart = queryCustomChartByProjectAndId(projectId, customChartId);
CustomChartSearchVO customChartSearchVO = customChartToDataSearch(customChart);
if (customChartSearchVO == null) {
return;
}
redisUtil.delete(CUSTOM_CHART + projectId + COLON + customChartSearchVO);
}
use of io.choerodon.agile.infra.dto.CustomChartDTO in project agile-service by open-hand.
the class CustomChartServiceImpl method checkName.
@Override
public Boolean checkName(Long projectId, String name) {
CustomChartDTO customChart = new CustomChartDTO();
customChart.setProjectId(projectId);
customChart.setName(name);
return validNameRepeat(customChart);
}
Aggregations