This commit is contained in:
linfso 2024-08-05 11:31:05 +08:00
parent eddbd3eef0
commit 8f9ffbcd9d
4 changed files with 49 additions and 6 deletions

View File

@ -80,7 +80,7 @@ public class EmisSettleInvoiceRecord extends BaseEntity
private BigDecimal openMoney;
/* 发票号 */
private String invoiceNo;
/* 开票状态 0-待开票 1-已开票 2-拒绝开票 */
/* 开票状态 0-待开票 1-开票中 2-已开票 3-拒绝开票 */
private String invoiceStatus;
/* 开票状态描述 */
private String invoiceStatusDesc;

View File

@ -28,6 +28,13 @@ public interface EmisSettleInvoiceRecordMapper extends BaseMapper<EmisSettleInvo
*/
public EmisSettleInvoiceRecord selectEmisSettleInvoiceRecordById(Long id);
/**
*
* @param applySeqNo
* @return
*/
public EmisSettleInvoiceRecord selectInvoiceRecordByApplySeqNo(String applySeqNo);
/**
* 查询列表
*
@ -40,6 +47,8 @@ public interface EmisSettleInvoiceRecordMapper extends BaseMapper<EmisSettleInvo
public List<EmisSettleInvoiceRecord> selectInvoiceRecordListBySettleBillNo(String settleBillNo);
/**
* 检查是否重复
*

View File

@ -17,9 +17,11 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xdadan.erp.emis.domain.EmisBaseInvoiceChInfo;
import com.xdadan.erp.emis.domain.EmisSettleBill;
import com.xdadan.erp.emis.domain.EmisSettleInvoiceRecord;
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.mapper.EmisBaseInvoiceChInfoMapper;
import com.xdadan.erp.emis.mapper.EmisSettleInvoiceRecordMapper;
import com.xdadan.erp.emis.service.openbill.hx.HXOrderGoods;
import com.xdadan.erp.emis.service.openbill.hx.HXOrderInfo;
import com.xdadan.erp.emis.service.openbill.hx.HXSdk;
@ -46,6 +48,9 @@ public class EmisSettleInvoiceChRecordServiceImpl implements IEmisSettleInvoiceC
@Autowired
private EmisBaseInvoiceChInfoMapper emisBaseInvoiceChInfoMapper;
@Autowired
private EmisSettleInvoiceRecordMapper emisSettleInvoiceRecordMapper;
/**
* 查询渠道开票记录表
*
@ -92,10 +97,25 @@ public class EmisSettleInvoiceChRecordServiceImpl implements IEmisSettleInvoiceC
@Override
public int insertEmisSettleInvoiceChRecord(EmisSettleInvoiceChRecord emisSettleInvoiceChRecord)
{
EmisSettleInvoiceRecord oldApply=emisSettleInvoiceRecordMapper.selectInvoiceRecordByApplySeqNo(emisSettleInvoiceChRecord.getApplySeqNo());
// 判断对应账单是否存在
String reqNo= WaybillHelper.genOrderSn();
emisSettleInvoiceChRecord.setReqNo(reqNo);
return emisSettleInvoiceChRecordMapper.insertEmisSettleInvoiceChRecord(emisSettleInvoiceChRecord);
emisSettleInvoiceChRecordMapper.insertEmisSettleInvoiceChRecord(emisSettleInvoiceChRecord);
// 更新开票状态
EmisSettleInvoiceRecord newApply = new EmisSettleInvoiceRecord();
newApply.setId(oldApply.getId());
newApply.setInvoiceStatus("1");
newApply.setInvoiceStatusDesc("开票中");
// 渠道待开票
newApply.setOpenChStatus("0");
emisSettleInvoiceRecordMapper.updateEmisSettleInvoiceRecord(newApply);
return 1;
}
/**
@ -251,8 +271,7 @@ public class EmisSettleInvoiceChRecordServiceImpl implements IEmisSettleInvoiceC
updRecord.setInvoiceNo(item0.getString("invoiceNo"));
// updRecord.setRemark(jQRst.toJSONString());
updRecord.setOpenChStatus(item0.getString("status"));
updRecord.setOpenChStatusDesc("已查询开票");
updRecord.setOpenChStatusDesc("已开票");
/*
status string Y 2 发票状态:
0:待开票;
@ -263,14 +282,23 @@ public class EmisSettleInvoiceChRecordServiceImpl implements IEmisSettleInvoiceC
5:发票已红冲-部分;
6:开票失败;
*/
// 更新渠道开票状态,更新下载文件
// 开票成功
// 更新开票状态
EmisSettleInvoiceRecord oldApply=emisSettleInvoiceRecordMapper.selectInvoiceRecordByApplySeqNo(updRecord.getApplySeqNo());
EmisSettleInvoiceRecord newApply = new EmisSettleInvoiceRecord();
newApply.setId(oldApply.getId());
newApply.setInvoiceStatus(updRecord.getOpenChStatus());
newApply.setInvoiceStatusDesc(updRecord.getOpenChStatusDesc());
newApply.setOpenChStatus("2");
newApply.setFilePath(updRecord.getFilePath());
emisSettleInvoiceRecordMapper.updateEmisSettleInvoiceRecord(newApply);
} else {
updRecord.setOpenChStatus("-1");
updRecord.setOpenChStatusDesc(item0.getString("returnStatusMsg"));
}
emisSettleInvoiceChRecordMapper.updateEmisSettleInvoiceChRecord(updRecord);
}
}

View File

@ -123,6 +123,12 @@
where a.settle_bill_no = #{settleBillNo}
</select>
<select id="selectInvoiceRecordByApplySeqNo" 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, 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
where a.apply_seq_no = #{applySeqNo}
</select>
<select id="checkUnique" parameterType="EmisSettleInvoiceRecord" resultType="int">
select count(1) from emis_settle_invoice_record
where del_flag='0'