Browse Source

积分bug修改

feature/syp_points
songyunpeng 5 years ago
parent
commit
178e4fd465
  1. 2
      esua-epdc/epdc-commons/epdc-commons-points-tools/src/main/java/com/elink/esua/epdc/pointcommons/tools/rocketmq/producer/PointsProducer.java
  2. 5
      esua-epdc/epdc-module/epdc-points/epdc-points-client/src/main/java/com/elink/esua/epdc/dto/result/PointsStatisticsListResultDTO.java
  3. 2
      esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/mq/PointsModifyConsumer.java
  4. 13
      esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/mapper/PointsLogsDao.xml

2
esua-epdc/epdc-commons/epdc-commons-points-tools/src/main/java/com/elink/esua/epdc/pointcommons/tools/rocketmq/producer/PointsProducer.java

@ -31,7 +31,7 @@ public class PointsProducer {
public void sendMessage(String topic, String tag, String keys, String body) {
Message message = new Message(topic, tag, keys, body.getBytes());
try {
SendResult sendResult = rocketMQTemplate.getProducer().send(message);
SendResult sendResult = rocketMQTemplate.getProducer().send(message,10000L);
log.info("积分埋点发送消息结果:{sendStatus:{}, topic:{}, msgId:{}}", sendResult.getSendStatus(), topic, sendResult.getMsgId());
} catch (Exception e) {
log.error("积分埋点发送消息异常:{topic:{}, tag:{}, keys:{}, body:{}}", topic, tag, keys, body);

5
esua-epdc/epdc-module/epdc-points/epdc-points-client/src/main/java/com/elink/esua/epdc/dto/result/PointsStatisticsListResultDTO.java

@ -13,6 +13,11 @@ public class PointsStatisticsListResultDTO implements Serializable {
*/
private int allPoints;
/**
* 积分操作类型
*/
private int pointsType;
/**
* 消耗积分
*/

2
esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/java/com/elink/esua/epdc/mq/PointsModifyConsumer.java

@ -130,7 +130,7 @@ public class PointsModifyConsumer implements RocketMQListener<MessageExt> {
}
//2.赋值积分规则的上限期限(小时,年。。。。)
pointsLogsFormDTO.setOperationFlag(pointsRuleResultDTO.getLimitType());
//3.获取前一分钟的总分
//3.获取时间段内的总分
Integer total = pointsLogsService.getPointsSumByBehaviorCodeAndUserId(pointsLogsFormDTO);
//判断总分是否超过上限
if (total != null) {

13
esua-epdc/epdc-module/epdc-points/epdc-points-server/src/main/resources/mapper/PointsLogsDao.xml

@ -52,7 +52,7 @@
case when OPERATION_TYPE =0 then sum(POINTS) else 0 end as f,
case when OPERATION_TYPE =1 then sum(POINTS) else 0 end as z,
BEHAVIOR_CODE
from epdc_points_logs where USER_ID = #{userId} and BEHAVIOR_CODE = #{behaviorCode}
from epdc_points_logs where USER_ID = #{userId} and RULE_CODE = #{ruleCode}
<if test="operationFlag == 0">
and OPERATION_TIME between date_add(now() , interval -1 minute ) and now()
</if>
@ -183,9 +183,8 @@
<select id="selectPointsList" resultType="com.elink.esua.epdc.dto.result.PointsStatisticsListResultDTO">
SELECT
SUM(
IF( lg.OPERATION_TYPE = '1', lg.POINTS, 0 )
) allPoints,
SUM(lg.POINTS) allPoints,
lg.OPERATION_TYPE as pointsType,
SUM(
IF( lg.OPERATION_TYPE = '0', lg.POINTS, 0 )
) residuePoints,
@ -194,15 +193,15 @@
epdc_points_logs lg
WHERE
lg.DEL_FLAG = '0'
<if test="ruleCode!= null and ruleCode !=''">
and lg.RULE_CODE = #{ruleCode}
<if test="behaviorCode!= null and behaviorCode !=''">
and lg.BEHAVIOR_CODE = #{behaviorCode}
</if>
<if test="startTime!= null and startTime !=''">
and lg.OPERATION_TIME between #{startTime} AND #{endTime}
</if>
GROUP BY
lg.RULE_CODE
lg.OPERATION_TYPE,lg.BEHAVIOR_CODE
ORDER BY allPoints DESC
</select>

Loading…
Cancel
Save