48c56ece155f7f70dc281c89e42f7b60b592e749.svn-base 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package cn.com.goldenwater.dcproj.controller.util;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.constValue.CommonLabel;
  5. import cn.com.goldenwater.dcproj.model.WeiXinMsg;
  6. import cn.com.goldenwater.dcproj.service.impl.RedisDataCenterReceiver;
  7. import cn.com.goldenwater.dcproj.utils.RedisOperator;
  8. import com.alibaba.fastjson.JSON;
  9. import io.swagger.annotations.Api;
  10. import net.sf.json.JSONObject;
  11. import org.slf4j.Logger;
  12. import org.slf4j.LoggerFactory;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.data.redis.core.RedisTemplate;
  15. import org.springframework.stereotype.Controller;
  16. import org.springframework.web.bind.annotation.*;
  17. @Api(value = "webSocket相关接口", tags = "webSocket相关接口")
  18. @RestController
  19. @RequestMapping("/wx/call/back")
  20. public class WeiXinRecvController extends BaseController {
  21. @Autowired
  22. private RedisTemplate redisTemplate;
  23. protected static final Logger LOGGER = LoggerFactory.getLogger(RedisDataCenterReceiver.class);
  24. @RequestMapping(value = "", method = RequestMethod.POST)
  25. public BaseResponse<WeiXinMsg> recvMsg(@RequestBody WeiXinMsg weiXinMsg) {
  26. //JSONObject jsonObject = JSONObject.fromObject(weiXinMsg);
  27. redisTemplate.convertAndSend(CommonLabel.SEND_TO_WEI_XIN, JSON.toJSONString(weiXinMsg));
  28. //LOGGER.info(jsonObject.toString());
  29. return buildSuccessResponse(weiXinMsg);
  30. }
  31. }