Esempio n. 1
0
  /**
   * 所有学校的互动
   *
   * @param model
   * @param request
   * @return
   */
  @RequestMapping(value = "/getAllGroupNews", method = RequestMethod.GET)
  public String getAllGroupNews(ModelMap model, HttpServletRequest request) {
    ResponseMessage responseMessage = RestUtil.addResponseMessageForModelMap(model);
    String type = request.getParameter("type");
    try {

      PaginationData pData = this.getPaginationDataByRequest(request);
      SessionUserInfoInterface user = this.getUserInfoBySession(request);
      String uuid = request.getParameter("uuid");
      pData.setPageSize(5);
      String groups = this.getMyGroupUuidsBySession(request);
      if (StringUtils.isBlank(groups)) {
        responseMessage.setMessage(RightConstants.Return_msg);
        return "";
      }

      PageQueryResult pageQueryResult = classNewsService.listClassNewsByAllgroup(user, uuid, pData);

      model.addAttribute(RestConstants.Return_ResponseMessage_list, pageQueryResult);
      responseMessage.setStatus(RestConstants.Return_ResponseMessage_success);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      responseMessage.setStatus(RestConstants.Return_ResponseMessage_failed);
      responseMessage.setMessage("服务器异常:" + e.getMessage());
      return "";
    }
    return "";
  }
Esempio n. 2
0
  @RequestMapping(value = "/{uuid}", method = RequestMethod.GET)
  public String get(@PathVariable String uuid, ModelMap model, HttpServletRequest request) {
    ResponseMessage responseMessage = RestUtil.addResponseMessageForModelMap(model);
    ClassNewsJsonform c;
    try {
      c = classNewsService.get(uuid);
      // 定义接口,返回浏览总数.
      model.put(
          RestConstants.Return_ResponseMessage_count,
          countService.count(uuid, SystemConstants.common_type_hudong));
      model.put(
          RestConstants.Return_ResponseMessage_share_url, PxStringUtil.getClassNewsByUuid(uuid));

    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      responseMessage.setStatus(RestConstants.Return_ResponseMessage_failed);
      responseMessage.setMessage(e.getMessage());
      return "";
    }
    model.addAttribute(RestConstants.Return_G_entity, c);

    responseMessage.setStatus(RestConstants.Return_ResponseMessage_success);
    return "";
  }
  /**
   * 获取我的孩子列表
   *
   * @param model
   * @param request
   * @return
   */
  @RequestMapping(value = "/listByMy", method = RequestMethod.GET)
  public String listByMy(ModelMap model, HttpServletRequest request) {
    ResponseMessage responseMessage = RestUtil.addResponseMessageForModelMap(model);

    SessionUserInfoInterface parent = this.getUserInfoBySession(request);

    List<PxStudent> list = pxStudentService.listByMy(parent);
    List list1 = pxClassService.listPxStudentPXClassRelationByStudent(parent);
    model.addAttribute(RestConstants.Return_ResponseMessage_list, list);
    model.addAttribute("class_list", list1);
    responseMessage.setStatus(RestConstants.Return_ResponseMessage_success);
    return "";
  }
  @RequestMapping(value = "/{uuid}", method = RequestMethod.GET)
  public String get(@PathVariable String uuid, ModelMap model, HttpServletRequest request) {
    ResponseMessage responseMessage = RestUtil.addResponseMessageForModelMap(model);
    PxStudent s;
    try {
      if (DBUtil.isSqlInjection(uuid, responseMessage)) return "";

      s = pxStudentService.get(uuid);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      responseMessage.setStatus(RestConstants.Return_ResponseMessage_failed);
      responseMessage.setMessage("服务器异常:" + e.getMessage());
      return "";
    }
    model.addAttribute(RestConstants.Return_G_entity, s);
    responseMessage.setStatus(RestConstants.Return_ResponseMessage_success);
    return "";
  }
Esempio n. 5
0
  /**
   * 统计我的发布的班级互动数量,收到点赞,和回复的总数.
   *
   * @param type
   * @param model
   * @param request
   * @return
   */
  @RequestMapping(value = "/getMyClassnewStatistics", method = RequestMethod.GET)
  public String getMyClassnewStatistics(ModelMap model, HttpServletRequest request) {
    ResponseMessage responseMessage = RestUtil.addResponseMessageForModelMap(model);

    try {
      SessionUserInfoInterface user = this.getUserInfoBySession(request);

      PieStatisticsVo vo = classNewsService.getMyClassnewStatistics(responseMessage, user);
      model.addAttribute(RestConstants.Return_G_entity, vo.getTitle_text());
    } catch (Exception e) {
      e.printStackTrace();
      responseMessage.setStatus(RestConstants.Return_ResponseMessage_failed);
      responseMessage.setMessage("服务器错误:" + e.getMessage());
      return "";
    }

    responseMessage.setStatus(RestConstants.Return_ResponseMessage_success);
    return "";
  }
