Merge remote-tracking branch 'origin/mark' into jdshop

This commit is contained in:
苏尹岚
2021-03-02 16:57:32 +08:00
8 changed files with 140 additions and 55 deletions

View File

@@ -82,6 +82,12 @@ func PrintOrderByOrder4Store(ctx *jxcontext.Context, order *model.GoodsOrder, st
}, nil
}
storeDetail, _ := dao.GetStoreDetail(db, storeID, order.VendorID, order.VendorOrgCode)
if storeDetail == nil && order.VendorOrderID == testVendorOrderID {
storeDetail = &dao.StoreDetail{
BrandName: testVendorOrderID,
BrandIsPrint: model.NO,
}
}
printResult, err = handler.PrintOrder(ctx, store, storeDetail, order)
if err == nil {
dao.SetOrderPrintFlag(db, ctx.GetUserName(), order.VendorOrderID, order.VendorID, true)

View File

@@ -40,14 +40,16 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
getCode = fmt.Sprintf("<B>饿百取货码:%s</B><BR><BR>\n", jxutils.GetEbaiOrderGetCode(order))
}
orderFmt := ``
if storeDetail.BrandIsPrint == model.NO {
orderFmt += `
if storeDetail != nil {
if storeDetail.BrandIsPrint == model.NO {
orderFmt += `
<CB>%s</CB><BR><BR>
`
if order.VendorOrgCode == "34665" {
orderParams = append(orderParams, globals.StoreNameEbai2)
} else {
orderParams = append(orderParams, storeDetail.BrandName)
if order.VendorOrgCode == "34665" {
orderParams = append(orderParams, globals.StoreNameEbai2)
} else {
orderParams = append(orderParams, storeDetail.BrandName)
}
}
}
orderFmt += `
@@ -124,14 +126,16 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
}
orderParams := []interface{}{}
orderFmt := ``
if storeDetail.BrandIsPrint == model.NO {
orderFmt += `
if storeDetail != nil {
if storeDetail.BrandIsPrint == model.NO {
orderFmt += `
<CB>%s</CB><BR><BR>
`
if order.VendorOrgCode == "34665" {
orderParams = append(orderParams, globals.StoreNameEbai2)
} else {
orderParams = append(orderParams, storeDetail.BrandName)
if order.VendorOrgCode == "34665" {
orderParams = append(orderParams, globals.StoreNameEbai2)
} else {
orderParams = append(orderParams, storeDetail.BrandName)
}
}
}
orderFmt += `

View File

@@ -39,14 +39,16 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
}
orderParams := []interface{}{}
orderFmt := ``
if storeDetail.BrandIsPrint == model.NO {
orderFmt += `
<FS2><center>%s</center></FS2>\n\n
`
if order.VendorOrgCode == "34665" {
orderParams = append(orderParams, globals.StoreNameEbai2)
} else {
orderParams = append(orderParams, storeDetail.BrandName)
if storeDetail != nil {
if storeDetail.BrandIsPrint == model.NO {
orderFmt += `
<FS2><center>%s</center></FS2>\n\n
`
if order.VendorOrgCode == "34665" {
orderParams = append(orderParams, globals.StoreNameEbai2)
} else {
orderParams = append(orderParams, storeDetail.BrandName)
}
}
}
orderFmt += `
@@ -117,14 +119,16 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
}
orderParams := []interface{}{}
orderFmt := ``
if storeDetail.BrandIsPrint == model.NO {
orderFmt += `
if storeDetail != nil {
if storeDetail.BrandIsPrint == model.NO {
orderFmt += `
<FS2><center>%s</center></FS2>\n\n
`
if order.VendorOrgCode == "34665" {
orderParams = append(orderParams, globals.StoreNameEbai2)
} else {
orderParams = append(orderParams, storeDetail.BrandName)
if order.VendorOrgCode == "34665" {
orderParams = append(orderParams, globals.StoreNameEbai2)
} else {
orderParams = append(orderParams, storeDetail.BrandName)
}
}
}
orderFmt += `

View File

@@ -40,14 +40,16 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
}
orderParams := []interface{}{}
orderFmt := ``
if storeDetail.BrandIsPrint == model.NO {
orderFmt += `
if storeDetail != nil {
if storeDetail.BrandIsPrint == model.NO {
orderFmt += `
<S2><C>%s</C></S2><RN><RN>
`
if order.VendorOrgCode == "34665" {
orderParams = append(orderParams, globals.StoreNameEbai2)
} else {
orderParams = append(orderParams, storeDetail.BrandName)
if order.VendorOrgCode == "34665" {
orderParams = append(orderParams, globals.StoreNameEbai2)
} else {
orderParams = append(orderParams, storeDetail.BrandName)
}
}
}
orderFmt += `

View File

@@ -14,7 +14,7 @@ import (
)
const (
EbaiSupplierIDsc = "1486975681715"
EbaiSupplierIDsc = "1921188187760"
EbaiSupplierIDc4 = "22267134648"
EbaiSupplierIDhc = "2233065879"
EbaiSupplierIDgy = "2267230126"

View File

@@ -38,7 +38,7 @@ var (
},
},
BusinessFormID: 1672214913,
BrandName: "京西到家便利店",
BrandName: "京西到家",
},
EbaiSupplierIDhc: &tEbaiSupplierInfo{
SupplierID: EbaiSupplierIDhc,

View File

@@ -433,24 +433,31 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate, isE
if !isExd {
var categoryID = utils.Str2Int64(storeSku.VendorCatID)
if ebaiExSkuCatMap[storeSku.SkuID] != 0 {
store, _ := dao.GetStoreDetail(dao.GetDB(), storeSku.StoreID, model.VendorIDEBAI, "")
if store.CityCode == 510100 {
s, _ := dao.GetStoreSkuCategoryMap(dao.GetDB(), 439, storeSku.StoreID)
categoryID = s.EbaiID
if store, err := dao.GetStoreDetail(dao.GetDB(), storeSku.StoreID, model.VendorIDEBAI, ""); err == nil && store != nil {
if store.CityCode == 510100 {
if s, err2 := dao.GetStoreSkuCategoryMap(dao.GetDB(), 439, storeSku.StoreID); err2 == nil && s != nil {
categoryID = s.EbaiID
}
}
}
}
if ebaiExSkuCatMap2[storeSku.SkuID] != 0 {
store, _ := dao.GetStoreDetail(dao.GetDB(), storeSku.StoreID, model.VendorIDEBAI, "")
if store.CityCode == 510100 {
s, _ := dao.GetStoreSkuCategoryMap(dao.GetDB(), 440, storeSku.StoreID)
categoryID = s.EbaiID
if store, err := dao.GetStoreDetail(dao.GetDB(), storeSku.StoreID, model.VendorIDEBAI, ""); err == nil && store != nil {
if store.CityCode == 510100 {
if s, err2 := dao.GetStoreSkuCategoryMap(dao.GetDB(), 440, storeSku.StoreID); err2 == nil && s != nil {
categoryID = s.EbaiID
}
}
}
}
if ebaiExSkuCatMap3[storeSku.SkuID] != 0 {
store, _ := dao.GetStoreDetail(dao.GetDB(), storeSku.StoreID, model.VendorIDEBAI, "")
if store.CityCode == 510100 {
s, _ := dao.GetStoreSkuCategoryMap(dao.GetDB(), 175, storeSku.StoreID)
categoryID = s.EbaiID
if store, err := dao.GetStoreDetail(dao.GetDB(), storeSku.StoreID, model.VendorIDEBAI, ""); err == nil && store != nil {
if store.CityCode == 510100 {
if s, err2 := dao.GetStoreSkuCategoryMap(dao.GetDB(), 175, storeSku.StoreID); err2 == nil && s != nil {
categoryID = s.EbaiID
}
}
}
}
params["category_id"] = categoryID

View File

@@ -24,10 +24,28 @@ import (
var (
opTimeErrReg = regexp.MustCompile(`当前配送营业时间为:([\d:~,]*)`)
storeVendorOrgCodeMap = map[string]string{
"589": mtwmapi.MtwmC4Tag,
"5873": mtwmapi.MtwmSCTag,
"4123": mtwmapi.MtwmSGTag,
storeVendorOrgCodeMap = map[string]map[string]string{
"589": map[string]string{
"firstTag": mtwmapi.MtwmC4Tag, //经营品类
"settlementID": "7030017", //结算ID
"poiCert": "1,5", //资质列表
},
"5873": map[string]string{
"firstTag": mtwmapi.MtwmSCTag,
"settlementID": "",
"poiCert": "1,2,5,6",
},
"4123": map[string]string{
"firstTag": mtwmapi.MtwmSGTag,
"settlementID": "6572945",
"poiCert": "1,5",
},
}
poiCertMap = map[string]string{
"1": "门脸图",
"2": "环境图",
"5": "营业执照",
"6": "食品经营许可证",
}
)
@@ -124,24 +142,24 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
shippingTime += jxutils.JxOperationTime2StrTime(storeDetail.CloseTime2)
}
}
vendorInfoMap := storeVendorOrgCodeMap[vendorOrgCode]
poiSettleSaveParam := &mtwmapi.PoiSettleSaveParam{
Type: 0, //创建
ApplyInfos: []*mtwmapi.ApplyInfo{
&mtwmapi.ApplyInfo{
AppPoiCode: utils.Int2Str(storeDetail.ID),
SettlementID: 0, //结算ID暂时还没得
SettlementID: utils.Str2Int(vendorInfoMap["settlementID"]), //结算ID暂时还没得
MultiPoiBasicInfo: &mtwmapi.MultiPoiBasicInfo{
Name: params["vendorStoreName"].(string),
City: cityName,
Address: storeDetail.Address,
Longitude: utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lng)),
Latitude: utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lat)),
FirstTag: storeVendorOrgCodeMap[vendorOrgCode],
FirstTag: vendorInfoMap["firstTag"],
CallCenter: storeDetail.Tel1,
ContactPhone: storeDetail.Tel1,
ContactName: storeDetail.IDName,
EcommerceAccountPhone: "18048531223",
EcommerceAccountPhone: "18048531223", //石总的手机
ShippingTime: shippingTime,
},
MultiPoiShippingInfo: &mtwmapi.MultiPoiShippingInfo{
@@ -153,8 +171,52 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
},
},
}
switchCertType := func(certType string) (licensePic, licenseSocialCreditCode, licenseNumber, licenseLegalPerson, licenseAddress, licenseValidStartDate, licenseValidity string, isLongTime int) {
switch certType {
case "1":
licensePic = storeDetail.StoreFrontPic
case "2":
licensePic = storeDetail.StoreInPic
case "5":
licensePic = storeDetail.Licence
licenseSocialCreditCode = storeDetail.LicenceCode
licenseNumber = storeDetail.LicenceCode
licenseLegalPerson = storeDetail.LicenceOwnerName
licenseAddress = storeDetail.LicenceAddress
licenseValidStartDate = storeDetail.LicenceValid
if storeDetail.LicenceExpire == "" {
isLongTime = 1
} else {
licenseValidity = storeDetail.LicenceExpire
}
case "6":
licensePic = storeDetail.Licence2Image
licenseSocialCreditCode = storeDetail.Licence2Code
licenseNumber = storeDetail.Licence2Code
licenseLegalPerson = storeDetail.LicenceOwnerName
licenseAddress = storeDetail.LicenceAddress
licenseValidStartDate = storeDetail.Licence2Valid
if storeDetail.Licence2Expire == "" {
isLongTime = 1
} else {
licenseValidity = storeDetail.Licence2Expire
}
}
return licensePic, licenseSocialCreditCode, licenseNumber, licenseLegalPerson, licenseAddress, licenseValidStartDate, licenseValidity, isLongTime
}
var certs []*mtwmapi.MultiPoiCertInfo
for _, v := range strings.Split(vendorInfoMap["poiCert"], ",") {
cert := &mtwmapi.MultiPoiCertInfo{
Type: utils.Str2Int(v),
LicenseName: poiCertMap[v],
}
cert.LicensePic, cert.LicenseSocialCreditCode, cert.LicenseNumber, cert.LicenseLegalPerson, cert.LicenseAddress, cert.LicenseValidStartDate, cert.LicenseValidity, cert.IsLongTime = switchCertType(v)
certs = append(certs, cert)
}
mtapi := getAPIWithoutToken(storeDetail.VendorOrgCode)
mtapi.PoiSettleSave(poiSettleSaveParam)
if vendorStoreID, err = mtapi.PoiSettleSave(poiSettleSaveParam); err == nil {
err = mtapi.PoiSettleAuditSubmit([]string{vendorStoreID})
}
return vendorStoreID, err
}