lrf 8 bulan lalu
induk
melakukan
33e174bc0d

+ 11 - 28
src/main/java/com/free/controller/ChatRecordController.java

@@ -24,6 +24,7 @@ import com.free.config.CustomizationException;
 import com.free.config.ExceptionEnum;
 import com.free.config.ResponseFormat;
 import com.free.dto.ChatRecordCreateDTO;
+import com.free.dto.ChatRecordToReadDTO;
 import com.free.entity.ChatRecord;
 import com.free.entity.TransferApply;
 import com.free.mq.MqService;
@@ -45,6 +46,16 @@ public class ChatRecordController {
   @Autowired
   private MqService mqService;
 
+  @ApiOperation("对话已读")
+  @PostMapping("/read")
+  public Object readMsg(@RequestBody ChatRecordToReadDTO body) {
+    ChatRecord updateData = new ChatRecord();
+    updateData.setIs_read(service.chatRecordReadSign);
+    QueryWrapper qw = new QueryWrapper<>();
+    qw.eq("apply_id", body.getApply_id());
+    return ResponseFormat.success();
+  }
+
   /** 创建数据 */
   @PassToken
   @ApiOperation("创建数据")
@@ -90,21 +101,6 @@ public class ChatRecordController {
     // return ResponseFormat.success();
   }
 
-  /** 修改数据, 转人工对话不修改 */
-  @ApiOperation("修改数据")
-  // @PostMapping("/{id}")
-  public Object update(@PathVariable String id, @RequestBody ChatRecord data) {
-    QueryWrapper qw = new QueryWrapper<>();
-    qw.eq("id", id);
-    Long num = this.service.count(qw);
-    if (num <= 0) {
-      throw new CustomizationException(ExceptionEnum.NOT_FOUND);
-    }
-    data.setId(id);
-    this.service.updateById(data);
-    Object newData = this.service.getById(id);
-    return ResponseFormat.success(newData);
-  }
 
   /** 列表查询 */
   @PassToken
@@ -156,17 +152,4 @@ public class ChatRecordController {
     return ResponseFormat.success(newData);
   }
 
-  /** 根据id删除数据 , 无删除 */
-  @ApiOperation("删除数据")
-  // @DeleteMapping("/{id}")
-  public Object delete(@PathVariable String id) {
-    QueryWrapper qw = new QueryWrapper<>();
-    qw.eq("id", id);
-    Long num = service.count(qw);
-    if (num <= 0) {
-      throw new CustomizationException(ExceptionEnum.NOT_FOUND);
-    }
-    service.removeById(id);
-    return ResponseFormat.success();
-  }
 }

+ 12 - 0
src/main/java/com/free/dto/ChatRecordToReadDTO.java

@@ -0,0 +1,12 @@
+package com.free.dto;
+
+
+import javax.validation.constraints.NotBlank;
+
+import lombok.Data;
+
+@Data
+public class ChatRecordToReadDTO {
+  @NotBlank(message = "缺少转人工信息")
+  private String apply_id;
+}