Esempio n. 6
0
 /**
  * 获取班级信息
  *
  * @param model
  * @param request
  * @return
  */
 @Deprecated
 @RequestMapping(value = "/getClassNewsByClassuuid", method = RequestMethod.GET)
 public String getClassNewsByClassuuid(ModelMap model, HttpServletRequest request) {
   ResponseMessage responseMessage = RestUtil.addResponseMessageForModelMap(model);
   try {
     PaginationData pData = this.getPaginationDataByRequest(request);
     SessionUserInfoInterface user = this.getUserInfoBySession(request);
     PageQueryResult pageQueryResult =
         classNewsService.query(user, null, request.getParameter("classuuid"), pData);
     model.addAttribute(RestConstants.Return_ResponseMessage_list, pageQueryResult);
     responseMessage.setStatus(RestConstants.Return_ResponseMessage_success);
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
     responseMessage.setStatus(RestConstants.Return_ResponseMessage_failed);
     responseMessage.setMessage("服务器异常:" + e.getMessage());
     return "";
   }
   return "";
 }
Esempio n. 7
0
  /**
   * 班级删除
   *
   * @param model
   * @param request
   * @return
   */
  @RequestMapping(value = "/delete", method = RequestMethod.POST)
  public String delete(ModelMap model, HttpServletRequest request) {
    // 返回消息体
    ResponseMessage responseMessage = RestUtil.addResponseMessageForModelMap(model);

    try {
      boolean flag = classNewsService.delete(request.getParameter("uuid"), responseMessage);
      if (!flag) return "";
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      responseMessage.setStatus(RestConstants.Return_ResponseMessage_failed);
      responseMessage.setMessage(e.getMessage());
      return "";
    }

    responseMessage.setStatus(RestConstants.Return_ResponseMessage_success);
    responseMessage.setMessage("删除成功");
    return "";
  }
Esempio n. 8
0
  /**
   * 平台方可以查看所有互动.
   *
   * @param model
   * @param request
   * @return
   */
  @RequestMapping(value = "/getAllClassNewsByWJ", method = RequestMethod.GET)
  public String getAllClassNewsByWJ(ModelMap model, HttpServletRequest request) {
    ResponseMessage responseMessage = RestUtil.addResponseMessageForModelMap(model);
    try {

      // 请求消息体
      if (!RightUtils.hasRight(
          SystemConstants.Group_uuid_wjkj, RightConstants.AD_classnew_m, request)) {
        responseMessage.setStatus(RestConstants.Return_ResponseMessage_failed);
        responseMessage.setMessage(RightConstants.Return_msg);
        return "";
      }

      PaginationData pData = this.getPaginationDataByRequest(request);
      SessionUserInfoInterface user = this.getUserInfoBySession(request);
      pData.setPageSize(5);

      PageQueryResult pageQueryResult = classNewsService.getAllClassNewsByWJ(user, pData);

      model.addAttribute(RestConstants.Return_ResponseMessage_list, pageQueryResult);
      responseMessage.setStatus(RestConstants.Return_ResponseMessage_success);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      responseMessage.setStatus(RestConstants.Return_ResponseMessage_failed);
      responseMessage.setMessage("服务器异常:" + e.getMessage());
      return "";
    }
    return "";
  }
Esempio n. 9
0
  /**
   * 删除 支持多个,用逗号分隔
   *
   * @param uuid
   */
  public boolean delete(String uuid, ResponseMessage responseMessage) {
    if (StringUtils.isBlank(uuid)) {

      responseMessage.setMessage("ID不能为空!");
      return false;
    }
    //
    //		if (uuid.indexOf(",") != -1)// 多ID
    //		{
    //			this.nSimpleHibernateDao.getHibernateTemplate().bulkUpdate(
    //					"update PushMessage set isdelete=? where uuid in(?)",
    //					announcements_isdelete_yes, uuid);
    //		} else {
    //			this.nSimpleHibernateDao.getHibernateTemplate().bulkUpdate(
    //					"update PushMessage set isdelete=? where uuid =?",
    //					announcements_isdelete_yes, uuid);
    //		}

    return true;
  }
