md
This commit is contained in:
parent
5b5f057ea2
commit
3eaf01cd24
@ -215,7 +215,7 @@ public class EmisBaseService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 新占用下单额度
|
||||
* 新下单使用信用额度
|
||||
* @param emisWaybill
|
||||
*/
|
||||
public void newUseQuotaCredit(EmisWaybill emisWaybill) throws EmisBizError {
|
||||
@ -267,7 +267,7 @@ public class EmisBaseService {
|
||||
queryCreditSalesmen.setSalesmen(emisWaybill.getSalesmen());
|
||||
queryCreditSalesmen.getParams().put("sendDate",emisWaybill.getSendDate());
|
||||
queryCreditSalesmen.setTransType(emisWaybill.getTransType());
|
||||
List<EmisCreditSalesmen> listCreditSalesmen=emisCreditSalesmenMapper.selectEmisCreditSalesmenList(queryCredit);
|
||||
List<EmisCreditSalesmen> listCreditSalesmen=emisCreditSalesmenMapper.selectEmisCreditSalesmenList(queryCreditSalesmen);
|
||||
|
||||
if(!CollectionUtils.isEmpty(listCreditSalesmen)){
|
||||
EmisCreditSalesmen item0=listCreditSalesmen.get(0);
|
||||
@ -299,6 +299,121 @@ public class EmisBaseService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新运单调整信用额度
|
||||
* @param emisWaybill
|
||||
*/
|
||||
public void ajustUseQuotaCredit(EmisWaybill emisWaybill,EmisWaybill oldEmisWaybill) throws EmisBizError {
|
||||
|
||||
// 删除原来的数据数据
|
||||
EmisCreditCustomerRecord queryRecord = new EmisCreditCustomerRecord();
|
||||
queryRecord.setBillCode(emisWaybill.getBillCode());
|
||||
queryRecord.setChangeType("2");
|
||||
List<EmisCreditCustomerRecord> listRecord=emisCreditCustomerRecordMapper.selectEmisCreditCustomerRecordList(queryRecord);
|
||||
if(!CollectionUtils.isEmpty(listRecord)){
|
||||
EmisCreditCustomerRecord item0=listRecord.get(0);
|
||||
BigDecimal changeMoney=item0.getChangeMoney();
|
||||
// 删除扣减数据
|
||||
emisCreditCustomerRecordMapper.deleteEmisCreditCustomerRecordById(item0.getId());
|
||||
// 增加余额数据
|
||||
emisCreditCustomerMapper.changeBalance(item0.getAccCode(),changeMoney);
|
||||
}
|
||||
|
||||
// // 返回越来现金数据
|
||||
// EmisCreditSalesmenRecord queryRecord = new EmisCreditCustomerRecord();
|
||||
// queryRecord.setBillCode(emisWaybill.getBillCode());
|
||||
// queryRecord.setChangeType("2");
|
||||
// List<EmisCreditCustomerRecord> listRecord=emisCreditCustomerRecordMapper.selectEmisCreditCustomerRecordList(queryRecord);
|
||||
// if(!CollectionUtils.isEmpty(listRecord)){
|
||||
// EmisCreditCustomerRecord item0=listRecord.get(0);
|
||||
// BigDecimal changeMoney=item0.getChangeMoney();
|
||||
// // 删除扣减数据
|
||||
// emisCreditCustomerRecordMapper.deleteEmisCreditCustomerRecordById(item0.getId());
|
||||
// // 增加余额数据
|
||||
// emisCreditCustomerMapper.changeBalance(item0.getAccCode(),changeMoney);
|
||||
// }
|
||||
|
||||
|
||||
// 删除原来的占用,重新变更数据
|
||||
String paymentType=emisWaybill.getPaymentType();
|
||||
// 月结客户
|
||||
if("2".equals(paymentType)
|
||||
|| "4".equals(paymentType)
|
||||
|| "5".equals(paymentType)
|
||||
){
|
||||
// 月结额度占用
|
||||
EmisCreditCustomer queryCreditCustomer = new EmisCreditCustomer();
|
||||
queryCreditCustomer.setMonthlyPayCode(emisWaybill.getCustNo());
|
||||
queryCreditCustomer.getParams().put("sendDate",emisWaybill.getSendDate());
|
||||
queryCreditCustomer.setTransType(emisWaybill.getTransType());
|
||||
List<EmisCreditCustomer> listCreditCustomer=emisCreditCustomerMapper.selectEmisCreditCustomerList(queryCreditCustomer);
|
||||
|
||||
if(!CollectionUtils.isEmpty(listCreditCustomer)){
|
||||
EmisCreditCustomer item0=listCreditCustomer.get(0);
|
||||
if(emisWaybill.getFreight().compareTo(item0.getCurMoney()) == 1 ){
|
||||
// 提示异常
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "超出信用额度");
|
||||
}else{
|
||||
|
||||
// 当前余额,变动后余额,变动金额
|
||||
BigDecimal curMoney=item0.getCurMoney();
|
||||
BigDecimal backBalance=curMoney.subtract(emisWaybill.getFreight());
|
||||
BigDecimal changeMoney=BigDecimal.ZERO.subtract(emisWaybill.getFreight());
|
||||
|
||||
// 扣减额度,插入扣额度数据明细
|
||||
EmisCreditCustomerRecord itemRecord=new EmisCreditCustomerRecord();
|
||||
itemRecord.setAccCode(item0.getAccCode());
|
||||
itemRecord.setCustomerCode(item0.getCustomerCode());
|
||||
itemRecord.setBillCode(emisWaybill.getBillCode());
|
||||
itemRecord.setPreBalance(curMoney);
|
||||
itemRecord.setChangeMoney(emisWaybill.getFreight());
|
||||
itemRecord.setChangeType("2");
|
||||
itemRecord.setBackBalance(backBalance);
|
||||
emisCreditCustomerRecordMapper.insertEmisCreditCustomerRecord(itemRecord);
|
||||
|
||||
// 更新余额
|
||||
emisCreditCustomerMapper.changeBalance(item0.getAccCode(),changeMoney);
|
||||
}
|
||||
}
|
||||
}else if("1".equals(paymentType)
|
||||
|| "3".equals(paymentType)
|
||||
){
|
||||
// 现金额度占用
|
||||
EmisCreditSalesmen queryCreditSalesmen= new EmisCreditSalesmen();
|
||||
queryCreditSalesmen.setSalesmen(emisWaybill.getSalesmen());
|
||||
queryCreditSalesmen.getParams().put("sendDate",emisWaybill.getSendDate());
|
||||
queryCreditSalesmen.setTransType(emisWaybill.getTransType());
|
||||
List<EmisCreditSalesmen> listCreditSalesmen=emisCreditSalesmenMapper.selectEmisCreditSalesmenList(queryCredit);
|
||||
|
||||
if(!CollectionUtils.isEmpty(listCreditSalesmen)){
|
||||
EmisCreditSalesmen item0=listCreditSalesmen.get(0);
|
||||
if(emisWaybill.getFreight().compareTo(item0.getCurMoney()) == 1 ){
|
||||
// 提示异常
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "超出信用额度");
|
||||
}else{
|
||||
|
||||
// 当前余额,变动后余额,变动金额
|
||||
BigDecimal curMoney=item0.getCurMoney();
|
||||
BigDecimal backBalance=curMoney.subtract(emisWaybill.getFreight());
|
||||
BigDecimal changeMoney=BigDecimal.ZERO.subtract(emisWaybill.getFreight());
|
||||
|
||||
// 扣减额度,插入扣额度数据明细
|
||||
EmisCreditSalesmenRecord itemRecord=new EmisCreditSalesmenRecord();
|
||||
itemRecord.setAccCode(item0.getAccCode());
|
||||
itemRecord.setSalesmen(item0.getSalesmen());
|
||||
itemRecord.setBillCode(emisWaybill.getBillCode());
|
||||
itemRecord.setPreBalance(curMoney);
|
||||
itemRecord.setChangeMoney(emisWaybill.getFreight());
|
||||
itemRecord.setChangeType("2");
|
||||
itemRecord.setBackBalance(backBalance);
|
||||
emisCreditSalesmenRecordMapper.insertEmisCreditSalesmenRecord(itemRecord);
|
||||
|
||||
// 更新余额
|
||||
emisCreditSalesmenMapper.changeBalance(item0.getAccCode(),changeMoney);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -26,9 +26,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
del_flag='0'
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="accCode != null and accCode != ''"> and acc_code=#{accCode}</if>
|
||||
<if test="customerCode != null and customerCode != ''"> and customer_code like concat('%', #{customerCode}, '%')</if>
|
||||
<if test="billCode != null and billCode != ''"> and bill_code like concat('%', #{billCode}, '%')</if>
|
||||
<if test="changeType != null and changeType != ''"> and change_type like concat('%', #{changeType}, '%')</if>
|
||||
<if test="customerCode != null and customerCode != ''"> and customer_code=#{customerCode}</if>
|
||||
<if test="billCode != null and billCode != ''"> and bill_code=#{billCode}</if>
|
||||
<if test="changeType != null and changeType != ''"> and change_type=#{changeType}</if>
|
||||
<if test="changeMoney != null "> and change_money = #{changeMoney}</if>
|
||||
<if test="preBalance != null "> and pre_balance = #{preBalance}</if>
|
||||
<if test="backBalance != null "> and back_balance = #{backBalance}</if>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user