InboxController.java 1.9 KB
package com.yohoufo.inboxclient.controller;

import com.yohobuy.ufo.model.message.SmsMessageReq;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.inboxclient.model.InBoxResponse;
import com.yohoufo.inboxclient.model.InboxReqVO;
import com.yohoufo.inboxclient.sdk.InBoxSDK;
import com.yohoufo.inboxclient.sdk.InBoxSendSmsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by li.ma on 2019/3/19.
 * 供后台调用发站内信
 */
@RequestMapping("/erp")
@RestController
public class InboxController {
    private final Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private InBoxSDK inBoxSDK;

    @Autowired
    private InBoxSendSmsService smsService;

    @RequestMapping(value = "/addInboxForPlatform")
    @IgnoreSession
    @IgnoreSignature
    public String addInboxForPlatform(@RequestBody InboxReqVO reqVO){
        logger.info("InboxController.addInbox with param is {}", reqVO);
        InBoxResponse result = inBoxSDK.addInbox(reqVO);
        logger.info("InboxController.addInbox call result is {}",result);
        return "SUCCESS";
    }


    @RequestMapping(value = "/sendSmsForPlatform")
    @IgnoreSession
    @IgnoreSignature
    public String sendSmsForPlatform(@RequestBody SmsMessageReq smsMessageReq){
        logger.info("InboxController.sendSmsForPlatform with param is {}", smsMessageReq);
        smsService.smsSendByMobile(smsMessageReq.getContent(), smsMessageReq.getMobileList());
        logger.info("InboxController.sendSmsForPlatform call success");
        return "SUCCESS";
    }
}