Example #1
0
 public static void forward(String str) throws ServletException, IOException {
   request = ServletActionContext.getRequest();
   response = ServletActionContext.getResponse();
   RequestDispatcher rd;
   rd = request.getRequestDispatcher(str);
   rd.forward(request, response);
 }
Example #2
0
 // zz for shopGoods
 public String sdetial() {
   String sid = "";
   if (ServletActionContext.getRequest().getParameter("sid") != null) {
     sid = ServletActionContext.getRequest().getParameter("sid");
     String pageNo = ServletActionContext.getRequest().getParameter("page.pageNo");
     String pageSize = ServletActionContext.getRequest().getParameter("page.pageSize");
     // System.out.println("no-"+pageNo+"size-"+pageSize);
     if (pageNo != null && pageSize != null) {
       pagegoods.setPageNo(Integer.parseInt(pageNo));
       pagegoods.setPageSize(Integer.parseInt(pageSize));
     }
   } else {
     sid = session.get("shopid").toString();
   }
   Shop shop = shopService.get(Integer.parseInt(sid));
   request.put("shop", shop);
   // System.out.println("no-"+pagegoods.getPageNo()+"size-"+pagegoods.getPageSize());
   pagegoods = goodsService.getShop(pagegoods, Integer.parseInt(sid));
   if (pagegoods != null && pagegoods.getTotalItems() > 0) {
     request.put("msg", "");
   } else {
     request.put("msg", "该店铺尚未添加商品");
   }
   request.put("page", pagegoods);
   return "lists";
 }
  public String auctionDetailAll() {
    logger.info("11111___________");
    String auctionFlag = ServletActionContext.getRequest().getParameter("auctionFlag");
    if (auctionFlag == null) return "auctionDetailAll";
    String detailType = ServletActionContext.getRequest().getParameter("detailType");

    String returnVal = "";
    AuctionInfoDtoIndex auctionInfoDtoIndex = iAuctionInfo.getAuctionInfoIndexDto(auctionFlag);
    if (auctionInfoDtoIndex == null || ("0").equals(auctionInfoDtoIndex.getPublishFlag())) {
      return "sessionDestory";
    }
    if ("1".equals(detailType)) {
      returnVal = auctionInfoDtoIndex.getAuctionBulletin();
    } else if ("2".equals(detailType)) {
      returnVal = auctionInfoDtoIndex.getAuctionNotice();
    } else if ("3".equals(detailType)) {
      returnVal = auctionInfoDtoIndex.getAuctionGuide();
    } else if ("4".equals(detailType)) {
      returnVal = auctionInfoDtoIndex.getAuctionDescription();
    } else {

    }
    ServletActionContext.getRequest().setAttribute("returnVal", returnVal);
    return "auctionDetailAll";
  }
