- GetStores添加provinceCode
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||
"git.rosy.net.cn/jx-callback/business/authz"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
@@ -40,8 +39,10 @@ const (
|
||||
|
||||
type StoreExt struct {
|
||||
model.Store
|
||||
FloatLng float64 `json:"lng"`
|
||||
FloatLat float64 `json:"lat"`
|
||||
FloatLng float64 `json:"lng"`
|
||||
FloatLat float64 `json:"lat"`
|
||||
|
||||
ProvinceCode int `json:"provinceCode"`
|
||||
ProvinceName string `json:"provinceName"`
|
||||
CityName string `json:"cityName"`
|
||||
DistrictName string `json:"districtName"`
|
||||
@@ -177,6 +178,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
t1.operator_role2,
|
||||
t1.printer_font_size,
|
||||
|
||||
province.code province_code,
|
||||
province.name province_name,
|
||||
city.name city_name,
|
||||
district.name district_name,
|
||||
@@ -336,7 +338,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
}
|
||||
|
||||
sql += sqlWhere + `
|
||||
GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63
|
||||
GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64
|
||||
ORDER BY t1.id DESC
|
||||
/*LIMIT ? OFFSET ?*/`
|
||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||
@@ -404,29 +406,29 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
retVal.Stores = retVal.Stores[offset : offset+pageSize]
|
||||
}
|
||||
if needConver2Baidu {
|
||||
task := tasksch.NewParallelTask("坐标转换", tasksch.NewParallelConfig().SetParallelCount(4).SetBatchSize(autonavi.MaxConvertCount), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
var coords []*autonavi.Coordinate
|
||||
for _, v := range batchItemList {
|
||||
store := v.(*StoreExt)
|
||||
coords = append(coords, &autonavi.Coordinate{
|
||||
Lng: store.FloatLng,
|
||||
Lat: store.FloatLat,
|
||||
})
|
||||
}
|
||||
coords, err = api.AutonaviAPI.BatchCoordinateConvert(coords, autonavi.CoordSysBaidu)
|
||||
if err == nil {
|
||||
for k, v := range batchItemList {
|
||||
store := v.(*StoreExt)
|
||||
coord := coords[k]
|
||||
store.FloatLng = coord.Lng
|
||||
store.FloatLat = coord.Lat
|
||||
}
|
||||
}
|
||||
return retVal, err
|
||||
}, retVal.Stores)
|
||||
task.Run()
|
||||
task.GetResult(0)
|
||||
// task := tasksch.NewParallelTask("坐标转换", tasksch.NewParallelConfig().SetParallelCount(4).SetBatchSize(autonavi.MaxConvertCount), ctx,
|
||||
// func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
// var coords []*autonavi.Coordinate
|
||||
// for _, v := range batchItemList {
|
||||
// store := v.(*StoreExt)
|
||||
// coords = append(coords, &autonavi.Coordinate{
|
||||
// Lng: store.FloatLng,
|
||||
// Lat: store.FloatLat,
|
||||
// })
|
||||
// }
|
||||
// coords, err = api.AutonaviAPI.BatchCoordinateConvert(coords, autonavi.CoordSysBaidu)
|
||||
// if err == nil {
|
||||
// for k, v := range batchItemList {
|
||||
// store := v.(*StoreExt)
|
||||
// coord := coords[k]
|
||||
// store.FloatLng = coord.Lng
|
||||
// store.FloatLat = coord.Lat
|
||||
// }
|
||||
// }
|
||||
// return retVal, err
|
||||
// }, retVal.Stores)
|
||||
// task.Run()
|
||||
// task.GetResult(0)
|
||||
}
|
||||
// if mapLimit {
|
||||
// retVal.TotalCount = len(retVal.Stores)
|
||||
|
||||
Reference in New Issue
Block a user