Commit 320db2cf by huluobin

update

parent 70551d5a
......@@ -7,10 +7,12 @@ import com.gogirl.application.order.mall.IMallOrderTechnicianService;
import com.gogirl.domain.order.mall.MallOrder;
import com.gogirl.domain.order.mall.MallOrderDetail;
import com.gogirl.domain.order.mall.MallOrderTechnician;
import com.gogirl.domain.user.customer.Customer;
import com.gogirl.infrastructure.common.util.ListUtil;
import com.gogirl.infrastructure.mapper.order.mall.MallOrderDetailMapper;
import com.gogirl.infrastructure.mapper.order.mall.MallOrderMapper;
import com.gogirl.infrastructure.mapper.order.mall.MallOrderTechnicianMapper;
import com.gogirl.infrastructure.mapper.user.customer.CustomerMapper;
import com.gogirl.shared.order.mall.QueryMallOrderAchievementRequest;
import org.springframework.stereotype.Service;
......@@ -36,6 +38,9 @@ public class MallOrderTechnicianServiceImpl extends ServiceImpl<MallOrderTechnic
MallOrderMapper mallOrderMapper;
@Resource
MallOrderDetailMapper mallOrderDetailMapper;
@Resource
CustomerMapper customerMapper;
@Override
public Page<MallOrderTechnician> queryMallOrderAchievement(QueryMallOrderAchievementRequest request) {
......@@ -43,6 +48,7 @@ public class MallOrderTechnicianServiceImpl extends ServiceImpl<MallOrderTechnic
List<Long> mallOrderIdList = mallOrderTechnicianList.getRecords().stream()
.map(MallOrderTechnician::getMallOrderId).filter(Objects::nonNull).collect(Collectors.toList());
if (ListUtil.isNotEmpty(mallOrderIdList)) {
Map<Long, MallOrder> mallOrderMap = mallOrderMapper.selectBatchIds(mallOrderIdList)
.stream()
......@@ -52,13 +58,20 @@ public class MallOrderTechnicianServiceImpl extends ServiceImpl<MallOrderTechnic
.stream()
.collect(Collectors.groupingBy(MallOrderDetail::getOrderId));
List<Integer> customerIdList = mallOrderMap.values().stream().map(MallOrder::getCustomerId).collect(Collectors.toList());
Map<Integer, Customer> customerMap = customerMapper.selectBatchIds(customerIdList)
.stream()
.collect(Collectors.toMap(Customer::getId, customer -> customer, (k1, k2) -> k1));
mallOrderMap.forEach((mallOrderId, mallOrder) -> {
mallOrder.setMallOrderDetailList(mallOrderDetailMap.get(mallOrderId));
mallOrder.setCustomer(customerMap.get(mallOrder.getCustomerId()));
});
mallOrderTechnicianList.getRecords().forEach(mallOrderTechnician -> mallOrderTechnician.setMallOrder(mallOrderMap.get(mallOrderTechnician.getMallOrderId())));
mallOrderTechnicianList.getRecords().forEach(mallOrderTechnician -> {
mallOrderTechnician.setMallOrder(mallOrderMap.get(mallOrderTechnician.getMallOrderId())
}));
}
return mallOrderTechnicianList;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment