// 获取报废信息
  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'}");
    }
  }
Esempio n. 2
0
  /**
   * 保存地址
   *
   * @throws IOException
   */
  public void addAdress() throws IOException {
    ids = ServletActionContext.getRequest().getParameter("ids");
    goodowner = ServletActionContext.getRequest().getParameter("goodowner");
    addressOwner = ServletActionContext.getRequest().getParameter("addressOwner");
    phonenumerowner = ServletActionContext.getRequest().getParameter("phonenumerowner");
    ids = ServletActionContext.getRequest().getParameter("ids");
    List<GoodStore> listGoodStore = goodStoreService.getMyStore(id);
    String str[] = ids.split(",");
    int array[] = new int[str.length];
    GoodAddress goodAddress = new GoodAddress();
    goodAddress.setAddressOwner(addressOwner);
    goodAddress.setGoodowner(goodowner);
    goodAddress.setPhonenumerowner(phonenumerowner);

    int f = goodAdressServiceImpl.saveAddress(goodAddress);

    try {
      for (int i = 0; i < str.length; i++) {
        array[i] = Integer.parseInt(str[i]);
        goodStore = goodStoreService.getGoodsStore(array[i]);
        goodStore.setAddressId(f);
        goodStoreService.saveOrUpdate(goodStore);
      }
      m.put("msg", "1");
      ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
    } catch (Exception e) {
      e.printStackTrace();
      m.put("msg", "-1");
      ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
    }
  }
Esempio n. 3
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;
  }
Esempio n. 4
0
  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;
    }
  }
Esempio n. 5
0
  /**
   * 提交app信息
   *
   * @throws IOException
   */
  public void subCheckedApp() throws Exception {
    Map<String, String> map = new HashMap<String, String>();
    map.put("activeCode", getActiveCode());
    // String dstr=URLDecoder.decode(checked, "iso-8859-1");
    // dstr=StringUtils.convertToUTF(dstr);
    // log.info("checkedchecked:"+dstr);
    map.put("checked", StringUtils.convertToUTF(checked));
    // map.put("checked", dstr);
    map.put("userId", getUserNo());

    if (!("").equals(checked.trim())) {
      int subNum = map.get("checked").split(",").length;
      map.put("triggerType", "2"); // type=2:app
      int count = service.getCheckedAppCount(map);
      if (count + subNum > 10) {
        ServletActionContext.getResponse().getWriter().print("L");
        return;
      }
    }

    if (("").equals(checked.trim()) || checked == null || service.insertCheckedApp(map)) {
      ServletActionContext.getResponse().getWriter().print("Y");
    } else {
      ServletActionContext.getResponse().getWriter().print("N");
    }
  }
Esempio n. 6
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;
  }
Esempio n. 7
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);
    }
  }
