Bläddra i källkod

消息记录全部已读

cs 2 år sedan
förälder
incheckning
516708c590

+ 10 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/InformationController.java

@@ -33,5 +33,15 @@ public class InformationController {
     public HttpRespMsg checkInformation(@RequestParam Integer id, HttpServletRequest request) {
         return informationService.checkInformation(id, request);
     }
+
+    /**
+     * 将所有未读消息标记为已读
+     * @param request
+     * @return
+     */
+    @RequestMapping("/checkAll")
+    public HttpRespMsg allCheck(HttpServletRequest request) {
+        return informationService.checkAllInformation(request);
+    }
 }
 

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/InformationService.java

@@ -18,4 +18,6 @@ public interface InformationService extends IService<Information> {
     HttpRespMsg getInformationList(HttpServletRequest request);
 
     HttpRespMsg checkInformation(Integer id, HttpServletRequest request);
+
+    HttpRespMsg checkAllInformation(HttpServletRequest request);
 }

+ 22 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/InformationServiceImpl.java

@@ -38,6 +38,9 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
     @Resource
     private WxCorpInfoMapper wxCorpInfoMapper;
 
+    @Resource
+    private InformationService informationService;
+
     @Override
     public HttpRespMsg getInformationList(HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
@@ -93,4 +96,23 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
         }
         return httpRespMsg;
     }
+
+    /**
+     * 将该用户所有未读消息标记为已读
+     * @param request
+     * @return
+     */
+    @Override
+    public HttpRespMsg checkAllInformation(HttpServletRequest request) {
+        HttpRespMsg HttpRespMsg = new HttpRespMsg();
+        String token = request.getHeader("token");
+        List<Information> information = informationMapper.selectList(new QueryWrapper<Information>().eq("user_id", token).eq("checked", 0));
+        if (information.size() != 0){
+            for (Information item : information) {
+                item.setChecked(1);
+            }
+            informationService.updateBatchById(information);
+        }
+        return HttpRespMsg;
+    }
 }