|
@ -27,21 +27,27 @@ import com.epmet.commons.tools.exception.EpmetException; |
|
|
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.utils.EpmetRequestHolder; |
|
|
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|
|
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.dao.TagCustomerDao; |
|
|
import com.epmet.dao.TagCustomerDao; |
|
|
import com.epmet.dao.TagScopeDao; |
|
|
import com.epmet.dao.TagScopeDao; |
|
|
import com.epmet.dto.TagCustomerDTO; |
|
|
import com.epmet.dto.TagCustomerDTO; |
|
|
import com.epmet.dto.form.TagCustomerFormDTO; |
|
|
import com.epmet.dto.form.TagCustomerFormDTO; |
|
|
import com.epmet.dto.form.TagCustomerPageFormDTO; |
|
|
import com.epmet.dto.form.TagCustomerPageFormDTO; |
|
|
import com.epmet.dto.form.UpdateTagFormDTO; |
|
|
import com.epmet.dto.form.UpdateTagFormDTO; |
|
|
|
|
|
import com.epmet.dto.result.AgencyResultDTO; |
|
|
import com.epmet.dto.result.UpdateTagUseCountsResultDTO; |
|
|
import com.epmet.dto.result.UpdateTagUseCountsResultDTO; |
|
|
import com.epmet.entity.TagCustomerEntity; |
|
|
import com.epmet.entity.TagCustomerEntity; |
|
|
import com.epmet.entity.TagScopeEntity; |
|
|
import com.epmet.entity.TagScopeEntity; |
|
|
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
import com.epmet.service.TagCustomerService; |
|
|
import com.epmet.service.TagCustomerService; |
|
|
import com.epmet.utils.TagColorUtils; |
|
|
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 lombok.extern.slf4j.Slf4j; |
|
|
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.scheduling.annotation.Async; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
@ -55,10 +61,13 @@ import java.util.List; |
|
|
* @author generator generator@elink-cn.com |
|
|
* @author generator generator@elink-cn.com |
|
|
* @since v1.0.0 2020-06-02 |
|
|
* @since v1.0.0 2020-06-02 |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
@Slf4j |
|
|
@Service |
|
|
@Service |
|
|
public class TagCustomerServiceImpl extends BaseServiceImpl<TagCustomerDao, TagCustomerEntity> implements TagCustomerService { |
|
|
public class TagCustomerServiceImpl extends BaseServiceImpl<TagCustomerDao, TagCustomerEntity> implements TagCustomerService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private TagScopeDao tagScopeDao; |
|
|
private TagScopeDao tagScopeDao; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -191,4 +200,45 @@ public class TagCustomerServiceImpl extends BaseServiceImpl<TagCustomerDao, TagC |
|
|
.set(TagCustomerEntity::getShowFlag,showFlag); |
|
|
.set(TagCustomerEntity::getShowFlag,showFlag); |
|
|
baseDao.update(null,tagCustomerUpdateWrapper); |
|
|
baseDao.update(null,tagCustomerUpdateWrapper); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 初始化标签应用范围, |
|
|
|
|
|
* 每个标签,和当前客户下所有社区关联 |
|
|
|
|
|
* |
|
|
|
|
|
* @param customerId@return |
|
|
|
|
|
*/ |
|
|
|
|
|
@Async |
|
|
|
|
|
@Override |
|
|
|
|
|
public void initTagScope(String customerId) { |
|
|
|
|
|
if (StringUtils.isBlank(customerId)) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
LambdaQueryWrapper<TagCustomerEntity> queryWrapper = new LambdaQueryWrapper(); |
|
|
|
|
|
queryWrapper.eq(TagCustomerEntity::getCustomerId, customerId); |
|
|
|
|
|
List<TagCustomerEntity> tagList = baseDao.selectList(queryWrapper); |
|
|
|
|
|
if (CollectionUtils.isEmpty(tagList)) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
int tagTotal = tagList.size(); |
|
|
|
|
|
// 获取当前客户下所有的社区组织
|
|
|
|
|
|
Result<List<AgencyResultDTO>> communityRes = govOrgOpenFeignClient.getAllCommunity(customerId); |
|
|
|
|
|
if (communityRes.success() && CollectionUtils.isNotEmpty(communityRes.getData())) { |
|
|
|
|
|
int communityTotal = communityRes.getData().size(); |
|
|
|
|
|
int num = 1; |
|
|
|
|
|
for (TagCustomerEntity tag : tagList) { |
|
|
|
|
|
for (AgencyResultDTO agencyResultDTO : communityRes.getData()) { |
|
|
|
|
|
TagScopeEntity tagScopeEntity = new TagScopeEntity(); |
|
|
|
|
|
tagScopeEntity.setCustomerId(tag.getCustomerId()); |
|
|
|
|
|
tagScopeEntity.setTagId(tag.getId()); |
|
|
|
|
|
tagScopeEntity.setAgencyId(agencyResultDTO.getAgencyId()); |
|
|
|
|
|
tagScopeEntity.setOrgIdPath(agencyResultDTO.getOrgIdPath()); |
|
|
|
|
|
tagScopeDao.insert(tagScopeEntity); |
|
|
|
|
|
num++; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
log.error(String.format("customerId:%s,已经将%s个标签应用给%s个社区,tag_scope产生%s条记录", customerId, tagTotal, communityTotal, num)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|