Example #4
0
  public String preEditMyCustomer() throws Exception {
    HttpServletRequest request = ServletActionContext.getRequest();
    HttpServletResponse response = ServletActionContext.getResponse();

    String json = "";
    String ids = request.getParameter("pid").trim();
    String shop_no = ids.split("\\|")[0];
    String pos_no = ids.split("\\|")[1];
    String pan = ids.split("\\|")[2];
    ArrayList<String> arrayList = new ArrayList<String>();
    arrayList.add("shop_no,string," + shop_no);
    arrayList.add("pos_no,string," + pos_no);
    arrayList.add("pan,string," + pan);
    List myCustomerList = myCustomerBean.execHql("myCustomer", "findMyCustomer", arrayList);
    MyCustomer mc = new MyCustomer();
    if (myCustomerList != null && !myCustomerList.isEmpty()) {
      mc = (MyCustomer) myCustomerList.get(0);
    }
    json = JsonFormat.objectToJson(mc);
    // 需要加商户名称
    Shop s = new Shop();
    arrayList.clear();
    arrayList.add("shop_no,string," + mc.getShop_no().trim());
    List shopList = myCustomerBean.execHql("shop", "findShop", arrayList);
    if (shopList != null && !shopList.isEmpty()) {
      s = (Shop) shopList.get(0);
      json += ",shop_name:'" + s.getShop_name() + "'";
    }
    response.setContentType("text/html;charset=utf-8");
    response.getWriter().write(json);
    return null;
  }
  public String execute() throws Exception {

    if (ServletActionContext.getRequest().getServerName().equals("wikitimes.l3s.de")) {
      contextPath = null;
      useContextPath = false;
    } else {
      contextPath = ServletActionContext.getServletContext().getContextPath();
      useContextPath = true;
    }

    DatabaseManager db = null;
    try {
      db = new DatabaseManager();
      if (fromDate == null || toDate == null)
        stories = helper.getStoryList(db.getEventsByCategory(categoryId, null, null));
      else if (fromDate.isEmpty() || toDate.isEmpty())
        stories = helper.getStoryList(db.getEventsByCategory(categoryId, null, null));
      else stories = helper.getStoryList(db.getEventsByCategory(categoryId, fromDate, toDate));
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (db != null) db.closeConnection();
    }

    return "StoryListView";
  }
  // 获取报废信息
  public void getReject() throws IOException {
    HttpServletRequest request =
        (HttpServletRequest) (ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST));
    String equid = request.getParameter("equid");
    this.equipmentreject = this.equipmentrejectService.findbyEquipmentId(equid);
    String jsonstr = "";
    if (this.equipmentreject != null) {
      jsonstr = "{status:'0'";
      jsonstr += ",userId:'" + this.equipmentreject.getRejectuser() + "'";
      jsonstr +=
          ",rejectReason:'"
              + java.net.URLEncoder.encode(this.equipmentreject.getRejectreason(), "UTF-8")
              + "'";
      this.officeteacher = this.officeteacherService.findById(this.equipmentreject.getRejectuser());
      if (this.officeteacher != null) {
        jsonstr +=
            ",userName:'******'";
      } else {
        jsonstr += ",userName:'******'";
      }
      jsonstr += ",rejectTime:'" + this.equipmentreject.getRejecttime() + "'}";
      ServletActionContext.getResponse().getWriter().write(jsonstr);

    } else {
      ServletActionContext.getResponse().getWriter().write("{status:'1'}");
    }
  }
Example #7
0
  public String query() throws IOException {
    List<Song> songs = songService.findSongs();

    JsonConfig jc = new JsonConfig();
    jc.setExcludes(
        new String[] {
          "recorder",
          "copyright",
          "size",
          "initiateName",
          "keyword",
          "date",
          "description",
          "singer"
        });

    JSONArray jsonArray = JSONArray.fromObject(songs, jc);

    String json = jsonArray.toString();

    System.out.print(json);
    ServletActionContext.getResponse().setContentType("text/json;charset=UTF-8");
    System.out.println(json);
    ServletActionContext.getResponse().getWriter().print(json);

    return NONE;
  }
