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,6 +16,7 @@ public class GetStationMsgListReq extends BaseReq {
16 /** 16 /**
17 * 消息类型 17 * 消息类型
18 */ 18 */
  19 +
19 private String groupType; 20 private String groupType;
20 /** 21 /**
21 * 页码 22 * 页码
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/msg/MarkStationMsgReq.java
1 package com.diligrp.mobsite.getway.domain.protocol.msg; 1 package com.diligrp.mobsite.getway.domain.protocol.msg;
2 2
3 import com.diligrp.mobsite.getway.domain.protocol.BaseReq; 3 import com.diligrp.mobsite.getway.domain.protocol.BaseReq;
  4 +import io.swagger.annotations.ApiModelProperty;
4 5
5 /** 6 /**
6 * <B>Description</B> 按类型标识站内信已读(请求)<br /> 7 * <B>Description</B> 按类型标识站内信已读(请求)<br />
@@ -17,7 +18,7 @@ public class MarkStationMsgReq extends BaseReq { @@ -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 public String getGroupType() { 23 public String getGroupType() {
23 return groupType; 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,7 +32,7 @@ public interface StationMsgRPC extends BaseService {
32 * @param userid 32 * @param userid
33 * @return 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,9 +8,9 @@ import com.diligrp.mobsite.getway.domain.except.ServiceException;
8 import com.diligrp.mobsite.getway.domain.protocol.msg.*; 8 import com.diligrp.mobsite.getway.domain.protocol.msg.*;
9 import com.diligrp.mobsite.getway.domain.protocol.msg.model.HomeMsgInfo; 9 import com.diligrp.mobsite.getway.domain.protocol.msg.model.HomeMsgInfo;
10 import com.diligrp.mobsite.getway.domain.protocol.msg.model.StationMsg; 10 import com.diligrp.mobsite.getway.domain.protocol.msg.model.StationMsg;
  11 +import com.diligrp.mobsite.getway.rpc.StationMsgRPC;
11 import com.diligrp.mobsite.getway.rpc.base.BaseOutput; 12 import com.diligrp.mobsite.getway.rpc.base.BaseOutput;
12 import com.diligrp.mobsite.getway.rpc.base.impl.BaseServiceImpl; 13 import com.diligrp.mobsite.getway.rpc.base.impl.BaseServiceImpl;
13 -import com.diligrp.mobsite.getway.rpc.StationMsgRPC;  
14 import com.diligrp.website.util.security.Validator; 14 import com.diligrp.website.util.security.Validator;
15 import org.slf4j.Logger; 15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory; 16 import org.slf4j.LoggerFactory;
@@ -47,6 +47,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC @@ -47,6 +47,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC
47 Map<String,String> params = new HashMap<String, String>(); 47 Map<String,String> params = new HashMap<String, String>();
48 params.put("groupCode", req.getGroupType().toString()); 48 params.put("groupCode", req.getGroupType().toString());
49 params.put("userId", req.getUserId().toString()); 49 params.put("userId", req.getUserId().toString());
  50 + params.put("userRole", req.getUserRole().toString());
50 BaseOutput<String> output = null; 51 BaseOutput<String> output = null;
51 try { 52 try {
52 output = super.httpPost("/messages/readAllByGroup.do", params, null); 53 output = super.httpPost("/messages/readAllByGroup.do", params, null);
@@ -88,6 +89,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC @@ -88,6 +89,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC
88 params.put("currPage", req.getPageNum().toString()); 89 params.put("currPage", req.getPageNum().toString());
89 params.put("pageSize", PAGESIZE); 90 params.put("pageSize", PAGESIZE);
90 params.put("groupCode",req.getGroupType()); 91 params.put("groupCode",req.getGroupType());
  92 + params.put("userRole", req.getUserRole().toString());
91 BaseOutput<String> output = null; 93 BaseOutput<String> output = null;
92 try { 94 try {
93 output = super.httpPost("/messages.do", params, null); 95 output = super.httpPost("/messages.do", params, null);
@@ -179,9 +181,10 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC @@ -179,9 +181,10 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC
179 } 181 }
180 182
181 @Override 183 @Override
182 - public Boolean isMsgRead(Long userid) { 184 + public Boolean isMsgRead(Long userid,String userRole) {
183 Map<String,String> params = new HashMap<String, String>(); 185 Map<String,String> params = new HashMap<String, String>();
184 params.put("userId", userid.toString()); 186 params.put("userId", userid.toString());
  187 + params.put("userRole", userRole);
185 BaseOutput<String> output = null; 188 BaseOutput<String> output = null;
186 try { 189 try {
187 output = super.httpPost("/messages/unRead.do", params, null); 190 output = super.httpPost("/messages/unRead.do", params, null);
@@ -216,6 +219,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC @@ -216,6 +219,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC
216 GetHomeInfoResp resp = new GetHomeInfoResp(); 219 GetHomeInfoResp resp = new GetHomeInfoResp();
217 Map<String,String> params = new HashMap<String, String>(); 220 Map<String,String> params = new HashMap<String, String>();
218 params.put("userId", req.getUserId().toString()); 221 params.put("userId", req.getUserId().toString());
  222 + params.put("userRole", req.getUserRole().toString());
219 BaseOutput<String> output = null; 223 BaseOutput<String> output = null;
220 try { 224 try {
221 output = super.httpPost("/groupedMessage.do", params, null); 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 package com.diligrp.mobsite.getway.service.buyer.user.impl; 1 package com.diligrp.mobsite.getway.service.buyer.user.impl;
2 2
  3 +import com.diligrp.mobsite.getway.domain.common.ResultCode;
3 import com.diligrp.mobsite.getway.domain.protocol.msg.*; 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 import com.diligrp.mobsite.getway.service.buyer.user.StationMsgService; 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 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
6 12
  13 +import java.util.ArrayList;
  14 +import java.util.List;
  15 +
7 /** 16 /**
8 * <B>Description</B> 站内信 <br /> 17 * <B>Description</B> 站内信 <br />
9 * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> 18 * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
@@ -17,25 +26,74 @@ public class StationMsgServiceImpl implements StationMsgService { @@ -17,25 +26,74 @@ public class StationMsgServiceImpl implements StationMsgService {
17 //是否有未读消息 26 //是否有未读消息
18 private static final Integer ISREAD_TRUE = 1 ; 27 private static final Integer ISREAD_TRUE = 1 ;
19 private static final Integer ISREAD_FALSE = 2 ; 28 private static final Integer ISREAD_FALSE = 2 ;
20 - 29 + @Autowired
  30 + StationMsgRPC stationMsgRPC;
21 31
22 @Override 32 @Override
23 public GetStationMsgListResp getStationMsgList(GetStationMsgListReq req) { 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 @Override 42 @Override
28 public MarkStationMsgResp markStationMsg(MarkStationMsgReq req) { 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 @Override 51 @Override
33 public GetHomeInfoResp getHomeInfo(GetHomeInfoReq req) { 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 @Override 91 @Override
38 public GetHomeInfoResp getHomeInfoArray(GetHomeInfoReq req) { 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,7 +38,7 @@
38 <version>2.2</version> 38 <version>2.2</version>
39 <configuration> 39 <configuration>
40 <port>8080</port> 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 <username>gateway</username> 42 <username>gateway</username>
43 <password>123456</password> 43 <password>123456</password>
44 <path>/</path> 44 <path>/</path>
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 <url>http://maven.apache.org</url> 10 <url>http://maven.apache.org</url>
11 <properties> 11 <properties>
12 <spring.version>4.2.8.RELEASE</spring.version> 12 <spring.version>4.2.8.RELEASE</spring.version>
13 - <java.version>1.8</java.version> 13 + <java.version>1.7</java.version>
14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15 </properties> 15 </properties>
16 16