Commit ee28bb94 by shiwenbo

增加场站系统和购砂单位系统查询消息的接口

parent 3d502572
......@@ -27,6 +27,11 @@ public class QueryParam {
*/
private String type;
/**
* 用户Id
*/
private String userId;
public String getType() {
......@@ -69,4 +74,12 @@ public class QueryParam {
this.orderField = orderField;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
}
......@@ -48,7 +48,12 @@ import com.beecode.bcp.authz.service.PrivilegeService;
import com.beecode.bcp.type.KObject;
import com.beecode.bcp.type.json.JSONObjectUtils;
import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.beecode.inz.message.internal.QueryParam;
import com.beecode.inz.message.service.MessageInfoService;
import com.beecode.inz.message.web.info.MessageInfo;
import com.beecode.nlib.utils.StringUtils;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.xyst.dinas.biz.enumeration.PlanningCycleEnum;
import com.xyst.dinas.biz.service.DinasCommonService;
import com.xyst.dinas.biz.service.DinasOrganizationService;
......@@ -74,6 +79,9 @@ public class DinasCommonController {
PrivilegeService privilegeService;
@Autowired
private MessageInfoService messageInfoService;
@Autowired
public AttachmentService attachmentService;
private final Logger logger = LoggerFactory.getLogger(getClass());
/**
......@@ -352,5 +360,59 @@ public class DinasCommonController {
}
return false;
}
/**
* 获取指定消息类型指定页的消息-已读未读都包含,未读在前面(场站用户)
* @throws Exception
*/
@RequestMapping(value ="/warehouse/api/common/messages/query",method = RequestMethod.POST)
public Object queryByPagingWarehouse(@RequestBody String body) throws Exception{
Gson gson = new Gson();
QueryParam param = null;
try{
param = gson.fromJson(body, QueryParam.class);
}catch(JsonSyntaxException e){
logger.error("Paging param is no correct");
throw new JsonSyntaxException("Paging param is no correct",e);
}
if(param == null){
logger.error("Paging param is no correct");
throw new Exception("Paging param is no correct");
}
String userId = param.getUserId();
List<KObject> lists = messageInfoService.queryByPaging(userId, param);
List<MessageInfo> messageInfos = new ArrayList<MessageInfo>();
for(KObject kobject :lists){
messageInfos.add(new MessageInfo(kobject));
}
return messageInfos;
}
/**
* 获取指定消息类型指定页的消息-已读未读都包含,未读在前面(购砂单位用户)
* @throws Exception
*/
@RequestMapping(value ="/sand/user/common/messages/query",method = RequestMethod.POST)
public Object queryByPagingSand(@RequestBody String body) throws Exception{
Gson gson = new Gson();
QueryParam param = null;
try{
param = gson.fromJson(body, QueryParam.class);
}catch(JsonSyntaxException e){
logger.error("Paging param is no correct");
throw new JsonSyntaxException("Paging param is no correct",e);
}
if(param == null){
logger.error("Paging param is no correct");
throw new Exception("Paging param is no correct");
}
String userId = param.getUserId();
List<KObject> lists = messageInfoService.queryByPaging(userId, param);
List<MessageInfo> messageInfos = new ArrayList<MessageInfo>();
for(KObject kobject :lists){
messageInfos.add(new MessageInfo(kobject));
}
return messageInfos;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment