|
@@ -20,6 +20,7 @@ import com.fjhx.params.order.OrderInfoEx;
|
|
|
import com.fjhx.params.order.OrderInfoVo;
|
|
|
import com.fjhx.params.order.OrderJdExcelVo;
|
|
|
import com.fjhx.service.excel.ExcelImportLogService;
|
|
|
+import com.fjhx.service.flow.CompensateFlowService;
|
|
|
import com.fjhx.service.order.OrderDetailsService;
|
|
|
import com.fjhx.service.order.OrderInfoService;
|
|
|
import com.fjhx.service.product.ProductInfoService;
|
|
@@ -64,21 +65,32 @@ public class OrderInfoInfoServiceImpl extends ServiceImpl<OrderInfoMapper, Order
|
|
|
@Autowired
|
|
|
private SystemConfigService systemConfigService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CompensateFlowService compensateFlowService;
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public Page<OrderInfoEx> getPage(Map<String, Object> condition) {
|
|
|
|
|
|
-
|
|
|
IWrapper<Object> wrapper = IWrapper.getWrapper(condition)
|
|
|
// 京东订单销售订单
|
|
|
.func(q -> {
|
|
|
Integer type = Convert.toInt(condition.get("type"));
|
|
|
Boolean issue = Convert.toBool(condition.get("deliverable"), false);
|
|
|
+ Boolean afterSales = Convert.toBool(condition.get("afterSales"), false);
|
|
|
+
|
|
|
// 如果类型为空,默认为销售订单
|
|
|
if (type == null) {
|
|
|
// 如果是出货
|
|
|
if (issue) {
|
|
|
- q.in("oi", OrderInfo::getType, 1, 2, 4, 5);
|
|
|
- } else {
|
|
|
+ q.in("oi", OrderInfo::getType, 1, 2, 5, 6);
|
|
|
+ }
|
|
|
+ // 如果是售后
|
|
|
+ else if (afterSales) {
|
|
|
+ q.in("oi", OrderInfo::getType, 4, 5, 6);
|
|
|
+ }
|
|
|
+ // 默认销售订单
|
|
|
+ else {
|
|
|
q.in("oi", OrderInfo::getType, 1, 2);
|
|
|
}
|
|
|
} else {
|
|
@@ -92,6 +104,7 @@ public class OrderInfoInfoServiceImpl extends ServiceImpl<OrderInfoMapper, Order
|
|
|
}
|
|
|
})
|
|
|
.keyword(new KeywordData("oi", OrderInfo::getCode), new KeywordData("ci", CustomerInfo::getName))
|
|
|
+ .eq("oi", OrderInfo::getAfterSalesStatus)
|
|
|
.eq("oi", OrderInfo::getStatus)
|
|
|
.like("oi", OrderInfo::getCode)
|
|
|
.like("ci", CustomerInfo::getName, condition.get("customerName"))
|
|
@@ -265,6 +278,33 @@ public class OrderInfoInfoServiceImpl extends ServiceImpl<OrderInfoMapper, Order
|
|
|
return orderInfoEx;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void addAfterSales(OrderInfoVo orderInfoVo) {
|
|
|
+ Long oldId = orderInfoVo.getId();
|
|
|
+
|
|
|
+ OrderInfo orderInfo = getById(oldId);
|
|
|
+ orderInfo.setId(null);
|
|
|
+ orderInfo.setType(orderInfoVo.getType());
|
|
|
+ orderInfo.setStatus(1);
|
|
|
+ orderInfo.setIssueStatus(1);
|
|
|
+ orderInfo.setAfterSalesStatus(1);
|
|
|
+ orderInfo.setRemark(orderInfo.getRemark());
|
|
|
+ save(orderInfo);
|
|
|
+
|
|
|
+ if (orderInfoVo.getType().equals(4)) {
|
|
|
+ compensateFlowService.create(orderInfoVo);
|
|
|
+ } else {
|
|
|
+ List<OrderDetails> list = orderDetailsService.list(q -> q.eq(OrderDetails::getOrderId, oldId));
|
|
|
+ for (OrderDetails orderDetails : list) {
|
|
|
+ orderDetails.setId(null);
|
|
|
+ orderDetails.setOrderId(orderInfo.getId());
|
|
|
+ orderDetails.setNotIssuedQuantity(orderDetails.getQuantity());
|
|
|
+ orderDetails.setRemark(null);
|
|
|
+ }
|
|
|
+ orderDetailsService.saveBatch(list);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 验证订单编号是否重复
|
|
|
*/
|