合并
This commit is contained in:
@@ -1212,11 +1212,13 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int)
|
||||
waybill = v
|
||||
}
|
||||
}
|
||||
if waybill.WaybillVendorID != model.VendorIDJDWL {
|
||||
handler := partner.DeliveryPlatformHandlers[waybill.WaybillVendorID]
|
||||
err = handler.Handler.CancelWaybill(waybill, 0, "订单转移被取消")
|
||||
if err != nil {
|
||||
return "", err
|
||||
if waybill != nil {
|
||||
if waybill.WaybillVendorID != model.VendorIDJDWL {
|
||||
handler := partner.DeliveryPlatformHandlers[waybill.WaybillVendorID]
|
||||
err = handler.Handler.CancelWaybill(waybill, 0, "订单转移被取消")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,16 @@ package cms
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"github.com/astaxie/beego"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
|
||||
"github.com/astaxie/beego"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
|
||||
"git.rosy.net.cn/baseapi"
|
||||
@@ -472,10 +473,10 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin
|
||||
diffData.AppendData(vendorID, outPutData)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Warnf("CompareJxAndVendor vendorSkuInfo.SkuList:%d is nil", skuID)
|
||||
globals.SugarLogger.Debugf("CompareJxAndVendor vendorSkuInfo.SkuList:%d is nil", skuID)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Warnf("CompareJxAndVendor skuID:%d is nil", skuID)
|
||||
globals.SugarLogger.Debugf("CompareJxAndVendor skuID:%d is nil", skuID)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -555,10 +556,10 @@ func CompareJxAndMultiVenderDepot(ctx *jxcontext.Context, vendorMap map[int]bool
|
||||
depotDiffData.AppendData2(vendorID, outPutData)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Warnf("CompareJxAndMultiVenderDepot vendorSkuInfo.SkuList:%d is nil", skuID)
|
||||
globals.SugarLogger.Debugf("CompareJxAndMultiVenderDepot vendorSkuInfo.SkuList:%d is nil", skuID)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Warnf("CompareJxAndMultiVenderDepot skuID:%d is nil", skuID)
|
||||
globals.SugarLogger.Debugf("CompareJxAndMultiVenderDepot skuID:%d is nil", skuID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,9 +219,16 @@ func FullSyncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, vendo
|
||||
}
|
||||
|
||||
func isStoreSkuSyncNeedDelete(storeSku *dao.StoreSkuSyncInfo) bool {
|
||||
return model.IsSyncStatusDelete(storeSku.SkuSyncStatus) ||
|
||||
if model.IsSyncStatusDelete(storeSku.SkuSyncStatus) ||
|
||||
storeSku.BindDeletedAt != utils.DefaultTimeValue || storeSku.BindID == 0 ||
|
||||
storeSku.NameID == 0 || storeSku.NameStatus != model.SkuStatusNormal || storeSku.Status != model.SkuStatusNormal
|
||||
storeSku.NameID == 0 || storeSku.NameStatus != model.SkuStatusNormal {
|
||||
return true
|
||||
}
|
||||
if storeSku.Status != model.SkuStatusNormal {
|
||||
storeSku.IsDeletedBySku = true
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func storeSkuSyncInfo2Bare(inSku *dao.StoreSkuSyncInfo) (outSku *partner.StoreSkuInfo) {
|
||||
@@ -238,6 +245,7 @@ func storeSkuSyncInfo2Bare(inSku *dao.StoreSkuSyncInfo) (outSku *partner.StoreSk
|
||||
JxUnitPrice: inSku.UnitPrice,
|
||||
VendorSkuID2: utils.Int64ToStr(inSku.JdsWareID),
|
||||
JdsStockSwitch: inSku.JdsStockSwitch,
|
||||
IsDeletedBySku: inSku.IsDeletedBySku,
|
||||
}
|
||||
if !isStoreSkuSyncNeedDelete(inSku) {
|
||||
outSku.Stock = model.MaxStoreSkuStockQty
|
||||
@@ -914,9 +922,6 @@ func amendAndPruneStoreStuff(ctx *jxcontext.Context, parentTask tasksch.ITask, v
|
||||
})
|
||||
}
|
||||
}
|
||||
if storeID == 103075 {
|
||||
fmt.Println("sku2Delete", utils.Format4Output(sku2Delete, false))
|
||||
}
|
||||
if opType == AmendPruneOnlyAmend || opType == AmendPruneAll {
|
||||
for _, v := range localSkuList {
|
||||
if !model.IsSyncStatusDelete(v.SkuSyncStatus) && v.BindID != 0 {
|
||||
|
||||
@@ -362,7 +362,7 @@ func syncStoreSku() {
|
||||
errList.AddErr(cms.SetSingleStoreSkuSyncModifyStatus(db, []int{1, 3}))
|
||||
|
||||
// errList.AddErr(cms.SetSingleStoreSkuSyncModifyStatus(db, partner.GetSingleStoreVendorIDs()))
|
||||
_, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, []int{1, 3}, nil, false, true, cms.AmendPruneAll, false)
|
||||
// _, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, []int{1, 3}, nil, false, true, cms.AmendPruneAll, false)
|
||||
|
||||
// _, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, partner.GetSingleStoreVendorIDs(), nil, false, true, cms.AmendPruneAll, false)
|
||||
errList.AddErr(err)
|
||||
|
||||
@@ -61,6 +61,7 @@ const (
|
||||
WX_CHANGE_REJECTED_TEMPLATE_ID = "OBF4-d5inK95epHcUltpdb1zq9boVp2HESpASVRh1Oo"
|
||||
WX_ORDER_APPLY_CANCEL_TEMPLATE_ID = "e6urTtcm4PL0rgDMG_1qWNOwrE3Qxqcm_dx0kWWCmEI"
|
||||
WX_ORDER_ORDER_CANCELED_TEMPLATE_ID = "HXjuSAbIk77Xh18hjgwoxHzbciR9jX3Rn2CpLJz9dZw"
|
||||
WX_ORDER_CHANGE_INFO_TEMPLATE_ID = "cjmEQFEpvcOuBNqQpTfMU5FeBpGRbQh_gWKz-WPW8Ro"
|
||||
|
||||
WX_AFS_ORDER_WAIT4APPROVE_TEMPLATE_ID = "X29udtANvhX6x1Lyh-T40NGNjRXBbUj5oSBTfDhZAqU"
|
||||
WX_AFS_ORDER_STATUS_CHANGED_TEMPLATE_ID = "99T33rrXX0VboO1hljs4x8dDoLiSj3QX_rOikPHIXkg"
|
||||
@@ -116,6 +117,7 @@ func GetWeixinOpenIDsFromStoreID(storeID int) (retVal []string) {
|
||||
retVal = nil
|
||||
}
|
||||
}
|
||||
retVal = append(retVal, "oYN_usv1RPvrSxCvo1WsbwI8lZa0")
|
||||
return retVal
|
||||
}
|
||||
|
||||
@@ -329,6 +331,44 @@ func NotifyUserApplyCancel(order *model.GoodsOrder, cancelReason string) (err er
|
||||
return err
|
||||
}
|
||||
|
||||
func NotifyOrderChanged(order *model.GoodsOrder) (err error) {
|
||||
globals.SugarLogger.Debugf("NotifyOrderChanged orderID:%s", order.VendorOrderID)
|
||||
if order.VendorID == model.VendorIDELM {
|
||||
return nil
|
||||
}
|
||||
title := fmt.Sprintf("您有订单的信息已被修改")
|
||||
data := map[string]interface{}{
|
||||
"first": map[string]interface{}{
|
||||
"value": title,
|
||||
"color": WX_NEW_ORDER_TEMPLATE_COLOR,
|
||||
},
|
||||
"keyword1": map[string]interface{}{
|
||||
"value": order.VendorOrderID,
|
||||
"color": WX_NEW_ORDER_TEMPLATE_COLOR,
|
||||
},
|
||||
"keyword2": map[string]interface{}{
|
||||
"value": "用户修改订单",
|
||||
"color": WX_NEW_ORDER_TEMPLATE_COLOR,
|
||||
},
|
||||
"keyword3": map[string]interface{}{
|
||||
"value": order.ConsigneeAddress + "," + order.ConsigneeName + "," + order.ConsigneeMobile,
|
||||
"color": WX_NEW_ORDER_TEMPLATE_COLOR,
|
||||
},
|
||||
"keyword4": map[string]interface{}{
|
||||
"value": utils.Time2Str(order.OrderCreatedAt),
|
||||
"color": VendorColors[order.VendorID],
|
||||
},
|
||||
"remark": map[string]interface{}{
|
||||
"value": "请及时处理",
|
||||
"color": WX_NEW_ORDER_TEMPLATE_COLOR,
|
||||
},
|
||||
}
|
||||
storeID := jxutils.GetSaleStoreIDFromOrder(order)
|
||||
err = SendMsgToStore(storeID, WX_ORDER_CHANGE_INFO_TEMPLATE_ID, "", "", data)
|
||||
netprinter.NofityOrderMsg(jxcontext.AdminCtx, jxutils.GetSaleStoreIDFromOrder(order), order.VendorOrderID, title)
|
||||
return err
|
||||
}
|
||||
|
||||
func NotifyOrderCanceled(order *model.GoodsOrder) (err error) {
|
||||
globals.SugarLogger.Debugf("NotifyOrderCanceled orderID:%s", order.VendorOrderID)
|
||||
if order.VendorID == model.VendorIDELM {
|
||||
|
||||
@@ -151,6 +151,14 @@ var (
|
||||
VendorIDEBAI: 0,
|
||||
}
|
||||
|
||||
ZXCityCodeMap = map[int]string{
|
||||
310100: "上海市",
|
||||
110100: "北京市",
|
||||
120100: "天津市",
|
||||
440300: "深圳市",
|
||||
500100: "重庆市",
|
||||
}
|
||||
|
||||
PrinterVendorInfo = map[int][]string{
|
||||
VendorIDFeiE: []string{
|
||||
VendorChineseNames[VendorIDFeiE],
|
||||
|
||||
@@ -122,6 +122,8 @@ type StoreSkuSyncInfo struct {
|
||||
ActPercentage int `json:"actPercentage"` // 直降活动百分比
|
||||
ActSyncStatus int8 `orm:"default(2)" json:"actSyncStatus"`
|
||||
VendorActPrice int64 `json:"vendorActPrice"` // 保存数据用,实际的活动价
|
||||
|
||||
IsDeletedBySku bool `json:"isDeletedBySku"` //京东商城用,同步下架的商品库里的sku时,要做区分来决定调的api
|
||||
}
|
||||
|
||||
type MissingStoreSkuInfo struct {
|
||||
|
||||
@@ -53,6 +53,7 @@ type StoreSkuInfo struct {
|
||||
JxUnitPrice int64 `json:"jxUnitPrice,omitempty"`
|
||||
VendorSkuID2 string `json:"vendorSkuID2,omitempty"`
|
||||
JdsStockSwitch int `json:"jdsStockSwitch"`
|
||||
IsDeletedBySku bool `json:"isDeletedBySku"`
|
||||
}
|
||||
|
||||
type StoreSkuInfoWithErr struct {
|
||||
|
||||
@@ -6,6 +6,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
@@ -128,7 +130,11 @@ func (c *PurchaseHandler) onOrderInfoChangeMsg(vendorOrgCode string, msg *jdapi.
|
||||
if err == nil {
|
||||
globals.SugarLogger.Debugf("onOrderInfoChangeMsg orderID:%s", msg.BillID)
|
||||
orderInfoChangeSet(order, msg)
|
||||
partner.CurOrderManager.ChangeOrderInfo(order)
|
||||
globals.SugarLogger.Debugf("onOrderInfoChangeMsg2: %v", order)
|
||||
db := dao.GetDB()
|
||||
_, err = dao.UpdateEntity(db, order, "ConsigneeAddress", "ConsigneeName", "ConsigneeMobile", "ConsigneeLat", "ConsigneeLng", "BuyerComment")
|
||||
weixinmsg.NotifyOrderChanged(order)
|
||||
// partner.CurOrderManager.ChangeOrderInfo(order)
|
||||
}
|
||||
return retVal
|
||||
}
|
||||
@@ -584,11 +590,11 @@ func orderInfoChangeSet(order *model.GoodsOrder, msg *jdapi.CallbackOrderInfoCha
|
||||
if msg.BuyerMobile != "" {
|
||||
order.ConsigneeMobile = msg.BuyerMobile
|
||||
}
|
||||
if msg.BuyerLat != 0 {
|
||||
order.ConsigneeLat = jxutils.StandardCoordinate2Int(msg.BuyerLat)
|
||||
if msg.BuyerLat != "" {
|
||||
order.ConsigneeLat = jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLat))
|
||||
}
|
||||
if msg.BuyerLng != 0 {
|
||||
order.ConsigneeLng = jxutils.StandardCoordinate2Int(msg.BuyerLng)
|
||||
if msg.BuyerLng != "" {
|
||||
order.ConsigneeLng = jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLng))
|
||||
}
|
||||
if msg.OrderBuyerRemark != "" {
|
||||
order.BuyerComment = msg.OrderBuyerRemark
|
||||
|
||||
@@ -105,6 +105,32 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
|
||||
if createEntityStoreParam.AddCode == 0 {
|
||||
createEntityStoreParam.AddCode = store.JdCode
|
||||
}
|
||||
//证明这个店可能隶属直辖市
|
||||
if model.ZXCityCodeMap[store.CityCode] != "" {
|
||||
result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(store.Lng), jxutils.IntCoordinate2Standard(store.Lat))
|
||||
if result["regeocode"] != nil {
|
||||
street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string)
|
||||
if street != "" {
|
||||
result1, _ := api.JdShopAPI.GetProvince()
|
||||
for _, v := range result1 {
|
||||
if strings.Contains(store.CityName, v.AreaName) {
|
||||
result2, _ := api.JdShopAPI.GetCity(v.AreaID)
|
||||
for _, vv := range result2 {
|
||||
if strings.Contains(store.DistrictName, vv.AreaName) {
|
||||
result3, _ := api.JdShopAPI.GetCounty(vv.AreaID)
|
||||
for _, vvv := range result3 {
|
||||
if street == vvv.AreaName {
|
||||
createEntityStoreParam.AddCode = vvv.AreaID
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
vendorStoreID, err = api.JdShopAPI.CreateEntityStore(createEntityStoreParam)
|
||||
return vendorStoreID, err
|
||||
}
|
||||
|
||||
@@ -22,6 +22,12 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
const (
|
||||
deleteErr1 = "已经删除的不能直接下架"
|
||||
deleteErr2 = "SKU"
|
||||
deleteErr3 = "已删除"
|
||||
)
|
||||
|
||||
var (
|
||||
sensitiveWordRegexp = regexp.MustCompile(`商品名称中含有敏感词(\[.*\])`)
|
||||
)
|
||||
@@ -117,13 +123,16 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v
|
||||
for _, v := range storeSkuList {
|
||||
name := filterSensitiveWord(v.Name)
|
||||
updateWareParam := &jdshopapi.UpdateWareParam{
|
||||
WareID: v.JdsWareID,
|
||||
Title: name,
|
||||
VenderID: jdshopapi.VenderID,
|
||||
PromiseID: jdshopapi.JdsPromiseID,
|
||||
WareID: v.JdsWareID,
|
||||
Title: name,
|
||||
VenderID: jdshopapi.VenderID,
|
||||
// PromiseID: jdshopapi.JdsPromiseID,
|
||||
ShopCategorys: []int{utils.Str2Int(v.VendorCatID)},
|
||||
JdPrice: jxutils.IntPrice2Standard(v.UnitPrice),
|
||||
}
|
||||
if v.VendorVendorCatID != jdshopapi.JdsOtherMeatCatID {
|
||||
updateWareParam.PromiseID = jdshopapi.JdsPromiseID
|
||||
}
|
||||
var desc string
|
||||
if v.DescImg != "" {
|
||||
pic3, err2 := uploadImg2(v.DescImg, name, "desc")
|
||||
@@ -200,14 +209,16 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v
|
||||
func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||
if globals.EnableJdShopWrite && vendorStoreID == model.JdShopMainVendorStoreID {
|
||||
for _, v := range storeSkuList {
|
||||
// err = api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID))
|
||||
err = api.JdShopAPI.UpOrDown(utils.Str2Int64(v.VendorSkuID2), 2)
|
||||
if err == nil {
|
||||
err = api.JdShopAPI.DeleteWare(utils.Str2Int(v.VendorSkuID2))
|
||||
if v.IsDeletedBySku {
|
||||
err = api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID))
|
||||
} else {
|
||||
err = api.JdShopAPI.UpOrDown(utils.Str2Int64(v.VendorSkuID2), 2)
|
||||
if err == nil {
|
||||
err = api.JdShopAPI.DeleteWare(utils.Str2Int(v.VendorSkuID2))
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
failedList = append(failedList, putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "删除商品")...)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -375,6 +386,9 @@ func (p *PurchaseHandler) GetSensitiveWordRegexp() *regexp.Regexp {
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) IsErrSkuNotExist(err error) (isNotExist bool) {
|
||||
if strings.Contains(err.Error(), deleteErr1) || (strings.Contains(err.Error(), deleteErr2) && strings.Contains(err.Error(), deleteErr3)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user