|
@@ -102,6 +102,18 @@ public class FsFinanceOrderController extends BaseController {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 已回款状态不允许重复导入
|
|
|
|
|
+ String statusMsg = validateNotReturned(order);
|
|
|
|
|
+ if (statusMsg != null) {
|
|
|
|
|
+ BigDecimal totalPrice = order.getTotalPrice() != null ? order.getTotalPrice() : BigDecimal.ZERO;
|
|
|
|
|
+ BigDecimal collectionPrice = order.getCollectionPrice() != null ? order.getCollectionPrice() : BigDecimal.ZERO;
|
|
|
|
|
+ failList.add(new FsFinanceOrderImportFailDTO(
|
|
|
|
|
+ order.getOrderCode(), order.getDeliverySn(),
|
|
|
|
|
+ totalPrice, collectionPrice, dto.getReturnPrice(),
|
|
|
|
|
+ statusMsg));
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 回款金额与代收金额一致性校验
|
|
// 回款金额与代收金额一致性校验
|
|
|
String amountMsg = validateReturnPriceMatch(order, dto.getReturnPrice());
|
|
String amountMsg = validateReturnPriceMatch(order, dto.getReturnPrice());
|
|
|
if (amountMsg != null) {
|
|
if (amountMsg != null) {
|
|
@@ -151,6 +163,17 @@ public class FsFinanceOrderController extends BaseController {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 校验订单是否已回款。status=4 表示已回款,不允许重复导入。
|
|
|
|
|
+ * @return null 表示可导入,否则返回失败原因
|
|
|
|
|
+ */
|
|
|
|
|
+ private String validateNotReturned(FsExternalOrder order) {
|
|
|
|
|
+ if (order != null && Integer.valueOf(4).equals(order.getStatus())) {
|
|
|
|
|
+ return "订单已回款,不能重复导入";
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 校验导入回款金额与订单代收金额是否一致。
|
|
* 校验导入回款金额与订单代收金额是否一致。
|
|
|
* @return null 表示一致,否则返回失败原因
|
|
* @return null 表示一致,否则返回失败原因
|
|
@@ -207,6 +230,15 @@ public class FsFinanceOrderController extends BaseController {
|
|
|
preview.setPayPrice(order.getPayPrice());
|
|
preview.setPayPrice(order.getPayPrice());
|
|
|
preview.setCollectionPrice(order.getCollectionPrice());
|
|
preview.setCollectionPrice(order.getCollectionPrice());
|
|
|
|
|
|
|
|
|
|
+ // 已回款状态不允许重复导入(不通过仍回填订单信息)
|
|
|
|
|
+ String statusMsg = validateNotReturned(order);
|
|
|
|
|
+ if (statusMsg != null) {
|
|
|
|
|
+ preview.setMatched(false);
|
|
|
|
|
+ preview.setFailReason(statusMsg);
|
|
|
|
|
+ previewList.add(preview);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 回款金额与代收金额一致性校验(不通过仍回填订单信息,便于预览/导出明细)
|
|
// 回款金额与代收金额一致性校验(不通过仍回填订单信息,便于预览/导出明细)
|
|
|
String amountMsg = validateReturnPriceMatch(order, dto.getReturnPrice());
|
|
String amountMsg = validateReturnPriceMatch(order, dto.getReturnPrice());
|
|
|
if (amountMsg != null) {
|
|
if (amountMsg != null) {
|