This commit is contained in:
苏尹岚
2021-03-02 16:18:58 +08:00
parent 52a3d02eac
commit 67f1333ef3
2 changed files with 69 additions and 10 deletions

View File

@@ -41,7 +41,6 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
orderParams := []interface{}{}
orderFmt := ``
if storeDetail != nil {
if storeDetail.BrandIsPrint == model.NO {
orderFmt += `
<S2><C>%s</C></S2><RN><RN>

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": "", //结算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": "",
"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,50 @@ 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)
vendorStoreID, err = mtapi.PoiSettleSave(poiSettleSaveParam)
return vendorStoreID, err
}