|
@@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
@Slf4j
|
|
@@ -102,6 +103,7 @@ public class NoticeWebsitLogic {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
noticeBean.setCompanyWechatId(adminUser.getCompanyWechatId());
|
|
|
noticeBean.setCompanyWechatName(adminUser.getCompanyName());
|
|
|
+
|
|
|
noticeBean.updateById();
|
|
|
|
|
|
List<NoticeWebsitRecord> noticeWebsitRecords = new ArrayList<>();
|
|
@@ -126,10 +128,11 @@ public class NoticeWebsitLogic {
|
|
|
}
|
|
|
|
|
|
public void ofOrSend(String id, String status) {
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
NoticeWebsit noticeWebsit = noticeWebsitService.getById(id);
|
|
|
noticeWebsit.setStatus(status);
|
|
|
- if (status.equals("SEND"))
|
|
|
- noticeWebsit.setIssueTime(new Date());
|
|
|
+
|
|
|
+
|
|
|
noticeWebsit.updateById();
|
|
|
|
|
|
noticeWebsitRecordService.lambdaUpdate()
|
|
@@ -154,7 +157,17 @@ public class NoticeWebsitLogic {
|
|
|
|
|
|
public Object unreadCount(HttpServletRequest request, String readFlag) {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
+
|
|
|
+ List<String> collect = noticeWebsitService.lambdaQuery()
|
|
|
+ .eq(NoticeWebsit::getStatus, "SEND").select(NoticeWebsit::getNoticeWebsitId)
|
|
|
+ .list().stream().map(NoticeWebsit::getNoticeWebsitId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(collect)) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
Integer count = noticeWebsitRecordService.lambdaQuery()
|
|
|
+ .in(NoticeWebsitRecord::getNoticeWebsitId,collect)
|
|
|
.eq(NoticeWebsitRecord::getReadFlag, readFlag)
|
|
|
.in(!CollectionUtils.isEmpty(adminUser.getAdminWebsitIds()),NoticeWebsitRecord::getAdminWebsitId, adminUser.getAdminWebsitIds())
|
|
|
.count();
|
|
@@ -167,6 +180,7 @@ public class NoticeWebsitLogic {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
noticeWebsitRecordService.lambdaUpdate()
|
|
|
.in(NoticeWebsitRecord::getNoticeWebsitId,noticeIds)
|
|
|
+ .eq(NoticeWebsitRecord::getReadFlag,IsYesNoEnum.NO.getKey())
|
|
|
.in(!CollectionUtils.isEmpty(adminUser.getAdminWebsitIds()),NoticeWebsitRecord::getAdminWebsitId, adminUser.getAdminWebsitIds())
|
|
|
.set(NoticeWebsitRecord::getReadFlag, IsYesNoEnum.YES.getKey())
|
|
|
.set(NoticeWebsitRecord::getReadTime, new Date())
|
|
@@ -175,10 +189,15 @@ public class NoticeWebsitLogic {
|
|
|
for (String id : noticeIds) {
|
|
|
|
|
|
|
|
|
+
|
|
|
NoticeWebsit one = noticeWebsitService.getById(id);
|
|
|
if (one != null){
|
|
|
- one.setNum(one.getNum()+1);
|
|
|
- one.updateById();
|
|
|
+
|
|
|
+ noticeWebsitService.lambdaUpdate()
|
|
|
+ .eq(NoticeWebsit::getNoticeWebsitId,one.getNoticeWebsitId())
|
|
|
+ .set(NoticeWebsit::getNum,noticeWebsitRecordService.lambdaQuery()
|
|
|
+ .eq(NoticeWebsitRecord::getNoticeWebsitId,id)
|
|
|
+ .eq(NoticeWebsitRecord::getReadFlag,IsYesNoEnum.YES.getKey()).count()).update();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -190,24 +209,36 @@ public class NoticeWebsitLogic {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
if (!CollectionUtils.isEmpty(adminUser.getAdminWebsitIds())) {
|
|
|
|
|
|
+ List<String> collect = noticeWebsitService.lambdaQuery()
|
|
|
+ .eq(NoticeWebsit::getStatus, "SEND").select(NoticeWebsit::getNoticeWebsitId)
|
|
|
+ .list().stream().map(NoticeWebsit::getNoticeWebsitId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(collect)) {
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+
|
|
|
List<NoticeWebsitRecord> list = noticeWebsitRecordService.lambdaQuery()
|
|
|
+ .in(NoticeWebsitRecord::getNoticeWebsitId,collect)
|
|
|
+ .eq(NoticeWebsitRecord::getReadFlag,IsYesNoEnum.NO.getKey())
|
|
|
.in(!CollectionUtils.isEmpty(adminUser.getAdminWebsitIds()), NoticeWebsitRecord::getAdminWebsitId, adminUser.getAdminWebsitIds())
|
|
|
.list();
|
|
|
for (NoticeWebsitRecord websitRecord : list) {
|
|
|
|
|
|
-
|
|
|
+ websitRecord.setReadFlag(IsYesNoEnum.YES.getKey());
|
|
|
+ websitRecord.setReadTime(new Date());
|
|
|
+ websitRecord.updateById();
|
|
|
NoticeWebsit one = noticeWebsitService.getById(websitRecord.getNoticeWebsitId());
|
|
|
if (one != null){
|
|
|
- one.setNum(one.getNum()+1);
|
|
|
- one.updateById();
|
|
|
+ noticeWebsitService.lambdaUpdate()
|
|
|
+ .eq(NoticeWebsit::getNoticeWebsitId,one.getNoticeWebsitId())
|
|
|
+ .set(NoticeWebsit::getNum,noticeWebsitRecordService.lambdaQuery()
|
|
|
+ .eq(NoticeWebsitRecord::getNoticeWebsitId,one.getNoticeWebsitId())
|
|
|
+ .eq(NoticeWebsitRecord::getReadFlag,IsYesNoEnum.YES.getKey()).count()).update();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- noticeWebsitRecordService.lambdaUpdate()
|
|
|
- .in(!CollectionUtils.isEmpty(adminUser.getAdminWebsitIds()), NoticeWebsitRecord::getAdminWebsitId, adminUser.getAdminWebsitIds())
|
|
|
- .set(NoticeWebsitRecord::getReadFlag, IsYesNoEnum.YES.getKey())
|
|
|
- .set(NoticeWebsitRecord::getReadTime, new Date())
|
|
|
- .update();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -216,6 +247,7 @@ public class NoticeWebsitLogic {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
noticeWebsitRecordService.lambdaUpdate()
|
|
|
.in(NoticeWebsitRecord::getId,id)
|
|
|
+ .eq(NoticeWebsitRecord::getReadFlag,IsYesNoEnum.NO.getKey())
|
|
|
.in(!CollectionUtils.isEmpty(adminUser.getAdminWebsitIds()),NoticeWebsitRecord::getAdminWebsitId, adminUser.getAdminWebsitIds())
|
|
|
.set(NoticeWebsitRecord::getReadFlag, IsYesNoEnum.YES.getKey())
|
|
|
.set(NoticeWebsitRecord::getReadTime, new Date())
|
|
@@ -226,8 +258,11 @@ public class NoticeWebsitLogic {
|
|
|
NoticeWebsitRecord noticeWebsitRecord = noticeWebsitRecordService.getById(idOne);
|
|
|
NoticeWebsit one = noticeWebsitService.getById(noticeWebsitRecord.getNoticeWebsitId());
|
|
|
if (one != null){
|
|
|
- one.setNum(one.getNum()+1);
|
|
|
- one.updateById();
|
|
|
+ noticeWebsitService.lambdaUpdate()
|
|
|
+ .in(NoticeWebsit::getNoticeWebsitId,one.getNoticeWebsitId())
|
|
|
+ .set(NoticeWebsit::getNum,noticeWebsitRecordService.lambdaQuery()
|
|
|
+ .eq(NoticeWebsitRecord::getNoticeWebsitId,one.getNoticeWebsitId())
|
|
|
+ .eq(NoticeWebsitRecord::getReadFlag,IsYesNoEnum.YES.getKey()).count()).update();
|
|
|
}
|
|
|
}
|
|
|
}
|