<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.yc.ycportal.blockimp.service.CommonService" %>
<%
response.setContentType("text/xml");
String userId = request.getParameter("userId");
//Create the response XML
if (userId != null && !"".equals(userId.trim())) {
List gyList = CommonService.getInstance().getDynamicTable("select * from dic_counter where counter_id='" + userId + "'");
if (gyList != null && gyList.size() == 1) {
Map gyMap = (Map) gyList.get(0);
String gyName = (String) gyMap.get("COUNTER_NAME");//櫃員姓名
String organId = (String) gyMap.get("ORGAN_ID");//櫃員所屬行號
List organList = CommonService.getInstance().getDynamicTable("select * from dic_organ where organ_id='31" + organId + "'");
if( organList != null && organList.size() == 1) {
Map organMap = (Map) organList.get(0);
String organName = (String) organMap.get("ORGAN_NAME");//擷取櫃員所屬行名
//組織需要返回的xml
StringBuffer xml = new StringBuffer("<?xml version=/"1.0/" encoding=/"gb2312/" ?><result><queryResult>success</queryResult><name>").append(gyName).append("</name><bank_id>").append(organId).append("</bank_id><bank_name>").append(organName).append("</bank_name></result>");
//Send the response back to the browser
response.getWriter().write(xml.toString());
}else{
response.getWriter().write("<result><queryResult>failed</queryResult></result>");
}
}else{
response.getWriter().write("<result><queryResult>failed</queryResult></result>");
}
}else{
response.getWriter().write("<result><queryResult>failed</queryResult></result>");
}
%>