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

@@ -4,12 +4,13 @@ import (
"encoding/json"
"errors"
"fmt"
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
"git.rosy.net.cn/jx-callback/business/auth2"
"git.rosy.net.cn/jx-callback/business/bidding"
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
"git.rosy.net.cn/jx-callback/business/jxstore/permission"
"git.rosy.net.cn/jx-callback/business/partner/delivery"
"git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm"
"git.rosy.net.cn/jx-callback/business/partner/purchase/ebai"
"strings"
"time"
@@ -1512,7 +1513,7 @@ func (c *OrderController) UpdateTiktokSettlement() {
// @router /GetInvoiceRecord [post]
func (c *OrderController) GetInvoiceRecord() {
c.callGetInvoiceRecord(func(params *tOrderGetInvoiceRecordParams) (retVal interface{}, errCode string, err error) {
retVal, err = dao.GetStoreInvoiceList(params.StoreId, utils.Str2Time(params.StartTime), utils.Str2Time(params.EndTime), params.Status, params.Offset, params.PageSize)
retVal, err = dao.GetStoreInvoiceList(params.StoreId, 0, utils.Str2Time(params.StartTime), utils.Str2Time(params.EndTime), params.Status, params.Offset, params.PageSize)
return retVal, errCode, err
})
}
@@ -1537,9 +1538,78 @@ func (c *OrderController) UploadOrderInvoice() {
}
invoice.InvoiceUrl = params.InvoiceUrl
invoice.InvoiceId = params.InvoiceId
dao.UpdateEntity(db, invoice, "InvoiceUrl", "InvoiceId")
handler, _ := partner.GetPurchasePlatformFromVendorID(invoice.VendorID).(partner.IPurchasePlatformStoreSkuHandler)
success, _, err := handler.UploadInvoice(invoice)
if err != nil {
return nil, "", err
}
switch invoice.VendorID {
case model.VendorIDMTWM:
invoice.Status = model.InvoiceStatusBillingSuccess
case model.VendorIDEBAI:
for _, v := range success {
if v == invoice.InvoiceTaskId {
invoice.Status = model.InvoiceStatusBillingSuccess
}
}
err = mtwm.UploadInvoice(invoice)
}
dao.UpdateEntity(db, invoice, "InvoiceUrl", "InvoiceId", "Status")
return retVal, errCode, err
})
}
// @Title 查询门店发票设置
// @Description 查询门店发票设置
// @Param token header string true "认证token"
// @Param vendorId formData string true "平台ID"
// @Param vendorStoreID formData string true "平台门店ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /QueryInvoiceSetting [get]
func (c *OrderController) QueryInvoiceSetting() {
c.callQueryInvoiceSetting(func(params *tOrderQueryInvoiceSettingParams) (retVal interface{}, errCode string, err error) {
retVal, err = ebai.QueryInvoiceSetting(params.VendorStoreID)
return
})
}
// @Title 批量更新门店发票设置
// @Description 批量更新门店发票设置
// @Param token header string true "认证token"
// @Param vendorId formData string true "平台ID"
// @Param vendorStoreID formData string true "平台门店ID"
// @Param payload formData string true "json数据,格式为 ebaiapi.StoreInvoiceSetting"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /BathUpdateInvoiceSetting [post]
func (c *OrderController) BathUpdateInvoiceSetting() {
c.callBathUpdateInvoiceSetting(func(params *tOrderBathUpdateInvoiceSettingParams) (retVal interface{}, errCode string, err error) {
setting := &ebaiapi.StoreInvoiceSetting{}
if err = utils.UnmarshalUseNumber([]byte(params.Payload), setting); err == nil {
success, fail, err := ebai.BathUpdateInvoiceSetting(params.VendorStoreID, setting)
return map[string]interface{}{
"success": success,
"fail": fail,
}, "", err
}
return
})
}
// @Title 批量更新店铺开票申请
// @Description 批量更新店铺开票申请
// @Param token header string true "认证token"
// @Param vendorId formData string true "平台ID"
// @Param vendorStoreID formData string true "平台门店ID"
// @Param storeID formData int true "京西门店ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /QueryUnansweredInvoice [get]
func (c *OrderController) QueryUnansweredInvoice() {
c.callQueryUnansweredInvoice(func(params *tOrderQueryUnansweredInvoiceParams) (retVal interface{}, errCode string, err error) {
retVal, err = ebai.QueryUnansweredInvoice(params.VendorStoreID, params.StoreID)
return
})
}