|
|
@ -2,12 +2,17 @@ package com.epmet.controller; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.epmet.commons.tools.dto.form.mq.ReceiveMqMsg; |
|
|
|
import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.service.UserPointActionLogService; |
|
|
|
import dto.form.SendPointFormDTO; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.logging.log4j.LogManager; |
|
|
|
import org.apache.logging.log4j.Logger; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
@ -16,7 +21,6 @@ import org.springframework.web.bind.annotation.RestController; |
|
|
|
* |
|
|
|
* @date: 2020/7/21 9:04 |
|
|
|
* @author: jianjun liu |
|
|
|
* email:liujianjun@git.elinkit.com.cn |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@RestController |
|
|
@ -24,6 +28,9 @@ import org.springframework.web.bind.annotation.RestController; |
|
|
|
public class MqPointCallbackController { |
|
|
|
private Logger logger = LogManager.getLogger(MqPointCallbackController.class); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private UserPointActionLogService userPointActionLogService; |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:爱心活动积分发放 |
|
|
|
* |
|
|
@ -38,8 +45,62 @@ public class MqPointCallbackController { |
|
|
|
return "success"; |
|
|
|
} |
|
|
|
SendPointFormDTO formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), SendPointFormDTO.class); |
|
|
|
try { |
|
|
|
//TODO 调用调整积分方法去给用户加减积分 userPointActionLogService.
|
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("activeSendPoint consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg())); |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg()); |
|
|
|
} |
|
|
|
log.info("activeSendPoint consumer success,formDTO:{}", JSON.toJSONString(formDTO)); |
|
|
|
return "success"; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:爱心互助-志愿者注册消息 |
|
|
|
* |
|
|
|
* @param mqMsg |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@RequestMapping("registervolunteer") |
|
|
|
public String registerVolunteer(ReceiveMqMsg mqMsg) { |
|
|
|
log.debug("registerVolunteer receive mqMsg:{}", JSON.toJSONString(mqMsg)); |
|
|
|
if (mqMsg == null || StringUtils.isBlank(mqMsg.getMsg())) { |
|
|
|
log.warn("registerVolunteer mqMsg is empty"); |
|
|
|
return "success"; |
|
|
|
} |
|
|
|
BasePointEventMsg formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), BasePointEventMsg.class); |
|
|
|
try { |
|
|
|
//TODO 调用调整积分方法去给用户加减积分 userPointActionLogService.
|
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("registerVolunteer consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg())); |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg()); |
|
|
|
} |
|
|
|
log.info("registerVolunteer consumer success,formDTO:{}", JSON.toJSONString(formDTO)); |
|
|
|
return "success"; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:爱心互助-发布实况消息 |
|
|
|
* |
|
|
|
* @param mqMsg |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@RequestMapping("pubactivelive") |
|
|
|
public String pubActiveLive(ReceiveMqMsg mqMsg) { |
|
|
|
log.debug("pubActiveLive receive mqMsg:{}", JSON.toJSONString(mqMsg)); |
|
|
|
if (mqMsg == null || StringUtils.isBlank(mqMsg.getMsg())) { |
|
|
|
log.warn("pubActiveLive mqMsg is empty"); |
|
|
|
return "success"; |
|
|
|
} |
|
|
|
BasePointEventMsg formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), BasePointEventMsg.class); |
|
|
|
try { |
|
|
|
//TODO 调用调整积分方法去给用户加减积分 userPointActionLogService.
|
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("pubActiveLive consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg())); |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg()); |
|
|
|
} |
|
|
|
log.info("pubActiveLive consumer success,formDTO:{}", JSON.toJSONString(formDTO)); |
|
|
|
return "success"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|