Browse Source

积分事件修改

master
wangchao 5 years ago
parent
commit
36e325f6e2
  1. 20
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java
  2. 3
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java
  3. 1
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml

20
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java

@ -73,15 +73,19 @@ public class MqPointCallbackController {
log.warn("registerVolunteer mqMsg is empty");
return new Result<Boolean>().ok(true);
}
BasePointEventMsg formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), BasePointEventMsg.class);
List<BasePointEventMsg> formList = JSON.parseArray(mqMsg.getMsg(), BasePointEventMsg.class);
try {
//TODO 调用调整积分方法去给用户加减积分 userPointActionLogService.
userPointActionLogService.grantPointByEvent(EventEnum.REGISTER_VOLUNTEER.getEventTag(),formDTO);
formList.forEach(obj -> {
userPointActionLogService.grantPointByEvent(EventEnum.ACTIVE_INSERT_LIVE.getEventTag(),obj);
});
} catch (Exception e) {
logger.error("registerVolunteer consume fail", e);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg());
}
log.info("registerVolunteer consumer success,formDTO:{}", JSON.toJSONString(formDTO));
log.info("registerVolunteer consumer success,formDTO:{}", JSON.toJSONString(formList));
return new Result<Boolean>().ok(true);
}
@ -98,15 +102,19 @@ public class MqPointCallbackController {
log.warn("pubActiveLive mqMsg is empty");
return new Result<Boolean>().ok(true);
}
BasePointEventMsg formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), BasePointEventMsg.class);
List<BasePointEventMsg> formList = JSON.parseArray(mqMsg.getMsg(), BasePointEventMsg.class);
//BasePointEventMsg formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), BasePointEventMsg.class);
try {
//TODO 调用调整积分方法去给用户加减积分 userPointActionLogService.
userPointActionLogService.grantPointByEvent(EventEnum.ACTIVE_INSERT_LIVE.getEventTag(),formDTO);
formList.forEach(obj -> {
userPointActionLogService.grantPointByEvent(EventEnum.ACTIVE_INSERT_LIVE.getEventTag(),obj);
});
} catch (Exception e) {
logger.error("pubActiveLive consume fail", e);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg());
}
log.info("pubActiveLive consumer success,formDTO:{}", JSON.toJSONString(formDTO));
log.info("pubActiveLive consumer success,formDTO:{}", JSON.toJSONString(formList));
return new Result<Boolean>().ok(true);
}
}

3
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java

@ -175,9 +175,10 @@ public class UserPointTotalServiceImpl extends BaseServiceImpl<UserPointTotalDao
Optional<ResiPointRankResultDTO> opt = rankList.stream().filter(obj -> StringUtils.equals(obj.getUserId(), pointRankFormDTO.getUserId())).findFirst();
if(opt.isPresent()){
myself = opt.get();
o.setMyPoint(myself.getTotalPoint());
o.setMyPoint(null == myself.getTotalPoint() ? NumConstant.ZERO : myself.getTotalPoint());
o.setMyRanking(myself.getRank());
} else {
o.setMyPoint(NumConstant.ZERO);
if (rankList.get(rankList.size() - NumConstant.ONE).getTotalPoint() > NumConstant.ZERO) {
o.setMyRanking(rankList.get(rankList.size() - NumConstant.ONE).getRank() + NumConstant.ONE);
} else {

1
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml

@ -42,6 +42,7 @@
FROM point_rule
WHERE
DEL_FLAG = '0'
AND
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND EVENT_CODE = #{eventCode,jdbcType=VARCHAR}
</select>
</mapper>
Loading…
Cancel
Save