|
|
|
@@ -255,7 +255,11 @@ public class WxFinanceServiceImpl implements WxFinanceService { |
|
|
|
} |
|
|
|
return sum.getAdvanceList(); |
|
|
|
}else { |
|
|
|
faq.setType(EnumFinanceCashierType.RECEIVE.getCode()); |
|
|
|
faq.setReceiveType(EnumFinanceReceiveType.ADVANCE.getCode()); |
|
|
|
faq.setStatus(EnumFinanceReceiveStatus.NORMAL.getCode()); |
|
|
|
faq.setSortColumns(SortField.CreateTime_ASC); |
|
|
|
faq.setHasExtraMoney(EnumYesOrNo.YES.getCode()); |
|
|
|
return wxFinanceReceiveMapper.findList(faq); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -273,6 +277,10 @@ public class WxFinanceServiceImpl implements WxFinanceService { |
|
|
|
}else { |
|
|
|
List<FinanceSetOffDetailVo> setoffList = bill.getSetOffDetailList(); |
|
|
|
for (int j = calcuteDto.getCurrentIndex(); j < calcuteDto.getAdvanceList().size() ; j++) { |
|
|
|
owe = new BigDecimal(bill.getOwe()); |
|
|
|
if (owe.compareTo(b0) <= 0) { |
|
|
|
break; |
|
|
|
} |
|
|
|
WxFinanceReceive advance = calcuteDto.getAdvanceList().get(j); |
|
|
|
BigDecimal remain = new BigDecimal(advance.getRemain()); |
|
|
|
if (remain.compareTo(b0) > 0) { |
|
|
|
@@ -282,7 +290,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { |
|
|
|
FinanceSetOffDetailVo dv = new FinanceSetOffDetailVo(); |
|
|
|
dv.setAdvanceId(advance.getId()); |
|
|
|
BigDecimal billSetOff = null;//账单历史抵扣 |
|
|
|
if (StringUtils.isBlank(bill.getSetOff())) { |
|
|
|
if (StringUtils.isNotBlank(bill.getSetOff())) { |
|
|
|
billSetOff = new BigDecimal(bill.getSetOff()); |
|
|
|
}else { |
|
|
|
billSetOff = b0; |
|
|
|
@@ -302,6 +310,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { |
|
|
|
dv.setSetoff(remain.toPlainString()); |
|
|
|
setoffList.add(dv); |
|
|
|
bill.setSetOffDetailList(setoffList); |
|
|
|
calcuteDto.setCurrentIndex(calcuteDto.getCurrentIndex()+1); |
|
|
|
setSetOff(bill,calcuteDto); |
|
|
|
}else { |
|
|
|
bill.setSetOff(billSetOff.add(owe).toPlainString()); |
|
|
|
@@ -310,6 +319,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { |
|
|
|
dv.setSetoff(owe.toPlainString()); |
|
|
|
setoffList.add(dv); |
|
|
|
bill.setSetOffDetailList(setoffList); |
|
|
|
break; |
|
|
|
} |
|
|
|
}else { |
|
|
|
calcuteDto.setCurrentIndex(calcuteDto.getCurrentIndex()+1); |
|
|
|
@@ -342,6 +352,9 @@ public class WxFinanceServiceImpl implements WxFinanceService { |
|
|
|
List<WxAllBill> retList = new ArrayList<WxAllBill>(); |
|
|
|
for (int i = 0 ; i < bills.size() ; i ++) { |
|
|
|
WxAllBill be = bills.get(i); |
|
|
|
be.setSetOffDetailList(null); |
|
|
|
be.setCurrentReceive(null); |
|
|
|
be.setCurrentSetOff(null); |
|
|
|
WxAllBill bill = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(be.getBillType()), merchant, be.getId()); |
|
|
|
be.setReceivePay(bill.getReceivePay()); |
|
|
|
be.setPay(bill.getPay()); |
|
|
|
@@ -658,6 +671,20 @@ public class WxFinanceServiceImpl implements WxFinanceService { |
|
|
|
createFinanceReceiveBill(addreceive,bill,be.getCurrentSetOff(),null,Constant.bill_pay_way_setoff); |
|
|
|
//处理预充关联 |
|
|
|
createFinanceReceiveSetoff(addreceive,be,bill); |
|
|
|
WxBillPayDTO payDto = new WxBillPayDTO(); |
|
|
|
payDto.updateTenantInfo(addreceive); |
|
|
|
payDto.setId(be.getId()); |
|
|
|
payDto.setBillTypeValue(be.getBillType()); |
|
|
|
payDto.setAddpay("0"); |
|
|
|
payDto.setSetOff(be.getCurrentSetOff()); |
|
|
|
payDto.setPayWay(Constant.bill_pay_way_setoff); |
|
|
|
if (null == payWay0) { |
|
|
|
payWay0 = new WxBillPayWay(); |
|
|
|
payWay0.setId(Constant.bill_pay_way_setoff); |
|
|
|
} |
|
|
|
payDto.setPayWayObject(payWay0); |
|
|
|
payDto.setRemark("收款单收款["+addreceive.getId()+"]冲抵"+addreceive.getRemark()); |
|
|
|
wxBillAllHelper.updatePay(payDto, user); |
|
|
|
} |
|
|
|
return noNeedCreate; |
|
|
|
} |
|
|
|
@@ -768,7 +795,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { |
|
|
|
sortBills(bills); |
|
|
|
|
|
|
|
//创建主收款单 |
|
|
|
WxFinanceReceive addreceive = generateReceive(receiveId,user,EnumFinanceCashierType.PAY ,EnumFinanceReceiveType.RECEIVE, null,payTotal.toPlainString(), record.getMerchantId(), null, record.getRemark()); |
|
|
|
WxFinanceReceive addreceive = generateReceive(receiveId,user,EnumFinanceCashierType.PAY ,EnumFinanceReceiveType.RECEIVE, "0",payTotal.toPlainString(), record.getMerchantId(), null, record.getRemark()); |
|
|
|
if (payTotal.compareTo(new BigDecimal(0)) > 0) { |
|
|
|
addreceive.setMoneyDetail(JSON.toJSONString(record.getPayWays())); |
|
|
|
wxFinanceReceivePaywayMapper.insertPayWays(record.getTenantId(),receivePayWayList); |
|
|
|
@@ -952,6 +979,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { |
|
|
|
rsq.updateTenantInfo(record); |
|
|
|
rsq.setBillId(bill.getId()); |
|
|
|
rsq.setBillType(bill.getBillType()); |
|
|
|
rsq.setAdvanceId(rb.getReceiveId()); |
|
|
|
List<WxFinanceReceiveSetoff> setoffList = wxFinanceReceiveSetoffMapper.findList(rsq); |
|
|
|
if (null != setoffList) { |
|
|
|
for (int j = 0 ; j < setoffList.size() ; j ++) { |
|
|
|
|