|  | @ -18,10 +18,8 @@ | 
			
		
	
		
		
			
				
					|  |  | package com.epmet.service.impl; |  |  | package com.epmet.service.impl; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
			
		
	
		
		
			
				
					|  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |  |  |  | 
			
		
	
		
		
			
				
					|  |  | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |  |  | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 
			
		
	
		
		
			
				
					|  |  | 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.constant.StrConstant; |  |  | import com.epmet.commons.tools.constant.StrConstant; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.commons.tools.exception.EpmetErrorCode; |  |  | import com.epmet.commons.tools.exception.EpmetErrorCode; | 
			
		
	
	
		
		
			
				
					|  | @ -43,7 +41,6 @@ import com.epmet.utils.TagColorUtils; | 
			
		
	
		
		
			
				
					|  |  | import com.github.pagehelper.PageHelper; |  |  | import com.github.pagehelper.PageHelper; | 
			
		
	
		
		
			
				
					|  |  | import com.github.pagehelper.PageInfo; |  |  | import com.github.pagehelper.PageInfo; | 
			
		
	
		
		
			
				
					|  |  | import org.apache.commons.collections4.CollectionUtils; |  |  | import org.apache.commons.collections4.CollectionUtils; | 
			
		
	
		
		
			
				
					|  |  | 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; | 
			
		
	
	
		
		
			
				
					|  | @ -51,7 +48,6 @@ import org.springframework.transaction.annotation.Transactional; | 
			
		
	
		
		
			
				
					|  |  | import java.util.Arrays; |  |  | import java.util.Arrays; | 
			
		
	
		
		
			
				
					|  |  | import java.util.Date; |  |  | import java.util.Date; | 
			
		
	
		
		
			
				
					|  |  | import java.util.List; |  |  | import java.util.List; | 
			
		
	
		
		
			
				
					|  |  | import java.util.Map; |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | /** |  |  | /** | 
			
		
	
		
		
			
				
					|  |  |  * 客户标签表 |  |  |  * 客户标签表 | 
			
		
	
	
		
		
			
				
					|  | @ -78,22 +74,6 @@ public class TagCustomerServiceImpl extends BaseServiceImpl<TagCustomerDao, TagC | 
			
		
	
		
		
			
				
					|  |  |         return new PageData<>(list, pageInfo.getTotal()); |  |  |         return new PageData<>(list, pageInfo.getTotal()); | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     @Override |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     public List<TagCustomerDTO> list(Map<String, Object> params) { |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         List<TagCustomerEntity> entityList = baseDao.selectList(getWrapper(params)); |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         return ConvertUtils.sourceToTarget(entityList, TagCustomerDTO.class); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     private QueryWrapper<TagCustomerEntity> getWrapper(Map<String, Object> params){ |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         String id = (String)params.get(FieldConstant.ID_HUMP); |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         QueryWrapper<TagCustomerEntity> wrapper = new QueryWrapper<>(); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         return wrapper; |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     @Override |  |  |     @Override | 
			
		
	
		
		
			
				
					|  |  |     public TagCustomerDTO get(String id) { |  |  |     public TagCustomerDTO get(String id) { | 
			
		
	
		
		
			
				
					|  |  |         TagCustomerEntity entity = baseDao.selectById(id); |  |  |         TagCustomerEntity entity = baseDao.selectById(id); | 
			
		
	
	
		
		
			
				
					|  | @ -119,8 +99,8 @@ public class TagCustomerServiceImpl extends BaseServiceImpl<TagCustomerDao, TagC | 
			
		
	
		
		
			
				
					|  |  |         entity.setUseCount(NumConstant.ZERO); |  |  |         entity.setUseCount(NumConstant.ZERO); | 
			
		
	
		
		
			
				
					|  |  |         entity.setShowFlag(NumConstant.ONE); |  |  |         entity.setShowFlag(NumConstant.ONE); | 
			
		
	
		
		
			
				
					|  |  |         insert(entity); |  |  |         insert(entity); | 
			
		
	
		
		
			
				
					
					|  |  |         if(CollectionUtils.isNotEmpty(dto.getAgencyIds())){ |  |  |         if(CollectionUtils.isNotEmpty(dto.getAgencyList())){ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             dto.getAgencyIds().forEach(tagScopeDTO->{ |  |  |             dto.getAgencyList().forEach(tagScopeDTO->{ | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |                 TagScopeEntity tagScopeEntity=new TagScopeEntity(); |  |  |                 TagScopeEntity tagScopeEntity=new TagScopeEntity(); | 
			
		
	
		
		
			
				
					|  |  |                 tagScopeEntity.setCustomerId(entity.getCustomerId()); |  |  |                 tagScopeEntity.setCustomerId(entity.getCustomerId()); | 
			
		
	
		
		
			
				
					|  |  |                 tagScopeEntity.setTagId(entity.getId()); |  |  |                 tagScopeEntity.setTagId(entity.getId()); | 
			
		
	
	
		
		
			
				
					|  | @ -151,8 +131,8 @@ public class TagCustomerServiceImpl extends BaseServiceImpl<TagCustomerDao, TagC | 
			
		
	
		
		
			
				
					|  |  |         updateById(entity); |  |  |         updateById(entity); | 
			
		
	
		
		
			
				
					|  |  |         //删除应用范围
 |  |  |         //删除应用范围
 | 
			
		
	
		
		
			
				
					|  |  |         tagScopeDao.deleteByTagId(entity.getId(),entity.getCustomerId()); |  |  |         tagScopeDao.deleteByTagId(entity.getId(),entity.getCustomerId()); | 
			
		
	
		
		
			
				
					
					|  |  |         if(CollectionUtils.isNotEmpty(dto.getAgencyIds())){ |  |  |         if(CollectionUtils.isNotEmpty(dto.getAgencyList())){ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             dto.getAgencyIds().forEach(tagScopeDTO->{ |  |  |             dto.getAgencyList().forEach(tagScopeDTO->{ | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |                 TagScopeEntity tagScopeEntity=new TagScopeEntity(); |  |  |                 TagScopeEntity tagScopeEntity=new TagScopeEntity(); | 
			
		
	
		
		
			
				
					|  |  |                 tagScopeEntity.setCustomerId(entity.getCustomerId()); |  |  |                 tagScopeEntity.setCustomerId(entity.getCustomerId()); | 
			
		
	
		
		
			
				
					|  |  |                 tagScopeEntity.setTagId(entity.getId()); |  |  |                 tagScopeEntity.setTagId(entity.getId()); | 
			
		
	
	
		
		
			
				
					|  | 
 |