|
@@ -8,10 +8,9 @@ import com.gree.mall.manager.bean.notice.NoticeWebsitRecordVO;
|
|
|
import com.gree.mall.manager.bean.notice.NoticeWebsitVO;
|
|
|
import com.gree.mall.manager.bean.workorder.WebsitDispatchVO;
|
|
|
import com.gree.mall.manager.commonmapper.NoticeRecordBeanMapper;
|
|
|
+import com.gree.mall.manager.enums.IsYesNoEnum;
|
|
|
import com.gree.mall.manager.logic.common.CommonLogic;
|
|
|
-import com.gree.mall.manager.plus.entity.AdminWebsit;
|
|
|
-import com.gree.mall.manager.plus.entity.NoticeWebsit;
|
|
|
-import com.gree.mall.manager.plus.entity.NoticeWebsitRecord;
|
|
|
+import com.gree.mall.manager.plus.entity.*;
|
|
|
import com.gree.mall.manager.plus.service.AdminWebsitService;
|
|
|
import com.gree.mall.manager.plus.service.NoticeWebsitRecordService;
|
|
|
import com.gree.mall.manager.plus.service.NoticeWebsitService;
|
|
@@ -20,8 +19,12 @@ import com.gree.mall.manager.zfire.util.FieldUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Service
|
|
@@ -134,4 +137,63 @@ public class NoticeWebsitLogic {
|
|
|
|
|
|
return noticeWebsitRecordVOIPage;
|
|
|
}
|
|
|
+
|
|
|
+ public Object unreadCount(HttpServletRequest request, String readFlag) {
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
+ Integer count = noticeWebsitRecordService.lambdaQuery()
|
|
|
+ .eq(NoticeWebsitRecord::getReadFlag, readFlag)
|
|
|
+ .in(!CollectionUtils.isEmpty(adminUser.getAdminWebsitIds()),NoticeWebsitRecord::getAdminWebsitId, adminUser.getAdminWebsitIds())
|
|
|
+ .count();
|
|
|
+
|
|
|
+ return count;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void markRead(List<String> noticeIds) {
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
+ noticeWebsitRecordService.lambdaUpdate()
|
|
|
+ .in(NoticeWebsitRecord::getNoticeWebsitId,noticeIds)
|
|
|
+ .in(!CollectionUtils.isEmpty(adminUser.getAdminWebsitIds()),NoticeWebsitRecord::getAdminWebsitId, adminUser.getAdminWebsitIds())
|
|
|
+ .set(NoticeWebsitRecord::getReadFlag, IsYesNoEnum.YES.getKey())
|
|
|
+ .set(NoticeWebsitRecord::getReadTime, new Date())
|
|
|
+ .update();
|
|
|
+
|
|
|
+ for (String id : noticeIds) {
|
|
|
+
|
|
|
+
|
|
|
+ NoticeWebsit one = noticeWebsitService.getById(id);
|
|
|
+ if (one != null){
|
|
|
+ one.setNum(one.getNum()+1);
|
|
|
+ one.updateById();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void markReadAll(HttpServletRequest request) {
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
+ if (!CollectionUtils.isEmpty(adminUser.getAdminWebsitIds())) {
|
|
|
+
|
|
|
+ List<NoticeWebsitRecord> list = noticeWebsitRecordService.lambdaQuery()
|
|
|
+ .in(!CollectionUtils.isEmpty(adminUser.getAdminWebsitIds()), NoticeWebsitRecord::getAdminWebsitId, adminUser.getAdminWebsitIds())
|
|
|
+ .list();
|
|
|
+ for (NoticeWebsitRecord websitRecord : list) {
|
|
|
+
|
|
|
+
|
|
|
+ NoticeWebsit one = noticeWebsitService.getById(websitRecord.getNoticeWebsitId());
|
|
|
+ if (one != null){
|
|
|
+ one.setNum(one.getNum()+1);
|
|
|
+ one.updateById();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ noticeWebsitRecordService.lambdaUpdate()
|
|
|
+ .in(!CollectionUtils.isEmpty(adminUser.getAdminWebsitIds()), NoticeWebsitRecord::getAdminWebsitId, adminUser.getAdminWebsitIds())
|
|
|
+ .set(NoticeWebsitRecord::getReadFlag, IsYesNoEnum.YES.getKey())
|
|
|
+ .set(NoticeWebsitRecord::getReadTime, new Date())
|
|
|
+ .update();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|