Browse Source

导出

master
dimengzhe 2 years ago
parent
commit
064ab766e8
  1. 28
      mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/impl/OmsOrderServiceImpl.java
  2. 2
      mallplus-mbg/src/main/java/com/zscat/mallplus/oms/mapper/OmsOrderMapper.java
  3. 54
      mallplus-mbg/src/main/resources/mapper/oms/OmsOrderDao.xml

28
mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/impl/OmsOrderServiceImpl.java

@ -1,10 +1,12 @@
package com.zscat.mallplus.oms.service.impl; package com.zscat.mallplus.oms.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zscat.mallplus.enums.OrderStatus; import com.zscat.mallplus.enums.OrderStatus;
import com.zscat.mallplus.enums.StatusEnum; import com.zscat.mallplus.enums.StatusEnum;
import com.zscat.mallplus.oms.entity.OmsOrder; import com.zscat.mallplus.oms.entity.OmsOrder;
import com.zscat.mallplus.oms.entity.OmsOrderItem;
import com.zscat.mallplus.oms.entity.OmsOrderLocation; import com.zscat.mallplus.oms.entity.OmsOrderLocation;
import com.zscat.mallplus.oms.entity.OmsOrderOperateHistory; import com.zscat.mallplus.oms.entity.OmsOrderOperateHistory;
import com.zscat.mallplus.oms.mapper.OmsOrderMapper; import com.zscat.mallplus.oms.mapper.OmsOrderMapper;
@ -373,7 +375,18 @@ public class OmsOrderServiceImpl extends ServiceImpl<OmsOrderMapper, OmsOrder> i
} else { } else {
orders = orderMapper.listExcel(qw.eq("omo.status", omsOrderQuery.getStatus())); orders = orderMapper.listExcel(qw.eq("omo.status", omsOrderQuery.getStatus()));
} }
return orders; List<OrderExcelVo> list = new ArrayList<>();
for (OrderExcelVo orderExcelVo : orders){
List<OmsOrderItem> omsOrderItemList = baseMapper.selectOmsOrderItem(orderExcelVo.getOrderSn());
for (OmsOrderItem omsOrderItem : omsOrderItemList){
OrderExcelVo excelVo = new OrderExcelVo();
BeanUtil.copyProperties(orderExcelVo,excelVo);
excelVo.setGoodsName(omsOrderItem.getProductName());
excelVo.setProductQuantity(omsOrderItem.getProductQuantity().toString());
list.add(excelVo);
}
}
return list;
} }
@Override @Override
@ -395,6 +408,17 @@ public class OmsOrderServiceImpl extends ServiceImpl<OmsOrderMapper, OmsOrder> i
} else { } else {
orders = orderMapper.listExcel(qw.eq("omo.status", omsOrderLocationQuery.getStatus())); orders = orderMapper.listExcel(qw.eq("omo.status", omsOrderLocationQuery.getStatus()));
} }
return orders; List<OrderExcelVo> list = new ArrayList<>();
for (OrderExcelVo orderExcelVo : orders){
List<OmsOrderItem> omsOrderItemList = baseMapper.selectOmsOrderItem(orderExcelVo.getOrderSn());
for (OmsOrderItem omsOrderItem : omsOrderItemList){
OrderExcelVo excelVo = new OrderExcelVo();
BeanUtil.copyProperties(orderExcelVo,excelVo);
excelVo.setGoodsName(omsOrderItem.getProductName());
excelVo.setProductQuantity(omsOrderItem.getProductQuantity().toString());
list.add(excelVo);
}
}
return list;
} }
} }

2
mallplus-mbg/src/main/java/com/zscat/mallplus/oms/mapper/OmsOrderMapper.java

@ -84,4 +84,6 @@ public interface OmsOrderMapper extends BaseMapper<OmsOrder> {
List<OmsOrderLocation> getPickupPoint(String id); List<OmsOrderLocation> getPickupPoint(String id);
List<OrderExcelVo> listExcel(@Param(Constants.WRAPPER) QueryWrapper<OmsOrder> qw); List<OrderExcelVo> listExcel(@Param(Constants.WRAPPER) QueryWrapper<OmsOrder> qw);
List<OmsOrderItem> selectOmsOrderItem(String orderSn);
} }

54
mallplus-mbg/src/main/resources/mapper/oms/OmsOrderDao.xml

@ -308,34 +308,38 @@
</select> </select>
<select id="listExcel" resultType="com.zscat.mallplus.oms.vo.OrderExcelVo"> <select id="listExcel" resultType="com.zscat.mallplus.oms.vo.OrderExcelVo">
select omo.order_sn orderSn, select distinct omo.order_sn orderSn,
omo.create_time createTime, omo.create_time createTime,
omo.receiver_phone receiverPhone, omo.receiver_phone receiverPhone,
omo.member_username memberUsername, omo.member_username memberUsername,
omo.goods_name goodsName, omo.goods_name goodsName,
omo.total_amount totalAmount, omo.total_amount totalAmount,
omo.receiver_detail_address receiverDetailAddress, omo.receiver_detail_address receiverDetailAddress,
case omo.status case omo.status
when 1 then '支付成功,没有回调' when 1 then '支付成功,没有回调'
when 2 then '待发货' when 2 then '待发货'
when 3 then '待收货' when 3 then '待收货'
when 4 then '待评价' when 4 then '待评价'
when 5 then '已完成' when 5 then '已完成'
when 6 then '维权中' when 6 then '维权中'
when 7 then '维权已完成' when 7 then '维权已完成'
when 8 then '待分享' when 8 then '待分享'
when 13 then '申请退款' when 13 then '申请退款'
when 14 then '已退款' when 14 then '已退款'
when 15 then '已关闭' when 15 then '已关闭'
when 16 then '无效订单' when 16 then '无效订单'
when 17 then '已删除' when 17 then '已删除'
when 12 then '待付款' when 12 then '待付款'
end as statusName, end as statusName
ooi.product_quantity productQuantity
from oms_order omo from oms_order omo
left join oms_order_item ooi on ooi.order_sn = omo.order_sn
<where> <where>
${ew.sqlSegment} ${ew.sqlSegment}
</where> </where>
</select> </select>
<select id="selectOmsOrderItem" resultType="com.zscat.mallplus.oms.entity.OmsOrderItem">
select *
from oms_order_item
where order_sn = #{orderSn}
</select>
</mapper> </mapper>

Loading…
Cancel
Save