This commit is contained in:
邹宗楠
2025-09-16 14:22:34 +08:00
parent 5480380c90
commit c55847dda0
29 changed files with 401 additions and 21 deletions

View File

@@ -920,3 +920,68 @@ func (c *PurchaseHandler) UpdateStoreLineStatus(ctx *jxcontext.Context, vendorOr
return err
}
// QueryInvoiceSetting 获取门店发票设置
func QueryInvoiceSetting(baiDuStoreId string) ([]*ebaiapi.SettingList, error) {
return api.EbaiAPI.QueryInvoiceSetting([]string{baiDuStoreId})
}
// BathUpdateInvoiceSetting 批量更新门店发票设置
func BathUpdateInvoiceSetting(baiDuStoreId string, setting *ebaiapi.StoreInvoiceSetting) ([]*ebaiapi.ResultList, []*ebaiapi.ResultList, error) {
return api.EbaiAPI.BathUpdateInvoiceSetting(baiDuStoreId, setting)
}
// QueryUnansweredInvoice 查询门店未回复发票信息
func QueryUnansweredInvoice(baiDuStoreId string, jxStoreId int) (*ebaiapi.QueryUnansweredInvoiceResult, error) {
var db = dao.GetDB()
unansweredList, err := api.EbaiAPI.QueryUnansweredInvoice(baiDuStoreId)
if err != nil {
return nil, err
}
if len(unansweredList.RecordList) != 0 {
invoiceData, _ := dao.GetInvoiceByStoreId(db, jxStoreId, model.VendorIDEBAI)
invoiceDataMap := make(map[string]*model.InvoiceMsg, 0)
for i := 0; i < len(invoiceData); i++ {
invoiceDataMap[invoiceData[i].InvoiceTaskId] = invoiceData[i]
}
for i := 0; i < len(unansweredList.RecordList); i++ {
if invoiceDataMap[unansweredList.RecordList[i].ApplicationNo] != nil {
invoiceDataMap[unansweredList.RecordList[i].ApplicationNo].Status = model.InvoiceStatusInit
dao.UpdateEntity(db, invoiceDataMap[unansweredList.RecordList[i].ApplicationNo], "Status")
} else {
invoiceObj := model.InvoiceMsg{
ModelIDCUL: model.ModelIDCUL{},
OrderId: utils.Int64ToStr(unansweredList.RecordList[i].OrderList[0].OrderId),
StoreID: utils.Str2Int(unansweredList.RecordList[i].ShopId),
VendorID: model.VendorIDEBAI,
InvoiceTaskId: unansweredList.RecordList[i].ApplicationNo,
Status: unansweredList.RecordList[i].Status,
PushType: 1,
InvoiceTitle: unansweredList.RecordList[i].BuyerTitle.TitleName,
TaxpayerId: unansweredList.RecordList[i].BuyerTitle.TaxPayerNum,
NeedInvoiceByCategory: 1,
CompanyAddress: unansweredList.RecordList[i].BuyerTitle.RegisterAddress,
CompanyPhone: unansweredList.RecordList[i].BuyerTitle.RegisterPhone,
AccountBank: unansweredList.RecordList[i].BuyerTitle.BankName,
AccountNumber: unansweredList.RecordList[i].BuyerTitle.BankAccount,
Email: unansweredList.RecordList[i].BuyerContact.Email,
InvoiceAmount: utils.Float64TwoInt64(unansweredList.RecordList[i].TotalInvoiceAmount * 100),
InvoiceUrl: "",
InvoiceId: "",
}
if len(unansweredList.RecordList[i].OrderList) > 1 {
orderList := make(map[int64]float64, 0)
for _, v := range unansweredList.RecordList[i].OrderList {
orderList[v.OrderId] = v.InvoiceAmount
}
invoiceObj.Remark = string(utils.MustMarshal(orderList))
}
dao.WrapAddIDCULEntity(invoiceObj, "system")
dao.CreateEntity(db, invoiceObj)
}
}
}
return unansweredList, err
}