This commit is contained in:
邹宗楠
2025-08-12 17:52:30 +08:00
parent 5c14110da0
commit 14b6c34652
9 changed files with 236 additions and 26 deletions

View File

@@ -2,7 +2,10 @@ package mtwm
import (
"encoding/json"
"fmt"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
"git.rosy.net.cn/jx-callback/business/partner"
"git.rosy.net.cn/jx-callback/business/partner/im"
beego "github.com/astaxie/beego/server/web"
"net/http"
@@ -130,3 +133,42 @@ func pushIMToGyOrPet(msg *mtwmapi.ImCallbackMsg, serverType string) {
return
}
func InvoiceCallback(invoice *mtwmapi.InvoiceCallback) (err error) {
localOrder, _ := partner.CurOrderManager.LoadOrder(invoice.OrderId, model.VendorIDMTWM)
if localOrder == nil {
return fmt.Errorf("订单不存在:%s", invoice.OrderId)
}
invoiceData, _ := dao.GetInvoiceInfo(dao.GetDB(), invoice.OrderId)
if invoiceData == nil {
invoiceObj := model.InvoiceMsg{
ModelIDCUL: model.ModelIDCUL{},
OrderId: invoice.OrderId,
StoreID: localOrder.JxStoreID,
VendorID: model.VendorIDMTWM,
InvoiceTaskId: invoice.InvoiceTaskId,
PushType: invoice.PushType,
InvoiceTitle: invoice.InvoiceTitle,
TaxpayerId: invoice.TaxpayerId,
NeedInvoiceByCategory: invoice.NeedInvoiceByCategory,
CompanyAddress: invoice.CompanyAddress,
CompanyPhone: invoice.CompanyPhone,
AccountBank: invoice.AccountBank,
AccountNumber: invoice.AccountNumber,
Email: invoice.Email,
InvoiceAmount: invoice.ItemTotalInvoiceAmount,
InvoiceUrl: "",
InvoiceId: "",
}
dao.WrapAddIDCULEntity(invoiceObj, "system")
if err = dao.CreateEntity(dao.GetDB(), invoiceObj); err != nil {
return err
}
}
content2 := fmt.Sprintf("订单:%s,用户申请发票,请老板提供发票信息!", localOrder.VendorOrderID)
if _, err = weixinmsg.SendStoreMessage(jxcontext.AdminCtx, "美团用户申请发票", content2, []int{localOrder.JxStoreID}, nil, "", model.MessageTypeStore, true, true); err != nil {
im.PushMsgByCid(localOrder.VendorStoreID, localOrder.VendorID, content2)
}
return err
}

View File

@@ -1058,3 +1058,12 @@ func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (strin
Amount: num,
})
}
func UploadInvoice(param *model.InvoiceMsg) error {
goodsOrder, err := partner.CurOrderManager.LoadOrder(param.OrderId, param.VendorID)
if err != nil {
return err
}
return getAPI(goodsOrder.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(goodsOrder), goodsOrder.VendorStoreID).UploadInvoice(param.OrderId, param.InvoiceUrl, param.InvoiceId, param.InvoiceTaskId)
}