webService接口

来源:互联网 发布:中文文献分析软件 编辑:程序博客网 时间:2024/06/05 17:30

与新中心集团一卡通webService接口数据集成整理,新手编写,请多指教

一卡通历史流水整理,通过一卡通号查询相应人员的消费信息,与当日流水没多大区别只为整理分享

<%@ page contentType="text/html; charset=gb2312" %>
<%@ include file="/oa_interface/ids.jsp"%>
<%@ page import="java.util.*,java.io.*" %>
<%@ page import="OAWebService,OAUserInfo" %>
<%@ page import="org.jdom.input.SAXBuilder,java.io.InputStream,java.io.ByteArrayInputStream,org.jdom.*,java.lang.Exception" %>
<%@ page import="hlg.test.schoolcard.webservice.HisConsumeLogWSC" %>
<%@ page import="hlg.test.schoolcard.webservice.HisTrjnDTO" %>
<%@ page import="hlg.test.schoolcard.webservice.TrjnSearchServiceEndPoint" %>
<%@ page import="hlg.test.schoolcard.webservice.TrjnSearchServiceEndPointService" %>
<%@ page import="hlg.test.schoolcard.webservice.TrjnSearchServiceEndPointServiceLocator" %>
<%@ page import="hlg.test.schoolcard.webservice.WebTrjnDTO" %>
<%@ page import="hlg.test.schoolcard.webservice.PageDTO"%>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>一卡通当日流水 </title>
</head>
<script type='text/javascript' src='/oa_interface/date/Calendar1.js'>

</script>

