@ -85,6 +85,7 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
@Override
@Override
public JSONObject takeEncourageMoney ( String orderId , String visitorOpenId ) {
public JSONObject takeEncourageMoney ( String orderId , String visitorOpenId ) {
logger . info ( "=====takeEncourageMoney+" + orderId ) ;
JSONObject config = currentEncourageConfig ( ) ;
JSONObject config = currentEncourageConfig ( ) ;
if ( config ! = null ) {
if ( config ! = null ) {
if ( customerEncourageMoneyAccessLogMapper . findByOrderId ( orderId ) ! = null ) {
if ( customerEncourageMoneyAccessLogMapper . findByOrderId ( orderId ) ! = null ) {
@ -239,16 +240,22 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
Date toDate = config . getDate ( "to_date" ) ;
Date toDate = config . getDate ( "to_date" ) ;
status . put ( "to" , DateFormatUtils . format ( toDate , "MM-dd" ) ) ;
status . put ( "to" , DateFormatUtils . format ( toDate , "MM-dd" ) ) ;
JSONObject member = customerMembershipMapper . findByPaymentOpenId ( openid ) ;
JSONObject member = customerMembershipMapper . findByPaymentOpenId ( openid ) ;
JSONObject use = customerEncourageMoneyAccessLogMapper . sumMoney ( member . getString ( "memeber_id" ) , config . getString ( "event_id" ) ) ;
BigDecimal balance = BigDecimal . ZERO ;
if ( use ! = null ) {
balance = use . getBigDecimal ( "use_amount" ) ;
}
member . put ( "used_amount" , balance . setScale ( 2 , BigDecimal . ROUND_DOWN ) . toPlainString ( ) ) ;
if ( member ! = null ) {
if ( member ! = null ) {
status . put ( "member_info" , member ) ;
status . put ( "member_info" , member ) ;
List < JSONObject > balanceLogs = customerMembershipMapper . listEncourageBalanceHistory ( fromDate , toDate , member . getString ( "member_id" ) ) ;
List < JSONObject > balanceLogs = customerMembershipMapper . listEncourageBalanceHistory ( fromDate , toDate , member . getString ( "member_id" ) ) ;
status . put ( "logs" , balanceLogs ) ;
status . put ( "logs" , balanceLogs ) ;
BigDecimal usedAmount = customerEncourageMoneyUseLogMapper . sumUsed ( member . getString ( "member_id" ) , fromDate , toDate ) ;
// BigDecimal usedAmount = customerEncourageMoneyUseLogMapper.sumUsed(member.getString("member_id"), fromDate, toDate);
member . put ( "used_amount" , usedAmount ) ;
// member.put("used_amount", usedAmount);
} else {
} else {
member = new JSONObject ( ) ;
member = new JSONObject ( ) ;
member . put ( "encourage_balance" , 0 ) ;
member . put ( "encourage_balance" , 0 ) ;
member . put ( "used_amount" , 0 ) ;
// member.put("used_amount", 0);
}
}
status . put ( "member" , member ) ;
status . put ( "member" , member ) ;
return status ;
return status ;