示例#1
0
 @Action(
     value = "update_setting",
     results = {
       @Result(
           name = SUCCESS,
           type = Constants.RESULT_NAME_REDIRECT_ACTION,
           params = {"actionName", "setting"}),
       @Result(name = INPUT, type = Constants.RESULT_NAME_TILES, location = ".initUpdate_teacher")
     })
 public String updateUserInfo() {
   BaseUser _user = baseUserDao.findById(getSessionUserId());
   if (user.getNickName() != null) _user.setNickName(this.user.getNickName());
   if (user.getCardId() != null) _user.setCardId(this.user.getCardId());
   if (user.getPic() != null) _user.setPic(this.user.getPic());
   if (user.getUserName() != null) _user.setUserName(user.getUserName());
   if (StringUtils.isNotBlank(user.getSelfDescription())) {
     _user.setSelfDescription(user.getSelfDescription());
   }
   _user.setSexy(user.getSexy());
   UserAccountInfo userAccountInfoForSave =
       this.userAccountInfoDao.findByUserId(this.getSessionUserId());
   userAccountInfoForSave.setBankName(this.getUserAccountInfo().getBankName());
   userAccountInfoForSave.setDisposeName(this.getUserAccountInfo().getDisposeName());
   userAccountInfoForSave.setBankAccount(this.getUserAccountInfo().getBankAccount());
   userAccountInfoForSave.setUser(_user);
   userAccountInfoDao.persist(userAccountInfoForSave);
   baseUserDao.persistAbstract(_user);
   this.setUser(_user);
   this.setUserAccountInfo(userAccountInfoForSave);
   this.setUserToSession(_user);
   setUserOrg(_user);
   return SUCCESS;
 }
示例#2
0
 @Action(
     value = "reWritePassword",
     results = {
       @Result(name = SUCCESS, type = Constants.RESULT_NAME_TILES, location = ".reWritePassword"),
       @Result(name = INPUT, type = Constants.RESULT_NAME_TILES, location = ".yzRePasswordCode")
     })
 public String reWritePassword() {
   BaseUser _user = baseUserDao.findByEmail(user.getEmail());
   _user.setPassword(MD5.endCode(rePwd));
   baseUserDao.persistAbstract(_user);
   return SUCCESS;
 }
示例#3
0
 @Action(value = "saveQuestionResult")
 public String saveQuestionResult() {
   QuestionResult questionResult = questionResultDao.find(userId, questionId, courseClassId);
   if (questionResult == null) questionResult = new QuestionResult();
   Question question = questionDao.findById(questionId);
   BaseUser owner = baseUserDao.findById(userId);
   QuestionItem questionItem = null;
   for (QuestionItem item : question.getQuestionItems()) {
     if (item.getIndexValue().equals(questionItemIndex)) {
       questionItem = item;
       questionResult.setQuestionItem(questionItem);
       questionResult.setIsCorrect(questionItem.getIsAnswer());
       break;
     }
   }
   if (questionItem == null) {
     logger.error("question item is null");
     return RESULT_JSON;
   }
   questionResult.setOwner(owner);
   questionResult.setQuestion(question);
   questionResult.setCourseClass(classDao.findById(courseClassId));
   questionResultDao.persistAbstract(questionResult);
   return RESULT_JSON;
 }
示例#4
0
 public void validateUpdateUserInfo() {
   /*String cardId = this.getUser().getCardId();
   if (!(cardId != null && (cardId.length() == 0 || cardId.length() == 15 || cardId.length() == 18))) {
       addFieldError("user.cardId", "身份证号错误");
   }*/
   BaseUser nickNameUser = baseUserDao.findByNickName(StringUtils.trim(user.getNickName()));
   if (nickNameUser != null && !this.getSessionUserId().equals(nickNameUser.getId())) {
     addFieldError("user.nickName", this.getText("member.reg.nickname.exist"));
   }
 }
示例#5
0
 @Action(
     value = "setting",
     results = {
       @Result(
           name = SUCCESS,
           type = Constants.RESULT_NAME_TILES,
           location = ".initUpdate_teacher")
     })
 public String initUpdate() {
   user = baseUserDao.findById(getSessionUserId());
   userAccountInfo = userAccountInfoDao.findByUserId(this.getSessionUserId());
   return SUCCESS;
 }
示例#6
0
 @Action(
     value = "reInviteTeacher",
     results = {@Result(name = SUCCESS, type = "json")})
 public String reInviteTeacher() {
   ResultData<String> rd = new ResultData<String>();
   ActionContext.getContext().getValueStack().push(rd);
   try {
     BaseUser teacher = baseUserDao.findByEmail(user.getEmail());
     Organization org = organizationDao.findByResId(getSessionUserId());
     OrganizationTeacher orgTeacher =
         organizationTeacherDao.findByOrgIdAndTeacherId(org.getId(), teacher.getId());
     orgTeacher.setTeacherStatus(Constants.USER_STATUS_UNCONFIRMED);
     organizationTeacherDao.persistAbstract(orgTeacher);
     rd.setResult(200);
   } catch (Exception e) {
     rd.setResult(500);
     rd.setMessage("ReInvite Failure:" + e.getMessage());
     logger.error("ReInvite Failure", e);
   }
   return SUCCESS;
 }
示例#7
0
 @Action(
     value = "deleteTeacher",
     results = {@Result(name = SUCCESS, type = "json")})
 public String deleteTeacher() {
   ResultData<String> rd = new ResultData<String>();
   ActionContext.getContext().getValueStack().push(rd);
   try {
     BaseUser teacher = baseUserDao.findByEmail(user.getEmail());
     Organization org = organizationDao.findByResId(getSessionUserId());
     OrganizationTeacher orgTeacher =
         organizationTeacherDao.findByOrgIdAndTeacherId(org.getId(), teacher.getId());
     // 删除用户
     organizationTeacherDao.delete(orgTeacher);
     // 不删除角色
     rd.setResult(200);
   } catch (Exception e) {
     rd.setResult(500);
     rd.setMessage("Delete Failure:" + e.getMessage());
     logger.error("Delete Failure", e);
   }
   return SUCCESS;
 }