anderx пре 7 година
родитељ
комит
9fb064deb0

+ 26 - 1
src/main/java/com/goafanti/app/controller/AppUserController.java

@@ -824,5 +824,30 @@ public class AppUserController extends CertifyApiController {
 			result.setData(userIdentityService.appMyInterestedExpert(type,pageNo,pageSize));
 		return result;
 	}
-	
+	/**
+	 * 消息列表
+	 */
+	@RequestMapping(value="/applistMessage",method=RequestMethod.GET)
+	public Result applistMessage(Integer pageNo,Integer pageSize){
+		Result result=new Result();
+//		if(StringUtils.isBlank(TokenManager.getUserId())) {
+//			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
+//			return result;
+//		}
+		result.setData(messageService.applistMessage(pageNo,pageSize));
+		return result;
+	}
+	/**
+	 * 读取消息
+	 */
+	@RequestMapping(value="/appReadMessage",method=RequestMethod.GET)
+	public Result appReadMessage(String id){
+		Result result=new Result();
+		if(StringUtils.isBlank(id)) {
+			result.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "消息ID错误"));
+			return result;
+		}
+		result.setData(messageService.appReadMessage(id));
+		return result;
+	}
 }

+ 17 - 0
src/main/java/com/goafanti/common/mapper/MessageFromSystemMapper.xml

@@ -693,4 +693,21 @@
 				and b.resource_type = #{resourceType,jdbcType=INTEGER}
 			</if>
    </select>
+   <select id="appMessageList" resultType="com.goafanti.message.bo.MessageListBo">
+   select a.id as cid,b.title,b.create_time as createTime from jt_message_consumer a
+	left join jt_message_producer b on a.message_id=b.id
+	<if test="uid !=null and uid !=''">
+	where a.aid=#{uid,jdbcType=VARCHAR}
+	</if>
+   <if test="page_sql!=null">
+				${page_sql}
+			</if>
+   </select>
+   <select id="appMessageCount" resultType="java.lang.Integer">
+   select count(*) from jt_message_consumer a
+	left join jt_message_producer b on a.message_id=b.id
+	<if test="uid !=null and uid !=''">
+	where a.aid=#{uid,jdbcType=VARCHAR}
+	</if>
+   </select>
 </mapper>

+ 7 - 0
src/main/java/com/goafanti/message/bo/MessageListBo.java

@@ -1,6 +1,7 @@
 package com.goafanti.message.bo;
 
 public class MessageListBo {
+	private String cid;
 	private String messageId;
 	private String title;
 	private String body;
@@ -78,4 +79,10 @@ public class MessageListBo {
 	public void setIsRead(String isRead) {
 		this.isRead = isRead;
 	}
+	public String getCid() {
+		return cid;
+	}
+	public void setCid(String cid) {
+		this.cid = cid;
+	}
 }

+ 17 - 0
src/main/java/com/goafanti/message/service/MessageService.java

@@ -6,6 +6,7 @@ import java.util.Map;
 
 import com.goafanti.app.bo.IndexBo;
 import com.goafanti.common.model.JpushEasemobAccount;
+import com.goafanti.common.model.JtMessageProducer;
 import com.goafanti.common.model.MessageConsumer;
 import com.goafanti.common.model.MessageFromSystem;
 import com.goafanti.common.model.MessageProducer;
@@ -159,4 +160,20 @@ public interface MessageService {
 	 * @return
 	 */
 	JpushEasemobAccount selectSynAccByUid(String uid);
+	/**
+	 * 新增系统消息
+	 * @param messageProducer
+	 * @return
+	 */
+	int addMessage(JtMessageProducer messageProducer);
+	
+	/**
+	 * 系统向注册用户发送信息
+	 * @param messageId
+	 * @return
+	 */
+	int sendMessage(String messageId);
+	
+	Pagination<MessageListBo> applistMessage(Integer pageNo, Integer pageSize);
+	MessageListBo appReadMessage(String id);
 }

+ 40 - 0
src/main/java/com/goafanti/message/service/impl/MessageServiceImpl.java

@@ -16,10 +16,13 @@ import org.springframework.transaction.annotation.Transactional;
 
 import com.goafanti.app.bo.IndexBo;
 import com.goafanti.common.dao.JpushEasemobAccountMapper;
+import com.goafanti.common.dao.JtMessageConsumerMapper;
 import com.goafanti.common.dao.MessageFromSystemMapper;
 import com.goafanti.common.dao.MessageProducerMapper;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.JpushEasemobAccount;
+import com.goafanti.common.model.JtMessageConsumer;
+import com.goafanti.common.model.JtMessageProducer;
 import com.goafanti.common.model.MessageConsumer;
 import com.goafanti.common.model.MessageFromSystem;
 import com.goafanti.common.model.MessageProducer;
@@ -45,6 +48,8 @@ public class MessageServiceImpl  extends BaseMybatisDao<MessageFromSystemMapper>
 	private JpushEasemobAccountMapper jpushEasemobAccountMapper;
 	@Autowired
 	private JGMessageHelper jgMessageHelper;
+	@Autowired
+	private JtMessageConsumerMapper	jtMessageConsumerMapper;
 	@Override
 	public String selectSendUser(Map<Integer, String> selectMap,Integer type) {
 		if(selectMap.containsKey(ConsumerType.PERSON_CUSTOMER_RETAIL.getTypeCode())){ //客户散户
@@ -429,4 +434,39 @@ public class MessageServiceImpl  extends BaseMybatisDao<MessageFromSystemMapper>
 		return jpushEasemobAccountMapper.insert(jea);
 	}
 
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<MessageListBo> applistMessage(Integer pageNo, Integer pageSize) {
+		Map<String,Object> params = new HashMap<String,Object>();
+		if(null==pageNo||pageNo<0)pageNo=1;
+		if(null==pageSize||pageSize<0)pageNo=10;
+		params.put("uid", TokenManager.getUserId());
+		params.put("uid", "2160baeb-8ea4-4192-a6f4-fccf8738e248");
+		return (Pagination<MessageListBo>)findPage("appMessageList", "appMessageCount", params, pageNo, pageSize);
+	}
+
+	@Override
+	public MessageListBo appReadMessage(String id) {
+		JtMessageConsumer mc=new JtMessageConsumer();
+		mc.setId(id);
+		mc.setIsRead((byte)1);
+		jtMessageConsumerMapper.updateByPrimaryKeySelective(mc);
+		
+		return null;
+	}
+
+	@Override
+	public int addMessage(JtMessageProducer messageProducer) {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	@Override
+	public int sendMessage(String messageId) {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	
+
 }

+ 2 - 2
src/main/resources/props/config_local.properties

@@ -1,7 +1,7 @@
 #Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #\u6570\u636e\u5e93\u94fe\u63a5\uff0c
-jdbc.url=jdbc:mysql://192.168.1.102:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.url=jdbc:mysql://192.168.0.17:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 #\u5e10\u53f7
 jdbc.username=dev
 #\u5bc6\u7801
@@ -40,7 +40,7 @@ jdbc.filters=stat
 
 logging.level.com.goafanti=DEBUG
 
-jedis.host=192.168.1.102
+jedis.host=192.168.0.17
 jedis.port=6379
 jedis.timeout=5000
 jedis.password=aft123456