Authored by mali

发站内信接口

  1 +package com.yoho.ufo.service.impl;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.yoho.core.rest.client.ServiceCaller;
  5 +import com.yoho.ufo.service.model.InboxReqVO;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Service;
  10 +import org.springframework.web.bind.annotation.RequestBody;
  11 +
  12 +/**
  13 + * Created by li.ma on 2019/3/19.
  14 + */
  15 +@Service
  16 +public class InboxServiceImpl {
  17 + private static final Logger LOGGER = LoggerFactory.getLogger(InboxServiceImpl.class);
  18 + @Autowired
  19 + private ServiceCaller serviceCaller;
  20 +
  21 + public void addInboxForPlatform(int uid, Integer type, Integer businessType, String params){
  22 + InboxReqVO reqVO = InboxReqVO.builder().businessType(businessType).params(params).type(type).uid(uid).build();
  23 +
  24 + LOGGER.info("addInboxForPlatform.addInbox with reqVO is {}", reqVO);
  25 +
  26 + JSONObject jsonObject = serviceCaller.asyncCall("ufo-gateway.addInboxForPlatform", reqVO, JSONObject.class).get();
  27 +
  28 + LOGGER.info("addInboxForPlatform.addInbox call result is {}", jsonObject);
  29 + }
  30 +}
  1 +package com.yoho.ufo.service.model;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import lombok.experimental.Builder;
  5 +
  6 +/**
  7 + * Created by shengguo.cai on 2018/9/12.
  8 + */
  9 +@Builder
  10 +public class InboxReqVO{
  11 + private int uid;
  12 + private Integer type;
  13 + private Integer businessType;
  14 + private String params;
  15 +
  16 + public String getParams() {
  17 + return params;
  18 + }
  19 +
  20 + public void setParams(String params) {
  21 + this.params = params;
  22 + }
  23 +
  24 + public Integer getType() {
  25 + return type;
  26 + }
  27 +
  28 + public void setType(Integer type) {
  29 + this.type = type;
  30 + }
  31 +
  32 + public int getUid() {
  33 + return uid;
  34 + }
  35 +
  36 + public void setUid(int uid) {
  37 + this.uid = uid;
  38 + }
  39 +
  40 + public Integer getBusinessType() {
  41 + return businessType;
  42 + }
  43 +
  44 + public void setBusinessType(Integer businessType) {
  45 + this.businessType = businessType;
  46 + }
  47 +
  48 + @Override
  49 + public String toString() {
  50 + return JSONObject.toJSONString(this);
  51 + }
  52 +}