| | |
| | | param.put("cusId",cusId); |
| | | |
| | | sql.append(" select wfstate data_name,businesstype cate_id,count(id) num from workflow_base where wfstate in (1,2,3,4) "); |
| | | setWhereSql(sql,"createtime",selDate,statisType,param); |
| | | setWhereSql(sql,"to_date(createtime,'YYYYMMDDHH24MISS')",selDate,statisType,param); |
| | | sql.append(" and customer_id=:cusId group by wfstate,businesstype order by businesstype,wfstate"); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | Map<String,Map> dataSetMap = new HashMap(); |
| | |
| | | param.put("cusId",cusId); |
| | | |
| | | sql.append(" select wfstate data_name,businesstype cate_id,count(id) num from workflow_base where wfstate in (1,2,3,4) "); |
| | | setWhereSql(sql,"createtime",selDate,statisType,param); |
| | | setWhereSql(sql,"to_date(createtime,'YYYYMMDDHH24MISS')",selDate,statisType,param); |
| | | sql.append(" and customer_id=:cusId group by businesstype,wfstate "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | sql.setLength(0); |
| | | sql.append(" SELECT businesstype cate_id,count(id) num FROM workflow_base WHERE customer_id = :cusId "); |
| | | setWhereSql(sql,"createtime",selDate,statisType,param); |
| | | setWhereSql(sql,"to_date(createtime,'YYYYMMDDHH24MISS')",selDate,statisType,param); |
| | | sql.append(" group by businesstype "); |
| | | List<Map> extendList = baseDao.queryForList(sql.toString(),param); |
| | | |
| | |
| | | }else if(statisType.equals("quarter")){ |
| | | sql.append(" AND CONCAT(left(month,4),quarter(CONCAT(month,'01'))) =:selDate "); |
| | | } |
| | | sql.append(" GROUP BY A.CUSTOMER_ID"); |
| | | sql.append(" GROUP BY A.CUSTOMER_ID,B.CUSTOMER_NAME, B.YWJL_NAME, B.ID"); |
| | | Map map = baseDao.queryForMap(sql.toString(),param); |
| | | |
| | | StringBuffer detailsql = new StringBuffer("SELECT A.CUSTOMER_ID,B.SATIS_TYPE,SUM(B.ALL_COUNT) AS ALL_COUNT,SUM(SATIS_COUNT) AS SATIS_COUNT,AVG(FG_RATE) AS FG_RATE,AVG(REQUEST_FG_RATE) AS REQUEST_FG_RATE,AVG(SATIS_SCORE) AS SATIS_SCORE,AVG(REQUEST_SATIS_SCORE) AS REQUEST_SATIS_SCORE,AVG(SATIS_QZ) AS SATIS_QZ FROM TOTLE_SATIS_INFO A,TOTLE_SATIS_DETAIL B WHERE A.ID = B.BUS_ID AND A.CUSTOMER_ID = :cus_id "); |
| | |
| | | param.put("cusId", cusId); |
| | | param.put("selDate", selDate); |
| | | sql.append(" select count(id) num,type_id,type_name from sc_workflow_incident where customer_id = :cusId "); |
| | | setWhereSql(sql, "create_time", selDate, statisType, param); |
| | | sql.append(" group by type_id "); |
| | | setWhereSql(sql, "to_date(create_time,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by type_id,type_name "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | if(dataList!=null&&dataList.size()>0){ |
| | | Map dataSetMap = new HashMap(); |
| | |
| | | param.put("busType",Constants.WORKFLOW_BASE_BUSINESS_TYPE_INCIDENT); |
| | | |
| | | |
| | | String groupByStr = ""; |
| | | if(statisType.equals("month")){ |
| | | sql.append(" select date_format(createtime,'%Y%m') cate_id,"); |
| | | sql.append(" select date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y%m') cate_id,"); |
| | | groupByStr="date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y%m')"; |
| | | }else if(statisType.equals("week")){ |
| | | sql.append(" select concat(year(createtime),week(createtime,5)) cate_id,"); |
| | | sql.append(" select concat(year(to_date(createtime,'YYYYMMDDHH24MISS')),week(to_date(createtime,'YYYYMMDDHH24MISS'),5)) cate_id,"); |
| | | groupByStr = "concat(year(to_date(createtime,'YYYYMMDDHH24MISS')),week(to_date(createtime,'YYYYMMDDHH24MISS'),5))"; |
| | | }else if(statisType.equals("quarter")){ |
| | | sql.append(" select concat(year(createtime),quarter(createtime)) cate_id,"); |
| | | sql.append(" select concat(year(to_date(createtime,'YYYYMMDDHH24MISS')),quarter(to_date(createtime,'YYYYMMDDHH24MISS'))) cate_id,"); |
| | | groupByStr = "concat(year(to_date(createtime,'YYYYMMDDHH24MISS')),quarter(to_date(createtime,'YYYYMMDDHH24MISS')))"; |
| | | } |
| | | sql.append(" wfstate data_name,count(id) num from workflow_base where wfstate in (1,2,3,4) and businesstype=:busType "); |
| | | if(statisType.equals("month")){ |
| | | sql.append(" and (date_format(createtime,'%Y%m') = :selDate or date_format(createtime,'%Y%m')=:lastDate) "); |
| | | sql.append(" and (date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y%m') = :selDate or date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y%m')=:lastDate) "); |
| | | }else if(statisType.equals("week")){ |
| | | sql.append(" and year(createtime)=left(:selDate,4) and (week(createtime,5) = substring(:selDate,5) or week(createtime,5)=substring(:lastDate,5) ) "); |
| | | sql.append(" and year(to_date(createtime,'YYYYMMDDHH24MISS'))=left(:selDate,4) and (week(to_date(createtime,'YYYYMMDDHH24MISS'),5) = substring(:selDate,5) or week(to_date(createtime,'YYYYMMDDHH24MISS'),5)=substring(:lastDate,5) ) "); |
| | | }else if(statisType.equals("quarter")){ |
| | | sql.append(" and year(createtime)=left(:selDate,4) and (quarter(createtime) = substring(:selDate,5) or quarter(createtime)=substring(:lastDate,5) ) "); |
| | | sql.append(" and year(to_date(createtime,'YYYYMMDDHH24MISS'))=left(:selDate,4) and (quarter(to_date(createtime,'YYYYMMDDHH24MISS')) = substring(:selDate,5) or quarter(to_date(createtime,'YYYYMMDDHH24MISS'))=substring(:lastDate,5) ) "); |
| | | } |
| | | |
| | | sql.append(" and customer_id=:cusId group by cate_id,data_name "); |
| | | sql.append(" and customer_id=:cusId group by " + groupByStr +",wfstate "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | |
| | | Map<String,Map> dataSet = new HashMap(); |
| | |
| | | param.put("cusId", cusId); |
| | | param.put("selDate", selDate); |
| | | sql.append(" select count(id) num,source_id from sc_workflow_incident where customer_id = :cusId "); |
| | | setWhereSql(sql, "create_time", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(create_time,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by source_id "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | if(dataList!=null&&dataList.size()>0){ |
| | |
| | | param.put("cusId", cusId); |
| | | param.put("selDate", selDate); |
| | | sql.append(" select count(id) num,resolve_type_id from sc_workflow_incident where customer_id = :cusId and resolve_type_id is not null "); |
| | | setWhereSql(sql, "create_time", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(create_time,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by resolve_type_id "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | |
| | |
| | | StringBuilder sql = new StringBuilder(); |
| | | SqlParameter param = new SqlParameter(); |
| | | param.put("cusId", cusId); |
| | | sql.append(" select TRUNCATE((total_num-IFNULL(outtime_num,0))*100/total_num,2) ontime_rate from ( "); |
| | | sql.append(" select case when total_num=0 then 0 else TRUNCATE((total_num-IFNULL(outtime_num,0))*100/total_num,2) end ontime_rate from ( "); |
| | | sql.append(" select count(id) total_num from sc_workflow_incident where customer_id = :cusId "); |
| | | setWhereSql(sql, "create_time", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(create_time,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mtotal, ( "); |
| | | sql.append(" select count(id) outtime_num from sc_workflow_incident where customer_id = :cusId and (answer_timeout=1 or deal_timeout=1) "); |
| | | setWhereSql(sql, "create_time", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(create_time,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mfinish "); |
| | | Double y = baseDao.queryForDouble(sql.toString(), param); |
| | | Map chartMap = new HashMap(); |
| | |
| | | param.put("cusId", cusId); |
| | | param.put("selDate", selDate); |
| | | sql.append(" select count(id) num,sla_id from sc_workflow_incident where customer_id = :cusId "); |
| | | setWhereSql(sql, "create_time", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(create_time,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by sla_id "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | |
| | |
| | | sql.append(" select mtotal.THIRD_CATEGORY_NAME,total_num,IFNULL(answer_num,0) answer_num,IFNULL(activi_num,0) activi_num,IFNULL(finish_num,0) finish_num,IFNULL(timeout_num,0) timeout_num, "); |
| | | sql.append(" IFNULL(pri_num,0) pri_num,IFNULL(ques_num,0) ques_num,IFNULL(avg_time,0) avg_time,truncate(IFNULL(first_num, 0)*100/total_num,2) first_rate,truncate((total_num-IFNULL(timeout_num, 0))*100/total_num,2) ontime_rate from "); |
| | | sql.append(" (select THIRD_CATEGORY_NAME,count(id) total_num,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT where customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | sql.append(" group by THIRD_CATEGORY_ID) mtotal "); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by THIRD_CATEGORY_ID,THIRD_CATEGORY_NAME) mtotal "); |
| | | sql.append(" left join (select count(i.id) answer_num,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT i,workflow_base b,workflow_node n where i.FLOW_ID=b.ID and b.CURRENT_NODE_ID=n.ID and n.FLOWSTATE=1 and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by i.THIRD_CATEGORY_ID) manswer "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = manswer.THIRD_CATEGORY_ID "); |
| | | sql.append(" left join (select count(i.id) activi_num,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT i,workflow_base b where i.FLOW_ID=b.ID and b.WFSTATE=1 and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by i.THIRD_CATEGORY_ID) mactivi "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = mactivi.THIRD_CATEGORY_ID "); |
| | | sql.append(" left join (select count(i.id) finish_num,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT i,workflow_base b where i.FLOW_ID=b.ID and b.WFSTATE in (2,4) and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by i.THIRD_CATEGORY_ID) mfinish "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = mfinish.THIRD_CATEGORY_ID "); |
| | | sql.append(" left join (select count(id) timeout_num,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT where (ANSWER_TIMEOUT=1 or DEAL_TIMEOUT=1) and customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by THIRD_CATEGORY_ID) mtimeout "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = mtimeout.THIRD_CATEGORY_ID "); |
| | | sql.append(" left join (select count(id) pri_num,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT where SLA_NAME='LEVEL1' and customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by THIRD_CATEGORY_ID) mpri "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = mpri.THIRD_CATEGORY_ID "); |
| | | sql.append(" left join (select count(id) ques_num,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT where QUESTIONID is not null and customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by THIRD_CATEGORY_ID) mques "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = mques.THIRD_CATEGORY_ID "); |
| | | sql.append(" left join (select truncate(avg(DEAL_USE_TIME)*3600*1000,0) avg_time,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT where customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by THIRD_CATEGORY_ID) mdeal "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = mdeal.THIRD_CATEGORY_ID "); |
| | | sql.append(" left join (select count(i.id) first_num,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT i,workflow_base b,workflow_node n where i.FLOW_ID=b.ID and b.CURRENT_NODE_ID=n.ID and (b.WFSTATE=2 or b.WFSTATE=4) and n.NODE_TEMPLATE_ID = :nodeTemplateId and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by i.THIRD_CATEGORY_ID) mfirst "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = mfirst.THIRD_CATEGORY_ID "); |
| | | List<Map> baseList = baseDao.queryForList(sql.toString(),param); |
| | |
| | | sql.append(" select total_num,IFNULL(answer_num,0) answer_num,IFNULL(activi_num,0) activi_num,IFNULL(finish_num,0) finish_num,IFNULL(timeout_num,0) timeout_num, "); |
| | | sql.append(" IFNULL(pri_num,0) pri_num,IFNULL(ques_num,0) ques_num,IFNULL(avg_time,0) avg_time,truncate(IFNULL(first_num, 0)*100/total_num,2) first_rate,truncate((total_num-IFNULL(timeout_num, 0))*100/total_num,2) ontime_rate from "); |
| | | sql.append(" (select count(id) total_num from SC_WORKFLOW_INCIDENT where customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mtotal, "); |
| | | sql.append(" (select count(i.id) answer_num from SC_WORKFLOW_INCIDENT i,workflow_base b,workflow_node n where i.FLOW_ID=b.ID and b.CURRENT_NODE_ID=n.ID and n.FLOWSTATE=1 and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) manswer, "); |
| | | sql.append(" (select count(i.id) activi_num from SC_WORKFLOW_INCIDENT i,workflow_base b where i.FLOW_ID=b.ID and b.WFSTATE=1 and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mactivi, "); |
| | | sql.append(" (select count(i.id) finish_num from SC_WORKFLOW_INCIDENT i,workflow_base b where i.FLOW_ID=b.ID and b.WFSTATE in (2,4) and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mfinish, "); |
| | | sql.append(" (select count(id) timeout_num from SC_WORKFLOW_INCIDENT where (ANSWER_TIMEOUT=1 or DEAL_TIMEOUT=1) and customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mtimeout, "); |
| | | sql.append(" (select count(id) pri_num from SC_WORKFLOW_INCIDENT where SLA_NAME='LEVEL1' and customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mpri, "); |
| | | sql.append(" (select count(id) ques_num from SC_WORKFLOW_INCIDENT where QUESTIONID is not null and customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mques, "); |
| | | sql.append(" (select truncate(avg(DEAL_USE_TIME)*3600*1000,0) avg_time from SC_WORKFLOW_INCIDENT where customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mdeal, "); |
| | | sql.append(" (select count(i.id) first_num from SC_WORKFLOW_INCIDENT i,workflow_base b,workflow_node n where i.FLOW_ID=b.ID and b.CURRENT_NODE_ID=n.ID and (b.WFSTATE=2 or b.WFSTATE=4) and n.NODE_TEMPLATE_ID = :nodeTemplateId and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mfirst "); |
| | | Map extendMap = baseDao.queryForMap(sql.toString(),param); |
| | | |
| | |
| | | param.put("selDate", selDate); |
| | | param.put("busType", Constants.WORKFLOW_BASE_BUSINESS_TYPE_INCIDENT); |
| | | sql.append(" select count(id) num,wfstate from workflow_base where businesstype =:busType and customer_id = :cusId "); |
| | | setWhereSql(sql, "createtime", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATETIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by wfstate order by wfstate"); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | Map<String,Map> dataxx = new HashMap(); |
| | |
| | | param.put("busType",Constants.WORKFLOW_BASE_BUSINESS_TYPE_QUESTION); |
| | | |
| | | |
| | | String groupByStr = ""; |
| | | if(statisType.equals("month")){ |
| | | sql.append(" select date_format(createtime,'%Y%m') cate_id,"); |
| | | sql.append(" select date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y%m') cate_id,"); |
| | | groupByStr = "date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y%m') "; |
| | | }else if(statisType.equals("week")){ |
| | | sql.append(" select concat(year(createtime),week(createtime,5)) cate_id,"); |
| | | sql.append(" select concat(year(to_date(createtime,'YYYYMMDDHH24MISS')),week(to_date(createtime,'YYYYMMDDHH24MISS'),5)) cate_id,"); |
| | | groupByStr = "concat(year(to_date(createtime,'YYYYMMDDHH24MISS')),week(to_date(createtime,'YYYYMMDDHH24MISS'),5)) "; |
| | | }else if(statisType.equals("quarter")){ |
| | | sql.append(" select concat(year(createtime),quarter(createtime)) cate_id,"); |
| | | sql.append(" select concat(year(to_date(createtime,'YYYYMMDDHH24MISS')),quarter(to_date(createtime,'YYYYMMDDHH24MISS'))) cate_id,"); |
| | | groupByStr = " concat(year(to_date(createtime,'YYYYMMDDHH24MISS')),quarter(to_date(createtime,'YYYYMMDDHH24MISS'))) "; |
| | | } |
| | | sql.append(" wfstate data_name,count(id) num from workflow_base where wfstate in (1,2,3) and businesstype=:busType "); |
| | | if(statisType.equals("month")){ |
| | | sql.append(" and (date_format(createtime,'%Y%m') = :selDate or date_format(createtime,'%Y%m')=:lastDate) "); |
| | | sql.append(" and (date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y%m') = :selDate or date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y%m')=:lastDate) "); |
| | | }else if(statisType.equals("week")){ |
| | | sql.append(" and year(createtime)=left(:selDate,4) and (week(createtime,5) = substring(:selDate,5) or week(createtime,5)=substring(:lastDate,5)) "); |
| | | }else if(statisType.equals("quarter")){ |
| | | sql.append(" and year(createtime)=left(:selDate,4) and (quarter(createtime) = substring(:selDate,5) or quarter(createtime)=substring(:lastDate,5)) "); |
| | | sql.append(" and year(to_date(createtime,'YYYYMMDDHH24MISS'))=left(:selDate,4) and (week(to_date(createtime,'YYYYMMDDHH24MISS'),5) = substring(:selDate,5) or week(to_date(createtime,'YYYYMMDDHH24MISS'),5)=substring(:lastDate,5)) "); |
| | | }else if(statisType.equals("to_date(createtime,'YYYYMMDDHH24MISS')")){ |
| | | sql.append(" and year(to_date(createtime,'YYYYMMDDHH24MISS'))=left(:selDate,4) and (quarter(to_date(createtime,'YYYYMMDDHH24MISS')) = substring(:selDate,5) or quarter(to_date(createtime,'YYYYMMDDHH24MISS'))=substring(:lastDate,5)) "); |
| | | } |
| | | |
| | | sql.append(" and customer_id=:cusId group by cate_id,data_name "); |
| | | sql.append(" and customer_id=:cusId group by "+ groupByStr +",wfstate "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | |
| | | String newcreatetime = "to_date(createtime,'YYYYMMDDHH24MISS')"; |
| | | if(dataList!=null&&dataList.size()>0){ |
| | | String groupCateId=""; |
| | | sql.setLength(0); |
| | | if(statisType.equals("month")){ |
| | | sql.append(" select date_format(createtime,'%Y%m') cate_id,"); |
| | | sql.append(" select date_format(" + newcreatetime+",'%Y%m') cate_id,"); |
| | | groupCateId = " date_format(" + newcreatetime+",'%Y%m') "; |
| | | }else if(statisType.equals("week")){ |
| | | sql.append(" select concat(year(createtime),week(createtime,5)) cate_id,"); |
| | | sql.append(" select concat(year("+newcreatetime+"),week("+newcreatetime+",5)) cate_id,"); |
| | | groupCateId = " concat(year("+newcreatetime+"),week("+newcreatetime+",5)) "; |
| | | }else if(statisType.equals("quarter")){ |
| | | sql.append(" select concat(year(createtime),quarter(createtime)) cate_id,"); |
| | | sql.append(" select concat(year("+newcreatetime+"),quarter("+newcreatetime+")) cate_id,"); |
| | | groupCateId=" concat(year("+newcreatetime+"),quarter("+newcreatetime+")) "; |
| | | } |
| | | sql.append(" count(id) num FROM workflow_base WHERE customer_id = :cusId and businesstype=:busType "); |
| | | if(statisType.equals("month")){ |
| | | sql.append(" and (date_format(createtime,'%Y%m') = :selDate or date_format(createtime,'%Y%m')=:lastDate) "); |
| | | sql.append(" and (date_format("+newcreatetime+",'%Y%m') = :selDate or date_format("+newcreatetime+",'%Y%m')=:lastDate) "); |
| | | }else if(statisType.equals("week")){ |
| | | sql.append(" and year(createtime)=left(:selDate,4) and (week(createtime,5) = substring(:selDate,5) or week(createtime,5)=substring(:lastDate,5)) "); |
| | | sql.append(" and year("+newcreatetime+")=left(:selDate,4) and (week("+newcreatetime+",5) = substring(:selDate,5) or week("+newcreatetime+",5)=substring(:lastDate,5)) "); |
| | | }else if(statisType.equals("quarter")){ |
| | | sql.append(" and year(createtime)=left(:selDate,4) and (quarter(createtime) = substring(:selDate,5) or quarter(createtime)=substring(:lastDate,5)) "); |
| | | sql.append(" and year("+newcreatetime+")=left(:selDate,4) and (quarter("+newcreatetime+") = substring(:selDate,5) or quarter("+newcreatetime+")=substring(:lastDate,5)) "); |
| | | } |
| | | sql.append(" group by cate_id "); |
| | | sql.append(" group by "+groupCateId); |
| | | List<Map> extendList = baseDao.queryForList(sql.toString(),param); |
| | | |
| | | Map dataSetMap = new HashMap(); |
| | |
| | | param.put("cusId", cusId); |
| | | param.put("selDate", selDate); |
| | | sql.append(" select count(id) num,source_id from sc_workflow_question where customer_id = :cusId "); |
| | | setWhereSql(sql, "create_time", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(create_time,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by source_id "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | if(dataList!=null&&dataList.size()>0){ |
| | |
| | | param.put("cusId", cusId); |
| | | param.put("selDate", selDate); |
| | | sql.append(" select count(id) num,resolve_type_id from sc_workflow_question where customer_id = :cusId and state=7 "); |
| | | setWhereSql(sql, "create_time", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(create_time,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by resolve_type_id "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | |
| | |
| | | param.put("cusId", cusId); |
| | | param.put("selDate", selDate); |
| | | sql.append(" select count(id) num,influence_id from sc_workflow_question where customer_id = :cusId "); |
| | | setWhereSql(sql, "create_time", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(create_time,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by influence_id "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | |
| | |
| | | sql.append(" IFNULL(finish_num,0) finish_num, IFNULL(close_num,0) close_num from ( "); |
| | | sql.append(" select count(b.id) total_num,i.THIRD_CATEGORY_NAME,i.THIRD_CATEGORY_ID from workflow_base b ,SC_WORKFLOW_QUESTION i "); |
| | | sql.append(" where b.ID = i.FLOW_ID and b.BUSINESSTYPE = 9 and b.customer_id = :cusId "); |
| | | setWhereSql(sql, "b.createtime", selDate, statisType, param); |
| | | sql.append(" GROUP BY I.THIRD_CATEGORY_ID "); |
| | | setWhereSql(sql, "to_date(b.createtime,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" GROUP BY I.THIRD_CATEGORY_ID,i.THIRD_CATEGORY_NAME "); |
| | | sql.append(" ) mtotal left join ( "); |
| | | sql.append(" select count(b.id) answer_num,i.THIRD_CATEGORY_ID from workflow_base b ,SC_WORKFLOW_QUESTION i,( "); |
| | | sql.append(" select FLOWID from workflow_node where FLOWSTATE = 1 group by FLOWID "); |
| | | sql.append(" ) n where b.ID = i.FLOW_ID and b.id = n.FLOWID and b.BUSINESSTYPE = 9 and b.customer_id = :cusId "); |
| | | setWhereSql(sql, "b.createtime", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(b.createtime,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" and b.WFSTATE = 1 GROUP BY I.THIRD_CATEGORY_ID "); |
| | | sql.append(" ) manswer on mtotal.THIRD_CATEGORY_ID = manswer.THIRD_CATEGORY_ID left join ( "); |
| | | sql.append(" select count(b.id) activi_num,i.THIRD_CATEGORY_ID from workflow_base b ,SC_WORKFLOW_QUESTION i "); |
| | | sql.append(" where b.ID = i.FLOW_ID and b.BUSINESSTYPE = 9 and b.customer_id = :cusId "); |
| | | setWhereSql(sql, "b.createtime", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(b.createtime,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" and b.WFSTATE=1 GROUP BY I.THIRD_CATEGORY_ID "); |
| | | sql.append(" ) mactivi on mtotal.THIRD_CATEGORY_ID = mactivi.THIRD_CATEGORY_ID left join ( "); |
| | | sql.append(" select count(b.id) sleep_num,i.THIRD_CATEGORY_ID from workflow_base b ,SC_WORKFLOW_QUESTION i "); |
| | | sql.append(" where b.ID = i.FLOW_ID and b.BUSINESSTYPE = 9 and b.customer_id = :cusId "); |
| | | setWhereSql(sql, "b.createtime", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(b.createtime,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" and b.WFSTATE=6 GROUP BY I.THIRD_CATEGORY_ID "); |
| | | sql.append(" ) msleep on mtotal.THIRD_CATEGORY_ID = msleep.THIRD_CATEGORY_ID left join ( "); |
| | | sql.append(" select count(b.id) finish_num,i.THIRD_CATEGORY_ID from workflow_base b ,SC_WORKFLOW_QUESTION i "); |
| | | sql.append(" where b.ID = i.FLOW_ID and b.BUSINESSTYPE = 9 and b.customer_id = :cusId "); |
| | | setWhereSql(sql, "b.createtime", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(b.createtime,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" and (b.WFSTATE=2 or b.WFSTATE=4) GROUP BY I.THIRD_CATEGORY_ID "); |
| | | sql.append(" ) mfinish on mtotal.THIRD_CATEGORY_ID = mfinish.THIRD_CATEGORY_ID left join ( "); |
| | | sql.append(" select count(b.id) close_num,i.THIRD_CATEGORY_ID from workflow_base b ,SC_WORKFLOW_QUESTION i "); |
| | | sql.append(" where b.ID = i.FLOW_ID and b.BUSINESSTYPE = 9 and b.customer_id = :cusId "); |
| | | setWhereSql(sql, "b.createtime", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(b.createtime,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" and i.state=7 GROUP BY I.THIRD_CATEGORY_ID "); |
| | | sql.append(" ) mclose on mtotal.THIRD_CATEGORY_ID = mclose.THIRD_CATEGORY_ID "); |
| | | List<Map> baseList = baseDao.queryForList(sql.toString(),param); |
| | |
| | | param.put("busType",Constants.WORKFLOW_BASE_BUSINESS_TYPE_INCIDENT_LOCAL); |
| | | |
| | | |
| | | String gruopByStr = ""; |
| | | String newCreateTime = "to_date(createtime,'YYYYMMDDHH24MISS')"; |
| | | if(statisType.equals("month")){ |
| | | sql.append(" select date_format(createtime,'%Y%m') cate_id,"); |
| | | sql.append(" select date_format(" + newCreateTime +",'%Y%m') cate_id,"); |
| | | gruopByStr = "date_format("+ newCreateTime +",'%Y%m') "; |
| | | }else if(statisType.equals("week")){ |
| | | sql.append(" select concat(year(createtime),week(createtime,5)) cate_id,"); |
| | | sql.append(" select concat(year(" + newCreateTime + "),week("+newCreateTime + ",5)) cate_id,"); |
| | | gruopByStr = " concat(year(" + newCreateTime + "),week("+newCreateTime + ",5))"; |
| | | }else if(statisType.equals("quarter")){ |
| | | sql.append(" select concat(year(createtime),quarter(createtime)) cate_id,"); |
| | | sql.append(" select concat(year(" + newCreateTime +"),quarter(" + newCreateTime + ")) cate_id,"); |
| | | gruopByStr = " concat(year(" + newCreateTime +"),quarter(" + newCreateTime + ")) "; |
| | | } |
| | | sql.append(" ( CASE WHEN WFSTATE = 1 THEN '1' WHEN WFSTATE = 2 THEN '2' WHEN WFSTATE = 3 THEN '3' WHEN WFSTATE = 4 THEN '2' WHEN WFSTATE = 6 THEN '6' END ) data_name,count(id) num from workflow_base where wfstate in (1,2,3,4) and businesstype=:busType "); |
| | | if(statisType.equals("month")){ |
| | | sql.append(" and (date_format(createtime,'%Y%m') = :selDate or date_format(createtime,'%Y%m')=:lastDate) "); |
| | | sql.append(" and (date_format("+newCreateTime+",'%Y%m') = :selDate or date_format("+newCreateTime+",'%Y%m')=:lastDate) "); |
| | | }else if(statisType.equals("week")){ |
| | | sql.append(" and year(createtime)=left(:selDate,4) and (week(createtime,5) = substring(:selDate,5) or week(createtime,5)=substring(:lastDate,5)) "); |
| | | sql.append(" and year("+newCreateTime+")=left(:selDate,4) and (week("+newCreateTime+",5) = substring(:selDate,5) or week("+newCreateTime+",5)=substring(:lastDate,5)) "); |
| | | }else if(statisType.equals("quarter")){ |
| | | sql.append(" and year(createtime)=left(:selDate,4) and (quarter(createtime) = substring(:selDate,5) or quarter(createtime)=substring(:lastDate,5)) "); |
| | | sql.append(" and year("+newCreateTime+")=left(:selDate,4) and (quarter("+newCreateTime+") = substring(:selDate,5) or quarter("+newCreateTime+")=substring(:lastDate,5)) "); |
| | | } |
| | | |
| | | sql.append(" and customer_id=:cusId group by cate_id,data_name "); |
| | | sql.append(" and customer_id=:cusId group by "+gruopByStr +",WFSTATE "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | |
| | | if(dataList!=null&&dataList.size()>0){ |
| | |
| | | param.put("cusId", cusId); |
| | | param.put("selDate", selDate); |
| | | sql.append(" select count(id) num,source_id from sc_workflow_incident_local where customer_id = :cusId "); |
| | | setWhereSql(sql, "create_time", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by source_id "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | if(dataList!=null&&dataList.size()>0){ |
| | |
| | | param.put("cusId", cusId); |
| | | param.put("selDate", selDate); |
| | | sql.append(" select count(id) num,type_id,type_name from sc_workflow_incident_local where customer_id = :cusId "); |
| | | setWhereSql(sql, "create_time", selDate, statisType, param); |
| | | sql.append(" group by type_id "); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by type_id ,type_name"); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | if(dataList!=null&&dataList.size()>0){ |
| | | Map dataSetMap = new HashMap(); |
| | |
| | | param.put("cusId", cusId); |
| | | param.put("selDate", selDate); |
| | | sql.append(" select count(id) num,resolve_type_id from sc_workflow_incident_local where customer_id = :cusId and resolve_type_id is not null "); |
| | | setWhereSql(sql, "create_time", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by resolve_type_id "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | if(dataList!=null&&dataList.size()>0){ |
| | |
| | | StringBuilder sql = new StringBuilder(); |
| | | SqlParameter param = new SqlParameter(); |
| | | param.put("cusId", cusId); |
| | | sql.append(" select TRUNCATE((total_num-IFNULL(outtime_num,0))*100/total_num,2) ontime_rate from ( "); |
| | | sql.append(" select case when total_num=0 then 0 else TRUNCATE((total_num-IFNULL(outtime_num,0))*100/total_num,2) end ontime_rate from ( "); |
| | | sql.append(" select count(id) total_num from sc_workflow_incident_local where customer_id = :cusId "); |
| | | setWhereSql(sql, "create_time", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mtotal, ( "); |
| | | sql.append(" select count(id) outtime_num from sc_workflow_incident_local where customer_id = :cusId and (answer_timeout=1 or deal_timeout=1) "); |
| | | setWhereSql(sql, "create_time", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mfinish "); |
| | | Double y = baseDao.queryForDouble(sql.toString(), param); |
| | | Map chartMap = new HashMap(); |
| | |
| | | param.put("cusId", cusId); |
| | | param.put("selDate", selDate); |
| | | sql.append(" select count(id) num,sla_id from sc_workflow_incident_local where customer_id = :cusId "); |
| | | setWhereSql(sql, "create_time", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by sla_id "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | if(dataList!=null&&dataList.size()>0){ |
| | |
| | | sql.append(" select mtotal.THIRD_CATEGORY_NAME,total_num,IFNULL(answer_num,0) answer_num,IFNULL(activi_num,0) activi_num,IFNULL(finish_num,0) finish_num,IFNULL(timeout_num,0) timeout_num, "); |
| | | sql.append(" IFNULL(pri_num,0) pri_num,IFNULL(ques_num,0) ques_num,IFNULL(avg_time,0) avg_time,truncate(IFNULL(finish_num, 0)*100/total_num,2) first_rate,truncate((total_num-IFNULL(timeout_num, 0))*100/total_num,2) ontime_rate from "); |
| | | sql.append(" (select a.THIRD_CATEGORY_NAME,count(a.id) total_num,a.THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT_LOCAL a,workflow_base b where a.customer_id=:cusId and a.id=b.BUSINESS_ID and b.WFSTATE<>3 "); |
| | | setWhereSql(sql, "a.CREATE_TIME", selDate, statisType, param); |
| | | sql.append(" group by a.THIRD_CATEGORY_ID) mtotal "); |
| | | setWhereSql(sql, "to_date(a.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by a.THIRD_CATEGORY_ID,a.THIRD_CATEGORY_NAME) mtotal "); |
| | | sql.append(" left join (select count(i.id) answer_num,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT_LOCAL i,workflow_base b,workflow_node n where i.FLOW_ID=b.ID and b.WFSTATE<>3 and b.CURRENT_NODE_ID=n.ID and n.FLOWSTATE=1 and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by i.THIRD_CATEGORY_ID) manswer "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = manswer.THIRD_CATEGORY_ID "); |
| | | sql.append(" left join (select count(i.id) activi_num,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT_LOCAL i,workflow_base b where i.FLOW_ID=b.ID and b.WFSTATE=1 and b.WFSTATE<>3 and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by i.THIRD_CATEGORY_ID) mactivi "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = mactivi.THIRD_CATEGORY_ID "); |
| | | sql.append(" left join (select count(i.id) finish_num,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT_LOCAL i,workflow_base b where i.FLOW_ID=b.ID and b.WFSTATE in (2,4) and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by i.THIRD_CATEGORY_ID) mfinish "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = mfinish.THIRD_CATEGORY_ID "); |
| | | sql.append(" left join (select count(id) timeout_num,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT_LOCAL where (ANSWER_TIMEOUT=1 or DEAL_TIMEOUT=1) and customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by THIRD_CATEGORY_ID) mtimeout "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = mtimeout.THIRD_CATEGORY_ID "); |
| | | sql.append(" left join (select count(id) pri_num,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT_LOCAL where SLA_NAME='LEVEL1' and customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by THIRD_CATEGORY_ID) mpri "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = mpri.THIRD_CATEGORY_ID "); |
| | | sql.append(" left join (select count(id) ques_num,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT_LOCAL where QUESTIONID is not null and customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by THIRD_CATEGORY_ID) mques "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = mques.THIRD_CATEGORY_ID "); |
| | | sql.append(" left join (select truncate(avg(DEAL_USE_TIME)*3600*1000,0) avg_time,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT_LOCAL where customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by THIRD_CATEGORY_ID) mdeal "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = mdeal.THIRD_CATEGORY_ID "); |
| | | sql.append(" left join (select count(i.id) first_num,THIRD_CATEGORY_ID from SC_WORKFLOW_INCIDENT_LOCAL i,workflow_base b,workflow_node n where i.FLOW_ID=b.ID and b.CURRENT_NODE_ID=n.ID and (b.WFSTATE=2 or b.WFSTATE=4) and n.NODE_TEMPLATE_ID = :nodeTemplateId and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" group by i.THIRD_CATEGORY_ID) mfirst "); |
| | | sql.append(" on mtotal.THIRD_CATEGORY_ID = mfirst.THIRD_CATEGORY_ID "); |
| | | List<Map> baseList = baseDao.queryForList(sql.toString(),param); |
| | |
| | | sql.append(" select total_num,IFNULL(answer_num,0) answer_num,IFNULL(activi_num,0) activi_num,IFNULL(finish_num,0) finish_num,IFNULL(timeout_num,0) timeout_num, "); |
| | | sql.append(" IFNULL(pri_num,0) pri_num,IFNULL(ques_num,0) ques_num,IFNULL(avg_time,0) avg_time,truncate(IFNULL(finish_num, 0)*100/total_num,2) first_rate,truncate((total_num-IFNULL(timeout_num, 0))*100/total_num,2) ontime_rate from "); |
| | | sql.append(" (select count(a.id) total_num from SC_WORKFLOW_INCIDENT_LOCAL a,workflow_base b where a.customer_id=:cusId and a.id=b.BUSINESS_ID and b.WFSTATE<>3 "); |
| | | setWhereSql(sql, "a.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(a.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mtotal, "); |
| | | sql.append(" (select count(i.id) answer_num from SC_WORKFLOW_INCIDENT_LOCAL i,workflow_base b,workflow_node n where i.FLOW_ID=b.ID and b.WFSTATE<>3 and b.CURRENT_NODE_ID=n.ID and n.FLOWSTATE=1 and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) manswer, "); |
| | | sql.append(" (select count(i.id) activi_num from SC_WORKFLOW_INCIDENT_LOCAL i,workflow_base b where i.FLOW_ID=b.ID and b.WFSTATE=1 and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mactivi, "); |
| | | sql.append(" (select count(i.id) finish_num from SC_WORKFLOW_INCIDENT_LOCAL i,workflow_base b where i.FLOW_ID=b.ID and b.WFSTATE in (2,4) and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mfinish, "); |
| | | sql.append(" (select count(id) timeout_num from SC_WORKFLOW_INCIDENT_LOCAL where (ANSWER_TIMEOUT=1 or DEAL_TIMEOUT=1) and customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mtimeout, "); |
| | | sql.append(" (select count(id) pri_num from SC_WORKFLOW_INCIDENT_LOCAL where SLA_NAME='LEVEL1' and customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mpri, "); |
| | | sql.append(" (select count(id) ques_num from SC_WORKFLOW_INCIDENT_LOCAL where QUESTIONID is not null and customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mques, "); |
| | | sql.append(" (select truncate(avg(DEAL_USE_TIME)*3600*1000,0) avg_time from SC_WORKFLOW_INCIDENT_LOCAL where customer_id=:cusId "); |
| | | setWhereSql(sql, "CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mdeal, "); |
| | | sql.append(" (select count(i.id) first_num from SC_WORKFLOW_INCIDENT_LOCAL i,workflow_base b,workflow_node n where i.FLOW_ID=b.ID and b.CURRENT_NODE_ID=n.ID and (b.WFSTATE=2 or b.WFSTATE=4) and n.NODE_TEMPLATE_ID = :nodeTemplateId and i.customer_id=:cusId "); |
| | | setWhereSql(sql, "i.CREATE_TIME", selDate, statisType, param); |
| | | setWhereSql(sql, "to_date(i.CREATE_TIME,'YYYYMMDDHH24MISS')", selDate, statisType, param); |
| | | sql.append(" ) mfirst "); |
| | | Map extendMap = baseDao.queryForMap(sql.toString(),param); |
| | | |
| | |
| | | tempList.add(ConvertUtil.obj2StrBlank(base.get("timeout_num"))); |
| | | tempList.add(ConvertUtil.obj2StrBlank(base.get("pri_num"))); |
| | | tempList.add(ConvertUtil.obj2StrBlank(base.get("ques_num"))); |
| | | |
| | | tempList.add(DateUtil.secToTime(Math.round((Double)base.get("avg_time")))); |
| | | Object avg_time = base.get("avg_time"); |
| | | String avgTimeSTr = null; |
| | | if (avg_time == null){ |
| | | avgTimeSTr = "0"; |
| | | } else { |
| | | avgTimeSTr = String.valueOf(avg_time); |
| | | } |
| | | tempList.add(DateUtil.secToTime(Math.round(Double.valueOf(avgTimeSTr)))); |
| | | tempList.add(ConvertUtil.obj2StrBlank(base.get("first_rate"))+"%"); |
| | | tempList.add(ConvertUtil.obj2StrBlank(base.get("ontime_rate"))+"%"); |
| | | dataList.add(tempList); |
| | |
| | | List<String> tempList = new ArrayList<String>(); |
| | | tempList.add("合计"); |
| | | tempList.add(ConvertUtil.obj2StrBlank(extendMap.get("total_num"))); |
| | | |
| | | tempList.add(ConvertUtil.obj2StrBlank(extendMap.get("answer_num"))); |
| | | tempList.add(ConvertUtil.obj2StrBlank(extendMap.get("activi_num"))); |
| | | tempList.add(ConvertUtil.obj2StrBlank(extendMap.get("finish_num"))); |
| | | tempList.add(ConvertUtil.obj2StrBlank(extendMap.get("timeout_num"))); |
| | | tempList.add(ConvertUtil.obj2StrBlank(extendMap.get("pri_num"))); |
| | | tempList.add(ConvertUtil.obj2StrBlank(extendMap.get("ques_num"))); |
| | | tempList.add(DateUtil.secToTime(Math.round((Double)extendMap.get("avg_time")))); |
| | | Object avg_time = extendMap.get("avg_time"); |
| | | String avgTimeSTr = null; |
| | | if (avg_time == null){ |
| | | avgTimeSTr = "0"; |
| | | } else { |
| | | avgTimeSTr = String.valueOf(avg_time); |
| | | } |
| | | tempList.add(DateUtil.secToTime(Math.round(Double.valueOf(avgTimeSTr)))); |
| | | tempList.add(ConvertUtil.obj2StrBlank(extendMap.get("first_rate"))+"%"); |
| | | tempList.add(ConvertUtil.obj2StrBlank(extendMap.get("ontime_rate"))+"%"); |
| | | dataList.add(tempList); |
| | |
| | | param.put("lastDate",lastDate); |
| | | param.put("busType",Constants.WORKFLOW_BASE_BUSINESS_TYPE_INCIDENT); |
| | | |
| | | String cateIdStr = ""; |
| | | //查询数据 |
| | | if(statisType.equals("month")){ |
| | | sql.append(" select i.month cate_id, "); |
| | | cateIdStr = " i.month "; |
| | | }else if(statisType.equals("year")){ |
| | | sql.append(" select left(i.month,4) cate_id, "); |
| | | cateIdStr = " left(i.month,4) "; |
| | | }else if(statisType.equals("quarter")){ |
| | | sql.append(" select concat(left(i.month,4),quarter(concat(i.month,'01'))) cate_id, "); |
| | | cateIdStr = " concat(left(i.month,4),quarter(concat(i.month,'01'))) "; |
| | | } |
| | | sql.append(" d.satis_type data_name,truncate(avg(d.satis_score),0) num from totle_satis_info i,totle_satis_detail d where i.id = d.bus_id "); |
| | | if(statisType.equals("month")){ |
| | |
| | | }else if(statisType.equals("quarter")){ |
| | | sql.append(" and (concat(left(i.month,4),quarter(concat(i.month,'01'))) = :selDate or concat(left(i.month,4),quarter(concat(i.month,'01')))=:lastDate) "); |
| | | } |
| | | sql.append(" and i.customer_id=:cusId group by cate_id,data_name "); |
| | | sql.append(" and i.customer_id=:cusId group by "+cateIdStr+",d.satis_type "); |
| | | sql.append(" union "); |
| | | if(statisType.equals("month")){ |
| | | sql.append(" select i.month cate_id, "); |
| | |
| | | }else if(statisType.equals("quarter")){ |
| | | sql.append(" and (concat(left(i.month,4),quarter(concat(i.month,'01'))) = :selDate or concat(left(i.month,4),quarter(concat(i.month,'01')))=:lastDate) "); |
| | | } |
| | | sql.append(" and i.customer_id=:cusId group by cate_id,data_name "); |
| | | sql.append(" and i.customer_id=:cusId group by "+cateIdStr+" "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | if(dataList!=null&&dataList.size()>0){ |
| | | Map dataSetMap = new HashMap(); |
| | |
| | | .addValue("busType", Constants.WORKFLOW_BASE_BUSINESS_TYPE_INCIDENT); |
| | | |
| | | StringBuilder sql = new StringBuilder(); |
| | | sql.append(" select count(id) num,date_format(createtime,'%Y%c') cate_id from workflow_base where businesstype = :busType and customer_id =:cusId "); |
| | | sql.append(" and date_format(createtime,'%Y') = :selDate group by cate_id "); |
| | | sql.append(" select count(id) num,date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y%c') cate_id from workflow_base where businesstype = :busType and customer_id =:cusId "); |
| | | sql.append(" and date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y') = :selDate group by date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y%c') "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | if(dataList!=null&&dataList.size()>0){ |
| | | Map dataSetMap = new HashMap(); |
| | |
| | | .addValue("lastDate", lastDate); |
| | | |
| | | StringBuilder sql = new StringBuilder(); |
| | | sql.append(" select count(id) num,date_format(createtime,'%Y') cate_id from workflow_base where businesstype = :busType and customer_id =:cusId "); |
| | | sql.append(" and (date_format(createtime,'%Y') = :selDate or date_format(createtime,'%Y') = :lastDate) group by cate_id "); |
| | | sql.append(" select count(id) num,date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y') cate_id from workflow_base where businesstype = :busType and customer_id =:cusId "); |
| | | sql.append(" and (date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y') = :selDate or date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y') = :lastDate) group by date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y') "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | if(dataList!=null&&dataList.size()>0){ |
| | | Map dataSetMap = new HashMap(); |
| | |
| | | .addValue("busType", Constants.WORKFLOW_BASE_BUSINESS_TYPE_QUESTION); |
| | | |
| | | StringBuilder sql = new StringBuilder(); |
| | | sql.append(" select count(id) num,date_format(createtime,'%Y%c') cate_id from workflow_base where businesstype = :busType and customer_id =:cusId "); |
| | | sql.append(" and date_format(createtime,'%Y') = :selDate group by cate_id "); |
| | | sql.append(" select count(id) num,date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y%c') cate_id from workflow_base where businesstype = :busType and customer_id =:cusId "); |
| | | sql.append(" and date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y') = :selDate group by date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y%c') "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | if(dataList!=null&&dataList.size()>0){ |
| | | Map dataSetMap = new HashMap(); |
| | |
| | | .addValue("lastDate", lastDate); |
| | | |
| | | StringBuilder sql = new StringBuilder(); |
| | | sql.append(" select count(id) num,date_format(createtime,'%Y') cate_id from workflow_base where businesstype = :busType and customer_id =:cusId "); |
| | | sql.append(" and (date_format(createtime,'%Y') = :selDate or date_format(createtime,'%Y') = :lastDate) group by cate_id "); |
| | | sql.append(" select count(id) num,date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y') cate_id from workflow_base where businesstype = :busType and customer_id =:cusId "); |
| | | sql.append(" and (date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y') = :selDate or date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y') = :lastDate) group by date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y') "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | if(dataList!=null&&dataList.size()>0){ |
| | | Map dataSetMap = new HashMap(); |
| | |
| | | .addValue("busType", Constants.WORKFLOW_BASE_BUSINESS_TYPE_INCIDENT_LOCAL); |
| | | |
| | | StringBuilder sql = new StringBuilder(); |
| | | sql.append(" select count(id) num,date_format(createtime,'%Y%c') cate_id from workflow_base where businesstype = :busType and customer_id =:cusId "); |
| | | sql.append(" and date_format(createtime,'%Y') = :selDate group by cate_id "); |
| | | sql.append(" select count(id) num,date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y%c') cate_id from workflow_base where businesstype = :busType and customer_id =:cusId "); |
| | | sql.append(" and date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y') = :selDate group by date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y%c') "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | if(dataList!=null&&dataList.size()>0){ |
| | | Map dataSetMap = new HashMap(); |
| | |
| | | .addValue("lastDate", lastDate); |
| | | |
| | | StringBuilder sql = new StringBuilder(); |
| | | sql.append(" select count(id) num,date_format(createtime,'%Y') cate_id from workflow_base where businesstype = :busType and customer_id =:cusId "); |
| | | sql.append(" and (date_format(createtime,'%Y') = :selDate or date_format(createtime,'%Y') = :lastDate) group by cate_id "); |
| | | sql.append(" select count(id) num,date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y') cate_id from workflow_base where businesstype = :busType and customer_id =:cusId "); |
| | | sql.append(" and (date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y') = :selDate or date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y') = :lastDate) group by date_format(to_date(createtime,'YYYYMMDDHH24MISS'),'%Y') "); |
| | | List<Map> dataList = baseDao.queryForList(sql.toString(),param); |
| | | if(dataList!=null&&dataList.size()>0){ |
| | | Map dataSetMap = new HashMap(); |
| | |
| | | |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.append(" SELECT I.ALL_SCORE,D.SATIS_SCORE,D.SATIS_TYPE,I.MONTH FROM TOTLE_SATIS_DETAIL D ,TOTLE_SATIS_INFO I "); |
| | | builder.append(" WHERE LEFT(I.MONTH,4)=:selDate AND D.BUS_ID = I.ID AND I.CUSTOMER_ID = :cusId GROUP BY D.SATIS_TYPE,I.MONTH ORDER BY SATIS_TYPE,MONTH"); |
| | | builder.append(" WHERE LEFT(I.MONTH,4)=:selDate AND D.BUS_ID = I.ID AND I.CUSTOMER_ID = :cusId GROUP BY D.SATIS_TYPE,I.MONTH,I.ALL_SCORE, D.SATIS_SCORE ORDER BY SATIS_TYPE,MONTH"); |
| | | List<Map> queryList = baseDao.queryForList(builder.toString(), param); |
| | | builder.setLength(0); |
| | | Map<String,Object> queryMap = new HashMap<String,Object>(); |
| | |
| | | public List<String> getCusYearToCur(String cusId) { |
| | | SqlParameter param = new SqlParameter(); |
| | | param.addValue("cusId", cusId); |
| | | String sql = "select year(CREATE_TIME) from SC_PARTNER_CUSTOMER_INFO where id = :cusId"; |
| | | String sql = "select substr(CREATE_TIME||'',1,4) from SC_PARTNER_CUSTOMER_INFO where id = :cusId"; |
| | | Integer startYear = baseDao.queryForInteger(sql,param); |
| | | Calendar cal = Calendar.getInstance(); |
| | | Integer endYear = cal.get(Calendar.YEAR); |
| | |
| | | @Override |
| | | public String getNRecordDate(Map<String, String> params) { |
| | | String col = ""; |
| | | String createTimeStr = "to_date(createtime,'YYYYMMDDHH24MISS')"; |
| | | if(params.get("type").equals("week")){ |
| | | col = "week(createtime,5)"; |
| | | col = "week("+ createTimeStr +",5)"; |
| | | }else if(params.get("type").equals("month")){ |
| | | col = "date_format(createtime,'%Y%m')"; |
| | | col = "date_format("+ createTimeStr +",'%Y%m')"; |
| | | }else if(params.get("type").equals("quarter")){ |
| | | col = "quarter(createtime)"; |
| | | col = "quarter("+ createTimeStr +")"; |
| | | }else if(params.get("type").equals("year")){ |
| | | col = "year(createtime)"; |
| | | col = "year("+ createTimeStr +")"; |
| | | } |
| | | |
| | | StringBuilder sql = new StringBuilder(); |
| | | sql.append(" select GROUP_CONCAT(d) from ( "); |
| | | sql.append(" select wm_CONCAT(d) from ( "); |
| | | sql.append(" select $col d from workflow_base where businesstype in (8,9,10) and customer_id=:cusId "); |
| | | if(!params.get("type").equals("year")){ |
| | | sql.append(" and year(createtime)=:year "); |
| | | sql.append(" and substr(createtime||'',1,4)=:year "); |
| | | } |
| | | sql.append(" group by $col "); |
| | | sql.append(" ) t "); |