md
This commit is contained in:
parent
8cdb9170eb
commit
3473e4661b
@ -37,6 +37,7 @@ import com.xdadan.erp.emis.domain.EmisSettleSubBill;
|
||||
import com.xdadan.erp.emis.domain.EmisSettleSubBillFeeitem;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.domain.stat.BillPayStatInfo;
|
||||
import com.xdadan.erp.emis.domain.stat.OpenBillStatInfo;
|
||||
import com.xdadan.erp.emis.domain.vo.scan.ScanResult;
|
||||
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||
import com.xdadan.erp.emis.service.IEmisExchangeRateService;
|
||||
@ -93,8 +94,11 @@ public class EmisSettleBillController extends BaseController
|
||||
@Autowired
|
||||
private IEmisExchangeRateService emisExchangeRateService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 回款统计
|
||||
* @param emisSettleBill
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryBillPayStatInfoList")
|
||||
public TableDataInfo queryBillPayStatInfoList(EmisSettleBill emisSettleBill)
|
||||
{
|
||||
@ -106,6 +110,22 @@ public class EmisSettleBillController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开票统计
|
||||
* @param emisSettleBill
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryOpenBillStatInfoList")
|
||||
public TableDataInfo queryOpenBillStatInfoList(EmisSettleBill emisSettleBill)
|
||||
{
|
||||
startPage();
|
||||
|
||||
setPrivParams(emisSettleBill);
|
||||
|
||||
List<OpenBillStatInfo> list = emisSettleBillService.selectOpenBillStatInfoList(emisSettleBill);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询结算总账单列表
|
||||
*/
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
package com.xdadan.erp.emis.domain.stat;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 账单开票统计明细
|
||||
*/
|
||||
@Data
|
||||
public class OpenBillStatInfo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// 销售联系人
|
||||
private String salesmen;
|
||||
|
||||
private String billMonth;
|
||||
|
||||
// 账单总数量
|
||||
private Integer totalBillCount;
|
||||
// 已开票账单数量
|
||||
private Integer hasOpenBillCount;
|
||||
// 部分开票账单数量
|
||||
private Integer someOpenBillCount;
|
||||
// 未开票账单数量
|
||||
private Integer noOpenBillCount;
|
||||
|
||||
// 不开票账单数量
|
||||
private Integer noNeedOpenBillCount;
|
||||
// 正常开票数量
|
||||
private Integer normalOpenBillCount;
|
||||
// 超时开票数量
|
||||
private Integer expiredOpenBillCount;
|
||||
// 超时未开票账单数量
|
||||
private Integer expiredNoOpenBillCount;
|
||||
|
||||
// 正常开票率
|
||||
private BigDecimal normalOpenBillRate;
|
||||
// 超期开票率
|
||||
private BigDecimal expireOpenBillRate;
|
||||
|
||||
|
||||
}
|
||||
@ -16,6 +16,7 @@ import com.xdadan.erp.common.annotation.audit.DataAuditLog;
|
||||
import com.xdadan.erp.common.annotation.audit.OperateType;
|
||||
import com.xdadan.erp.emis.domain.EmisSettleBill;
|
||||
import com.xdadan.erp.emis.domain.stat.BillPayStatInfo;
|
||||
import com.xdadan.erp.emis.domain.stat.OpenBillStatInfo;
|
||||
import com.xdadan.erp.emis.service.impl.EmisSettleBillServiceImpl;
|
||||
import com.xdadan.erp.emis.service.impl.EmisSettleSubBillServiceImpl;
|
||||
|
||||
@ -45,6 +46,9 @@ public interface EmisSettleBillMapper extends BaseMapper<EmisSettleBill>
|
||||
*/
|
||||
public List<BillPayStatInfo> selectBillPayStatInfoList(EmisSettleBill emisSettleBill);
|
||||
|
||||
|
||||
public List<OpenBillStatInfo> selectOpenBillStatInfoList(EmisSettleBill emisSettleBill);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
|
||||
@ -15,6 +15,7 @@ import com.xdadan.erp.common.core.audit.IDataAuditService;
|
||||
import com.xdadan.erp.emis.domain.EmisSettleBill;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.domain.stat.BillPayStatInfo;
|
||||
import com.xdadan.erp.emis.domain.stat.OpenBillStatInfo;
|
||||
|
||||
/**
|
||||
* @ClassName EmisSettleBillService
|
||||
@ -36,12 +37,19 @@ public interface IEmisSettleBillService extends IDataAuditService
|
||||
|
||||
|
||||
/**
|
||||
* 获取统计数据
|
||||
* 获取收款统计数据
|
||||
* @param emisSettleBill
|
||||
* @return
|
||||
*/
|
||||
public List<BillPayStatInfo> selectBillPayStatInfoList(EmisSettleBill emisSettleBill);
|
||||
|
||||
/**
|
||||
* 获取开票统计数据
|
||||
* @param emisSettleBill
|
||||
* @return
|
||||
*/
|
||||
public List<OpenBillStatInfo> selectOpenBillStatInfoList(EmisSettleBill emisSettleBill);
|
||||
|
||||
|
||||
/**
|
||||
* 查询结算总账单列表
|
||||
|
||||
@ -26,6 +26,7 @@ import com.xdadan.erp.emis.domain.EmisSettleSubBill;
|
||||
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.domain.stat.BillPayStatInfo;
|
||||
import com.xdadan.erp.emis.domain.stat.OpenBillStatInfo;
|
||||
import com.xdadan.erp.emis.mapper.EmisSettleSubBillMapper;
|
||||
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||
import com.xdadan.erp.emis.utils.WaybillHelper;
|
||||
@ -75,7 +76,7 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
||||
|
||||
|
||||
/**
|
||||
* 获取统计数据
|
||||
* 获取回款统计数据
|
||||
* @param emisSettleBill
|
||||
* @return
|
||||
*/
|
||||
@ -85,6 +86,18 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
||||
return emisSettleBillMapper.selectBillPayStatInfoList(emisSettleBill);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取开票统计数据
|
||||
* @param emisSettleBill
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<OpenBillStatInfo> selectOpenBillStatInfoList(EmisSettleBill emisSettleBill)
|
||||
{
|
||||
return emisSettleBillMapper.selectOpenBillStatInfoList(emisSettleBill);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EmisSettleBill selectEmisSettleBillBySettleBillNo(String settleBillNo)
|
||||
{
|
||||
|
||||
@ -83,6 +83,22 @@
|
||||
<result property="expireBillPayRate" column="expireBillPayRate" />
|
||||
<result property="expireBillNoPayRate" column="expireBillNoPayRate" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="OpenBillStatInfo" id="OpenBillStatInfoResult">
|
||||
<result property="salesmen" column="salesmen" />
|
||||
<result property="billMonth" column="billMonth" />
|
||||
|
||||
<result property="totalBillCount" column="totalBillCount" />
|
||||
<result property="hasOpenBillCount" column="hasOpenBillCount" />
|
||||
<result property="someOpenBillCount" column="someOpenBillCount" />
|
||||
<result property="noOpenBillCount" column="noOpenBillCount" />
|
||||
<result property="noNeedOpenBillCount" column="noNeedOpenBillCount" />
|
||||
<result property="normalOpenBillCount" column="normalOpenBillCount" />
|
||||
<result property="expiredOpenBillCount" column="expiredOpenBillCount" />
|
||||
<result property="expiredNoOpenBillCount" column="expiredNoOpenBillCount" />
|
||||
<result property="normalOpenBillRate" column="normalOpenBillRate" />
|
||||
<result property="expireOpenBillRate" column="expireOpenBillRate" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
@ -102,7 +118,7 @@
|
||||
from (
|
||||
select salesmen,bill_month as billMonth,
|
||||
ROUND(sum(rec_money),2) as recPayMoney,
|
||||
ROUND(sum(send_piece_sum),0) as totalBillCount,
|
||||
count(1) as totalBillCount,
|
||||
ROUND(sum(reced_money),2) as hasRecdPayMoney
|
||||
from emis_settle_bill a
|
||||
<where>
|
||||
@ -195,6 +211,114 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectOpenBillStatInfoList" parameterType="EmisSettleBill" resultMap="OpenBillStatInfoResult">
|
||||
select tba.salesmen,
|
||||
tba.billMonth,
|
||||
tba.totalBillCount,
|
||||
tbb.hasOpenBillCount,
|
||||
tbb.someOpenBillCount,
|
||||
tbb.noOpenBillCount,
|
||||
tbb.noNeedOpenBillCount,
|
||||
|
||||
ifnull(tbc.normalOpenBillCount,0) as normalOpenBillCount,
|
||||
ifnull(tbd.expiredOpenBillCount,0) as expiredOpenBillCount,
|
||||
tbb.noOpenBillCount as expiredNoOpenBillCount
|
||||
|
||||
from (
|
||||
select salesmen,bill_month as billMonth,
|
||||
count(1) as totalBillCount
|
||||
from emis_settle_bill a
|
||||
<where>
|
||||
a.del_flag='0'
|
||||
<if test="salesmen != null and salesmen!='' "> and a.salesmen = #{salesmen}</if>
|
||||
<if test="billMonth != null and billMonth!='' "> and a.bill_month = #{billMonth}</if>
|
||||
<if test="openBillStatus != null and openBillStatus != ''"> and a.open_bill_status = #{openBillStatus}</if>
|
||||
<if test="paymentStatus != null and paymentStatus != ''"> and a.payment_status = #{paymentStatus}</if>
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
and (
|
||||
a.salesmen=#{params.privEmpName}
|
||||
or a.payee=#{params.privEmpName}
|
||||
or a.salesmen in(
|
||||
select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
|
||||
)
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
group by salesmen,bill_month
|
||||
) tba
|
||||
left join (
|
||||
select salesmen,bill_month as billMonth,
|
||||
sum(IF(open_bill_status='1',1,0)) as hasOpenBillCount,
|
||||
sum(IF(open_bill_status='2',1,0)) as someOpenBillCount,
|
||||
sum(IF(open_bill_status='3',1,0)) as noNeedOpenBillCount,
|
||||
sum(IF(open_bill_status='0',1,0)) as noOpenBillCount
|
||||
from emis_settle_bill a
|
||||
<where>
|
||||
a.del_flag='0'
|
||||
<if test="salesmen != null and salesmen!='' "> and a.salesmen = #{salesmen}</if>
|
||||
<if test="billMonth != null and billMonth!='' "> and a.bill_month = #{billMonth}</if>
|
||||
<if test="openBillStatus != null and openBillStatus != ''"> and a.open_bill_status = #{openBillStatus}</if>
|
||||
<if test="paymentStatus != null and paymentStatus != ''"> and a.payment_status = #{paymentStatus}</if>
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
and (
|
||||
a.salesmen=#{params.privEmpName}
|
||||
or a.payee=#{params.privEmpName}
|
||||
or a.salesmen in(
|
||||
select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
|
||||
)
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
group by salesmen,bill_month
|
||||
) tbb on tba.salesmen=tbb.salesmen and tba.billMonth=tbb.billMonth
|
||||
left join (
|
||||
select a.salesmen,a.bill_month as billMonth,
|
||||
count(1) as normalOpenBillCount
|
||||
from emis_settle_bill a,emis_settle_invoice_record b
|
||||
<where>
|
||||
a.del_flag='0' and b.del_flag='0' and FIND_IN_SET(a.settle_bill_no,b.settle_bill_no) and b.create_time <![CDATA[ <= ]]> a.payment_due_date
|
||||
<if test="salesmen != null and salesmen!='' "> and a.salesmen = #{salesmen}</if>
|
||||
<if test="billMonth != null and billMonth!='' "> and a.bill_month = #{billMonth}</if>
|
||||
<if test="openBillStatus != null and openBillStatus != ''"> and a.open_bill_status = #{openBillStatus}</if>
|
||||
<if test="paymentStatus != null and paymentStatus != ''"> and a.payment_status = #{paymentStatus}</if>
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
and (
|
||||
a.salesmen=#{params.privEmpName}
|
||||
or a.payee=#{params.privEmpName}
|
||||
or a.salesmen in(
|
||||
select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
|
||||
)
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
group by salesmen,bill_month
|
||||
) tbc on tba.salesmen=tbc.salesmen and tba.billMonth=tbc.billMonth
|
||||
left join (
|
||||
select a.salesmen,a.bill_month as billMonth,
|
||||
count(1) as expiredOpenBillCount
|
||||
from emis_settle_bill a,emis_settle_invoice_record b
|
||||
<where>
|
||||
a.del_flag='0' and b.del_flag='0' and FIND_IN_SET(a.settle_bill_no,b.settle_bill_no) and b.create_time <![CDATA[ > ]]> a.payment_due_date
|
||||
<if test="salesmen != null and salesmen!='' "> and a.salesmen = #{salesmen}</if>
|
||||
<if test="billMonth != null and billMonth!='' "> and a.bill_month = #{billMonth}</if>
|
||||
<if test="openBillStatus != null and openBillStatus != ''"> and a.open_bill_status = #{openBillStatus}</if>
|
||||
<if test="paymentStatus != null and paymentStatus != ''"> and a.payment_status = #{paymentStatus}</if>
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
and (
|
||||
a.salesmen=#{params.privEmpName}
|
||||
or a.payee=#{params.privEmpName}
|
||||
or a.salesmen in(
|
||||
select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
|
||||
)
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
group by salesmen,bill_month
|
||||
) tbd on tba.salesmen=tbd.salesmen and tba.billMonth=tbd.billMonth
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<sql id="selectEmisSettleBillVo">
|
||||
select id, settle_bill_no, settle_bill_name, settle_type, settle_start_date, settle_end_date, bill_month, rec_money, reced_money, invoiced_money, cust_no, cust_name, customer_code, customer_name, site_code, site_name, satisfy_money, allowance_money, deduction_money, other_money, satisfy_reason, allowance_reason, deduction_reason, other_reason, open_bill_status, payment_status, charge_status, send_piece_sum, piece_number, fee_weight, uncollected_amount, send_money_sum, refund_amount, refund_money, payee, salesmen, credit_period, credit_period_type, settle_day, payment_due_date, bl_send_oms, bl_confirm_center, confirm_center_date, confirm_center_note, confirm_center_man_code, confirm_center_code, bl_confirm_site, confirm_site_date, confirm_site_man_code, confirm_site_note, confirm_site_code, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_settle_bill a
|
||||
|
||||
Loading…
Reference in New Issue
Block a user