lrf пре 8 месеци
родитељ
комит
80f851b927

+ 32 - 1
src/main/java/com/free/controller/ChatRecordController.java

@@ -18,11 +18,13 @@ 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;
 import com.free.service.ChatRecordService;
 import com.free.service.TransferApplyService;
+import com.free.utils.JwtUtil;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -39,6 +41,36 @@ public class ChatRecordController {
   @Autowired
   private MqService mqService;
 
+  /** 对话记录未读标识 */
+  public static final String chatRecordNotReadSign = "0";
+
+  /** 对话记录已读标识 */
+  public static final String chatRecordReadSign = "1";
+
+  @PassToken
+  @ApiOperation("修改已读")
+  @PostMapping("/read")
+  public Object read(@RequestBody @Valid ChatRecordToReadDTO body) {
+    Map userInfo = null;
+    try {
+      userInfo = JwtUtil.getDetails(null);
+      if (null == userInfo) {
+        return ResponseFormat.error();
+      }
+    } catch (Exception e) {
+      // TODO: handle exception
+      return ResponseFormat.error();
+    }
+    String user_id = (String) userInfo.get("id");
+    QueryWrapper qw = new QueryWrapper<>();
+    qw.eq("apply_id", body.getApply_id());
+    qw.ne("speaker", user_id);
+    ChatRecord updateData = new ChatRecord();
+    updateData.setIs_read(chatRecordReadSign);
+    service.update(updateData, qw);
+    return ResponseFormat.success();
+  }
+
   /** 创建数据 */
   @PassToken
   @ApiOperation("创建数据")
@@ -84,7 +116,6 @@ public class ChatRecordController {
     // return ResponseFormat.success();
   }
 
-
   /** 列表查询 */
   @PassToken
   @ApiOperation("查询数据列表")

+ 15 - 2
src/main/java/com/free/controller/TransferApplyController.java

@@ -50,6 +50,19 @@ public class TransferApplyController {
   /** 转人工申请,受理转人工-未结束标识 */
   public final static int TransferApplyNotClose = 1;
 
+  @PassToken
+  @ApiOperation("结束转人工服务")
+  @PostMapping("/close/{id}")
+  public Object close(@PathVariable String id) {
+    TransferApply data = service.getById(id);
+    if (null == data) {
+      throw new CustomizationException(ExceptionEnum.NOT_FOUND);
+    }
+    data.setIs_close(TransferApplyClose);
+    service.updateById(data);
+    return ResponseFormat.success();
+  }
+
   /** 创建数据 */
   @PassToken
   @ApiOperation("创建数据")
@@ -111,11 +124,11 @@ public class TransferApplyController {
     QueryWrapper qw = new QueryWrapper<>();
     qw.eq("id", id);
     TransferApply oldData = this.service.getOne(qw);
-    if (null== oldData) {
+    if (null == oldData) {
       throw new CustomizationException(ExceptionEnum.NOT_FOUND);
     }
     TransferApply updateData = new TransferApply();
-//    修改不会修改会话状态 关闭有单独的方法
+    // 修改不会修改会话状态 关闭有单独的方法
     updateData.setIs_close(oldData.getIs_close());
     updateData.setId(id);
     // 从token获取信息, 只有客服人员能处理

+ 3 - 7
src/main/java/com/free/service/TransferApplyService.java

@@ -9,7 +9,7 @@ import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.free.entity.ChatRecord;
+import com.free.controller.ChatRecordController;
 import com.free.entity.TransferApply;
 import com.free.entity.system.Customer;
 import com.free.mapper.TransferApplyMapper;
@@ -24,11 +24,7 @@ public class TransferApplyService extends ServiceImpl<TransferApplyMapper, Trans
   @Autowired
   private ChatRecordService chatRecordService;
 
-  /** 对话记录未读标识 */
-  public static final String chatRecordNotReadSign = "0";
-
-  /** 对话记录已读标识 */
-  public static final String chatRecordReadSign = "1";
+ 
 
   // @Autowired
   // private UserService userService
@@ -79,7 +75,7 @@ public class TransferApplyService extends ServiceImpl<TransferApplyMapper, Trans
       String apply_id = (String) map.get("id");
       QueryWrapper qw = new QueryWrapper<>();
       qw.eq("apply_id", apply_id);
-      qw.eq("is_read", chatRecordNotReadSign);
+      qw.eq("is_read", ChatRecordController.chatRecordNotReadSign);
       qw.ne("speaker", user_id);
       Long num = this.count(qw);
       map.put("notRead", num);

+ 1 - 1
src/main/resources/application.yml

@@ -27,7 +27,7 @@ spring:
     virtual-host: customer
     listener:
       simple:
-        acknowledge-mode: auto
+        acknowledge-mode: AUTO
   devtools:
     restart:
       enabled: true