Ejemplo n.º 1
0
 public String showVehicleDetail() {
   try {
     AnnouncementInfo info =
         (AnnouncementInfo) service.getObject("WxManage.getGonggaoInfoById", announcementInfo);
     String vins = info.getGonggao_veh();
     if (vins != null && !"".equals(vins)) {
       String vinStr = "";
       String[] tmp = vins.split(",");
       for (String v : tmp) {
         vinStr += "'" + v + "',";
       }
       if (!"".equals(vinStr)) vinStr = vinStr.substring(0, vinStr.length() - 1);
       UserInfo user = getCurrentUser();
       VehcileInfo vehinfo = new VehcileInfo();
       vehinfo.setOrganization_id(user.getOrganizationID());
       if (vehicle_ln != null && vehicle_ln != "") {
         vehinfo.setVehicle_ln(vehicle_ln.trim());
       }
       vehinfo.setVehicle_vin(vinStr);
       vehicleList = (List<VehcileInfo>) service.getObjects("WxManage.getInfosVeh", vehinfo);
     }
   } catch (BusinessException e) {
     super.addActionError(getText("info.db.error"));
     log.error(e.getMessage());
     return ERROR;
   } catch (Exception e) {
     super.addActionError(getText("info.db.error"));
     log.error(e.getMessage());
     return ERROR;
   }
   return SUCCESS;
 }
Ejemplo n.º 2
0
 /**
  * 转换Map
  *
  * @param oilusedList
  * @param totalCountDay
  * @param pageIndex
  * @return
  */
 public Map<String, Object> getPagination(
     List<AnnouncementInfo> announcementList, int totalCount, String pageIndex, String rpNum) {
   List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
   Map<String, Object> mapData = new LinkedHashMap<String, Object>();
   try {
     for (int i = 0; i < announcementList.size(); i++) {
       AnnouncementInfo s = (AnnouncementInfo) announcementList.get(i);
       String[] vehTmp = new String[0];
       int wxUserCount = 0;
       if (s.getGonggao_veh() != null && !"".equals(s.getGonggao_veh())) {
         vehTmp = s.getGonggao_veh().split(",");
         String veh = "'" + s.getGonggao_veh().replaceAll(",", "','") + "'";
         wxUserCount = (Integer) service.getObject("WxManage.getWxUserCount", veh);
       }
       Map<String, Object> cellMap = new LinkedHashMap<String, Object>();
       cellMap.put("id", s.getGonggao_id());
       cellMap.put(
           "cell",
           new Object[] {
             (i + 1) + (Integer.parseInt(pageIndex) - 1) * Integer.parseInt(rpNum),
             s.getGonggao_title(),
             s.getUser_name(),
             s.getGonggao_date(),
             vehTmp.length,
             wxUserCount
           });
       mapList.add(cellMap);
     }
     mapData.put("page", pageIndex); // 从前台获取当前第page页
     mapData.put("total", totalCount); // 从数据库获取总记录数
     mapData.put("rows", mapList);
   } catch (BusinessException e) {
     addActionError(getText(e.getMessage()));
   }
   return mapData;
 }