|
@@ -4,7 +4,6 @@ import cn.rankin.common.utils.api.page.Page;
|
|
|
import cn.rankin.common.utils.enums.BaseOrderEnum;
|
|
|
import cn.rankin.common.utils.enums.BaseStatusEnum;
|
|
|
import cn.rankin.common.utils.util.JpaSortUtil;
|
|
|
-import cn.rankin.data.api.product.entity.Tag;
|
|
|
import cn.rankin.data.api.user.dto.UserTagDTO;
|
|
|
import cn.rankin.data.api.user.entity.UserTag;
|
|
|
import cn.rankin.userservice.repository.UserTagRepository;
|
|
@@ -25,18 +24,6 @@ public class UserTagService {
|
|
|
@Autowired
|
|
|
private UserTagRepository userTagRepository;
|
|
|
|
|
|
-
|
|
|
- private TagGroupRepository tagGroupRepository;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private MerchantProductRepository merchantProductRepository;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private MerchantProductTagRelationService merchantProductTagRelationService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private GoodsService goodsService;*/
|
|
|
-
|
|
|
public List<UserTag> findByTypeCode(String typeCode,String uid) {
|
|
|
List<UserTag> userTagList = userTagRepository.findByTypeCodeUid(typeCode,uid, BaseStatusEnum.NORMAL);
|
|
|
return userTagList;
|
|
@@ -47,27 +34,6 @@ public class UserTagService {
|
|
|
return userTagList;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- List<MerchantProductTagRelation> relationList = merchantProductTagRelationService.findByTagId(tagId, BaseStatusEnum.NORMAL);
|
|
|
- if (CollectionUtils.isEmpty(relationList)) {
|
|
|
- return new ArrayList<>();
|
|
|
- }
|
|
|
-
|
|
|
- List<String> productIdList = new ArrayList<>();
|
|
|
- relationList.forEach(relation -> productIdList.add(relation.getPid()));
|
|
|
- List<MerchantProduct> merchantProductList = merchantProductRepository.findByPidsAndMerchantId(productIdList, merchantId);
|
|
|
- Map<String, MerchantProduct> merchantProductMap = ListUtil.convert(merchantProductList, "pid", MerchantProduct.class);
|
|
|
-
|
|
|
- List<MerchantProduct> sortMerchantProductList = new ArrayList<>();
|
|
|
- for (String productId : productIdList) {
|
|
|
- MerchantProduct merchantProduct = merchantProductMap.get(productId);
|
|
|
- if (merchantProduct != null) {
|
|
|
- sortMerchantProductList.add(merchantProduct);
|
|
|
- }
|
|
|
- }
|
|
|
- return sortMerchantProductList;
|
|
|
- }*/
|
|
|
-
|
|
|
|
|
|
public Page<UserTag> search(UserTag userTag, Integer pageNo, Integer pageSize, LinkedHashMap<String, BaseOrderEnum> sort) {
|
|
|
Long count = userTagRepository.count(userTag);
|
|
@@ -85,47 +51,19 @@ public class UserTagService {
|
|
|
|
|
|
public UserTag getUserTag(String id) {
|
|
|
UserTag userTag = userTagRepository.find(id);
|
|
|
- String uid = userTag.getUid();
|
|
|
-
|
|
|
-
|
|
|
- userTag.setProductList(merchantProductList);*/
|
|
|
return userTag;
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<UserTag> findUserTagByCodeUid(String code,String uid) {
|
|
|
List<UserTag> userTagLIst = userTagRepository.findByTypeCodeUid(code,uid, BaseStatusEnum.NORMAL);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- userTag.setProductList(merchantProductList);*/
|
|
|
return userTagLIst;
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
public UserTag create(UserTagDTO userTagDTO) {
|
|
|
UserTag userTag = convert(userTagDTO);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- String groupId = tagDTO.getGroupId();
|
|
|
- if(StringUtils.isNotBlank(groupId)){
|
|
|
-
|
|
|
- TagGroup tagGroup = tagGroupRepository.find(groupId);
|
|
|
- if (tagGroup == null) {
|
|
|
- return APIResult.error(ProductServiceAPICode.NOT_EXISTS);
|
|
|
- }
|
|
|
-
|
|
|
- merchantId = tagGroup.getMerchantId();
|
|
|
-
|
|
|
- }else{
|
|
|
-
|
|
|
- merchantId = tagDTO.getMerchantId();
|
|
|
- }
|
|
|
-
|
|
|
- tag.setMerchantId(merchantId);*/
|
|
|
UserTag result = userTagRepository.save(userTag);
|
|
|
-
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -133,15 +71,6 @@ public class UserTagService {
|
|
|
public UserTag update(UserTagDTO userTagDTO) {
|
|
|
UserTag userTag = convert(userTagDTO);
|
|
|
UserTag result = userTagRepository.update(userTag);
|
|
|
-
|
|
|
-
|
|
|
- String uid = result.getUid();
|
|
|
- List<String> productIdList = tagDTO.getProductList();
|
|
|
- merchantProductTagRelationService.updateByTagId(tagId, merchantId, productIdList);
|
|
|
-
|
|
|
- List<MerchantProduct> merchantProductList = getMerchantProductList(tagId, merchantId);
|
|
|
- tag.setProductList(merchantProductList);*/
|
|
|
-
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -159,31 +88,4 @@ public class UserTagService {
|
|
|
return userTagRepository.findUserTagByUid(uid);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- public void sortTag(String groupId, List<String> tagIdList) {
|
|
|
- List<Tag> tagList = tagRepository.findByGroupId(groupId, BaseStatusEnum.NORMAL);
|
|
|
- sortTag(tagIdList, tagList);
|
|
|
- tagRepository.update(tagList);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @Transactional
|
|
|
- public void sortTagByTypeCode(String typeCode, List<String> tagIdList) {
|
|
|
- List<Tag> tagList = tagRepository.findByTypeCode(typeCode);
|
|
|
- sortTag(tagIdList, tagList);
|
|
|
- tagRepository.update(tagList);
|
|
|
- }*/
|
|
|
-
|
|
|
-
|
|
|
- for (Tag tag : tagList) {
|
|
|
- String tagId = tag.getId();
|
|
|
- if (!tagIdList.contains(tagId)) {
|
|
|
- tag.setStatus(BaseStatusEnum.DEL);
|
|
|
- continue;
|
|
|
- }
|
|
|
- Integer index = tagIdList.indexOf(tagId);
|
|
|
- tag.setSort(index);
|
|
|
- }
|
|
|
- }*/
|
|
|
}
|