Esempio n. 8
0
  /** 查询page* */
  public void query() {
    datalist = serviceDispatcher.getCmsMenuService().getMenuStore();
    // 采用集合分页
    List pageList = UtilTools.queryForPage(start, limit, datalist);
    JSONBean jbean = new JSONBean();
    MetaData md = new MetaData();
    md.setIdProperty("cmpId"); // 关联将要显示列表对应的bean实体的主键ID
    md.reflectFields("com.oemp.cms.bean.CmsMenu"); // 关联将要显示列表对应的bean实体
    jbean.setMetaData(md);
    jbean.setRows(pageList);
    jbean.setSuccess(true);
    jbean.setTotal(datalist.size());

    ServletActionContext.getResponse().setCharacterEncoding("UTF-8");
    String jsonString = UtilTools.encodeObject2Json(jbean);

    PrintWriter out;
    try {
      out = ServletActionContext.getResponse().getWriter();
      out.print(jsonString);
      out.flush();
      out.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Esempio n. 9
0
 /*public static void setLoginKey(String loginKey, int maxAge) {
     CookieManager.getInstance().setCookie(StateName.P2P_LOGIN_KEY, loginKey, maxAge);
 }*/
 public static void cleanLoginCookie() {
   instance.cookieManager.deleteCookie(
       ServletActionContext.getResponse(), StateName.P2P_CUSTOMER_ID);
   instance.cookieManager.deleteCookie(
       ServletActionContext.getResponse(), StateName.P2P_LOGIN_TIME);
   instance.cookieManager.deleteCookie(
       ServletActionContext.getResponse(), StateName.P2P_LOGIN_KEY);
 }
Esempio n. 10
0
 /**
  * do the register submit.
  *
  * @throws IOException
  */
 @Action(value = "do_register")
 public StreamResult doRegister() throws IOException {
   ServletActionContext.getResponse().setCharacterEncoding("UTF-8");
   PrintWriter writer = ServletActionContext.getResponse().getWriter();
   writer.write(userManager.register(user).toString());
   writer.close();
   return null;
 }
 /** 编辑策略 */
 public void updateTactics() throws Exception {
   HttpServletRequest request = ServletActionContext.getRequest();
   PrintWriter out = ServletActionContext.getResponse().getWriter();
   ServletActionContext.getResponse().setCharacterEncoding("UTF-8");
   String vcTaskOrder = (String) ServletActionContext.getContext().getSession().get("baseUserId");
   String dtOrderTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.s").format(new Date());
   String dtStartTime = ReqUtils.getReqString(request, "dtStartTime");
   String dtEndTime = ReqUtils.getReqString(request, "dtEndTime");
   String intStartHour = ReqUtils.getReqString(request, "intStartHour");
   String intEndHour = ReqUtils.getReqString(request, "intEndHour");
   String vcContents = ReqUtils.getReqString(request, "vcContents");
   //		vcContents = new String(vcContents.getBytes("ISO-8859-1"),"UTF-8");
   vcContents = new String(vcContents.getBytes("ISO-8859-1"), "GBK");
   String nmDataGetterTaskId = ReqUtils.getReqString(request, "id");
   String productArray = ReqUtils.getReqString(request, "product");
   keywordsTacticsImpl.deleteKeyValueGetterFilter(nmDataGetterTaskId);
   keywordsTacticsImpl.updateTactics(
       nmDataGetterTaskId,
       vcTaskOrder,
       dtStartTime,
       dtEndTime,
       intStartHour,
       intEndHour,
       vcContents);
   String[] nmSoTypeIds = productArray.split(",");
   String isExactMarkValuearray = ReqUtils.getReqString(request, "iskey");
   // isExactMarkValuearray = new
   // String(isExactMarkValuearray.getBytes("ISO-8859-1"),"UTF-8");
   isExactMarkValuearray = new String(isExactMarkValuearray.getBytes("ISO-8859-1"), "GBK");
   if (isExactMarkValuearray != "" || isExactMarkValuearray != null) {
     String[] isExactMarkValues = isExactMarkValuearray.split(",");
     for (int i = 0; i < nmSoTypeIds.length; i++) {
       String nmSoTypeId = nmSoTypeIds[i];
       for (int j = 0; j < isExactMarkValues.length; j++) {
         String isExactMarkValue = isExactMarkValues[j];
         // keywordsTacticsImpl.insertIsExactMark(nmDataGetterTaskId, nmSoTypeId,
         // isExactMarkValue);
       }
     }
   }
   String unExactMarkValuearray = ReqUtils.getReqString(request, "unkey");
   // unExactMarkValuearray = new
   // String(unExactMarkValuearray.getBytes("ISO-8859-1"),"UTF-8");
   unExactMarkValuearray = new String(unExactMarkValuearray.getBytes("ISO-8859-1"), "GBK");
   if (unExactMarkValuearray != "" || unExactMarkValuearray != null) {
     String[] unExactMarkValues = unExactMarkValuearray.split(",");
     for (int i = 0; i < nmSoTypeIds.length; i++) {
       String nmSoTypeId = nmSoTypeIds[i];
       for (int j = 0; j < unExactMarkValues.length; j++) {
         String unExactMarkValue = unExactMarkValues[j];
         keywordsTacticsImpl.insertUnExactMark(nmDataGetterTaskId, nmSoTypeId, unExactMarkValue);
       }
     }
   }
   out.write("1");
 }
 /**
  * 获取策略名
  *
  * @throws IOException
  */
 @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
 public void getTaskName() throws IOException {
   HttpServletRequest request = ServletActionContext.getRequest();
   PrintWriter out = ServletActionContext.getResponse().getWriter();
   ServletActionContext.getResponse().setCharacterEncoding("UTF-8");
   String nmDataGetterTaskId = ReqUtils.getReqString(request, "id");
   List<KeywordsTacticsDTO> lst = keywordsTacticsImpl.getShowMessage(nmDataGetterTaskId);
   JSONArray array = JSONArray.fromObject(lst.get(0));
   out.write(array.toString());
 }
Esempio n. 13
0
 public void write(String str) {
   ServletActionContext.getResponse().setContentType("text/html;charset=UTF-8");
   PrintWriter out;
   try {
     out = ServletActionContext.getResponse().getWriter();
     out.write(str);
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Esempio n. 14
0
  public void getTypeAppList() throws Exception {

    Map<String, String> map = service.getTypeAppList(appType);
    if (map != null) {
      ServletActionContext.getResponse()
          .getWriter()
          .print(StringUtils.convertToISO(map.get("0") + "_" + map.get("1")));
    } else {
      ServletActionContext.getResponse().getWriter().print("F");
    }
  }
Esempio n. 15
0
 public void writeJson(Object object) {
   try {
     String json = JSON.toJSONStringWithDateFormat(object, "yyyy-MM-dd HH:mm:ss");
     ServletActionContext.getResponse().setContentType("text/html;charset=utf-8");
     ServletActionContext.getResponse().getWriter().write(json);
     ServletActionContext.getResponse().getWriter().flush();
     ServletActionContext.getResponse().getWriter().close();
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Esempio n. 16
0
 /**
  * 获取前台选取的基站
  *
  * @throws Exception
  */
 public void getCheckedBsList() throws Exception {
   Map<String, String> map = new HashMap<String, String>();
   map.put("activeCode", getActiveCode());
   map = service.getCheckedPosition(map);
   if (map == null) {
     ServletActionContext.getResponse().getWriter().print("");
   } else {
     ServletActionContext.getResponse()
         .getWriter()
         .print(StringUtils.convertToISO(map.get("bsms")));
   }
 }
Esempio n. 17
0
 public void get() throws ClassNotFoundException, SQLException, IOException {
   Class.forName("com.mysql.jdbc.Driver");
   String url = "jdbc:mysql://localhost:3306/cpsystem";
   String usernameMysql = "root";
   String passwordMysql = "root";
   Connection conn = DriverManager.getConnection(url, usernameMysql, passwordMysql);
   Statement stmt = conn.createStatement();
   HttpServletRequest request = ServletActionContext.getRequest();
   JSONObject dt = JSONObject.parseObject(request.getParameter("dt"));
   String account = (String) dt.get("account");
   String sql = "select * from user where phone='" + account + "'";
   ResultSet userinfo = stmt.executeQuery(sql);
   JSONObject json = new JSONObject();
   JSONObject info = new JSONObject();
   if (userinfo.next()) {
     if (userinfo.getInt("type") == 1) { // driver
       info.put("id", userinfo.getInt("id"));
       info.put("phone", userinfo.getString("phone"));
       info.put("email", userinfo.getString("email"));
       info.put("name", userinfo.getString("name"));
       info.put("type", userinfo.getInt("type"));
       sql = "select * from driver_info where id=" + userinfo.getInt("id");
       stmt = conn.createStatement();
       ResultSet driverinfo = stmt.executeQuery(sql);
       if (driverinfo.next()) {
         info.put("success_count", driverinfo.getInt("success_count"));
         info.put("success_thismonth", driverinfo.getInt("success_thismonth"));
         info.put("send_count", driverinfo.getInt("send_count"));
         info.put("send_thismonth", driverinfo.getInt("send_thismonth"));
       }
       json.put("info", info);
       HttpServletResponse response = ServletActionContext.getResponse();
       response.setCharacterEncoding("utf-8");
       response.getWriter().write(json.toString());
     } else if (userinfo.getInt("type") == 2) { // passenger
       info.put("id", userinfo.getInt("id"));
       info.put("phone", userinfo.getString("phone"));
       info.put("email", userinfo.getString("email"));
       info.put("type", userinfo.getString("type"));
       sql = "select * from passenger_info where id=" + userinfo.getInt("id");
       stmt = conn.createStatement();
       ResultSet passengerinfo = stmt.executeQuery(sql);
       if (passengerinfo.next()) {
         info.put("take_count", passengerinfo.getInt("take_count"));
         info.put("take_thismonth", passengerinfo.getInt("take_thismonth"));
       }
       json.put("info", info);
       HttpServletResponse response = ServletActionContext.getResponse();
       response.setCharacterEncoding("utf-8");
       response.getWriter().write(json.toString());
     }
   }
 }
Esempio n. 18
0
 public void deleteSetProperty() throws Exception {
   Map<String, String> map = new HashMap<String, String>();
   map.put("triggerName", StringUtils.convertToUTF(URLDecoder.decode(triggerName, "iso-8859-1")));
   map.put("triggerType", triggerType);
   map.put("titleType", titleType);
   map.put("activeCode", getActiveCode());
   boolean a = service.deleteSetProperty(map);
   if (a) {
     ServletActionContext.getResponse().getWriter().print("Y");
   } else {
     ServletActionContext.getResponse().getWriter().print("F");
   }
 }
  // 删除部门记录
  public void delEquDe() throws IOException {
    HttpServletRequest request =
        (HttpServletRequest) (ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST));
    String recordId = request.getParameter("id");

    this.equipmentdepartmentthis = this.equipmentDepartmentService.findById(recordId);
    if (this.equipmentdepartmentthis != null) {
      this.equipmentDepartmentService.delete(this.equipmentdepartmentthis);
      ServletActionContext.getResponse().getWriter().write("{status:'0'}");
    } else {
      ServletActionContext.getResponse().getWriter().write("{status:'1'}");
    }
  }
Esempio n. 20
0
 public void viewXml() throws Exception {
   RepositoryService repositoryService = processEngine.getRepositoryService();
   ProcessDefinition processDefinition =
       repositoryService
           .createProcessDefinitionQuery()
           .processDefinitionId(processDefinitionId)
           .singleResult();
   String resourceName = processDefinition.getResourceName();
   InputStream resourceAsStream =
       repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), resourceName);
   ServletActionContext.getResponse().setContentType("text/xml;charset=UTF-8");
   IoUtils.copyStream(resourceAsStream, ServletActionContext.getResponse().getOutputStream());
 }
Esempio n. 21
0
  /** 加入购物车 */
  public void addGoodsStore() throws IOException {
    try {
      goodStore.setState(0);
      goodStoreService.saveGoodStore(goodStore);
      m.put("msg", "1");
      ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));

    } catch (Exception e) {
      e.printStackTrace();
      m.put("msg", "-1");
      ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
    }
  }
  // 报废
  public void addReject() throws IOException {
    HttpServletRequest request =
        (HttpServletRequest) (ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST));
    String equid = request.getParameter("equid");
    String rejectUser = request.getParameter("rejectUser");
    String reason = request.getParameter("reason");
    reason = java.net.URLDecoder.decode(reason, "UTF-8");
    this.equipment = this.equipmentService.findById(equid);
    if (this.equipment != null) {

      this.equipmentreject = this.equipmentrejectService.findbyEquipmentId(this.equipment.getId());
      if (this.equipmentreject != null) {
        this.equipmentrejectService.delete(this.equipmentreject);
      }
      this.equipmentreject = new Equipmentreject();
      this.equipmentreject.setRejectreason(reason);
      this.equipmentreject.setEquipment(this.equipment);
      this.equipmentreject.setRejectuser(rejectUser);
      DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd");
      String datestr = format1.format(new java.util.Date());
      this.equipmentreject.setRejecttime(datestr);
      this.equipmentrejectService.save(this.equipmentreject);
      this.equipmentdepartment =
          this.equipmentDepartmentService.findByEquipmentId(this.equipment.getId());
      for (int i = 0; i < this.equipmentdepartment.size(); i++) {
        this.equipmentdepartmentthis = this.equipmentdepartment.get(i);
        if (this.equipmentdepartmentthis.getFlowouttime() == null
            || this.equipmentdepartmentthis.getFlowouttime().trim().length() < 10) {

          this.equipmentdepartmentthis.setFlowouttime(datestr);
          this.equipmentdepartmentthis.setFlowdes(
              this.equipmentdepartmentthis.getFlowdes() + "(已报废)");
          this.equipmentDepartmentService.update(this.equipmentdepartmentthis);
          this.equipmentuserList =
              this.equipmentuserService.findByEquipmentdepId(this.equipmentdepartmentthis.getId());
          for (int j = 0; j < this.equipmentuserList.size(); j++) {
            this.equipmentuser = this.equipmentuserList.get(j);
            if (this.equipmentuser.getFlowouttime2() == null
                || this.equipmentuser.getFlowouttime2().trim().length() < 10) {
              this.equipmentuser.setFlowouttime2(datestr);
              this.equipmentuser.setDes(this.equipmentuser.getDes() + "(已报废)");
              this.equipmentuserService.update(this.equipmentuser);
            }
          }
        }
      }
      ServletActionContext.getResponse().getWriter().write("{status:'0'}");
    } else {
      ServletActionContext.getResponse().getWriter().write("{status:'1'}");
    }
  }
