master
wangning 7 years ago
parent d5165e50aa
commit ab111ce878

@ -131,7 +131,7 @@ public class CustomerImpressionServiceImpl implements CustomerImpressionService
JSONObject clientCustomerInfo = clientCustomersMapper.getClientCustomerWithNull(client_id, customer_id); JSONObject clientCustomerInfo = clientCustomersMapper.getClientCustomerWithNull(client_id, customer_id);
if (clientCustomerInfo == null) { 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 { try {
JSONObject client_customer = new JSONObject(); JSONObject client_customer = new JSONObject();
client_customer.put("client_id", order.getIntValue("client_id")); client_customer.put("client_id", order.getIntValue("client_id"));
@ -216,10 +216,10 @@ public class CustomerImpressionServiceImpl implements CustomerImpressionService
if (userInfo == null) { if (userInfo == null) {
userInfo = customerRelationAlipayMapper.findCustomerByUserId(customer_id); userInfo = customerRelationAlipayMapper.findCustomerByUserId(customer_id);
} }
JSONObject clientCustomerInfo = clientCustomersMapper.getClientCustomerWithNull(order.getIntValue("client_id"), customer_id); locker.lock(CUSTOMER_IMPRESSION_PREFIX + customer_id, 30_000, 30_000);
if (clientCustomerInfo == null) { try {
locker.lock(CUSTOMER_IMPRESSION_PREFIX+customer_id, 30_000, 30_000); JSONObject clientCustomerInfo = clientCustomersMapper.getClientCustomerWithNull(order.getIntValue("client_id"), customer_id);
try { if (clientCustomerInfo == null) {
JSONObject client_customer = new JSONObject(); JSONObject client_customer = new JSONObject();
client_customer.put("client_id", order.getIntValue("client_id")); client_customer.put("client_id", order.getIntValue("client_id"));
client_customer.put("customer_id", order.getString("customer_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("total_amount", order.getBigDecimal("total_amount"));
client_customer.put("last_payment_time", order.getDate("confirm_time")); client_customer.put("last_payment_time", order.getDate("confirm_time"));
clientCustomersMapper.insert(client_customer); clientCustomersMapper.insert(client_customer);
} finally { } else {
locker.unlock(customer_id); clientCustomerInfo.put("payment_times", 1);
} clientCustomerInfo.put("client_id", order.getIntValue("client_id"));
} else { clientCustomerInfo.put("customer_id", order.getString("customer_id"));
clientCustomerInfo.put("payment_times", 1); clientCustomerInfo.put("total_amount", order.getBigDecimal("total_amount"));
clientCustomerInfo.put("client_id", order.getIntValue("client_id")); if (userInfo != null) {
clientCustomerInfo.put("customer_id", order.getString("customer_id")); clientCustomerInfo.put("headimg", userInfo.getString("headimg"));
clientCustomerInfo.put("total_amount", order.getBigDecimal("total_amount")); clientCustomerInfo.put("nick_name", userInfo.getString("nickname"));
if (userInfo != null) { }
clientCustomerInfo.put("headimg", userInfo.getString("headimg")); clientCustomerInfo.put("last_payment_time", order.getDate("confirm_time"));
clientCustomerInfo.put("nick_name", userInfo.getString("nickname")); clientCustomersMapper.updateAfterPaymentFinish(clientCustomerInfo);
} }
clientCustomerInfo.put("last_payment_time", order.getDate("confirm_time")); } finally {
clientCustomersMapper.updateAfterPaymentFinish(clientCustomerInfo); locker.unlock(customer_id);
} }
} catch (Exception e) { } catch (Exception e) {
logger.debug("Reduce Customer Impression Error Redis Value =" + redisValue, e); logger.debug("Reduce Customer Impression Error Redis Value =" + redisValue, e);

Loading…
Cancel
Save