|
@@ -22,6 +22,7 @@ import com.txz.mall.core.ResultCode;
|
|
|
import com.txz.mall.core.ServiceException;
|
|
|
import com.txz.mall.dubbo.client.CifAccountDubboServiceClient;
|
|
|
import com.txz.mall.dubbo.client.CifUserDubboServiceClient;
|
|
|
+import com.txz.mall.enums.PinkOrderStatusEnum;
|
|
|
import com.txz.mall.model.*;
|
|
|
import com.txz.mall.service.*;
|
|
|
import com.txz.mall.util.EasyExcelUtil;
|
|
@@ -1235,6 +1236,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
storeOrder.setPaid(0);
|
|
|
storeOrder.setCost(BigDecimal.ZERO);
|
|
|
storeOrder.setType(0);
|
|
|
+ storeOrder.setStatus(PinkOrderStatusEnum.UNPAID.getKey());
|
|
|
|
|
|
// StoreCouponUser storeCouponUser = new StoreCouponUser();
|
|
|
// // 优惠券修改
|
|
@@ -1315,8 +1317,8 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
} else {
|
|
|
throw new ServiceException("获取用户钱包账户失败");
|
|
|
}
|
|
|
- storeOrder.setPaid(1);
|
|
|
- update(storeOrder);
|
|
|
+ updateOrderStatus(storeOrder.getId(), PinkOrderStatusEnum.WAIT_OPEN.getKey());
|
|
|
+
|
|
|
if ("open".equals(dto.getType())) {
|
|
|
OpenParam openParam = new OpenParam();
|
|
|
openParam.setBizId(storeOrder.getId().toString());
|
|
@@ -1346,8 +1348,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
if (storeOrder.getPaid().equals(Constants.ORDER_STATUS_H5_UNPAID)) {
|
|
|
throw new ServiceException("当前状态不支持退款");
|
|
|
}
|
|
|
- storeOrder.setRefundStatus(1);
|
|
|
- update(storeOrder);
|
|
|
+ updateOrderStatus(storeOrder.getId(), PinkOrderStatusEnum.GROUP_REFUNDING.getKey());
|
|
|
|
|
|
// 归还用户余额
|
|
|
// accountDubboServiceClient.refund(id.toString(), storeOrder.getOrderId(), storeOrder.getPayPrice());
|
|
@@ -1359,8 +1360,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
public void close(Long id) {
|
|
|
StoreOrder storeOrder = findById(id);
|
|
|
if (storeOrder.getStatus().equals(Constants.ORDER_STATUS_H5_COMPLETE)) {
|
|
|
- storeOrder.setStatus(Constants.ORDER_STATUS_H5_CLOSE);
|
|
|
- update(storeOrder);
|
|
|
+ updateOrderStatus(storeOrder.getId(), PinkOrderStatusEnum.CLOSE.getKey());
|
|
|
} else {
|
|
|
throw new ServiceException("当前状态不支持关闭");
|
|
|
}
|
|
@@ -1370,8 +1370,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
public void cancel(Long id) {
|
|
|
StoreOrder storeOrder = findById(id);
|
|
|
if (storeOrder.getPaid().equals(0)) {
|
|
|
- storeOrder.setStatus(Constants.ORDER_STATUS_H5_CANCEL);
|
|
|
- update(storeOrder);
|
|
|
+ updateOrderStatus(storeOrder.getId(), PinkOrderStatusEnum.CANCEL.getKey());
|
|
|
} else {
|
|
|
throw new ServiceException("当前状态不支持取消");
|
|
|
}
|
|
@@ -1379,32 +1378,10 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
|
|
|
@Override
|
|
|
public void exportDelivery(HttpServletResponse response) {
|
|
|
- List<String> rowHead = CollUtil.newArrayList("ID", "订单号", "用户ID", "用户注册手机号", "订单状态", "订单金额", "下单时间", "支付时间", "商品ID", "商品名称", "商品规格", "购买数量", "收件人姓名", "收件人手机", "收件人详细地址", "邮编", "快递公司", "快递单号");
|
|
|
- ExcelWriter writer = ExcelUtil.getWriter();
|
|
|
- try {
|
|
|
- writer.writeHeadRow(rowHead);
|
|
|
- List<List<Object>> rows = new LinkedList<>();
|
|
|
- List<Object> rowA = CollUtil.newArrayList();
|
|
|
- rows.add(rowA);
|
|
|
- writer.write(rows);
|
|
|
- //设置宽度自适应
|
|
|
- writer.setColumnWidth(-1, 22);
|
|
|
- //response为HttpServletResponse对象
|
|
|
- response.setContentType("application/vnd.ms-excel;charset=utf-8");
|
|
|
- //test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
|
|
|
- response.setHeader("Content-Disposition", "attachment;filename=" + new String(("导出发货模版").getBytes("UTF-8"), "ISO-8859-1") + ".xls");
|
|
|
- ServletOutputStream out = response.getOutputStream();
|
|
|
- //out为OutputStream,需要写出到的目标流
|
|
|
- writer.flush(out);
|
|
|
- log.info("导出结束");
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("导出异常", e);
|
|
|
- e.printStackTrace();
|
|
|
- } finally {
|
|
|
- // 关闭writer,释放内存
|
|
|
- writer.close();
|
|
|
- log.info("导出结束");
|
|
|
- }
|
|
|
+ StoreOrderDTO storeOrderDTO = new StoreOrderDTO();
|
|
|
+ storeOrderDTO.setPaid(1);
|
|
|
+ storeOrderDTO.setStatus(Constants.ORDER_STATUS_H5_NOT_SHIPPED);
|
|
|
+ exportFile(storeOrderDTO, response);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1431,12 +1408,21 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
|
storeOrder.setDeliveryId(po.getDeliveryId());
|
|
|
storeOrder.setDeliveryName(po.getDeliveryName());
|
|
|
update(storeOrder);
|
|
|
+ updateOrderStatus(po.getId(), PinkOrderStatusEnum.WAIT_RECEIVER.getKey());
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void updateOrderStatus(Long id, Integer status) {
|
|
|
+ StoreOrder storeOrder = findById(id);
|
|
|
+ storeOrder.setStatus(status);
|
|
|
+ update(storeOrder);
|
|
|
+ storeOrderStatusService.createLog(id, "", PinkOrderStatusEnum.getEnum(status).getValue());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 校验商品库存(生成订单)
|
|
|
*
|