md
This commit is contained in:
parent
6603d6857b
commit
24da846b82
@ -28,6 +28,10 @@ public interface EmisSettleInvoiceRelMapper extends BaseMapper<EmisSettleInvoice
|
|||||||
*/
|
*/
|
||||||
public EmisSettleInvoiceRel selectEmisSettleInvoiceRelById(Long id);
|
public EmisSettleInvoiceRel selectEmisSettleInvoiceRelById(Long id);
|
||||||
|
|
||||||
|
public List<EmisSettleInvoiceRel> selectListByApplySeqNo(String applySeqNo);
|
||||||
|
|
||||||
|
public List<EmisSettleInvoiceRel> selectHasOpenListBySettleBillNo(String settleBillNo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询列表
|
* 查询列表
|
||||||
*
|
*
|
||||||
|
|||||||
@ -117,6 +117,8 @@ public class EmisSettleInvoiceRecordServiceImpl extends EmisBaseService implemen
|
|||||||
if(!CollectionUtils.isEmpty(listRel)){
|
if(!CollectionUtils.isEmpty(listRel)){
|
||||||
for (EmisSettleInvoiceRel invoiceRel:listRel
|
for (EmisSettleInvoiceRel invoiceRel:listRel
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
invoiceRel.setId(null);
|
||||||
invoiceRel.setApplySeqNo(applySeqNo);
|
invoiceRel.setApplySeqNo(applySeqNo);
|
||||||
emisSettleInvoiceRelMapper.insertEmisSettleInvoiceRel(invoiceRel);
|
emisSettleInvoiceRelMapper.insertEmisSettleInvoiceRel(invoiceRel);
|
||||||
}
|
}
|
||||||
@ -170,25 +172,21 @@ public class EmisSettleInvoiceRecordServiceImpl extends EmisBaseService implemen
|
|||||||
private int reCalcSettleBillInvoiceInfo(String settleBillNo){
|
private int reCalcSettleBillInvoiceInfo(String settleBillNo){
|
||||||
|
|
||||||
EmisSettleBill oldBill =getSettleBillBySettleBillNo(settleBillNo);
|
EmisSettleBill oldBill =getSettleBillBySettleBillNo(settleBillNo);
|
||||||
// 获取开票记录
|
|
||||||
List<EmisSettleInvoiceRecord> invoiceRecordList=emisSettleInvoiceRecordMapper.selectInvoiceRecordListBySettleBillNo(settleBillNo);
|
|
||||||
// 计算已开票金额
|
|
||||||
BigDecimal totalMoney = BigDecimal.ZERO;
|
BigDecimal totalMoney = BigDecimal.ZERO;
|
||||||
|
// 获取运单已经开票记录
|
||||||
for(EmisSettleInvoiceRecord item:invoiceRecordList){
|
List<EmisSettleInvoiceRel> listRel=emisSettleInvoiceRelMapper.selectHasOpenListBySettleBillNo(settleBillNo);
|
||||||
// 审核拒绝
|
if(!CollectionUtils.isEmpty(listRel)) {
|
||||||
if("2".equals(item.getBlAudit()) ){
|
for(EmisSettleInvoiceRel item:listRel){
|
||||||
continue;
|
// 查询关联的运单表
|
||||||
|
totalMoney = totalMoney.add(item.getMoney());
|
||||||
}
|
}
|
||||||
|
|
||||||
totalMoney=totalMoney.add(item.getApplyMoney());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EmisSettleBill newBill = new EmisSettleBill();
|
EmisSettleBill newBill = new EmisSettleBill();
|
||||||
newBill.setId(oldBill.getId());
|
newBill.setId(oldBill.getId());
|
||||||
|
|
||||||
if(oldBill.getRecMoney().compareTo(totalMoney)>=0) {
|
if(oldBill.getRecMoney().compareTo(totalMoney)>=0) {
|
||||||
newBill.setOpenBillStatus("2");
|
newBill.setOpenBillStatus("1");
|
||||||
}else{
|
}else{
|
||||||
newBill.setOpenBillStatus("2");
|
newBill.setOpenBillStatus("2");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,17 +53,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
and update_site = #{updateSite}
|
and update_site = #{updateSite}
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="selectEmisSettleInvoiceRelById" parameterType="Long" resultMap="EmisSettleInvoiceRelResult">
|
<select id="selectEmisSettleInvoiceRelById" parameterType="Long" resultMap="EmisSettleInvoiceRelResult">
|
||||||
select id, apply_seq_no, pay_id, bill_no, money, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
select id, apply_seq_no, pay_id, bill_no, money, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||||
from emis_settle_invoice_rel a
|
from emis_settle_invoice_rel a
|
||||||
where a.id = #{id}
|
where a.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectListByApplySeqNo" parameterType="String" resultMap="EmisSettleInvoiceRelResult">
|
||||||
|
select id, apply_seq_no, pay_id, bill_no, money, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||||
|
from emis_settle_invoice_rel a
|
||||||
|
where a.apply_seq_no = #{applySeqNo} and del_flag='0'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectHasOpenListBySettleBillNo" parameterType="String" resultMap="EmisSettleInvoiceRelResult">
|
||||||
|
select id, apply_seq_no, pay_id, bill_no, money, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||||
|
from emis_settle_invoice_rel a
|
||||||
|
where del_flag='0'
|
||||||
|
AND apply_seq_no IN (
|
||||||
|
SELECT x1.apply_seq_no FROM
|
||||||
|
emis_settle_invoice_record x1,
|
||||||
|
emis_settle_bill x2
|
||||||
|
WHERE
|
||||||
|
x1.del_flag = '0' and x1.bl_audit!='2'
|
||||||
|
AND x2.del_flag = '0'
|
||||||
|
AND FIND_IN_SET( x2.settle_bill_no, x1.settle_bill_no )
|
||||||
|
AND FIND_IN_SET( x2.settle_bill_no, #{settleBillNo})
|
||||||
|
)
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<insert id="insertEmisSettleInvoiceRel" parameterType="EmisSettleInvoiceRel" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertEmisSettleInvoiceRel" parameterType="EmisSettleInvoiceRel" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into emis_settle_invoice_rel
|
insert into emis_settle_invoice_rel
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">id,</if>
|
|
||||||
<if test="applySeqNo != null and applySeqNo != ''">apply_seq_no,</if>
|
<if test="applySeqNo != null and applySeqNo != ''">apply_seq_no,</if>
|
||||||
<if test="payId != null and payId != ''">pay_id,</if>
|
<if test="payId != null and payId != ''">pay_id,</if>
|
||||||
<if test="billNo != null and billNo != ''">bill_no,</if>
|
<if test="billNo != null and billNo != ''">bill_no,</if>
|
||||||
@ -77,7 +100,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="updateSite != null and updateSite != ''">update_site,</if>
|
<if test="updateSite != null and updateSite != ''">update_site,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">#{id},</if>
|
|
||||||
<if test="applySeqNo != null and applySeqNo != ''">#{applySeqNo},</if>
|
<if test="applySeqNo != null and applySeqNo != ''">#{applySeqNo},</if>
|
||||||
<if test="payId != null and payId != ''">#{payId},</if>
|
<if test="payId != null and payId != ''">#{payId},</if>
|
||||||
<if test="billNo != null and billNo != ''">#{billNo},</if>
|
<if test="billNo != null and billNo != ''">#{billNo},</if>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user