package com.cpic.cmp.admin.repository.reportKpi;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.cpic.caf.core.repository.jpa.BaseHibernate4QueryDao;
import com.cpic.cmp.admin.entity.ReportKpi;
import com.cpic.cmp.admin.util.JsonUtil;
@Service
public class ReportKpiRepositoryImpl <T extends ReportKpi> extends BaseHibernate4QueryDao<ReportKpi>
implements ReportKpiDAOCustom<ReportKpi> {
/**
* 已经处理成对象模型的列表
*/
@Override
public List<?> findAllBasicStaticis(Date startDate, Date endDate,int type ) {
StringBuilder sb = new StringBuilder();
sb.append("SELECT CASE WHEN TB1.statTime1 IS NULL THEN TB2.statTime2 ELSE TB1.statTime1 END AS statTime, CASE WHEN TB1.regCnt IS NULL THEN 0 ELSE TB1.regCnt END AS regCnt, CASE WHEN TB1.certCnt IS NULL THEN 0 ELSE TB1.certCnt END AS certCnt, CASE WHEN TB2.startCnt IS NULL THEN 0 ELSE TB2.startCnt END AS startCnt, CASE WHEN TB2.uvCnt IS NULL THEN 0 ELSE TB2.uvCnt END AS uvCnt FROM (SELECT CASE WHEN T1.regTime IS NULL THEN T2.certTime ELSE T1.regTime END AS statTime1, CASE WHEN T1.regCnt IS NULL THEN 0 ELSE T1.regCnt END AS regCnt, CASE WHEN T2.certCnt IS NULL THEN 0 ELSE T2.certCnt END AS certCnt FROM (SELECT TO_CHAR(u.REGISTRATION_TIME, 'yyyy/mm/dd') AS regTime,COUNT(ID) AS regCnt FROM T_USER_INFO u WHERE u.REGISTRATION_TIME >= :startDate AND u.REGISTRATION_TIME < :endDate GROUP BY TO_CHAR(u.REGISTRATION_TIME, 'yyyy/mm/dd') ORDER BY TO_CHAR(u.REGISTRATION_TIME, 'yyyy/mm/dd') desc) T1 FULL JOIN (SELECT TO_CHAR(u.REAL_NAME_TIME, 'yyyy/mm/dd') AS certTime,COUNT(ID) AS certCnt FROM T_USER_INFO u WHERE u.CERT_FLAG = '1' AND u.REAL_NAME_TIME >= :startDate AND u.REAL_NAME_TIME < :endDate GROUP BY TO_CHAR(u.REAL_NAME_TIME, 'yyyy/mm/dd') ORDER BY TO_CHAR(u.REAL_NAME_TIME, 'yyyy/mm/dd') desc) T2 ON T1.regTime = T2.certTime ORDER BY statTime1 desc) TB1 FULL JOIN (SELECT CASE WHEN T3.startTime IS NULL THEN T4.uvTime ELSE T3.startTime END AS statTime2, CASE WHEN T3.startCnt IS NULL THEN 0 ELSE T3.startCnt END AS startCnt, CASE WHEN T4.uvCnt IS NULL THEN 0 ELSE T4.uvCnt END AS uvCnt FROM (SELECT TO_CHAR(s.DATE_TIME, 'yyyy/mm/dd') AS startTime,COUNT(ID) AS startCnt FROM T_APP_STATISTICS s WHERE s.DATE_TIME >= :startDate AND s.DATE_TIME < :endDate GROUP BY TO_CHAR(s.DATE_TIME, 'yyyy/mm/dd') ORDER BY TO_CHAR(s.DATE_TIME, 'yyyy/mm/dd') desc) T3 FULL JOIN (SELECT uvTime,COUNT(uvCnt) AS uvCnt FROM (SELECT TO_CHAR(s.DATE_TIME, 'yyyy/mm/dd') AS uvTime,COUNT(DISTINCT DEVICE_ID) AS uvCnt FROM T_APP_STATISTICS s WHERE s.DATE_TIME >= :startDate AND s.DATE_TIME < :endDate GROUP BY TO_CHAR(s.DATE_TIME, 'yyyy/mm/dd'),s.DEVICE_ID ORDER BY TO_CHAR(s.DATE_TIME, 'yyyy/mm/dd')) GROUP BY uvTime ORDER BY uvTime desc) T4 ON T3.startTime = T4.uvTime ORDER BY statTime2 desc) TB2 ON TB1.statTime1 = TB2.statTime2 ORDER BY statTime desc");
Map<String, Object> conditionMap = new HashMap<String, Object>();
conditionMap.put("startDate", startDate);
conditionMap.put("endDate", endDate);
System.err.println(sb.toString());
List<?> retval = (List<?>) this.findResutlObjectsBySql(sb.toString(), conditionMap);
List<ReportKpi> list = new ArrayList<ReportKpi>();
if (1==type) {
return retval;
}
for (int i = 0; i < retval.size(); i++) {
ReportKpi entity = new ReportKpi();
Object[] obj = (Object[]) retval.get(i);
entity.setAppOpen(((BigDecimal) obj[3]).longValue());
entity.setAppUV(((BigDecimal) obj[4]).longValue());
entity.setKpiType("0");
entity.setRealNames(((BigDecimal) obj[2]).longValue() );
entity.setRegisters(((BigDecimal) obj[1]).longValue());
entity.setDateLine((String) obj[0]);
list.add(entity);
}
try {
System.out.println(JsonUtil.objectToJsonString(list));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
/**
*没有处理的数组对象列表
*/
@Override
public List<Object[]> findAllBasicObjects(Date startDate, Date endDate) {
// TODO Auto-generated method stub
StringBuilder sb = new StringBuilder();
sb.append("SELECT CASE WHEN T1.regTime IS NULL THEN T2.certTime ELSE T1.regTime END AS statTime,CASE WHEN T1.regCnt IS NULL THEN 0 ELSE T1.regCnt END AS regCnt,CASE WHEN T2.certCnt IS NULL THEN 0 ELSE T2.certCnt END AS certCnt FROM(SELECT TO_CHAR(u.REGISTRATION_TIME, 'yyyy/mm/dd') AS regTime,COUNT(ID) AS regCnt FROM T_USER_INFO u WHERE u.REGISTRATION_TIME >=:startDate ") ;
sb.append(" AND u.REGISTRATION_TIME < :endDate ");
sb.append("GROUP BY TO_CHAR(u.REGISTRATION_TIME, 'yyyy/mm/dd') ORDER BY TO_CHAR(u.REGISTRATION_TIME, 'yyyy/mm/dd')) T1 FULL JOIN (SELECT TO_CHAR(u.REAL_NAME_TIME, 'yyyy/mm/dd') AS certTime,COUNT(ID) AS certCnt FROM T_USER_INFO u WHERE u.CERT_FLAG = '1' AND u.REAL_NAME_TIME >=:startDate ");
sb.append("AND u.REAL_NAME_TIME < :endDate ");
sb.append("GROUP BY TO_CHAR(u.REAL_NAME_TIME, 'yyyy/mm/dd') ORDER BY TO_CHAR(u.REAL_NAME_TIME, 'yyyy/mm/dd')) T2 ON T1.regTime = T2.certTime ORDER BY statTime");
Map<String, Object> conditionMap = new HashMap<String, Object>();
conditionMap.put("startDate", startDate);
conditionMap.put("endDate", endDate);
System.err.println(sb.toString());
@SuppressWarnings("unchecked")
List<Object[]> retval = (List<Object[]>) this.findResutlObjectsBySql(sb.toString(), conditionMap);
return retval;
}
@Override
public List<?> findBasticStaticisMounth(int tolmonths,int type ) {
Map<String, Object> conditionMap = new HashMap<String, Object>();
conditionMap.put("tolmonths", tolmonths);
// String sql = "SELECT T.statTime , T.regCnt , T.certCnt FROM (SELECT CASE WHEN T1.regTime IS NULL THEN T2.certTime ELSE T1.regTime END AS statTime,CASE WHEN T1.regCnt IS NULL THEN 0 ELSE T1.regCnt END AS regCnt,CASE WHEN T2.certCnt IS NULL THEN 0 ELSE T2.certCnt END AS certCnt FROM (SELECT TO_CHAR(u.CREATE_TIME, 'yyyy/mm') AS regTime,COUNT(ID) AS regCnt FROM T_USER_INFO u WHERE u.CREATE_TIME >= (SELECT TRUNC(ADD_MONTHS(SYSDATE, -:tolmonths), 'month') FROM DUAL) AND u.CREATE_TIME < (SELECT TRUNC(ADD_MONTHS(SYSDATE, 1), 'month') FROM DUAL) GROUP BY TO_CHAR(u.CREATE_TIME, 'yyyy/mm') ORDER BY TO_CHAR(u.CREATE_TIME, 'yyyy/mm/dd')) T1 FULL JOIN (SELECT TO_CHAR(u.CREATE_TIME, 'yyyy/mm') AS certTime,COUNT(ID) AS certCnt FROM T_USER_INFO u WHERE u.CERT_FLAG = '1' AND u.CREATE_TIME >= (SELECT TRUNC(ADD_MONTHS(SYSDATE, -:tolmonths), 'month') FROM DUAL) AND u.CREATE_TIME < (SELECT TRUNC(ADD_MONTHS(SYSDATE, 1), 'month') FROM DUAL) GROUP BY TO_CHAR(u.CREATE_TIME, 'yyyy/mm') ORDER BY TO_CHAR(u.CREATE_TIME, 'yyyy/mm/dd')) T2 ON T1.regTime = T2.certTime ORDER BY statTime) T";
String sql = "SELECT CASE WHEN TB1.statTime1 IS NULL THEN TB2.statTime2 ELSE TB1.statTime1 END AS statTime, CASE WHEN TB1.regCnt IS NULL THEN 0 ELSE TB1.regCnt END AS regCnt, CASE WHEN TB1.certCnt IS NULL THEN 0 ELSE TB1.certCnt END AS certCnt, CASE WHEN TB2.startCnt IS NULL THEN 0 ELSE TB2.startCnt END AS startCnt, CASE WHEN TB2.uvCnt IS NULL THEN 0 ELSE TB2.uvCnt END AS uvCnt FROM (SELECT CASE WHEN T1.regTime IS NULL THEN T2.certTime ELSE T1.regTime END AS statTime1, CASE WHEN T1.regCnt IS NULL THEN 0 ELSE T1.regCnt END AS regCnt, CASE WHEN T2.certCnt IS NULL THEN 0 ELSE T2.certCnt END AS certCnt FROM (SELECT TO_CHAR(u.REGISTRATION_TIME, 'yyyy/mm') AS regTime,COUNT(ID) AS regCnt FROM T_USER_INFO u WHERE u.REGISTRATION_TIME >= (SELECT TRUNC(ADD_MONTHS(SYSDATE, -:tolmonths), 'month') FROM DUAL) AND u.REGISTRATION_TIME < (SELECT TRUNC(ADD_MONTHS(SYSDATE, 1), 'month') FROM DUAL) GROUP BY TO_CHAR(u.REGISTRATION_TIME, 'yyyy/mm') ORDER BY TO_CHAR(u.REGISTRATION_TIME, 'yyyy/mm') desc) T1 FULL JOIN (SELECT TO_CHAR(u.REAL_NAME_TIME, 'yyyy/mm') AS certTime,COUNT(ID) AS certCnt FROM T_USER_INFO u WHERE u.CERT_FLAG = '1'
没有合适的资源?快使用搜索试试~ 我知道了~
项目开发(包含webService、springbatch、quartz等)
共1093个文件
class:279个
java:273个
jsp:138个
需积分: 9 14 下载量 141 浏览量
2017-07-24
16:48:50
上传
评论 2
收藏 4.76MB RAR 举报
温馨提示
技术参考
资源推荐
资源详情
资源评论
收起资源包目录
项目开发(包含webService、springbatch、quartz等) (1093个子文件)
ReportKpiRepositoryImpl.class 28KB
ModuleController.class 24KB
CmsController2.class 22KB
ModuleAuditController.class 20KB
AppCategoryController.class 19KB
AppAuditController.class 18KB
CmsController.class 17KB
AppController.class 17KB
UserFeeBackController.class 16KB
BasicDataStatisticController.class 15KB
ObjectUtils.class 15KB
AppDependController.class 12KB
AppModuleAuditServiceImpl.class 12KB
ListFilterFile.class 12KB
MessageQueryController.class 12KB
MessageController.class 12KB
ExcelUtil.class 12KB
MenuBiz.class 11KB
AppVerManController.class 10KB
AutoRegisterTaskLet.class 9KB
User.class 9KB
DataStatisticServiceImpl.class 9KB
LotteryInfoSendQuartz.class 9KB
UserFeeBackServiceImpl.class 9KB
SmsStubServiceImpl.class 9KB
AppModuleServiceImpl.class 8KB
StoreInfoTaskLet.class 8KB
LotteryRecordRepoImpl.class 8KB
NativeHttpClient.class 8KB
PushMessageController.class 8KB
AssembleUserInfoTaskLet.class 8KB
BlueToothInfoTaskLet.class 8KB
HttpClientUtil.class 8KB
AutoSendSmsXMLTaskLet.class 8KB
MppPushClient.class 8KB
ContentManagerSystemQuartz.class 7KB
AutoSendSmsTaskLet.class 7KB
LotteryCommServiceImpl.class 7KB
PushNoticeController.class 7KB
UserCtrl.class 7KB
AppAuditServiceImpl.class 7KB
MenuServiceImpl.class 7KB
ImageTextManage.class 7KB
AppModuleAuditEO.class 7KB
ImageTextManageEO.class 7KB
UserTaskInfoTaskLet.class 6KB
AppModuleEO.class 6KB
PushStoreInfoQuartz.class 6KB
MessagePushQuartz.class 6KB
UpdateOfficeQuartz.class 6KB
MenuCtrl.class 6KB
MessagePushTaskLet.class 6KB
AppDependServiceImpl.class 6KB
UserTaskInfoQuartz.class 6KB
UserRedisServiceImpl.class 6KB
RoleFunctionCtrl.class 6KB
AssembleUserInfoQuartz.class 6KB
PushStoreInfoTaskLet.class 5KB
AppModule.class 5KB
UserRoleCtrl.class 5KB
RoleFunctionOrgCtrl.class 5KB
RoleCtrl.class 5KB
AppModuleAudit.class 5KB
ImageTextManageRepository.class 5KB
BlueToothInfoQuartz.class 5KB
StoreInfoQuartz.class 5KB
AutoRegisterQuartz.class 5KB
Preconditions.class 5KB
UpdateDeviceQuartz.class 5KB
ContentManagerSystemTaskLet.class 5KB
AppEntityBean.class 5KB
AutoSendSmsQuartz.class 5KB
MessageEntity.class 5KB
UpdateDeviceTaskLet.class 4KB
ModuleTagModel.class 4KB
UserTaskInfoTaskLetTest.class 4KB
LotteryTaskInfoTaskLet.class 4KB
AppServiceImpl.class 4KB
LotteryServiceImpl.class 4KB
AutoSendSmsXMLQuartz.class 4KB
AppTagModel.class 4KB
PushControlQuartz.class 4KB
ImageTextManageServiceImpl.class 4KB
StoreInfo.class 4KB
AppVersion.class 4KB
App.class 4KB
MessgaPushRecodeServiceImpl.class 4KB
RegisteSmsRepositoryImpl.class 4KB
StoreInfoRecord.class 4KB
AppCategoryServiceImpl.class 4KB
LotteryCommController.class 4KB
LottertHitInfoCommEO.class 4KB
FileReGenerateController.class 4KB
StoreInfoEO.class 4KB
AppVerManServiceImpl.class 4KB
MessageServiceImpl.class 3KB
TaskUser.class 3KB
UserTaskRepositoryTest.class 3KB
UpdateOfficeTaskLet.class 3KB
PushUserInfo.class 3KB
共 1093 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
资源评论
jackie-cs
- 粉丝: 3
- 资源: 54
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功