aa
This commit is contained in:
@@ -1206,7 +1206,7 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend
|
||||
mtapi := apimanager.CurAPIManager.GetAPI(model.VendorIDMTWM, storeMap.VendorOrgCode).(*mtwmapi.API)
|
||||
if token, err := mtapi.GetAccessToken2(storeMap.VendorStoreID); err == nil && token != nil {
|
||||
storeMap.MtwmToken = token.AccessToken
|
||||
storeMap.MtwmToken = token.RefreshToken
|
||||
storeMap.MtwmRefreshToken = token.RefreshToken
|
||||
}
|
||||
}
|
||||
storeMap.SyncStatus = model.SyncFlagModifiedMask | model.SyncFlagStoreName | model.SyncFlagStoreAddress // 新增绑定门店是修改的概念
|
||||
|
||||
@@ -10,8 +10,6 @@ import (
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
@@ -444,8 +442,7 @@ func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID int, f
|
||||
if index2 > len(storeIDs) {
|
||||
index2 = len(storeIDs) - 1
|
||||
}
|
||||
storeIDsPage = storeIDs[offset*pageSize+1 : index2]
|
||||
fmt.Println("storeIDsPage111111111111", offset, pageSize, index2, storeIDsPage)
|
||||
storeIDsPage = storeIDs[offset*pageSize : index2]
|
||||
task := tasksch.NewParallelTask("GetStoreManageState", tasksch.NewParallelConfig().SetParallelCount(20).SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
v := batchItemList[0].(int)
|
||||
@@ -482,6 +479,7 @@ func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID int, f
|
||||
result.OpenTime = optime * float64(dayCount)
|
||||
//商品数
|
||||
skuCount, highSkuCount := 0, 0
|
||||
dao.GetStoresSkusInfo(db, storeIDs, skuIDs)
|
||||
storeSkus, _ := dao.GetStoresSkusInfo(db, []int{v}, nil)
|
||||
for _, v := range storeSkus {
|
||||
if v.Status == model.StoreSkuBindStatusNormal && v.Stock > 0 {
|
||||
@@ -567,6 +565,6 @@ func CalculateCoverArea(coordinate []string, vendorID int) (area float64) {
|
||||
sum += xyList[len(xyList)-1][0]*xyList[0][1] - xyList[0][0]*xyList[len(xyList)-1][1]
|
||||
sum /= float64(2)
|
||||
sum = math.Abs(sum)
|
||||
area, _ = decimal.NewFromFloat(sum).Round(3).Float64()
|
||||
return area
|
||||
sum = utils.Str2Float64(fmt.Sprintf("%.2f", sum))
|
||||
return sum
|
||||
}
|
||||
|
||||
@@ -769,7 +769,7 @@ func GetDataResFieldName(vendorID int) (fieldName string) {
|
||||
// return fieldName
|
||||
// }
|
||||
|
||||
func GetStoresSkusInfo(db *DaoDB, storeIDs, skuIDs []int) (storeSkuList []*model.StoreSkuBind, err error) {
|
||||
func GetStoresSkusInfo(db *DaoDB, storeIDs, skuIDs []int, status int) (storeSkuList []*model.StoreSkuBind, err error) {
|
||||
sql := `
|
||||
SELECT *
|
||||
FROM store_sku_bind t1
|
||||
@@ -1812,3 +1812,32 @@ func GetStoreSkuListWithVendor(db *DaoDB, storeID, vendorID int, vendorOrgCode s
|
||||
err = GetRows(db, &skuList, sql, sqlParams)
|
||||
return skuList, err
|
||||
}
|
||||
|
||||
type GetStoresSkusForManageStateResult struct {
|
||||
SkuID int `orm:"column(sku_id)"`
|
||||
UnitPrice int
|
||||
MidUnitPrice int
|
||||
}
|
||||
|
||||
func GetStoresSkusForManageState(db *DaoDB, storeID, status int) (storeSkuList []*GetStoresSkusForManageStateResult, err error) {
|
||||
sql := `
|
||||
SELECT t1.sku_id, t1.unit_price, t2.mid_unit_price
|
||||
FROM store_sku_bind t1
|
||||
LEFT JOIN price_refer_snapshot t2 ON t1.sku_id = t2.sku_id AND t2.city_code = ? AND t2.snapshot_at = ?
|
||||
WHERE t1.deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
0, utils.Time2Date(time.Now().AddDate(0, 0, -1)),
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
if storeID != 0 {
|
||||
sql += " AND t1.store_id = ?"
|
||||
sqlParams = append(sqlParams, storeID)
|
||||
}
|
||||
if status != model.StoreSkuBindStatusNA {
|
||||
sql += " AND t1.status = ? "
|
||||
sqlParams = append(sqlParams, status)
|
||||
}
|
||||
err = GetRows(db, &storeSkuList, sql, sqlParams...)
|
||||
return storeSkuList, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user