private HashMap<String, Long> runProductTypeQuery(Date date1, Integer productTypeId){
long DIFF, TIME = System.currentTimeMillis(), START_TIME = System.currentTimeMillis();
Query baseQuery = em.createQuery(BASE_TYPE_QUERY);
Calendar cal = Calendar.getInstance();
HashMap<String, Long> result = new HashMap<String, Long>();
{
cal.setTime(date1);
int dayMin = cal.getActualMinimum(Calendar.DAY_OF_MONTH);
int dayMax = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
cal.set(Calendar.DAY_OF_MONTH, dayMin);
Parameter<Date> p1 = baseQuery.getParameter("oldStartDate", Date.class);
baseQuery.setParameter(p1, cal.getTime());
cal.set(Calendar.DAY_OF_MONTH, dayMax);
Parameter<Date> p2 = baseQuery.getParameter("oldEndDate", Date.class);
baseQuery.setParameter(p2, cal.getTime());
Parameter<Integer> p3 = baseQuery.getParameter("productTypeId", Integer.class);
baseQuery.setParameter(p3, productTypeId);
List<Object[]> resultList = baseQuery.getResultList();
DIFF = (System.currentTimeMillis() - TIME);
System.out.println(" Q TIME = "+DIFF+"ms");
for (int i=0; i < resultList.size(); i++){
Object o[] = resultList.get(i);
result.put((String)o[1],(Long)o[0]);
}
}
return result;
}
DailySalesHeatMapFacadeREST.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:marathonv5
作者:
评论列表
文章目录