/** 登录认证,失败会捕获相关异常信息 */
 protected boolean executeLogin(ServletRequest request, ServletResponse response)
     throws Exception {
   CaptchaUsernamePasswordToken token =
       (CaptchaUsernamePasswordToken) createToken(request, response);
   try {
     doCaptchaValidate((HttpServletRequest) request, token);
     if (token.getUsername().equals("NO")) {
       throw new DisabledAccountException("该用户被禁用,请联系客服!");
     }
     Subject subject = getSubject(request, response);
     subject.login(token);
     HttpSession session = ((HttpServletRequest) request).getSession(false);
     Member member = (Member) subject.getPrincipal();
     session.setAttribute("currentMember", member);
     session.setAttribute("currentMemberWork", memberService.getMemberWork(member.getMemberId()));
     int messageNoticCount = loginTotalMessageNotic(member.getMemberId());
     session.setAttribute("messageNoticCount", messageNoticCount);
     memberService.updateIntegra(member.getMemberId());
     return onLoginSuccess(token, subject, request, response);
   } catch (AuthenticationException e) {
     return onLoginFailure(token, e, request, response);
   }
 }
  @Transactional(readOnly = false)
  public Object sendMessage(String[] array, MessageNote messageNote) {
    Subject pricipalSubject = SecurityUtils.getSubject();
    User pricipalUser = (User) pricipalSubject.getPrincipal();
    JqReturnJson returnResult = new JqReturnJson(); // 构建返回结果,默认结果为false
    List<String> noteList = new ArrayList<String>(); // 构建接收邮箱List
    messageNote.setNoteId(RandomGUID.getRandomGUID());
    int count = 0;
    if (messageNote.getNoteType().equals("candidate")) { // 部分群发
      for (int i = 0; i < array.length; i++) {
        Member member = memberService.getMemberMsg(array[i]);
        noteList.add(member.getMobileNumber());
      }
      // 对MessageEmail赋值
      messageNote.setCreater(pricipalUser.getUserId());
      messageNote.setCreaterTime(new Date());
      messageNote.setNoteTime(new Date());
      count = messageNoteMapper.insertSelective(messageNote);
      if (count == 1) {
        for (int i = 0; i < array.length; i++) {
          Member member = memberService.getMemberMsg(array[i]);
          MessageInfo messageInfo = new MessageInfo(); // 构建邮箱记录
          messageInfo.setInfoId(RandomGUID.getRandomGUID()); // 随即产生32位ID
          messageInfo.setInfoTitle(messageNote.getNoteTitle()); // 设置标题
          messageInfo.setInfoSend(pricipalUser.getUserId()); // 管理员
          messageInfo.setInfoMemberid(member.getMemberId()); // 会员ID
          messageInfo.setCreaterTime(new Date()); // 设置当前时间
          messageInfo.setNoteId(messageNote.getNoteId()); // 设置活动邮件ID
          messageInfoMapper.insertSelective(messageInfo); // 执行添加
        }
      }

      for (int i = 0; i < noteList.size(); i++) {
        noteSend(messageNote.getNoteText(), noteList.get(i));
      }

      returnResult.setMsg("发送成功");
      returnResult.setSuccess(true);

    } else if (messageNote.getNoteType().equals("mass")) { // 群发会员
      List<Member> memberList = memberService.getMemberList();
      for (Member member : memberList) {
        noteList.add(member.getMobileNumber());
      }
      // 对MessageEmail赋值
      messageNote.setCreater(pricipalUser.getUserId());
      messageNote.setCreaterTime(new Date());
      messageNote.setNoteTime(new Date());
      count = messageNoteMapper.insertSelective(messageNote);
      if (count == 1) {
        for (Member member : memberList) {
          MessageInfo messageInfo = new MessageInfo(); // 构建邮箱记录
          messageInfo.setInfoId(RandomGUID.getRandomGUID()); // 随即产生32位ID
          messageInfo.setInfoTitle(messageNote.getNoteTitle()); // 设置标题
          messageInfo.setInfoSend(pricipalUser.getUserId()); // 管理员
          messageInfo.setInfoMemberid(member.getMemberId()); // 会员ID
          messageInfo.setCreaterTime(new Date()); // 设置当前时间
          messageInfo.setNoteId(messageNote.getNoteId()); // 设置活动邮件ID
          messageInfoMapper.insertSelective(messageInfo); // 执行添加
        }
      }

      for (int i = 0; i < noteList.size(); i++) {
        noteSend(messageNote.getNoteText(), noteList.get(i));
      }

      returnResult.setMsg("发送成功");
      returnResult.setSuccess(true);

    } else if (messageNote.getNoteType().equals("Vip")) {
      MemberExample memberExample = new MemberExample();
      memberExample.createCriteria().andTypeEqualTo("vip");
      List<Member> memberList = memberMapper.selectByExample(memberExample);
      for (Member member : memberList) {
        noteList.add(member.getMobileNumber());
      }
      // 对MessageEmail赋值
      messageNote.setCreater(pricipalUser.getUserId());
      messageNote.setCreaterTime(new Date());
      messageNote.setNoteTime(new Date());
      count = messageNoteMapper.insertSelective(messageNote);
      if (count == 1) {
        for (Member member : memberList) {
          MessageInfo messageInfo = new MessageInfo(); // 构建邮箱记录
          messageInfo.setInfoId(RandomGUID.getRandomGUID()); // 随即产生32位ID
          messageInfo.setInfoTitle(messageNote.getNoteTitle()); // 设置标题
          messageInfo.setInfoSend(pricipalUser.getUserId()); // 管理员
          messageInfo.setInfoMemberid(member.getMemberId()); // 会员ID
          messageInfo.setCreaterTime(new Date()); // 设置当前时间
          messageInfo.setNoteId(messageNote.getNoteId()); // 设置活动邮件ID
          messageInfoMapper.insertSelective(messageInfo); // 执行添加
        }
      }

      for (int i = 0; i < noteList.size(); i++) {
        noteSend(messageNote.getNoteText(), noteList.get(i));
      }

      returnResult.setMsg("发送成功");
      returnResult.setSuccess(true);

    } else if (messageNote.getNoteType().equals("general")) {
      MemberExample memberExample = new MemberExample();
      memberExample.createCriteria().andTypeEqualTo("vip");
      List<Member> memberList = memberMapper.selectByExample(memberExample);
      for (Member member : memberList) {
        noteList.add(member.getMobileNumber());
      }
      // 对MessageEmail赋值
      messageNote.setCreater(pricipalUser.getUserId());
      messageNote.setCreaterTime(new Date());
      messageNote.setNoteTime(new Date());
      count = messageNoteMapper.insertSelective(messageNote);
      if (count == 1) {
        for (Member member : memberList) {
          MessageInfo messageInfo = new MessageInfo(); // 构建邮箱记录
          messageInfo.setInfoId(RandomGUID.getRandomGUID()); // 随即产生32位ID
          messageInfo.setInfoTitle(messageNote.getNoteTitle()); // 设置标题
          messageInfo.setInfoSend(pricipalUser.getUserId()); // 管理员
          messageInfo.setInfoMemberid(member.getMemberId()); // 会员ID
          messageInfo.setCreaterTime(new Date()); // 设置当前时间
          messageInfo.setNoteId(messageNote.getNoteId()); // 设置活动邮件ID
          messageInfoMapper.insertSelective(messageInfo); // 执行添加
        }
      }

      for (int i = 0; i < noteList.size(); i++) {
        noteSend(messageNote.getNoteText(), noteList.get(i));
      }

      returnResult.setMsg("发送成功");
      returnResult.setSuccess(true);
    }
    return returnResult;
  }