Esempio n. 23
0
  /**
   * 修改疾病指标状态
   *
   * @return
   */
  public String updateState() {
    DiseaseNameDict f = new DiseaseNameDict();
    f.setUseState(map.get("useState"));
    f.setDiseaseNameId(map.get("diseaseNameId"));
    try {
      int result = diseaseNameDictService.updateState(f);
      if (result == 1) ServletActionContext.getResponse().getWriter().print("修改成功");
      else ServletActionContext.getResponse().getWriter().print("修改失败");
    } catch (IOException e) {
      e.printStackTrace();
    }

    return null;
  }
Esempio n. 24
0
  /** 新增 */
  public void add() {
    CmsUser cmsuserForSession = getCmsUser();
    String cmdAdduser = cmsuserForSession.getCmuName();
    // 写日志
    CmsLog log = UtilTools.buildLog("菜单管理", CmsLog.Add, "新增菜单", cmdAdduser);
    serviceDispatcher.getCmsLogService().add(log);

    // 返回值
    ServletActionContext.getResponse().setCharacterEncoding("UTF-8");
    net.sf.json.JSONObject js = net.sf.json.JSONObject.fromObject(rows);

    Integer cmmParentId = js.getInt("cmmParentId");
    String cmmName = js.getString("cmmName");
    String cmmDesc = js.getString("cmmDesc");
    String cmmIcon =
        "".equals(js.getString("cmmIcon"))
            ? "workplace/image/icon/xitong.png"
            : js.getString("cmmIcon");
    Integer cmmOrderNum = js.getInt("cmmOrderNum");
    String cmmAdminUrl = js.getString("cmmAdminUrl");
    Integer cmmType = js.getInt("cmmType");
    Date cmmAddTime = UtilTools.getCurrrentDate1(); // 获取当前系统时间
    String cmmAddUser = cmsuserForSession.getCmuName();

    CmsMenu cm = new CmsMenu();
    cm.setCmmParentId(cmmParentId);
    cm.setCmmName(cmmName);
    cm.setCmmDesc(cmmDesc);
    cm.setCmmIcon(cmmIcon);
    cm.setCmmOrderNum(cmmOrderNum);
    cm.setCmmAdminUrl(cmmAdminUrl);
    cm.setCmmType(cmmType);
    cm.setCmmAddUser(cmmAddUser);
    cm.setCmmAddTime(cmmAddTime);
    serviceDispatcher.getCmsMenuService().add(cm);
    // 获取数据
    StringBuffer jsonString = new StringBuffer();
    jsonString.append("{");
    jsonString.append("success:true");
    jsonString.append("}");
    PrintWriter out;
    try {
      out = ServletActionContext.getResponse().getWriter();
      out.print(jsonString);
      out.flush();
      out.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  // 删除设备
  public void deleteEquipment() throws IOException {
    HttpServletRequest request =
        (HttpServletRequest) (ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST));
    String equid = request.getParameter("equid");

    this.equipment = this.equipmentService.findById(equid);
    if (this.equipment != null) {

      this.equipmentService.delete(this.equipment);
      ServletActionContext.getResponse().getWriter().write("{status:'0'}");
    } else {
      ServletActionContext.getResponse().getWriter().write("{status:'1'}");
    }
  }
Esempio n. 26
0
 /** 从购物车删除 */
 public void deleteGoodsStore() throws IOException {
   id = Integer.parseInt(ServletActionContext.getRequest().getParameter("id"));
   GoodStore goodStore = goodStoreService.getGoodsStore(id);
   goodStore.setState(-1);
   try {
     goodStoreService.saveOrUpdate(goodStore);
     m.put("msg", "1");
     ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
   } catch (Exception e) {
     e.printStackTrace();
     m.put("msg", "-1");
     ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
   }
 }
Esempio n. 27
0
 public void loop() throws IOException {
   if (path == null) {
     ServletActionContext.getResponse().getWriter().print("fault");
   } else {
     if (this.width == null) {
       this.width = 200;
     }
     List<String> arrayList = this.listFile(new File(path), "jpg", true);
     for (int i = 0; i < arrayList.size(); i++) {
       this.width(arrayList.get(i), this.width);
       System.out.println(arrayList.get(i));
     }
     ServletActionContext.getResponse().getWriter().print("ok");
   }
 }
Esempio n. 28
0
 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));
 }
Esempio n. 29
0
  /** 分析并设置contentType与headers. */
  private static HttpServletResponse initResponseHeader(
      final String contentType, final String... headers) {
    // 分析headers参数
    String encoding = DEFAULT_ENCODING;
    boolean noCache = DEFAULT_NOCACHE;
    for (String header : headers) {
      String headerName = StringUtils.substringBefore(header, ":");
      String headerValue = StringUtils.substringAfter(header, ":");

      if (StringUtils.equalsIgnoreCase(headerName, HEADER_ENCODING)) {
        encoding = headerValue;
      } else if (StringUtils.equalsIgnoreCase(headerName, HEADER_NOCACHE)) {
        noCache = Boolean.parseBoolean(headerValue);
      } else {
        throw new IllegalArgumentException(headerName + "不是一个合法的header类型");
      }
    }

    HttpServletResponse response = ServletActionContext.getResponse();

    // 设置headers参数
    String fullContentType = contentType + ";charset=" + encoding;
    response.setContentType(fullContentType);
    if (noCache) {
      ServletUtils.setDisableCacheHeader(response);
    }

    return response;
  }
Esempio n. 30
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();
   }
 }