IndexAction.java~553~
上传用户:zghglow
上传日期:2022-08-09
资源大小:27227k
文件大小:31k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

JavaScript

  1. package com.chinacannel.xlchemical.struts.Action;
  2. import org.apache.struts.actions.DispatchAction;
  3. import org.apache.struts.action.ActionForward;
  4. import javax.servlet.http.HttpServletRequest;
  5. import org.apache.struts.action.ActionMapping;
  6. import javax.servlet.http.HttpServletResponse;
  7. import org.apache.struts.action.ActionForm;
  8. import java.util.List;
  9. import java.util.ArrayList;
  10. import com.chinacannel.entity.*;
  11. import com.chinacannel.xlchemical.struts.Vo.ModelVo;
  12. import com.chinacannel.common.PageInfo;
  13. import com.chinacannel.xlchemical.service.*;
  14. import com.chinacannel.xlchemical.struts.ActionForm.AdminActionForm;
  15. import java.io.IOException;
  16. public class IndexAction extends DispatchAction {
  17.     IndexService is = new IndexService();
  18.     MenuService ms = new MenuService();
  19.     CategoryService cs = new CategoryService();
  20.     InformationService infs = new InformationService();
  21.     DownLoadService ds = new DownLoadService();
  22.     LeaveWordService ls = new LeaveWordService();
  23.     ProductService ps = new ProductService();
  24.     JobsService js = new JobsService();
  25.     LinkService links = new LinkService();
  26.     public ActionForward OpenIndex(ActionMapping actionMapping,
  27.                                    ActionForm actionForm,
  28.                                    HttpServletRequest servletRequest,
  29.                                    HttpServletResponse servletResponse) {
  30.         List list = null;
  31.         String Language = "CN";
  32.         List LinkList1 = null;
  33.         List LinkList2 = null;
  34.         try {
  35.             if (servletRequest.getParameter("Language") != null) {
  36.                 Language = servletRequest.getParameter("Language");
  37.                 servletRequest.getSession().setAttribute("Language", Language);
  38.                 servletRequest.getSession().setMaxInactiveInterval(60 * 60 * 24);
  39.             } else {
  40.                 if (servletRequest.getSession().getAttribute("Language") != null) {
  41.                     Language = servletRequest.getSession().getAttribute(
  42.                             "Language").toString();
  43.                 } else {
  44.                     servletRequest.getSession().setAttribute("Language",
  45.                             Language);
  46.                 }
  47.             }
  48.             is.beginTran();
  49.             list = is.GetIndexMenu(Language);
  50.             LinkList1 = links.GetLinkByType(new Long(1));
  51.             LinkList2 = links.GetLinkByType(new Long(2));
  52.             servletRequest.setAttribute("LinkList1", LinkList1);
  53.             servletRequest.setAttribute("LinkList2", LinkList2);
  54.             is.commit();
  55.         } catch (Exception ex) {
  56.             log.error(ex.getMessage(), ex);
  57.             try {
  58.                 is.rollback();
  59.             } catch (Exception ex2) {
  60.                 log.error(ex2.getMessage(), ex2);
  61.             }
  62.         }
  63.         if (list.size() > 0) {
  64.             servletRequest.setAttribute("menu1", (Menu) list.get(0));
  65.         }
  66.         if (list.size() > 1) {
  67.             servletRequest.setAttribute("menu2", (Menu) list.get(1));
  68.         }
  69.         if (list.size() > 2) {
  70.             servletRequest.setAttribute("menu3", (Menu) list.get(2));
  71.         }
  72.         if (list.size() > 3) {
  73.             servletRequest.setAttribute("menu4", (Menu) list.get(3));
  74.         }
  75.         return actionMapping.findForward("OpenIndex");
  76.     }
  77.     private void LeftMenu(String Language, HttpServletRequest servletRequest) {
  78.         List menuList = null;
  79.         Menu fMenu = null;
  80.         Long fMenuID = new Long(0);
  81.         if (servletRequest.getParameter("fMenuID") != null) {
  82.             fMenuID = new Long(servletRequest.getParameter("fMenuID"));
  83.         }
  84.         fMenu = ms.GetMenuById(fMenuID);
  85.         menuList = ms.GetMenuBySuperior(fMenuID, Language);
  86.         servletRequest.setAttribute("menu", fMenu);
  87.         servletRequest.setAttribute("menuList", menuList);
  88.     }
  89.     public ActionForward ShowMenu(ActionMapping actionMapping,
  90.                                   ActionForm actionForm,
  91.                                   HttpServletRequest servletRequest,
  92.                                   HttpServletResponse servletResponse) throws
  93.             IOException {
  94.         String Language = "CN";
  95.         String key = "";
  96.         String s = "";
  97.         try {
  98.             if (servletRequest.getSession().getAttribute("Language") != null) {
  99.                 Language = servletRequest.getSession().getAttribute("Language").
  100.                            toString();
  101.             }
  102.             if (servletRequest.getParameter("key") != null) {
  103.                 key = servletRequest.getParameter("key");
  104.             }
  105.             ms.beginTran();
  106.             Menu menu1 = ms.GetMenuByKey(key + Language);
  107.             List menuList = ms.GetMenuBySuperior(menu1.getMen_ID(), Language);
  108.             ms.commit();
  109.             for (int i = 0; i < menuList.size(); i++) {
  110.                 Menu menu = (Menu) menuList.get(i);
  111.                 if (s == "") {
  112.                     s = "{"name":"" + menu.getMen_DefaultName() +
  113.                         "","fId":"" + menu.getMen_Superior() +
  114.                         "","cId":"" + menu.getMen_ID() + ""}";
  115.                 } else {
  116.                     s += "," + "{"name":"" + menu.getMen_DefaultName() +
  117.                             "","fId":"" + menu.getMen_Superior() +
  118.                             "","cId":"" + menu.getMen_ID() + ""}";
  119.                 }
  120.             }
  121.         } catch (Exception ex) {
  122.             log.error(ex.getMessage(), ex);
  123.             try {
  124.                 is.rollback();
  125.             } catch (Exception ex2) {
  126.                 log.error(ex2.getMessage(), ex2);
  127.             }
  128.         }
  129.         servletResponse.setCharacterEncoding("GBK");
  130.         servletResponse.getWriter().write("[" + s + "]");
  131.         return actionMapping.findForward("ShowMenu");
  132.     }
  133.     public ActionForward OpenIndexMenu(ActionMapping actionMapping,
  134.                                        ActionForm actionForm,
  135.                                        HttpServletRequest servletRequest,
  136.                                        HttpServletResponse servletResponse) {
  137.         String key = "";
  138.         Long cMenuID = new Long(0);
  139.         List menuList = null;
  140.         Menu menu = null;
  141.         Menu fMenu = null;
  142.         String title = "";
  143.         String Language = "CN";
  144.         Long fMenuID = new Long(0);
  145.         try {
  146.             if (servletRequest.getSession().getAttribute("Language") != null) {
  147.                 Language = servletRequest.getSession().getAttribute("Language").
  148.                            toString();
  149.             }
  150.             if (servletRequest.getParameter("key") != null) {
  151.                 key = servletRequest.getParameter("key");
  152.             }
  153.             if (servletRequest.getParameter("fMenuID") != null) {
  154.                 fMenuID = new Long(servletRequest.getParameter("fMenuID"));
  155.             }
  156.             if (servletRequest.getParameter("cMenuID") != null) {
  157.                 cMenuID = new Long(servletRequest.getParameter("cMenuID"));
  158.             }
  159.             ms.beginTran();
  160.             if (!key.equals("")) {
  161.                 fMenu = ms.GetMenuByKey(key);
  162.             } else {
  163.                 fMenu = ms.GetMenuById(fMenuID);
  164.             }
  165.             menuList = ms.GetMenuBySuperior(fMenu.getMen_ID(), Language);
  166.             if (!cMenuID.equals(new Long(0))) {
  167.                 menu = ms.GetMenuById(cMenuID);
  168.             } else {
  169.                 menu = (Menu) menuList.get(0);
  170.             }
  171.             if (menu != null) {
  172.                 if (!menu.getMen_Default().equals(new Long(1))) {
  173.                     if (menu.getMen_Type().equals(new Long(0))) {
  174.                         Information inf = infs.GetFirstInformationByMenuID(menu.
  175.                                 getMen_ID());
  176.                         if (inf != null) {
  177.                             title = inf.getInf_Title();
  178.                             servletRequest.setAttribute("inf", inf);
  179.                         }
  180.                     } else {
  181.                         PageInfo pageInfo = infs.getPageInfo("", null, menu,
  182.                                 menu.getMen_Language(), 0);
  183.                         title = menu.getMen_Name();
  184.                         servletRequest.setAttribute("type", menu.getMen_Type());
  185.                         servletRequest.setAttribute("pageInfo", pageInfo);
  186.                     }
  187.                 } else {
  188.                     String url = menu.getMen_Url() + "&fMenuID=" + fMenu.getMen_ID();
  189.                     servletRequest.setAttribute("url", url);
  190.                     return actionMapping.findForward("Jumping");
  191.                 }
  192.             }
  193.             ms.commit();
  194.         } catch (Exception ex) {
  195.             log.error(ex.getMessage(), ex);
  196.             try {
  197.                 is.rollback();
  198.             } catch (Exception ex2) {
  199.                 log.error(ex2.getMessage(), ex2);
  200.             }
  201.         }
  202.         servletRequest.setAttribute("title", title);
  203.         servletRequest.setAttribute("menu", fMenu);
  204.         servletRequest.setAttribute("menuList", menuList);
  205.         if (menu.getMen_Type().equals(new Long(0))) {
  206.             return actionMapping.findForward("OpenInfo");
  207.         } else if (menu.getMen_Type().equals(new Long(1))) {
  208.             return actionMapping.findForward("OpenList1");
  209.         } else if (menu.getMen_Type().equals(new Long(2))) {
  210.             return actionMapping.findForward("OpenList2");
  211.         } else if (menu.getMen_Type().equals(new Long(3))) {
  212.             return actionMapping.findForward("OpenList3");
  213.         } else {
  214.             return actionMapping.findForward("OpenList4");
  215.         }
  216.     }
  217.     public ActionForward OpenInfo(ActionMapping actionMapping,
  218.                                   ActionForm actionForm,
  219.                                   HttpServletRequest servletRequest,
  220.                                   HttpServletResponse servletResponse) {
  221.         Long type = new Long(0);
  222.         Information inf = null;
  223.         Long fMenuID = new Long(0);
  224.         Menu fMenu = null;
  225.         List menuList = null;
  226.         String Language = "CN";
  227.         try {
  228.             if (servletRequest.getSession().getAttribute("Language") != null) {
  229.                 Language = servletRequest.getSession().getAttribute("Language").
  230.                            toString();
  231.             }
  232.             if (servletRequest.getParameter("type") != null) {
  233.                 type = new Long(servletRequest.getParameter("type"));
  234.             }
  235.             if (servletRequest.getParameter("fMenuID") != null) {
  236.                 fMenuID = new Long(servletRequest.getParameter("fMenuID"));
  237.             }
  238.             infs.beginTran();
  239.             fMenu = ms.GetMenuById(fMenuID);
  240.             menuList = ms.GetMenuBySuperior(fMenuID, Language);
  241.             inf = infs.GetInformationById(new Long(servletRequest.
  242.                     getParameter("infID")));
  243.             if (inf.getInf_Click() == null) {
  244.                 inf.setInf_Click(new Long(1));
  245.             } else {
  246.                 inf.setInf_Click(inf.getInf_Click() + new Long(1));
  247.             }
  248.             infs.UpdateInformation(inf);
  249.             infs.commit();
  250.         } catch (Exception ex) {
  251.             log.error(ex.getMessage(), ex);
  252.             try {
  253.                 is.rollback();
  254.             } catch (Exception ex2) {
  255.                 log.error(ex2.getMessage(), ex2);
  256.             }
  257.         }
  258.         servletRequest.setAttribute("inf", inf);
  259.         servletRequest.setAttribute("menu", fMenu);
  260.         servletRequest.setAttribute("menuList", menuList);
  261.         if (!type.equals(new Long(4))) {
  262.             return actionMapping.findForward("OpenInfo1");
  263.         } else {
  264.             return actionMapping.findForward("OpenInfo2");
  265.         }
  266.     }
  267.     public ActionForward OpenMenu(ActionMapping actionMapping,
  268.                                   ActionForm actionForm,
  269.                                   HttpServletRequest servletRequest,
  270.                                   HttpServletResponse servletResponse) {
  271.         Admin adm = null;
  272.         List fModelList = new ArrayList();
  273.         List cModelList = new ArrayList();
  274.         Role role = null;
  275.         RoleService rs = new RoleService();
  276.         ModelService ms = new ModelService();
  277.         try {
  278.             rs.beginTran();
  279.             adm = (Admin) servletRequest.getSession().getAttribute("admin");
  280.             role = rs.GetRoleById(adm.getRole().getRol_ID());
  281.             String[] fmodels = role.getRol_FModel().split(",");
  282.             String[] cmodels = role.getRol_CModel().split(",");
  283.             for (int i = 0; i < cmodels.length; i++) {
  284.                 cModelList.add(cmodels[i]);
  285.             }
  286.             for (int i = 0; i < fmodels.length; i++) {
  287.                 ModelVo mv = new ModelVo();
  288.                 Model model = ms.GetModelByKey(fmodels[i]);
  289.                 mv.setMod_CnName(model.getMod_CnName());
  290.                 mv.setMod_EnName(model.getMod_EnName());
  291.                 mv.setMod_ID(model.getMod_ID());
  292.                 mv.setMod_Key(model.getMod_Key());
  293.                 mv.setMod_Order(model.getMod_Order());
  294.                 mv.setMod_Superior(model.getMod_Superior());
  295.                 mv.setMod_Url(model.getMod_Url());
  296.                 mv.setMod_EnUrl(model.getMod_EnUrl());
  297.                 List childList = ms.GetChildModel(model.getMod_ID());
  298.                 List cList = new ArrayList();
  299.                 for (int j = 0; j < childList.size(); j++) {
  300.                     Model cmod = (Model) childList.get(j);
  301.                     if (cModelList.contains(cmod.getMod_Key())) {
  302.                         cList.add(cmod);
  303.                     }
  304.                 }
  305.                 mv.setChildModel(cList);
  306.                 fModelList.add(mv);
  307.             }
  308.             rs.commit();
  309.         } catch (Exception ex) {
  310.             log.error(ex.getMessage(), ex);
  311.             try {
  312.                 is.rollback();
  313.             } catch (Exception ex2) {
  314.                 log.error(ex2.getMessage(), ex2);
  315.             }
  316.         }
  317.         servletRequest.setAttribute("modelLength", fModelList.size());
  318.         servletRequest.setAttribute("modelList", fModelList);
  319.         return actionMapping.findForward("OpenMenu");
  320.     }
  321.     //打开后台首页
  322.     public ActionForward OpenBackIndex(ActionMapping actionMapping,
  323.                                        ActionForm actionForm,
  324.                                        HttpServletRequest servletRequest,
  325.                                        HttpServletResponse servletResponse) {
  326.         String language = "CN";
  327.         try {
  328.             if (servletRequest.getParameter("Language") != null) {
  329.                 language = servletRequest.getParameter("Language");
  330.             }
  331.             servletRequest.getSession().setAttribute("Language", language);
  332.             servletRequest.getSession().setMaxInactiveInterval(60 * 60 * 24);
  333.         } catch (Exception ex) {
  334.             log.error(ex.getMessage(), ex);
  335.             try {
  336.                 is.rollback();
  337.             } catch (Exception ex2) {
  338.                 log.error(ex2.getMessage(), ex2);
  339.             }
  340.         }
  341.         return actionMapping.findForward("OpenBackIndex");
  342.     }
  343.     public ActionForward ShowHonnors(ActionMapping actionMapping,
  344.                                      ActionForm actionForm,
  345.                                      HttpServletRequest servletRequest,
  346.                                      HttpServletResponse servletResponse) {
  347.         String Language = "CN";
  348.         List list = null;
  349.         try {
  350.             if (servletRequest.getSession().getAttribute("Language") != null) {
  351.                 Language = servletRequest.getSession().getAttribute("Language").
  352.                            toString();
  353.             }
  354.             cs.beginTran();
  355.             LeftMenu(Language, servletRequest);
  356.             list = cs.getCategoryListByKey("QYRY", Language);
  357.             cs.commit();
  358.         } catch (Exception ex) {
  359.             log.error(ex.getMessage(), ex);
  360.             try {
  361.                 cs.rollback();
  362.             } catch (Exception ex2) {
  363.                 log.error(ex2.getMessage(), ex2);
  364.             }
  365.         }
  366.         servletRequest.setAttribute("categoryList", list);
  367.         return actionMapping.findForward("ShowHonnors");
  368.     }
  369.     public ActionForward ShowDownLoad(ActionMapping actionMapping,
  370.                                       ActionForm actionForm,
  371.                                       HttpServletRequest servletRequest,
  372.                                       HttpServletResponse servletResponse) {
  373.         int pageNo = 0;
  374.         PageInfo pageInfo = null;
  375.         String Language = "CN";
  376.         Long type = new Long(0);
  377.         String title = "";
  378.         try {
  379.             pageNo = Integer.parseInt(servletRequest.getParameter("pageNo"));
  380.         } catch (Exception ex1) {}
  381.         try {
  382.             if (servletRequest.getSession().getAttribute("Language") != null) {
  383.                 Language = servletRequest.getSession().getAttribute("Language").
  384.                            toString();
  385.             }
  386.             if (servletRequest.getParameter("Type") != null) {
  387.                 type = new Long(servletRequest.getParameter("Type"));
  388.             }
  389.             ds.beginTran();
  390.             LeftMenu(Language, servletRequest);
  391.             pageInfo = ds.getPageInfo(type, Language, pageNo);
  392.             if (type.equals(new Long(1))) {
  393.                 if (Language.equals("CN")) {
  394.                     title = "公司报告";
  395.                 } else {
  396.                     title = "Company Reports";
  397.                 }
  398.             } else if (type.equals(new Long(0))) {
  399.                 if (Language.equals("CN")) {
  400.                     title = "运营数据";
  401.                 } else {
  402.                     title = "Operators Data";
  403.                 }
  404.             }
  405.             ds.commit();
  406.         } catch (Exception ex) {
  407.             log.error(ex.getMessage(), ex);
  408.             try {
  409.                 cs.rollback();
  410.             } catch (Exception ex2) {
  411.                 log.error(ex2.getMessage(), ex2);
  412.             }
  413.         }
  414.         servletRequest.setAttribute("title", title);
  415.         servletRequest.setAttribute("pageInfo", pageInfo);
  416.         return actionMapping.findForward("ShowDownLoad");
  417.     }
  418.     public ActionForward ShowLeaveWord(ActionMapping actionMapping,
  419.                                        ActionForm actionForm,
  420.                                        HttpServletRequest servletRequest,
  421.                                        HttpServletResponse servletResponse) {
  422.         String Language = "CN";
  423.         int pageNo = 0;
  424.         PageInfo pageInfo = null;
  425.         try {
  426.             pageNo = Integer.parseInt(servletRequest.getParameter("pageNo"));
  427.         } catch (Exception ex1) {}
  428.         try {
  429.             if (servletRequest.getSession().getAttribute("Language") != null) {
  430.                 Language = servletRequest.getSession().getAttribute("Language").
  431.                            toString();
  432.             }
  433.             ls.beginTran();
  434.             LeftMenu(Language, servletRequest);
  435.             pageInfo = ls.getPageInfo(Language, "1", pageNo);
  436.             ls.commit();
  437.         } catch (Exception ex) {
  438.             log.error(ex.getMessage(), ex);
  439.             try {
  440.                 ls.rollback();
  441.             } catch (Exception ex2) {
  442.                 log.error(ex2.getMessage(), ex2);
  443.             }
  444.         }
  445.         servletRequest.setAttribute("pageInfo", pageInfo);
  446.         return actionMapping.findForward("ShowLeaveWord");
  447.     }
  448.     public ActionForward ShowContact(ActionMapping actionMapping,
  449.                                      ActionForm actionForm,
  450.                                      HttpServletRequest servletRequest,
  451.                                      HttpServletResponse servletResponse) {
  452.         String Language = "CN";
  453.         try {
  454.             if (servletRequest.getSession().getAttribute("Language") != null) {
  455.                 Language = servletRequest.getSession().getAttribute("Language").
  456.                            toString();
  457.             }
  458.             LeftMenu(Language, servletRequest);
  459.         } catch (Exception ex) {
  460.             log.error(ex.getMessage(), ex);
  461.             try {
  462.                 ls.rollback();
  463.             } catch (Exception ex2) {
  464.                 log.error(ex2.getMessage(), ex2);
  465.             }
  466.         }
  467.         return actionMapping.findForward("ShowContact");
  468.     }
  469.     public ActionForward OpenProduct(ActionMapping actionMapping,
  470.                                      ActionForm actionForm,
  471.                                      HttpServletRequest servletRequest,
  472.                                      HttpServletResponse servletResponse) {
  473.         int pageNo = 0;
  474.         String Language = "CN";
  475.         PageInfo pageInfo = null;
  476.         try {
  477.             pageNo = Integer.parseInt(servletRequest.getParameter("pageNo"));
  478.         } catch (Exception ex1) {}
  479.         try {
  480.             if (servletRequest.getSession().getAttribute("Language") != null) {
  481.                 Language = servletRequest.getSession().getAttribute("Language").
  482.                            toString();
  483.             }
  484.             ps.beginTran();
  485.             LeftMenu(Language, servletRequest);
  486.             pageInfo = ps.getPageInfo(Language, pageNo);
  487.             ps.commit();
  488.         } catch (Exception ex) {
  489.             log.error(ex.getMessage(), ex);
  490.             try {
  491.                 ps.rollback();
  492.             } catch (Exception ex2) {
  493.                 log.error(ex2.getMessage(), ex2);
  494.             }
  495.         }
  496.         servletRequest.setAttribute("pageInfo", pageInfo);
  497.         return actionMapping.findForward("OpenProduct");
  498.     }
  499.     public ActionForward OpenJobs(ActionMapping actionMapping,
  500.                                   ActionForm actionForm,
  501.                                   HttpServletRequest servletRequest,
  502.                                   HttpServletResponse servletResponse) {
  503.         int pageNo = 0;
  504.         String Language = "CN";
  505.         PageInfo pageInfo = null;
  506.         try {
  507.             pageNo = Integer.parseInt(servletRequest.getParameter("pageNo"));
  508.         } catch (Exception ex1) {}
  509.         try {
  510.             if (servletRequest.getSession().getAttribute("Language") != null) {
  511.                 Language = servletRequest.getSession().getAttribute("Language").
  512.                            toString();
  513.             }
  514.             js.beginTran();
  515.             LeftMenu(Language, servletRequest);
  516.             pageInfo = js.getPageInfo(Language, pageNo);
  517.             js.commit();
  518.         } catch (Exception ex) {
  519.             log.error(ex.getMessage(), ex);
  520.             try {
  521.                 js.rollback();
  522.             } catch (Exception ex2) {
  523.                 log.error(ex2.getMessage(), ex2);
  524.             }
  525.         }
  526.         servletRequest.setAttribute("pageInfo", pageInfo);
  527.         return actionMapping.findForward("OpenJobs");
  528.     }
  529.     public ActionForward ShowInvitesInfo(ActionMapping actionMapping,
  530.                                          ActionForm actionForm,
  531.                                          HttpServletRequest servletRequest,
  532.                                          HttpServletResponse servletResponse) {
  533.         Jobs jobs = null;
  534.         boolean b = false;
  535.         String Language = "CN";
  536.         try {
  537.             if (servletRequest.getSession().getAttribute("Language") != null) {
  538.                 Language = servletRequest.getSession().getAttribute("Language").
  539.                            toString();
  540.             }
  541.             js.beginTran();
  542.             LeftMenu(Language, servletRequest);
  543.             jobs = js.GetJobsById(new Long(servletRequest.getParameter("jobID")));
  544.             jobs.setJob_Click(jobs.getJob_Click() + new Long(1));
  545.             b = js.UpdateJobs(jobs);
  546.             js.commit();
  547.         } catch (Exception ex) {
  548.             log.error(ex.getMessage(), ex);
  549.             try {
  550.                 js.rollback();
  551.             } catch (Exception ex2) {
  552.                 log.error(ex2.getMessage(), ex2);
  553.             }
  554.         }
  555.         if (b == false) {
  556.         }
  557.         servletRequest.setAttribute("jobs", jobs);
  558.         return actionMapping.findForward("ShowInvitesInfo");
  559.     }
  560.     public ActionForward ShowLink(ActionMapping actionMapping,
  561.                                   ActionForm actionForm,
  562.                                   HttpServletRequest servletRequest,
  563.                                   HttpServletResponse servletResponse) {
  564.         int pageNo = 0;
  565.         PageInfo pageInfo = null;
  566.         String Language = "CN";
  567.         try {
  568.             pageNo = Integer.parseInt(servletRequest.getParameter("pageNo"));
  569.         } catch (Exception ex1) {}
  570.         try {
  571.             if (servletRequest.getSession().getAttribute("Language") != null) {
  572.                 Language = servletRequest.getSession().getAttribute("Language").
  573.                            toString();
  574.             }
  575.             ls.beginTran();
  576.             LeftMenu(Language, servletRequest);
  577.             pageInfo = links.getPageInfo(new Long(1), pageNo);
  578.             ls.commit();
  579.         } catch (Exception ex) {
  580.             log.error(ex.getMessage(), ex);
  581.             try {
  582.                 ls.rollback();
  583.             } catch (Exception ex2) {
  584.                 log.error(ex2.getMessage(), ex2);
  585.             }
  586.         }
  587.         servletRequest.setAttribute("pageInfo", pageInfo);
  588.         return actionMapping.findForward("ShowLink");
  589.     }
  590.     public ActionForward ShowMap(ActionMapping actionMapping,
  591.                                  ActionForm actionForm,
  592.                                  HttpServletRequest servletRequest,
  593.                                  HttpServletResponse servletResponse) {
  594.         String Language = "CN";
  595.         try {
  596.             if (servletRequest.getSession().getAttribute("Language") != null) {
  597.                 Language = servletRequest.getSession().getAttribute("Language").
  598.                            toString();
  599.             }
  600.             ms.beginTran();
  601.             LeftMenu(Language, servletRequest);
  602.             MapSubmit("QYXX", servletRequest);
  603.             MapSubmit("QYWH", servletRequest);
  604.             MapSubmit("XWGG", servletRequest);
  605.             MapSubmit("GDTD", servletRequest);
  606.             MapSubmit("SCJY", servletRequest);
  607.             MapSubmit("LLZY", servletRequest);
  608.             ms.commit();
  609.         } catch (Exception ex) {
  610.             log.error(ex.getMessage(), ex);
  611.             try {
  612.                 ls.rollback();
  613.             } catch (Exception ex2) {
  614.                 log.error(ex2.getMessage(), ex2);
  615.             }
  616.         }
  617.         return actionMapping.findForward("ShowMap");
  618.     }
  619.     private void MapSubmit(String ColumnName, HttpServletRequest servletRequest) {
  620.         Menu menu = null;
  621.         List list = null;
  622.         String Language = "CN";
  623.         if (servletRequest.getSession().getAttribute("Language") != null) {
  624.             Language = servletRequest.getSession().getAttribute("Language").
  625.                        toString();
  626.         }
  627.         menu = ms.GetMenuByKey(ColumnName + Language);
  628.         list = ms.GetMenuBySuperior(menu.getMen_ID(), Language);
  629.         servletRequest.setAttribute(ColumnName + "List", list);
  630.     }
  631.     public ActionForward SearchIndex(ActionMapping actionMapping,
  632.                                      ActionForm actionForm,
  633.                                      HttpServletRequest servletRequest,
  634.                                      HttpServletResponse servletResponse) {
  635.         AdminActionForm aaf = (AdminActionForm) actionForm;
  636.         int pageNo = 0;
  637.         PageInfo pageInfo = null;
  638.         String Language = "CN";
  639.         try {
  640.             pageNo = Integer.parseInt(servletRequest.getParameter("pageNo"));
  641.         } catch (Exception ex1) {}
  642.         try {
  643.             if (servletRequest.getSession().getAttribute("Language") != null) {
  644.                 Language = servletRequest.getSession().getAttribute("Language").
  645.                            toString();
  646.             }
  647.             is.beginTran();
  648.             pageInfo = is.getPageInfo(aaf.getCondition(),null, Language, pageNo);
  649.             is.commit();
  650.         } catch (Exception ex) {
  651.             log.error(ex.getMessage(), ex);
  652.             try {
  653.                 ls.rollback();
  654.             } catch (Exception ex2) {
  655.                 log.error(ex2.getMessage(), ex2);
  656.             }
  657.         }
  658.         servletRequest.setAttribute("pageInfo", pageInfo);
  659.         return actionMapping.findForward("SearchIndex");
  660.     }
  661.     public ActionForward SearchInformation(ActionMapping actionMapping,
  662.                                            ActionForm actionForm,
  663.                                            HttpServletRequest servletRequest,
  664.                                            HttpServletResponse servletResponse) {
  665.         AdminActionForm aaf = (AdminActionForm) actionForm;
  666.         int pageNo = 0;
  667.         PageInfo pageInfo = null;
  668.         String Language = "CN";
  669.         Menu cmenu = null;
  670.         Long menuID = new Long(0);
  671.         String key = "";
  672.         Menu fMenu = null;
  673.         List menuList = null;
  674.         Long cMenuID = new Long(0);
  675.         try {
  676.             pageNo = Integer.parseInt(servletRequest.getParameter("pageNo"));
  677.         } catch (Exception ex1) {}
  678.         try {
  679.             if (servletRequest.getSession().getAttribute("Language") != null) {
  680.                 Language = servletRequest.getSession().getAttribute("Language").
  681.                            toString();
  682.             }
  683.             if (servletRequest.getParameter("menuID") != null) {
  684.                 menuID = new Long(servletRequest.getParameter("menuID"));
  685.             }
  686.             if (servletRequest.getParameter("cMenuID") != null) {
  687.                 cMenuID = new Long(servletRequest.getParameter("cMenuID"));
  688.             }
  689.             if (servletRequest.getParameter("key") != null) {
  690.                 key = servletRequest.getParameter("key");
  691.             }
  692.             is.beginTran();
  693.             if (key.equals("")) {
  694.                 fMenu = ms.GetMenuById(menuID);
  695.             } else {
  696.                 fMenu = ms.GetMenuByKey(key);
  697.             }
  698.             menuList = ms.GetMenuBySuperior(fMenu.getMen_ID(), Language);
  699.             if(!cMenuID.equals(new Long(0))){
  700.                 cmenu = ms.GetMenuById(cMenuID);
  701.             }else{
  702.                 cmenu = menuList.get(0);
  703.             }
  704.             pageInfo = is.getPageInfo(aaf.getCondition1(), cmenu, Language,
  705.                                       pageNo);
  706.             is.commit();
  707.         } catch (Exception ex) {
  708.             log.error(ex.getMessage(), ex);
  709.             try {
  710.                 is.rollback();
  711.             } catch (Exception ex2) {
  712.                 log.error(ex2.getMessage(), ex2);
  713.             }
  714.         }
  715.         servletRequest.setAttribute("menu", fMenu);
  716.         servletRequest.setAttribute("menuList", menuList);
  717.         servletRequest.setAttribute("pageInfo", pageInfo);
  718.         return actionMapping.findForward("SearchIndex");
  719.     }
  720. }