|
|
|
|
@@ -15,9 +15,11 @@ import com.cool.store.dao.order.PreAllocationRecordDAO;
|
|
|
|
|
import com.cool.store.dao.order.StoreOrderDAO;
|
|
|
|
|
import com.cool.store.dao.order.StoreOrderOptionSnapshotDAO;
|
|
|
|
|
import com.cool.store.dao.order.StoreWishlistDAO;
|
|
|
|
|
import com.cool.store.dao.order.StoreWishlistOptionDAO;
|
|
|
|
|
import com.cool.store.dao.store.StoreTypeDAO;
|
|
|
|
|
import com.cool.store.dao.store.StoreTypeOptionDAO;
|
|
|
|
|
import com.cool.store.dao.wallet.WalletTradeDAO;
|
|
|
|
|
import com.cool.store.dto.PointInfoDTO;
|
|
|
|
|
import com.cool.store.entity.*;
|
|
|
|
|
import com.cool.store.entity.config.ConfigOptionDO;
|
|
|
|
|
import com.cool.store.entity.dict.SysDictTableDO;
|
|
|
|
|
@@ -26,6 +28,7 @@ import com.cool.store.entity.order.PreAllocationRecordDO;
|
|
|
|
|
import com.cool.store.entity.order.StoreOrderDO;
|
|
|
|
|
import com.cool.store.entity.order.StoreOrderOptionSnapshotDO;
|
|
|
|
|
import com.cool.store.entity.order.StoreWishlistDO;
|
|
|
|
|
import com.cool.store.entity.order.StoreWishlistOptionDO;
|
|
|
|
|
import com.cool.store.entity.store.StoreTypeDO;
|
|
|
|
|
import com.cool.store.entity.store.StoreTypeOptionDO;
|
|
|
|
|
import com.cool.store.entity.wallet.WalletTradeDO;
|
|
|
|
|
@@ -33,15 +36,21 @@ import com.cool.store.enums.*;
|
|
|
|
|
import com.cool.store.enums.fees.AllocationPayStatusEnum;
|
|
|
|
|
import com.cool.store.enums.fees.WalletFeeItemEnum;
|
|
|
|
|
import com.cool.store.enums.order.StoreOrderStatusEnum;
|
|
|
|
|
import com.cool.store.enums.order.WishlistStatusEnum;
|
|
|
|
|
import com.cool.store.enums.point.ShopSubStageStatusEnum;
|
|
|
|
|
import com.cool.store.enums.wallet.WalletTradeModuleEnum;
|
|
|
|
|
import com.cool.store.exception.ServiceException;
|
|
|
|
|
import com.cool.store.dto.wallet.BatchTransferDTO;
|
|
|
|
|
import com.cool.store.mapper.ShopAuditInfoMapper;
|
|
|
|
|
import com.cool.store.request.PointRecommendLineRequest;
|
|
|
|
|
import com.cool.store.request.SelectPointRequest;
|
|
|
|
|
import com.cool.store.request.SysRoleRequest;
|
|
|
|
|
import com.cool.store.request.order.*;
|
|
|
|
|
import com.cool.store.request.dict.DictColumnQueryRequest;
|
|
|
|
|
import com.cool.store.request.wallet.BatchTransferRequest;
|
|
|
|
|
import com.cool.store.service.OperationLogService;
|
|
|
|
|
import com.cool.store.service.PointService;
|
|
|
|
|
import com.cool.store.service.ShopService;
|
|
|
|
|
import com.cool.store.service.UserAuthMappingService;
|
|
|
|
|
import com.cool.store.service.dict.DictColumnService;
|
|
|
|
|
import com.cool.store.service.order.MiniStoreOrderService;
|
|
|
|
|
@@ -68,9 +77,11 @@ import io.swagger.models.auth.In;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.text.MessageFormat;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
@@ -93,6 +104,7 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
|
|
|
|
|
private final StoreOrderDAO storeOrderDAO;
|
|
|
|
|
private final StoreOrderOptionSnapshotDAO snapshotDAO;
|
|
|
|
|
private final StoreWishlistDAO storeWishlistDAO;
|
|
|
|
|
private final StoreWishlistOptionDAO storeWishlistOptionDAO;
|
|
|
|
|
private final ShopInfoDAO shopInfoDAO;
|
|
|
|
|
private final LineInfoDAO lineInfoDAO;
|
|
|
|
|
private final StoreTypeDAO storeTypeDAO;
|
|
|
|
|
@@ -114,6 +126,10 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
|
|
|
|
|
private final OperationLogDAO operationLogDAO;
|
|
|
|
|
private final ConfigItemCategoryDAO configItemCategoryDAO;
|
|
|
|
|
private final ConfigItemDAO configItemDAO;
|
|
|
|
|
private final QualificationsInfoDAO qualificationsInfoDAO;
|
|
|
|
|
private final PointService pointService;
|
|
|
|
|
private final PointInfoDAO pointInfoDAO;
|
|
|
|
|
private final ShopService shopService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -329,10 +345,11 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
|
|
|
|
|
operationLogService.addOperationLog(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_280, user.getPartnerId(), user.getUsername(),
|
|
|
|
|
OperationTypeEnum.OPERATION_TYPE_0, "店型选购提交", OperationStatusEnum.PROCESSED);
|
|
|
|
|
|
|
|
|
|
List<EnterpriseUserDO> users = userAuthMappingService.getUserIdByRoleEnumAndRegionId(Collections.singletonList(UserRoleEnum.JOIN_OFFICE),
|
|
|
|
|
shopInfo.getInvestRegionId());
|
|
|
|
|
SysRoleRequest sysRoleRequest = new SysRoleRequest();
|
|
|
|
|
sysRoleRequest.setRoleName(AI_STORE_TYPE_APPROVE.getDesc());
|
|
|
|
|
List<EnterpriseUserDO> userListByRole = userAuthMappingService.findUserListByRole(sysRoleRequest, false);
|
|
|
|
|
operationLogService.addOperationLog(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281,
|
|
|
|
|
user.getPartnerId(), users,
|
|
|
|
|
user.getPartnerId(), userListByRole,
|
|
|
|
|
OperationTypeEnum.OPERATION_TYPE_1, "店型选购待立规审批", OperationStatusEnum.NOT_PROCESSED, 1);
|
|
|
|
|
|
|
|
|
|
return order.getId();
|
|
|
|
|
@@ -349,11 +366,14 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
|
|
|
|
|
|
|
|
|
|
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(order.getShopId());
|
|
|
|
|
|
|
|
|
|
StoreTypeDO storeType = storeTypeDAO.getById(order.getStoreTypeId());
|
|
|
|
|
|
|
|
|
|
MiniStoreOrderDetailVO vo = new MiniStoreOrderDetailVO();
|
|
|
|
|
|
|
|
|
|
MiniStoreOrderDetailVO.OrderInfoVO orderInfo = new MiniStoreOrderDetailVO.OrderInfoVO();
|
|
|
|
|
orderInfo.setStoreType(order.getStoreType());
|
|
|
|
|
orderInfo.setStoreTypeId(order.getStoreTypeId());
|
|
|
|
|
orderInfo.setStoreTypeName(storeType.getStoreTypeName());
|
|
|
|
|
orderInfo.setOrderNo(order.getOrderNo());
|
|
|
|
|
orderInfo.setOrderId(order.getId());
|
|
|
|
|
orderInfo.setShopId(order.getShopId());
|
|
|
|
|
@@ -557,15 +577,6 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
|
|
|
|
|
//处理审批记录 通过
|
|
|
|
|
handleAudit(order.getShopId(),user,0,request.getRemark(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281);
|
|
|
|
|
|
|
|
|
|
List<EnterpriseUserDO> users = userAuthMappingService.getUserIdByRoleEnumAndRegionId(Arrays.asList(HEAD_OF_DESIGN), shopInfoDAO.getShopInfo(order.getShopId()).getRegionId());
|
|
|
|
|
List<String> userIds = new ArrayList<>();
|
|
|
|
|
if (CollectionUtils.isNotEmpty(users)) {
|
|
|
|
|
userIds = users.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
operationLogService.addOperationLog(order.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281_5,
|
|
|
|
|
user.getUserId(), users,
|
|
|
|
|
OperationTypeEnum.OPERATION_TYPE_1, "店型选配待招商经理审批", OperationStatusEnum.NOT_PROCESSED);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (INVEST_MANAGER_CONFIRM.getCode().equals(currentStatus)){
|
|
|
|
|
order.setStatus(FINANCIAL_CONFIRM.getCode());
|
|
|
|
|
@@ -574,9 +585,6 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
|
|
|
|
|
//修改阶段数据
|
|
|
|
|
shopStageInfoDAO.updateShopStageInfo(order.getShopId(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_282);
|
|
|
|
|
|
|
|
|
|
//处理审批记录 通过
|
|
|
|
|
handleAudit(order.getShopId(),user,0,request.getRemark(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281_5);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return Boolean.TRUE;
|
|
|
|
|
}
|
|
|
|
|
@@ -603,12 +611,10 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
|
|
|
|
|
ShopSubStageStatusEnum current = null;
|
|
|
|
|
if (WAIT_CONFIRM.getCode().equals(currentStatus)){
|
|
|
|
|
current = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281;
|
|
|
|
|
//处理审批记录
|
|
|
|
|
handleAudit(order.getShopId(),userInfo,1,request.getRemark(),current);
|
|
|
|
|
}
|
|
|
|
|
if (INVEST_MANAGER_CONFIRM.getCode().equals(currentStatus)){
|
|
|
|
|
current = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281_5;
|
|
|
|
|
}
|
|
|
|
|
//处理审批记录
|
|
|
|
|
handleAudit(order.getShopId(),userInfo,1,request.getRemark(),current);
|
|
|
|
|
|
|
|
|
|
return Boolean.TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -825,11 +831,11 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
|
|
|
|
|
operationLogService.addOperationLog(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_280, user.getPartnerId(), user.getUsername(),
|
|
|
|
|
OperationTypeEnum.OPERATION_TYPE_0, "店型选购提交", OperationStatusEnum.PROCESSED);
|
|
|
|
|
|
|
|
|
|
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(order.getShopId());
|
|
|
|
|
List<EnterpriseUserDO> users = userAuthMappingService.getUserIdByRoleEnumAndRegionId(Collections.singletonList(UserRoleEnum.JOIN_OFFICE),
|
|
|
|
|
shopInfo.getInvestRegionId());
|
|
|
|
|
SysRoleRequest sysRoleRequest = new SysRoleRequest();
|
|
|
|
|
sysRoleRequest.setRoleName(AI_STORE_TYPE_APPROVE.getDesc());
|
|
|
|
|
List<EnterpriseUserDO> userListByRole = userAuthMappingService.findUserListByRole(sysRoleRequest, false);
|
|
|
|
|
operationLogService.addOperationLog(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281,
|
|
|
|
|
user.getPartnerId(), users,
|
|
|
|
|
user.getPartnerId(), userListByRole,
|
|
|
|
|
OperationTypeEnum.OPERATION_TYPE_1, "店型选购待立规审批", OperationStatusEnum.NOT_PROCESSED, 1);
|
|
|
|
|
|
|
|
|
|
return order.getId();
|
|
|
|
|
@@ -1292,12 +1298,14 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
|
|
|
|
|
optionMap = options.stream().collect(Collectors.toMap(ConfigOptionDO::getId, Function.identity(), (a, b) -> a));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (request.getVersionNo() != null) {
|
|
|
|
|
storeWishlistDAO.softDeleteByLineIdAndStoreTypeAndVersion(userInfoVO.getLineId(), request.getStoreTypeId(), request.getVersionNo());
|
|
|
|
|
if (request.getWishlistId() != null) {
|
|
|
|
|
MiniStoreWishlistDelRequest miniStoreWishlistDelRequest = new MiniStoreWishlistDelRequest();
|
|
|
|
|
miniStoreWishlistDelRequest.setWishlistId(request.getWishlistId());
|
|
|
|
|
//删除逻辑
|
|
|
|
|
deleted(miniStoreWishlistDelRequest,null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String versionNo = generateOrderNo();
|
|
|
|
|
List<StoreWishlistDO> saveList = new ArrayList<>();
|
|
|
|
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
|
|
|
|
|
|
|
|
|
BigDecimal storeFixedAmount = safe(storeType.getFranchiseFee())
|
|
|
|
|
@@ -1326,67 +1334,279 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
|
|
|
|
|
BigDecimal quantity = selected.getQuantity();
|
|
|
|
|
BigDecimal defaultQty = binding.getDefaultQuantity();
|
|
|
|
|
BigDecimal amount = BigDecimal.ZERO;
|
|
|
|
|
//原价
|
|
|
|
|
BigDecimal originalPrice = cfg.getOriginalOptionPrice();
|
|
|
|
|
if(quantity.compareTo(defaultQty)<=0){
|
|
|
|
|
if (quantity.compareTo(defaultQty) <= 0) {
|
|
|
|
|
amount = price.multiply(quantity);
|
|
|
|
|
}else {
|
|
|
|
|
// 店型优惠价*默认数量 + 原价 *(选择数量-默认数量)
|
|
|
|
|
} else {
|
|
|
|
|
amount = price.multiply(defaultQty).add(originalPrice.multiply(quantity.subtract(defaultQty)));
|
|
|
|
|
}
|
|
|
|
|
totalAmount = totalAmount.add(amount);
|
|
|
|
|
|
|
|
|
|
saveList.add(StoreWishlistDO.builder()
|
|
|
|
|
.lineId(userInfoVO.getLineId())
|
|
|
|
|
.storeTypeId(request.getStoreTypeId())
|
|
|
|
|
.optionId(selected.getOptionId())
|
|
|
|
|
.quantity(selected.getQuantity())
|
|
|
|
|
.totalAmount(BigDecimal.ZERO)
|
|
|
|
|
.versionNo(versionNo)
|
|
|
|
|
.deleted(0)
|
|
|
|
|
.build());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
totalAmount = storeFixedAmount.add(totalAmount);
|
|
|
|
|
|
|
|
|
|
for (StoreWishlistDO row : saveList) {
|
|
|
|
|
row.setTotalAmount(totalAmount);
|
|
|
|
|
StoreWishlistDO wishlist = StoreWishlistDO.builder()
|
|
|
|
|
.lineId(userInfoVO.getLineId())
|
|
|
|
|
.storeTypeId(request.getStoreTypeId())
|
|
|
|
|
.totalAmount(totalAmount)
|
|
|
|
|
.versionNo(versionNo)
|
|
|
|
|
.wishlistStatus(getWishlistStatus(userInfoVO.getLineId()))
|
|
|
|
|
.deleted(0)
|
|
|
|
|
.build();
|
|
|
|
|
storeWishlistDAO.insert(wishlist);
|
|
|
|
|
|
|
|
|
|
List<StoreWishlistOptionDO> optionSaveList = new ArrayList<>();
|
|
|
|
|
for (MiniStoreWishlistSaveRequest.SelectedOption selected : request.getSelectedOptions()) {
|
|
|
|
|
optionSaveList.add(StoreWishlistOptionDO.builder()
|
|
|
|
|
.wishlistId(wishlist.getId())
|
|
|
|
|
.optionId(selected.getOptionId())
|
|
|
|
|
.quantity(selected.getQuantity())
|
|
|
|
|
.deleted(0)
|
|
|
|
|
.build());
|
|
|
|
|
}
|
|
|
|
|
storeWishlistDAO.insertBatch(saveList);
|
|
|
|
|
storeWishlistOptionDAO.insertBatch(optionSaveList);
|
|
|
|
|
return Boolean.TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取线索阶段
|
|
|
|
|
* @param lineId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private Integer getWishlistStatus(Long lineId){
|
|
|
|
|
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
|
|
|
|
|
if (lineInfo.getWorkflowSubStageStatus()>=WorkflowSubStageStatusEnum.INTENT_5.getCode()){
|
|
|
|
|
return WishlistStatusEnum.COMPLETE_POINT.getCode();
|
|
|
|
|
}
|
|
|
|
|
return WishlistStatusEnum.AGREE.getCode();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean deleted(MiniStoreWishlistDelRequest request, PartnerUserInfoVO userInfoVO) {
|
|
|
|
|
storeWishlistDAO.softDeleteByLineIdAndStoreTypeAndVersion(userInfoVO.getLineId(),request.getStoreTypeId(),request.getVersionNo());
|
|
|
|
|
StoreWishlistDO storewishlist = storeWishlistDAO.getById(request.getWishlistId());
|
|
|
|
|
if (storewishlist==null){
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
|
|
|
|
}
|
|
|
|
|
storewishlist.setDeleted(1);
|
|
|
|
|
storeWishlistDAO.updateByExampleSelective(storewishlist);
|
|
|
|
|
//更新配置项数据
|
|
|
|
|
storeWishlistOptionDAO.softDeleteByWishlistIds(Arrays.asList(request.getWishlistId()));
|
|
|
|
|
return Boolean.TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public MiniStoreWishlistDetailVO wishlistDetail(Long storeTypeId,String versionNo, Long lineId) {
|
|
|
|
|
if (lineId == null) {
|
|
|
|
|
public MiniStoreWishlistDetailVO wishlistDetail(Long wishlistId) {
|
|
|
|
|
StoreWishlistDO storeWishlistDO = storeWishlistDAO.getById(wishlistId);
|
|
|
|
|
if (storeWishlistDO==null){
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
|
|
|
|
}
|
|
|
|
|
return convert(storeWishlistDO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<StoreWishlistDO> rows = storeWishlistDAO.listByLineIdAndStoreTypeAndVersion(lineId, storeTypeId, versionNo);
|
|
|
|
|
if (CollectionUtils.isEmpty(rows)){
|
|
|
|
|
@Override
|
|
|
|
|
public List<MiniStoreWishlistListVO> wishlistList( PartnerUserInfoVO userInfoVO) {
|
|
|
|
|
if (userInfoVO == null || userInfoVO.getLineId() == null) {
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
|
|
|
|
List<MiniStoreWishlistListVO> wishlistList = storeWishlistDAO.listByLineId(userInfoVO.getLineId(), null);
|
|
|
|
|
if (CollectionUtils.isEmpty(wishlistList)) {
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Long> wishlistIds = wishlistList.stream().map(MiniStoreWishlistListVO::getWishlistId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
|
|
List<StoreWishlistOptionDO> optionRows = storeWishlistOptionDAO.listByWishlistIds(wishlistIds);
|
|
|
|
|
|
|
|
|
|
Map<Long, List<StoreWishlistOptionDO>> map = optionRows.stream().collect(Collectors.groupingBy(StoreWishlistOptionDO::getWishlistId));
|
|
|
|
|
|
|
|
|
|
List<Long> optionIds = optionRows.stream().distinct().map(StoreWishlistOptionDO::getOptionId).collect(Collectors.toList());
|
|
|
|
|
Map<Long, ConfigOptionDO> optionMap = new HashMap<>();
|
|
|
|
|
if (CollectionUtils.isNotEmpty(optionIds)) {
|
|
|
|
|
List<ConfigOptionDO> options = configOptionDAO.listActiveByIds(optionIds);
|
|
|
|
|
optionMap = options.stream().collect(Collectors.toMap(ConfigOptionDO::getId, Function.identity(), (a, b) -> a));
|
|
|
|
|
}
|
|
|
|
|
List<Long> pointList = wishlistList.stream().filter(x -> x.getPointId() != null).map(MiniStoreWishlistListVO::getPointId).collect(Collectors.toList());
|
|
|
|
|
List<PointInfoDO> pointDOList = pointInfoDAO.getPointListByIds(pointList);
|
|
|
|
|
Map<Long, Long> pointMap = pointDOList.stream().filter(x -> x.getShopId() != null).collect(Collectors.toMap(PointInfoDO::getId, PointInfoDO::getShopId));
|
|
|
|
|
|
|
|
|
|
for (MiniStoreWishlistListVO item : wishlistList) {
|
|
|
|
|
List<StoreWishlistOptionDO> storeWishlistOptionDOS = map.get(item.getWishlistId());
|
|
|
|
|
List<MiniStoreWishlistListVO.OptionVO> optionList = new ArrayList<>();
|
|
|
|
|
if (item.getPointId()!=null){
|
|
|
|
|
item.setShopId(pointMap.get(item.getPointId()));
|
|
|
|
|
}
|
|
|
|
|
for (StoreWishlistOptionDO row : storeWishlistOptionDOS) {
|
|
|
|
|
MiniStoreWishlistListVO.OptionVO vo = new MiniStoreWishlistListVO.OptionVO();
|
|
|
|
|
vo.setOptionId(row.getOptionId());
|
|
|
|
|
vo.setQuantity(row.getQuantity());
|
|
|
|
|
ConfigOptionDO cfg = optionMap.get(row.getOptionId());
|
|
|
|
|
if (cfg != null) {
|
|
|
|
|
vo.setOptionName(cfg.getOptionName());
|
|
|
|
|
vo.setOptionPrice(cfg.getOptionPrice());
|
|
|
|
|
vo.setImageUrl(cfg.getImageUrl());
|
|
|
|
|
}
|
|
|
|
|
optionList.add(vo);
|
|
|
|
|
}
|
|
|
|
|
item.setOptions(optionList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return wishlistList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageInfo<MiniStoreWishlistListVO> wishAllList(WishAllListRequest request) {
|
|
|
|
|
PageHelper.startPage(request.getPageNum(),request.getPageSize());
|
|
|
|
|
List<MiniStoreWishlistListVO> wishlist = storeWishlistDAO.listByVersionList(request.getKeyword(), request.getStoreTypeId(),request.getWishlistStatus());
|
|
|
|
|
if (CollectionUtils.isEmpty(wishlist)){
|
|
|
|
|
return new PageInfo<>();
|
|
|
|
|
}
|
|
|
|
|
PageInfo<MiniStoreWishlistListVO> result = new PageInfo<>(wishlist);
|
|
|
|
|
List<Long> lineIdList = wishlist.stream().map(MiniStoreWishlistListVO::getLineId).collect(Collectors.toList());
|
|
|
|
|
List<LineInfoDO> lineList = lineInfoDAO.getByLineIds(lineIdList);
|
|
|
|
|
Map<Long, LineInfoDO> map = lineList.stream().collect(Collectors.toMap(LineInfoDO::getId, data -> data));
|
|
|
|
|
|
|
|
|
|
List<Long> wishlistIds = wishlist.stream().map(MiniStoreWishlistListVO::getWishlistId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
|
|
List<StoreWishlistOptionDO> optionRows = storeWishlistOptionDAO.listByWishlistIds(wishlistIds);
|
|
|
|
|
|
|
|
|
|
Map<Long, List<StoreWishlistOptionDO>> wishlistOptionMap = optionRows.stream().collect(Collectors.groupingBy(StoreWishlistOptionDO::getWishlistId));
|
|
|
|
|
|
|
|
|
|
List<Long> optionIds = optionRows.stream().distinct().map(StoreWishlistOptionDO::getOptionId).collect(Collectors.toList());
|
|
|
|
|
Map<Long, ConfigOptionDO> optionMap = new HashMap<>();
|
|
|
|
|
if (CollectionUtils.isNotEmpty(optionIds)) {
|
|
|
|
|
List<ConfigOptionDO> options = configOptionDAO.listActiveByIds(optionIds);
|
|
|
|
|
optionMap = options.stream().collect(Collectors.toMap(ConfigOptionDO::getId, Function.identity(), (a, b) -> a));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (MiniStoreWishlistListVO item : wishlist) {
|
|
|
|
|
LineInfoDO lineInfoDO = map.get(item.getLineId());
|
|
|
|
|
if (lineInfoDO != null) {
|
|
|
|
|
item.setPartnerMobile(lineInfoDO.getMobile());
|
|
|
|
|
item.setPartnerName(lineInfoDO.getUsername());
|
|
|
|
|
}
|
|
|
|
|
List<StoreWishlistOptionDO> storeWishlistOptionDOS = wishlistOptionMap.get(item.getWishlistId());
|
|
|
|
|
|
|
|
|
|
List<MiniStoreWishlistListVO.OptionVO> optionList = new ArrayList<>();
|
|
|
|
|
for (StoreWishlistOptionDO row : storeWishlistOptionDOS) {
|
|
|
|
|
MiniStoreWishlistListVO.OptionVO vo = new MiniStoreWishlistListVO.OptionVO();
|
|
|
|
|
vo.setOptionId(row.getOptionId());
|
|
|
|
|
vo.setQuantity(row.getQuantity());
|
|
|
|
|
ConfigOptionDO cfg = optionMap.get(row.getOptionId());
|
|
|
|
|
if (cfg != null) {
|
|
|
|
|
vo.setOptionName(cfg.getOptionName());
|
|
|
|
|
vo.setOptionPrice(cfg.getOptionPrice());
|
|
|
|
|
vo.setImageUrl(cfg.getImageUrl());
|
|
|
|
|
}
|
|
|
|
|
optionList.add(vo);
|
|
|
|
|
}
|
|
|
|
|
item.setOptions(optionList);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean wishlistBindPoint(WishlistBindPointRequest request) {
|
|
|
|
|
StoreWishlistDO storeWishlist = storeWishlistDAO.getById(request.getWishlistId());
|
|
|
|
|
if (!WishlistStatusEnum.COMPLETE_POINT.getCode().equals(storeWishlist.getWishlistStatus())){
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.TASK_STATUS_NOT_ALLOW_OPERATE);
|
|
|
|
|
}
|
|
|
|
|
//校验铺位是否关联了其他心愿单 且心愿单不是拒绝状态
|
|
|
|
|
Integer pointBindWishlistCount = storeWishlistDAO.getPointBindWishlistCount(request.getPointId(), WishlistStatusEnum.REJECT.getCode());
|
|
|
|
|
if (pointBindWishlistCount>0){
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.CURRENT_POINT_BIND_OTHER_WISHLIST);
|
|
|
|
|
}
|
|
|
|
|
storeWishlist.setPointId(request.getPointId());
|
|
|
|
|
storeWishlist.setWishlistStatus(WishlistStatusEnum.LI_GUI_APPROVE.getCode());
|
|
|
|
|
storeWishlistDAO.updateByExampleSelective(storeWishlist);
|
|
|
|
|
return Boolean.TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public Boolean wishlistApprove(WishlistAuditRequest request, LoginUserInfo userInfo) {
|
|
|
|
|
log.info("wishlistApprove:{},审批人:{}",JSONObject.toJSONString(request),userInfo.getName());
|
|
|
|
|
//查看心愿单状态
|
|
|
|
|
StoreWishlistDO wishlistDO = storeWishlistDAO.getById(request.getWishlistId());
|
|
|
|
|
if (wishlistDO==null){
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE);
|
|
|
|
|
}
|
|
|
|
|
if (!WishlistStatusEnum.LI_GUI_APPROVE.getCode().equals(wishlistDO.getWishlistStatus())){
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.TASK_STATUS_NOT_ALLOW_OPERATE);
|
|
|
|
|
}
|
|
|
|
|
Integer wishlistStatus = null;
|
|
|
|
|
//通过
|
|
|
|
|
if (request.getAuditStatus()==1){
|
|
|
|
|
//查看线索阶段是否完成 如果没有完成 直接跳过意向金和意向协议阶段
|
|
|
|
|
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(wishlistDO.getLineId());
|
|
|
|
|
if (Objects.isNull(lineInfo.getRegionId())||lineInfo.getRegionId() == 0){
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.LINE_REGION_NOT_EXIST);
|
|
|
|
|
}
|
|
|
|
|
lineInfo.setWorkflowStage(WorkflowStageEnum.STORE.getCode());
|
|
|
|
|
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_125.getCode());
|
|
|
|
|
lineInfo.setDevelopmentManager(lineInfo.getInvestmentManager());
|
|
|
|
|
lineInfoDAO.updateLineInfo(lineInfo);
|
|
|
|
|
//初始化店铺 AI店
|
|
|
|
|
lineInfo.setUseStandardStore(1);
|
|
|
|
|
Long shopId = shopService.initAiShop(lineInfo);
|
|
|
|
|
//选址阶段直接完成
|
|
|
|
|
PointRecommendLineRequest recommendLineRequest = new PointRecommendLineRequest();
|
|
|
|
|
recommendLineRequest.setShopIds(Arrays.asList(Long.valueOf(shopId)));
|
|
|
|
|
recommendLineRequest.setPointId(wishlistDO.getPointId());
|
|
|
|
|
recommendLineRequest.setDevelopmentManager(lineInfo.getDevelopmentManager());
|
|
|
|
|
//推荐逻辑
|
|
|
|
|
pointService.pointRecommendLine(recommendLineRequest);
|
|
|
|
|
SelectPointRequest selectPointRequest = new SelectPointRequest();
|
|
|
|
|
selectPointRequest.setPointId(wishlistDO.getPointId());
|
|
|
|
|
selectPointRequest.setLineId(wishlistDO.getLineId());
|
|
|
|
|
selectPointRequest.setShopId(shopId);
|
|
|
|
|
//选址
|
|
|
|
|
pointService.lineSelectPoint(selectPointRequest);
|
|
|
|
|
//修改心愿单状态
|
|
|
|
|
wishlistStatus = WishlistStatusEnum.PASS.getCode();
|
|
|
|
|
}
|
|
|
|
|
if (request.getAuditStatus()==0){
|
|
|
|
|
wishlistStatus = WishlistStatusEnum.REJECT.getCode();
|
|
|
|
|
}
|
|
|
|
|
wishlistDO.setWishlistStatus(wishlistStatus);
|
|
|
|
|
wishlistDO.setRemark(request.getRemark());
|
|
|
|
|
wishlistDO.setUpdateTime(new Date());
|
|
|
|
|
storeWishlistDAO.updateByExampleSelective(wishlistDO);
|
|
|
|
|
return Boolean.TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public MiniStoreWishlistDetailVO getCurrentShopBindWishlist(Long shopId) {
|
|
|
|
|
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
|
|
|
|
|
if (shopInfo == null) {
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE);
|
|
|
|
|
}
|
|
|
|
|
if (shopInfo.getPointId()==null){
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
StoreWishlistDO storelistDO = storeWishlistDAO.getByPointId(shopInfo.getLineId(), shopInfo.getPointId());
|
|
|
|
|
return convert(storelistDO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private MiniStoreWishlistDetailVO convert(StoreWishlistDO storeWishlistDO){
|
|
|
|
|
if (storeWishlistDO==null){
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
MiniStoreWishlistDetailVO vo = new MiniStoreWishlistDetailVO();
|
|
|
|
|
vo.setStoreTypeId(storeTypeId);
|
|
|
|
|
vo.setVersionNo(versionNo);
|
|
|
|
|
StoreWishlistDO storeWishlistDO = rows.get(0);
|
|
|
|
|
if (storeWishlistDO!=null){
|
|
|
|
|
vo.setTotalAmount(storeWishlistDO.getTotalAmount());
|
|
|
|
|
vo.setCreateTime(storeWishlistDO.getCreateTime());
|
|
|
|
|
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(storeWishlistDO.getLineId());
|
|
|
|
|
if (lineInfo!=null){
|
|
|
|
|
vo.setPartnerMobile(lineInfo.getMobile());
|
|
|
|
|
vo.setPartnerName(lineInfo.getUsername());
|
|
|
|
|
}
|
|
|
|
|
vo.setStoreTypeId(storeWishlistDO.getStoreTypeId());
|
|
|
|
|
vo.setId(storeWishlistDO.getId());
|
|
|
|
|
vo.setVersionNo(storeWishlistDO.getVersionNo());
|
|
|
|
|
vo.setTotalAmount(storeWishlistDO.getTotalAmount());
|
|
|
|
|
vo.setPointId(storeWishlistDO.getPointId());
|
|
|
|
|
vo.setWishlistStatus(storeWishlistDO.getWishlistStatus());
|
|
|
|
|
vo.setCreateTime(storeWishlistDO.getCreateTime());
|
|
|
|
|
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(storeWishlistDO.getLineId());
|
|
|
|
|
if (lineInfo != null) {
|
|
|
|
|
vo.setPartnerMobile(lineInfo.getMobile());
|
|
|
|
|
vo.setPartnerName(lineInfo.getUsername());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StoreTypeDO storeTypeDO = storeTypeDAO.getById(storeTypeId);
|
|
|
|
|
StoreTypeDO storeTypeDO = storeTypeDAO.getById(storeWishlistDO.getStoreTypeId());
|
|
|
|
|
MiniStoreWishlistDetailVO.FeeInfoVO feeInfo = new MiniStoreWishlistDetailVO.FeeInfoVO();
|
|
|
|
|
feeInfo.setFranchiseFee(storeTypeDO.getFranchiseFee());
|
|
|
|
|
feeInfo.setBrandUsageFee(storeTypeDO.getBrandUsageFee());
|
|
|
|
|
@@ -1397,8 +1617,20 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
|
|
|
|
|
feeInfo.setFirstOrderFee(storeTypeDO.getFirstOrderFee());
|
|
|
|
|
vo.setFeeInfoVO(feeInfo);
|
|
|
|
|
vo.setStoreTypeName(storeTypeDO.getStoreTypeName());
|
|
|
|
|
vo.setStoreType(storeTypeDO.getStoreType());
|
|
|
|
|
|
|
|
|
|
List<Long> optionIds = rows.stream().map(StoreWishlistDO::getOptionId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
|
|
if (storeWishlistDO.getPointId()!=null){
|
|
|
|
|
PointInfoDO pointInfoDO = pointInfoDAO.getPointInfoById(storeWishlistDO.getPointId());
|
|
|
|
|
vo.setShopId(pointInfoDO.getShopId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<StoreWishlistOptionDO> optionRows = storeWishlistOptionDAO.listByWishlistIds(Arrays.asList(storeWishlistDO.getId()));
|
|
|
|
|
if (CollectionUtils.isEmpty(optionRows)) {
|
|
|
|
|
vo.setOptions(Collections.emptyList());
|
|
|
|
|
return vo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Long> optionIds = optionRows.stream().map(StoreWishlistOptionDO::getOptionId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
|
|
Map<Long, ConfigOptionDO> optionMap = new HashMap<>();
|
|
|
|
|
List<ConfigOptionDO> options = new ArrayList<>();
|
|
|
|
|
if (CollectionUtils.isNotEmpty(optionIds)) {
|
|
|
|
|
@@ -1406,7 +1638,7 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
|
|
|
|
|
optionMap = options.stream().collect(Collectors.toMap(ConfigOptionDO::getId, Function.identity(), (a, b) -> a));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<StoreTypeOptionDO> bindings = storeTypeOptionDAO.listByStoreTypeId(storeTypeId);
|
|
|
|
|
List<StoreTypeOptionDO> bindings = storeTypeOptionDAO.listByStoreTypeId(storeWishlistDO.getStoreTypeId());
|
|
|
|
|
Map<Long, StoreTypeOptionDO> bindingMap = bindings.stream()
|
|
|
|
|
.collect(Collectors.toMap(StoreTypeOptionDO::getOptionId, Function.identity(), (a, b) -> a));
|
|
|
|
|
|
|
|
|
|
@@ -1417,7 +1649,7 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
|
|
|
|
|
Map<String, String> itemCodeMap = configItemDAO.nameMap(itemCodeList);
|
|
|
|
|
|
|
|
|
|
List<MiniStoreWishlistDetailVO.OptionVO> list = new ArrayList<>();
|
|
|
|
|
for (StoreWishlistDO row : rows) {
|
|
|
|
|
for (StoreWishlistOptionDO row : optionRows) {
|
|
|
|
|
MiniStoreWishlistDetailVO.OptionVO item = new MiniStoreWishlistDetailVO.OptionVO();
|
|
|
|
|
BigDecimal quantity = row.getQuantity();
|
|
|
|
|
item.setOptionId(row.getOptionId());
|
|
|
|
|
@@ -1431,16 +1663,14 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
|
|
|
|
|
item.setCategoryCode(cfg.getCategoryCode());
|
|
|
|
|
item.setItemCode(cfg.getItemCode());
|
|
|
|
|
}
|
|
|
|
|
if (storeTypeOptionDO!=null){
|
|
|
|
|
if (storeTypeOptionDO != null && cfg != null) {
|
|
|
|
|
BigDecimal price = storeTypeOptionDO.getOptionPrice();
|
|
|
|
|
BigDecimal amount = BigDecimal.ZERO;
|
|
|
|
|
BigDecimal defaultQty = storeTypeOptionDO.getDefaultQuantity();
|
|
|
|
|
//原价
|
|
|
|
|
BigDecimal originalPrice = cfg.getOriginalOptionPrice();
|
|
|
|
|
if(quantity.compareTo(defaultQty)<=0){
|
|
|
|
|
if (quantity.compareTo(defaultQty) <= 0) {
|
|
|
|
|
amount = price.multiply(quantity);
|
|
|
|
|
}else {
|
|
|
|
|
// 店型优惠价*默认数量 + 原价 *(选择数量-默认数量)
|
|
|
|
|
} else {
|
|
|
|
|
amount = price.multiply(defaultQty).add(originalPrice.multiply(quantity.subtract(defaultQty)));
|
|
|
|
|
}
|
|
|
|
|
item.setOptionPrice(price);
|
|
|
|
|
@@ -1454,100 +1684,6 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
|
|
|
|
|
return vo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<MiniStoreWishlistListVO> wishlistList( PartnerUserInfoVO userInfoVO) {
|
|
|
|
|
if (userInfoVO == null || userInfoVO.getLineId() == null) {
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
|
|
|
|
List<MiniStoreWishlistListVO> wishlist = storeWishlistDAO.listByLineId(userInfoVO.getLineId(), null);
|
|
|
|
|
if (CollectionUtils.isEmpty(wishlist)) {
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (MiniStoreWishlistListVO item : wishlist) {
|
|
|
|
|
List<StoreWishlistDO> rows = storeWishlistDAO.listByLineIdAndStoreTypeAndVersion(userInfoVO.getLineId(), item.getStoreTypeId(), item.getVersionNo());
|
|
|
|
|
if (CollectionUtils.isEmpty(rows)) {
|
|
|
|
|
item.setOptions(Collections.emptyList());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Long> optionIds = rows.stream().map(StoreWishlistDO::getOptionId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
|
|
Map<Long, ConfigOptionDO> optionMap = new HashMap<>();
|
|
|
|
|
if (CollectionUtils.isNotEmpty(optionIds)) {
|
|
|
|
|
List<ConfigOptionDO> options = configOptionDAO.listActiveByIds(optionIds);
|
|
|
|
|
optionMap = options.stream().collect(Collectors.toMap(ConfigOptionDO::getId, Function.identity(), (a, b) -> a));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<MiniStoreWishlistListVO.OptionVO> optionList = new ArrayList<>();
|
|
|
|
|
for (StoreWishlistDO row : rows) {
|
|
|
|
|
MiniStoreWishlistListVO.OptionVO vo = new MiniStoreWishlistListVO.OptionVO();
|
|
|
|
|
vo.setOptionId(row.getOptionId());
|
|
|
|
|
vo.setQuantity(row.getQuantity());
|
|
|
|
|
ConfigOptionDO cfg = optionMap.get(row.getOptionId());
|
|
|
|
|
if (cfg != null) {
|
|
|
|
|
vo.setOptionName(cfg.getOptionName());
|
|
|
|
|
vo.setOptionPrice(cfg.getOptionPrice());
|
|
|
|
|
vo.setImageUrl(cfg.getImageUrl());
|
|
|
|
|
}
|
|
|
|
|
optionList.add(vo);
|
|
|
|
|
}
|
|
|
|
|
item.setOptions(optionList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return wishlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageInfo<MiniStoreWishlistListVO> wishAllList(WishAllListRequest request) {
|
|
|
|
|
PageHelper.startPage(request.getPageNum(),request.getPageSize());
|
|
|
|
|
List<String> distinctVersion = storeWishlistDAO.getDistinctVersion(request.getKeyword(),request.getStoreTypeId());
|
|
|
|
|
if (CollectionUtils.isEmpty(distinctVersion)){
|
|
|
|
|
return new PageInfo<>();
|
|
|
|
|
}
|
|
|
|
|
PageInfo result = new PageInfo<>(distinctVersion);
|
|
|
|
|
List<MiniStoreWishlistListVO> wishlist = storeWishlistDAO.listByVersionList(distinctVersion);
|
|
|
|
|
|
|
|
|
|
List<Long> lineIdList = wishlist.stream().map(MiniStoreWishlistListVO::getLineId).collect(Collectors.toList());
|
|
|
|
|
List<LineInfoDO> lineList = lineInfoDAO.getByLineIds(lineIdList);
|
|
|
|
|
Map<Long, LineInfoDO> map = lineList.stream().collect(Collectors.toMap(LineInfoDO::getId, data -> data));
|
|
|
|
|
for (MiniStoreWishlistListVO item : wishlist) {
|
|
|
|
|
LineInfoDO lineInfoDO = map.get(item.getLineId());
|
|
|
|
|
if (lineInfoDO!=null){
|
|
|
|
|
item.setPartnerMobile(lineInfoDO.getMobile());
|
|
|
|
|
item.setPartnerName(lineInfoDO.getUsername());
|
|
|
|
|
}
|
|
|
|
|
List<StoreWishlistDO> rows = storeWishlistDAO.listByLineIdAndStoreTypeAndVersion(item.getLineId(), item.getStoreTypeId(), item.getVersionNo());
|
|
|
|
|
if (CollectionUtils.isEmpty(rows)) {
|
|
|
|
|
item.setOptions(Collections.emptyList());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Long> optionIds = rows.stream().map(StoreWishlistDO::getOptionId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
|
|
Map<Long, ConfigOptionDO> optionMap = new HashMap<>();
|
|
|
|
|
if (CollectionUtils.isNotEmpty(optionIds)) {
|
|
|
|
|
List<ConfigOptionDO> options = configOptionDAO.listActiveByIds(optionIds);
|
|
|
|
|
optionMap = options.stream().collect(Collectors.toMap(ConfigOptionDO::getId, Function.identity(), (a, b) -> a));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<MiniStoreWishlistListVO.OptionVO> optionList = new ArrayList<>();
|
|
|
|
|
for (StoreWishlistDO row : rows) {
|
|
|
|
|
MiniStoreWishlistListVO.OptionVO vo = new MiniStoreWishlistListVO.OptionVO();
|
|
|
|
|
vo.setOptionId(row.getOptionId());
|
|
|
|
|
vo.setQuantity(row.getQuantity());
|
|
|
|
|
ConfigOptionDO cfg = optionMap.get(row.getOptionId());
|
|
|
|
|
if (cfg != null) {
|
|
|
|
|
vo.setOptionName(cfg.getOptionName());
|
|
|
|
|
vo.setOptionPrice(cfg.getOptionPrice());
|
|
|
|
|
vo.setImageUrl(cfg.getImageUrl());
|
|
|
|
|
}
|
|
|
|
|
optionList.add(vo);
|
|
|
|
|
}
|
|
|
|
|
item.setOptions(optionList);
|
|
|
|
|
}
|
|
|
|
|
result.setList(wishlist);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private BigDecimal safe(BigDecimal v) {
|
|
|
|
|
return v == null ? BigDecimal.ZERO : v;
|
|
|
|
|
|