Beispiel #1
0
 @RequestMapping(value = "/member/jobapply.jspx")
 public void jobapply(
     Integer cId, HttpServletRequest request, HttpServletResponse response, ModelMap model)
     throws JSONException {
   CmsUser user = CmsUtils.getUser(request);
   JSONObject object = new JSONObject();
   if (user == null) {
     object.put("result", -1);
   } else if (cId == null) {
     object.put("result", -2);
   } else {
     Content c = contentMng.findById(cId);
     if (c == null) {
       object.put("result", -3);
     } else if (user.getUserResume() == null) {
       object.put("result", -4);
     } else if (user.hasApplyToday(cId)) {
       object.put("result", 0);
     } else {
       CmsJobApply jobApply = new CmsJobApply();
       jobApply.setApplyTime(Calendar.getInstance().getTime());
       jobApply.setContent(c);
       jobApply.setUser(user);
       jobApplyMng.save(jobApply);
       object.put("result", 1);
     }
   }
   ResponseUtils.renderJson(response, object.toString());
 }
Beispiel #2
0
 private boolean vldOpt(WebErrors errors, CmsSite site, CmsUser user, Integer[] ids) {
   for (Integer id : ids) {
     if (errors.ifNull(id, "id")) {
       return true;
     }
     CmsJobApply jobapply = jobApplyMng.findById(id);
     // 数据不存在
     if (errors.ifNotExist(jobapply, CmsJobApply.class, id)) {
       return true;
     }
     // 非本用户数据
     if (!jobapply.getUser().getId().equals(user.getId())) {
       errors.noPermission(Content.class, id);
       return true;
     }
   }
   return false;
 }