This commit is contained in:
邹宗楠
2026-01-28 14:16:47 +08:00
parent 175dc47c60
commit 22b18f1e02
9 changed files with 67886 additions and 67469 deletions

View File

@@ -49,8 +49,7 @@ func (s *DefScheduler) OnAfsOrderNew(order *model.AfsOrder, isPending bool) (err
storeDetail, err := partner.CurOrderManager.LoadStoreDetail(order.StoreID, order.VendorID)
if err == nil {
afsList, _ := dao.GetAfsOrders(dao.GetDB(), order.VendorID, order.VendorOrderID, "")
if storeDetail.IsPrintRefundOrder == model.YES && len(afsList) == model.YES { // 打印退款订单
if storeDetail.IsPrintRefundOrder == model.YES { // 打印退款订单
order2, _ := partner.CurOrderManager.LoadOrder(order.VendorOrderID, order.VendorID)
_, err = netprinter.PrintRefundOrCancelOrder(jxcontext.AdminCtx, model.NO, order2, order2.JxStoreID)
}

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm"
"io"
"math"
"mime/multipart"
@@ -3042,6 +3043,89 @@ func UpdateSkuExinfoMap(ctx *jxcontext.Context, nameIDs []int, imgWaterMark stri
return hint, err
}
func UpdateVendorImg(ctx *jxcontext.Context, storeId int, imgWaterMark string, vendorID int, exPrefix string, fromTime, toTime string, isAsync, isContinueWhenError bool) (hint string, err error) {
var (
fromTimeP time.Time
toTimeP time.Time
db = dao.GetDB()
i = 0
// skuIDs []int
)
if fromTime != "" {
fromTimeP = utils.Time2Date(utils.Str2Time(fromTime))
}
if toTime != "" {
toTimeP = utils.Time2Date(utils.Str2Time(toTime))
}
if toTimeP.Before(fromTimeP) {
return "", fmt.Errorf("结束时间不可以小于开始时间!开始时间:[%v],结束时间:[%v]", fromTimeP, toTimeP)
}
task := tasksch.NewParallelTask("刷新商品前缀水印图", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
switch vendorID {
case model.VendorIDMTWM:
storeDetail, err := dao.GetStoreDetail(db, storeId, vendorID, "")
if err != nil {
return nil, err
}
api := mtwm.GetAPI(storeDetail.VendorOrgCode, storeId, storeDetail.VendorStoreID)
for {
foodList, _ := api.RetailListAll(storeDetail.VendorStoreID, i)
for _, v := range foodList {
if v.AppFoodCode == "mtcode_2005129131042222122" { // 测试
skuEx := &model.SkuExinfoMap{
NameID: 0,
ImgWatermark: v.PictureList[0], // 原图
ImgWatermarkMix: v.AppFoodCode, // 商品ID
ExPrefix: exPrefix,
VendorID: vendorID,
BeginAt: fromTimeP,
EndAt: toTimeP,
BrandID: 0,
}
dao.WrapAddIDCULDEntity(skuEx, ctx.GetUserName())
dao.CreateEntity(db, skuEx)
param := map[string]interface{}{}
if imgWaterMark != "" {
if ImgMix := jxutils.MixWatermarkImg(imgWaterMark, v.PictureList[0], &fromTimeP, &toTimeP); ImgMix != "" {
picture := make([]string, 0, len(v.PictureList))
picture = append(picture, ImgMix)
if len(v.PictureList) > 1 {
picture = append(picture, v.PictureList[1:]...)
}
param["picture"] = strings.Join(picture, ",")
}
}
if exPrefix != "" {
param["name"] = fmt.Sprintf("%s %s", exPrefix, v.Name)
}
api.RetailInitData(utils.GetUUID(), storeDetail.VendorStoreID, v.AppFoodCode, param)
return nil, err
}
}
if len(foodList) < 100 {
break
}
i++
}
}
return retVal, err
}, nil)
tasksch.HandleTask(task, nil, true).Run()
if isAsync {
hint = task.GetID()
} else {
_, err = task.GetResult(0)
hint = "1"
}
return hint, err
}
func GetVendorCategoryMap(ctx *jxcontext.Context, parentID, level, vendorID int, vendorOrgCode string) (vendorMaps []*model.VendorCategoryMap, err error) {
db := dao.GetDB()
vendorMaps, err = dao.GetVendorCategoryMap(db, parentID, level, vendorID, vendorOrgCode, 0)

View File

@@ -132,6 +132,10 @@ func PrintStoreStatus(ctx *jxcontext.Context, storeDetail *dao.StoreDetail, vend
// PrintRefundOrCancelOrder 打印退单或取消订单信息
func PrintRefundOrCancelOrder(ctx *jxcontext.Context, printType int, order *model.GoodsOrder, storeID int) (printResult *partner.PrinterStatus, err error) {
db := dao.GetDB()
list, _ := dao.GetOrderStatusList(order.VendorOrderID, model.OrderTypeAfsOrder, order.VendorID)
if len(list) > 1 {
return nil, nil
}
store, err := getStore4Print(db, storeID)
if err == nil {
handler, err := GetHandlerFromStore(store)

View File

@@ -2105,3 +2105,15 @@ type StoreOrderRank struct {
OrderCount int `json:"order_count"`
TotalOrders int `json:"total_orders"`
}
func GetOrderStatusList(vendorOrderId string, orderType, vendorId int) ([]*model.OrderStatus, error) {
sql := ` SELECT * FROM order_status WHERE ref_vendor_order_id = ? AND vendor_id = ? AND order_type = ? `
param := []interface{}{vendorOrderId, vendorId, orderType}
orderStatus := make([]*model.OrderStatus, 0, 0)
if err := GetRows(GetDB(), &orderStatus, sql, param); err != nil {
return nil, err
}
return orderStatus, nil
}

View File

@@ -614,6 +614,27 @@ func (c *SkuController) UpdateSkuExinfoMap() {
})
}
// @Title 批量设置商品额外信息
// @Description 批量设置商品额外信息
// @Param token header string true "认证token"
// @Param exPrefix formData string false "商品额外前缀"
// @Param fromDate formData string true "生效开始时间,格式 2006-01-01 "
// @Param toDate formData string true "生效结束时间,格式 2006-01-01 "
// @Param imgWaterMark formData string false "商品水印图"
// @Param vendorID formData int true "平台ID"
// @Param storeId formData int true "京西门店ID"
// @Param isAsync formData bool false "是否异步"
// @Param isContinueWhenError formData bool false "单个同步失败是否继续缺省false"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateVendorSkuImg [put]
func (c *SkuController) UpdateVendorSkuImg() {
c.callUpdateVendorSkuImg(func(params *tSkuUpdateVendorSkuImgParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.UpdateVendorImg(params.Ctx, params.StoreId, params.ImgWaterMark, params.VendorID, params.ExPrefix, params.FromDate, params.ToDate, params.IsAsync, params.IsContinueWhenError)
return retVal, "", err
})
}
// @Title 得到平台类别
// @Description 得到平台类别
// @Param token header string true "认证token"

View File

@@ -2490,6 +2490,15 @@ func init() {
MethodParams: param.Make(),
Filters: nil,
Params: nil})
// 修改美团线上商品图片加水印,名字加前缀
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"],
web.ControllerComments{
Method: "UpdateVendorSkuImg",
Router: `/UpdateVendorSkuImg`,
AllowHTTPMethods: []string{"put"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"],
web.ControllerComments{

File diff suppressed because it is too large Load Diff

View File

@@ -17207,6 +17207,83 @@
}
}
},
"/sku/UpdateVendorSkuImg": {
"put": {
"tags": [
"sku"
],
"description": "批量设置商品额外信息",
"operationId": "SkuController.批量设置商品额外信息",
"parameters": [
{
"in": "header",
"name": "token",
"description": "认证token",
"required": true,
"type": "string"
},
{
"in": "formData",
"name": "exPrefix",
"description": "商品额外前缀",
"type": "string"
},
{
"in": "formData",
"name": "fromDate",
"description": "生效开始时间,格式 2006-01-01",
"required": true,
"type": "string"
},
{
"in": "formData",
"name": "toDate",
"description": "生效结束时间,格式 2006-01-01",
"required": true,
"type": "string"
},
{
"in": "formData",
"name": "imgWaterMark",
"description": "商品水印图",
"type": "string"
},
{
"in": "formData",
"name": "vendorID",
"description": "平台ID",
"required": true,
"type": "integer",
"format": "int64"
},
{
"in": "formData",
"name": "storeId",
"description": "京西门店ID",
"required": true,
"type": "integer",
"format": "int64"
},
{
"in": "formData",
"name": "isAsync",
"description": "是否异步",
"type": "boolean"
},
{
"in": "formData",
"name": "isContinueWhenError",
"description": "单个同步失败是否继续缺省false",
"type": "boolean"
}
],
"responses": {
"200": {
"description": "{object} controllers.CallResult"
}
}
}
},
"/store/AddBrand": {
"post": {
"tags": [
@@ -17649,7 +17726,6 @@
"in": "query",
"name": "notifyUrl",
"description": "成功跳转链接(支付宝有,微信没有)",
"required": true,
"type": "string"
}
],

View File

@@ -11674,6 +11674,59 @@ paths:
responses:
"200":
description: '{object} controllers.CallResult'
/sku/UpdateVendorSkuImg:
put:
tags:
- sku
description: 批量设置商品额外信息
operationId: SkuController.批量设置商品额外信息
parameters:
- in: header
name: token
description: 认证token
required: true
type: string
- in: formData
name: exPrefix
description: 商品额外前缀
type: string
- in: formData
name: fromDate
description: 生效开始时间,格式 2006-01-01
required: true
type: string
- in: formData
name: toDate
description: 生效结束时间,格式 2006-01-01
required: true
type: string
- in: formData
name: imgWaterMark
description: 商品水印图
type: string
- in: formData
name: vendorID
description: 平台ID
required: true
type: integer
format: int64
- in: formData
name: storeId
description: 京西门店ID
required: true
type: integer
format: int64
- in: formData
name: isAsync
description: 是否异步
type: boolean
- in: formData
name: isContinueWhenError
description: 单个同步失败是否继续缺省false
type: boolean
responses:
"200":
description: '{object} controllers.CallResult'
/store/AddBrand:
post:
tags:
@@ -11985,7 +12038,6 @@ paths:
- in: query
name: notifyUrl
description: 成功跳转链接(支付宝有,微信没有)
required: true
type: string
responses:
"200":