コード例 #1
0
 public Object listAsGrid(JqPager pemail) {
   JqGridReturn returnResult = new JqGridReturn();
   MessageNoteExample messageNoteExample = new MessageNoteExample();
   if (null != pemail.getPage() && null != pemail.getRows()) { // 设置排序信息
     messageNoteExample.setLimitStart((pemail.getPage() - 1) * pemail.getRows());
     messageNoteExample.setLimitEnd(pemail.getRows());
   }
   if (StringUtils.isNotBlank(pemail.getSort())
       && StringUtils.isNotBlank(pemail.getOrder())) { // 设置排序信息
     messageNoteExample.setOrderByClause(pemail.getOrderBy("temp_message_note_"));
   }
   List<MessageNote> messageNotes =
       messageNoteMapper.selectByExample(messageNoteExample); // 查询所有广告列表
   int total = messageNoteMapper.countByExample(messageNoteExample); // 查询总页数
   returnResult.setRows(messageNotes);
   returnResult.setTotal(total);
   return returnResult; // 返回ExtGrid表
 }
コード例 #2
0
  @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;
  }
コード例 #3
0
 @Transactional(readOnly = false)
 public Object getNote(String noteId) {
   MessageNote messageNote = messageNoteMapper.selectByPrimaryKey(noteId);
   return messageNote;
 }