|
@@ -1,8 +1,12 @@
|
|
|
package com.sqx.modules.order.service.impl;
|
|
package com.sqx.modules.order.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
+import cn.hutool.core.util.URLUtil;
|
|
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
|
|
+import com.alibaba.excel.converters.longconverter.LongStringConverter;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -111,8 +115,13 @@ import org.springframework.transaction.TransactionStatus;
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
|
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
|
|
|
|
+import org.springframework.web.context.request.RequestAttributes;
|
|
|
|
|
+import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
|
+import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
@@ -2892,6 +2901,34 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
|
|
|
return pageUtils;
|
|
return pageUtils;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void exportGoodsSkuSalesCount(GoodsSkuQuery query) {
|
|
|
|
|
+ Page<GoodsSkuSalesCountVO> pages = new Page<>(query.getPage(), query.getLimit());
|
|
|
|
|
+ IPage<GoodsSkuSalesCountVO> page = baseMapper.getGoodsSkuSalesCount(pages, query);
|
|
|
|
|
+ List<GoodsSkuSalesCountVO> records = page.getRecords();
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
|
|
|
|
|
+ HttpServletResponse response = ((ServletRequestAttributes) requestAttributes).getResponse();
|
|
|
|
|
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
|
|
+ response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
|
|
|
|
+ response.setCharacterEncoding("UTF-8");
|
|
|
|
|
+
|
|
|
|
|
+ String excelName = "sku销售记录_";
|
|
|
|
|
+ excelName += DateUtil.format(new Date(), "yyyyMMddHHmmss");
|
|
|
|
|
+ String fileName = URLUtil.encode(excelName, "UTF-8");
|
|
|
|
|
+ response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
|
|
|
|
+
|
|
|
|
|
+ EasyExcel.write(response.getOutputStream(), GoodsSkuSalesCountVO.class)
|
|
|
|
|
+ .sheet("sheet1")
|
|
|
|
|
+ .registerConverter(new LongStringConverter())
|
|
|
|
|
+ .doWrite(records);
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ log.error("sku销售记录导出失败:{}", e.getMessage());
|
|
|
|
|
+ throw new SqxException("sku销售记录导出失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 更新订单状态和支付顺序
|
|
* 更新订单状态和支付顺序
|
|
|
*
|
|
*
|