From ab111ce878dea553507de54c27baaa6bd12f717c Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Wed, 28 Feb 2018 16:58:48 +0800 Subject: [PATCH] update --- .../impls/CustomerImpressionServiceImpl.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionServiceImpl.java index 20aaec0b0..b00b975d3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionServiceImpl.java @@ -131,7 +131,7 @@ public class CustomerImpressionServiceImpl implements CustomerImpressionService JSONObject clientCustomerInfo = clientCustomersMapper.getClientCustomerWithNull(client_id, customer_id); if (clientCustomerInfo == null) { - locker.lock(CUSTOMER_IMPRESSION_PREFIX+customer_id, 30_000, 30_000); + locker.lock(CUSTOMER_IMPRESSION_PREFIX + customer_id, 30_000, 30_000); try { JSONObject client_customer = new JSONObject(); client_customer.put("client_id", order.getIntValue("client_id")); @@ -216,10 +216,10 @@ public class CustomerImpressionServiceImpl implements CustomerImpressionService if (userInfo == null) { userInfo = customerRelationAlipayMapper.findCustomerByUserId(customer_id); } - JSONObject clientCustomerInfo = clientCustomersMapper.getClientCustomerWithNull(order.getIntValue("client_id"), customer_id); - if (clientCustomerInfo == null) { - locker.lock(CUSTOMER_IMPRESSION_PREFIX+customer_id, 30_000, 30_000); - try { + locker.lock(CUSTOMER_IMPRESSION_PREFIX + customer_id, 30_000, 30_000); + try { + JSONObject clientCustomerInfo = clientCustomersMapper.getClientCustomerWithNull(order.getIntValue("client_id"), customer_id); + if (clientCustomerInfo == null) { JSONObject client_customer = new JSONObject(); client_customer.put("client_id", order.getIntValue("client_id")); client_customer.put("customer_id", order.getString("customer_id")); @@ -234,20 +234,20 @@ public class CustomerImpressionServiceImpl implements CustomerImpressionService client_customer.put("total_amount", order.getBigDecimal("total_amount")); client_customer.put("last_payment_time", order.getDate("confirm_time")); clientCustomersMapper.insert(client_customer); - } finally { - locker.unlock(customer_id); - } - } else { - clientCustomerInfo.put("payment_times", 1); - clientCustomerInfo.put("client_id", order.getIntValue("client_id")); - clientCustomerInfo.put("customer_id", order.getString("customer_id")); - clientCustomerInfo.put("total_amount", order.getBigDecimal("total_amount")); - if (userInfo != null) { - clientCustomerInfo.put("headimg", userInfo.getString("headimg")); - clientCustomerInfo.put("nick_name", userInfo.getString("nickname")); + } else { + clientCustomerInfo.put("payment_times", 1); + clientCustomerInfo.put("client_id", order.getIntValue("client_id")); + clientCustomerInfo.put("customer_id", order.getString("customer_id")); + clientCustomerInfo.put("total_amount", order.getBigDecimal("total_amount")); + if (userInfo != null) { + clientCustomerInfo.put("headimg", userInfo.getString("headimg")); + clientCustomerInfo.put("nick_name", userInfo.getString("nickname")); + } + clientCustomerInfo.put("last_payment_time", order.getDate("confirm_time")); + clientCustomersMapper.updateAfterPaymentFinish(clientCustomerInfo); } - clientCustomerInfo.put("last_payment_time", order.getDate("confirm_time")); - clientCustomersMapper.updateAfterPaymentFinish(clientCustomerInfo); + } finally { + locker.unlock(customer_id); } } catch (Exception e) { logger.debug("Reduce Customer Impression Error Redis Value =" + redisValue, e);