记得上下班打卡 | git大法好,push需谨慎

Commit bd84163a authored by 胡佳晨's avatar 胡佳晨

Merge branch 'lmy_start' into dev_yy_dh

parents 6e2fcf9c 54beec84
package com.liquidnet.service.goblin.dto.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
@Data
@HeadRowHeight(value = 20)//设置表头行高
@ColumnWidth(value = 15)//设置表头行宽
public class OrderMallOrderVo {
@ExcelProperty(value = "订单编号",index = 0)
private String orderCode;
@ExcelProperty(value = "购买人手机号",index = 1)
private String userMobile;
@ExcelProperty(value = "快递费",index = 2)
private String priceExpress;
@ExcelProperty(value = "平台券优惠金额",index = 3)
private String priceCoupon;
@ExcelProperty(value = "店铺券优惠金额",index = 4)
private String storePriceCoupon;
@ExcelProperty(value = "收货人",index = 5)
private String expressContacts;
@ExcelProperty(value = "收货人电话",index = 6)
private String expressPhone;
@ExcelProperty(value = "快递地址",index = 7)
private String expressDetailAddress;
@ExcelProperty(value = "支付方式",index = 8)
private String payType;
@ExcelProperty(value = "支付时间",index = 9)
private String payTime;
@ExcelProperty(value = "下单时间",index = 10)
private String createdAt;
@ExcelProperty(value = "快递公司",index = 11)
private String logisticsCompany;
@ExcelProperty(value = "物流单号",index = 12)
private String mailNo;
@ExcelProperty(value = "商品id1",index = 13)
private String spuId;
@ExcelProperty(value = "商品名1",index = 14)
private String name;
@ExcelProperty(value = "一级分类1",index = 15)
private String cate1Name;
@ExcelProperty(value = "二级分类1",index = 16)
private String cate2Name;
@ExcelProperty(value = "款式1",index = 17)
private String skuName;
@ExcelProperty(value = "数量1",index = 18)
private String num;
@ExcelProperty(value = "单价1",index = 19)
private String skuPrice;
@ExcelProperty(value = "价格1",index = 20)
private String skuPriceActual;
@ExcelProperty(value = "订单skuId1",index = 21)
private String orderSkuId;
}
package com.liquidnet.service.goblin.service;
import com.liquidnet.service.base.ResponseDto;
import javax.servlet.http.HttpServletResponse;
public interface IGoblinExportService {
//导出商城订单信息
ResponseDto<Boolean> exportMallOrder(HttpServletResponse response, String beginTime, String endTime, String state, Integer mailType,String storeId);
}
package com.liquidnet.service.goblin.service;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.OrderMallOrderVo;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
public interface IGoblinImportService {
//导入对订单发货
ResponseDto<String> importExpress(MultipartFile file);
}
......@@ -32,7 +32,7 @@ public interface IGoblinStoreOrderService {
ResponseDto<Boolean> refundOrderSku(String orderId, String orderSkuId, BigDecimal price);
ResponseDto<Boolean> express(String orderId, String orderSkuIds,String mailNo);
ResponseDto<Boolean> express(String orderId, String orderSkuIds,String mailNo,String uid);
ResponseDto<Boolean> changeExpressMailNo(String orderId, String mailId,String mailNo);
......
......@@ -2,10 +2,14 @@ package com.liquidnet.client.admin.web.controller.zhengzai.tools;
import com.liquidnet.client.admin.common.core.controller.BaseController;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.exception.BusinessException;
import com.liquidnet.client.admin.common.utils.poi.ExcelUtil;
import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinExportService;
import com.liquidnet.client.admin.zhengzai.kylin.dto.*;
import com.liquidnet.client.admin.zhengzai.kylin.service.IExportService;
import com.liquidnet.service.goblin.dto.MallOrdertDao;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -13,16 +17,22 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;
@Controller
@RequestMapping("tools/export")
public class ExportDataController extends BaseController {
@Autowired
private IExportService exportService;
@Autowired
private IGoblinExportService iGoblinExportService;
private String prefix = "zhengzai/financial";
@GetMapping()
......@@ -80,6 +90,7 @@ public class ExportDataController extends BaseController {
return StringUtils.isNotBlank(beginTime) && StringUtils.isNotBlank(endTime) ? true : false;
}
/**
* 导出会员订单
*
......@@ -122,4 +133,21 @@ public class ExportDataController extends BaseController {
return util.exportExcel(list, "商品订单");
}
/**
* 导出商城订单信息
*
* @param beginTime
* @param endTime
* @return
*/
@PostMapping("/export/exportMallOrder")
@ResponseBody
public AjaxResult exportMallOrder(String beginTime, String endTime, String state, Integer mailType) {
if (!timeIsNotNull(beginTime, endTime)) { //todo 暂定只校验时间
return error("开始时间和结束时间不能为空!");
}
AjaxResult ajaxResult = iGoblinExportService.exportMallOrder(beginTime, endTime, state, mailType);
return ajaxResult;
}
}
package com.liquidnet.client.admin.zhengzai.goblin.service;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.service.goblin.dto.MallOrdertDao;
import java.util.List;
public interface IGoblinExportService {
//导出商城订单信息
AjaxResult exportMallOrder(String beginTime, String endTime, String state, Integer mailType);
}
package com.liquidnet.client.admin.zhengzai.goblin.service.impl;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.exception.BusinessException;
import com.liquidnet.client.admin.common.utils.poi.ExcelUtil;
import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinExportService;
import com.liquidnet.service.goblin.dto.MallOrdertDao;
import com.liquidnet.service.goblin.mapper.GoblinStoreOrderMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
@Slf4j
public class GoblinExportServiceImpl implements IGoblinExportService {
@Autowired
GoblinStoreOrderMapper goblinStoreOrderMapper;
@Override
public AjaxResult exportMallOrder(String beginTime, String endTime, String state, Integer mailType) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date beginDate = sdf.parse(beginTime);
Date endDate = sdf.parse(endTime);
List<String> states = null;
if (StringUtils.isNotBlank(state)) {
states = Arrays.asList(state.split(","));
}
List<MallOrdertDao> voList = goblinStoreOrderMapper.exportMallOrder(beginDate, endDate, states ,mailType);
AjaxResult ajaxResult = null;
Map<String, List<String>> map = new HashMap<>();
int max = 0;
//将数据保存到list中
if (voList != null && voList.size() > 0) {
for (MallOrdertDao te : voList) {
String orderCode = te.getOrderCode();
if (map.get(orderCode) == null) {
List<String> list = new ArrayList<>();
list.add(te.getOrderCode());
list.add(te.getUserMobile());
list.add(te.getPriceExpress());
list.add(te.getPriceCoupon());
list.add(te.getStorePriceCoupon());
list.add(te.getExpressContacts());
list.add(te.getExpressPhone());
list.add(te.getExpressDetailAddress());
list.add(te.getPayType());
list.add(te.getPayTime());
list.add(te.getCreatedAt());
list.add(te.getLogisticsCompany());
list.add(te.getMailNo());
list.add(te.getSpuId());
list.add(te.getName());
list.add(te.getCate1Name());
list.add(te.getCate2Name());
list.add(te.getSkuName());
list.add(te.getNum());
list.add(te.getSkuPrice());
list.add(te.getSkuPriceActual());
list.add(te.getOrderSkuId());
max = Math.max(max, list.size());
map.put(orderCode, list);
continue;
}
if (map.get(orderCode) != null) {
List<String> list = map.get(orderCode);
list.add(te.getSpuId());
list.add(te.getName());
list.add(te.getCate1Name());
list.add(te.getCate2Name());
list.add(te.getSkuName());
list.add(te.getNum());
list.add(te.getSkuPrice());
list.add(te.getSkuPriceActual());
list.add(te.getOrderSkuId());
max = Math.max(max, list.size());
map.put(orderCode, list);
}
}
return exportexcel(map, "order", max);
}
return AjaxResult.error("查无信息!");
} catch (ParseException e) {
e.printStackTrace();
throw new BusinessException("导出Excel失败,请联系网站管理员!");
}
}
//导出Excel
private AjaxResult exportexcel(Map<String, List<String>> map, String name, int max) {
//实例化XSSFWorkbook对象,相当于新建一个Excel文件
XSSFWorkbook workbook = new XSSFWorkbook();
//根据XSSFWorkbook获取Sheet
XSSFSheet sheet = workbook.createSheet();
//添加一行作为表格头
XSSFRow header = sheet.createRow(0);
//创建表格样式
XSSFCellStyle cellStyle = workbook.createCellStyle();
//cellStyle.setAlignment(CellStyle.ALIGN_CENTER);//内容居中显示
//创建头部表格
XSSFCell cell = null;
int index = 0;
//固定表头
List<String> fixedCells = fixedCells();
for (String cname : fixedCells) {
cell = header.createCell(index);
cell.setCellStyle(cellStyle);
cell.setCellValue(cname);
index++;
}
int n = 13; //固定表头13个
int indext = 0;
//追加表头
List<String> cells = appendCells();
while (n < max) {
indext++;
for (String cname : cells) {
cell = header.createCell(n);
cell.setCellStyle(cellStyle);
cell.setCellValue(cname + indext);
n++;
}
}
int z = 1;
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
List<String> list = entry.getValue();
//获取每行
XSSFRow content = sheet.createRow(z);
for (int i = 0; i < list.size(); i++) {
//创建单元格并设置值
content.createCell(i).setCellValue(list.get(i));
}
z++;
}
OutputStream fileOutputStream = null;
try {
ExcelUtil<MallOrdertDao> util = new ExcelUtil(MallOrdertDao.class);
String filename = util.encodingFilename(name);
//写入文件
fileOutputStream = new FileOutputStream(util.getAbsoluteFile(filename));
workbook.write(fileOutputStream);
return AjaxResult.success("导出成功!",filename);
} catch (IOException e) {
e.printStackTrace();
throw new BusinessException("导出Excel失败,请联系网站管理员!");
} finally {
if (workbook != null) {
try {
workbook.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
//固定表头
private List<String> fixedCells() {
List<String> cells = new ArrayList<>();
cells.add("订单编号");
cells.add("购买人手机号");
cells.add("快递费");
cells.add("平台券优惠券金额");
cells.add("店铺券优惠金额");
cells.add("收货人");
cells.add("收货人电话");
cells.add("快递地址");
cells.add("支付方式");
cells.add("支付时间");
cells.add("下单时间");
cells.add("快递公司");
cells.add("物流单号");
return cells;
}
//追加表头
private List<String> appendCells() {
List<String> cells = new ArrayList<>();
cells.add("商品id");
cells.add("商品名");
cells.add("一级分类");
cells.add("二级分类");
cells.add("款式");
cells.add("数量");
cells.add("单价");
cells.add("价格");
cells.add("订单skuId");
return cells;
}
}
......@@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
......@@ -28,7 +29,7 @@ public class ExportServiceImpl implements IExportService {
public List<OrderExportVo> exportOrderByPerformanceIdAll(String performancesId) {
List<OrderExportDao> list = performancesMapper.exportOrderByPerformanceIdAll(performancesId);
List<OrderExportVo> voList = new ArrayList();
for (OrderExportDao item :list){
for (OrderExportDao item : list) {
voList.add(OrderExportVo.getNew().copyOrderExportVo(item));
}
return voList;
......@@ -38,7 +39,7 @@ public class ExportServiceImpl implements IExportService {
public List<OrderExportVo> exportOrderByPerformanceIdPay(String performancesId) {
List<OrderExportDao> list = performancesMapper.exportOrderByPerformanceIdPay(performancesId);
List<OrderExportVo> voList = new ArrayList();
for (OrderExportDao item :list){
for (OrderExportDao item : list) {
voList.add(OrderExportVo.getNew().copyOrderExportVo(item));
}
return voList;
......@@ -50,9 +51,9 @@ public class ExportServiceImpl implements IExportService {
try {
Date beginDate = sdf.parse(beginTime);
Date endDate = sdf.parse(endTime);
List<OrderExportDao> list = performancesMapper.exportOrderByOrderTime(beginDate,endDate);
List<OrderExportDao> list = performancesMapper.exportOrderByOrderTime(beginDate, endDate);
List<OrderDetailedExportVo> voList = new ArrayList();
for (OrderExportDao item :list){
for (OrderExportDao item : list) {
voList.add(OrderDetailedExportVo.getNew().copyOrderExportVo(item));
}
return voList;
......@@ -68,9 +69,9 @@ public class ExportServiceImpl implements IExportService {
try {
Date beginDate = sdf.parse(beginTime);
Date endDate = sdf.parse(endTime);
List<OrderExportDao> list = performancesMapper.exportOrderByShowTime(beginDate,endDate);
List<OrderExportDao> list = performancesMapper.exportOrderByShowTime(beginDate, endDate);
List<OrderDetailedByShowDateExportVo> voList = new ArrayList();
for (OrderExportDao item :list){
for (OrderExportDao item : list) {
voList.add(OrderDetailedByShowDateExportVo.getNew().copyOrderExportVo(item));
}
return voList;
......@@ -84,7 +85,7 @@ public class ExportServiceImpl implements IExportService {
public List<OrderDetailedByShowIdExportVo> exportOrderByShowId(String showId) {
List<OrderExportDao> list = performancesMapper.exportOrderByShowId(showId);
List<OrderDetailedByShowIdExportVo> voList = new ArrayList();
for (OrderExportDao item :list){
for (OrderExportDao item : list) {
voList.add(OrderDetailedByShowIdExportVo.getNew().copyOrderExportVo(item));
}
return voList;
......@@ -96,9 +97,9 @@ public class ExportServiceImpl implements IExportService {
try {
Date beginDate = sdf.parse(beginTime);
Date endDate = sdf.parse(endTime);
List<MemberOrderExportDao> list = performancesMapper.exportMemberOrder(beginDate,endDate);
List<MemberOrderExportDao> list = performancesMapper.exportMemberOrder(beginDate, endDate);
List<OrderMemberExportVo> voList = new ArrayList();
for (MemberOrderExportDao item :list){
for (MemberOrderExportDao item : list) {
voList.add(OrderMemberExportVo.getNew().copyMemberOrderExportVo(item));
}
return voList;
......@@ -114,9 +115,9 @@ public class ExportServiceImpl implements IExportService {
try {
Date beginDate = sdf.parse(beginTime);
Date endDate = sdf.parse(endTime);
List<CommodityOrderExportDao> list = performancesMapper.exportCommodityOrder(beginDate,endDate);
List<CommodityOrderExportDao> list = performancesMapper.exportCommodityOrder(beginDate, endDate);
List<OrderCommodityExportVo> voList = new ArrayList();
for (CommodityOrderExportDao item :list){
for (CommodityOrderExportDao item : list) {
voList.add(OrderCommodityExportVo.getNew().copyCommodityOrderExportVo(item));
}
return voList;
......
......@@ -9,6 +9,7 @@ import java.util.function.Predicate;
public class CollectionUtil {
private static final HashMap<String, String> STRING_STRING_HASH_MAP = new HashMap<>();
private static final HashMap<String, Object> STRING_OBJECT_HASH_MAP = new HashMap<>();
private static final HashMap<String, List<String>> STRING_LIST_HASH_MAP = new HashMap<>();
private static final HashMap<String, Integer> STRING_INTEGER_HASH_MAP = new HashMap<>();
private static final HashMap<String, BigDecimal> STRING_BIG_DECIMAL_HASH_MAP = new HashMap<>();
private static final HashMap<String, Map<String, Object>> STRING_MAP_HASH_MAP = new HashMap<>();
......@@ -25,6 +26,9 @@ public class CollectionUtil {
public static HashMap<String, String> mapStringString() {
return (HashMap<String, String>) STRING_STRING_HASH_MAP.clone();
}
public static HashMap<String, List<String>> mapStringList() {
return (HashMap<String, List<String>>) STRING_LIST_HASH_MAP.clone();
}
public static HashMap<String, Object> mapStringObject() {
return (HashMap<String, Object>) STRING_OBJECT_HASH_MAP.clone();
......
......@@ -59,7 +59,7 @@ info:
version: '@project.version@'
# -----------------------------------------------------------
mybatis-plus:
mapper-locations: classpath*:com.liquidnet.service.*.mapper/*Mapper.xml
mapper-locations: classpath*:com.liquidnet.service.*.mapper/*Mapper.xml,classpath:com.liquidnet.service.*.mapper/*Mapper.xml,classpath:com.liquidnet.service.kylin.mapper/*Mapper.xml
# -----------------------------------------------------------
spring:
application:
......
package com.liquidnet.service.goblin.dto;
import lombok.Data;
@Data
public class MallOrdertDao {
//订单id
private String orderId;
//订单编号
private String orderCode;
//购买人手机号
private String userMobile;
//快递费
private String priceExpress;
//平台券优惠金额
private String priceCoupon;
//店铺券优惠金额
private String storePriceCoupon;
//收货人
private String expressContacts;
//收货人电话
private String expressPhone;
//快递地址
private String expressDetailAddress;
//商品id
private String spuId;
//商品名
private String name;
//一级分类
private String cate1Name;
//二级分类
private String cate2Name;
//款式
private String skuName;
//数量
private String num;
//单价
private String skuPrice;
//价格
private String skuPriceActual;
//订单skuId
private String orderSkuId;
//支付方式
private String payType;
//支付时间
private String payTime;
//下单时间
private String createdAt;
//快递公司
private String logisticsCompany;
//物流单号
private String mailNo;
}
package com.liquidnet.service.goblin.mapper;
import com.liquidnet.service.goblin.dto.MallOrdertDao;
import com.liquidnet.service.goblin.entity.GoblinStoreOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* <p>
......@@ -13,4 +18,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface GoblinStoreOrderMapper extends BaseMapper<GoblinStoreOrder> {
List<MallOrdertDao> exportMallOrder(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime, @Param("states") List<String>
states, @Param("mailType") Integer mailType, @Param("storeId") String storeId);
}
......@@ -2,4 +2,84 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.goblin.mapper.GoblinStoreOrderMapper">
<resultMap id="exportMallOrderDaoResult" type="com.liquidnet.service.goblin.dto.MallOrdertDao">
<result column="order_id" property="orderId"/>
<result column="order_code" property="orderCode"/>
<result column="user_mobile" property="userMobile"/>
<result column="price_express" property="priceExpress"/>
<result column="price_coupon" property="priceCoupon"/>
<result column="store_price_coupon" property="storePriceCoupon"/>
<result column="express_contacts" property="expressContacts"/>
<result column="express_phone" property="expressPhone"/>
<result column="express_detail_address" property="expressDetailAddress"/>
<result column="spu_id" property="spuId"/>
<result column="name" property="name"/>
<result column="cate1_name" property="cate1Name"/>
<result column="cate2_name" property="cate2Name"/>
<result column="sku_name" property="skuName"/>
<result column="num" property="num"/>
<result column="sku_price" property="skuPrice"/>
<result column="sku_price_actual" property="skuPriceActual"/>
<result column="order_sku_id" property="orderSkuId"/>
<result column="pay_type" property="payType"/>
<result column="pay_time" property="payTime"/>
<result column="created_at" property="createdAt"/>
<result column="logistics_company" property="logisticsCompany"/>
<result column="mail_no" property="mailNo"/>
</resultMap>
<select id="exportMallOrder" resultMap="exportMallOrderDaoResult">
select
gso.order_id as order_id,
gso.order_code as order_code,
gso.user_mobile as user_mobile,
gso.price_express as price_express,
gso.price_coupon as price_coupon,
gso.store_price_coupon as store_price_coupon,
goa.express_contacts as express_contacts,
goa.express_phone as express_phone,
CONCAT(goa.express_address,' ',goa.express_address_detail) as express_detail_address,
gso.pay_type as pay_type,
gso.pay_time as pay_time,
gso.created_at as created_at,
gm.logistics_company as logistics_company,
gm.mail_no as mail_no,
gos.spu_id as spu_id,
gg.name as name,
gg.cate1_name as cate1_name,
gg.cate2_name as cate2_name,
gos.sku_name as sku_name,
gos.num as num,
gos.sku_price as sku_price,
gos.sku_price_actual as sku_price_actual,
gos.order_sku_id as order_sku_id
from goblin_store_order as gso
inner join goblin_order_sku as gos on gos.order_id = gso.order_id
inner join (select spu_id, gg.name, gsgc1.name as cate1_name, gsgc2.name as cate2_name
from goblin_goods as gg
left join goblin_self_goods_category as gsgc1 on gsgc1.cate_id = gg.cate_fid
left join goblin_self_goods_category as gsgc2 on gsgc2.cate_id = gg.cate_sid) as gg
on gos.spu_id = gg.spu_id
inner join goblin_order_attr as goa on goa.order_id = gso.order_id
left join goblin_mail as gm on gm.order_id = gso.order_id
<where>
and gso.store_id = #{storeId}
<if test="beginTime != null and endTime != null">
and gso.created_at between #{beginTime} and #{endTime}
</if>
<if test="states != null">
and gso.status in
<foreach collection="states" item="item" index="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
<if test="mailType != null and mailType == '1'">
and gm.mail_no is null;
</if>
<if test="mailType != null and mailType == '2'">
and gm.mail_no is not null;
</if>
</where>
</select>
</mapper>
......@@ -81,4 +81,5 @@ public interface KylinPerformancesMapper extends BaseMapper<KylinPerformances> {
List<MemberOrderExportDao> exportMemberOrder(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
//商品订单信息
List<CommodityOrderExportDao> exportCommodityOrder(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
}
......@@ -99,6 +99,7 @@
<result column="status" property="status"/>
<result column="refund_at" property="refundAt"/>
</resultMap>
<!-- <resultMap id="OrderExportDaoResult" type="com.liquidnet.service.kylin.dao.OrderExportDao">-->
<!-- <result column="performance_title" property="performanceTitle"/>-->
<!-- <result column="user_mobile" property="userMobile"/>-->
......@@ -1056,5 +1057,4 @@ GROUP BY user_mobile;
group by do.code) temtable group by temtable.code
</select>
</mapper>
package com.liquidnet.service.goblin.controller;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.service.IGoblinImportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.Null;
import java.util.List;
@Controller
@Api(tags = "订单导入")
@RequestMapping("/import")
public class GoblinImportController {
private String prefix = "zhengzai/kylin/performances/orderImport";
@Autowired
IGoblinImportService iGoblinImportService;
/**
* 导入对订单发货
*/
@PostMapping("/OrderExpress")
@ApiOperation("快递发货")
@ResponseBody
public ResponseDto<String> importOrderExpress(MultipartFile file) throws Exception {
// ExcelUtil<OrderMallOrderVo> util = new ExcelUtil(OrderMallOrderVo.class);
// List<OrderMallOrderVo> MallOrdertVoList = util.importExcel(file.getInputStream());
return iGoblinImportService.importExpress(file);
}
}
......@@ -2,6 +2,7 @@ package com.liquidnet.service.goblin.controller.manage;
import com.github.pagehelper.PageInfo;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.GoblinMailVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreOrderListVo;
......@@ -134,7 +135,7 @@ public class GoblinStoreOrderController {
public ResponseDto<Boolean> express(@RequestParam(value = "orderId", required = true) @Valid String orderId,
@RequestParam(value = "orderSkuIds", required = false) @Valid String orderSkuIds,
@RequestParam(value = "mailNo", required = true) @Valid String mailNo) {
return goblinStoreOrderService.express(orderId, orderSkuIds, mailNo);
return goblinStoreOrderService.express(orderId, orderSkuIds, mailNo, CurrentUtil.getCurrentUid());
}
@ApiOperation(value = "修改快递单号")
......
package com.liquidnet.service.goblin.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.read.listener.PageReadListener;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.service.IGoblinImportService;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
@Service
@Slf4j
public class GoblinImportServiceImpl implements IGoblinImportService {
@Autowired
private IGoblinStoreOrderService iGoblinStoreOrderService;
@Override
public ResponseDto<String> importExpress(MultipartFile file) {
if (file == null) {
return ResponseDto.failure();
}
try {
EasyExcel.read(file.getInputStream(), new PageReadListener<HashMap<String, String>>(dataList -> {
for (HashMap<String, String> item : dataList) {
String skuIds = "";
int init = 22;
int skip = 9;
int count = (item.size() - init) / skip;
String orderId = item.get(0);
String mailNo = item.get(13);
for (int i = 0; i < count; i++) {
String skuId = item.get(init + (i * skip));
if (skuId != null && !skuId.equals("null")) {
skuIds = skuIds.concat(skuId).concat(",");
}
}
if (skuIds.trim().length() > 0) {
skuIds = skuIds.substring(0, skuIds.trim().length() - 1);
}
log.debug("orderId = " + orderId);
log.debug("skuIds = " + skuIds);
log.debug("mailNo = " + mailNo);
if (mailNo == null || mailNo.equals("")) {
log.error("发货失败 orderId = " + orderId + "skuIds = " + skuIds + " 快递单号空");
}
ResponseDto<Boolean> express = iGoblinStoreOrderService.express(orderId, skuIds, mailNo, "d0920ca469129c3950f70371b36c1ce2");
if (express.getCode().equals("0")) {
} else {
log.error("发货失败 orderId = " + orderId + "skuIds = " + skuIds + " mailNo = " + mailNo);
}
}
})).sheet().doRead();
// if (StringUtils.isNull(mallOrdertVoList) || mallOrdertVoList.size() == 0) {
// throw new BusinessException("导入数据不能为空!");
// }
// int successNum = 0;
// int failureNum = 0;
// StringBuilder successMsg = new StringBuilder();
// StringBuilder failureMsg = new StringBuilder();
// for (OrderMallOrderVo mallOrderVo : mallOrdertVoList) {
// log.debug("data = " + mallOrderVo.toString());
//// ResponseDto<Boolean> express = iGoblinStoreOrderService.express(mallOrderVo.getOrderCode(), null, mallOrderVo.getMailNo());
// if (express.getCode().equals("0")) {
// successNum++;
// successMsg.append("<br/>" + successNum + "、订单编号 " + mallOrderVo.getOrderCode() + " 导入发货成功");
// } else {
// failureNum++;
// String msg = "<br/>" + failureNum + "、订单编号 " + mallOrderVo.getOrderCode() + " 失败原因:";
// failureMsg.append(msg + express.getMessage());
// }
// }
// if (failureNum > 0) {
// failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
// throw new BusinessException(failureMsg.toString());
// } else {
// successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
// }
// return successMsg.toString();
} catch (Exception e) {
e.printStackTrace();
return ResponseDto.failure();
}
return ResponseDto.success("订单导入成功");
}
}
......@@ -538,8 +538,7 @@ public class GoblinStoreOrderServiceImpl implements IGoblinStoreOrderService {
}
@Override
public ResponseDto<Boolean> express(String orderId, String orderSkuIds, String mailNo) {
String uid = CurrentUtil.getCurrentUid();
public ResponseDto<Boolean> express(String orderId, String orderSkuIds, String mailNo,String uid) {
LocalDateTime now = LocalDateTime.now();
String nowStr = DateUtil.getNowTime();
LinkedList<String> sqls = CollectionUtil.linkedListString();
......
package com.liquidnet.service.platform.controller.goblin;
import com.liquidnet.service.goblin.service.IGoblinExportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletResponse;
@Api(tags = "商城-订单信息导出")
@Controller
@RequestMapping("/tools/export")
@Validated
public class GoblinExportDataController {
@Autowired
IGoblinExportService iGoblinExportService;
/**
* 导出商城订单信息
*
* @param beginTime
* @param endTime
* @return
*/
@GetMapping("/exportMallOrder")
@ApiOperation(value = "excel订单信息导出")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "beginTime", value = "开始时间"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "店铺id"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "endTime", value = "结束时间"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "state", value = "状态逗号隔开字符串[0-待付款(用户刚下单)|2-代发货(用户付完款 等待商城发货)|3-代收货(商城已经发货 等待用户确认收货)|4-已完成(用户已经确认收货 订单结束)|5-取消订单(用户未付款前取消订单)|6-退款通过(用户已经付款但是商城还未发货,用户发出退款申请,商城同意退款)|7-退货通过(用户已经确认收货后用户发出退货申请,商城同意所有退货申请 ,一个订单可能有多个单品)|61-6的发起状态|71-7的发起状态】"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "mailType", value = "快递状态[0-全部|1-未发货|2-已发货]"),
})
public void exportMallOrder(HttpServletResponse response, @RequestParam("beginTime") String beginTime, @RequestParam("endTime") String endTime,
@RequestParam("state") String state, @RequestParam("mailType") Integer mailType, @RequestParam("storeId") String storeId) {
iGoblinExportService.exportMallOrder(response, beginTime, endTime, state, mailType, storeId);
}
}
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