项目中用到列表的地方很多,二页面列表的显示必然要求分页,
所以分页和查询几乎密不可分,如果说你不会分页查询数据,
那你基本上还属于菜鸟。

分页的原理很简单,从sql上看就是从哪一条开始,往后差几条。
所以sql只需要传2个参数,这只是原理罢了,关键是实现。
而实现的方法就多了去了,架构师干这个是小菜一碟。

在我的项目中,关于分页架构师已经写好了一个管理分页的类,
这个类与sql耦合,控制分页只需哟啊控制这个类的对象的参数,
说白了这个类就是管理上面sql中需要的那2个参数,无论怎么写
实质是一样的。

在定义HibernateTemplete是定义分页的查询方法,例如:

[java] view plaincopy
  1. public List queryNativeSQL(final String sql, final PaginationSupport ps) {
  2. return (List) execute(new HibernateCallback() {
  3. public Object doInHibernate(Session session) throws HibernateException {
  4. try {
  5. SQLQuery query = session.createSQLQuery(sql);
  6. query.setFirstResult(ps.getStartIndex());
  7. query.setMaxResults(ps.getCountOnEachPage());
  8. return query.list();
  9. catch (RuntimeException e) {
  10. log.error("query sql catch exception: " , e);
  11. throw e;
  12. }
  13. }
  14. });
  15. }

核心就是
query.setFirstResult(ps.getStartIndex());
query.setMaxResults(ps.getCountOnEachPage());

关于PaginationSupport ps就是管理这两个参数与分页其他参数的逻辑。

[java] view plaincopy
  1. package org.rd.framework.query.support;
  2. import java.io.Serializable;
  3. import org.rd.framework.query.sort.SortCriterion;
  4. public class PaginationSupport implements Serializable {
  5. private static final long serialVersionUID = 1L;
  6. private static int DEFAULT_COUNT_ON_EACH_PAGE = 20;
  7. private int totalCount;
  8. private int startIndex;
  9. private int countOnEachPage;
  10. // support field sort
  11. private boolean sortingEnabled = false; // default
  12. private SortCriterion sorter = null;
  13. public PaginationSupport() {
  14. this(DEFAULT_COUNT_ON_EACH_PAGE);
  15. }
  16. /**
  17. * @param sortingEnabled default false
  18. */
  19. public PaginationSupport(boolean sortingEnabled) {
  20. this(DEFAULT_COUNT_ON_EACH_PAGE);
  21. this.sortingEnabled = sortingEnabled;
  22. }
  23. public PaginationSupport(int countOnEachPage) {
  24. startIndex = 0;
  25. this.countOnEachPage = countOnEachPage < 1
  26. ? DEFAULT_COUNT_ON_EACH_PAGE
  27. : countOnEachPage;
  28. }
  29. public PaginationSupport(int startIndex, int totalCount, int countOnEachPage) {
  30. this.startIndex = startIndex;
  31. this.totalCount = totalCount;
  32. this.countOnEachPage = countOnEachPage;
  33. }
  34. public void setStartIndex(int startIndex) {
  35. this.startIndex = startIndex;
  36. }
  37. public void setCountOnEachPage(int countOnEachPage) {
  38. this.countOnEachPage = countOnEachPage;
  39. }
  40. public int getTotalCount() {
  41. return totalCount;
  42. }
  43. public int getEndIndex() {
  44. int endIndex = getStartIndex() + countOnEachPage;
  45. return endIndex > totalCount ? totalCount : endIndex;
  46. }
  47. public int getStartIndex() {
  48. if (startIndex > totalCount) {
  49. return totalCount;
  50. else if (startIndex < 0) {
  51. return 0;
  52. else {
  53. return startIndex;
  54. }
  55. }
  56. public int getNextIndex() {
  57. int[] nextStartIndexes = getNextStartIndexes();
  58. if (nextStartIndexes == null) {
  59. return getTotalCount();
  60. else {
  61. return nextStartIndexes[0];
  62. }
  63. }
  64. public int getPreviousIndex() {
  65. int[] previousIndexes = getPreviousStartIndexes();
  66. if (previousIndexes == null) {
  67. return getStartIndex();
  68. else {
  69. return previousIndexes[previousIndexes.length - 1];
  70. }
  71. }
  72. public int[] getNextStartIndexes() {
  73. int index = getEndIndex();
  74. if (index == totalCount) {
  75. return null;
  76. }
  77. int count = (totalCount - index) / countOnEachPage;
  78. if ((totalCount - index) % countOnEachPage > 0) {
  79. count++;
  80. }
  81. int result[] = new int[count];
  82. for (int i = 0; i < count; i++) {
  83. result[i] = index;
  84. index += countOnEachPage;
  85. }
  86. return result;
  87. }
  88. public int[] getPreviousStartIndexes() {
  89. int index = getStartIndex();
  90. if (index == 0) {
  91. return null;
  92. }
  93. int count = index / countOnEachPage;
  94. if (index % countOnEachPage > 0) {
  95. count++;
  96. }
  97. int result[] = new int[count];
  98. for (int i = count - 1; i > 0; i--) {
  99. index -= countOnEachPage;
  100. result[i] = index;
  101. }
  102. return result;
  103. }
  104. public int getCountOnEachPage() {
  105. return countOnEachPage;
  106. }
  107. public void setTotalCount(int totalCount) {
  108. this.totalCount = totalCount;
  109. validate();
  110. }
  111. private void validate() {
  112. if (startIndex >= totalCount) {
  113. int i = getTotalCount() % countOnEachPage;
  114. startIndex = totalCount - i;
  115. }
  116. if (startIndex < 0) {
  117. startIndex = 0;
  118. }
  119. }
  120. /**
  121. * Return the number of pages for the current query.
  122. */
  123. public int getPageCount() {
  124. int pages = getTotalCount() / countOnEachPage;
  125. int i = getTotalCount() % countOnEachPage;
  126. if (i > 0) {
  127. pages++;
  128. }
  129. if (getTotalCount() == 0) {
  130. pages = 1;
  131. }
  132. return pages;
  133. }
  134. /**
  135. * Return the current page number.
  136. * Page numbering starts with 1.
  137. */
  138. public int getPage() {
  139. int page = startIndex / countOnEachPage;
  140. return page + 1;
  141. }
  142. public void setPage(int page) {
  143. startIndex = page < 1 ? 0 : (page - 1) * countOnEachPage;
  144. }
  145. public boolean isSortingEnabled() {
  146. return sortingEnabled;
  147. }
  148. public void setSortingEnabled(boolean sortingEnabled) {
  149. this.sortingEnabled = sortingEnabled;
  150. }
  151. public SortCriterion getSorter() {
  152. return sorter;
  153. }
  154. public void setSorter(SortCriterion sorter) {
  155. this.sorter = sorter;
  156. }
  157. public String toString() {
  158. return "PaginationSupport["
  159. + "totalCount=" + totalCount
  160. + ", startIndex="+ startIndex
  161. + ", pageCount=" + getPageCount()
  162. + ", page=" + getPage()
  163. + ", sorter=" + sorter
  164. + "]";
  165. }
  166. }

底层的方法已经具备,剩下的就是要在业务层管理传参和在
显示层管理页面展示就可以了。

在页面的展示,

我的思路是对一个div,定义好id,根据这个id找到它,然后再里面
写html展示分页。

greenpage.js(使用到jquerty,在使用本js文件时需要同时引入jquery)

[javascript] view plaincopy
  1. function GreenPage(divid,pageHref,currPage,pageCount,validHref){
  2. this.divid=divid;
  3. this.pageHref=pageHref;
  4. this.currPage=currPage;
  5. this.pageCount=pageCount;
  6. this.validHref=validHref;
  7. };
  8. GreenPage.prototype.getCurrPageInfo=function ()
  9. {
  10. return "GreenPageInfo---"+this.divid+":"+this.pageHref+":"+this.currPage+":"+this.pageCount;
  11. };
  12. GreenPage.prototype.getDivInfo=function ()
  13. {
  14. return "getDivInfo---"+$("#"+this.divid).html();
  15. };
  16. GreenPage.prototype.currPageClick=function (currPage)
  17. {
  18. this.currPage=currPage;
  19. document.getElementById(divid).innerHTML="";
  20. this.makePage();
  21. };
  22. GreenPage.prototype.makePage=function ()
  23. {
  24. $("#"+this.divid).addClass("greenpage");
  25. if(this.currPage=="1"){
  26. }else{
  27. if(this.validHref=="0"){
  28. writeHtml(this.divid,"<a href=\"#\"  οnclick=\"pageClickFunc('1')\">首页</a> ");
  29. }else{
  30. writeHtml(this.divid,"<a href=\""+this.pageHref+"?targetPageNum=1\"  οnclick=\"pageClickFunc('1')\">首页</a> ");
  31. }
  32. }
  33. if(this.currPage=="1"){
  34. }else{
  35. var tempnum=(this.currPage-1>0)?(this.currPage-1):1;
  36. if(this.validHref=="0"){
  37. writeHtml(this.divid,"<a href=\"#\"  οnclick=\"pageClickFunc('"+tempnum+"')\">上一页</a> ");
  38. }else{
  39. writeHtml(this.divid,"<a href=\""+this.pageHref+"?targetPageNum="+tempnum+"\"  οnclick=\"pageClickFunc('"+tempnum+"')\">上一页</a> ");
  40. }
  41. }
  42. var start=0;
  43. var end=0;
  44. if(this.pageCount<=10){
  45. start=1;
  46. end=this.pageCount;
  47. }else{
  48. if(this.currPage<=5){
  49. start=1;
  50. end=10;
  51. }else if(this.currPage>=this.pageCount-5){
  52. start=this.currPage-(10-(this.pageCount-this.currPage))+1;
  53. end=this.pageCount;
  54. }else{
  55. start=this.currPage-4;
  56. end=(this.currPage+5<=this.pageCount)?(this.currPage+5):this.pageCount;
  57. }
  58. }
  59. for(var i=start;i<=end;i++){
  60. if(i==this.currPage){
  61. writeHtml(this.divid," <span  class=\"current\" id=\""+this.divid+"Selected\">["+i+"] </span> ");
  62. }else{
  63. if(this.validHref=="0"){
  64. writeHtml(this.divid,"<a href=\"#\"   οnclick=\"pageClickFunc('"+i+"')\">"+i+"</a> ");
  65. }else{
  66. writeHtml(this.divid,"<a href=\""+this.pageHref+"?targetPageNum="+i+"\"   οnclick=\"pageClickFunc('"+i+"')\">"+i+"</a> ");
  67. }
  68. }
  69. }
  70. if(this.currPage==this.pageCount){
  71. }else{
  72. var pcurr=parseInt(this.currPage);
  73. var pcoun=parseInt(this.pageCount);
  74. var tempnum=((pcurr+1)<pcoun)?(pcurr+1):pcoun;
  75. if(this.validHref=="0"){
  76. writeHtml(this.divid,"<a href=\"#\"   οnclick=\"pageClickFunc('"+tempnum+"')\">下一页</a> ");
  77. }else{
  78. writeHtml(this.divid,"<a href=\""+this.pageHref+"?targetPageNum="+tempnum+"\"   οnclick=\"pageClickFunc('"+tempnum+"')\">下一页</a> ");
  79. }
  80. }
  81. if(this.currPage==this.pageCount){
  82. }else{
  83. if(this.validHref=="0"){
  84. writeHtml(this.divid,"<a href=\"#\"  οnclick=\"pageClickFunc('"+this.pageCount+"')\">尾页</a> ");
  85. }else{
  86. writeHtml(this.divid,"<a href=\""+this.pageHref+"?targetPageNum="+this.pageCount+"\"  οnclick=\"pageClickFunc('"+this.pageCount+"')\">尾页</a> ");
  87. }
  88. }
  89. };
  90. GreenPage.prototype.reMakePage=function (divid,pageHref,currPage,pageCount,validHref)
  91. {
  92. this.divid=divid;
  93. this.pageHref=pageHref;
  94. this.currPage=currPage;
  95. this.pageCount=pageCount;
  96. this.validHref=validHref;
  97. document.getElementById(divid).innerHTML="";
  98. this.makePage();
  99. };
  100. function writeHtml(divid,str){
  101. //document.getElementById(divid).innerHTML=document.getElementById(divid).innerHTML+str;
  102. $("#"+divid).html($("#"+divid).html()+str);
  103. }

逻辑很简单,可以说算是分页里面的最简单版本了,没有多余的其他控制逻辑,
值根据参数负责显示。
有一个reMakePage方法需要注意,这个是根据参数重新画分页,因为你没点一次
分页的链接,分页都需要变化(你点的那一页选中,有没有上一页,首页等),
所以每点一次必然重画分页,这个方法就是重画分页,在ajax回调方法里要调用这个
方法,当然要给正确的参数,才能保证正确显示。

greenpage.css(没有用到图片,所以样式很容易改,公用性比较强)

[javascript] view plaincopy
  1. DIV.greenpage {
  2. PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM:10px; MARGIN: 3px; PADDING-TOP: 17px; TEXT-ALIGN: center; font-size:12px;
  3. }
  4. DIV.greenpage A {
  5. BORDER-RIGHT: #ddd 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ddd 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #ddd 1px solid; COLOR: #88af3f; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #ddd 1px solid; TEXT-DECORATION: none
  6. }
  7. DIV.greenpage A:hover {
  8. BORDER-RIGHT: #85bd1e 1px solid; BORDER-TOP: #85bd1e 1px solid; BORDER-LEFT: #85bd1e 1px solid; COLOR: #638425; BORDER-BOTTOM: #85bd1e 1px solid; BACKGROUND-COLOR: #f1ffd6
  9. }
  10. DIV.greenpage A:active {
  11. BORDER-RIGHT: #85bd1e 1px solid; BORDER-TOP: #85bd1e 1px solid; BORDER-LEFT: #85bd1e 1px solid; COLOR: #638425; BORDER-BOTTOM: #85bd1e 1px solid; BACKGROUND-COLOR: #f1ffd6
  12. }
  13. DIV.greenpage SPAN.current {
  14. BORDER-RIGHT: #b2e05d 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #b2e05d 1px solid; PADDING-LEFT: 5px;
  15. FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; BORDER-LEFT: #b2e05d 1px solid; COLOR: #fff; MARGIN-RIGHT: 2px; PADDING-TOP: 2px;
  16. BORDER-BOTTOM: #b2e05d 1px solid; BACKGROUND-COLOR: #b2e05d
  17. }
  18. DIV.greenpage SPAN.disabled {
  19. BORDER-RIGHT: #f3f3f3 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f3f3f3 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #f3f3f3 1px solid;
  20. COLOR: #ccc; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #f3f3f3 1px solid
  21. }

项目中使用的一个实例:

insummary.jsp

[html] view plaincopy
  1. <%@ page language="java" contentType="text/html; charset=UTF-8"%>
  2. <%@ taglib uri="/struts-tags" prefix="s"%>
  3. <%@ taglib uri="/WEB-INF/component.tld" prefix="cx"%>
  4. <%@ taglib uri="/WEB-INF/greenpage.tld" prefix="page"%>
  5. <%@ page import="java.util.*" %>
  6. <%@ page import="org.hd.util.ReportUtil" %>
  7. <%@ page import="org.rd.framework.query.support.PaginationSupport" %>
  8. <%
  9. String path = request.getContextPath();
  10. %>
  11. <%
  12. String xmldata="";
  13. if(request.getAttribute("InSummaryData")!=null){
  14. xmldata=(String)request.getAttribute("InSummaryData");
  15. }
  16. String isqueryed="";
  17. if(request.getAttribute("isqueryed")!=null){
  18. isqueryed=(String)request.getAttribute("isqueryed");
  19. }
  20. List tablelist=null;
  21. if(request.getAttribute("InSummaryTableData")!=null){
  22. tablelist=(List)request.getAttribute("InSummaryTableData");
  23. }
  24. PaginationSupport pageset=null;
  25. if(request.getAttribute("pageset")!=null){
  26. pageset=(PaginationSupport)request.getAttribute("pageset");
  27. }else{
  28. pageset=new PaginationSupport(0,0,20);
  29. }
  30. String pathUrl=path+"/report/reportInSummary.action";
  31. %>
  32. <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  33. <html xmlns="http://www.w3.org/1999/xhtml">
  34. <head>
  35. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  36. <title>Single Series Column 2D Chart</title>
  37. <script src="<%=path%>/script/jquery-1.7.1.js" type="text/javascript"></script>
  38. <link href="<%=path%>/resource/hd/css/style2.css" rel="stylesheet" type="text/css" />
  39. <link href="<%=path%>/script/plugin/FusionCharts_Evaluation/Gallery/assets/ui/css/style.css" rel="stylesheet" type="text/css" />
  40. <link href="<%=path%>/script/plugin/FusionCharts_Evaluation/Gallery/assets/prettify/prettify.css" rel="stylesheet" type="text/css" />
  41. <script type="text/javascript" src="<%=path%>/script/plugin/FusionCharts_Evaluation/Charts/FusionCharts.js"></script>
  42. <script type="text/javascript" src="<%=path%>/script/plugin/FusionCharts_Evaluation/Gallery/assets/ui/js/json2.js"></script>
  43. <script type="text/javascript" src="<%=path%>/script/plugin/FusionCharts_Evaluation/Gallery/assets/prettify/prettify.js"></script>
  44. <script type="text/javascript" src="<%=path%>/script/plugin/FusionCharts_Evaluation/Gallery/assets/ui/js/lib.js" ></script>
  45. <script src="<%=path%>/script/plugin/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
  46. <script src="<%=path%>/resource/tool/hometab/Style/menu.js" type="text/javascript"></script>
  47. <link rel="stylesheet" href="<%=path%>/resource/tool/hometab/Style/default.css" type="text/css" />
  48. <script src="<%=path%>/script/hd/greenpage.js" type="text/javascript"></script>
  49. <link rel="stylesheet" href="<%=path%>/script/hd/greenpage.css" type="text/css" />
  50. <script type="text/javascript" src="<%=path%>/script/hd/greenpage.js"></script>
  51. <link href="<%=path%>/script/hd/greenpage.css" rel="stylesheet" type="text/css" />
  52. </script>
  53. <script type="text/javascript">
  54. var divpage=null;
  55. $(document).ready(function(){
  56. divpage=new GreenPage('divpage','',1,1,'0');
  57. divpage.makePage();
  58. });
  59. </script>
  60. </head>
  61. <body style=" overflow-y:scroll;">
  62. <input type="hidden" id="path" value="<%=path%>" />
  63. <input type="hidden" id="xmldata" value='<%=xmldata%>' />
  64. <input type="hidden" id="isqueryed" value='<%=isqueryed%>' />
  65. <div style="width:100%;height:10px"></div>
  66. <h3 style="text-align: center;vertical-align:bottom;padding: 0px,0px,5px,0px; margin: 0px,0px,5px,0px; font-size:14px;color: #0c212b; ">
  67. 报表系统--呼入汇总</h3>
  68. <div style="width:100%;height:10px"></div>
  69. <table width="100%" border="0">
  70. <tr>
  71. <td style="width:100%;">
  72. <div >
  73. <table>
  74. <tr style=" margin: 8px,0px,5px,0px;">
  75. <td style="width:10%"></td>
  76. <td style="width:20%;align:center" id="fromdatetd"><p><font color="#401c44">开始日期: </font><input type="text" id="fromdate"  class="Wdate" onClick="WdatePicker()"></p></td>
  77. <td style="width:20%;align:center" id="todatetd"><p><font color="#401c44">结束日期: </font><input type="text" id="todate"  class="Wdate" onClick="WdatePicker()"></p></td>
  78. <td style="width:5%;align:center"></td>
  79. <td style="width:30%;">
  80. <select id="ritypebox"  name="ritypebox"  style="width: 100px; height: 25px;font-size:14px; color:#401c44;">
  81. <option value='ttian' selected>按日期统计</option>
  82. <option value='dnian' >按年份对比</option>
  83. <option value='djidu' >按季度对比</option>
  84. <option value='dyuefen'>按月份对比</option>
  85. <option value='dtian'>按日期对比</option>
  86. </select>
  87. </td>
  88. <td style="width:5%"><input type="button" id="chaxun" onclick="chaxun()" value="查询"></td>
  89. </tr>
  90. </table>
  91. </div>
  92. </td>
  93. </tr>
  94. <tr>
  95. <td style="width:100%;align:center">
  96. <div id="tablelist" >
  97. <table style="margin : 0px 0px 0px 0px;position: relative;left: 0px;top: 0px;
  98. width="100%"  height="100%" border="0" cellspacing="0" cellpadding="0" id="box_mid">
  99. <tr>
  100. <td class="right"><!--列表-->
  101. <div class="divline2" >
  102. <table width="1100px" border="0" cellspacing="0" cellpadding="0" class="tables2">
  103. <tr >
  104. <th width="8%">日期</th>
  105. <th width="8%">坐席总数</th>
  106. <th width="8%">呼入总数</th>
  107. <th width="8%">总失败次数</th>
  108. <th width="8%">咨询次数</th>
  109. <th width="8%">转移次数 </th>
  110. <th width="8%">总通话时长</th>
  111. <th width="8%">平均通话时长</th>
  112. <th width="8%">平均振铃次数</th>
  113. <th width="8%">平均振铃时长</th>
  114. </tr>
  115. </table>
  116. </div>
  117. <div style="height:200px; overflow-y:none;width:100%;">
  118. <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table4" id="list">
  119. <div id="listdata">
  120. <tr>
  121. <td width="8%"></td>
  122. <td width="8%"></td>
  123. <td width="8%"></td>
  124. <td width="8%"></td>
  125. <td width="8%"></td>
  126. <td width="8%"></td>
  127. <td width="8%"></td>
  128. <td width="8%"></td>
  129. <td width="8%"></td>
  130. <td width="9%"></td>
  131. </tr>
  132. </div>
  133. </table>
  134. <!--列表END--></td>
  135. </tr>
  136. </table>
  137. <div id="divpage" style="align:center"></div>
  138. </div>
  139. </div>
  140. </td>
  141. </tr>
  142. <tr>
  143. <td style="width:100%">
  144. </td>
  145. </tr>
  146. <tr>
  147. <td style="width:100%">
  148. </td>
  149. </tr>
  150. </table>
  151. <table  style="width:100%;align:center">
  152. <tr>
  153. <td style="width:100%;">
  154. <div id="chartdiv11" style="align:center"></div>
  155. </td>
  156. </tr>
  157. <tr>
  158. <td style="width:100%;">
  159. <div id="chartdiv12" style="align:center"></div>
  160. </td>
  161. </tr>
  162. <tr>
  163. <td style="width:100%;">
  164. <div id="chartdiv13" style="align:center"></div>
  165. </td>
  166. </tr>
  167. </table>
  168. <table>
  169. <tr>
  170. <td style="width:50%">
  171. <div id="chartdiv21" style="display:none" align="center"></div>
  172. </td>
  173. <td style="width:50%">
  174. <div id="chartdiv22" style="display:none" align="center"></div>
  175. </td>
  176. </tr>
  177. <tr>
  178. <td style="width:50%">
  179. <div id="chartdiv23" style="display:none" align="center"></div>
  180. </td>
  181. <td style="width:50%">
  182. <div id="chartdiv24" style="display:none" align="center"></div>
  183. </td>
  184. </tr>
  185. </tr>
  186. <tr>
  187. <td style="width:50%">
  188. <div id="chartdiv25" style="display:none" align="center"></div>
  189. </td>
  190. <td style="width:50%">
  191. </td>
  192. </tr>
  193. </table>
  194. </body>
  195. </html>
  196. <script type="text/javascript" src="temp/insummary.js" ></script>
  197. <script type="text/javascript" src="temp/insummary2.js" ></script>
  198. <script type="text/javascript">
  199. var path=document.getElementById("path").value;
  200. var isqueryed=document.getElementById("isqueryed").value;
  201. var xmldata=document.getElementById("xmldata").value;
  202. if (GALLERY_RENDERER && GALLERY_RENDERER.search(/javascript|flash/i)==0)  FusionCharts.setCurrentRenderer(GALLERY_RENDERER);
  203. var chart11 = new FusionCharts("<%=path%>/script/plugin/FusionCharts_Evaluation/Charts/Column3D.swf", "ChartId11", "560", "400", "0", "0");
  204. chart11.setXMLData(dataString11);
  205. chart11.render("chartdiv11");
  206. var chart12 = new FusionCharts("<%=path%>/script/plugin/FusionCharts_Evaluation/Charts/MSColumn3D.swf", "ChartId12", "560", "400", "0", "0");
  207. chart12.setXMLData(dataString12);
  208. chart12.render("chartdiv12");
  209. var chart13 = new FusionCharts("<%=path%>/script/plugin/FusionCharts_Evaluation/Charts/Column3D.swf", "ChartId13", "560", "400", "0", "0");
  210. chart13.setXMLData( dataString13 );
  211. chart13.render("chartdiv13");
  212. //if (GALLERY_RENDERER && GALLERY_RENDERER.search(/javascript|flash/i)==0)  FusionCharts.setCurrentRenderer(GALLERY_RENDERER);
  213. var chart21 = new FusionCharts("<%=path%>/script/plugin/FusionCharts_Evaluation/Charts/MSLine.swf", "ChartId21", "560", "400", "0", "0");
  214. chart21.setXMLData( dataString21 );
  215. chart21.render("chartdiv21");
  216. var chart22 = new FusionCharts("<%=path%>/script/plugin/FusionCharts_Evaluation/Charts/MSLine.swf", "ChartId22", "560", "400", "0", "0");
  217. chart22.setXMLData( dataString22 );
  218. chart22.render("chartdiv22");
  219. var chart23 = new FusionCharts("<%=path%>/script/plugin/FusionCharts_Evaluation/Charts/MSLine.swf", "ChartId23", "560", "400", "0", "0");
  220. chart23.setXMLData( dataString23 );
  221. chart23.render("chartdiv23");
  222. var chart24 = new FusionCharts("<%=path%>/script/plugin/FusionCharts_Evaluation/Charts/MSLine.swf", "ChartId24", "560", "400", "0", "0");
  223. chart24.setXMLData( dataString24 );
  224. chart24.render("chartdiv24");
  225. var chart25 = new FusionCharts("<%=path%>/script/plugin/FusionCharts_Evaluation/Charts/MSLine.swf", "ChartId25", "560", "400", "0", "0");
  226. chart25.setXMLData( dataString25 );
  227. chart25.render("chartdiv25");
  228. $("#ritypebox").change( function() {
  229. // 这里可以写些验证代码
  230. var tt=getRitypeValueBox();
  231. var vv=$("#ritypebox").val();
  232. if($.trim(vv)=="dnian"){
  233. reNewMy97DatePicker("yyyy");
  234. chooseone('d');
  235. }else if($.trim(vv)=="djidu"){
  236. var hh1="<p>年份: <input type=\"text\" id=\"fromdate\"  class=\"Wdate\" onClick=\"WdatePicker({dateFmt:'yyyy'})\"></p>";
  237. var hh2="季度:<select id=\"todate\"  name=\"todate\">"
  238. +"<option value='1' >第一季度</option><option value='2' >第二季度</option>"+
  239. "<option value='3'>第三季度</option>"+
  240. "<option value='4'>第四季度</option>"+
  241. "</select>";
  242. $("#fromdatetd").html(hh1);
  243. $("#todatetd").html(hh2);
  244. chooseone('d');
  245. }else if($.trim(vv)=="dyuefen"){
  246. reNewMy97DatePicker("yyyy-MM");
  247. chooseone('d');
  248. }else if($.trim(vv)=="dtian"){
  249. reNewMy97DatePicker("yyyy-MM-dd");
  250. chooseone('d');
  251. }else if($.trim(vv)=="ttian"){
  252. reNewMy97DatePicker("yyyy-MM-dd");
  253. chooseone('t');
  254. }
  255. });
  256. function reNewMy97DatePicker(fmt){
  257. var hh1="<p>开始日期: <input type=\"text\" id=\"fromdate\"  class=\"Wdate\" onClick=\"WdatePicker({dateFmt:'"+fmt+"'})\"></p>";
  258. var hh2="<p>结束日期: <input type=\"text\" id=\"todate\"  class=\"Wdate\" onClick=\"WdatePicker({dateFmt:'"+fmt+"'})\"></p>";
  259. $("#fromdatetd").html(hh1);
  260. $("#todatetd").html(hh2);
  261. }
  262. function getRitypeValueBox() {
  263. var checkText=$("#ritypebox").find("option:selected").text();
  264. return checkText;
  265. }
  266. function chooseone(t){
  267. if(t=="t"){
  268. $("#tablelist").show();
  269. $("#chartdiv11").show();
  270. $("#chartdiv12").show();
  271. $("#chartdiv13").show();
  272. $("#chartdiv21").hide();
  273. $("#chartdiv22").hide();
  274. $("#chartdiv23").hide();
  275. $("#chartdiv24").hide();
  276. $("#chartdiv25").hide();
  277. }else{
  278. $("#tablelist").hide();
  279. $("#chartdiv11").hide();
  280. $("#chartdiv12").hide();
  281. $("#chartdiv13").hide();
  282. $("#chartdiv21").show();
  283. $("#chartdiv22").show();
  284. $("#chartdiv23").show();
  285. $("#chartdiv24").show();
  286. $("#chartdiv25").show();
  287. }
  288. }
  289. //查询
  290. function chaxun(){
  291. var datetype=$.trim($("#ritypebox").val());
  292. var date1=$("#fromdate").val();
  293. var date2=$("#todate").val();
  294. if($.trim(date1)==""&&$.trim(date2)==""){
  295. alert("请选择查询条件!");
  296. }else{
  297. var urlpath=path+'/report/judgeIsTwoRightDate.action?fromdate='+date1+'&todate='+date2+'&datetype='+datetype;
  298. $.ajax({
  299. type: "POST",
  300. url: urlpath,
  301. success: validateBack
  302. });
  303. }
  304. }
  305. function validateBack(msg){
  306. var mm=$.trim(msg);
  307. if(mm=="NO"){
  308. alert("开始日期不能大于结束日期!");
  309. }else{
  310. var datetype=$.trim($("#ritypebox").val());
  311. var date1=$("#fromdate").val();
  312. var date2=$("#todate").val();
  313. //对比还是统计
  314. if(datetype=="ttian"){
  315. var urlpath=path+'/report/rptInSummaryAll.action?fromdate='+date1+'&todate='+date2+'&datetype='+datetype;
  316. $.ajax({
  317. type: "POST",
  318. url: urlpath,
  319. success: chaxunBackDealData,
  320. dataType:"json"
  321. });
  322. }else{
  323. var urlpath=path+'/report/rptInSummaryCompare.action?fromdate='+date1+'&todate='+date2+'&datetype='+datetype;
  324. $.ajax({
  325. type: "POST",
  326. url: urlpath,
  327. success: chaxunCompareBackDealData,
  328. dataType:"json"
  329. });
  330. }
  331. }
  332. }
  333. function chaxunBackDealData(data){
  334. //var str=eval('('+data+')');
  335. //alert(data.all.page.currPage);
  336. var page=data.all.page;
  337. var listdata=data.all.listdata;
  338. var dataString11=data.all.dataString11.data;
  339. var dataString12=data.all.dataString12.data;
  340. var dataString13=data.all.dataString13.data;
  341. var datetype=$.trim($("#ritypebox").val());
  342. var date1=$("#fromdate").val();
  343. var date2=$("#todate").val();
  344. var url=path+'/report/rptInSummaryPage.action?fromdate='+date1+'&todate='+date2+'&datetype='+datetype;
  345. divpage.reMakePage('divpage',url,page.currPage,page.pageCount,'0');
  346. if(dataString11=="nodata"){
  347. alert("结果集无数据,请选择其它条件!");
  348. }else{
  349. chart11.setXMLData(dataString11);
  350. chart12.setXMLData(dataString12);
  351. chart13.setXMLData(dataString13);
  352. }
  353. var tablehtml="";
  354. for(var i=0;i<listdata.length;i++){
  355. //alert(listdata[i].agent_count);
  356. var agent_count=listdata[i].agent_count;
  357. var avg_long_time=listdata[i].avg_long_time;
  358. var avg_ring_count=listdata[i].avg_ring_count;
  359. var avg_ring_time=listdata[i].avg_ring_time;
  360. var fail_count=listdata[i].fail_count;
  361. var sdf_date=listdata[i].sdf_date;
  362. var sum_consult_count=listdata[i].sum_consult_count;
  363. var sum_long_time=listdata[i].sum_long_time;
  364. var sum_transfer_count=listdata[i].sum_transfer_count;
  365. var voice_count=listdata[i].voice_count;
  366. var htmlstr="<tr>";
  367. htmlstr+="<td width=\"8%\">"+sdf_date+"</td>";
  368. htmlstr+="<td width=\"8%\">"+agent_count+"</td>";
  369. htmlstr+="<td width=\"8%\">"+voice_count+"</td>";
  370. htmlstr+="<td width=\"8%\">"+fail_count+"</td>";
  371. htmlstr+="<td width=\"8%\">"+sum_consult_count+"</td>";
  372. htmlstr+="<td width=\"8%\">"+sum_transfer_count+"</td>";
  373. htmlstr+="<td width=\"8%\">"+sum_long_time+"</td>";
  374. htmlstr+="<td width=\"8%\">"+avg_long_time+"</td>";
  375. htmlstr+="<td width=\"8%\">"+avg_ring_count+"</td>";
  376. htmlstr+="<td width=\"9%\">"+avg_ring_time+"</td>";
  377. htmlstr+="</tr>";
  378. tablehtml+=htmlstr;
  379. }
  380. $("#list").html(tablehtml);
  381. }
  382. function chaxunCompareBackDealData(data){
  383. var dataString21=data.all.dataString21.data;
  384. var dataString22=data.all.dataString22.data;
  385. var dataString23=data.all.dataString23.data;
  386. var dataString24=data.all.dataString24.data;
  387. var dataString25=data.all.dataString25.data;
  388. //alert(dataString21);
  389. if(dataString21=="nodata"){
  390. alert("结果集无数据,请选择其它条件!");
  391. }else{
  392. chart21.setXMLData(dataString21);
  393. chart22.setXMLData(dataString22);
  394. chart23.setXMLData(dataString23);
  395. chart24.setXMLData(dataString24);
  396. chart25.setXMLData(dataString25);
  397. }
  398. }
  399. function pageClickFunc(page){
  400. //alert(divpage.getDivInfo());
  401. var datetype=$.trim($("#ritypebox").val());
  402. var date1=$("#fromdate").val();
  403. var date2=$("#todate").val();
  404. var urlpath=path+'/report/rptInSummaryPage.action?fromdate='+date1+'&todate='+date2+'&datetype='+datetype+"&targetPageNum="+page;
  405. $.ajax({
  406. type: "POST",
  407. url: urlpath,
  408. success: chaxunPageBackDealData,
  409. dataType:"json"
  410. });
  411. }
  412. function chaxunPageBackDealData(data){
  413. var page=data.all.page;
  414. var listdata=data.all.listdata;
  415. var datetype=$.trim($("#ritypebox").val());
  416. var date1=$("#fromdate").val();
  417. var date2=$("#todate").val();
  418. var url=path+'/report/rptInSummaryPage.action?fromdate='+date1+'&todate='+date2+'&datetype='+datetype;
  419. divpage.reMakePage('divpage',url,page.currPage,page.pageCount,'0');
  420. //alert(page.currPage+"-----"+page.pageCount+"--"+listdata);
  421. var tablehtml="";
  422. for(var i=0;i<listdata.length;i++){
  423. //alert(listdata[i].agent_count);
  424. var agent_count=listdata[i].agent_count;
  425. var avg_long_time=listdata[i].avg_long_time;
  426. var avg_ring_count=listdata[i].avg_ring_count;
  427. var avg_ring_time=listdata[i].avg_ring_time;
  428. var fail_count=listdata[i].fail_count;
  429. var sdf_date=listdata[i].sdf_date;
  430. var sum_consult_count=listdata[i].sum_consult_count;
  431. var sum_long_time=listdata[i].sum_long_time;
  432. var sum_transfer_count=listdata[i].sum_transfer_count;
  433. var voice_count=listdata[i].voice_count;
  434. var htmlstr="<tr>";
  435. htmlstr+="<td width=\"8%\">"+sdf_date+"</td>";
  436. htmlstr+="<td width=\"8%\">"+agent_count+"</td>";
  437. htmlstr+="<td width=\"8%\">"+voice_count+"</td>";
  438. htmlstr+="<td width=\"8%\">"+fail_count+"</td>";
  439. htmlstr+="<td width=\"8%\">"+sum_consult_count+"</td>";
  440. htmlstr+="<td width=\"8%\">"+sum_transfer_count+"</td>";
  441. htmlstr+="<td width=\"8%\">"+sum_long_time+"</td>";
  442. htmlstr+="<td width=\"8%\">"+avg_long_time+"</td>";
  443. htmlstr+="<td width=\"8%\">"+avg_ring_count+"</td>";
  444. htmlstr+="<td width=\"9%\">"+avg_ring_time+"</td>";
  445. htmlstr+="</tr>";
  446. tablehtml+=htmlstr;
  447. }
  448. $("#list").html(tablehtml);
  449. }
  450. /*
  451. var xmlurl=path+'/business/changeComeUserInfo.action?jobNumber='+cusid2;
  452. $.ajax({
  453. type: "POST",
  454. url: urlpath,
  455. success: function(msg){
  456. var mm=$.trim(msg);
  457. if(mm=="NO"){
  458. //alert("NO");
  459. }else{
  460. changeUser(mm);
  461. }
  462. }
  463. });
  464. */
  465. </script>

关于分页的使用,有几个地方:

var divpage=null;
$(document).ready(function(){
 divpage=new GreenPage('divpage','',1,1,'0');
 divpage.makePage();
});
divpage要拿到方法外面,因为后面刷新数据,需要这个对象,
初始化方法如上。

<div id="divpage" style="align:center"></div>
对这个div话分页

在ajax回调方法里要有
var url=path+'/report/rptInSummaryPage.action?fromdate='+date1+'&todate='+date2+'&datetype='+datetype;
divpage.reMakePage('divpage',url,page.currPage,page.currPage,'0');

这个就是为了重新画分页currPage,currPage是我用json返回的参数,这个你在后台自己
拼好在这里能取到就可以。

整体的思路就是这样,我的完整实例如下:
(逻辑有些复杂,因为不是为了分页专门写的例子,是项目中的实例)

insummary.jsp如上,
RptInSummaryAction.java

[java] view plaincopy
  1. package org.hd.report.action;
  2. import java.io.PrintWriter;
  3. import java.util.List;
  4. import javax.servlet.http.HttpServletRequest;
  5. import javax.servlet.http.HttpServletResponse;
  6. import org.apache.struts2.ServletActionContext;
  7. import org.hd.report.model.GreenPageVo;
  8. import org.hd.report.service.ReportService;
  9. import org.hd.report.service.RptService;
  10. import org.rd.framework.common.container.ContainerManager;
  11. import org.rd.framework.query.support.PaginationSupport;
  12. import org.rd.framework.struts.action.CommonAction;
  13. import com.opensymphony.xwork2.ActionContext;
  14. //呼入汇总
  15. public class RptInSummaryAction  extends CommonAction{
  16. private RptService rptService = (RptService)ContainerManager.getComponent(RptService.BEAN_ID);
  17. private int targetPageNum;//目标页
  18. private PaginationSupport pageset=new PaginationSupport();
  19. private GreenPageVo greenpage=new GreenPageVo();//分页的设置开关
  20. public String rptInSummaryAll() throws Exception{
  21. ActionContext ctx = ActionContext.getContext();
  22. HttpServletResponse response = (HttpServletResponse) ctx.get(ServletActionContext.HTTP_RESPONSE);
  23. HttpServletRequest request  = (HttpServletRequest) ctx.get(ServletActionContext.HTTP_REQUEST);
  24. response.setCharacterEncoding("UTF-8");
  25. PrintWriter out = response.getWriter();
  26. String fromdate="";
  27. String todate="";
  28. String datetype="";//下拉框5个参数
  29. if(request.getParameter("fromdate")==null||request.getParameter("fromdate").trim().equals("")){
  30. }else{
  31. fromdate=request.getParameter("fromdate").trim();
  32. }
  33. if(request.getParameter("todate")==null||request.getParameter("todate").trim().equals("")){
  34. }else{
  35. todate=request.getParameter("todate").trim();
  36. }
  37. if(request.getParameter("datetype")==null||request.getParameter("datetype").trim().equals("")){
  38. }else{
  39. datetype=request.getParameter("datetype").trim();
  40. }
  41. getGreenpage().setEachItemsOfPage(5);
  42. String xmlData=rptService.getAllDataForInSummary(fromdate, todate, datetype,getGreenpage());
  43. out.println(xmlData);
  44. return NONE;
  45. }
  46. public String rptInSummaryPage() throws Exception{
  47. ActionContext ctx = ActionContext.getContext();
  48. HttpServletResponse response = (HttpServletResponse) ctx.get(ServletActionContext.HTTP_RESPONSE);
  49. HttpServletRequest request  = (HttpServletRequest) ctx.get(ServletActionContext.HTTP_REQUEST);
  50. response.setCharacterEncoding("UTF-8");
  51. PrintWriter out = response.getWriter();
  52. String fromdate="";
  53. String todate="";
  54. String datetype="";//下拉框5个参数
  55. String targetPageNum="";//目标页
  56. if(request.getParameter("targetPageNum")==null||request.getParameter("targetPageNum").trim().equals("")){
  57. }else{
  58. targetPageNum=request.getParameter("targetPageNum").trim();
  59. getGreenpage().setCurrPage(Integer.valueOf(targetPageNum));
  60. }
  61. if(request.getParameter("fromdate")==null||request.getParameter("fromdate").trim().equals("")){
  62. }else{
  63. fromdate=request.getParameter("fromdate").trim();
  64. }
  65. if(request.getParameter("todate")==null||request.getParameter("todate").trim().equals("")){
  66. }else{
  67. todate=request.getParameter("todate").trim();
  68. }
  69. if(request.getParameter("datetype")==null||request.getParameter("datetype").trim().equals("")){
  70. }else{
  71. datetype=request.getParameter("datetype").trim();
  72. }
  73. //设置分页
  74. getGreenpage().setEachItemsOfPage(5);
  75. String xmlData=rptService.getPageJsonForInSummary(fromdate, todate, datetype,getGreenpage());
  76. out.println(xmlData);
  77. return NONE;
  78. }
  79. //对比查询
  80. public String rptInSummaryCompare() throws Exception{
  81. ActionContext ctx = ActionContext.getContext();
  82. HttpServletResponse response = (HttpServletResponse) ctx.get(ServletActionContext.HTTP_RESPONSE);
  83. HttpServletRequest request  = (HttpServletRequest) ctx.get(ServletActionContext.HTTP_REQUEST);
  84. response.setCharacterEncoding("UTF-8");
  85. PrintWriter out = response.getWriter();
  86. String fromdate="";
  87. String todate="";
  88. String datetype="";//下拉框5个参数
  89. if(request.getParameter("fromdate")==null||request.getParameter("fromdate").trim().equals("")){
  90. }else{
  91. fromdate=request.getParameter("fromdate").trim();
  92. }
  93. if(request.getParameter("todate")==null||request.getParameter("todate").trim().equals("")){
  94. }else{
  95. todate=request.getParameter("todate").trim();
  96. }
  97. if(request.getParameter("datetype")==null||request.getParameter("datetype").trim().equals("")){
  98. }else{
  99. datetype=request.getParameter("datetype").trim();
  100. }
  101. String xmlData=rptService.getCompareDataForInSummary(fromdate, todate, datetype);
  102. out.println(xmlData);
  103. return NONE;
  104. }
  105. public String execute() throws Exception{
  106. return SUCCESS;
  107. }
  108. public int getTargetPageNum() {
  109. return targetPageNum;
  110. }
  111. public PaginationSupport getPageset() {
  112. return pageset;
  113. }
  114. public void setTargetPageNum(int targetPageNum) {
  115. this.targetPageNum = targetPageNum;
  116. }
  117. public void setPageset(PaginationSupport pageset) {
  118. this.pageset = pageset;
  119. }
  120. public GreenPageVo getGreenpage() {
  121. return greenpage;
  122. }
  123. public void setGreenpage(GreenPageVo greenpage) {
  124. this.greenpage = greenpage;
  125. }
  126. }

GreenPageVo.java
管理传参,但不控制分页逻辑。
真正管理分页参数传到sql的是PaginationSupport,
因为传参过程只是传递,不需要逻辑,有逻辑的反而会把参数
传丢(因为它判断参数之间关系,你穿过去的不对,它就给你改正,这样参数就传丢了)

[java] view plaincopy
  1. package org.hd.report.model;
  2. import org.rd.framework.query.support.PaginationSupport;
  3. public class GreenPageVo {
  4. private int currPage=0;
  5. private int pageCount=0;
  6. private int eachItemsOfPage=5;
  7. public int getCurrPage() {
  8. return currPage;
  9. }
  10. public int getPageCount() {
  11. return pageCount;
  12. }
  13. public void setCurrPage(int currPage) {
  14. this.currPage = currPage;
  15. }
  16. public void setPageCount(int pageCount) {
  17. this.pageCount = pageCount;
  18. }
  19. public int getEachItemsOfPage() {
  20. return eachItemsOfPage;
  21. }
  22. public void setEachItemsOfPage(int eachItemsOfPage) {
  23. this.eachItemsOfPage = eachItemsOfPage;
  24. }
  25. }

action中有两个请求,一个是查询总数据的数据,包括分页数据;
,另一个是只查询分页列表数据的请求。

实现的底层方法(包括数据查询,拼装,返回)
RptServiceImpl.java

[java] view plaincopy
  1. package org.hd.report.service.impl;
  2. import java.util.ArrayList;
  3. import java.util.HashMap;
  4. import java.util.List;
  5. import java.util.Map;
  6. import org.hd.report.model.GreenPageVo;
  7. import org.hd.report.model.resultvo.InDetailResult;
  8. import org.hd.report.model.resultvo.InsummaryResult;
  9. import org.hd.report.service.RptService;
  10. import org.hd.util.ReportUtil;
  11. import org.rd.framework.dao.impl.CommonServiceImpl;
  12. import org.rd.framework.query.support.PaginationSupport;
  13. public class RptServiceImpl extends CommonServiceImpl implements RptService {
  14. // 点击查询,呼入汇总insummary.sql
  15. public String getAllDataForInSummary(String fromdate, String todate,
  16. String datetype,GreenPageVo page) {
  17. String jsonData = "";
  18. List list = new ArrayList();
  19. String sql = "select vo.* " + " ,con.sum_consult_count  "
  20. + " ,con.sum_transfer_count  " + "  from  " + " ( "
  21. + "   select " + "   sdf_date  "
  22. + "   ,count(distinct a.agent_id) agent_count "
  23. + "   ,count(voice_id) voice_count"
  24. + "   ,sum(decode(a.start_time,null,1,'',1,0)) fail_count"
  25. + "   ,avg(ring_long_time)/60 avg_ring_time"
  26. + "   ,avg(decode(voice_id,null,0,1))/60 avg_ring_count"
  27. + "   ,sum(long_time)/60 sum_long_time "
  28. + "   ,avg(long_time)/60 avg_long_time " + "   from  "
  29. + "   ( " + "     select  "
  30. + " substr(ring_time,0,10) sdf_date "
  31. + "  , t.*   from hd_agent_voice_seq t   " + "  where 1=1  ";
  32. if (fromdate != null && !fromdate.trim().equals("")) {
  33. sql += "   and t.ring_time>='"
  34. + ReportUtil.dealDateByDatetype(fromdate.trim(), datetype,
  35. true, todate) + "'  ";
  36. }
  37. if (todate != null && !todate.trim().equals("")) {
  38. sql += " and t.ring_time<='"
  39. + ReportUtil.dealDateByDatetype(todate.trim(), datetype,
  40. false, todate) + "' ";
  41. }
  42. sql += "  and t.voice_direct_id='0'  "
  43. + "   ) a  "
  44. + "  group by sdf_date "
  45. + " ) vo, "
  46. + " ( "
  47. + "    select  "
  48. + " zc.sdf_consult_date "
  49. + " ,sum(decode(zc.consult_start_time,null,0,'',0,1)) sum_consult_count  "
  50. + " ,sum(decode(zc.transfer_flag,null,0,'',0,0,0,1)) sum_transfer_count "
  51. + " ,sum(decode(zc.conference_start_time,null,0,'',0,1)) sum_conference_count  "
  52. + " ,sum(consult_long_time)/60 sum_consult_time "
  53. + " ,sum(conference_long_time)/60 sum_consult_time "
  54. + " from  "
  55. + " ( "
  56. + " select za.*,substr(consult_start_time,0,10) sdf_consult_date,zb.voice_id bvoice_id  "
  57. + "  from hd_consult_log za , hd_agent_voice_seq zb  "
  58. + "  where za.voice_id=zb.voice_id(+)  ";
  59. if (fromdate != null && !fromdate.trim().equals("")) {
  60. sql += "  and za.consult_start_time>='"
  61. + ReportUtil.dealDateByDatetype(fromdate.trim(), datetype,
  62. true, todate) + "'  ";
  63. }
  64. if (todate != null && !todate.trim().equals("")) {
  65. sql += "   and za.consult_start_time<='"
  66. + ReportUtil.dealDateByDatetype(todate.trim(), datetype,
  67. false, todate) + "' ";
  68. }
  69. sql += "  ) zc  " + "  group by sdf_consult_date " + " ) con  "
  70. + "  where vo.sdf_date=con.sdf_consult_date(+)  "
  71. + "  order by vo.sdf_date ";
  72. System.out.println("getAllListForInSummary--" + sql);
  73. list = this.queryNativeSQL(sql);
  74. jsonData = this.getAllJsonForInSummaryByList(list,page);
  75. return jsonData;
  76. }
  77. // 列表,分页,报表 的数据
  78. public String getAllJsonForInSummaryByList(List list,GreenPageVo page) {
  79. String res = "";
  80. // "page":{"currPage":"6","pageCount":"67"}
  81. String pageJson = "";
  82. // [{"agent_count":"12","avg_long_time":"345"},{}]
  83. String listJson = "\"listdata\":[";
  84. String dataString11 = "";
  85. String dataString12 = "";
  86. String dataString13 = "";
  87. String rptJson11 = "<chart caption='呼入总数 ' palette='2' xAxisName='' yAxisName='单位:个' "
  88. + "formatNumberScale='0' numberPrefix='' labeldisplay='ROTATE' slantLabels='1'"
  89. + " sNumberSuffix=' pcs.' showLabels='1' showValues='1' labelDisplay='STAGGER'>";
  90. String rptJson11Set = "";
  91. String rptJson12 = "<chart caption='平均值比对' XAxisName='' palette='2' animation='1' "
  92. + "formatNumberScale='0' numberPrefix='' showValues='1' numDivLines='4' "
  93. + "legendPosition='BOTTOM'>";
  94. String rptJson12categories = "<categories>";
  95. String rptJson12dataset1 = "<dataset seriesName='平均振铃时长'>";
  96. String rptJson12dataset2 = "<dataset seriesName='平均通话时长'>";
  97. String rptJson13 = "<chart caption='呼损率' palette='2' formatNumberScale='0' xAxisName=''"
  98. + " yAxisName='单位:百分比' numberSuffix='%' numberPrefix='' labeldisplay='ROTATE' "
  99. + "slantLabels='1' sNumberSuffix=' pcs.' showValues='1' labelDisplay='STAGGER'>";
  100. String rptJson13set = "";
  101. if (list != null) {
  102. // 分页显示数据
  103. pageJson = "\"page\":{\"currPage\":\"1\",\"pageCount\":\""
  104. + (ReportUtil.getPageCountByDivide(list.size(), page.getEachItemsOfPage())) + "\"}";
  105. int f = 1;
  106. boolean dataset = false;
  107. for (int i = 0; i < list.size(); i++) {
  108. Object[] o1 = (Object[]) list.get(i);
  109. if (o1 != null && o1.length >= 10) {
  110. String sdf_date = ReportUtil.objectToString(o1[0]);
  111. String agent_count = ReportUtil.objectToString(o1[1]);
  112. agent_count=ReportUtil.getNumberFormatForCount(agent_count);
  113. String voice_count = ReportUtil.objectToString(o1[2]);
  114. voice_count=ReportUtil.getNumberFormatForCount(voice_count);
  115. String fail_count = ReportUtil.objectToString(o1[3]);
  116. fail_count=ReportUtil.getNumberFormatForCount(fail_count);
  117. String avg_ring_time = ReportUtil.objectToString(o1[4]);
  118. String avg_ring_count = ReportUtil.objectToString(o1[5]);
  119. avg_ring_count=ReportUtil.getNumberFormatForCount(avg_ring_count);
  120. String sum_long_time = ReportUtil.objectToString(o1[6]);
  121. String avg_long_time = ReportUtil.objectToString(o1[7]);
  122. String sum_consult_count = ReportUtil.objectToString(o1[8]);
  123. sum_consult_count=ReportUtil.getNumberFormatForCount(sum_consult_count);
  124. String sum_transfer_count = ReportUtil
  125. .objectToString(o1[9]);
  126. sum_transfer_count=ReportUtil.getNumberFormatForCount(sum_transfer_count);
  127. // 列表数据
  128. InsummaryResult is = new InsummaryResult(sdf_date,
  129. agent_count, voice_count, fail_count,
  130. avg_ring_time, avg_ring_count, sum_long_time,
  131. avg_long_time, sum_consult_count,
  132. sum_transfer_count);
  133. // {"agent_count":"12","avg_long_time":"345","avg_ring_count":"","avg_ring_time":"","fail_count":"","sdf_date":"","sum_consult_count":"","sum_long_time":"","sum_transfer_count":"","voice_count":""}
  134. String isJson = ReportUtil.getJsonFromObject(is);
  135. if(i<page.getEachItemsOfPage()){
  136. if (f == 1) {
  137. listJson += isJson;
  138. else {
  139. listJson += "," + isJson;
  140. }
  141. }
  142. f++;
  143. // 报表dataString11的数据
  144. rptJson11Set += "<set label='" + sdf_date + "' value='"
  145. + voice_count + "' />";
  146. // 报表dataString12的数据
  147. rptJson12categories += "<category label='" + sdf_date
  148. + "' />";
  149. rptJson12dataset1 += "<set value='" + avg_ring_time
  150. + "' />";
  151. rptJson12dataset2 += "<set value='" + avg_long_time
  152. + "' />";
  153. // 报表dataString13的数据
  154. rptJson13set += "<set label='"
  155. + sdf_date
  156. + "' value='"
  157. + ReportUtil.getTwoStrDivision(fail_count,
  158. voice_count) + "' />";
  159. }// end if
  160. dataset = true;
  161. }// end for
  162. listJson += "]";
  163. rptJson11 += rptJson11Set;
  164. rptJson11 += "<styles>"
  165. + "<definition><style type='font' name='CaptionFont' size='15' color='666666' />"
  166. + "<style type='font' name='SubCaptionFont' bold='0' />"
  167. + "</definition><application>"
  168. + "<apply toObject='caption' styles='CaptionFont' />"
  169. + "<apply toObject='SubCaption' styles='SubCaptionFont' />"
  170. + "</application>" + "</styles>" + "</chart>'";
  171. rptJson12categories += "</categories>";
  172. rptJson12dataset1 += "</dataset>";
  173. rptJson12dataset2 += "</dataset>";
  174. rptJson12 += rptJson12categories;
  175. rptJson12 += rptJson12dataset1;
  176. rptJson12 += rptJson12dataset2;
  177. rptJson12 += "<styles>"
  178. + "<definition>"
  179. + "<style type='font' name='CaptionFont' color='666666' size='15' />"
  180. + "<style type='font' name='SubCaptionFont' bold='0' />"
  181. + "</definition><application>"
  182. + "<apply toObject='caption' styles='CaptionFont' />"
  183. + "<apply toObject='SubCaption' styles='SubCaptionFont' />"
  184. + "</application>" + "</styles>" + "</chart>'";
  185. rptJson13 += rptJson13set;
  186. rptJson13 += "<styles>"
  187. + "<definition><style type='font' name='CaptionFont' size='15' color='666666' />"
  188. + "<style type='font' name='SubCaptionFont' bold='0' />"
  189. + "</definition><application>"
  190. + "<apply toObject='caption' styles='CaptionFont' />"
  191. + "<apply toObject='SubCaption' styles='SubCaptionFont' />"
  192. + "</application>" + "</styles></chart>'";
  193. // {"dataString11":"xxxxx"}
  194. if (dataset) {
  195. dataString11 += "\"dataString11\":{\"data\":\"" + rptJson11
  196. + "\"}";
  197. dataString12 += "\"dataString12\":{\"data\":\"" + rptJson12
  198. + "\"}";
  199. dataString13 += "\"dataString13\":{\"data\":\"" + rptJson13
  200. + "\"}";
  201. else {
  202. dataString11 += "\"dataString11\":{\"data\":\"nodata\"}";
  203. dataString12 += "\"dataString12\":{\"data\":\"nodata\"}";
  204. dataString13 += "\"dataString13\":{\"data\":\"nodata\"}";
  205. }
  206. // [{"agent_count":"12","avg_long_time":"345"},{}]
  207. res += "{\"all\":{" + pageJson + "," + listJson + ","
  208. + dataString11 + "," + dataString12 + "," + dataString13
  209. + "}}";
  210. System.out.println("json结果:\n" + res);
  211. }// end if
  212. return res;
  213. }
  214. // 分页某一页的数据
  215. public String getPageJsonForInSummary(String fromdate, String todate,
  216. String datetype, GreenPageVo page) {
  217. String jsonData = "";
  218. List list = new ArrayList();
  219. String sql = "select vo.* " + " ,con.sum_consult_count  "
  220. + " ,con.sum_transfer_count  " + "  from  " + " ( "
  221. + "   select " + "   sdf_date  "
  222. + "   ,count(distinct a.agent_id) agent_count "
  223. + "   ,count(voice_id) voice_count"
  224. + "   ,sum(decode(a.start_time,null,1,'',1,0)) fail_count"
  225. + "   ,avg(ring_long_time)/60 avg_ring_time"
  226. + "   ,avg(decode(voice_id,null,0,1)) avg_ring_count"
  227. + "   ,sum(long_time)/60 sum_long_time "
  228. + "   ,avg(long_time)/60 avg_long_time " + "   from  "
  229. + "   ( " + "     select  "
  230. + " substr(ring_time,0,10) sdf_date "
  231. + "  , t.*   from hd_agent_voice_seq t   " + "  where 1=1  ";
  232. if (fromdate != null && !fromdate.trim().equals("")) {
  233. sql += "   and t.ring_time>='"
  234. + ReportUtil.dealDateByDatetype(fromdate.trim(), datetype,
  235. true, todate) + "'  ";
  236. }
  237. if (todate != null && !todate.trim().equals("")) {
  238. sql += " and t.ring_time<='"
  239. + ReportUtil.dealDateByDatetype(todate.trim(), datetype,
  240. false, todate) + "' ";
  241. }
  242. sql += "  and t.voice_direct_id='0'  "
  243. + "   ) a  "
  244. + "  group by sdf_date "
  245. + " ) vo, "
  246. + " ( "
  247. + "    select  "
  248. + " zc.sdf_consult_date "
  249. + " ,sum(decode(zc.consult_start_time,null,0,'',0,1)) sum_consult_count  "
  250. + " ,sum(decode(zc.transfer_flag,null,0,'',0,0,0,1)) sum_transfer_count "
  251. + " ,sum(decode(zc.conference_start_time,null,0,'',0,1)) sum_conference_count  "
  252. + " ,sum(consult_long_time)/60 sum_consult_time "
  253. + " ,sum(conference_long_time)/60 sum_consult_time "
  254. + " from  "
  255. + " ( "
  256. + " select za.*,substr(consult_start_time,0,10) sdf_consult_date,zb.voice_id bvoice_id  "
  257. + "  from hd_consult_log za , hd_agent_voice_seq zb  "
  258. + "  where za.voice_id=zb.voice_id(+)  ";
  259. if (fromdate != null && !fromdate.trim().equals("")) {
  260. sql += "  and za.consult_start_time>='"
  261. + ReportUtil.dealDateByDatetype(fromdate.trim(), datetype,
  262. true, todate) + "'  ";
  263. }
  264. if (todate != null && !todate.trim().equals("")) {
  265. sql += "   and za.consult_start_time<='"
  266. + ReportUtil.dealDateByDatetype(todate.trim(), datetype,
  267. false, todate) + "' ";
  268. }
  269. sql += "  ) zc  " + "  group by sdf_consult_date " + " ) con  "
  270. + "  where vo.sdf_date=con.sdf_consult_date(+)  "
  271. + "  order by vo.sdf_date ";
  272. System.out.println("getAllListForInSummary--" + sql);
  273. String countSql = "select count(sdf_date) countNumber " + "  from  ("
  274. + sql + " )";
  275. List listCount = new ArrayList();
  276. listCount = this.queryNativeSQL(countSql);
  277. PaginationSupport pageset=new PaginationSupport();
  278. pageset.setTotalCount(this.getCountNumberFromList(listCount));// 记录总数
  279. pageset.setCountOnEachPage(page.getEachItemsOfPage());
  280. pageset.setPage(page.getCurrPage());
  281. list = this.queryNativeSQL(sql, pageset);
  282. jsonData = this.getPageJsonForInSummaryByList(list, pageset);
  283. return jsonData;
  284. }
  285. public int getCountNumberFromList(List list) {
  286. int a = 0;
  287. if (list == null) {
  288. else {
  289. Object o1 = (Object) list.get(0);
  290. String cc = ReportUtil.objectToString(o1);
  291. String cc2=ReportUtil.getNumberFormatForCount(cc);
  292. a = Integer.valueOf(cc2);
  293. System.out.println("getCount--" + a);
  294. }
  295. return a;
  296. }
  297. // 列表,分页,报表 的数据
  298. public String getPageJsonForInSummaryByList(List list,
  299. PaginationSupport pageset) {
  300. String res = "";
  301. // "page":{"currPage":"6","pageCount":"67"}
  302. String pageJson = "";
  303. // [{"agent_count":"12","avg_long_time":"345"},{}]
  304. String listJson = "\"listdata\":[";
  305. if (list != null) {
  306. // 分页显示数据
  307. pageJson = "\"page\":{\"currPage\":\"" + pageset.getPage()
  308. + "\",\"pageCount\":\"" + pageset.getPageCount() + "\"}";
  309. int f = 1;
  310. for (int i = 0; i < list.size(); i++) {
  311. Object[] o1 = (Object[]) list.get(i);
  312. if (o1 != null && o1.length >= 10) {
  313. String sdf_date = ReportUtil.objectToString(o1[0]);
  314. String agent_count = ReportUtil.objectToString(o1[1]);
  315. agent_count=ReportUtil.getNumberFormatForCount(agent_count);
  316. String voice_count = ReportUtil.objectToString(o1[2]);
  317. voice_count=ReportUtil.getNumberFormatForCount(voice_count);
  318. String fail_count = ReportUtil.objectToString(o1[3]);
  319. fail_count=ReportUtil.getNumberFormatForCount(fail_count);
  320. String avg_ring_time = ReportUtil.objectToString(o1[4]);
  321. String avg_ring_count = ReportUtil.objectToString(o1[5]);
  322. avg_ring_count=ReportUtil.getNumberFormatForCount(avg_ring_count);
  323. String sum_long_time = ReportUtil.objectToString(o1[6]);
  324. String avg_long_time = ReportUtil.objectToString(o1[7]);
  325. String sum_consult_count = ReportUtil.objectToString(o1[8]);
  326. sum_consult_count=ReportUtil.getNumberFormatForCount(sum_consult_count);
  327. String sum_transfer_count = ReportUtil
  328. .objectToString(o1[9]);
  329. sum_transfer_count=ReportUtil.getNumberFormatForCount(sum_transfer_count);
  330. // 列表数据
  331. InsummaryResult is = new InsummaryResult(sdf_date,
  332. agent_count, voice_count, fail_count,
  333. avg_ring_time, avg_ring_count, sum_long_time,
  334. avg_long_time, sum_consult_count,
  335. sum_transfer_count);
  336. // {"agent_count":"12","avg_long_time":"345","avg_ring_count":"","avg_ring_time":"","fail_count":"","sdf_date":"","sum_consult_count":"","sum_long_time":"","sum_transfer_count":"","voice_count":""}
  337. String isJson = ReportUtil.getJsonFromObject(is);
  338. if (f == 1) {
  339. listJson += isJson;
  340. else {
  341. listJson += "," + isJson;
  342. }
  343. f++;
  344. }// end if
  345. }// end for
  346. listJson += "]";
  347. // [{"agent_count":"12","avg_long_time":"345"},{}]
  348. res += "{\"all\":{" + pageJson + "," + listJson + "}}";
  349. System.out.println("分页json结果:\n" + res);
  350. }// end if
  351. return res;
  352. }
  353. // 对比查询
  354. public String getCompareDataForInSummary(String fromdate, String todate,
  355. String datetype) {
  356. String jsonData = "";
  357. List list = new ArrayList();
  358. String sql = "select vo.* " + " ,con.sum_consult_count  "
  359. + " ,con.sum_transfer_count  " + "  from  " + " ( "
  360. + "   select " + "   sdf_date  "
  361. + "   ,count(distinct a.agent_id) agent_count "
  362. + "   ,count(voice_id) voice_count"
  363. + "   ,sum(decode(a.start_time,null,1,'',1,0)) fail_count"
  364. + "   ,avg(ring_long_time)/60 avg_ring_time"
  365. + "   ,avg(decode(voice_id,null,0,1)) avg_ring_count"
  366. + "   ,sum(long_time)/60 sum_long_time "
  367. + "   ,avg(long_time)/60 avg_long_time " + "   from  "
  368. + "   ( " + "     select  ";
  369. sql += this.getSubStrDate(datetype);
  370. sql += "  , t.*   from hd_agent_voice_seq t   " + "  where 1=1  ";
  371. if (fromdate != null && !fromdate.trim().equals("")) {
  372. sql += "   and t.ring_time>='"
  373. + ReportUtil.dealDateByDatetype(fromdate.trim(), datetype,
  374. true, todate) + "'  ";
  375. }
  376. if (todate != null && !todate.trim().equals("")) {
  377. sql += " and t.ring_time<='"
  378. + ReportUtil.dealDateByDatetype(todate.trim(), datetype,
  379. false, todate) + "' ";
  380. }
  381. sql += "  and t.voice_direct_id='0'  "
  382. + "   ) a  "
  383. + "  group by sdf_date "
  384. + " ) vo, "
  385. + " ( "
  386. + "    select  "
  387. + " zc.sdf_consult_date "
  388. + " ,sum(decode(zc.consult_start_time,null,0,'',0,1)) sum_consult_count  "
  389. + " ,sum(decode(zc.transfer_flag,null,0,'',0,0,0,1)) sum_transfer_count "
  390. + " ,sum(decode(zc.conference_start_time,null,0,'',0,1)) sum_conference_count  "
  391. + " ,sum(consult_long_time)/60 sum_consult_time "
  392. + " ,sum(conference_long_time)/60 sum_consult_time "
  393. + " from  "
  394. + " ( "
  395. + " select za.*,substr(consult_start_time,0,10) sdf_consult_date,zb.voice_id bvoice_id  "
  396. + "  from hd_consult_log za , hd_agent_voice_seq zb  "
  397. + "  where za.voice_id=zb.voice_id(+)  ";
  398. if (fromdate != null && !fromdate.trim().equals("")) {
  399. sql += "  and za.consult_start_time>='"
  400. + ReportUtil.dealDateByDatetype(fromdate.trim(), datetype,
  401. true, todate) + "'  ";
  402. }
  403. if (todate != null && !todate.trim().equals("")) {
  404. sql += "   and za.consult_start_time<='"
  405. + ReportUtil.dealDateByDatetype(todate.trim(), datetype,
  406. false, todate) + "' ";
  407. }
  408. sql += "  ) zc  " + "  group by sdf_consult_date " + " ) con  "
  409. + "  where vo.sdf_date=con.sdf_consult_date(+)  "
  410. + "  order by vo.sdf_date ";
  411. System.out.println("getAllListForInSummary--" + sql);
  412. list = this.queryNativeSQL(sql);
  413. jsonData = this.getCompareJsonForInSummaryByList(list);
  414. return jsonData;
  415. }
  416. public String getSubStrDate(String datetype) {
  417. String sub = "   substr(ring_time,0,10) sdf_date ";
  418. // substr(ring_time,0,10) sdf_date --按天
  419. // --substr(ring_time,0,4) sdf_date --按年
  420. // -- substr(ring_time,0,7) sdf_date --按月份
  421. if (datetype == null) {
  422. else if (datetype.trim().equals("")) {
  423. else {
  424. String dd = datetype.trim();
  425. if (dd.equals("dtian")) {
  426. sub = "  substr(ring_time,0,10) sdf_date ";
  427. else if (dd.equals("djidu") || dd.equals("dyuefen")) {
  428. sub = "  substr(ring_time,0,7) sdf_date ";
  429. else if (dd.equals("dnian")) {
  430. sub = "  substr(ring_time,0,4) sdf_date ";
  431. }
  432. }
  433. return sub;
  434. }
  435. // 折线的json
  436. public String getCompareJsonForInSummaryByList(List list) {
  437. String res = "";
  438. // 第一张折线图--呼叫总数
  439. String dataString21 = "";
  440. String rpt21 = "<chart canvasPadding='10' caption='呼叫总数' yAxisName='单位:个' formatNumberScale='0' "
  441. + " bgColor='F7F7F7, E9E9E9' numVDivLines='10' divLineAlpha='30' "
  442. + " labelPadding ='30' yAxisValuesPadding ='30' showValues='1' rotateValues='2' valuePosition='auto'>";
  443. String categories21 = "<categories>";
  444. String dataset211 = "<dataset seriesName='呼叫总数' color='F6BD0F'>";
  445. // 第二张折线图--总通话时长
  446. String dataString22 = "<chart canvasPadding='10' caption='总通话时长' yAxisName='单位:分钟'"
  447. + " formatNumberScale='0'  bgColor='F7F7F7, E9E9E9'"
  448. + " numVDivLines='10' divLineAlpha='30'  labelPadding ='30' yAxisValuesPadding ='30' "
  449. + "showValues='1' rotateValues='2' valuePosition='auto'>";
  450. String rpt22 = "";
  451. String categories22 = "<categories>";
  452. String dataset221 = "<dataset seriesName='总通话时长' color='F6BD0F'>";
  453. // 第三张折线图--平均振铃时长
  454. String dataString23 = "<chart canvasPadding='10' caption='平均振铃时长' yAxisName='单位:分钟'"
  455. + " formatNumberScale='0'  bgColor='F7F7F7, E9E9E9'"
  456. + " numVDivLines='10' divLineAlpha='30'  labelPadding ='30' yAxisValuesPadding ='30' "
  457. + "showValues='1' rotateValues='2' valuePosition='auto'>";
  458. String rpt23 = "";
  459. String categories23 = "<categories>";
  460. String dataset231 = "<dataset seriesName='平均振铃时长' color='F6BD0F'>";
  461. // 第四张折线图--平均通话时长
  462. String dataString24 = "<chart canvasPadding='10' caption='平均通话时长' yAxisName='单位:分钟'"
  463. + " formatNumberScale='0'  bgColor='F7F7F7, E9E9E9'"
  464. + " numVDivLines='10' divLineAlpha='30'  labelPadding ='30' yAxisValuesPadding ='30' "
  465. + "showValues='1' rotateValues='2' valuePosition='auto'>";
  466. String rpt24 = "";
  467. String categories24 = "<categories>";
  468. String dataset241 = "<dataset seriesName='平均通话时长' color='F6BD0F'>";
  469. // 第五张折线图--呼损率
  470. String dataString25 = "<chart canvasPadding='10' caption='呼损率' yAxisName='单位:%' "
  471. + " numberSuffix='%'  formatNumberScale='0'  bgColor='F7F7F7, E9E9E9' "
  472. + "numVDivLines='10' divLineAlpha='30'  labelPadding ='30' yAxisValuesPadding ='30' "
  473. + "showValues='1' rotateValues='2' valuePosition='auto'>";
  474. String rpt25 = "";
  475. String categories25 = "<categories>";
  476. String dataset251 = "<dataset seriesName='呼损率' color='F6BD0F'>";
  477. if (list != null) {
  478. int f = 1;
  479. // 平均线的值
  480. double line_voice_count = 0;
  481. double line_sum_long_time = 0;
  482. double line_avg_ring_time = 0;
  483. double line_avg_long_time = 0;
  484. double line_husunlv = 0;
  485. boolean dataset = false;
  486. // boolean dataset_sum_long_time=false;
  487. // boolean dataset_avg_ring_time=false;
  488. // boolean dataset_avg_long_time=false;
  489. for (int i = 0; i < list.size(); i++) {
  490. Object[] o1 = (Object[]) list.get(i);
  491. if (o1 != null && o1.length >= 10) {
  492. String sdf_date = ReportUtil.objectToString(o1[0]);
  493. String agent_count = ReportUtil.objectToString(o1[1]);
  494. agent_count=ReportUtil.getNumberFormatForCount(agent_count);
  495. String voice_count = ReportUtil.objectToString(o1[2]);
  496. voice_count=ReportUtil.getNumberFormatForCount(voice_count);
  497. String fail_count = ReportUtil.objectToString(o1[3]);
  498. fail_count=ReportUtil.getNumberFormatForCount(fail_count);
  499. String avg_ring_time = ReportUtil.objectToString(o1[4]);
  500. String avg_ring_count = ReportUtil.objectToString(o1[5]);
  501. avg_ring_count=ReportUtil.getNumberFormatForCount(avg_ring_count);
  502. String sum_long_time = ReportUtil.objectToString(o1[6]);
  503. String avg_long_time = ReportUtil.objectToString(o1[7]);
  504. String sum_consult_count = ReportUtil.objectToString(o1[8]);
  505. sum_consult_count=ReportUtil.getNumberFormatForCount(sum_consult_count);
  506. String sum_transfer_count = ReportUtil
  507. .objectToString(o1[9]);
  508. sum_transfer_count=ReportUtil.getNumberFormatForCount(sum_transfer_count);
  509. categories21 += "<category label='" + sdf_date + "' />";
  510. dataset211 += "<set value='" + voice_count + "' />";
  511. categories22 += "<category label='" + sdf_date + "' />";
  512. dataset221 += "<set value='" + sum_long_time + "' />";
  513. categories23 += "<category label='" + sdf_date + "' />";
  514. dataset231 += "<set value='" + avg_ring_time + "' />";
  515. categories24 += "<category label='" + sdf_date + "' />";
  516. dataset241 += "<set value='" + avg_long_time + "' />";
  517. categories25 += "<category label='" + sdf_date + "' /> ";
  518. dataset251 += "<set value='"
  519. + ReportUtil.getTwoStrDivision(fail_count,
  520. voice_count) + "' /> ";
  521. line_voice_count = ReportUtil.getSumLeijiDouble(
  522. line_voice_count, voice_count);
  523. line_sum_long_time = ReportUtil.getSumLeijiDouble(
  524. line_sum_long_time, sum_long_time);
  525. line_avg_ring_time = ReportUtil.getSumLeijiDouble(
  526. line_avg_ring_time, avg_ring_time);
  527. line_avg_long_time = ReportUtil.getSumLeijiDouble(
  528. line_avg_long_time, avg_long_time);
  529. line_husunlv = ReportUtil.getSumLeijiDouble(line_husunlv,
  530. ReportUtil.getTwoStrDivision(fail_count,
  531. voice_count));
  532. }// end if
  533. f++;
  534. dataset = true;
  535. }// end for
  536. line_voice_count = ReportUtil.getAvgLeijiDouble(line_voice_count,
  537. (f - 1));
  538. line_sum_long_time = ReportUtil.getAvgLeijiDouble(
  539. line_sum_long_time, (f - 1));
  540. line_avg_ring_time = ReportUtil.getAvgLeijiDouble(
  541. line_avg_ring_time, (f - 1));
  542. line_avg_long_time = ReportUtil.getAvgLeijiDouble(
  543. line_avg_long_time, (f - 1));
  544. line_husunlv = ReportUtil.getAvgLeijiDouble(line_husunlv, (f - 1));
  545. categories21 += "</categories>";
  546. dataset211 += "</dataset>";
  547. rpt21 += categories21 + dataset211;
  548. rpt21 += "<trendlines><line startValue='"
  549. + line_voice_count
  550. + "' displayValue='Average:"
  551. + line_voice_count
  552. + "' color='009900' valueOnRight='1' /></trendlines></chart>";
  553. dataString21 += rpt21;
  554. if (dataset) {
  555. dataString21 = "\"dataString21\":{\"data\":\"" + dataString21
  556. + "\"}";
  557. else {
  558. dataString21 = "\"dataString21\":{\"data\":\"nodata\"}";
  559. }
  560. // //
  561. categories22 += "</categories>";
  562. dataset221 += "</dataset>";
  563. rpt22 += categories22;
  564. rpt22 += dataset221;
  565. rpt22 += "<trendlines><line startValue='"
  566. + line_sum_long_time
  567. + "' displayValue='Average:"
  568. + line_sum_long_time
  569. + "' color='009900' valueOnRight='1' /></trendlines></chart>";
  570. dataString22 += rpt22;
  571. if (dataset) {
  572. dataString22 = "\"dataString22\":{\"data\":\"" + dataString22
  573. + "\"}";
  574. else {
  575. dataString22 = "\"dataString22\":{\"data\":\"nodata\"}";
  576. }
  577. // ///
  578. categories23 += "</categories>";
  579. dataset231 += "</dataset>";
  580. rpt23 += categories23;
  581. rpt23 += dataset231;
  582. rpt23 += "<trendlines><line startValue='"
  583. + line_avg_ring_time
  584. + "' displayValue='Average:"
  585. + line_avg_ring_time
  586. + "' color='009900' valueOnRight='1' /></trendlines></chart>";
  587. dataString23 += rpt23;
  588. if (dataset) {
  589. dataString23 = "\"dataString23\":{\"data\":\"" + dataString23
  590. + "\"}";
  591. else {
  592. dataString23 = "\"dataString23\":{\"data\":\"nodata\"}";
  593. }
  594. // ///
  595. categories24 += "</categories>";
  596. dataset241 += "</dataset>";
  597. rpt24 += categories24;
  598. rpt24 += dataset241;
  599. rpt24 += "<trendlines><line startValue='"
  600. + line_avg_long_time
  601. + "' displayValue='Average:"
  602. + line_avg_long_time
  603. + "' color='009900' valueOnRight='1' /></trendlines></chart>";
  604. dataString24 += rpt24;
  605. if (dataset) {
  606. dataString24 = "\"dataString24\":{\"data\":\"" + dataString24
  607. + "\"}";
  608. else {
  609. dataString24 = "\"dataString24\":{\"data\":\"nodata\"}";
  610. }
  611. //
  612. categories25 += "</categories>";
  613. dataset251 += "</dataset>";
  614. rpt25 += categories25;
  615. rpt25 += dataset251;
  616. rpt25 += "<trendlines><line startValue='"
  617. + line_husunlv
  618. + "' displayValue='Average:"
  619. + line_husunlv
  620. + "' color='009900' valueOnRight='1' /></trendlines></chart>";
  621. dataString25 += rpt25;
  622. if (dataset) {
  623. dataString25 = "\"dataString25\":{\"data\":\"" + dataString25
  624. + "\"}";
  625. else {
  626. dataString25 = "\"dataString25\":{\"data\":\"nodata\"}";
  627. }
  628. // [{"agent_count":"12","avg_long_time":"345"},{}]
  629. res += "{\"all\":{" + dataString21 + "," + dataString22 + ","
  630. + dataString23 + "," + dataString24 + "," + dataString25
  631. + "}}";
  632. System.out.println("折线json结果:\n" + res);
  633. }// end if
  634. return res;
  635. }
  636. // ///明细开始/
  637. // 点击查询,明细sql
  638. public String getAllDataForInDetail(String fromdate, String todate,
  639. String datetype,GreenPageVo page) {
  640. String jsonData = "";
  641. List list = new ArrayList();
  642. String sql = " select "
  643. + " agent_name  "
  644. + "  ,count(voice_id) voice_count "
  645. + " ,sum(decode(a.start_time,null,1,'',1,0)) fail_count "
  646. + " ,count(voice_id)-sum(decode(a.start_time,null,1,'',1,0)) success_count "
  647. + " ,sum(long_time)/60 sum_long_time "
  648. + " ,avg(long_time)/60 avg_long_time "
  649. + " ,avg(ring_long_time)/60 avg_ring_time "
  650. + " ,avg(decode(voice_id,null,0,1)) avg_ring_count "
  651. + "   from  " + "   ( " + " select  "
  652. + "  t.*   from hd_agent_voice_seq t  " + " where 1=1  ";
  653. if (fromdate != null && !fromdate.trim().equals("")) {
  654. sql += "   and t.ring_time>='"
  655. + ReportUtil.dealDateByDatetype(fromdate.trim(), datetype,
  656. true, todate) + "'  ";
  657. }
  658. if (todate != null && !todate.trim().equals("")) {
  659. sql += " and t.ring_time<='"
  660. + ReportUtil.dealDateByDatetype(todate.trim(), datetype,
  661. false, todate) + "' ";
  662. }
  663. sql += "  and t.voice_direct_id='0'  " + "  ) a  "
  664. + " group by agent_name ";
  665. System.out.println("getAllDataForInDetail--" + sql);
  666. list = this.queryNativeSQL(sql);
  667. jsonData = this.getAllJsonForInDetailByList(list,page);
  668. return jsonData;
  669. }
  670. public String getAllJsonForInDetailByList(List list,GreenPageVo page){
  671. String res="";
  672. //"page":{"currPage":"6","pageCount":"67"}
  673. String pageJson="";
  674. //[{"agent_count":"12","avg_long_time":"345"},{}]
  675. String listJson="\"listdata\":[";
  676. String dataString11="";
  677. String dataString12="";
  678. String dataString13="";
  679. String dataString14="";
  680. String dataString15="";
  681. String rptJson11="<chart palette='2' caption='呼入总数--通话次数--呼损次数' " +
  682. "showLabels='1' showvalues='0'  numberPrefix='' showSum='1' " +
  683. "decimals='0' useRoundEdges='1' legendBorderAlpha='0' formatNumberScale='0'>";
  684. String rptJson11categories="<categories>";
  685. String rptJson11Set1="<dataset seriesName='呼入总数' color='AFD8F8' showValues='0'>";
  686. String rptJson11Set2="<dataset seriesName='通话次数 ' color='F6BD0F' showValues='0'>";
  687. String rptJson11Set3="<dataset seriesName='呼损次数' color='8BBA00' showValues='0'>";
  688. String rptJson12="<chart caption='平均通话时长 ' bgColor='E0EEEE,90B1DE'  palette='2'" +
  689. " formatNumberScale='0' numberPrefix='' labeldisplay='ROTATE' " +
  690. "slantLabels='1' sNumberSuffix=' pcs.' showValues='1' labelDisplay='STAGGER'>";
  691. String rptJson12dataset1="";
  692. String rptJson13="<chart caption='平均振铃时长 ' bgColor='E0EEEE,90B1DE'  palette='2'" +
  693. " formatNumberScale='0' numberPrefix='' labeldisplay='ROTATE' " +
  694. "slantLabels='1' sNumberSuffix=' pcs.' showValues='1' labelDisplay='STAGGER'>";
  695. String rptJson13dataset1="";
  696. String rptJson14="<chart caption='通话次数'  showValues='1' baseFontColor='FFFFFF'" +
  697. " bgColor='2E4A89,90B1DE' bgAlpha='100,100' pieYScale='30' " +
  698. "pieSliceDepth='8' smartLineColor='FFFFFF'>";
  699. String rptJson14dataset1="";
  700. String rptJson15="<chart caption='通话时长' showValues='1'  baseFontColor='FFFFFF'" +
  701. " bgColor='2E4A89,90B1DE' bgAlpha='100,100' pieYScale='30' " +
  702. "pieSliceDepth='8' smartLineColor='FFFFFF'>";
  703. String rptJson15dataset1="";
  704. if(list!=null){
  705. //分页显示数据
  706. pageJson="\"page\":{\"currPage\":\"1\",\"pageCount\":\""
  707. +(ReportUtil.getPageCountByDivide(list.size(), page.getEachItemsOfPage()))+"\"}";
  708. int f=1;
  709. boolean dataset=false;
  710. for(int i=0;i<list.size();i++){
  711. Object[] o1=(Object[])list.get(i);
  712. if(o1!=null&&o1.length>=8){
  713. String agent_name=ReportUtil.objectToString(o1[0]);
  714. String voice_count=ReportUtil.objectToString(o1[1]);
  715. voice_count=ReportUtil.getNumberFormatForCount(voice_count);
  716. String fail_count=ReportUtil.objectToString(o1[2]);
  717. fail_count=ReportUtil.getNumberFormatForCount(fail_count);
  718. String success_count=ReportUtil.objectToString(o1[3]);
  719. success_count=ReportUtil.getNumberFormatForCount(success_count);
  720. String sum_long_time=ReportUtil.objectToString(o1[4]);
  721. String avg_long_time=ReportUtil.objectToString(o1[5]);
  722. String avg_ring_time=ReportUtil.objectToString(o1[6]);
  723. String avg_ring_count=ReportUtil.objectToString(o1[7]);
  724. avg_ring_count=ReportUtil.getNumberFormatForCount(avg_ring_count);
  725. //列表数据
  726. InDetailResult id = new InDetailResult(agent_name, voice_count, fail_count, success_count, sum_long_time, avg_long_time, avg_ring_time, avg_ring_count);
  727. //{"agent_count":"12","avg_long_time":"345","avg_ring_count":"","avg_ring_time":"","fail_count":"","sdf_date":"","sum_consult_count":"","sum_long_time":"","sum_transfer_count":"","voice_count":""}
  728. String isJson=ReportUtil.getJsonFromObject(id);
  729. if(i<page.getEachItemsOfPage()){
  730. if(f==1){
  731. listJson+=isJson;
  732. }else{
  733. listJson+=","+isJson;
  734. }
  735. }
  736. f++;
  737. //报表dataString11的数据
  738. rptJson11categories+="<category label='"+agent_name+"' />";
  739. rptJson11Set1+="<set value='"+voice_count+"' />";
  740. rptJson11Set2+="<set value='"+success_count+"' />";
  741. rptJson11Set3+="<set value='"+fail_count+"' />";
  742. //报表dataString12的数据
  743. rptJson12dataset1+="<set value='"+avg_long_time+"' label='"+agent_name+"' color='"+ReportUtil.getColorByInt(i)+"'/>";
  744. //报表dataString13的数据
  745. rptJson13dataset1+="<set value='"+avg_ring_time+"' label='"+agent_name+"' color='"+ReportUtil.getColorByInt(i)+"'/>";
  746. //报表dataString14的数据
  747. rptJson14dataset1+="<set label='"+agent_name+"' value='"+success_count+"' />";
  748. //报表dataString15的数据
  749. rptJson15dataset1+="<set label='"+agent_name+"' value='"+sum_long_time+"' />";
  750. }//end if
  751. dataset=true;
  752. }//end for
  753. listJson+="]";
  754. rptJson11categories+="</categories>";
  755. rptJson11Set1+="</dataset>";
  756. rptJson11Set2+="</dataset>";
  757. rptJson11Set3+="</dataset>";
  758. rptJson11+=rptJson11categories;
  759. //           rptJson11+=rptJson11Set1;
  760. rptJson11+=rptJson11Set2;
  761. rptJson11+=rptJson11Set3;
  762. rptJson11+="</chart>";
  763. rptJson12+=rptJson12dataset1;
  764. rptJson12+="<styles>" +
  765. "<definition><style type='font' name='CaptionFont' size='15' color='666666' />" +
  766. "<style type='font' name='SubCaptionFont' bold='0' />" +
  767. "</definition><application>" +
  768. "<apply toObject='caption' styles='CaptionFont' />" +
  769. "<apply toObject='SubCaption' styles='SubCaptionFont' />" +
  770. "</application>" +
  771. "</styles>" +
  772. "</chart>";
  773. rptJson13+=rptJson13dataset1;
  774. rptJson13+="<styles>" +
  775. "<definition><style type='font' name='CaptionFont' size='15' color='666666' />" +
  776. "<style type='font' name='SubCaptionFont' bold='0' />" +
  777. "</definition><application>" +
  778. "<apply toObject='caption' styles='CaptionFont' />" +
  779. "<apply toObject='SubCaption' styles='SubCaptionFont' />" +
  780. "</application>" +
  781. "</styles>" +
  782. "</chart>";
  783. rptJson14+=rptJson14dataset1;
  784. rptJson14+="<styles>" +
  785. "<definition>" +
  786. "<style name='CaptionFont' type='FONT' size='12' bold='1' />" +
  787. "<style name='LabelFont' type='FONT' color='2E4A89' bgColor='FFFFFF' bold='1' />" +
  788. "<style name='ToolTipFont' type='FONT' bgColor='2E4A89' borderColor='2E4A89' />" +
  789. "</definition>" +
  790. "<application>" +
  791. "<apply toObject='CAPTION' styles='CaptionFont' />" +
  792. "<apply toObject='DATALABELS' styles='LabelFont' />" +
  793. "<apply toObject='TOOLTIP' styles='ToolTIpFont' />" +
  794. "</application>" +
  795. "</styles>" +
  796. "</chart>";
  797. rptJson15+=rptJson15dataset1;
  798. rptJson15+="<styles>" +
  799. "<definition>" +
  800. "<style name='CaptionFont' type='FONT' size='12' bold='1' />" +
  801. "<style name='LabelFont' type='FONT' color='2E4A89' bgColor='FFFFFF' bold='1' />" +
  802. "<style name='ToolTipFont' type='FONT' bgColor='2E4A89' borderColor='2E4A89' />" +
  803. "</definition>" +
  804. "<application>" +
  805. "<apply toObject='CAPTION' styles='CaptionFont' />" +
  806. "<apply toObject='DATALABELS' styles='LabelFont' />" +
  807. "<apply toObject='TOOLTIP' styles='ToolTIpFont' />" +
  808. "</application>" +
  809. "</styles>" +
  810. "</chart>";
  811. //{"dataString11":"xxxxx"}
  812. if(dataset){
  813. dataString11+="\"dataString11\":{\"data\":\""+rptJson11+"\"}";
  814. dataString12+="\"dataString12\":{\"data\":\""+rptJson12+"\"}";
  815. dataString13+="\"dataString13\":{\"data\":\""+rptJson13+"\"}";
  816. dataString14+="\"dataString14\":{\"data\":\""+rptJson14+"\"}";
  817. dataString15+="\"dataString15\":{\"data\":\""+rptJson15+"\"}";
  818. }else{
  819. dataString11+="\"dataString11\":{\"data\":\"nodata\"}";
  820. dataString12+="\"dataString12\":{\"data\":\"nodata\"}";
  821. dataString13+="\"dataString13\":{\"data\":\"nodata\"}";
  822. dataString14+="\"dataString14\":{\"data\":\"nodata\"}";
  823. dataString15+="\"dataString15\":{\"data\":\"nodata\"}";
  824. }
  825. //[{"agent_count":"12","avg_long_time":"345"},{}]
  826. res+="{\"all\":{"+pageJson+","+listJson+","+dataString11+","+dataString12+","+dataString13+","+dataString14+","+dataString15+"}}";
  827. System.out.println("json结果:\n"+res);
  828. }//end if
  829. return res;
  830. }
  831. // 明细分页 的数据
  832. public String getPageJsonForInDetail(String fromdate,String todate,String datetype,GreenPageVo page){
  833. String jsonData = "";
  834. List list = new ArrayList();
  835. String sql = " select "
  836. + " agent_name  "
  837. + "  ,count(voice_id) voice_count "
  838. + " ,sum(decode(a.start_time,null,1,'',1,0)) fail_count "
  839. + " ,count(voice_id)-sum(decode(a.start_time,null,1,'',1,0)) success_count "
  840. + " ,sum(long_time)/60 sum_long_time "
  841. + " ,avg(long_time)/60 avg_long_time "
  842. + " ,avg(ring_long_time)/60 avg_ring_time "
  843. + " ,avg(decode(voice_id,null,0,1)) avg_ring_count "
  844. + "   from  " + "   ( " + " select  "
  845. + "  t.*   from hd_agent_voice_seq t  " + " where 1=1  ";
  846. if (fromdate != null && !fromdate.trim().equals("")) {
  847. sql += "   and t.ring_time>='"
  848. + ReportUtil.dealDateByDatetype(fromdate.trim(), datetype,
  849. true, todate) + "'  ";
  850. }
  851. if (todate != null && !todate.trim().equals("")) {
  852. sql += " and t.ring_time<='"
  853. + ReportUtil.dealDateByDatetype(todate.trim(), datetype,
  854. false, todate) + "' ";
  855. }
  856. sql += "  and t.voice_direct_id='0'  " + "  ) a  "
  857. + " group by agent_name ";
  858. System.out.println("getAllListForInSummary--" + sql);
  859. String countSql = "select count(agent_name) countNumber " + "  from  ("
  860. + sql + " )";
  861. List listCount = new ArrayList();
  862. listCount = this.queryNativeSQL(countSql);
  863. PaginationSupport pageset=new PaginationSupport();
  864. pageset.setTotalCount(this.getCountNumberFromList(listCount));// 记录总数
  865. pageset.setCountOnEachPage(page.getEachItemsOfPage());
  866. pageset.setPage(page.getCurrPage());
  867. list = this.queryNativeSQL(sql, pageset);
  868. jsonData = this.getPageJsonForInDetailByList(list, pageset);
  869. return jsonData;
  870. }
  871. // 明细分页 的数据拼装
  872. public String getPageJsonForInDetailByList(List list,
  873. PaginationSupport pageset) {
  874. String res = "";
  875. // "page":{"currPage":"6","pageCount":"67"}
  876. String pageJson = "";
  877. // [{"agent_count":"12","avg_long_time":"345"},{}]
  878. String listJson = "\"listdata\":[";
  879. if (list != null) {
  880. // 分页显示数据
  881. pageJson = "\"page\":{\"currPage\":\"" + pageset.getPage()
  882. + "\",\"pageCount\":\"" + pageset.getPageCount() + "\"}";
  883. int f = 1;
  884. boolean dataset=false;
  885. for(int i=0;i<list.size();i++){
  886. Object[] o1=(Object[])list.get(i);
  887. if(o1!=null&&o1.length>=8){
  888. String agent_name=ReportUtil.objectToString(o1[0]);
  889. String voice_count=ReportUtil.objectToString(o1[1]);
  890. voice_count=ReportUtil.getNumberFormatForCount(voice_count);
  891. String fail_count=ReportUtil.objectToString(o1[2]);
  892. fail_count=ReportUtil.getNumberFormatForCount(fail_count);
  893. String success_count=ReportUtil.objectToString(o1[3]);
  894. success_count=ReportUtil.getNumberFormatForCount(success_count);
  895. String sum_long_time=ReportUtil.objectToString(o1[4]);
  896. String avg_long_time=ReportUtil.objectToString(o1[5]);
  897. String avg_ring_time=ReportUtil.objectToString(o1[6]);
  898. String avg_ring_count=ReportUtil.objectToString(o1[7]);
  899. avg_ring_count=ReportUtil.getNumberFormatForCount(avg_ring_count);
  900. //列表数据
  901. InDetailResult id = new InDetailResult(agent_name, voice_count, fail_count, success_count, sum_long_time, avg_long_time, avg_ring_time, avg_ring_count);
  902. //{"agent_count":"12","avg_long_time":"345","avg_ring_count":"","avg_ring_time":"","fail_count":"","sdf_date":"","sum_consult_count":"","sum_long_time":"","sum_transfer_count":"","voice_count":""}
  903. String isJson=ReportUtil.getJsonFromObject(id);
  904. if(f==1){
  905. listJson+=isJson;
  906. }else{
  907. listJson+=","+isJson;
  908. }
  909. f++;
  910. }//end if
  911. dataset=true;
  912. }//end for
  913. listJson += "]";
  914. // [{"agent_count":"12","avg_long_time":"345"},{}]
  915. res += "{\"all\":{" + pageJson + "," + listJson + "}}";
  916. System.out.println("分页json结果:\n" + res);
  917. }// end if
  918. return res;
  919. }
  920. }

内容很多,一般两个方法对应一个功能,一个查数据,
一个负责对查询的数据进行处理。

例如:
public String getPageJsonForInSummary(String fromdate, String todate,
   String datetype, GreenPageVo page) 
从前台接受参数,拼装sql查询数据。
其中jsonData = this.getPageJsonForInSummaryByList(list, pageset);

public String getPageJsonForInSummaryByList(List list,
   PaginationSupport pageset)
负责对结果集处理数据,所有数据处理后,返回一个json对象,
把需要的数据全部返回到页面。

控制分页能正确显示的json部分:
pageJson = "\"page\":{\"currPage\":\"" + pageset.getPage()
     + "\",\"pageCount\":\"" + pageset.getPageCount() + "\"}";

struts配置

[html] view plaincopy
  1. <action name="rptInSummaryAll" class="org.hd.report.action.RptInSummaryAction" method="rptInSummaryAll">
  2. </action>
  3. <action name="rptInSummaryPage" class="org.hd.report.action.RptInSummaryAction" method="rptInSummaryPage">
  4. </action>
  5. <action name="rptInSummaryCompare" class="org.hd.report.action.RptInSummaryAction" method="rptInSummaryCompare">
  6. </action>
  7. <action name="judgeIsTwoRightDate" class="org.hd.report.action.RightDateJudgeAction" method="judgeIsTwoRightDate">
  8. </action>
  9. <action name="rptInDetailAll" class="org.hd.report.action.RptInDetailAction" method="rptInDetailAll">
  10. </action>
  11. <action name="rptInDetailPage" class="org.hd.report.action.RptInDetailAction" method="rptInDetailPage">
  12. </action>

效果:

js实现关于分页的一种实现方式相关推荐

  1. 【JS继承】常见的7种继承方式

     自我介绍:大家好,我是吉帅振的网络日志:微信公众号:吉帅振的网络日志:前端开发工程师,工作4年,去过上海.北京,经历创业公司,进过大厂,现在郑州敲代码. JS继承专栏 1[JS继承]什么是JS继承? ...

  2. js简繁转换,两种实现方式,妥妥的~

    不知道繁简按钮有什么卵用,大陆人自带繁简转换开关的好么,但是还是项目要求,做了这么一个功能,现在整理给大家用~完美兼容~么么哒 按钮的样式可以随便用css定义,注意id不要变,注意jq的事件绑定好就o ...

  3. 【JS提升】选项卡的两种实现方式

    一.选项卡的两种实现方式 <!DOCTYPE html> <html lang="en"><head><meta charset=&quo ...

  4. Web前端笔记-two.js图形旋转动画的2种实现方式

    这里有两种方式! 第一种是使用setInterval: 代码如下: let time = setInterval(function(){if(sun.sun.rotation >= TWO_PI ...

  5. 398、Java框架52 -【Hibernate - 分页、两种获取方式】 2020.10.27

    0.目录 1.分页 2.分页,从第3个开始,一共查询5个Product 3.延迟加载 4.对于id不存在的对象的处理 5.参考链接 1.分页 使用Criteria进行分页查询 无论你使用的是Oracl ...

  6. html 简繁替换,js简繁转换,两种实现方式,妥妥的~

    cef3 获得js 返回值, 以及js 指挥delphi 函数的 总结参考 cef3  如何加载 本地html 文件.   请教老师[吐槽]常忘  22:21:45@lazarus 下载cef3中的范 ...

  7. SQL2005利用ROW_NUMER实现分页的两种常用方式

    代码如下: declare @PageNumber int declare @PageSize int set @PageNumber=2 set @PageSize=20 --利用between s ...

  8. vue实现分页的两种方式

    vue实现分页的两种方式 (1)方法一:使用slice方法 一次调用后端接口返回所有数据tableData,然后使用tableData.slice((currentPage-1)*pageSize,c ...

  9. iOS: JS和Native交互的两种方法,iosjsnative交互

    iOS: JS和Native交互的两种方法,iosjsnative交互 背景: UIWebView: iOS 用来展示 web 端内容的控件. 1. 核心方法: - (NSString*)string ...

最新文章

  1. Tempter of the Bone(DFS + 奇偶剪枝,好题)
  2. 找出占用磁盘空间最大的前10个文件或文件夹
  3. 荣耀X8碎屏2020-05-14
  4. 构造器是什么?(Java篇)
  5. 你真的了解Lambda表达式吗?
  6. hibernate配置详情2(Dept.hbm.xml)
  7. 【LeetCode - 224】基本计算器(栈)
  8. 【树】判断给定森林中有多少棵树(简单做法)
  9. hadoop 配置文件
  10. bottleneck resnet网络_Detection学习之四-利用pytorch实现resnet
  11. 伪标记是一种简单的半监督学习方法
  12. 图解设计模式-Chain Of Responsibility模式
  13. 小型超市网上购物系统开发项目总结
  14. 郝斌c语言视频笔记,郝斌老师C语言专题笔记
  15. matlab 直方图修正,matlab直方图修正
  16. EasyOrtho卫星影像处理软件
  17. OSChina 周四乱弹 ——Iphone7出了开始做牛做马了
  18. Java日志框架:slf4j作用及其实现原理
  19. C和C++的区别点汇总
  20. 唯美烟花特效登录页面,我感觉自己又行了

热门文章

  1. java 发送cookie_java – 如何在response.sendRedirect()之后发送cookie?
  2. Docker简单实践(一)
  3. Linus 将 Linux 的软盘驱动 floppy 标记为“孤立”状态
  4. Angular 7和ASP.NET Core 2.1入门
  5. odoo10参考系列--ORM API 三(字段、继承与扩展、域和更新到新API)
  6. 计算机应用与软件修审,国中课室素养导向标准本位评量的设计与应用:以英语科阅读为例...
  7. 科学计算机的用途,计算机最主要的用途之一就是科学计算,科学计算可分为两类...
  8. php无限极 left right,php无限极分类实现的两种解决方法
  9. 光纤光信号闪红灯_电信光纤光猫光信号闪红灯怎么处理
  10. android studio 帧动画,如何在android studio中的两帧动画之间添加延迟?