Browse Source

积分bug修改

dev_shibei_match
wangchao 5 years ago
parent
commit
c9a68a2154
  1. 2
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java
  2. 4
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java
  3. 5
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java
  4. 2
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml
  5. 2
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml
  6. 30
      epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java

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

@ -77,7 +77,7 @@ public class MqPointCallbackController {
try { try {
//TODO 调用调整积分方法去给用户加减积分 userPointActionLogService. //TODO 调用调整积分方法去给用户加减积分 userPointActionLogService.
formList.forEach(obj -> { formList.forEach(obj -> {
userPointActionLogService.grantPointByEvent(EventEnum.ACTIVE_INSERT_LIVE.getEventTag(),obj); userPointActionLogService.grantPointByEvent(EventEnum.REGISTER_VOLUNTEER.getEventTag(),obj);
}); });

4
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java

@ -361,8 +361,8 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
action.setCustomerId(grantPoint.getCustomerId()); action.setCustomerId(grantPoint.getCustomerId());
action.setPoint(grantPoint.getPoint()); action.setPoint(grantPoint.getPoint());
action.setEventStatement(grantPoint.getRemark()); action.setEventStatement(grantPoint.getRemark());
action.setEventName(EventEnum.ACTIVE_SEND_POINT.getEventDesc()); action.setEventName(ModuleConstant.EVENT_NAME_PARTICIPATED_ACT);
action.setEventId(ModuleConstant.COMMON_EVENT_ID); action.setEventId(EventEnum.ACTIVE_SEND_POINT.getEventTag());
action.setActionFlag(grantPoint.getActionFlag()); action.setActionFlag(grantPoint.getActionFlag());
action.setUserId(grantPoint.getUserId()); action.setUserId(grantPoint.getUserId());
action.setCreatedBy(grantPoint.getOperatorId()); action.setCreatedBy(grantPoint.getOperatorId());

5
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java

@ -121,8 +121,5 @@ public interface ModuleConstant extends Constant {
String EVENT_NAME_ADD_LIVE = "添加活动实况"; String EVENT_NAME_ADD_LIVE = "添加活动实况";
/**
* 通用事件不走规则但也是事件所以在用户积分行为记录表中的eventId中要有值与积分调整积分兑换分开
* */
String COMMON_EVENT_ID = "COMMON";
} }

2
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml

@ -26,7 +26,7 @@
<select id="selectPointActionLogList" resultType="com.epmet.dto.result.ResiPointLogPeriodResultDTO"> <select id="selectPointActionLogList" resultType="com.epmet.dto.result.ResiPointLogPeriodResultDTO">
SELECT SELECT
EVENT_NAME AS TITLE, EVENT_NAME AS TITLE,
EVENT_STATEMENT AS REMARK, IFNULL(EVENT_STATEMENT,'') AS REMARK,
CASE ACTION_FLAG WHEN 'plus' THEN concat('+',POINT) ELSE POINT END AS point, CASE ACTION_FLAG WHEN 'plus' THEN concat('+',POINT) ELSE POINT END AS point,
DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') AS DATE, DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') AS DATE,
DATE_FORMAT(CREATED_TIME,'%H:%i') AS TIME DATE_FORMAT(CREATED_TIME,'%H:%i') AS TIME

2
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml

@ -40,7 +40,7 @@
point.total_point, point.total_point,
@point := point.total_point @point := point.total_point
FROM FROM
( SELECT * FROM user_point_total ORDER BY total_point DESC ) point, ( SELECT * FROM user_point_total WHERE CUSTOMER_ID = #{customerId} ORDER BY total_point DESC ) point,
( SELECT @point := NULL, @rank := 1 ) a ( SELECT @point := NULL, @rank := 1 ) a
</select> </select>

30
epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java

@ -26,12 +26,14 @@ import com.epmet.constant.UserRedisKeys;
import com.epmet.dao.GridLatestDao; import com.epmet.dao.GridLatestDao;
import com.epmet.dao.RegisterRelationDao; import com.epmet.dao.RegisterRelationDao;
import com.epmet.dao.UserBaseInfoDao; import com.epmet.dao.UserBaseInfoDao;
import com.epmet.dao.UserWechatDao;
import com.epmet.dto.form.BelongGridNameFormDTO; import com.epmet.dto.form.BelongGridNameFormDTO;
import com.epmet.dto.result.BelongGridNameResultDTO; import com.epmet.dto.result.BelongGridNameResultDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO; import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.entity.RegisterRelationEntity; import com.epmet.entity.RegisterRelationEntity;
import com.epmet.entity.UserBaseInfoEntity; import com.epmet.entity.UserBaseInfoEntity;
import com.epmet.entity.UserWechatEntity;
import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.util.ModuleConstant; import com.epmet.util.ModuleConstant;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -39,6 +41,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.List;
import java.util.Map; import java.util.Map;
import static com.epmet.commons.tools.redis.RedisUtils.NOT_EXPIRE; import static com.epmet.commons.tools.redis.RedisUtils.NOT_EXPIRE;
@ -61,6 +64,8 @@ public class UserBaseInfoRedis {
private GovOrgOpenFeignClient govOrgOpenFeignClient; private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired @Autowired
private GridLatestDao gridLatestDao; private GridLatestDao gridLatestDao;
@Autowired
private UserWechatDao userWechatDao;
public void delete(Object[] ids) { public void delete(Object[] ids) {
@ -102,9 +107,11 @@ public class UserBaseInfoRedis {
} }
//缓存中没有数据,先查数据库,放入缓存后再返回 //缓存中没有数据,先查数据库,放入缓存后再返回
UserBaseInfoResultDTO baseInfo = userBaseInfoDao.selectListByUserIdList(userId); UserBaseInfoResultDTO baseInfo = userBaseInfoDao.selectListByUserIdList(userId);
if(null != baseInfo && StringUtils.isNotBlank(baseInfo.getId())){ if(null != baseInfo && StringUtils.isNotBlank(baseInfo.getId())){
RegisterRelationEntity relation = registerRelationDao.selectRegisteredGridIdByUserId(userId);
//如果没有首次注册网格,则没有网格名称(xx机关-xx网格)、显示昵称(xx网格-x先生/女士) //如果没有首次注册网格,则没有网格名称(xx机关-xx网格)、显示昵称(xx网格-x先生/女士)
RegisterRelationEntity relation = registerRelationDao.selectRegisteredGridIdByUserId(userId);
if(null != relation && StringUtils.isNotBlank(relation.getGridId())){ if(null != relation && StringUtils.isNotBlank(relation.getGridId())){
baseInfo.setCustomerId(relation.getCustomerId()); baseInfo.setCustomerId(relation.getCustomerId());
BelongGridNameFormDTO gridParam = new BelongGridNameFormDTO(); BelongGridNameFormDTO gridParam = new BelongGridNameFormDTO();
@ -140,6 +147,27 @@ public class UserBaseInfoRedis {
} }
set(baseInfo); set(baseInfo);
return baseInfo; return baseInfo;
}else{
//如果没有,说明这里是陌生人
//陌生人不放入缓存,也不更新用户基础信息表
baseInfo = new UserBaseInfoResultDTO();
baseInfo.setUserId(userId);
List<UserWechatEntity> wechatInfo = userWechatDao.selectByUserId(userId);
if(null != wechatInfo && !wechatInfo.isEmpty()){
baseInfo.setNickname(wechatInfo.get(NumConstant.ZERO).getNickname());
}else{
return null;
}
RegisterRelationEntity relation = registerRelationDao.selectRegisteredGridIdByUserId(userId);
if(null != relation && StringUtils.isNotBlank(relation.getGridId())){
baseInfo.setCustomerId(relation.getCustomerId());
}else{
LatestGridInfoResultDTO gridLatest =
gridLatestDao.selectLatestGridInfoByUserId(userId);
if(null != gridLatest){
baseInfo.setCustomerId(gridLatest.getCustomerId());
}
}
} }
} }

Loading…
Cancel
Save