|
@@ -51,7 +51,9 @@ public class PayFeeServiceImp implements PayFeeService {
|
|
|
@Resource
|
|
|
BaseClosingAccountInfoMapper baseClosingAccountInfoMapper;
|
|
|
|
|
|
- public String payFeeCounter( String id,Integer payway,BigDecimal transAmount, Integer balancetype){
|
|
|
+ public PayfeeResult payFeeCounter( String id,Integer payway,BigDecimal transAmount, Integer balancetype){
|
|
|
+ String result=""; //执行结果描述
|
|
|
+ BigDecimal fees=BigDecimal.ZERO; //抵扣金额
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
|
|
|
Integer siteId = loginUser.getSiteId();
|
|
@@ -132,6 +134,7 @@ public class PayFeeServiceImp implements PayFeeService {
|
|
|
//欠费不大于零直接移除
|
|
|
iterator.remove();
|
|
|
}else if(remaining.compareTo(payReceivable.getDebt()) != -1){
|
|
|
+ fees=fees.add(payReceivable.getDebt());
|
|
|
//预存余额不小于欠费(完全抵扣)
|
|
|
iterator.remove();
|
|
|
remaining = remaining.subtract(payReceivable.getDebt());//修改余额
|
|
@@ -152,6 +155,8 @@ public class PayFeeServiceImp implements PayFeeService {
|
|
|
}else{
|
|
|
//预存余额小于于欠费(部分抵扣)
|
|
|
//生成并保存实收
|
|
|
+ fees= fees.add(remaining.negate());
|
|
|
+
|
|
|
PayPayReceived payPayReceived = getReceived(payReceivable, year, month, localDateTime,payway,payseriesno,remaining,feetypeMap, siteId, customerId, userId );
|
|
|
|
|
|
PayTransactiondetails payTransactiondetails = getPayTransactiondetails(5, paywayName,localDateTime, payCustomRechargeDto, payseriesno, month, year, remaining.negate() , siteId, customerId, userId );
|
|
@@ -171,7 +176,8 @@ public class PayFeeServiceImp implements PayFeeService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ result+="<br>预存款抵扣:"+String.format("%.2f",fees)+"元";
|
|
|
+ fees=BigDecimal.ZERO;//
|
|
|
//缴费抵扣
|
|
|
Iterator<PayReceivable> iteratorTransAmount = payReceivableList.iterator();
|
|
|
while(iteratorTransAmount.hasNext()) {
|
|
@@ -184,6 +190,7 @@ public class PayFeeServiceImp implements PayFeeService {
|
|
|
iteratorTransAmount.remove();
|
|
|
}else if(transAmount.compareTo(payReceivable.getDebt()) != -1){
|
|
|
//交易金额不小于欠费(完全抵扣)
|
|
|
+ fees=fees.add(payReceivable.getDebt());
|
|
|
iteratorTransAmount.remove();
|
|
|
transAmount = transAmount.subtract(payReceivable.getDebt());//修改剩余交易金额
|
|
|
|
|
@@ -198,6 +205,7 @@ public class PayFeeServiceImp implements PayFeeService {
|
|
|
}else{
|
|
|
//交易金额小于于欠费(部分抵扣)
|
|
|
//生成并保存实收
|
|
|
+ fees=fees.add(transAmount);
|
|
|
getReceived(payReceivable, year, month, localDateTime,payway,payseriesno,transAmount,feetypeMap, siteId, customerId, userId );
|
|
|
//修改应收
|
|
|
payReceivable.setDebt(payReceivable.getDebt().subtract(transAmount));
|
|
@@ -209,8 +217,10 @@ public class PayFeeServiceImp implements PayFeeService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ result+="<br>支付金额抵扣:"+String.format("%.2f",fees)+"元";
|
|
|
//余额充值或划扣有余额
|
|
|
if(balancetype == 1 && transAmount.compareTo(BigDecimal.ZERO) == 1){
|
|
|
+ result+="<br>余额转预存:"+String.format("%.2f",transAmount)+"元";
|
|
|
//修改余额
|
|
|
remaining=remaining.add(transAmount);
|
|
|
//生成交易明细
|
|
@@ -219,6 +229,8 @@ public class PayFeeServiceImp implements PayFeeService {
|
|
|
payTransactiondetails.setTranstype(4);
|
|
|
payTransactiondetails.setTranstypeLabel("账户转预存");
|
|
|
transactiondetailsDtoList.add(payTransactiondetails);
|
|
|
+ }else{
|
|
|
+ result+="<br>余额找零:"+String.format("%.2f", transAmount)+"元";
|
|
|
}
|
|
|
|
|
|
//修改预存账户
|
|
@@ -234,7 +246,13 @@ public class PayFeeServiceImp implements PayFeeService {
|
|
|
if(transactiondetailsDtoList.size()>0)
|
|
|
payTransactiondetailsMapper.batchInsert(transactiondetailsDtoList);
|
|
|
//返回批次号
|
|
|
- return payseriesno;
|
|
|
+
|
|
|
+ PayfeeResult payfeeResult=new PayfeeResult();
|
|
|
+ payfeeResult.setMsg(result);
|
|
|
+ payfeeResult.setTransType(0);
|
|
|
+ payfeeResult.setPayway(payway);
|
|
|
+ payfeeResult.setPayseriesno(payseriesno);
|
|
|
+ return payfeeResult;
|
|
|
|
|
|
|
|
|
}
|
|
@@ -494,7 +512,7 @@ public class PayFeeServiceImp implements PayFeeService {
|
|
|
*
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public String rechargefeeCounter(String accountId , BigDecimal transAmount, Integer payway ){
|
|
|
+ public PayfeeResult rechargefeeCounter(String accountId , BigDecimal transAmount, Integer payway ){
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
|
|
|
Integer siteId = loginUser.getSiteId();
|
|
@@ -534,7 +552,12 @@ public class PayFeeServiceImp implements PayFeeService {
|
|
|
//生成批次号
|
|
|
// 微信:W 现金、预存账户:C 银行:B 支付宝:A
|
|
|
String payseriesno = recharge(transAmount, payway, siteId, customerId, userId, paywayName, localDateTime, payCustomRechargeDto);
|
|
|
- return payseriesno;
|
|
|
+ PayfeeResult payfeeResult =new PayfeeResult();
|
|
|
+ payfeeResult.setPayseriesno(payseriesno);
|
|
|
+ payfeeResult.setTransType(1);
|
|
|
+ payfeeResult.setPayway(payway);
|
|
|
+ payfeeResult.setMsg("<br>充值金额:"+String.format("%.2f", transAmount)+"元");
|
|
|
+ return payfeeResult;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -818,4 +841,5 @@ public class PayFeeServiceImp implements PayFeeService {
|
|
|
public List<PayInvoiceDto> getPayinvoiceInfo(BigInteger accountId, Integer year) {
|
|
|
return payFeeMapper.getPayinvoiceInfo(accountId, year);
|
|
|
}
|
|
|
+
|
|
|
}
|