Merge branch 'main' of http://129.204.52.122:3001/c-zhouhf1/zhgh_hmc
This commit is contained in:
@@ -26,11 +26,13 @@ import io.v.nutz.zhgh.msgNotify.service.MsgNotifyService;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
@@ -155,6 +157,7 @@ public class MsgNotifyController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("msgNotify.send")
|
||||
public Object doAdd(@Param(value = "flag", required = false) boolean flag,
|
||||
@Param(value = "existsLoginNameRedisKey", required = false) String existsLoginNameRedisKey,
|
||||
@@ -168,12 +171,6 @@ public class MsgNotifyController {
|
||||
|
||||
|
||||
List<MsgNotifyUser> msgNotifyUsers = new ArrayList<>();
|
||||
MsgNotifyUser msgNotifyUser = new MsgNotifyUser();
|
||||
msgNotifyUser.setSendUser(ShiroUtil.getUserId());
|
||||
msgNotifyUser.setTitle(msgNotify.getTitle());
|
||||
msgNotifyUser.setContent(msgNotify.getContent());
|
||||
msgNotifyUser.setLink(msgNotify.getLink());
|
||||
msgNotifyUser.setApiModule("消息管理系统");
|
||||
|
||||
if (msgNotify.getSendMode().equals("one")) {
|
||||
List<NutMap> list = msgNotifyService.getUserByRoleIds(msgNotify.getModule(), msgNotify.getTeacherMeetingId(), msgNotify.getRoleIds());
|
||||
@@ -182,6 +179,13 @@ public class MsgNotifyController {
|
||||
msgNotifyService.sendMsg2(msgNotify.getSendTypes(), loginNames, msgNotify.getContent(),msgNotify.getTitle(),msgNotify.getLink());
|
||||
}
|
||||
list.forEach(v -> {
|
||||
// 每位收件人创建独立明细,避免循环复用对象导致所有记录指向最后一人。
|
||||
MsgNotifyUser msgNotifyUser = new MsgNotifyUser();
|
||||
msgNotifyUser.setSendUser(ShiroUtil.getUserId());
|
||||
msgNotifyUser.setTitle(msgNotify.getTitle());
|
||||
msgNotifyUser.setContent(msgNotify.getContent());
|
||||
msgNotifyUser.setLink(msgNotify.getLink());
|
||||
msgNotifyUser.setApiModule("消息管理系统");
|
||||
if (flag) {
|
||||
msgNotify.setSendTime(DateUtil.getDateTime());
|
||||
msgNotifyUser.setSendTime(DateUtil.getDateTime());
|
||||
@@ -199,6 +203,13 @@ public class MsgNotifyController {
|
||||
msgNotifyService.sendMsg2(msgNotify.getSendTypes(), loginNames, msgNotify.getContent(),msgNotify.getTitle(),msgNotify.getLink());
|
||||
}
|
||||
userScopes.forEach(v -> {
|
||||
// 每位收件人创建独立明细,避免循环复用对象导致所有记录指向最后一人。
|
||||
MsgNotifyUser msgNotifyUser = new MsgNotifyUser();
|
||||
msgNotifyUser.setSendUser(ShiroUtil.getUserId());
|
||||
msgNotifyUser.setTitle(msgNotify.getTitle());
|
||||
msgNotifyUser.setContent(msgNotify.getContent());
|
||||
msgNotifyUser.setLink(msgNotify.getLink());
|
||||
msgNotifyUser.setApiModule("消息管理系统");
|
||||
if (flag) {
|
||||
msgNotify.setSendTime(DateUtil.getDateTime());
|
||||
msgNotifyUser.setSendTime(DateUtil.getDateTime());
|
||||
@@ -215,6 +226,13 @@ public class MsgNotifyController {
|
||||
msgNotifyService.sendMsg2(msgNotify.getSendTypes(), loginNames, msgNotify.getContent(),msgNotify.getTitle(),msgNotify.getLink());
|
||||
}
|
||||
for (String u : users) {
|
||||
// 每位收件人创建独立明细,避免循环复用对象导致所有记录指向最后一人。
|
||||
MsgNotifyUser msgNotifyUser = new MsgNotifyUser();
|
||||
msgNotifyUser.setSendUser(ShiroUtil.getUserId());
|
||||
msgNotifyUser.setTitle(msgNotify.getTitle());
|
||||
msgNotifyUser.setContent(msgNotify.getContent());
|
||||
msgNotifyUser.setLink(msgNotify.getLink());
|
||||
msgNotifyUser.setApiModule("消息管理系统");
|
||||
if (flag) {
|
||||
msgNotify.setSendTime(DateUtil.getDateTime());
|
||||
msgNotifyUser.setSendTime(DateUtil.getDateTime());
|
||||
@@ -233,6 +251,13 @@ public class MsgNotifyController {
|
||||
|
||||
msgNotify.setSendTime(DateUtil.getDateTime());
|
||||
for (User u : userList) {
|
||||
// 每位收件人创建独立明细,确保导入人员与收件箱记录一一对应。
|
||||
MsgNotifyUser msgNotifyUser = new MsgNotifyUser();
|
||||
msgNotifyUser.setSendUser(ShiroUtil.getUserId());
|
||||
msgNotifyUser.setTitle(msgNotify.getTitle());
|
||||
msgNotifyUser.setContent(msgNotify.getContent());
|
||||
msgNotifyUser.setLink(msgNotify.getLink());
|
||||
msgNotifyUser.setApiModule("消息管理系统");
|
||||
msgNotifyUser.setUserId(u.getId());
|
||||
msgNotifyUser.setTitleId(msgNotify.getId());
|
||||
msgNotifyUser.setSendTime(DateUtil.getDateTime());
|
||||
@@ -249,6 +274,7 @@ public class MsgNotifyController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("msgNotify.send")
|
||||
public Object sendMsgByGroupId(@Param("msgNotify") String msgNotifyData) {
|
||||
|
||||
@@ -257,12 +283,12 @@ public class MsgNotifyController {
|
||||
msgNotify.setCreateTime(DateUtil.getDateTime());
|
||||
dao.insert(msgNotify);
|
||||
|
||||
MsgNotifyUser msgNotifyUser = new MsgNotifyUser();
|
||||
msgNotifyUser.setSendUser(ShiroUtil.getUserId());
|
||||
|
||||
List<NutMap> userScopes = msgNotifyService.getUserScopes(msgNotify.getActivityGroupId());
|
||||
msgNotifyService.sendMsg(msgNotify.getSendTypes(), userScopes, msgNotify.getContent());
|
||||
userScopes.forEach(v -> {
|
||||
// 按组发送时每位收件人使用独立实体,避免主键和人员信息被重复复用。
|
||||
MsgNotifyUser msgNotifyUser = new MsgNotifyUser();
|
||||
msgNotifyUser.setSendUser(ShiroUtil.getUserId());
|
||||
msgNotify.setSendTime(DateUtil.getDateTime());
|
||||
msgNotifyUser.setUserId(v.getString("id"));
|
||||
msgNotifyUser.setTitleId(msgNotify.getId());
|
||||
@@ -274,6 +300,7 @@ public class MsgNotifyController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("msgNotify.send")
|
||||
public Object doEdit(boolean flag, @Param("msgNotify") String msgNotifyData, @Param(value = "users", required = false) String[] users) {
|
||||
MsgNotify msgNotify = Json.fromJson(MsgNotify.class, msgNotifyData);
|
||||
@@ -285,8 +312,6 @@ public class MsgNotifyController {
|
||||
list = msgNotifyService.getUserByRoleIds(msgNotify.getModule(), msgNotify.getTeacherMeetingId(), msgNotify.getRoleIds());
|
||||
}
|
||||
|
||||
MsgNotifyUser msgNotifyUser = new MsgNotifyUser();
|
||||
msgNotifyUser.setSendUser(ShiroUtil.getUserId());
|
||||
if (msgNotify.getType() != null && msgNotify.getType().equals("system")) {
|
||||
msgNotify.setHold(flag ? true : false);
|
||||
|
||||
@@ -295,6 +320,9 @@ public class MsgNotifyController {
|
||||
|
||||
}
|
||||
list.forEach(v -> {
|
||||
// 编辑后发送时为每位系统角色人员创建独立明细。
|
||||
MsgNotifyUser msgNotifyUser = new MsgNotifyUser();
|
||||
msgNotifyUser.setSendUser(ShiroUtil.getUserId());
|
||||
if (flag) {
|
||||
msgNotify.setSendTime(DateUtil.getDateTime());
|
||||
}
|
||||
@@ -314,6 +342,9 @@ public class MsgNotifyController {
|
||||
}
|
||||
msgNotify.setHold(flag ? true : false);
|
||||
for (String u : users) {
|
||||
// 编辑后发送时为每位自定义人员创建独立明细。
|
||||
MsgNotifyUser msgNotifyUser = new MsgNotifyUser();
|
||||
msgNotifyUser.setSendUser(ShiroUtil.getUserId());
|
||||
if (flag) {
|
||||
msgNotify.setSendTime(DateUtil.getDateTime());
|
||||
}
|
||||
@@ -328,6 +359,9 @@ public class MsgNotifyController {
|
||||
msgNotifyService.sendMsg(msgNotify.getSendTypes(), userScopes, msgNotify.getContent());
|
||||
}
|
||||
userScopes.forEach(v -> {
|
||||
// 编辑后发送时为活动组中的每位人员创建独立明细。
|
||||
MsgNotifyUser msgNotifyUser = new MsgNotifyUser();
|
||||
msgNotifyUser.setSendUser(ShiroUtil.getUserId());
|
||||
if (flag) {
|
||||
msgNotify.setSendTime(DateUtil.getDateTime());
|
||||
}
|
||||
@@ -342,7 +376,6 @@ public class MsgNotifyController {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
|
||||
Reference in New Issue
Block a user