Commit ae59b9a3d030eb8853dae79951134c0822be7952

Authored by landong2015
1 parent ba1966a273
Exists in master

获取消息的时候,可以获取一个时间范围内的信息

Showing 3 changed files with 9 additions and 10 deletions

mainData/src/main/resources/mainOrm/YmNotifications.xml View file @ ae59b9a
... ... @@ -82,7 +82,7 @@
82 82 and content = #{content,jdbcType=VARCHAR}
83 83 </if>
84 84 <if test="created != null">
85   -and created = #{created,jdbcType=TIMESTAMP}
  85 +and created >= #{created,jdbcType=TIMESTAMP}
86 86 </if>
87 87 <if test="yn != null and yn >= 0">
88 88 and yn = #{yn,jdbcType=INTEGER}
mainData/src/main/resources/mainOrm/YmPushMessages.xml View file @ ae59b9a
... ... @@ -74,7 +74,7 @@
74 74 and content = #{content,jdbcType=VARCHAR}
75 75 </if>
76 76 <if test="created != null">
77   -and created = #{created,jdbcType=TIMESTAMP}
  77 +and created >= #{created,jdbcType=TIMESTAMP}
78 78 </if>
79 79 <if test="receptionId != null and receptionId >= 0">
80 80 and reception_id = #{receptionId,jdbcType=INTEGER}
webApi/src/main/java/com/lyms/yimiao/web/controller/v1/NotificationsController.java View file @ ae59b9a
... ... @@ -44,15 +44,14 @@
44 44 @RequestMapping(value = "/notifications", method = RequestMethod.GET)
45 45 @TokenRequired
46 46 public void getNotifications(HttpServletResponse response,
47   - HttpServletRequest request
48   -// , @RequestParam(value = "time",required = false) long time
49   - ){
  47 + HttpServletRequest request,
  48 + @RequestParam("time") long time){
50 49 //系统消息
51 50 YmNotificationsQuery notificationsQuery = new YmNotificationsQuery();
52 51 notificationsQuery.setYn(YnEnum.yes.getId());
53 52 notificationsQuery.setSort("created desc");
54 53  
55   -// notificationsQuery.setCreated(new Date(time*1000));
  54 + notificationsQuery.setCreated(new Date(time*1000));
56 55 List<YmNotifications> notificationsList = notificationsService.queryYmNotifications(notificationsQuery);
57 56  
58 57 List<Map> list = new ArrayList<>();
... ... @@ -69,8 +68,8 @@
69 68 }
70 69  
71 70 //接种通知
72   - List inculateList = getInculateList(request);
73   -// List inculateList = getInculateList(request,time);
  71 +// List inculateList = getInculateList(request);
  72 + List inculateList = getInculateList(request,time);
74 73 if (CollectionUtils.isNotEmpty(inculateList)){
75 74 list.addAll(inculateList);
76 75 }
... ... @@ -96,7 +95,7 @@
96 95 ResultUtils.buildSuccessResultAndWrite(response,list);
97 96 }
98 97  
99   - private List getInculateList(HttpServletRequest request) {
  98 + private List getInculateList(HttpServletRequest request,long time) {
100 99 List<Map> dataList = new ArrayList<>();
101 100  
102 101 LoginContext loginContext = (LoginContext) request.getAttribute("loginContext");
... ... @@ -104,7 +103,7 @@
104 103 YmPushMessagesQuery query = new YmPushMessagesQuery();
105 104 query.setYn(YnEnum.yes.getId());
106 105 query.setReceptionId(loginContext.getId());
107   -// query.setCreated(new Date(time * 1000));
  106 + query.setCreated(new Date(time * 1000));
108 107 List<YmPushMessages> messagesList = ymPushMessagesService.queryYmPushMessages(query);
109 108 if (CollectionUtils.isNotEmpty(messagesList)){
110 109 for (YmPushMessages data : messagesList){