md
This commit is contained in:
parent
780873dba2
commit
01d4f424df
@ -81,7 +81,7 @@ public class EmisSettleInvoiceRecord extends BaseEntity
|
|||||||
private BigDecimal openMoney;
|
private BigDecimal openMoney;
|
||||||
/* 发票号 */
|
/* 发票号 */
|
||||||
private String invoiceNo;
|
private String invoiceNo;
|
||||||
/* 开票状态 0-待开票 1-已开票 2-拒绝开票 */
|
/* 开票状态 0-待开票 1-开票中 2-开票成功 */
|
||||||
private String invoiceStatus;
|
private String invoiceStatus;
|
||||||
/* 开票状态描述 */
|
/* 开票状态描述 */
|
||||||
private String invoiceStatusDesc;
|
private String invoiceStatusDesc;
|
||||||
@ -91,7 +91,7 @@ public class EmisSettleInvoiceRecord extends BaseEntity
|
|||||||
private String email;
|
private String email;
|
||||||
/* 发票下载路径 */
|
/* 发票下载路径 */
|
||||||
private String filePath;
|
private String filePath;
|
||||||
/* 审核状态 0-未审核 1-已审核 */
|
/* 审核状态 0-未审核 1-已审核 2-审核不通过 */
|
||||||
private String blAudit;
|
private String blAudit;
|
||||||
/* 审核日期 */
|
/* 审核日期 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
|||||||
@ -58,6 +58,8 @@ public interface EmisSettleInvoiceRecordMapper extends BaseMapper<EmisSettleInvo
|
|||||||
public int checkUnique(EmisSettleInvoiceRecord emisSettleInvoiceRecord);
|
public int checkUnique(EmisSettleInvoiceRecord emisSettleInvoiceRecord);
|
||||||
|
|
||||||
|
|
||||||
|
public int checkOpenBillRepeat(EmisSettleInvoiceRecord emisSettleInvoiceRecord);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
*
|
*
|
||||||
|
|||||||
@ -94,11 +94,19 @@ public class EmisSettleInvoiceRecordServiceImpl extends EmisBaseService implemen
|
|||||||
public int insertEmisSettleInvoiceRecord(EmisSettleInvoiceRecord emisSettleInvoiceRecord) throws EmisBizError {
|
public int insertEmisSettleInvoiceRecord(EmisSettleInvoiceRecord emisSettleInvoiceRecord) throws EmisBizError {
|
||||||
// 判断对应账单是否存在
|
// 判断对应账单是否存在
|
||||||
|
|
||||||
|
// 相同抬头,相同金额,有审批中或者已开票的不允许再申请
|
||||||
|
int chkRst=emisSettleInvoiceRecordMapper.checkOpenBillRepeat(emisSettleInvoiceRecord);
|
||||||
|
if(chkRst!=0){
|
||||||
|
throw new EmisBizError(EmisBizErrorType.FAIL,"重复开票");
|
||||||
|
}
|
||||||
|
|
||||||
//多个账单合并开票
|
//多个账单合并开票
|
||||||
emisSettleInvoiceRecord.setSettleBillNo(
|
emisSettleInvoiceRecord.setSettleBillNo(
|
||||||
WaybillHelper.formatQueryValue(emisSettleInvoiceRecord.getSettleBillNo())
|
WaybillHelper.formatQueryValue(emisSettleInvoiceRecord.getSettleBillNo())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BigDecimal totalFee =BigDecimal.ZERO;
|
BigDecimal totalFee =BigDecimal.ZERO;
|
||||||
// 总可开票金额
|
// 总可开票金额
|
||||||
String[] settBillNoArr = emisSettleInvoiceRecord.getSettleBillNo().split(",");
|
String[] settBillNoArr = emisSettleInvoiceRecord.getSettleBillNo().split(",");
|
||||||
@ -155,12 +163,22 @@ public class EmisSettleInvoiceRecordServiceImpl extends EmisBaseService implemen
|
|||||||
BigDecimal totalMoney = BigDecimal.ZERO;
|
BigDecimal totalMoney = BigDecimal.ZERO;
|
||||||
|
|
||||||
for(EmisSettleInvoiceRecord item:invoiceRecordList){
|
for(EmisSettleInvoiceRecord item:invoiceRecordList){
|
||||||
|
// 审核拒绝
|
||||||
|
if("2".equals(item.getBlAudit()) ){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
totalMoney=totalMoney.add(item.getApplyMoney());
|
totalMoney=totalMoney.add(item.getApplyMoney());
|
||||||
}
|
}
|
||||||
|
|
||||||
EmisSettleBill newBill = new EmisSettleBill();
|
EmisSettleBill newBill = new EmisSettleBill();
|
||||||
newBill.setId(oldBill.getId());
|
newBill.setId(oldBill.getId());
|
||||||
newBill.setOpenBillStatus("1");
|
|
||||||
|
if(oldBill.getRecMoney().compareTo(totalMoney)>=0) {
|
||||||
|
newBill.setOpenBillStatus("1");
|
||||||
|
}else{
|
||||||
|
newBill.setOpenBillStatus("2");
|
||||||
|
}
|
||||||
|
|
||||||
// 更新账单开票状态
|
// 更新账单开票状态
|
||||||
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
||||||
|
|||||||
@ -125,7 +125,6 @@
|
|||||||
<if test="createSite != null and createSite != ''"> and create_site = #{createSite}</if>
|
<if test="createSite != null and createSite != ''"> and create_site = #{createSite}</if>
|
||||||
<if test="updateSite != null and updateSite != ''"> and update_site = #{updateSite}</if>
|
<if test="updateSite != null and updateSite != ''"> and update_site = #{updateSite}</if>
|
||||||
|
|
||||||
|
|
||||||
<if test="params.beginCreateTime != null and params.beginCreateTime != ''">
|
<if test="params.beginCreateTime != null and params.beginCreateTime != ''">
|
||||||
and create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
|
and create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@ -173,7 +173,7 @@
|
|||||||
<select id="selectInvoiceRecordListBySettleBillNo" parameterType="String" resultMap="EmisSettleInvoiceRecordResult">
|
<select id="selectInvoiceRecordListBySettleBillNo" parameterType="String" resultMap="EmisSettleInvoiceRecordResult">
|
||||||
select id, apply_seq_no, apply_date, apply_man_code, apply_site_code, customer_code, customer_name, settle_bill_no, settle_bill_name, apply_money, invoice_type, company_name, company_tax_no, company_tel, company_address, bank_name, bank_acc_no, contact, phone, real_tax_type, open_money_max, open_money, invoice_no, invoice_status, invoice_status_desc, recieve_address, email, file_path, remark, bl_audit, audit_date, audit_man_code, audit_site_code, audit_note, op_man_code, op_date, op_site_code, open_ch_id, open_ch_status, open_ch_status_desc, open_com_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
select id, apply_seq_no, apply_date, apply_man_code, apply_site_code, customer_code, customer_name, settle_bill_no, settle_bill_name, apply_money, invoice_type, company_name, company_tax_no, company_tel, company_address, bank_name, bank_acc_no, contact, phone, real_tax_type, open_money_max, open_money, invoice_no, invoice_status, invoice_status_desc, recieve_address, email, file_path, remark, bl_audit, audit_date, audit_man_code, audit_site_code, audit_note, op_man_code, op_date, op_site_code, open_ch_id, open_ch_status, open_ch_status_desc, open_com_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||||
from emis_settle_invoice_record a
|
from emis_settle_invoice_record a
|
||||||
where a.settle_bill_no = #{settleBillNo}
|
where del_flag = '0' and FIND_IN_SET( a.settle_bill_no,#{settleBillNo} )
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectInvoiceRecordByApplySeqNo" parameterType="String" resultMap="EmisSettleInvoiceRecordResult">
|
<select id="selectInvoiceRecordByApplySeqNo" parameterType="String" resultMap="EmisSettleInvoiceRecordResult">
|
||||||
@ -182,6 +182,17 @@
|
|||||||
where a.apply_seq_no = #{applySeqNo}
|
where a.apply_seq_no = #{applySeqNo}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 检查是否有重复太抬头开票 -->
|
||||||
|
<select id="checkOpenBillRepeat" parameterType="EmisSettleInvoiceRecord" resultType="int">
|
||||||
|
select count(1) from emis_settle_invoice_record
|
||||||
|
where del_flag='0'
|
||||||
|
and settle_bill_no = #{settleBillNo}
|
||||||
|
and apply_money = #{applyMoney}
|
||||||
|
and invoice_type = #{invoiceType}
|
||||||
|
and company_tax_no = #{companyTaxNo}
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="checkUnique" parameterType="EmisSettleInvoiceRecord" resultType="int">
|
<select id="checkUnique" parameterType="EmisSettleInvoiceRecord" resultType="int">
|
||||||
select count(1) from emis_settle_invoice_record
|
select count(1) from emis_settle_invoice_record
|
||||||
where del_flag='0'
|
where del_flag='0'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user