Search in sources :

Example 6 with CustomChartDTO

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());
}
Also used : CustomChartDTO(io.choerodon.agile.infra.dto.CustomChartDTO)

Example 7 with CustomChartDTO

use of io.choerodon.agile.infra.dto.CustomChartDTO 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;
}
Also used : CustomChartDTO(io.choerodon.agile.infra.dto.CustomChartDTO) TypeToken(org.modelmapper.TypeToken) CustomChartVO(io.choerodon.agile.api.vo.CustomChartVO) ArrayList(java.util.ArrayList)

Example 8 with CustomChartDTO

use of io.choerodon.agile.infra.dto.CustomChartDTO in project agile-service by open-hand.

the class CustomChartServiceImpl method queryCustomChartDetail.

@Override
public CustomChartVO queryCustomChartDetail(Long projectId, Long customChartId) {
    Long organizationId = ConvertUtil.getOrganizationId(projectId);
    CustomChartDTO customChart = queryCustomChartByProjectAndId(projectId, customChartId);
    if (customChart == null) {
        return null;
    }
    CustomChartSearchVO customChartSearchVO = customChartToDataSearch(customChart);
    CustomChartDataVO customChartData = reportService.queryCustomChartData(customChartSearchVO, projectId, organizationId);
    CustomChartVO result = modelMapper.map(customChart, CustomChartVO.class);
    result.setCustomChartData(customChartData);
    if (!StringUtils.isBlank(result.getSearchJson())) {
        result.setSearchJson(EncryptionUtils.handlerPersonFilterJson(result.getSearchJson(), true));
    }
    return result;
}
Also used : CustomChartDataVO(io.choerodon.agile.api.vo.report.CustomChartDataVO) CustomChartDTO(io.choerodon.agile.infra.dto.CustomChartDTO) CustomChartVO(io.choerodon.agile.api.vo.CustomChartVO) CustomChartSearchVO(io.choerodon.agile.api.vo.report.CustomChartSearchVO)

Example 9 with CustomChartDTO

use of io.choerodon.agile.infra.dto.CustomChartDTO in project agile-service by open-hand.

the class CustomChartServiceImpl method deleteCustomChartById.

@Override
public void deleteCustomChartById(Long customChartId, Long projectId) {
    deleteCustomChartRedisById(projectId, customChartId);
    CustomChartDTO customChartDTO = new CustomChartDTO();
    customChartDTO.setProjectId(projectId);
    customChartDTO.setId(customChartId);
    int isDelete = customChartMapper.delete(customChartDTO);
    if (isDelete != 1) {
        throw new CommonException("error.customChart.deleteById");
    }
}
Also used : CustomChartDTO(io.choerodon.agile.infra.dto.CustomChartDTO) CommonException(io.choerodon.core.exception.CommonException)

Aggregations

CustomChartDTO (io.choerodon.agile.infra.dto.CustomChartDTO)9 CommonException (io.choerodon.core.exception.CommonException)3 CustomChartVO (io.choerodon.agile.api.vo.CustomChartVO)2 CustomChartSearchVO (io.choerodon.agile.api.vo.report.CustomChartSearchVO)2 CustomChartDataVO (io.choerodon.agile.api.vo.report.CustomChartDataVO)1 ArrayList (java.util.ArrayList)1 TypeToken (org.modelmapper.TypeToken)1