Example #8
0
  public void core() {
    // 获取HttpServletRequest,HttpServletResponse对象,以实现数据流交互
    HttpServletRequest request = ServletActionContext.getRequest();
    HttpServletResponse response = ServletActionContext.getResponse();
    try {
      request.setCharacterEncoding("utf-8");
    } catch (UnsupportedEncodingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    response.setCharacterEncoding("utf-8");
    httpServletBean.setHttpServletRequest(request);

    coreService.setHttpServletBean(httpServletBean);
    String result = coreService.dispose();
    try {
      response.setCharacterEncoding("utf-8");
      response.getWriter().print(result);
      response.getWriter().flush();
      response.getWriter().close();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
Example #9
0
  /**
   * 添加信息随访模板维护
   *
   * @return
   */
  public String addFlupModule() {
    HttpServletResponse response = ServletActionContext.getResponse();
    HttpServletRequest request = ServletActionContext.getRequest();
    try {
      FlupModule flupModule = new FlupModule();
      //			flupModule.setInfoCode(request.getParameter("infoCode"));
      flupModule.setInfoName(request.getParameter("infoName"));
      flupModule.setInfoContent(request.getParameter("infoContent"));
      flupModule.setMaintainDept(request.getParameter("maintainDept"));
      flupModule.setInfoBeyone(request.getParameter("infoBeyone"));
      flupModule.setInfoBelong(request.getParameter("infoBelong"));
      flupModule.setOperateEmpolyeeCode(SessionData.getEmployeeCode()); // 医生工号设置成死的暂时
      int result = flupModuleService.savaFlupModule(flupModule);
      if (result == 1) response.getWriter().print("success");
      else response.getWriter().print("faild");

    } catch (Exception e) {
      e.printStackTrace();
      try {
        response.getWriter().print("error");
      } catch (IOException e1) {
        e1.printStackTrace();
      }
    }
    return null;
  }
Example #10
0
 /** 获得系数列表; */
 @SuppressWarnings("unchecked")
 public void showAll() {
   try {
     String barId = ServletActionContext.getRequest().getParameter("barId");
     ExtLimit limit =
         (ExtLimit)
             EntityReflect.createObjectFromRequest(
                 ServletActionContext.getRequest(), ExtLimit.class);
     BarProportion barProportion =
         (BarProportion)
             EntityReflect.createObjectFromRequest(
                 ServletActionContext.getRequest(), BarProportion.class);
     barProportion.setExtLimit(limit);
     barProportion.setBarId(TypeConverterUtil.parseInt(barId));
     int count = barProportionService.selectLimitCount(barProportion);
     List<Department> barProportionList = barProportionService.selectByLimit(barProportion);
     AjaxOut.responseJSonGrid(
         ServletActionContext.getResponse(),
         barProportionList,
         count,
         new SimpleDateFormat("yyyy-MM-dd"));
   } catch (Exception e) {
     logger.error("", e);
   }
 }
  public String execute() {
    HttpServletRequest request = ServletActionContext.getRequest();
    HttpServletResponse response = ServletActionContext.getResponse();

    try {
      int custId;

      KKAppEng kkAppEng = this.getKKAppEng(request, response);

      custId = this.loggedIn(request, response, kkAppEng, null);

      // Force the user to login if configured to do so
      if (custId < 0 && kkAppEng.isForceLogin()) {
        return KKLOGIN;
      }

      // Ensure we are using the correct protocol. Redirect if not.
      String redirForward = checkSSL(kkAppEng, request, custId, /* forceSSL */ false);
      if (redirForward != null) {
        setupResponseForSSLRedirect(response, redirForward);
        return null;
      }

      kkAppEng.getNav().set(kkAppEng.getMsg("header.advanced.navigation"), request);
      return SUCCESS;

    } catch (Exception e) {
      return super.handleException(request, e);
    }
  }
Example #12
0
  /** 新增系数; */
  public void save() {
    JSONObject obj = new JSONObject();
    obj.put("success", true);
    try {
      BarProportion barProportion =
          (BarProportion)
              EntityReflect.createObjectFromRequest(
                  ServletActionContext.getRequest(), BarProportion.class);

      List<BarProportion> proportionList =
          barProportionService.selectProportionByDate(barProportion);
      UserInfoEty user = this.getLoginUser();
      if (barProportion.getId() == null) {
        if (proportionList.isEmpty()) {
          barProportion.setStatus(START_STATUS);
          barProportion.setCreateTime(new Date());
          barProportion.setCreator(user.getUsername());
          barProportionService.insert(barProportion);
          obj.put("result", "success");
        } else {
          obj.put("result", "use"); // use 表示要插入或更改的日期已经存在.
        }
      } else {
        if (proportionList.isEmpty()) {
          barProportionService.updateById(barProportion);
          obj.put("result", "success");
        } else {
          obj.put("result", "use");
        }
      }
    } catch (Exception e) {
      logger.error("", e);
    }
    AjaxOut.responseText(ServletActionContext.getResponse(), obj.toString());
  }
Example #13
0
  /** 通过活动类型获取时间进行比较 */
  public String judgeNameRepeat() {
    try {
      HttpServletRequest request = ServletActionContext.getRequest();
      HttpServletResponse response = ServletActionContext.getResponse();
      request.setCharacterEncoding("UTF-8");
      response.setCharacterEncoding("UTF-8");

      // 获取活动类型 开始时间 结束时间
      String caseName = request.getParameter("caseName");
      String caseStime = request.getParameter("caseSt");
      String caseEtime = request.getParameter("caseEt");

      // 转化为dateTime
      Timestamp startTime = Timestamp.valueOf(caseStime);
      Timestamp endTime = Timestamp.valueOf(caseEtime);

      int spaceTime = paraDtService.getCaseNameTime(caseName, startTime, endTime);
      if (spaceTime > 0) {
        flag = true;
      } else if (spaceTime == 0) {
        flag = false;
      }
    } catch (UnsupportedEncodingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return SUCCESS;
  }
Example #14
0
  /** 通过名称获取活动类型 */
  public String getNamePCP() {
    try {
      HttpServletRequest request = ServletActionContext.getRequest();
      HttpServletResponse response = ServletActionContext.getResponse();
      request.setCharacterEncoding("UTF-8");
      response.setCharacterEncoding("UTF-8");

      // 获取活动类型
      String caseName = request.getParameter("caseName");
      paraCaseP = paraCasePService.getNameParaCaseP(caseName);

      // 创建map集合封装页面要显示的数据
      dataMap = new HashMap<String, Object>();
      dataMap.put("caseCode", paraCaseP.getCaseCode());
      dataMap.put("CType", paraCaseP.getCType());
      dataMap.put("num", paraCaseP.getNum());

      // 将map对象转换成json类型数据
      jsonResult = dataMap;

    } catch (UnsupportedEncodingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return "jsonResult";
  }
Example #15
0
  public String execute() throws Exception {
    List<MenuModel> menuList = new ArrayList<MenuModel>();
    if (parentid == null
        || parentid.length() <= 0
        || name == null
        || name.length() <= 0
        || projectid == null
        || projectid.length() <= 0) {
      request.setAttribute("errorMes", "");
      return ERROR;
    }

    MenuService service = new MenuService();
    response = ServletActionContext.getResponse();
    PrintWriter writer = response.getWriter();
    response.setContentType("text/html;charset=utf-8");
    try {
      boolean result =
          service.insertMenu(name, Long.parseLong(parentid), Long.parseLong(projectid));
      menuList = service.getMenuList(projectid);
      String _r = "{\"id\":" + service.newNemuId + ",\"result\":" + result + "}";
      writer.println(_r);
    } catch (Exception e) {
      logger.error("��Ӳ˵��쳣", e);
      e.printStackTrace();
    } finally {
      writer.flush();
      writer.close();
    }

    request = ServletActionContext.getRequest();
    request.getSession().setAttribute("menuList", menuList);

    return SUCCESS;
  }
Example #16
0
  private void addEntryDataToCookie() {

    Cookie cookie = null;

    if (enc != null) {

      cookie = new Cookie(PortalConstants.Key.SEURE_PARAM_KEY, ByteUtil.stringToHexString(enc));
      cookie.setPath("/");
      cookie.setMaxAge(cookieAge);
      ServletActionContext.getResponse().addCookie(cookie);
    }

    if (title != null) {

      cookie = new Cookie("title", title);
      cookie.setPath("/");
      cookie.setMaxAge(cookieAge);
      ServletActionContext.getResponse().addCookie(cookie);
    }

    if (apply != null) {

      cookie = new Cookie("apply", apply);
      cookie.setPath("/");
      cookie.setMaxAge(cookieAge);
      ServletActionContext.getResponse().addCookie(cookie);
    }
  }
Example #17
0
public class FeeUseAction extends BaseAction {

  private HttpServletResponse response = ServletActionContext.getResponse();
  private HttpServletRequest request = ServletActionContext.getRequest();
  private HttpSession session = request.getSession(false);
  private static Log log = LogFactory.getLog(FeeUseAction.class);

  /**
   * 创建机构的兑换类型
   *
   * @throws Exception
   */
  public String createCompanyFeeUse() throws Exception {
    response.setContentType("text/xml;charset=UTF-8");
    Writer wr = response.getWriter();
    String str = new String((request.getParameter("context")).getBytes("ISO-8859-1"), "GBK");
    Common c = new Common();
    JSONObject obj = (JSONObject) JSONValue.parse(str);
    JSONArray array = (JSONArray) obj.get("content");
    c.setFee_usetype_name((String) (((JSONObject) array.get(0)).get("param1")));
    c.setFormula((String) (((JSONObject) array.get(0)).get("param2")));
    c.setFee_usetype_company((String) (((JSONObject) array.get(0)).get("param3")));
    c.setCreator(((LoginUser) session.getAttribute("LoginUser")).getUser_cd());
    JSONObject jsonObject =
        ((FeeUseServiceImpl) getBean("feeUseServiceImpl")).createCompanyFeeUse(c);
    wr.write(jsonObject.toJSONString());
    wr.close();

    return null;
  }
}
  public String image() throws IOException {
    BufferedImage buffImage = new BufferedImage(100, 42, BufferedImage.TYPE_INT_RGB);
    Graphics gra = buffImage.getGraphics();
    Color color = new Color(200, 255, 200);
    gra.setColor(color);
    gra.fillRect(0, 0, 100, 42);

    char[] ch = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toCharArray();
    Random random = new Random();
    int len = ch.length;
    int index;
    StringBuffer strB = new StringBuffer();
    for (int i = 0; i < 4; i++) {
      index = random.nextInt(len);
      gra.setColor(new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255)));
      gra.setFont(new Font("宋体", Font.BOLD, 30));
      gra.drawString(ch[index] + "", (i * 20 + 5), 25);
      strB.append(ch[index]);
    }
    ImageIO.write(
        buffImage,
        "JPG",
        new File(ServletActionContext.getServletContext().getRealPath("image") + "/verify.jpg"));

    ServletActionContext.getRequest().getSession().setAttribute("verify", strB.toString());
    System.out.println(strB.toString());
    return "image";
  }
  public void loginEx() throws Exception {
    try {
      // System.out.println(username+ "+" +password);
      if (false == userService.isUsernameExist(username)) {
        success = false;
        error = "username is not exist.";
        return;
      }
      User user_ = new User();
      user_ = userService.checkLogin(username, password);
      if (null != user_) {

        OnlineUsers.onlineUser(user_.getUsername());

        user_.setLastlogin(new Date());
        userService.save(user_);

        ActionContext.getContext().getSession().put("session_username", user_.getUsername());
        ServletActionContext.getResponse().getWriter().print(1);
        success = true;

        return;
      } else {
        ServletActionContext.getResponse().getWriter().print(0);
        success = false;
        error = "password is invalid.";
        return;
      }
    } catch (Exception e) {
      // TODO: handle exception
      success = false;
      error = "Unknown Error.";
      return;
    }
  }
  public String uploadImage() {

    System.out.println("1111" + albumId);
    HttpSession session = ServletActionContext.getRequest().getSession(false);
    User user = (User) session.getAttribute("user");
    System.out.println("UserPostAction Photo===>" + picFileName);
    System.out.println("UserPostAction Photo===>" + picContentType);
    System.out.println("UserPostAction Photo===>" + pic);
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date dateobj = new Date();
    UserImageUploadDAO up = new UserImageUploadDAOImpl();
    String destpath = "";
    String imageExtension = "";
    if (picContentType != null && picContentType.contains("jpeg")) {
      imageExtension = ".jpeg";
    } else if (picContentType != null && picContentType.contains("png")) {
      imageExtension = ".png";
    } else if (picContentType != null && picContentType.contains("gif")) {
      imageExtension = ".gif";
    } else if (picContentType != null && picContentType.contains("jpg")) {
      imageExtension = ".jpg";
    }
    if (picFileName != null) {
      Random randomGenerator = new Random();
      Integer randomInt = randomGenerator.nextInt(1000000);
      picFileName = randomInt.toString() + imageExtension;
      System.out.println("UserPostAction Photo===>" + picFileName);

      String name = up.getAlbumName(getAlbumId());
      destpath = StringUtils.photoPath + File.separator + user.getUserId() + "_" + name;
      System.out.println("Server path:" + destpath);
      File destFile = new File(destpath, picFileName);
      try {
        FileUtils.copyFile(pic, destFile);
      } catch (IOException e) {
        System.out.println("error occurred");
        e.printStackTrace();
        return ERROR;
      }
    }
    // if(friendId==null || friendId=="")
    // {
    user_id = user.getUserId();
    setUser_id(user_id);
    up.uploadImage(df.format(dateobj).toString(), albumId, picFileName);
    Integer aid = albumId;
    HttpServletRequest request = ServletActionContext.getRequest();
    request.setAttribute("albumId", aid.toString());
    request.setAttribute("imageList", imageList);

    // }
    // else{
    /*NewsFeedDAOImpl nfd=new NewsFeedDAOImpl();
    String userName=nfd.getFullUserName(friendId);

    up.postOnWall(postDesc, user.getUserId(),friendId,  df.format(dateobj).toString(),userName+" status Update","timeline",youtubeLink,picFileName);*/
    // }
    addActionMessage("Content has been posted successfully.");
    return "success";
  }
Example #21
0
  public String play() throws IOException {
    Song song = songService.findById(model.getSongId());

    JsonConfig jc = new JsonConfig();
    jc.setExcludes(
        new String[] {
          "recorder",
          "copyright",
          "size",
          "initiateName",
          "keyword",
          "date",
          "description",
          "singer"
        });

    JSONObject jsonObject = JSONObject.fromObject(song, jc);

    String json = jsonObject.toString();

    System.out.print(json);
    ServletActionContext.getResponse().setContentType("text/json;charset=UTF-8");
    System.out.println(json);
    ServletActionContext.getResponse().getWriter().print(json);

    return NONE;
  }
 public String getGroupDetails() {
   GroupDAO grp = new GroupDAOImpl();
   System.out.println("group_id     " + group_id);
   setGroupDetail(null);
   HttpSession session = ServletActionContext.getRequest().getSession(false);
   User u = (User) session.getAttribute("user");
   if (!(group_id == null)) {
     setGroupDetail(grp.getGroupDetails(group_id, Integer.parseInt(u.getUserId())));
     System.out.println("group id" + groupDetail.getGroup_id());
     System.out.println("group name" + groupDetail.getGroup_name());
   }
   NewsFeedAction n = new NewsFeedAction();
   setGrpList(grp.getAllGroups(Integer.parseInt(u.getUserId())));
   setFeedList(n.getGroupNewsFeed(group_id));
   int i = 0;
   while (i < grpList.size()) {
     System.out.println(grpList.get(i).getGroup_id());
     i++;
   }
   i = 0;
   System.out.println("post..................");
   while (i < feedList.size()) {
     System.out.println(feedList.get(i).getPostId());
     i++;
   }
   HttpServletRequest request = ServletActionContext.getRequest();
   request.setAttribute("groupDetail", groupDetail);
   request.setAttribute("grpList", grpList);
   request.setAttribute("groupDetail", groupDetail);
   return "success";
 }
Example #23
0
  public String delMyCustomers() throws Exception {
    HttpServletRequest request = ServletActionContext.getRequest();
    HttpServletResponse response = ServletActionContext.getResponse();

    Oper operSess = (Oper) request.getSession().getAttribute("oper");
    String json = "";
    String editid = StringUtil.formatNullString(request.getParameter("datagrid_editId"));
    String[] ids = editid.split(",");
    HashMap<String, ArrayList<String>> map = new HashMap<String, ArrayList<String>>();
    String sql = PreparedSqlHelper.getEntityExtendSql("myCustomer", "delete");
    ArrayList<String> list = new ArrayList<String>();
    for (String id : ids) {
      String shop_no = id.split("\\|")[0];
      String pos_no = id.split("\\|")[1];
      String pan = id.split("\\|")[2];
      list.add("shop_no,string," + shop_no + "#pos_no,string," + pos_no + "#pan,string," + pan);
    }

    map.put(sql, list);
    myCustomerBean.iudData(map);
    json = DELETE_SUCCESS;
    response.setContentType("text/html;charset=utf-8");
    response.getWriter().write(json);
    return null;
  }
Example #24
0
  // 修改成员信息
  public String UpdateMember() throws Exception {
    UserDAO uDAO = null;
    String retMess = "UpdateMemberFailed";

    try {
      uDAO = DAOFactory.getUserDAOInstance();
      User user = new User();
      // 获得uId
      setUserId(Integer.parseInt(ServletActionContext.getRequest().getParameter("uId")));

      user.setuId(getUserId());
      user.setuMgr(getUserMgr());
      user.setuEducation(getUserEducation());

      if (uDAO.doUpdateMember(user)) {
        ArrayList<User> uList = (ArrayList<User>) uDAO.doSelectById(getUserId());

        HttpServletRequest request = ServletActionContext.getRequest();
        request.setAttribute("uList", uList);

        ArrayList<String> mgrList = (ArrayList<String>) uDAO.doSelectAllMgr(getUserId());
        request.setAttribute("mgrList", mgrList);

        retMess = "UpdateMember";
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
    return retMess;
  }
Example #25
0
 public void addUser() {
   PrintWriter out = null;
   try {
     HttpServletRequest request = ServletActionContext.getRequest();
     HttpServletResponse response = ServletActionContext.getResponse();
     response.setContentType("text/html;charset=UTF-8");
     String account = request.getParameter("account");
     String name = request.getParameter("name");
     String address = request.getParameter("address");
     User user = new User();
     user.setAccount(account);
     user.setAddress(address);
     user.setName(name);
     userService.add(user);
     out = response.getWriter();
     out.write(new Gson().toJson("success"));
   } catch (Exception e) {
     e.printStackTrace();
     logger.error(e.getMessage());
     if (out != null) out.write(new Gson().toJson("fail"));
   } finally {
     out.flush();
     out.close();
   }
 }
Example #26
0
  public String saveServicePriceToSession() throws Exception {
    Map<String, Object> rt = new HashMap<String, Object>();
    String returnType = ServletActionContext.getRequest().getParameter("returnType");
    String serviceIdDetail = ServletActionContext.getRequest().getParameter("serviceIdDetail");
    String catalogNo = ServletActionContext.getRequest().getParameter("catalogNo");
    String key = null;
    if ("serviceId".equals(returnType)) {
      servicePrice.setServiceId(Integer.valueOf(serviceIdDetail));
      key = servicePrice.getCatalogId() + "_" + servicePrice.getServiceId();
    } else {
      List<com.genscript.gsscm.serv.entity.Service> serv =
          this.servService.getServiceByCatalogNo(catalogNo);
      servicePrice.setServiceId(serv.get(0).getServiceId());
      key = servicePrice.getCatalogId() + "_" + catalogNo;
    }

    ServicePrice sp =
        this.servService.getServicePriceByServiceIdAndCatalogId(
            servicePrice.getCatalogId(), servicePrice.getServiceId());
    if (sp == null) {
      sp = servicePrice;
    } else {
      sp.setLimitPrice(servicePrice.getLimitPrice());
      sp.setStandardPrice(servicePrice.getStandardPrice());
      sp.setPriceRuleGroup(servicePrice.getPriceRuleGroup());
      sp.setCategoryId(servicePrice.getCategoryId());
    }
    SessionUtil.updateOneRow(SessionPdtServ.ServicePricing.value(), sessionServiceId, key, sp);
    rt.put("key", key);
    rt.put("message", SUCCESS);
    Struts2Util.renderJson(rt);
    return null;
  }
Example #27
0
 // 客服设置首页商品
 public String getGoods() {
   String shopId = ServletActionContext.getRequest().getParameter("shop");
   String key = ServletActionContext.getRequest().getParameter("keyword");
   System.out.println("shopId" + shopId);
   String pageNo = ServletActionContext.getRequest().getParameter("page.pageNo");
   String pageSize = ServletActionContext.getRequest().getParameter("page.pageSize");
   if (pageNo != null && pageSize != null) {
     pagegoods.setPageNo(Integer.parseInt(pageNo));
     pagegoods.setPageSize(Integer.parseInt(pageSize));
   }
   if (shopId.equals("全部店铺")) {
     pagegoods = goodsService.getByShopKey(pagegoods, "0", key);
   } else {
     pagegoods = goodsService.getByShopKey(pagegoods, shopId, key);
   }
   // page = goodsService.getShop(page, Integer.parseInt(shopId));
   if (pagegoods != null && pagegoods.getTotalItems() > 0) {
     request.put("msg", "");
   } else {
     request.put("msg", "没有符合条件的记录,请重新查询");
   }
   request.put("page", pagegoods);
   List<Shop> list = shopService.getByState();
   request.put("ShopList", list);
   return "TopGoods";
 }
Example #28
0
  @Override
  public String execute() throws Exception {
    userid = -1;
    HttpSession httpSession = ServletActionContext.getRequest().getSession();
    Cookie[] cookies = ServletActionContext.getRequest().getCookies();
    for (Cookie cookie : cookies) {
      if (cookie.getName().equals("userid")) {
        userid = Integer.parseInt(cookie.getValue());
      }
      if (cookie.getName().equals("useremail")) {
        useremail = cookie.getValue();
      }
      if (cookie.getName().equals("usernick")) {
        usernike = Base64Util.decodeToString(cookie.getValue());
      }
    }

    if (userid == -1 || useremail == null || usernike == null) {
      return "session";
    } else {
      System.out.println(userid);
      list = UserInforDao.selectLoginInfor(userid);
      for (int i = 0; i < list.size(); i++) {
        list.get(i).setHostname(Base64Util.decodeToString(list.get(i).getHostname()));
      }
      size = list.size();
    }

    return SUCCESS;
  }
 public void myBuyedStore() throws IOException {
   id = Integer.parseInt(ServletActionContext.getRequest().getParameter("id"));
   List<GoodStore> listgoostore = goodStoreService.getMyBuyedStore(id);
   for (GoodStore goodStore : listgoostore) {
     JSONObject jsonObj = new JSONObject();
     Goods good = goodsService.getGoods(goodStore.getGoodId());
     jsonObj.put("goodStoreid", goodStore.getGoodStoreid());
     jsonObj.put("title", good.getTitle());
     jsonObj.put(
         "addTime", goodStore.getAddtime() == null ? "" : sdf1.format(goodStore.getAddtime()));
     jsonObj.put("price", good.getPrice() * goodStore.getCount());
     jsonObj.put("count", goodStore.getCount());
     jsonObj.put("id", goodStore.getGoodId());
     List<Image> listimage = imageServiceImpl.getimage(goodStore.getGoodId(), 3);
     Image image = new Image();
     if (listimage.size() > 0) {
       image.setImageUrl(IpMain.IP + listimage.get(1).getImageUrl());
     } else {
       image.setImageUrl("");
     }
     jsonObj.put("imgUrl", image);
     array.add(jsonObj);
   }
   m.put("msg", array);
   ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
 }
 // 根据编号获得团购
 @Action(
     value = "searchGroupon",
     interceptorRefs = {@InterceptorRef(value = "userActionStack")},
     results = {@Result(name = SUCCESS, type = "json")})
 public String searchGroupon() {
   User sessionUser = (User) ServletActionContext.getRequest().getSession().getAttribute("user");
   // 获得这个学校所有的团购项目
   if (groupon.getName() != null) {
     //            name = CommonUtil.getSortString(name.trim());
     name = "%" + groupon.getName() + "%";
   }
   List<Groupon> groupons =
       grouponService.effectiveGroupons(sessionUser.getSchool().getId(), page, name);
   List<GrouponBean> grouponBeanList = new ArrayList<>();
   for (int i = 0; i < groupons.size(); i++) {
     GrouponBean bean = new GrouponBean();
     bean.setId(groupons.get(i).getId());
     bean.setName(groupons.get(i).getName());
     bean.setClassNo(groupons.get(i).getClassNo());
     bean.setTel(groupons.get(i).getTel());
     bean.setEndTime(CommonUtil.dateToString(groupons.get(i).getEndTime()));
     grouponBeanList.add(bean);
   }
   String json = JSONArray.fromObject(grouponBeanList).toString();
   PrintWriter writer = CommonUtil.getJsonPrintWriter(ServletActionContext.getResponse());
   writer.write(json);
   writer.flush();
   writer.close();
   return SUCCESS;
 }