|
|
|
@ -11,6 +11,7 @@ import com.qniao.dam.domain.aggregate.externalproduct.valueobj.ExternalProductRe |
|
|
|
import com.qniao.dam.domain.aggregate.product.entity.Product; |
|
|
|
import com.qniao.dam.domain.aggregate.productspec.entity.ProductSpec; |
|
|
|
import com.qniao.dam.domain.aggregate.productspec.valueobj.ProductSpecTerm; |
|
|
|
import com.qniao.dam.domian.aggregate.product.constant.ProductMainCategoryEnum; |
|
|
|
import com.qniao.dam.domian.aggregate.product.constant.ProductSubCategoryEnum; |
|
|
|
import com.qniao.dam.domian.aggregate.product.constant.ProductTypeEnum; |
|
|
|
import com.qniao.dam.domian.aggregate.productspec.constant.ProductSpecTermNameEnum; |
|
|
|
@ -175,7 +176,8 @@ public class ProductQueryServiceImpl implements ProductQueryService { |
|
|
|
List<UserPageProductByCustomerGroupVo> groupVoList = new ArrayList<>(); |
|
|
|
List<UserPageProductByCustomerExtendVo> extendVos = productViewDao.selectProductByCustomerList(id); |
|
|
|
Map<Long, List<UserPageProductByCustomerExtendVo>> extMap = extendVos.stream().collect(Collectors.groupingBy(UserPageProductByCustomerExtendVo::getId)); |
|
|
|
extMap.forEach((k, v) -> { |
|
|
|
for (Long k : extMap.keySet()) { |
|
|
|
List<UserPageProductByCustomerExtendVo> v = extMap.get(k); |
|
|
|
UserPageProductByCustomerExtendVo extendVo = v.get(0); |
|
|
|
if (extendVo.getGroupType() == 0) { |
|
|
|
extendVo.setProductName(extendVo.getProductTitle()); |
|
|
|
@ -186,12 +188,53 @@ public class ProductQueryServiceImpl implements ProductQueryService { |
|
|
|
vo.setActivityId(extendVo.getId()); |
|
|
|
vo.setUnitSellingPrice(unitSellingPrice); |
|
|
|
vo.setUnitOriginalPrice(unitOriginalPrice); |
|
|
|
if (extendVo.getGroupType() == 0) { |
|
|
|
vo.setSubCategory(extendVo.getSubCategory()); |
|
|
|
} |
|
|
|
vo.setProductList(TypeConvertUtils.convert(v, UserPageProductByCustomerVo.class)); |
|
|
|
groupVoList.add(vo); |
|
|
|
}); |
|
|
|
} |
|
|
|
//特殊处理这么做是不对的 顺序:聊天卡、会员、包恋爱、包领证 |
|
|
|
List<UserPageProductByCustomerGroupVo> sortGroupVoList = new ArrayList<>(); |
|
|
|
//聊天卡 |
|
|
|
UserPageProductByCustomerGroupVo target1Vo = findTargetVo(groupVoList, 0, ProductSubCategoryEnum.CHAT_CARD); |
|
|
|
if (Objects.nonNull(target1Vo)) { |
|
|
|
sortGroupVoList.add(target1Vo); |
|
|
|
} |
|
|
|
//会员 |
|
|
|
sortGroupVoList.addAll(groupVoList.stream().filter(vo -> vo.getGroupType() == 1).collect(Collectors.toList())); |
|
|
|
groupVoList = groupVoList.stream().filter(vo -> vo.getGroupType() != 1).collect(Collectors.toList()); |
|
|
|
//包恋爱 |
|
|
|
UserPageProductByCustomerGroupVo target2Vo = findTargetVo(groupVoList, 0, ProductSubCategoryEnum.CONTRACT_LOVE); |
|
|
|
if (Objects.nonNull(target2Vo)) { |
|
|
|
sortGroupVoList.add(target2Vo); |
|
|
|
} |
|
|
|
//包领证 |
|
|
|
UserPageProductByCustomerGroupVo target3Vo = findTargetVo(groupVoList, 0, ProductSubCategoryEnum.CONTRACTED_MARRIAGE); |
|
|
|
if (Objects.nonNull(target3Vo)) { |
|
|
|
sortGroupVoList.add(target3Vo); |
|
|
|
} |
|
|
|
sortGroupVoList.addAll(groupVoList); |
|
|
|
groupVoList = sortGroupVoList; |
|
|
|
return groupVoList; |
|
|
|
} |
|
|
|
|
|
|
|
private UserPageProductByCustomerGroupVo findTargetVo(List<UserPageProductByCustomerGroupVo> sortGroupVoList, |
|
|
|
int groupType, |
|
|
|
ProductSubCategoryEnum subCategory) { |
|
|
|
UserPageProductByCustomerGroupVo targetVo = null; |
|
|
|
for (UserPageProductByCustomerGroupVo groupVo : sortGroupVoList) { |
|
|
|
if (groupVo.getGroupType() == groupType && subCategory.equals(groupVo.getSubCategory())) { |
|
|
|
targetVo = groupVo; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (Objects.nonNull(targetVo)) { |
|
|
|
sortGroupVoList.remove(targetVo); |
|
|
|
} |
|
|
|
return targetVo; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public UserPageProductByCustomerGroupVo getPageProductByCustomerDetails(Long id) { |
|
|
|
List<UserPageProductByCustomerGroupVo> vos = getPageProductByCustomer(id); |
|
|
|
|