[Y] 父商户处理子商户交易验证

master
taylor.dang 6 years ago
parent b7aa93ba46
commit 1c97b5e1fb

@ -75,17 +75,14 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
@Override
public JSONObject checkOrderRefundAmount(String orderId, JSONObject account) {
JSONObject order = orderMapper.getOrderDetail(orderId);
if (account != null) {
if (account != null && (account.getIntValue("client_id") != order.getIntValue("client_id"))) {
JSONObject client = clientMapper.findClient(account.getIntValue("client_id"));
////父商户全局管理子商户时候,跳过
if (account.getIntValue("client_id") != order.getIntValue("client_id")) {
JSONObject clientOrder = clientMapper.findClient(order.getIntValue("client_id"));
if(!(client.getBoolean("sub_manage") &&
clientOrder.containsKey("parent_client_id")?clientOrder.getIntValue("parent_client_id")==client.getIntValue("client_id"):false)){
JSONObject orderTargetClient = clientMapper.findClient(order.getIntValue("client_id"));
if (orderTargetClient.getIntValue("parent_client_id") != account.getIntValue("client_id")) {
throw new ForbiddenException("Order is not belong to your shop/merchant");
} else if (!client.getBooleanValue("sub_manage")) {
throw new ForbiddenException("Order is not belong to your shop/merchant");
}
}
}
Assert.notNull(order, "Order Not Exists");

Loading…
Cancel
Save