demand: TMS系统 - 客户账单管理 - 财务开票处理 - 新增加查询条件 按照发票号查询数据
committer: heyu
This commit is contained in:
parent
d9bc670d1b
commit
f76e912748
@ -1,10 +1,10 @@
|
||||
/**
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisSettlePayRecord.java
|
||||
* @author linfso
|
||||
* @date 2024-07-21 13:31:23
|
||||
* @Copyright: ShangHai Duta 2022 All rights reserved.
|
||||
* @version v1.0
|
||||
* @version v1.0
|
||||
* @Description: <p> 账单收退款记录 实体类 </p>
|
||||
*/
|
||||
|
||||
@ -42,7 +42,7 @@ public class EmisSettlePayRecord extends BaseEntity
|
||||
private Long id;
|
||||
/* 支付序号 */
|
||||
private String payId;
|
||||
/* 支付类型 1-微信支付2支付宝 3-对公 */
|
||||
/* 收款来源 1-微信支付2支付宝 3-对公 */
|
||||
private String payType;
|
||||
/* 收付类型 1-收款 2-退款 */
|
||||
private String recType;
|
||||
@ -50,8 +50,6 @@ public class EmisSettlePayRecord extends BaseEntity
|
||||
private String payMan;
|
||||
/* 支付人编码 */
|
||||
private String payManCode;
|
||||
/* 总账单号 */
|
||||
private String settleBillNo;
|
||||
/* 审核状态 0-未审核 1-已审核 */
|
||||
private String blAudit;
|
||||
/* 审核日期 */
|
||||
@ -79,7 +77,7 @@ public class EmisSettlePayRecord extends BaseEntity
|
||||
private String breakEmpCode;
|
||||
/* 收款人代码 */
|
||||
private String recManCode;
|
||||
/* 结算类型 1-现金 2-月结 */
|
||||
/* 支付类型 1-现金 2-月结 */
|
||||
private String settleType;
|
||||
/* 退款日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
@ -127,4 +125,16 @@ public class EmisSettlePayRecord extends BaseEntity
|
||||
// 开票记录关联
|
||||
List<EmisSettlePayInvoiceRel> payInvoiceRelList;
|
||||
|
||||
/* 账单号 */
|
||||
private String settleBillNo;
|
||||
// 扩展字段 - 用于查询结果展示
|
||||
/* 运单号(多个用逗号分隔) */
|
||||
private String billCodes;
|
||||
/* 账单金额 */
|
||||
private BigDecimal billAmount;
|
||||
/* 开票金额 */
|
||||
private BigDecimal invoiceAmount;
|
||||
/* 开票状态 0-待开票 1-已开票 2-拒绝开票 */
|
||||
private String invoiceStatus;
|
||||
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xdadan.erp.emis.mapper.EmisSettlePayRecordMapper" >
|
||||
|
||||
|
||||
<resultMap type="EmisSettlePayRecord" id="EmisSettlePayRecordResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="payId" column="pay_id" />
|
||||
@ -45,6 +45,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="otherMoney" column="other_money" />
|
||||
<result property="otherReason" column="other_reason" />
|
||||
<result property="tradeDate" column="trade_date" />
|
||||
<result property="billCodes" column="bill_codes" />
|
||||
<result property="billAmount" column="bill_amount" />
|
||||
<result property="invoiceAmount" column="invoice_amount" />
|
||||
<result property="invoiceStatus" column="invoice_status" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
@ -82,7 +86,92 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmisSettlePayRecordVo">
|
||||
select id, pay_id, pay_type, rec_type, pay_man, pay_man_code, settle_bill_no, bl_audit, audit_date, audit_man_code, audit_site_code, customer_code, customer_name, pay_money, pay_status, pay_status_desc, break_type, break_reason, break_emp_code, rec_man_code, settle_type, refund_date, refund_man_code, refund_seq, refund_mode, refund_money, refund_reason, refund_remark, refund_op_man_code, refund_register_site_code, refund_register_man_code, satisfy_money, satisfy_reason, allowance_money, allowance_reason, deduction_money, deduction_reason, other_money, other_reason, trade_date, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_settle_pay_record
|
||||
select
|
||||
a.id, a.pay_id, a.pay_type, a.rec_type, a.pay_man, a.pay_man_code, a.settle_bill_no,
|
||||
a.bl_audit, a.audit_date, a.audit_man_code, a.audit_site_code, a.customer_code,
|
||||
a.customer_name, a.pay_money, a.pay_status, a.pay_status_desc, a.break_type,
|
||||
a.break_reason, a.break_emp_code, a.rec_man_code, a.settle_type, a.refund_date,
|
||||
a.refund_man_code, a.refund_seq, a.refund_mode, a.refund_money, a.refund_reason,
|
||||
a.refund_remark, a.refund_op_man_code, a.refund_register_site_code,
|
||||
a.refund_register_man_code, a.satisfy_money, a.satisfy_reason, a.allowance_money,
|
||||
a.allowance_reason, a.deduction_money, a.deduction_reason, a.other_money,
|
||||
a.other_reason, a.trade_date,
|
||||
-- 重新赋值备注字段:财务开票备注+账单备注
|
||||
CONCAT_WS(';',
|
||||
COALESCE(invoice_remarks.invoice_remark, ''),
|
||||
COALESCE(bill_remark.remark, '')
|
||||
) as remark,
|
||||
a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.create_site, a.update_site,
|
||||
-- 运单号(多个用逗号分隔)
|
||||
COALESCE(waybill_codes.bill_codes, '') as bill_codes,
|
||||
-- 账单金额
|
||||
COALESCE(bill_amount.rec_money, 0) as bill_amount,
|
||||
-- 开票金额
|
||||
COALESCE(invoice_amount.total_amount, 0) as invoice_amount,
|
||||
-- 开票状态
|
||||
COALESCE(invoice_status.status, '0') as invoice_status
|
||||
from emis_settle_pay_record a
|
||||
-- 关联获取运单号
|
||||
left join (
|
||||
select
|
||||
espbr.pay_id,
|
||||
GROUP_CONCAT(essb.bill_code SEPARATOR ',') as bill_codes
|
||||
from emis_settle_pay_bill_rel espbr
|
||||
left join emis_settle_sub_bill essb on espbr.settle_bill_no = essb.settle_bill_no
|
||||
where espbr.del_flag = '0' and essb.del_flag = '0'
|
||||
group by espbr.pay_id
|
||||
) waybill_codes on a.pay_id = waybill_codes.pay_id
|
||||
-- 关联获取账单金额
|
||||
left join (
|
||||
select
|
||||
espbr.pay_id,
|
||||
esb.rec_money
|
||||
from emis_settle_pay_bill_rel espbr
|
||||
left join emis_settle_bill esb on espbr.settle_bill_no = esb.settle_bill_no
|
||||
where espbr.del_flag = '0' and esb.del_flag = '0'
|
||||
group by espbr.pay_id
|
||||
) bill_amount on a.pay_id = bill_amount.pay_id
|
||||
-- 关联获取开票金额
|
||||
left join (
|
||||
select
|
||||
espir.pay_id,
|
||||
SUM(esir.open_money) as total_amount
|
||||
from emis_settle_pay_invoice_rel espir
|
||||
left join emis_settle_invoice_record esir on espir.apply_seq_no = esir.apply_seq_no
|
||||
where espir.del_flag = '0' and esir.del_flag = '0' and esir.invoice_status = '1'
|
||||
group by espir.pay_id
|
||||
) invoice_amount on a.pay_id = invoice_amount.pay_id
|
||||
-- 关联获取开票状态
|
||||
left join (
|
||||
select
|
||||
espir.pay_id,
|
||||
esir.invoice_status as status
|
||||
from emis_settle_pay_invoice_rel espir
|
||||
left join emis_settle_invoice_record esir on espir.apply_seq_no = esir.apply_seq_no
|
||||
where espir.del_flag = '0' and esir.del_flag = '0'
|
||||
group by espir.pay_id
|
||||
) invoice_status on a.pay_id = invoice_status.pay_id
|
||||
-- 关联获取财务开票备注
|
||||
left join (
|
||||
select
|
||||
espir.pay_id,
|
||||
GROUP_CONCAT(esir.invioce_remark SEPARATOR ';') as invoice_remark
|
||||
from emis_settle_pay_invoice_rel espir
|
||||
left join emis_settle_invoice_record esir on espir.apply_seq_no = esir.apply_seq_no
|
||||
where espir.del_flag = '0' and esir.del_flag = '0'
|
||||
and esir.invioce_remark is not null and esir.invioce_remark != ''
|
||||
group by espir.pay_id
|
||||
) invoice_remarks on a.pay_id = invoice_remarks.pay_id
|
||||
-- 关联获取账单备注
|
||||
left join (
|
||||
select
|
||||
espbr.pay_id,
|
||||
esb.remark
|
||||
from emis_settle_pay_bill_rel espbr
|
||||
left join emis_settle_bill esb on espbr.settle_bill_no = esb.settle_bill_no
|
||||
where espbr.del_flag = '0' and esb.del_flag = '0'
|
||||
group by espbr.pay_id
|
||||
) bill_remark on a.pay_id = bill_remark.pay_id
|
||||
</sql>
|
||||
|
||||
<select id="getSettlePayStatInfoMap" parameterType="EmisSettlePayRecord" resultType="map">
|
||||
@ -188,7 +277,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectEmisSettlePayRecordList" parameterType="EmisSettlePayRecord" resultMap="EmisSettlePayRecordResult">
|
||||
<include refid="selectEmisSettlePayRecordVo"/>
|
||||
<where>
|
||||
<where>
|
||||
del_flag='0'
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="payId != null and payId != ''"> and pay_id = #{payId}</if>
|
||||
@ -408,9 +497,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and update_site = #{updateSite}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectEmisSettlePayRecordById" parameterType="Long" resultMap="EmisSettlePayRecordResult">
|
||||
select id, pay_id, pay_type, rec_type, pay_man, pay_man_code, settle_bill_no, bl_audit, audit_date, audit_man_code, audit_site_code, customer_code, customer_name, pay_money, pay_status, pay_status_desc, break_type, break_reason, break_emp_code, rec_man_code, settle_type, refund_date, refund_man_code, refund_seq, refund_mode, refund_money, refund_reason, refund_remark, refund_op_man_code, refund_register_site_code, refund_register_man_code, satisfy_money, satisfy_reason, allowance_money, allowance_reason, deduction_money, deduction_reason, other_money, other_reason, trade_date, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
select id, pay_id, pay_type, rec_type, pay_man, pay_man_code, settle_bill_no, bl_audit, audit_date, audit_man_code, audit_site_code, customer_code, customer_name, pay_money, pay_status, pay_status_desc, break_type, break_reason, break_emp_code, rec_man_code, settle_type, refund_date, refund_man_code, refund_seq, refund_mode, refund_money, refund_reason, refund_remark, refund_op_man_code, refund_register_site_code, refund_register_man_code, satisfy_money, satisfy_reason, allowance_money, allowance_reason, deduction_money, deduction_reason, other_money, other_reason, trade_date, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_settle_pay_record a
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
@ -420,7 +509,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from emis_settle_pay_record a
|
||||
where a.pay_id = #{payId} and a.del_flag='0'
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertEmisSettlePayRecord" parameterType="EmisSettlePayRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into emis_settle_pay_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@ -605,4 +694,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ORDER BY
|
||||
tradeDay
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user