|
|
@@ -82,7 +82,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void createOrder(AliBusinessCircleOrder record) { |
|
|
|
|
|
|
|
|
public void createOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record) { |
|
|
String lockKey = StringUtils.join(ALI_CIRCLE_KEY,record.getTransactionId(), ":",EnumYesOrNo.NO.getCode(),":","lock"); |
|
|
String lockKey = StringUtils.join(ALI_CIRCLE_KEY,record.getTransactionId(), ":",EnumYesOrNo.NO.getCode(),":","lock"); |
|
|
long time = System.currentTimeMillis() + 2000; |
|
|
long time = System.currentTimeMillis() + 2000; |
|
|
String timeStr = String.valueOf(time); |
|
|
String timeStr = String.valueOf(time); |
|
|
@@ -99,12 +99,15 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder |
|
|
|
|
|
|
|
|
//TODO 第三方获取门店(标识可能发生变化) |
|
|
//TODO 第三方获取门店(标识可能发生变化) |
|
|
// WxMerchant wxMerchant = wxMerchantService.getById(Long.parseLong(record.getMallStoreId())); |
|
|
// WxMerchant wxMerchant = wxMerchantService.getById(Long.parseLong(record.getMallStoreId())); |
|
|
WxMerchant wxMerchant = wxMerchantService.getMerchantByEncode(record.getMallStoreId()); |
|
|
|
|
|
if(wxMerchant != null){ |
|
|
|
|
|
record.setMerchantId(wxMerchant.getId()); |
|
|
|
|
|
}else{ |
|
|
|
|
|
logger.error("--Ali商圈付款通知消息未找到门店--mallStoreId="+record.getMallStoreId()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//必有门店 |
|
|
|
|
|
// WxMerchant wxMerchant = wxMerchantService.getMerchantByEncode(record.getMallStoreId()); |
|
|
|
|
|
// if(wxMerchant != null){ |
|
|
|
|
|
// record.setMerchantId(wxMerchant.getId()); |
|
|
|
|
|
// }else{ |
|
|
|
|
|
// logger.error("--Ali商圈付款通知消息未找到门店--mallStoreId="+record.getMallStoreId()); |
|
|
|
|
|
// } |
|
|
|
|
|
record.setMerchantId(wxMerchant.getId()); |
|
|
|
|
|
|
|
|
AliPayCUser userQ = new AliPayCUser(); |
|
|
AliPayCUser userQ = new AliPayCUser(); |
|
|
userQ.updateTenantInfo(record); |
|
|
userQ.updateTenantInfo(record); |
|
|
userQ.setAlipayUserId(record.getBuyerId()); |
|
|
userQ.setAlipayUserId(record.getBuyerId()); |
|
|
@@ -140,7 +143,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder |
|
|
creditHistory.setMerchantId(record.getMerchantId()); |
|
|
creditHistory.setMerchantId(record.getMerchantId()); |
|
|
creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); |
|
|
creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); |
|
|
creditHistory.setSpend(record.getPayAmount()); |
|
|
creditHistory.setSpend(record.getPayAmount()); |
|
|
creditHistory.setChangePurpose("Ali商圈消费:消费商户["+record.getMallName()+"] ("+record.getPayAmountStr()+"元) "); |
|
|
|
|
|
|
|
|
creditHistory.setChangePurpose("Ali商圈消费:消费商户["+wxMerchant.getName()+"] ("+record.getPayAmountStr()+"元) "); |
|
|
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); |
|
|
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); |
|
|
Integer creditNum = 0; |
|
|
Integer creditNum = 0; |
|
|
if (creditHistory.getCreditNum() != null) { |
|
|
if (creditHistory.getCreditNum() != null) { |
|
|
@@ -169,7 +172,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void insertRefundNoticeOrder(AliBusinessCircleOrder record) { |
|
|
|
|
|
|
|
|
public void insertRefundNoticeOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record) { |
|
|
AliBusinessCircleOrder order = this.getOrderByTransactionId(record.getTransactionId(),record.getTenantId()); |
|
|
AliBusinessCircleOrder order = this.getOrderByTransactionId(record.getTransactionId(),record.getTenantId()); |
|
|
if(order == null){ |
|
|
if(order == null){ |
|
|
logger.error("--Ali商圈退款--付款消息未找到--transactionId="+record.getTransactionId()); |
|
|
logger.error("--Ali商圈退款--付款消息未找到--transactionId="+record.getTransactionId()); |
|
|
@@ -219,7 +222,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder |
|
|
creditHistory.setCUserId(record.getCUserId()); |
|
|
creditHistory.setCUserId(record.getCUserId()); |
|
|
creditHistory.setCreateDate(new Date()); |
|
|
creditHistory.setCreateDate(new Date()); |
|
|
creditHistory.setCouponId(record.getId()); |
|
|
creditHistory.setCouponId(record.getId()); |
|
|
creditHistory.setMerchantId(record.getMerchantId()); |
|
|
|
|
|
|
|
|
creditHistory.setMerchantId(order.getMerchantId()); |
|
|
creditHistory.setCreditType(EnumScoreType.REFUND_CONSUMPTION.getCode()); |
|
|
creditHistory.setCreditType(EnumScoreType.REFUND_CONSUMPTION.getCode()); |
|
|
int points = 0; |
|
|
int points = 0; |
|
|
if((refundAmount + record.getRefundAmount()) == amount){ |
|
|
if((refundAmount + record.getRefundAmount()) == amount){ |
|
|
@@ -233,7 +236,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder |
|
|
|
|
|
|
|
|
creditHistory.setCreditNum(points); |
|
|
creditHistory.setCreditNum(points); |
|
|
creditHistory.setSpend(0-record.getRefundAmount()); |
|
|
creditHistory.setSpend(0-record.getRefundAmount()); |
|
|
creditHistory.setChangePurpose("Ali商圈消费退款:商户["+record.getMallName()+"] ("+record.getRefundAmountStr()+"元) "); |
|
|
|
|
|
|
|
|
creditHistory.setChangePurpose("Ali商圈消费退款:商户["+wxMerchant.getName()+"] ("+record.getRefundAmountStr()+"元) "); |
|
|
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); |
|
|
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); |
|
|
Integer creditNum = 0; |
|
|
Integer creditNum = 0; |
|
|
if (creditHistory.getCreditNum() != null) { |
|
|
if (creditHistory.getCreditNum() != null) { |
|
|
|