|
@@ -477,9 +477,9 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void exportFile(StoreOrderDTO dto, HttpServletResponse response) {
|
|
public void exportFile(StoreOrderDTO dto, HttpServletResponse response) {
|
|
|
- PageInfo<StoreOrderVO> page = orderList(dto);
|
|
|
|
|
|
|
+ PageInfo<StoreOrderVO> page = exportOrderList(dto);
|
|
|
List<StoreOrderVO> list = page.getList();
|
|
List<StoreOrderVO> list = page.getList();
|
|
|
- List<String> rowHead = CollUtil.newArrayList("ID", "订单号", "用户ID", "用户注册手机号", "订单状态", "订单金额", "下单时间", "支付时间", "商品ID", "商品名称", "商品规格", "购买数量", "收件人姓名", "收件人手机", "收件人详细地址", "邮编", "快递公司", "快递单号");
|
|
|
|
|
|
|
+ List<String> rowHead = CollUtil.newArrayList("ID", "订单号", "用户ID", "用户注册手机号", "订单状态", "订单金额", "下单时间", "支付时间", "商品ID", "商品名称", "商品规格", "商品供应商", "购买数量", "收件人姓名", "收件人手机", "收件人详细地址", "邮编", "快递公司", "快递单号");
|
|
|
ExcelWriter writer = ExcelUtil.getWriter();
|
|
ExcelWriter writer = ExcelUtil.getWriter();
|
|
|
try {
|
|
try {
|
|
|
writer.writeHeadRow(rowHead);
|
|
writer.writeHeadRow(rowHead);
|
|
@@ -505,6 +505,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
storeOrderInfo.getProductId(),
|
|
storeOrderInfo.getProductId(),
|
|
|
storeOrderInfo.getProductName(),
|
|
storeOrderInfo.getProductName(),
|
|
|
storeOrderInfo.getSku(),
|
|
storeOrderInfo.getSku(),
|
|
|
|
|
+ storeOrderInfo.getItemSupplier(),
|
|
|
storeOrderInfo.getPayNum(),
|
|
storeOrderInfo.getPayNum(),
|
|
|
|
|
|
|
|
(orderAddressVO == null || StringUtils.isBlank(orderAddressVO.getRealName())) ? "" : orderAddressVO.getRealName(),
|
|
(orderAddressVO == null || StringUtils.isBlank(orderAddressVO.getRealName())) ? "" : orderAddressVO.getRealName(),
|
|
@@ -1339,6 +1340,123 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
return storeOrderPageInfo;
|
|
return storeOrderPageInfo;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public PageInfo<StoreOrderVO> exportOrderList(StoreOrderDTO dto) {
|
|
|
|
|
+ Condition condition = new Condition(StoreOrder.class);
|
|
|
|
|
+ Example.Criteria criteria = condition.createCriteria();
|
|
|
|
|
+ criteria.andEqualTo("isDelete", 0);
|
|
|
|
|
+ condition.setOrderByClause("create_time DESC");
|
|
|
|
|
+ if (dto.getId() != null) {
|
|
|
|
|
+ criteria.andEqualTo("id", dto.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StrUtil.isNotBlank(dto.getDeliveryName())) {
|
|
|
|
|
+ criteria.andEqualTo("deliveryName", dto.getDeliveryName());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StrUtil.isNotBlank(dto.getRealName())) {
|
|
|
|
|
+ criteria.andEqualTo("realName", dto.getRealName());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (dto.getOrderId() != null) {
|
|
|
|
|
+ criteria.andEqualTo("orderId", dto.getOrderId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (dto.getStatus() != null) {
|
|
|
|
|
+ criteria.andEqualTo("status", dto.getStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (dto.getPaid() != null) {
|
|
|
|
|
+ criteria.andEqualTo("paid", dto.getPaid());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (dto.getRefundStatus() != null) {
|
|
|
|
|
+ criteria.andEqualTo("refundStatus", dto.getRefundStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (dto.getUid() != null) {
|
|
|
|
|
+ criteria.andEqualTo("uid", dto.getUid());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (dto.getUserPhone() != null) {
|
|
|
|
|
+ criteria.andEqualTo("userPhone", dto.getUserPhone());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (dto.getDeliveryId() != null) {
|
|
|
|
|
+ criteria.andEqualTo("deliveryId", dto.getDeliveryId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (dto.getStartTime() != null && dto.getEndTime() != null) {
|
|
|
|
|
+ criteria.andBetween("createTime", dto.getStartTime(), dto.getEndTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (dto.getPayStartTime() != null && dto.getPayEndTime() != null) {
|
|
|
|
|
+ criteria.andBetween("payTime", dto.getPayStartTime(), dto.getPayEndTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (dto.getDeliveryStartTime() != null && dto.getDeliveryEndTime() != null) {
|
|
|
|
|
+ criteria.andBetween("deliveryTime", dto.getDeliveryStartTime(), dto.getDeliveryEndTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (dto.getFinishStartTime() != null && dto.getFinishEndTime() != null) {
|
|
|
|
|
+ criteria.andBetween("signingTime", dto.getFinishStartTime(), dto.getFinishEndTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ PageHelper.startPage(dto.getPage(), dto.getSize());
|
|
|
|
|
+ List<StoreOrder> list = findByCondition(condition);
|
|
|
|
|
+ PageInfo storeOrderPageInfo = new PageInfo<>(list);
|
|
|
|
|
+
|
|
|
|
|
+ List<StoreOrderVO> arrayList = new ArrayList<>();
|
|
|
|
|
+ List<StoreOrderInfo> infoArrayList = new ArrayList<>();
|
|
|
|
|
+ List<StoreOrderStatus> statusList = new ArrayList<>();
|
|
|
|
|
+ List<UserAddress> addressList = new ArrayList<>();
|
|
|
|
|
+ Map<Long, StorePink> storePinkMap = new HashMap<>();
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
|
+ List<String> orderIdList = list.stream().map(StoreOrder::getOrderId).collect(Collectors.toList());
|
|
|
|
|
+ if (!org.springframework.util.CollectionUtils.isEmpty(orderIdList)) {
|
|
|
|
|
+ Condition infoCondition = new Condition(StoreOrderInfo.class);
|
|
|
|
|
+ Example.Criteria infoCriteria = infoCondition.createCriteria();
|
|
|
|
|
+ infoCriteria.andEqualTo("isDelete", 0);
|
|
|
|
|
+ infoCriteria.andIn("orderNo", orderIdList);
|
|
|
|
|
+ infoArrayList = storeOrderInfoService.findByCondition(infoCondition);
|
|
|
|
|
+
|
|
|
|
|
+ infoArrayList.forEach(info -> {
|
|
|
|
|
+ info.setItemSupplier(storeProductService.findById(info.getProductId()).getItemSupplier());
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ Condition statusCondition = new Condition(StoreOrderStatus.class);
|
|
|
|
|
+ Example.Criteria statusCriteria = statusCondition.createCriteria();
|
|
|
|
|
+ statusCriteria.andIn("orderId", orderIdList);
|
|
|
|
|
+ statusList = storeOrderStatusService.findByCondition(statusCondition);
|
|
|
|
|
+
|
|
|
|
|
+ Condition infoConditionStorePink = new Condition(StorePink.class);
|
|
|
|
|
+ Example.Criteria infoCriteriaStorePink = infoConditionStorePink.createCriteria();
|
|
|
|
|
+ infoCriteriaStorePink.andEqualTo("isDelete", 0);
|
|
|
|
|
+ infoCriteriaStorePink.andIn("orderId", orderIdList);
|
|
|
|
|
+ List<StorePink> byCondition = storePinkService.findByCondition(infoConditionStorePink);
|
|
|
|
|
+ if (!org.springframework.util.CollectionUtils.isEmpty(byCondition)) {
|
|
|
|
|
+ storePinkMap = byCondition.stream().collect(Collectors.toMap(StorePink::getOrderIdKey, a -> a, (b, c) -> c));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Condition addressCondition = new Condition(UserAddress.class);
|
|
|
|
|
+ Example.Criteria addressCriteria = addressCondition.createCriteria();
|
|
|
|
|
+ addressCriteria.andEqualTo("isDelete", 0);
|
|
|
|
|
+ List<Long> collect = list.stream().map(StoreOrder::getAddressId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
|
|
+ if (!org.springframework.util.CollectionUtils.isEmpty(collect)) {
|
|
|
|
|
+ addressCriteria.andIn("id", collect);
|
|
|
|
|
+ addressList = userAddressService.findByCondition(addressCondition);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ List<StoreOrderInfo> finalInfoArrayList = infoArrayList;
|
|
|
|
|
+ List<StoreOrderStatus> finalStatusList = statusList;
|
|
|
|
|
+ List<UserAddress> finalAddressList = addressList;
|
|
|
|
|
+ Map<Long, StorePink> finalStorePinkMap = storePinkMap;
|
|
|
|
|
+ list.forEach(item -> {
|
|
|
|
|
+ StoreOrderVO vo = new StoreOrderVO();
|
|
|
|
|
+ BeanUtils.copyProperties(item, vo);
|
|
|
|
|
+ List<StoreOrderInfo> infoCollect = finalInfoArrayList.stream().filter(info -> info.getOrderId().equals(item.getId())).collect(Collectors.toList());
|
|
|
|
|
+ vo.setOrderInfoVO(infoCollect);
|
|
|
|
|
+ vo.setOrderStatusVO(finalStatusList.stream().filter(status -> status.getOid().equals(item.getId())).collect(Collectors.toList()));
|
|
|
|
|
+ vo.setBrokerage(BigDecimal.ONE);
|
|
|
|
|
+ vo.setOrderAddressVO(finalAddressList.stream().filter(address -> address.getId().equals(item.getAddressId())).findFirst().orElse(null));
|
|
|
|
|
+ vo.setStorePink(finalStorePinkMap.get(item.getId()));
|
|
|
|
|
+
|
|
|
|
|
+ arrayList.add(vo);
|
|
|
|
|
+ });
|
|
|
|
|
+ storeOrderPageInfo.setList(arrayList);
|
|
|
|
|
+
|
|
|
|
|
+ return storeOrderPageInfo;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @ApiModelProperty(value = "类型 0-全部all 1-待支付topay 2-拼团成功success 3-拼团失败failed 4-拼团奖励reward")
|
|
* @ApiModelProperty(value = "类型 0-全部all 1-待支付topay 2-拼团成功success 3-拼团失败failed 4-拼团奖励reward")
|
|
|
* private Integer type;
|
|
* private Integer type;
|