|
@@ -18,11 +18,13 @@ import com.free.config.CustomizationException;
|
|
import com.free.config.ExceptionEnum;
|
|
import com.free.config.ExceptionEnum;
|
|
import com.free.config.ResponseFormat;
|
|
import com.free.config.ResponseFormat;
|
|
import com.free.dto.ChatRecordCreateDTO;
|
|
import com.free.dto.ChatRecordCreateDTO;
|
|
|
|
+import com.free.dto.ChatRecordToReadDTO;
|
|
import com.free.entity.ChatRecord;
|
|
import com.free.entity.ChatRecord;
|
|
import com.free.entity.TransferApply;
|
|
import com.free.entity.TransferApply;
|
|
import com.free.mq.MqService;
|
|
import com.free.mq.MqService;
|
|
import com.free.service.ChatRecordService;
|
|
import com.free.service.ChatRecordService;
|
|
import com.free.service.TransferApplyService;
|
|
import com.free.service.TransferApplyService;
|
|
|
|
+import com.free.utils.JwtUtil;
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -39,6 +41,36 @@ public class ChatRecordController {
|
|
@Autowired
|
|
@Autowired
|
|
private MqService mqService;
|
|
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
|
|
@PassToken
|
|
@ApiOperation("创建数据")
|
|
@ApiOperation("创建数据")
|
|
@@ -84,7 +116,6 @@ public class ChatRecordController {
|
|
// return ResponseFormat.success();
|
|
// return ResponseFormat.success();
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
/** 列表查询 */
|
|
/** 列表查询 */
|
|
@PassToken
|
|
@PassToken
|
|
@ApiOperation("查询数据列表")
|
|
@ApiOperation("查询数据列表")
|