预付提货单结算时余额判断改为该账户下的“预售余额”
parent
3052061eb9
commit
c671763676
|
|
@ -235,6 +235,59 @@ public class PresellOrderService extends BaseService {
|
||||||
|
|
||||||
BigDecimal out = Db.queryBigDecimal(sql, params.toArray());
|
BigDecimal out = Db.queryBigDecimal(sql, params.toArray());
|
||||||
|
|
||||||
|
return out == null ? new BigDecimal(0) : out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据客户id查询客户的可用余额
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BigDecimal getPresellCustomerSurplus2ById(Integer id) {
|
||||||
|
List<Object> params = new ArrayList<>();
|
||||||
|
params.add(id);
|
||||||
|
params.add(id);
|
||||||
|
|
||||||
|
String sql = "SELECT\n" +
|
||||||
|
" IFNULL(\n" +
|
||||||
|
" (\n" +
|
||||||
|
" SELECT\n" +
|
||||||
|
" (\n" +
|
||||||
|
" IFNULL(\n" +
|
||||||
|
" (\n" +
|
||||||
|
" SELECT\n" +
|
||||||
|
" sum(t.presell_amount)\n" +
|
||||||
|
" FROM\n" +
|
||||||
|
" presell_order t\n" +
|
||||||
|
" WHERE\n" +
|
||||||
|
" t.del = 0\n" +
|
||||||
|
" AND t.customer_id = ?\n" +
|
||||||
|
" ),\n" +
|
||||||
|
" 0\n" +
|
||||||
|
" )\n" +
|
||||||
|
" ) - (\n" +
|
||||||
|
" IFNULL(\n" +
|
||||||
|
" (\n" +
|
||||||
|
" SELECT\n" +
|
||||||
|
" sum(\n" +
|
||||||
|
" t.total_price\n" +
|
||||||
|
" )\n" +
|
||||||
|
" FROM\n" +
|
||||||
|
" order_temp t\n" +
|
||||||
|
" WHERE\n" +
|
||||||
|
" t.sale_type = 1\n" +
|
||||||
|
" AND t.state = 5\n" +
|
||||||
|
" AND t.customer_id = ?\n" +
|
||||||
|
" ),\n" +
|
||||||
|
" 0\n" +
|
||||||
|
" )\n" +
|
||||||
|
" )\n" +
|
||||||
|
" ),\n" +
|
||||||
|
" 0\n" +
|
||||||
|
" ) AS suplus";
|
||||||
|
|
||||||
|
BigDecimal out = Db.queryBigDecimal(sql, params.toArray());
|
||||||
|
|
||||||
return out == null ? new BigDecimal(0) : out;
|
return out == null ? new BigDecimal(0) : out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1127,7 +1127,7 @@ public class OrderTempSyncService {
|
||||||
}
|
}
|
||||||
|
|
||||||
//账户可用余额
|
//账户可用余额
|
||||||
BigDecimal availableBalance = PresellOrderService.me.getPresellCustomerSurplusById(ordercluster.getCustomerId());
|
BigDecimal availableBalance = PresellOrderService.me.getPresellCustomerSurplus2ById(ordercluster.getCustomerId());
|
||||||
if (availableBalance == null || availableBalance.compareTo(min) <= 0) {
|
if (availableBalance == null || availableBalance.compareTo(min) <= 0) {
|
||||||
return Result.failed("客户余额不足");
|
return Result.failed("客户余额不足");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue