|
@@ -103,6 +103,11 @@ public class IposFeignController extends BaseFeignController {
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
public VaultsResponse<List<SplitPay>> splitOrder(@RequestBody List<SplitInfo> list) {
|
|
public VaultsResponse<List<SplitPay>> splitOrder(@RequestBody List<SplitInfo> list) {
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 分账金额=(总价-手续费)
|
|
|
|
|
+ * 分账 = 分账金额*99%;平台自留: 分账金额*1%
|
|
|
|
|
+ */
|
|
|
|
|
+ BigDecimal proportion = new BigDecimal(0.99);
|
|
|
List<SplitPay> returnList = Lists.newArrayList();
|
|
List<SplitPay> returnList = Lists.newArrayList();
|
|
|
for (SplitInfo splitInfo : list) {
|
|
for (SplitInfo splitInfo : list) {
|
|
|
//List<SplitRecords> splitRecordsList = Lists.newArrayList();
|
|
//List<SplitRecords> splitRecordsList = Lists.newArrayList();
|
|
@@ -137,24 +142,23 @@ public class IposFeignController extends BaseFeignController {
|
|
|
SplitPay sp = new SplitPay();
|
|
SplitPay sp = new SplitPay();
|
|
|
sp.setOrderId(detail.getOrderId());
|
|
sp.setOrderId(detail.getOrderId());
|
|
|
sp.setSplitId(records.getSplitId());
|
|
sp.setSplitId(records.getSplitId());
|
|
|
- //运算价格
|
|
|
|
|
- BigDecimal price = new BigDecimal(detail.getPrice()).subtract(chargeAmount);
|
|
|
|
|
-
|
|
|
|
|
- //平台金额
|
|
|
|
|
- BigDecimal ptDecimal = new BigDecimal(split).multiply(price).setScale(0,BigDecimal.ROUND_DOWN);
|
|
|
|
|
|
|
+ //总价格 支付价-手续费
|
|
|
|
|
+ BigDecimal sumPrice = new BigDecimal(detail.getPrice()).subtract(chargeAmount);
|
|
|
|
|
+ //运算价格 总价格*99%
|
|
|
|
|
+ BigDecimal price = sumPrice.multiply(proportion);
|
|
|
|
|
+ detail.setPrice(price.longValue());
|
|
|
|
|
+ //平台金额=总价格-运算价格
|
|
|
|
|
+ BigDecimal ptDecimal = sumPrice.subtract(price);
|
|
|
BigDecimal valDecimal = new BigDecimal("1");
|
|
BigDecimal valDecimal = new BigDecimal("1");
|
|
|
if(ptDecimal.longValue() > 0){
|
|
if(ptDecimal.longValue() > 0){
|
|
|
valDecimal = new BigDecimal(ptDecimal.longValue());
|
|
valDecimal = new BigDecimal(ptDecimal.longValue());
|
|
|
}
|
|
}
|
|
|
- price = price.subtract(valDecimal);
|
|
|
|
|
ptAmount = ptAmount.add(valDecimal);
|
|
ptAmount = ptAmount.add(valDecimal);
|
|
|
- detail.setPrice(price.longValue());
|
|
|
|
|
returnList.add(sp);
|
|
returnList.add(sp);
|
|
|
}
|
|
}
|
|
|
pt.setDivAmt(String.valueOf(ptAmount.longValue()));
|
|
pt.setDivAmt(String.valueOf(ptAmount.longValue()));
|
|
|
details.add(pt);
|
|
details.add(pt);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
//一级供应商
|
|
//一级供应商
|
|
|
Map<String, List<SplitDetail>> oneMaps = splitInfo.getDetails().stream().filter(s -> StringUtils.isNotEmpty(s.getSupplierOneMerchantId()) && s.getBelong().equals(1)).collect(Collectors.groupingBy(SplitDetail::getSupplierOneMerchantId));
|
|
Map<String, List<SplitDetail>> oneMaps = splitInfo.getDetails().stream().filter(s -> StringUtils.isNotEmpty(s.getSupplierOneMerchantId()) && s.getBelong().equals(1)).collect(Collectors.groupingBy(SplitDetail::getSupplierOneMerchantId));
|
|
|
|
|
|
|
@@ -204,7 +208,6 @@ public class IposFeignController extends BaseFeignController {
|
|
|
for (SplitDetail detail : maps.get(s)) {
|
|
for (SplitDetail detail : maps.get(s)) {
|
|
|
supplierAmount = supplierAmount.add(new BigDecimal(detail.getSettlementPrice()));
|
|
supplierAmount = supplierAmount.add(new BigDecimal(detail.getSettlementPrice()));
|
|
|
detail.setPrice(new BigDecimal(detail.getPrice()).subtract(new BigDecimal(detail.getSettlementPrice())).longValue());
|
|
detail.setPrice(new BigDecimal(detail.getPrice()).subtract(new BigDecimal(detail.getSettlementPrice())).longValue());
|
|
|
- // detail.setPrice(detail.getPrice() - detail.getSettlementPrice());
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (supplierAmount.compareTo(BigDecimal.ZERO) == 1) {
|
|
if (supplierAmount.compareTo(BigDecimal.ZERO) == 1) {
|