|
|
@@ -3,11 +3,13 @@ package com.ruoyi.web.controller.shop.order;
|
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.excel.util.DateUtils;
|
|
|
+import com.ruoyi.business.service.IBusinessService;
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
@@ -39,6 +41,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import javax.activation.MimetypesFileTypeMap;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
+import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.util.*;
|
|
|
@@ -61,6 +64,7 @@ public class ShopOrderController extends BaseController {
|
|
|
|
|
|
private final IShopOrderService iShopOrderService;
|
|
|
private final ISaleRightsOrderService rightsOrderService;
|
|
|
+ private final IBusinessService iBusinessService;
|
|
|
|
|
|
private final ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
|
|
|
|
|
@@ -113,9 +117,15 @@ public class ShopOrderController extends BaseController {
|
|
|
@SaCheckPermission("order:shopOrder:chainPlatformPage")
|
|
|
@GetMapping("/chain-page")
|
|
|
public TableDataInfo<ShopOrderVo> chainPage(@Validated(QueryGroup.class) ShopOrderBo bo, PageQuery pageQuery) {
|
|
|
- if (ObjectUtil.isNull(bo.getBusinessId())) {
|
|
|
- throw new RuntimeException("请选择连锁店");
|
|
|
+ if(bo.getBusinessId() == null) {
|
|
|
+ List<Long> ids = iBusinessService.queryBusinessIdsByBusinessId(getBusinessId(true));
|
|
|
+ if (CollectionUtil.isEmpty(ids)) {
|
|
|
+ ids.add(0L);
|
|
|
+ }
|
|
|
+ bo.setBusinessIds(ids);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
bo.setOrderType(OrderType.NORMAL);
|
|
|
if(ObjectUtil.isNotNull(bo.getStartTime()))
|
|
|
{
|
|
|
@@ -517,13 +527,47 @@ public class ShopOrderController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 导出订单列表
|
|
|
+ * 平台导出订单列表
|
|
|
*/
|
|
|
- @ApiOperation("导出订单列表")
|
|
|
+ @ApiOperation("平台导出订单列表")
|
|
|
@SaCheckPermission("order:shopOrder:export")
|
|
|
@Log(title = "订单", businessType = BusinessType.EXPORT)
|
|
|
@GetMapping("/export")
|
|
|
public void export(@Validated ShopOrderBo bo, HttpServletResponse response) throws Exception {
|
|
|
+ exportHandle(bo, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 店铺导出订单列表
|
|
|
+ */
|
|
|
+ @ApiOperation("店铺导出订单列表")
|
|
|
+ @SaCheckPermission("order:shopOrder:businessExport")
|
|
|
+ @Log(title = "订单", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/businessExport")
|
|
|
+ public void businessExport(@Validated ShopOrderBo bo, HttpServletResponse response) throws Exception {
|
|
|
+ bo.setBusinessId(getBusinessId(true));
|
|
|
+ exportHandle(bo, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 总店导出连锁店订单列表
|
|
|
+ */
|
|
|
+ @ApiOperation("导出订单列表")
|
|
|
+ @SaCheckPermission("order:shopOrder:chainExport")
|
|
|
+ @Log(title = "订单", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/chainExport")
|
|
|
+ public void chainExport(@Validated ShopOrderBo bo, HttpServletResponse response) throws Exception {
|
|
|
+ if(bo.getBusinessId() == null) {
|
|
|
+ List<Long> ids = iBusinessService.queryBusinessIdsByBusinessId(getBusinessId(true));
|
|
|
+ if (CollectionUtil.isEmpty(ids)) {
|
|
|
+ ids.add(0L);
|
|
|
+ }
|
|
|
+ bo.setBusinessIds(ids);
|
|
|
+ }
|
|
|
+ exportHandle(bo, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void exportHandle(ShopOrderBo bo, HttpServletResponse response) throws IOException {
|
|
|
bo.setOrderType(OrderType.NORMAL);
|
|
|
if(ObjectUtil.isNotNull(bo.getStartTime()))
|
|
|
{
|