public void query(HttpServletRequest req, HttpServletResponse resp, String name) throws ServletException, IOException { int page = Integer.parseInt(req.getParameter("page")); int rows = Integer.parseInt(req.getParameter("rows")); int count = wlcs.getWTMD_Count(name); JSONObject jsonObj = new JSONObject(); JSONArray jsonArray = new JSONArray(); JSONObject json_Obj = null; List<SYJK_CCS_QGCLWTMDXX_TEMP> list_w = wlcs.getWTMD_W(page, rows, name); for (int i = 0; i < list_w.size(); i++) { json_Obj = new JSONObject(); SYJK_CCS_QGCLWTMDXX_TEMP wtmd = list_w.get(i); wtmd = WhiteList_Tool.Hanization(wtmd); json_Obj.put("R", i + 1); json_Obj.put("ID", wtmd.getID()); json_Obj.put("CLSBDM", wtmd.getCLSBDM()); json_Obj.put("SKSSSQ", DateUtil.getStringDate(wtmd.getSKSSSQ(), null)); json_Obj.put("SKSSZQ", DateUtil.getStringDate(wtmd.getSKSSZQ(), null)); json_Obj.put("DQYNSE", wtmd.getDQYNSE()); json_Obj.put("REVENUECODE", wtmd.getREVENUECODE()); json_Obj.put("WS", wtmd.getWSPZ()); json_Obj.put("YCYYDM", wtmd.getYCYYDM()); jsonArray.add(json_Obj); } jsonObj.put("total", count); jsonObj.put("rows", jsonArray); ResponseUtil.write(resp, jsonObj); System.out.println(jsonArray); }
/** * @author MILI * @throws IOException * @time 2014-12-4 09:00:37 @描述:xls写入数据库 */ public void Insert_xls( HttpServletRequest request, HttpServletResponse resp, Map<String, String> map) throws IOException { String file_date = map.get("File_path"); String path = request.getSession().getServletContext().getRealPath("/") + "upload/bmd/" + file_date + "/"; path += map.get("NAME"); // 保存到本地 List<String[]> list = white_tool.analyze_xls(path); List<String> list_error = null; List<Map<String, String>> list_map = new ArrayList<Map<String, String>>(); for (int i = 2; i < list.size(); i++) { Map<String, String> map_value = new HashMap<String, String>(); for (int j = 0; j < list.get(i).length; j++) { // if("APPLYSTATUS".equals(list.get(0)[j])){ // map_value.put(list.get(0)[j], "0"); // }else{ map_value.put(list.get(0)[j], list.get(i)[j].trim()); // } } list_map.add(map_value); } boolean flag = false; for (int i = 0; i < list_map.size(); i++) { Map<String, String> map_clsbdm = list_map.get(i); flag = wlcs.saveWtmd(this.getWDMI(map_clsbdm), map_clsbdm.get("LOGINNAME")); if (!flag) { // 有更新失败记录提示 list_error = new ArrayList<String>(); list_error.add(map_clsbdm.get("CLSBDM") + "文件上传出错"); } } ResponseUtil.write(resp, list_error); }
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int page = Integer.parseInt(request.getParameter("page")); int rows = Integer.parseInt(request.getParameter("rows")); String vin = request.getParameter("vin"); String taxqueryno = request.getParameter("taxqueryno"); String cph = request.getParameter("cph"); String jym = request.getParameter("jym"); JSONObject json = new JSONObject(); JSONArray array = new JSONArray(); JSONObject result = null; BusiQueryDao busiQueryDao = new BusiQueryDao(); ArrayList<BusiQueryUtil> list; try { list = (ArrayList<BusiQueryUtil>) busiQueryDao.getCondition(page, rows, vin, taxqueryno, cph, jym); int total = busiQueryDao.busiCount(); for (int i = 0; i < list.size(); i++) { result = new JSONObject(); BusiQueryUtil busiQueryUtil = list.get(i); result.put("TAXQUERYNO", busiQueryUtil.getTAXQUERYNO()); result.put("VIN", busiQueryUtil.getVIN()); result.put("TAXPAYERNAME", busiQueryUtil.getTAXPAYERNAME()); result.put("TAXLOCATIONCODE", busiQueryUtil.getTAXLOCATIONCODE()); result.put("EngineNo", busiQueryUtil.getEngineNo()); result.put("TAXCONDITIONCODE", busiQueryUtil.getTAXCONDITIONCODE()); array.add(result); } json.put("total", total); json.put("rows", array); ResponseUtil.write(response, json); System.out.println(json.toString()); System.out.println(array.toString()); } catch (Exception e) { e.printStackTrace(); } /* try { BusiQueryDao busiQueryDao = new BusiQueryDao(); JSONObject result=new JSONObject(); JSONArray jsonArray=JsonUtil.getJsonArray(busiQueryDao.getBusiQuery(page ,rows)); int total=busiQueryDao.busiCount(); result.put("rows", jsonArray); result.put("total", total); ResponseUtil.write(response, result); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } */ }
// 删除 public void delete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String id = req.getParameter("id"); String[] ids = id.split(","); boolean falg = wlcs.deleteWtmd(ids); JSONObject json_Obj = new JSONObject(); if (falg) { json_Obj.put("success", "success"); } else { json_Obj.put("error", "error"); } ResponseUtil.write(resp, json_Obj); System.out.println(json_Obj); }
// //修改查询 // public void edit(HttpServletRequest req, HttpServletResponse resp)throws // ServletException, IOException{ // String id = req.getParameter("id"); // boolean falg = wlcs.queryWtmd(id); // System.out.println("edit1"); // } // 修改保存 public void editSave(HttpServletRequest req, HttpServletResponse resp, Map<String, String> map) throws ServletException, IOException { String id = req.getParameter("id"); SYJK_CCS_QGCLWTMDXX_TEMP wtmd = getWDMI(map); boolean falg = wlcs.saveEdit(wtmd, id); JSONArray jsonArray = new JSONArray(); JSONObject json_Obj = new JSONObject(); if (falg) { json_Obj.put("success", "success"); } else { json_Obj.put("error", "error"); } jsonArray.add(json_Obj); ResponseUtil.write(resp, json_Obj); System.out.println(json_Obj); System.out.println(jsonArray); }