|
@@ -91,6 +91,7 @@ import com.fs.live.dto.LiveOrderComputeDTO;
|
|
|
import com.fs.live.dto.LiveOrderCustomerExportDTO;
|
|
import com.fs.live.dto.LiveOrderCustomerExportDTO;
|
|
|
import com.fs.live.dto.LiveOrderDeliveryNoteDTO;
|
|
import com.fs.live.dto.LiveOrderDeliveryNoteDTO;
|
|
|
import com.fs.live.dto.LiveOrderItemDTO;
|
|
import com.fs.live.dto.LiveOrderItemDTO;
|
|
|
|
|
+import com.fs.live.enums.LiveAfterSalesStatusEnum;
|
|
|
import com.fs.live.mapper.*;
|
|
import com.fs.live.mapper.*;
|
|
|
import com.fs.live.param.*;
|
|
import com.fs.live.param.*;
|
|
|
import com.fs.live.service.*;
|
|
import com.fs.live.service.*;
|
|
@@ -1133,6 +1134,15 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
IErpOrderService erpOrderService = getErpService();
|
|
IErpOrderService erpOrderService = getErpService();
|
|
|
FsErpConfig erpConfig = configUtil.generateStructConfigByKey("his.config", FsErpConfig.class);
|
|
FsErpConfig erpConfig = configUtil.generateStructConfigByKey("his.config", FsErpConfig.class);
|
|
|
LiveOrder order = baseMapper.selectLiveOrderByOrderId(String.valueOf(orderId));
|
|
LiveOrder order = baseMapper.selectLiveOrderByOrderId(String.valueOf(orderId));
|
|
|
|
|
+ LiveAfterSales updateSales = liveAfterSalesMapper.getLiveAfterSalesByOrderId(orderId);
|
|
|
|
|
+ if (updateSales == null) {
|
|
|
|
|
+ return R.error("售后单不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ LiveAfterSales liveMp = new LiveAfterSales();
|
|
|
|
|
+ liveMp.setId(updateSales.getId());
|
|
|
|
|
+ liveMp.setStatus(LiveAfterSalesStatusEnum.STATUS_4.getValue());
|
|
|
|
|
+ liveMp.setSalesStatus(3);
|
|
|
|
|
+ liveAfterSalesMapper.updateLiveAfterSales(liveMp);
|
|
|
if (order == null) {
|
|
if (order == null) {
|
|
|
return R.error("订单不存在");
|
|
return R.error("订单不存在");
|
|
|
}
|
|
}
|
|
@@ -1171,17 +1181,23 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
}
|
|
}
|
|
|
return liveAfterSalesService.applyForAfterSales(order.getUserId(), param);
|
|
return liveAfterSalesService.applyForAfterSales(order.getUserId(), param);
|
|
|
} else {
|
|
} else {
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- jSTOrderService.refundUpdateLive(request);
|
|
|
|
|
|
|
+ ErpOrderQueryRequert queryRequest = new ErpOrderQueryRequert();
|
|
|
|
|
+ queryRequest.setCode(order.getExtendOrderId());
|
|
|
|
|
+ ErpOrderQueryResponse response = erpOrderService.getLiveOrder(queryRequest);
|
|
|
|
|
+ if (response.getOrders() != null && response.getOrders().size() > 0) {
|
|
|
|
|
+ if (response.getOrders().get(0).getCancle() != null && !response.getOrders().get(0).getCancle()) {
|
|
|
|
|
+ jSTOrderService.refundUpdateLive(request);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- order.setStatus(OrderInfoEnum.STATUS_2.getValue());
|
|
|
|
|
|
|
+ order.setStatus(OrderInfoEnum.STATUS_NE2.getValue());
|
|
|
order.setRefundMoney(order.getPayMoney());
|
|
order.setRefundMoney(order.getPayMoney());
|
|
|
order.setRefundStatus(String.valueOf(OrderInfoEnum.REFUND_STATUS_2.getValue()));
|
|
order.setRefundStatus(String.valueOf(OrderInfoEnum.REFUND_STATUS_2.getValue()));
|
|
|
liveUserLotteryRecordMapper.updateOrderStatusByOrderId(order.getOrderId(), -2);
|
|
liveUserLotteryRecordMapper.updateOrderStatusByOrderId(order.getOrderId(), -2);
|
|
|
baseMapper.updateLiveOrder(order);
|
|
baseMapper.updateLiveOrder(order);
|
|
|
|
|
|
|
|
|
|
+
|
|
|
//退库存
|
|
//退库存
|
|
|
//获取订单下的商品
|
|
//获取订单下的商品
|
|
|
List<LiveOrderItem> orderItemVOS = liveOrderItemMapper.selectLiveOrderItemByOrderId(order.getOrderId());
|
|
List<LiveOrderItem> orderItemVOS = liveOrderItemMapper.selectLiveOrderItemByOrderId(order.getOrderId());
|
|
@@ -1296,6 +1312,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
userService.subTuiMoney(storeOrder);
|
|
userService.subTuiMoney(storeOrder);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
return R.ok();
|
|
return R.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1347,8 +1364,14 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
}
|
|
}
|
|
|
return liveAfterSalesService.applyForAfterSales(order.getUserId(), param);
|
|
return liveAfterSalesService.applyForAfterSales(order.getUserId(), param);
|
|
|
} else {
|
|
} else {
|
|
|
-
|
|
|
|
|
- jSTOrderService.refundUpdateLive(request);
|
|
|
|
|
|
|
+ ErpOrderQueryRequert queryRequest = new ErpOrderQueryRequert();
|
|
|
|
|
+ queryRequest.setCode(order.getExtendOrderId());
|
|
|
|
|
+ ErpOrderQueryResponse response = erpOrderService.getLiveOrder(queryRequest);
|
|
|
|
|
+ if (response.getOrders() != null && response.getOrders().size() > 0) {
|
|
|
|
|
+ if (response.getOrders().get(0).getCancle() != null && !response.getOrders().get(0).getCancle()) {
|
|
|
|
|
+ jSTOrderService.refundUpdateLive(request);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
order.setStatus(OrderInfoEnum.STATUS_NE2.getValue());
|
|
order.setStatus(OrderInfoEnum.STATUS_NE2.getValue());
|
|
@@ -1471,6 +1494,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
userService.subLiveTuiMoney(liveOrder);
|
|
userService.subLiveTuiMoney(liveOrder);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
return R.ok();
|
|
return R.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2664,17 +2688,19 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
baseMapper.updateLiveOrder(updateEntity);
|
|
baseMapper.updateLiveOrder(updateEntity);
|
|
|
//如果是正常签收,更新订单状态
|
|
//如果是正常签收,更新订单状态
|
|
|
if(dto.getState().equals("3")&&(dto.getStateEx().equals("301")||dto.getStateEx().equals("302")||dto.getStateEx().equals("304")||dto.getStateEx().equals("311"))){
|
|
if(dto.getState().equals("3")&&(dto.getStateEx().equals("301")||dto.getStateEx().equals("302")||dto.getStateEx().equals("304")||dto.getStateEx().equals("311"))){
|
|
|
- this.getGoods(order.getOrderId());
|
|
|
|
|
|
|
+ this.finishishOrder(order.getOrderId());
|
|
|
}
|
|
}
|
|
|
return R.ok();
|
|
return R.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public int getGoods(Long orderId) {
|
|
|
|
|
|
|
+ public int finishishOrder(Long orderId) {
|
|
|
|
|
|
|
|
LiveOrder order = baseMapper.selectLiveOrderByOrderId(String.valueOf(orderId));
|
|
LiveOrder order = baseMapper.selectLiveOrderByOrderId(String.valueOf(orderId));
|
|
|
if (order==null)throw new CustomException("订单不存在");
|
|
if (order==null)throw new CustomException("订单不存在");
|
|
|
- if (order.getStatus()!= OrderInfoEnum.STATUS_3.getValue())throw new CustomException("非法更改");
|
|
|
|
|
|
|
+ if (!Objects.equals(order.getStatus(), OrderInfoEnum.STATUS_2.getValue()))throw new CustomException("非法更改");
|
|
|
|
|
+ liveOrderLogsService.create(order.getOrderId(), OrderLogEnum.FINISH_ORDER.getValue(),
|
|
|
|
|
+ OrderLogEnum.FINISH_ORDER.getDesc());
|
|
|
LiveOrder updateEntity = new LiveOrder();
|
|
LiveOrder updateEntity = new LiveOrder();
|
|
|
updateEntity.setOrderId(order.getOrderId());
|
|
updateEntity.setOrderId(order.getOrderId());
|
|
|
updateEntity.setUpdateTime(new DateTime());
|
|
updateEntity.setUpdateTime(new DateTime());
|
|
@@ -2693,8 +2719,16 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
// OrderLogEnum.FINISH_ORDER.getDesc());
|
|
// OrderLogEnum.FINISH_ORDER.getDesc());
|
|
|
|
|
|
|
|
int i = baseMapper.updateLiveOrder(updateEntity);
|
|
int i = baseMapper.updateLiveOrder(updateEntity);
|
|
|
- liveUserLotteryRecordMapper.updateOrderStatusByOrderId(order.getOrderId(), OrderInfoEnum.STATUS_3.getValue());
|
|
|
|
|
-
|
|
|
|
|
|
|
+ //模板消息支付成功发布事件
|
|
|
|
|
+ TemplateBean templateBean = TemplateBean.builder()
|
|
|
|
|
+ .orderId(order.getOrderId().toString())
|
|
|
|
|
+ .orderCode(order.getOrderCode().toString())
|
|
|
|
|
+ .remark("您的订单已签收成功")
|
|
|
|
|
+ .finishTime(order.getFinishTime())
|
|
|
|
|
+ .userId(Long.valueOf(order.getUserId()))
|
|
|
|
|
+ .templateType(TemplateListenEnum.TYPE_3.getValue())
|
|
|
|
|
+ .build();
|
|
|
|
|
+ publisher.publishEvent(new TemplateEvent(this, templateBean));
|
|
|
return i;
|
|
return i;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -3304,7 +3338,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
|
|
|
|
|
// 更改店铺库存
|
|
// 更改店铺库存
|
|
|
fsStoreProduct.setStock(fsStoreProduct.getStock()-Integer.parseInt(liveOrder.getTotalNum()));
|
|
fsStoreProduct.setStock(fsStoreProduct.getStock()-Integer.parseInt(liveOrder.getTotalNum()));
|
|
|
- fsStoreProduct.setSales(fsStoreProduct.getSales()+Long.parseLong(liveOrder.getTotalNum()));
|
|
|
|
|
|
|
+ fsStoreProduct.setSales(fsStoreProduct.getSales()+Integer.parseInt(liveOrder.getTotalNum()));
|
|
|
fsStoreProductService.updateFsStoreProduct(fsStoreProduct);
|
|
fsStoreProductService.updateFsStoreProduct(fsStoreProduct);
|
|
|
// 更新直播间库存
|
|
// 更新直播间库存
|
|
|
goods.setStock(goods.getStock()-Integer.parseInt(liveOrder.getTotalNum()));
|
|
goods.setStock(goods.getStock()-Integer.parseInt(liveOrder.getTotalNum()));
|