Commit 08afc86922bf042461b2822d4578bc566d82ac22

Authored by weiliwhereareyou@163.com
1 parent 24c4f801

站内信接口

mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/msg/GetStationMsgListReq.java
... ... @@ -16,6 +16,7 @@ public class GetStationMsgListReq extends BaseReq {
16 16 /**
17 17 * 消息类型
18 18 */
  19 +
19 20 private String groupType;
20 21 /**
21 22 * 页码
... ...
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/msg/MarkStationMsgReq.java
1 1 package com.diligrp.mobsite.getway.domain.protocol.msg;
2 2  
3 3 import com.diligrp.mobsite.getway.domain.protocol.BaseReq;
  4 +import io.swagger.annotations.ApiModelProperty;
4 5  
5 6 /**
6 7 * <B>Description</B> 按类型标识站内信已读(请求)<br />
... ... @@ -17,7 +18,7 @@ public class MarkStationMsgReq extends BaseReq {
17 18 /**
18 19 * 消息类型
19 20 */
20   - private String groupType ;
  21 + private String groupType;
21 22  
22 23 public String getGroupType() {
23 24 return groupType;
... ...
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/StationMsgRPC.java
... ... @@ -32,7 +32,7 @@ public interface StationMsgRPC extends BaseService {
32 32 * @param userid
33 33 * @return
34 34 */
35   - Boolean isMsgRead(Long userid);
  35 + Boolean isMsgRead(Long userid,String userRole);
36 36  
37 37 /**
38 38 * 查询未读站内消息
... ...
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/StationMsgRPCImpl.java
... ... @@ -8,9 +8,9 @@ import com.diligrp.mobsite.getway.domain.except.ServiceException;
8 8 import com.diligrp.mobsite.getway.domain.protocol.msg.*;
9 9 import com.diligrp.mobsite.getway.domain.protocol.msg.model.HomeMsgInfo;
10 10 import com.diligrp.mobsite.getway.domain.protocol.msg.model.StationMsg;
  11 +import com.diligrp.mobsite.getway.rpc.StationMsgRPC;
11 12 import com.diligrp.mobsite.getway.rpc.base.BaseOutput;
12 13 import com.diligrp.mobsite.getway.rpc.base.impl.BaseServiceImpl;
13   -import com.diligrp.mobsite.getway.rpc.StationMsgRPC;
14 14 import com.diligrp.website.util.security.Validator;
15 15 import org.slf4j.Logger;
16 16 import org.slf4j.LoggerFactory;
... ... @@ -47,6 +47,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC
47 47 Map<String,String> params = new HashMap<String, String>();
48 48 params.put("groupCode", req.getGroupType().toString());
49 49 params.put("userId", req.getUserId().toString());
  50 + params.put("userRole", req.getUserRole().toString());
50 51 BaseOutput<String> output = null;
51 52 try {
52 53 output = super.httpPost("/messages/readAllByGroup.do", params, null);
... ... @@ -88,6 +89,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC
88 89 params.put("currPage", req.getPageNum().toString());
89 90 params.put("pageSize", PAGESIZE);
90 91 params.put("groupCode",req.getGroupType());
  92 + params.put("userRole", req.getUserRole().toString());
91 93 BaseOutput<String> output = null;
92 94 try {
93 95 output = super.httpPost("/messages.do", params, null);
... ... @@ -179,9 +181,10 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC
179 181 }
180 182  
181 183 @Override
182   - public Boolean isMsgRead(Long userid) {
  184 + public Boolean isMsgRead(Long userid,String userRole) {
183 185 Map<String,String> params = new HashMap<String, String>();
184 186 params.put("userId", userid.toString());
  187 + params.put("userRole", userRole);
185 188 BaseOutput<String> output = null;
186 189 try {
187 190 output = super.httpPost("/messages/unRead.do", params, null);
... ... @@ -216,6 +219,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC
216 219 GetHomeInfoResp resp = new GetHomeInfoResp();
217 220 Map<String,String> params = new HashMap<String, String>();
218 221 params.put("userId", req.getUserId().toString());
  222 + params.put("userRole", req.getUserRole().toString());
219 223 BaseOutput<String> output = null;
220 224 try {
221 225 output = super.httpPost("/groupedMessage.do", params, null);
... ...
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/impl/StationMsgServiceImpl.java
1 1 package com.diligrp.mobsite.getway.service.buyer.user.impl;
2 2  
  3 +import com.diligrp.mobsite.getway.domain.common.ResultCode;
3 4 import com.diligrp.mobsite.getway.domain.protocol.msg.*;
  5 +import com.diligrp.mobsite.getway.domain.protocol.msg.model.HomeMsgInfo;
  6 +import com.diligrp.mobsite.getway.domain.protocol.msg.model.StationMsg;
  7 +import com.diligrp.mobsite.getway.rpc.StationMsgRPC;
4 8 import com.diligrp.mobsite.getway.service.buyer.user.StationMsgService;
  9 +import com.diligrp.website.util.security.Validator;
  10 +import org.springframework.beans.factory.annotation.Autowired;
5 11 import org.springframework.stereotype.Service;
6 12  
  13 +import java.util.ArrayList;
  14 +import java.util.List;
  15 +
7 16 /**
8 17 * <B>Description</B> 站内信 <br />
9 18 * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
... ... @@ -17,25 +26,74 @@ public class StationMsgServiceImpl implements StationMsgService {
17 26 //是否有未读消息
18 27 private static final Integer ISREAD_TRUE = 1 ;
19 28 private static final Integer ISREAD_FALSE = 2 ;
20   -
  29 + @Autowired
  30 + StationMsgRPC stationMsgRPC;
21 31  
22 32 @Override
23 33 public GetStationMsgListResp getStationMsgList(GetStationMsgListReq req) {
24   - return null;
  34 + GetStationMsgListResp msglistResp = new GetStationMsgListResp();
  35 +
  36 + msglistResp = stationMsgRPC.getMsgList(req);
  37 +
  38 +
  39 + return msglistResp;
25 40 }
26 41  
27 42 @Override
28 43 public MarkStationMsgResp markStationMsg(MarkStationMsgReq req) {
29   - return null;
  44 +
  45 + MarkStationMsgResp markResp = new MarkStationMsgResp();
  46 + markResp = stationMsgRPC.markMsgByGroup(req);
  47 +
  48 + return markResp;
30 49 }
31 50  
32 51 @Override
33 52 public GetHomeInfoResp getHomeInfo(GetHomeInfoReq req) {
34   - return null;
  53 +
  54 + GetHomeInfoResp homeInfoResp = new GetHomeInfoResp();
  55 +
  56 + //获取相关系统消息信息
  57 + GetStationMsgListResp msglistResp = new GetStationMsgListResp();
  58 + GetStationMsgListReq listReq = new GetStationMsgListReq();
  59 + listReq.setPageNum(1);
  60 + listReq.setUserId(req.getUserId());
  61 + msglistResp = stationMsgRPC.getMsgList(listReq);
  62 + Boolean isread = stationMsgRPC.isMsgRead(req.getUserId(),req.getUserRole().toString());
  63 +
  64 + if (!Validator.isNull(msglistResp)
  65 + && !Validator.isEmpty(msglistResp.getMessages())) {
  66 + List<HomeMsgInfo> homeMsgInfos = new ArrayList<HomeMsgInfo>();
  67 + HomeMsgInfo homeMsgInfo = new HomeMsgInfo();
  68 + StationMsg stationMsg = msglistResp.getMessages().get(0);
  69 + homeMsgInfo.setContent(stationMsg.getContent());
  70 + homeMsgInfo.setContentTitle(stationMsg.getSecondCategoryName());
  71 + homeMsgInfo.setGroupName(stationMsg.getGroupName());
  72 + homeMsgInfo.setGroupType(stationMsg.getGroupCode());
  73 + if (isread) {
  74 + homeMsgInfo.setIsRead(ISREAD_TRUE);
  75 + }else {
  76 + homeMsgInfo.setIsRead(ISREAD_FALSE);
  77 + }
  78 + homeMsgInfo.setTime(stationMsg.getTime());
  79 + homeMsgInfos.add(homeMsgInfo);
  80 + homeInfoResp.setTcpMessages(homeMsgInfos);
  81 + homeInfoResp.setCode(ResultCode.SUCCESS);
  82 + homeInfoResp.setMsg("获取成功");
  83 + }else {
  84 + homeInfoResp.setCode(msglistResp.getCode());
  85 + homeInfoResp.setMsg(msglistResp.getMsg());
  86 + }
  87 +
  88 + return homeInfoResp;
35 89 }
36 90  
37 91 @Override
38 92 public GetHomeInfoResp getHomeInfoArray(GetHomeInfoReq req) {
39   - return null;
  93 +
  94 + GetHomeInfoResp getHomeInfoResp = new GetHomeInfoResp();
  95 +
  96 + getHomeInfoResp = stationMsgRPC.getHomeInfo(req);
  97 + return getHomeInfoResp;
40 98 }
41 99 }
... ...
mobsite-getway-web/pom.xml
... ... @@ -38,7 +38,7 @@
38 38 <version>2.2</version>
39 39 <configuration>
40 40 <port>8080</port>
41   - <url>http://10.28.11.181:8080/manager</url>
  41 + <url>http://10.28.11.181:80/manager</url>
42 42 <username>gateway</username>
43 43 <password>123456</password>
44 44 <path>/</path>
... ...
... ... @@ -10,7 +10,7 @@
10 10 <url>http://maven.apache.org</url>
11 11 <properties>
12 12 <spring.version>4.2.8.RELEASE</spring.version>
13   - <java.version>1.8</java.version>
  13 + <java.version>1.7</java.version>
14 14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15 15 </properties>
16 16  
... ...