发表于: 2017-10-17 21:49:46

1 691


一.今天完成的主要事情

1.完成精品推荐story,

该story共包括5个接口,分别是

今天完成了查询用户消息详情接口和查询用户消息列表接口

查询用户消息列表接口如图:

/**
* 12.查询用户消息
*
* @param
* @return
* @throws ServiceException
* @throws ServiceDaoException
*/

@RequestMapping(value = "/a/u/message/list ", method = RequestMethod.GET)
public String getUserMessage(HttpServletRequest request,
HttpServletResponse response, ModelMap model, Integer page,
Integer size, Long uid) throws Exception {

log.info("getUserMessage() parameter: userId : " + uid);
if (page == null) {
page = 1;
}
if (size == null) {
size = 10;
}
int start = (page - 1) * size;
if (start < 0) {
start = 0;
}
log.info("pageList : page= " + start + " , size=" + size);
if (DataUtils.isNullOrEmpty(uid)){
log.info("Parameter uid can not be NULL!");
model.addAttribute("code", -1000);
return "/common/failure";
}
List<Long> userIds = new ArrayList<Long>();
//加入公告消息
   userIds.add(-1L);

Integer recipient;
Map<String, Object> map;
List<Long> messageIds;
List<Message> messages = null;
try{
User user = userService.getObjectById(uid);
log.info("get user data : " + user);
if (DataUtils.isNullOrEmpty(user)){
log.info("Data user can not be NULL!");
model.addAttribute("code", -4);
return "/common/failure";
}
userIds.add(uid);
log.info("get uids: " + userIds);


Integer verification = user.getVerification();
log.info("get field verification from user, verification is :" + verification);
if (DataUtils.isNullOrEmpty(verification)){
log.info("Field verification can not be NULL!");
model.addAttribute("code", -4);
return "/common/failure";
}
if (verification == 0){
recipient = 1;
} else if(verification == 1){
recipient = 2;
} else {
model.addAttribute("code", -40003);
return "/common/failure";
}
log.info("Parameter recipient, recipient: " + recipient);
map = DynamicUtil.getMessageListByUserIdsAndRecipient(userIds, recipient, 1);
log.info("map is:" + map);

messageIds = messageService.getIdsByDynamicCondition(Message.class, map, start, size);
log.info("get messageIds : " + messageIds);
if (CollectionUtils.isNotEmpty(messageIds)){
messages = messageService.getObjectsByIds(messageIds);
log.info("get message data id: " + messages.size());
}

Integer autoTotal = messageService.countMessageIdsByUserId(uid);
Integer publicTotal = messageService.countMessageIdsByTypeAndStatusAndRecipient(1, 1, recipient);
Integer total = autoTotal + publicTotal;
log.info("get message total is " + total);

model.addAttribute("code", 0);
model.addAttribute("total", total);
model.addAttribute("messageList", messages);

} catch (Throwable t){
t.printStackTrace();
log.error(t.getMessage());
log.error("get message list error,page is  " + start + " , size "
               + size);
model.addAttribute("code", -1);
}

return "/polyFinance-business-service/message/json/messageListJson";
}

如此之外,开始了【我的】story,今天完成了更新用户信息接口的编写

二.明天计划完成的主要事情

1.继续编写【我的】story,包括身份验证接口,查询用户详细信息接口等

2.准备小课堂

三.遇到的问题

对于日志怎么打,打什么内容,没有直观的概念掌握的不是很清楚

百度了一波,说是要按照级别,还有内容要具体,要能够快速定位问题等,

解决方案是明天选这个方面的小课堂题目,准备小课堂的过程中学习

四.收获

以上

五.项目进度情况

有延期风险



返回列表 返回列表
评论

    分享到