| | |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | //只能同步昨天10之前的数据 |
| | | Calendar caln = Calendar.getInstance(); |
| | | caln.setTime(ydate); |
| | | if(caln.get(Calendar.HOUR_OF_DAY) <= 9){ |
| | | if(caln.get(Calendar.HOUR_OF_DAY) > 10){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,最近同步时间只能截止到昨天10点前!"); |
| | | } |
| | | } |
| | |
| | | detail.setRefundApplyDate(DateUtil.getDateFromString2(info.getRefundTime())); //申请退款时间 |
| | | //计算自行车收入,匹配来自自行车小程序的所有支付成功和退款成功的金额,作为自行车收入(累计收款金额-累计退款成功金额) |
| | | if(StringUtils.equals(detail.getAppid(), WxMiniConfig.wxPayService.getConfig().getAppId())){ |
| | | //自行车收入累计收款金额 |
| | | bill.setBikeFee(bill.getBikeFee().add(detail.getSettlementTotalFee())); |
| | | if(StringUtils.equals(detail.getRefundSuccessStatus(),"SUCCESS")){ |
| | | //自行车收入累计收款金额(支付成功总金额-退款总金额) |
| | | if(StringUtils.equals(info.getTradeState(),"SUCCESS")){ |
| | | //如果是交易 |
| | | bill.setBikeFee(bill.getBikeFee().add(detail.getSettlementTotalFee())); |
| | | bill.setBikeFee(bill.getBikeFee().subtract(detail.getCmmsAmt()) ); |
| | | }else if(StringUtils.equals(info.getTradeState(),"REFUND" )){ |
| | | //如果退款成功,扣除退款金额 |
| | | bill.setBikeFee(bill.getBikeFee().subtract(detail.getApplyRefundFee())); |
| | | bill.setBikeFee(bill.getBikeFee().subtract(detail.getRefundFee()) ); |
| | | bill.setBikeFee(bill.getBikeFee().subtract(detail.getCmmsAmt()) ); |
| | | } |
| | | } |
| | | |