|
@@ -14,6 +14,7 @@ import com.free.entity.TransferApply;
|
|
import com.free.entity.system.Customer;
|
|
import com.free.entity.system.Customer;
|
|
import com.free.mapper.TransferApplyMapper;
|
|
import com.free.mapper.TransferApplyMapper;
|
|
import com.free.service.system.CustomerService;
|
|
import com.free.service.system.CustomerService;
|
|
|
|
+import com.free.utils.JwtUtil;
|
|
import com.free.utils.Utils;
|
|
import com.free.utils.Utils;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -23,6 +24,12 @@ public class TransferApplyService extends ServiceImpl<TransferApplyMapper, Trans
|
|
@Autowired
|
|
@Autowired
|
|
private ChatRecordService chatRecordService;
|
|
private ChatRecordService chatRecordService;
|
|
|
|
|
|
|
|
+ /** 对话记录未读标识 */
|
|
|
|
+ public static final String chatRecordNotReadSign = "0";
|
|
|
|
+
|
|
|
|
+ /** 对话记录已读标识 */
|
|
|
|
+ public static final String chatRecordReadSign = "1";
|
|
|
|
+
|
|
// @Autowired
|
|
// @Autowired
|
|
// private UserService userService
|
|
// private UserService userService
|
|
/**
|
|
/**
|
|
@@ -51,6 +58,35 @@ public class TransferApplyService extends ServiceImpl<TransferApplyMapper, Trans
|
|
return returnData;
|
|
return returnData;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 查询当前用户查出的列表中的未读数量
|
|
|
|
+ *
|
|
|
|
+ * @param list
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public List<Map> getUserNotReadNum(List<Map> list) {
|
|
|
|
+ String token = null;
|
|
|
|
+ try {
|
|
|
|
+ token = JwtUtil.getToken();
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ }
|
|
|
|
+ if (null == token) {
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
+ Map userInfo = JwtUtil.getDetails(null);
|
|
|
|
+ String user_id = (String) userInfo.get("id");
|
|
|
|
+ for (Map map : list) {
|
|
|
|
+ String apply_id = (String) map.get("id");
|
|
|
|
+ QueryWrapper qw = new QueryWrapper<>();
|
|
|
|
+ qw.eq("apply_id", apply_id);
|
|
|
|
+ qw.eq("is_read", chatRecordNotReadSign);
|
|
|
|
+ qw.ne("speaker", user_id);
|
|
|
|
+ Long num = this.count(qw);
|
|
|
|
+ map.put("notRead", num);
|
|
|
|
+ }
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取每个转人工申请中聊天记录的最后一条
|
|
* 获取每个转人工申请中聊天记录的最后一条
|
|
*
|
|
*
|
|
@@ -61,7 +97,7 @@ public class TransferApplyService extends ServiceImpl<TransferApplyMapper, Trans
|
|
for (Map map : list) {
|
|
for (Map map : list) {
|
|
String apply_id = (String) map.get("id");
|
|
String apply_id = (String) map.get("id");
|
|
QueryWrapper qw = new QueryWrapper<>();
|
|
QueryWrapper qw = new QueryWrapper<>();
|
|
- qw.select("content", "time", "is_read","content_type");
|
|
|
|
|
|
+ qw.select("content", "time", "is_read", "content_type");
|
|
qw.eq("apply_id", apply_id);
|
|
qw.eq("apply_id", apply_id);
|
|
qw.orderByDesc("time");
|
|
qw.orderByDesc("time");
|
|
Map chatRecord = chatRecordService.getMap(qw);
|
|
Map chatRecord = chatRecordService.getMap(qw);
|