Search in sources :

Example 1 with QcDataQueryMapperSet

use of com.netsteadfast.greenstep.po.hbm.QcDataQueryMapperSet in project bamboobsc by billchen198318.

the class DataQueryMapperLogicServiceImpl method deleteMapperSet.

private void deleteMapperSet(DataQueryMapperVO queryMapper) throws ServiceException, Exception {
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("mapperOid", queryMapper.getOid());
    List<QcDataQueryMapperSet> searchDatas = this.dataQueryMapperSetService.findListByParams(paramMap);
    for (QcDataQueryMapperSet mapperSet : searchDatas) {
        this.dataQueryMapperSetService.delete(mapperSet);
    }
}
Also used : HashMap(java.util.HashMap) QcDataQueryMapperSet(com.netsteadfast.greenstep.po.hbm.QcDataQueryMapperSet)

Example 2 with QcDataQueryMapperSet

use of com.netsteadfast.greenstep.po.hbm.QcDataQueryMapperSet in project bamboobsc by billchen198318.

the class ChartsDataUtils method getHighchartsSeriesData.

/*
	public static List<String> getHighchartsBarCategories(String dataQueryMapperSetOid, 
			List<Map<String, Object>> searchDatas) throws ServiceException, Exception {
		if (StringUtils.isBlank(dataQueryMapperSetOid)) {
			throw new Exception("Mapper config is required!");
		}
		List<String> data = new LinkedList<String>();
		if (null==searchDatas || searchDatas.size()<1) {
			return data;
		}
		DataQueryMapperSetVO mapperSet = new DataQueryMapperSetVO();
		mapperSet.setOid(dataQueryMapperSetOid);
		DefaultResult<DataQueryMapperSetVO> result = dataQueryMapperSetService.findObjectByOid(mapperSet);
		if (result.getValue()==null) {
			throw new ServiceException(result.getSystemMessage().getValue());
		}
		mapperSet = result.getValue();
		for (Map<String, Object> searchDataMap : searchDatas) {
			String label = (String)searchDataMap.get( mapperSet.getLabelField() );
			if (StringUtils.isBlank(label)) {
				throw new Exception("Mapper label field not found!");
			}
			data.add(label);
		}		
		return data;
	}
	*/
public static List<Map<String, Object>> getHighchartsSeriesData(String dataQueryMapperOid, List<String> categories, List<Map<String, Object>> searchDatas) throws ServiceException, Exception {
    if (StringUtils.isBlank(dataQueryMapperOid)) {
        throw new Exception("Mapper config is required!");
    }
    List<Map<String, Object>> data = new LinkedList<Map<String, Object>>();
    if (null == searchDatas || searchDatas.size() < 1 || null == categories || categories.size() < 1) {
        return data;
    }
    DataQueryMapperVO mapper = new DataQueryMapperVO();
    mapper.setOid(dataQueryMapperOid);
    DefaultResult<DataQueryMapperVO> result = dataQueryMapperService.findObjectByOid(mapper);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    mapper = result.getValue();
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("mapperOid", mapper.getOid());
    List<QcDataQueryMapperSet> mapperSets = dataQueryMapperSetService.findListByParams(paramMap);
    if (null == mapperSets || mapperSets.size() < 1) {
        throw new Exception("Mapper config is required!");
    }
    for (QcDataQueryMapperSet mapperSet : mapperSets) {
        List<Object> values = new LinkedList<Object>();
        Map<String, Object> item = new HashMap<String, Object>();
        item.put("name", mapperSet.getValueField());
        item.put("data", values);
        for (Map<String, Object> searchDataMap : searchDatas) {
            for (String categorie : categories) {
                String label = (String) searchDataMap.get(mapperSet.getLabelField());
                if (!categorie.equals(label)) {
                    continue;
                }
                Object value = searchDataMap.get(mapperSet.getValueField());
                if (value == null) {
                    value = new Integer(0);
                }
                if (!isChartsValue(value)) {
                    throw new Exception("Mapper value field must be numeric!");
                }
                values.add(value);
            }
        }
        data.add(item);
    }
    return data;
}
Also used : HashMap(java.util.HashMap) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) LinkedList(java.util.LinkedList) DataQueryMapperVO(com.netsteadfast.greenstep.vo.DataQueryMapperVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) QcDataQueryMapperSet(com.netsteadfast.greenstep.po.hbm.QcDataQueryMapperSet) HashMap(java.util.HashMap) Map(java.util.Map)

Example 3 with QcDataQueryMapperSet

use of com.netsteadfast.greenstep.po.hbm.QcDataQueryMapperSet in project bamboobsc by billchen198318.

the class ChartsDataUtils method getHighchartsSeriesCategories.

public static List<String> getHighchartsSeriesCategories(String dataQueryMapperOid, List<Map<String, Object>> searchDatas) throws ServiceException, Exception {
    if (StringUtils.isBlank(dataQueryMapperOid)) {
        throw new Exception("Mapper config is required!");
    }
    List<String> data = new LinkedList<String>();
    if (null == searchDatas || searchDatas.size() < 1) {
        return data;
    }
    DataQueryMapperVO mapper = new DataQueryMapperVO();
    mapper.setOid(dataQueryMapperOid);
    DefaultResult<DataQueryMapperVO> result = dataQueryMapperService.findObjectByOid(mapper);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    mapper = result.getValue();
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("mapperOid", mapper.getOid());
    List<QcDataQueryMapperSet> mapperSets = dataQueryMapperSetService.findListByParams(paramMap);
    if (null == mapperSets || mapperSets.size() < 1) {
        throw new Exception("Mapper config is required!");
    }
    for (QcDataQueryMapperSet mapperSet : mapperSets) {
        for (Map<String, Object> searchDataMap : searchDatas) {
            String label = (String) searchDataMap.get(mapperSet.getLabelField());
            if (StringUtils.isBlank(label)) {
                throw new Exception("Mapper label field not found!");
            }
            if (!data.contains(label)) {
                data.add(label);
            }
        }
    }
    return data;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) QcDataQueryMapperSet(com.netsteadfast.greenstep.po.hbm.QcDataQueryMapperSet) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) LinkedList(java.util.LinkedList) DataQueryMapperVO(com.netsteadfast.greenstep.vo.DataQueryMapperVO)

Example 4 with QcDataQueryMapperSet

use of com.netsteadfast.greenstep.po.hbm.QcDataQueryMapperSet in project bamboobsc by billchen198318.

the class DataQueryMapperSetServiceImpl method findForMap.

@Override
public Map<String, String> findForMap(boolean pleaseSelect, String dataQueryMapperOid) throws ServiceException, Exception {
    Map<String, String> dataMap = this.providedSelectZeroDataMap(pleaseSelect);
    if (super.isNoSelectId(dataQueryMapperOid)) {
        return dataMap;
    }
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("mapperOid", dataQueryMapperOid);
    List<QcDataQueryMapperSet> searchList = this.findListByParams(paramMap);
    for (QcDataQueryMapperSet entity : searchList) {
        dataMap.put(entity.getOid(), entity.getLabelField() + " - " + entity.getValueField());
    }
    return dataMap;
}
Also used : HashMap(java.util.HashMap) QcDataQueryMapperSet(com.netsteadfast.greenstep.po.hbm.QcDataQueryMapperSet)

Aggregations

QcDataQueryMapperSet (com.netsteadfast.greenstep.po.hbm.QcDataQueryMapperSet)4 HashMap (java.util.HashMap)4 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)2 DataQueryMapperVO (com.netsteadfast.greenstep.vo.DataQueryMapperVO)2 LinkedList (java.util.LinkedList)2 Map (java.util.Map)1