| 
						
						
							
								
							
						
						
					 | 
					@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; | 
					 | 
					 | 
					import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.elink.esua.epdc.commons.tools.constant.FieldConstant; | 
					 | 
					 | 
					import com.elink.esua.epdc.commons.tools.constant.FieldConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.elink.esua.epdc.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.elink.esua.epdc.commons.tools.enums.pointsenum.PointsRuleAvailableEnum; | 
					 | 
					 | 
					import com.elink.esua.epdc.commons.tools.enums.pointsenum.PointsRuleAvailableEnum; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.elink.esua.epdc.commons.tools.exception.ErrorCode; | 
					 | 
					 | 
					import com.elink.esua.epdc.commons.tools.exception.ErrorCode; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.elink.esua.epdc.commons.tools.page.PageData; | 
					 | 
					 | 
					import com.elink.esua.epdc.commons.tools.page.PageData; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -96,10 +97,17 @@ public class PointsRuleServiceImpl extends BaseServiceImpl<PointsRuleDao, Points | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public Result save(PointsRuleDTO dto) { | 
					 | 
					 | 
					    public Result save(PointsRuleDTO dto) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 判断积分规则编码是否重复
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        Result checkRuleCode = this.checkRuleCodeIsExist(dto.getRuleCode()); | 
					 | 
					 | 
					        Result checkRuleCode = this.checkRuleCodeIsExist(dto.getRuleCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (checkRuleCode.getCode() == ErrorCode.INTERNAL_SERVER_ERROR) { | 
					 | 
					 | 
					        if (checkRuleCode.getCode() == ErrorCode.INTERNAL_SERVER_ERROR) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            return checkRuleCode; | 
					 | 
					 | 
					            return checkRuleCode; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 判断所选动作是否重复
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        Result checkBehaviorCode = this.checkBehaviorCodeIsExist(dto.getBehaviorCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (checkBehaviorCode.getCode() == ErrorCode.INTERNAL_SERVER_ERROR) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            return checkBehaviorCode; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        PointsRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointsRuleEntity.class); | 
					 | 
					 | 
					        PointsRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointsRuleEntity.class); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        insert(entity); | 
					 | 
					 | 
					        insert(entity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        // 存入redis
 | 
					 | 
					 | 
					        // 存入redis
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -125,7 +133,7 @@ public class PointsRuleServiceImpl extends BaseServiceImpl<PointsRuleDao, Points | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public Result update(PointsRuleDTO dto) { | 
					 | 
					 | 
					    public Result update(PointsRuleDTO dto) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        // 查询之前的动作编码
 | 
					 | 
					 | 
					        // 查询之前的积分规则编码、动作编码
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        PointsRuleEntity queryEntity = baseDao.selectById(dto.getId()); | 
					 | 
					 | 
					        PointsRuleEntity queryEntity = baseDao.selectById(dto.getId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        // 判断本次修改操作是否修改了积分规则编码, 如果改动了,查询新的积分规则编码是否已存在
 | 
					 | 
					 | 
					        // 判断本次修改操作是否修改了积分规则编码, 如果改动了,查询新的积分规则编码是否已存在
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (!(queryEntity.getRuleCode().equals(dto.getRuleCode()))) { | 
					 | 
					 | 
					        if (!(queryEntity.getRuleCode().equals(dto.getRuleCode()))) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -134,6 +142,14 @@ public class PointsRuleServiceImpl extends BaseServiceImpl<PointsRuleDao, Points | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                return checkRuleCode; | 
					 | 
					 | 
					                return checkRuleCode; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 判断本次修改操作是否修改了动作编码, 如果改动了,查询新的动作编码是否在表中已存在
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (!(queryEntity.getBehaviorCode().equals(dto.getBehaviorCode()))) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            Result checkBehaviorCode = this.checkBehaviorCodeIsExist(dto.getBehaviorCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (checkBehaviorCode.getCode() == ErrorCode.INTERNAL_SERVER_ERROR) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                return checkBehaviorCode; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        PointsRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointsRuleEntity.class); | 
					 | 
					 | 
					        PointsRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointsRuleEntity.class); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        updateById(entity); | 
					 | 
					 | 
					        updateById(entity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        // 删除redis中的存储信息
 | 
					 | 
					 | 
					        // 删除redis中的存储信息
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -209,4 +225,18 @@ public class PointsRuleServiceImpl extends BaseServiceImpl<PointsRuleDao, Points | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return new Result(); | 
					 | 
					 | 
					        return new Result(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Description: 查询积动作是否存在 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Param: [behaviorCode] | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @return: com.elink.esua.epdc.commons.tools.utils.Result | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Author: zy | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Date: 2020-05-08 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private Result checkBehaviorCodeIsExist(String behaviorCode) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        int behaviorCodeNum = baseDao.selectBehaviorCodeDoestItExist(behaviorCode); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (behaviorCodeNum > NumConstant.ZERO) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            return new Result().error("动作已存在,请选择其他动作"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        return new Result(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					} | 
					 | 
					 | 
					} |