public String send(CmsMessage message, String username, Integer groupId,
Integer pageNo, String title, Date sendBeginTime, Date sendEndTime,
Boolean status, Integer box, ModelMap model,
HttpServletRequest request, HttpServletResponse response) {
CmsSite site = CmsUtils.getSite(request);
CmsUser user = CmsUtils.getUser(request);
Date now = new Date();
CmsReceiverMessage receiverMessage = new CmsReceiverMessage();
CmsUser msgReceiverUser = userMng.findByUsername(username);
if (msgReceiverUser != null) {
messageInfoSet(message, receiverMessage, user, msgReceiverUser,
now, site, request);
}
// 按会员组推送站内信
if (groupId != null && !groupId.equals(-1)) {
List<CmsUser> users;
CmsUser tempUser;
CmsMessage tempMsg;
CmsReceiverMessage tempReceiverMsg;
if (groupId.equals(0)) {
// 所有未禁用会员
users = userMng.getList(null, null, null, null, false, false,null);
if (users != null && users.size() > 0) {
for (int i = 0; i < users.size(); i++) {
tempUser = users.get(i);
tempMsg = new CmsMessage();
tempMsg.setMsgTitle(message.getMsgTitle());
tempMsg.setMsgContent(message.getMsgContent());
tempReceiverMsg = new CmsReceiverMessage();
if (msgReceiverUser != null) {
if (!tempUser.equals(msgReceiverUser)) {
messageInfoSet(tempMsg, tempReceiverMsg, user,
tempUser, now, site, request);
}
} else {
messageInfoSet(tempMsg, tempReceiverMsg, user,
tempUser, now, site, request);
}
}
}
} else {
// 非禁用的会员
users = userMng.getList(null, null, null, groupId, false,
false, null);
if (users != null && users.size() > 0) {
for (int i = 0; i < users.size(); i++) {
tempUser = users.get(i);
tempMsg = new CmsMessage();
tempMsg.setMsgTitle(message.getMsgTitle());
tempMsg.setMsgContent(message.getMsgContent());
tempReceiverMsg = new CmsReceiverMessage();
if (msgReceiverUser != null) {
if (!tempUser.equals(msgReceiverUser)) {
messageInfoSet(tempMsg, tempReceiverMsg, user,
tempUser, now, site, request);
}
} else {
messageInfoSet(tempMsg, tempReceiverMsg, user,