| 
						
						
							
								
							
						
						
					 | 
					@ -20,11 +20,11 @@ package com.epmet.service.impl; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
					 | 
					 | 
					import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.FieldConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.enums.EventEnum; | 
					 | 
					 | 
					import com.epmet.commons.tools.enums.EventEnum; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.page.PageData; | 
					 | 
					 | 
					import com.epmet.commons.tools.page.PageData; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.ConvertUtils; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.constant.FieldConstant; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dao.UserPointActionLogDao; | 
					 | 
					 | 
					import com.epmet.dao.UserPointActionLogDao; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.UserPointActionLogDTO; | 
					 | 
					 | 
					import com.epmet.dto.UserPointActionLogDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.form.CommonPageUserFormDTO; | 
					 | 
					 | 
					import com.epmet.dto.form.CommonPageUserFormDTO; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -41,10 +41,12 @@ import com.epmet.utils.ModuleConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.github.pagehelper.PageHelper; | 
					 | 
					 | 
					import com.github.pagehelper.PageHelper; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.google.common.collect.Maps; | 
					 | 
					 | 
					import com.google.common.collect.Maps; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import dto.form.SendPointFormDTO; | 
					 | 
					 | 
					import dto.form.SendPointFormDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.apache.commons.lang3.StringUtils; | 
					 | 
					 | 
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.transaction.annotation.Transactional; | 
					 | 
					 | 
					import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import org.springframework.util.CollectionUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.util.*; | 
					 | 
					 | 
					import java.util.*; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.util.stream.Collectors; | 
					 | 
					 | 
					import java.util.stream.Collectors; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -55,6 +57,7 @@ import java.util.stream.Collectors; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 * @author generator generator@elink-cn.com | 
					 | 
					 | 
					 * @author generator generator@elink-cn.com | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 * @since v1.0.0 2020-07-20 | 
					 | 
					 | 
					 * @since v1.0.0 2020-07-20 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 */ | 
					 | 
					 | 
					 */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					@Slf4j | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					@Service | 
					 | 
					 | 
					@Service | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActionLogDao, UserPointActionLogEntity> implements UserPointActionLogService { | 
					 | 
					 | 
					public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActionLogDao, UserPointActionLogEntity> implements UserPointActionLogService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -147,59 +150,71 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @Description 消息网关回调进行积分发放 | 
					 | 
					 | 
					     * @Description 消息网关回调进行积分发放 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					     * @param grantPointParam | 
					 | 
					 | 
					     * @param grantPointList | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					     * @return | 
					 | 
					 | 
					     * @return | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @author wangc | 
					 | 
					 | 
					     * @author wangc | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2020.07.29 09:11 | 
					 | 
					 | 
					     * @date 2020.07.29 09:11 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     **/ | 
					 | 
					 | 
					     **/ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public void grantPoint(SendPointFormDTO grantPointParam){ | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_MINUS,grantPointParam.getActionFlag())){ | 
					 | 
					 | 
					    public void grantPoint(List<SendPointFormDTO> grantPointList){ | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (CollectionUtils.isEmpty(grantPointList)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            log.warn("grantPoint param is empty"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            return; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        grantPointList.forEach(grantPoint->{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            plusPoint(grantPoint); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private void plusPoint(SendPointFormDTO grantPoint) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_MINUS,grantPoint.getActionFlag())){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            //减
 | 
					 | 
					 | 
					            //减
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            if(grantPointParam.getPoint() > NumConstant.ZERO){ | 
					 | 
					 | 
					            if(grantPoint.getPoint() > NumConstant.ZERO){ | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                //保证负数
 | 
					 | 
					 | 
					                //保证负数
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                grantPointParam.setPoint(grantPointParam.getPoint() * NumConstant.ONE_NEG); | 
					 | 
					 | 
					                grantPoint.setPoint(grantPoint.getPoint() * NumConstant.ONE_NEG); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        }else{ | 
					 | 
					 | 
					        }else{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            //加
 | 
					 | 
					 | 
					            //加
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            if(grantPointParam.getPoint() < NumConstant.ZERO){ | 
					 | 
					 | 
					            if(grantPoint.getPoint() < NumConstant.ZERO){ | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                //保证正数
 | 
					 | 
					 | 
					                //保证正数
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                grantPointParam.setPoint(grantPointParam.getPoint() * NumConstant.ONE_NEG); | 
					 | 
					 | 
					                grantPoint.setPoint(grantPoint.getPoint() * NumConstant.ONE_NEG); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //1.新增用户积分行为记录
 | 
					 | 
					 | 
					        //1.新增用户积分行为记录
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        UserPointActionLogEntity action = new UserPointActionLogEntity(); | 
					 | 
					 | 
					        UserPointActionLogEntity action = new UserPointActionLogEntity(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        action.setCustomerId(grantPointParam.getCustomerId()); | 
					 | 
					 | 
					        action.setCustomerId(grantPoint.getCustomerId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        action.setPoint(grantPointParam.getPoint()); | 
					 | 
					 | 
					        action.setPoint(grantPoint.getPoint()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        action.setEventStatement(grantPointParam.getPointDesc()); | 
					 | 
					 | 
					        action.setEventStatement(grantPoint.getPointDesc()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        action.setEventName(EventEnum.ACTIVE_SEND_POINT.getEventDesc()); | 
					 | 
					 | 
					        action.setEventName(EventEnum.ACTIVE_SEND_POINT.getEventDesc()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        action.setEventId(EventEnum.ACTIVE_INSERT_LIVE.getEventTag()); | 
					 | 
					 | 
					        action.setEventId(EventEnum.ACTIVE_INSERT_LIVE.getEventTag()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        action.setActionFlag(grantPointParam.getActionFlag()); | 
					 | 
					 | 
					        action.setActionFlag(grantPoint.getActionFlag()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        action.setUserId(grantPointParam.getUserId()); | 
					 | 
					 | 
					        action.setUserId(grantPoint.getUserId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        action.setCreatedBy(grantPointParam.getOperatorId()); | 
					 | 
					 | 
					        action.setCreatedBy(grantPoint.getOperatorId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        action.setUpdatedBy(grantPointParam.getOperatorId()); | 
					 | 
					 | 
					        action.setUpdatedBy(grantPoint.getOperatorId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        action.setSourceId(grantPointParam.getSourceId()); | 
					 | 
					 | 
					        action.setSourceId(grantPoint.getSourceId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        action.setOperatorAgencyId(grantPointParam.getOpAgencyId()); | 
					 | 
					 | 
					        action.setOperatorAgencyId(grantPoint.getOpAgencyId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        baseDao.insert(action); | 
					 | 
					 | 
					        baseDao.insert(action); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //2.新增/修改用户积分日统计
 | 
					 | 
					 | 
					        //2.新增/修改用户积分日统计
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        DimIdGenerator.DimIdBean dimVal = DimIdGenerator.getDimIdBean(new Date()); | 
					 | 
					 | 
					        DimIdGenerator.DimIdBean dimVal = DimIdGenerator.getDimIdBean(new Date()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        UserPointStatisticalDailyEntity statistical = ConvertUtils.sourceToTarget(dimVal,UserPointStatisticalDailyEntity.class); | 
					 | 
					 | 
					        UserPointStatisticalDailyEntity statistical = ConvertUtils.sourceToTarget(dimVal,UserPointStatisticalDailyEntity.class); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        statistical.setPointChange(grantPointParam.getPoint()); | 
					 | 
					 | 
					        statistical.setPointChange(grantPoint.getPoint()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        statistical.setActionFlag(grantPointParam.getActionFlag()); | 
					 | 
					 | 
					        statistical.setActionFlag(grantPoint.getActionFlag()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        statistical.setCustomerId(grantPointParam.getCustomerId()); | 
					 | 
					 | 
					        statistical.setCustomerId(grantPoint.getCustomerId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        statistical.setUserId(grantPointParam.getUserId()); | 
					 | 
					 | 
					        statistical.setUserId(grantPoint.getUserId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        statistical.setCreatedBy(grantPointParam.getOperatorId()); | 
					 | 
					 | 
					        statistical.setCreatedBy(grantPoint.getOperatorId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        statistical.setUpdatedBy(grantPointParam.getOperatorId()); | 
					 | 
					 | 
					        statistical.setUpdatedBy(grantPoint.getOperatorId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        userPointStatisticalDailyService.insertOrUpdate(statistical); | 
					 | 
					 | 
					        userPointStatisticalDailyService.insertOrUpdate(statistical); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //3.新增/修改用户总积分
 | 
					 | 
					 | 
					        //3.新增/修改用户总积分
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        UserPointTotalEntity point = new UserPointTotalEntity(); | 
					 | 
					 | 
					        UserPointTotalEntity point = new UserPointTotalEntity(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        point.setCustomerId(grantPointParam.getCustomerId()); | 
					 | 
					 | 
					        point.setCustomerId(grantPoint.getCustomerId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        point.setUserId(grantPointParam.getUserId()); | 
					 | 
					 | 
					        point.setUserId(grantPoint.getUserId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        point.setTotalPoint(grantPointParam.getPoint()); | 
					 | 
					 | 
					        point.setTotalPoint(grantPoint.getPoint()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        point.setUsablePoint(grantPointParam.getPoint()); | 
					 | 
					 | 
					        point.setUsablePoint(grantPoint.getPoint()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        point.setUsedPoint(NumConstant.ZERO); | 
					 | 
					 | 
					        point.setUsedPoint(NumConstant.ZERO); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        point.setCreatedBy(grantPointParam.getOperatorId()); | 
					 | 
					 | 
					        point.setCreatedBy(grantPoint.getOperatorId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        point.setUpdatedBy(grantPointParam.getOperatorId()); | 
					 | 
					 | 
					        point.setUpdatedBy(grantPoint.getOperatorId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        userPointTotalService.insertOrUpdate(point); | 
					 | 
					 | 
					        userPointTotalService.insertOrUpdate(point); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					
  |