md
This commit is contained in:
parent
d99ff40c12
commit
f5e9ce9db1
@ -62,8 +62,12 @@ public interface EmisSettleSubBillMapper extends BaseMapper<EmisSettleSubBill>
|
||||
public Map getQueryStatInfoMap(EmisSettleSubBill emisSettleSubBill);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取不开票账单统计
|
||||
* @param emisSettleSubBill
|
||||
* @return
|
||||
*/
|
||||
public Map getNoNeedOpenBillSum(String settleBillNo);
|
||||
|
||||
/**
|
||||
* 根据客户统计月结账单
|
||||
|
||||
@ -489,6 +489,8 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
||||
}
|
||||
|
||||
BigDecimal totalMoney = BigDecimal.ZERO;
|
||||
// 所有开票金额 = 已开票金额+不开票金额
|
||||
BigDecimal totalAllMoney = BigDecimal.ZERO;
|
||||
// 获取运单已经开票记录 // 查询关联的运单表
|
||||
List<Map> listRel=emisSettleInvoiceRelMapper.selectHasOpenInvoiceMapList(settleBillNo);
|
||||
if(!CollectionUtils.isEmpty(listRel)) {
|
||||
@ -528,14 +530,42 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
||||
newBill.setId(oldBill.getId());
|
||||
newBill.setInvoicedMoney(totalMoney);
|
||||
|
||||
if( totalMoney.compareTo(BigDecimal.ZERO) == 0 ){
|
||||
newBill.setOpenBillStatus("0");
|
||||
// 判断是否有不开票的运单,如果有不开票的运单
|
||||
Map noNeedOpenBillMap=emisSettleSubBillMapper.getNoNeedOpenBillSum(settleBillNo);
|
||||
BigDecimal totalNoNeed=BigDecimal.ZERO;
|
||||
if(noNeedOpenBillMap!=null){
|
||||
totalAllMoney=totalAllMoney.add(totalMoney);
|
||||
Integer totalCnt=Integer.valueOf(noNeedOpenBillMap.get("totalCnt").toString());
|
||||
if(totalCnt>0){
|
||||
totalNoNeed=BigDecimal.valueOf(Double.valueOf(noNeedOpenBillMap.get("totalNoNeed").toString()).doubleValue());
|
||||
totalAllMoney=totalAllMoney.add(totalNoNeed);
|
||||
}
|
||||
|
||||
}else{
|
||||
totalAllMoney=totalMoney;
|
||||
}
|
||||
else{
|
||||
if (oldBill.getRecMoney().compareTo(totalMoney) > 0) {
|
||||
newBill.setOpenBillStatus("2");
|
||||
|
||||
if(totalNoNeed.compareTo(BigDecimal.ZERO)>0){
|
||||
if (totalAllMoney.compareTo(BigDecimal.ZERO) == 0) {
|
||||
newBill.setOpenBillStatus("0");
|
||||
} else {
|
||||
newBill.setOpenBillStatus("1");
|
||||
if (oldBill.getRecMoney().compareTo(totalAllMoney) > 0) {
|
||||
newBill.setOpenBillStatus("2");
|
||||
} else {
|
||||
// 已完成
|
||||
newBill.setOpenBillStatus("4");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (totalAllMoney.compareTo(BigDecimal.ZERO) == 0) {
|
||||
newBill.setOpenBillStatus("0");
|
||||
} else {
|
||||
if (oldBill.getRecMoney().compareTo(totalAllMoney) > 0) {
|
||||
newBill.setOpenBillStatus("2");
|
||||
} else {
|
||||
newBill.setOpenBillStatus("1");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 更新账单开票状态
|
||||
|
||||
@ -432,6 +432,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getNoNeedOpenBillSum" parameterType="String" resultType="map">
|
||||
select
|
||||
round(sum(bill_fee),2) as totalNoNeed,count(1) as totalCnt
|
||||
from emis_settle_sub_bill
|
||||
where del_flag='0' and open_bill_status='3' and invoiced_money=0 and `settle_bill_no`=#{settleBillNo}
|
||||
</select>
|
||||
|
||||
<select id="getMonthBillStatInfoMapList" parameterType="EmisSettleSubBill" resultType="map">
|
||||
select
|
||||
count(a.bill_code) as totalNum,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user