Esempio n. 10
0
  /**
   * 删除 支持多个,用逗号分隔
   *
   * @param uuid
   */
  public boolean read(String uuid, ResponseMessage responseMessage) {
    if (StringUtils.isBlank(uuid)) {

      responseMessage.setMessage("ID不能为空!");
      return false;
    }

    if (uuid.indexOf(",") != -1) // 多ID
    {
      this.nSimpleHibernateDao
          .getHibernateTemplate()
          .bulkUpdate(
              "update PushMessage set isread=? where uuid in(?)", announcements_isread_yes, uuid);
    } else {
      this.nSimpleHibernateDao
          .getHibernateTemplate()
          .bulkUpdate(
              "update PushMessage set isread=? where uuid =?", announcements_isread_yes, uuid);
    }

    return true;
  }
Esempio n. 11
0
  /**
   * 组织注册
   *
   * @param model
   * @param request
   * @return
   */
  @RequestMapping(value = "/save", method = RequestMethod.POST)
  public String save(ModelMap model, HttpServletRequest request) {
    // 返回消息体
    ResponseMessage responseMessage = RestUtil.addResponseMessageForModelMap(model);
    // 请求消息体
    String bodyJson = RestUtil.getJsonStringByRequest(request);
    ClassNewsJsonform classNewsJsonform;
    try {
      classNewsJsonform =
          (ClassNewsJsonform) this.bodyJsonToFormObject(bodyJson, ClassNewsJsonform.class);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      responseMessage.setMessage(error_bodyJsonToFormObject);
      return "";
    }

    // 设置当前用户
    SessionUserInfoInterface user = this.getUserInfoBySession(request);
    // 转换特定格式.
    classNewsJsonform.setContent(MyUbbUtils.htmlToMyUbb(classNewsJsonform.getContent()));
    classNewsJsonform.setImgs(PxStringUtil.imgUrlToUuid(classNewsJsonform.getImgs()));
    try {
      boolean flag;
      if (StringUtils.isEmpty(classNewsJsonform.getUuid()))
        flag = classNewsService.add(user, classNewsJsonform, responseMessage, request);
      else flag = classNewsService.update(user, classNewsJsonform, responseMessage, request);
      if (!flag) // 请求服务返回失败标示
      return "";
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      responseMessage.setStatus(RestConstants.Return_ResponseMessage_failed);
      responseMessage.setMessage(e.getMessage());
      return "";
    }

    responseMessage.setStatus(RestConstants.Return_ResponseMessage_success);
    responseMessage.setMessage("修改成功");
    return "";
  }
Esempio n. 12
0
  /**
   * 管理员-查询我管理学校的互动
   *
   * @param model
   * @param request
   * @return
   */
  @RequestMapping(value = "/listClassNewsByAdmin", method = RequestMethod.GET)
  public String listClassNewsByAdmin(ModelMap model, HttpServletRequest request) {
    ResponseMessage responseMessage = RestUtil.addResponseMessageForModelMap(model);
    try {

      String right = RightConstants.KD_announce_m;
      if (SessionListener.isPXLogin(request)) {
        right = RightConstants.PX_announce_m;
      }

      PaginationData pData = this.getPaginationDataByRequest(request);
      SessionUserInfoInterface user = this.getUserInfoBySession(request);
      pData.setPageSize(5);
      String groups = RightUtils.getRightGroups(right, request);
      if (StringUtils.isBlank(groups)) {
        responseMessage.setMessage(RightConstants.Return_msg);
        return "";
      }

      String groupuuid = request.getParameter("groupuuid");
      if (StringUtils.isNotBlank(groupuuid) && !groups.contains(groupuuid)) {
        responseMessage.setMessage("选择的幼儿园没有权限");
        return "";
      }
      if (StringUtils.isNotBlank(groupuuid)) {
        groups = groupuuid;
      }
      PageQueryResult pageQueryResult = classNewsService.listClassNewsByAdmin(groups, user, pData);
      model.addAttribute(RestConstants.Return_ResponseMessage_list, pageQueryResult);
      responseMessage.setStatus(RestConstants.Return_ResponseMessage_success);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      responseMessage.setStatus(RestConstants.Return_ResponseMessage_failed);
      responseMessage.setMessage("服务器异常:" + e.getMessage());
      return "";
    }
    return "";
  }