Selaa lähdekoodia

修改返回ID

DESKTOP-USV654P\pc 2 vuotta sitten
vanhempi
commit
870ab45e83

+ 11 - 10
src/main/java/com/xjrsoft/module/oa/controller/NewsController.java

@@ -183,17 +183,18 @@ public class NewsController {
     @PutMapping("/read")
     @ApiOperation(value = "读新闻")
     public R read(@RequestBody List<Long> ids) {
-        List<NewsRelation> toSaveList = new ArrayList<>();
-        for (Long id : ids) {
-            NewsRelation newsRelation = new NewsRelation();
-            newsRelation.setUserId(StpUtil.getLoginIdAsLong());
-            newsRelation.setNewsId(id);
-            toSaveList.add(newsRelation);
+        List<NewsRelation> toSaveList = newsRelationService.list(
+                Wrappers.<NewsRelation>query().lambda()
+                        .in(NewsRelation::getNewsId, ids)
+                        .eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong()));
+        for (NewsRelation newsRelation : toSaveList) {
+            newsRelation.setReadMark(1);
+            newsRelation.setReadDate(LocalDateTime.now());
         }
-        newsRelationService.remove(Wrappers.<NewsRelation>query().lambda()
-                .in(NewsRelation::getNewsId, ids)
-                .eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong()));
-        return R.ok(newsRelationService.saveBatch(toSaveList));
+//        newsRelationService.remove(Wrappers.<NewsRelation>query().lambda()
+//                .in(NewsRelation::getNewsId, ids)
+//                .eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong()));
+        return R.ok(newsRelationService.updateBatchById(toSaveList));
     }
 
     @PutMapping("/reply")

+ 3 - 0
src/main/java/com/xjrsoft/module/oa/vo/NewsVo.java

@@ -19,6 +19,9 @@ import java.util.List;
 @Data
 public class NewsVo {
 
+    @ApiModelProperty("主键")
+    private Long id;
+
     @ApiModelProperty("所属类别主键")
     private Long categoryId;
 

+ 4 - 2
src/main/java/com/xjrsoft/module/organization/controller/WechatController.java

@@ -1,6 +1,8 @@
 package com.xjrsoft.module.organization.controller;
 
 
+import cn.hutool.core.lang.Snowflake;
+import cn.hutool.core.lang.generator.SnowflakeGenerator;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -82,8 +84,8 @@ public class WechatController {
         JSONObject object = new JSONObject();
         object.put("touser","o8d_c6c-0yamdT-sEvX1Umgof1fE");
         object.put("template_id","sHsmz7LRj7HLd7GSTS3r2uKMhE2f1iDAW15RqSK_6KM");
-        object.put("url","");
-        object.put("client_msg_id","MSG_000001");
+        object.put("url","https://zhxy.cqtlzjzx.com/app/#/pages/message/notice/detail?id=1537635790825926657");
+        object.put("client_msg_id", "MSG_000022");
 
         JSONObject data=new JSONObject();