|
@@ -63,37 +63,50 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|
|
int lines = noticeMapper.insertNotice(notice);
|
|
|
SysNoticeTo sysNoticeTo = new SysNoticeTo();
|
|
|
sysNoticeTo.setNoticeId(notice.getNoticeId());
|
|
|
- String[] userIds = notice.getGlobalUserIds().split(",");
|
|
|
+// String[] userIds = notice.getGlobalUserIds().split(",");
|
|
|
+ //临时修改
|
|
|
+ String[] userIds = null;
|
|
|
+ if(notice.getGlobalUserIds() != null){
|
|
|
+ userIds = notice.getGlobalUserIds().split(",");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
System.out.println(notice.getGlobalUserIds()+"=notice.getGlobalUserIds");
|
|
|
System.out.println(notice.getGlobalDeptIds()+"=notice.getGlobalDeptIds");
|
|
|
- System.out.println(userIds.length+"=userIds.length");
|
|
|
+// System.out.println(userIds.length+"=userIds.length");
|
|
|
System.out.println(notice.getIsGroupNotice()+"=notice.getIsGroupNotice()");
|
|
|
- if(notice.getIsGroupNotice().equals("1")){//群发模式 不插入扩展表
|
|
|
+ if(notice.getIsGroupNotice()!=null && notice.getIsGroupNotice().equals("1")){//群发模式 不插入扩展表
|
|
|
System.out.println("群发模式 不插入扩展表");
|
|
|
return lines;
|
|
|
}
|
|
|
|
|
|
- Long[] userIdArray = sysNoticeToMapper.selectUserIdsByDeptIds(notice.getGlobalDeptIds().split(","));//根据部门选择的用户ID
|
|
|
- Set userIdSet = new HashSet();
|
|
|
- for (Object obj:userIdArray) {
|
|
|
- userIdSet.add(obj);
|
|
|
- }
|
|
|
- System.out.println(userIdSet.size()+"=userIdSet.size()");
|
|
|
- for (int i = 0; i < userIds.length; i++) {
|
|
|
- if("".equals(userIds[i])){
|
|
|
- System.out.println(userIds[i]+"=userIds[i] 为空");
|
|
|
- continue;
|
|
|
+ if(notice.getGlobalDeptIds() != null){
|
|
|
+ Long[] userIdArray = sysNoticeToMapper.selectUserIdsByDeptIds(notice.getGlobalDeptIds().split(","));//根据部门选择的用户ID
|
|
|
+ Set userIdSet = new HashSet();
|
|
|
+ for (Object obj:userIdArray) {
|
|
|
+ userIdSet.add(obj);
|
|
|
+ }
|
|
|
+ System.out.println(userIdSet.size()+"=userIdSet.size()");
|
|
|
+ for (int i = 0; userIds!= null && i < userIds.length; i++) {
|
|
|
+ if("".equals(userIds[i])){
|
|
|
+ System.out.println(userIds[i]+"=userIds[i] 为空");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ userIdSet.add(Long.valueOf(userIds[i]));//
|
|
|
}
|
|
|
- userIdSet.add(Long.valueOf(userIds[i]));//
|
|
|
- }
|
|
|
|
|
|
- Iterator<Long> iterator = userIdSet.iterator();
|
|
|
- while (iterator.hasNext()){
|
|
|
- sysNoticeTo.setId(UUID.randomUUID().toString().replace("-",""));
|
|
|
- sysNoticeTo.setUserId(iterator.next());
|
|
|
- sysNoticeToMapper.insertSysNoticeTo(sysNoticeTo);
|
|
|
+ Iterator<Long> iterator = userIdSet.iterator();
|
|
|
+ while (iterator.hasNext()){
|
|
|
+ sysNoticeTo.setId(UUID.randomUUID().toString().replace("-",""));
|
|
|
+ sysNoticeTo.setUserId(iterator.next());
|
|
|
+ sysNoticeToMapper.insertSysNoticeTo(sysNoticeTo);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/*for (int i = 0; i < userIds.length; i++) {
|
|
|
sysNoticeTo.setId(UUID.randomUUID().toString().replace("-",""));
|
|
|
System.out.println(userIds[i]+"=userIds[i]");
|