<script language="javascript" type="text/javascript">
  function timer(formObj){
    var st=document.getElementById("inputStartDate").value;
 var js=document.getElementById("inputEndDate").value;
 var xh=document.getElementById("xh").value;
    var datePattern = /^(\d{4})-(\d{1,2})-(\d{1,2})$/;
 if(xh=="")
 {
 window.alert("帐号不能为空,请输入要查询的帐号");
 return false;
 }
 if(xh.length<4)
 {
 window.alert("帐号长度过短");
 return false;
 }
 if(xh.substring(0,2)!="20")
 {
 window.alert("帐户不存在,无法进行查询");
 return false;
 }
 
 if (! datePattern.test(formObj.inputStartDate.value)) {
    window.alert("请填写正确的开始日期格式");
    return false;
 }
 if (! datePattern.test(formObj.inputEndDate.value)) {
    window.alert("请填写正确的结束日期格式");
    return false;
 }
 if(st>js)
 {
  alert("开始时间不能大于结束时间");
  return false;
    }

 
  
  return true;

}
</script>
<body>


 <%

  if(user != null){
  String kssj="2013-07-01";
  String ks=kssj.replace("-","");
  String jssj="2013-07-15";
  String js=jssj.replace("-","");
  int pages=1;
  String xh="";
  String session_id="";
  
  if(request.getParameter("pages")!=null){
   String pagess=request.getParameter("pages");
   pages = Integer.parseInt(pagess);
  }
  if(request.getParameter("xh")!=null){
   xh=request.getParameter("xh");
  }
  if(request.getParameter("inputStartDate")!=null){
   kssj=request.getParameter("inputStartDate");
   ks=kssj.replace("-","");
  }
  if(request.getParameter("inputEndDate")!=null){
   jssj=request.getParameter("inputEndDate");
   js=jssj.replace("-","");
  }
  TrjnSearchServiceEndPointService t = new TrjnSearchServiceEndPointServiceLocator();
  TrjnSearchServiceEndPoint m = t.getSchoolcardSearchService();
  //历史流水() input 5.21  return 5.19  5.20
  Long account = m.account(xh);//与当日流水不同的是根据学号查询其他人的消费信息,把学号传进去来获取账号
  HisTrjnDTO  histrjn=new HisTrjnDTO();
  histrjn.setAccount(account);
  histrjn.setInputObject("15");
  histrjn.setInputStartDate(ks);
  histrjn.setInputEndDate(js);
  histrjn.setPageSize(5);
  HisConsumeLogWSC la=null;
  if(pages==1){
   m.delSessionOut(session_id);
   session_id=m.getSessionId();
   histrjn.setSessionId(session_id);
   la = m.accHisTrjnSearch(histrjn);
  }else{
   session_id=request.getParameter("session_id");
   la = m.accHistrjnSearch(session_id, ks, js, 5, pages);
  }
  //下面是分页处理
  PageDTO fy = la.getPageDTO();
  int zys=fy.getPageCount();//总页数
  int myjls=fy.getPageSize();//每页记录数
  int zjls=la.getCount();//总记录数
  int dqy=fy.getPageNum();
     WebTrjnDTO[] webTrjndtos = la.getWebTrjnDTO();

  %>
    <form id="drls" name="drls" method="post" action="ykt_xh_ls.jsp" >
    帐号:<input type="text" id="xh" name="xh" value="<%=xh%>" />&nbsp;
    开始日期:<input type="text" id="inputStartDate" name="inputStartDate" value="<%=kssj%>" onFocus="calendar()" style="margin-left:5px; margin-right:5px;"/>&nbsp;
    结束日期:<input type="text" id="inputEndDate" name="inputEndDate" value="<%=jssj%>" onFocus="calendar()" style="margin-left:5px; margin-right:5px;"/>&nbsp;
    <input type="submit" value="查询" onclick="return timer(this.form);"/>
    </form>
  <!--判断用户有没有输入学号,再判断有没有该日期的查询记录,如果有才显示列表,没有则给出相应的提示-->
  <%
  if(request.getParameter("xh")==null||request.getParameter("xh").equals(""))
  
  {
   //out.println("请输入要查找的帐号");
  
   
  }else{
   if(webTrjndtos==null)
   {
    out.println("该日期没有消费记录");
   }else{
  
  %>
  
  <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#0066FF" align="center">
    <tr>
   <td   height="25" bgcolor="#CCCCC" align="center">交易日期</td>
   <td   height="25" bgcolor="#CCCCC" align="center">交易额 (单位:元)</td>
   <td   height="25" bgcolor="#CCCCC" align="center">现有余额 (单位:元)</td>
   <td   height="25" bgcolor="#CCCCC" align="center">交易状态</td>
   <td   height="25" bgcolor="#CCCCC" align="center">pos机编号</td>
    </tr>
  <%
 
  for(int i=0;i<webTrjndtos.length;i++){
   WebTrjnDTO st = webTrjndtos[i];
  %>
  <tr>
   <td height="30" bgcolor="#FFFFF" align="center"><%=st.getEffectdate()%></td>
   <td height="30" bgcolor="#FFFFF" align="center"><%=st.getFTranAmt()%></td>
   <td height="30" bgcolor="#FFFFF" align="center"><%=st.getNowAmt()%></td>
   <td height="30" bgcolor="#FFFFF" align="center"><%=st.getJourName()%></td>
   <td height="30" bgcolor="#FFFFF" align="center"><%=st.getPoscode()%></td>
  
  </tr>
  <%
  }
   
  
  %>
  <tr>
  <input  type="hidden" name="pages" value=""/>
  <td colspan="5"height="30" bgcolor="#FFFFF" align="center">共<%=zjls%>条数据 共<%=zys %>页 第<%=dqy%>页
    <%if (dqy > 1)
            {%>
              &nbsp;<a href="ykt_xh_ls.jsp?session_id=<%=session_id%>&pages=<%=pages-1%>&inputStartDate=<%=kssj%>&inputEndDate=<%=jssj%>&xh=<%=xh%>">上一页</a>
          <%}
           
   
            if (dqy < zys)
            {%>
              <a href="ykt_xh_ls.jsp?session_id=<%=session_id%>&pages=<%=pages+1%>&inputStartDate=<%=kssj%>&inputEndDate=<%=jssj%>&xh=<%=xh%>">下一页</a>
          <%}%>
     </td>
  </tr>
  <%
  }
  }
  } else{
  out.println("you are  not login");
  }
  %>


</table>

</body>
</html>

 

原创粉丝点击