mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-25 02:32:57 +08:00
二期移动端接口
This commit is contained in:
@@ -2,6 +2,7 @@ package com.xboe.system.user.api;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@@ -123,5 +124,38 @@ public class MessageApi extends ApiBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动端
|
||||
* 消息页面,按用户分组返回
|
||||
*
|
||||
* */
|
||||
@GetMapping("/mess-group")
|
||||
public JsonResponse<Map<String,Object>> messGroup(){
|
||||
String aid = this.getCurrent().getAccountId();
|
||||
if(StringUtil.isBlank(aid)){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
Map<String, Object> map = service.messGroup(aid);
|
||||
return success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动端
|
||||
* 按用户删除消息
|
||||
* */
|
||||
@GetMapping("/remove")
|
||||
public JsonResponse<Boolean> remove(String aid){
|
||||
if(StringUtil.isBlank(aid)){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
try {
|
||||
service.remove(aid);
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
return error("参数异常",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xboe.system.user.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.system.user.entity.Message;
|
||||
@@ -39,5 +40,15 @@ public interface IMessageService {
|
||||
* */
|
||||
void updateIsRead(List<String> ids);
|
||||
|
||||
/**
|
||||
* 移动端针对用户消息列表
|
||||
* */
|
||||
Map<String,Object> messGroup(String aid);
|
||||
|
||||
/**
|
||||
* 根据用户移除消息
|
||||
* */
|
||||
void remove(String aid);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.xboe.system.user.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@@ -76,4 +78,24 @@ public class MessageServiceImpl implements IMessageService {
|
||||
.builder());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> messGroup(String aid) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
QueryBuilder builder = QueryBuilder.from(Message.class);
|
||||
builder.addFilter(FieldFilters.eq("acceptId",aid));
|
||||
builder.addGroupBy("acceptId");
|
||||
List<Message> list = dao.findList(builder.builder());
|
||||
map.put("mess",list);
|
||||
//在查出未读消息数
|
||||
String sql="select count(1) from boe_message where is_read=false and acceptId=?1";
|
||||
int count = dao.sqlCount(sql, aid);
|
||||
map.put("count",count);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(String aid) {
|
||||
dao.deleteByFilter(FieldFilters.eq("acceptId",aid));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user