/** * . * * @param mapping ActionMapping * @param form ActionForm * @param request HttpServletRequest * @param response HttpServletResponse * @return ActionForward */ public ActionForward list( final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, final HttpServletResponse response) { String forward = "success"; String callback = request.getParameter("callback"); String pkgType = request.getParameter("pkgType") != null ? request.getParameter("pkgType") : ""; String prodCode = request.getParameter("prodCode"); String projCode = request.getParameter("projCode"); List<Map<String, Object>> selectList = new ArrayList<Map<String, Object>>(); if (pkgType.equalsIgnoreCase("303")) { CogDao cogDao = new CogDao(); selectList = cogDao.findBy(prodCode); // System.out.println(selectList); } else if (pkgType.equalsIgnoreCase("304")) { TradPkgDao tradPkgDao = new TradPkgDao(); selectList = tradPkgDao.findByProjCode(projCode); // System.out.println(selectList); } else if (pkgType.equalsIgnoreCase("305")) { // add new packType CspDao cspDao = new CspDao(); selectList = cspDao.findByProjCode(projCode); // System.out.println(selectList); } else if (pkgType.equalsIgnoreCase("306")) { RwDao rwDao = new RwDao(); selectList = rwDao.findBy(prodCode); // System.out.println(selectList); } else if (pkgType.equalsIgnoreCase("314")) { TsvDao tsvDao = new TsvDao(); selectList = tsvDao.findPkgCode(prodCode); // System.out.println(selectList); } else { IcTapeDao icTapeDao = new IcTapeDao(); selectList = icTapeDao.findByProdCode(prodCode); // System.out.println(selectList); } request.setAttribute("selectList", selectList); request.setAttribute("callback", callback); return mapping.findForward(forward); }
/** * Do action performance. * * @param mapping ActionMapping * @param form ActionForm * @param request HttpServletRequest * @param response HttpServletResponse * @return ActionForward * @throws Exception exception */ public ActionForward execute( final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, final HttpServletResponse response) throws Exception { String prodCode = request.getParameter("prodCode"); IcTapeDao icTapeDao = new IcTapeDao(); CogDao cogDao = new CogDao(); SapMasterCustomerDao sapMasterCustomerDao = new SapMasterCustomerDao(); List<String> custList = new ArrayList<String>(); List<String> extCustList = new ArrayList<String>(); String custs = ""; custList.addAll(icTapeDao.findCustByProdCode(prodCode)); // custList.addAll(cogDao.findCustByProdCode(prodCode)); for (String s : custList) { if (!extCustList.contains(s) && StringUtils.isNotEmpty(s)) { extCustList.add(s); } } for (String s : extCustList) { if (s != null && !s.equals("") && !s.equals("null")) { SapMasterCustomerTo sapMasterCustomerTo = sapMasterCustomerDao.findByVendorCode(s); if (sapMasterCustomerTo != null && StringUtils.isNotEmpty(sapMasterCustomerTo.getShortName())) { custs += "/" + sapMasterCustomerTo.getShortName(); } } } if (custs.length() > 0) { custs = custs.substring(1); } List<String> cogCust = cogDao.findCustByProdCode(prodCode); extCustList = new ArrayList<String>(); if (cogCust != null && cogCust.size() > 0) { for (String s : cogCust) { if (!extCustList.contains(s) && StringUtils.isNotEmpty(s)) { extCustList.add(s); } } } for (String s : extCustList) { custs += "/" + s; } if (custs.endsWith("/")) { custs = custs.substring(0, custs.length()); } PrintWriter out = response.getWriter(); out.print(Escape.escape(custs)); return null; }