670 lines
32 KiB
Go
670 lines
32 KiB
Go
package controllers
|
||
|
||
import (
|
||
"git.rosy.net.cn/baseapi/utils"
|
||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||
"git.rosy.net.cn/jx-callback/business/jxstore/common"
|
||
"git.rosy.net.cn/jx-callback/business/jxstore/misc"
|
||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||
"git.rosy.net.cn/jx-callback/business/jxutils/netprinter"
|
||
"git.rosy.net.cn/jx-callback/business/model"
|
||
"github.com/astaxie/beego"
|
||
)
|
||
|
||
type StoreController struct {
|
||
beego.Controller
|
||
}
|
||
|
||
// @Title 得到京西门店信息
|
||
// @Description 得到京西门店信息,如下条件之间是与的关系
|
||
// @Param token header string false "认证token"
|
||
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
||
// @Param storeID query int false "门店ID"
|
||
// @Param startStoreID query int false "起始门店ID"
|
||
// @Param coordinateType query int false "返回坐标类型,0:火星坐标,1:百度,缺省0"
|
||
// @Param storeIDs query string false "门店ID列表"
|
||
// @Param name query string false "门店名称(不要求完全一致)"
|
||
// @Param placeID query int false "所属地点ID"
|
||
// @Param placeLevel query int false "所属地点级别"
|
||
// @Param address query string false "门店地址"
|
||
// @Param tel query string false "电话"
|
||
// @Param statuss query string false "门店状态列表[-1,0,1],(-1:禁用;0:休息,关店;1:正常开店),缺省不限制"
|
||
// @Param vendorStoreCond query string false "查询关联门店的条件(如果此字段没有设置,vendorStoreConds无效),and:与,or:或,指的是vendorStoreConds里的条件间的关系,这组条件与其它条件都是与的关系"
|
||
// @Param vendorStoreConds query string false "为厂商条件对象{vendorID: cond},注意vendorID是字符串形式,cond,-1:没有关联,0:不限定,1:有关联,缺省为0,其它值表示vendorOrgCode"
|
||
// @Param courierStoreCond query string false "查询关联门店的条件(如果此字段没有设置,courierStoreConds无效),and:与,or:或,指的是courierStoreConds里的条件间的关系,这组条件与其它条件都是与的关系"
|
||
// @Param courierStoreConds query string false "为厂商条件对象{vendorID: cond},注意vendorID是字符串形式,cond,-1:没有关联,0:不限定,1:有关联,缺省为0"
|
||
// @Param mapLongitude query string false "地图中心经度"
|
||
// @Param mapLatitude query string false "地图中心纬度"
|
||
// @Param mapRadius query int false "地图半径(单位为米)"
|
||
// @Param orderTimeFrom query string false "订单创建起始时间"
|
||
// @Param orderTimeTo query string false "订单创建结束时间"
|
||
// @Param orderCountFrom query int false "订单量起始"
|
||
// @Param orderCountTo query int false "订单量结束"
|
||
// @Param marketManPhone query string false "市场负责人电话"
|
||
// @Param briefLevel query int false "返回信息精简模式"
|
||
// @Param storeLevels query string false "门店等级"
|
||
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetStores [get,post]
|
||
func (c *StoreController) GetStores() {
|
||
c.callGetStores(func(params *tStoreGetStoresParams) (retVal interface{}, errCode string, err error) {
|
||
timeList, err := jxutils.BatchStr2Time(params.OrderTimeFrom, params.OrderTimeTo)
|
||
if err == nil {
|
||
retVal, err = cms.GetStores(params.Ctx, params.Keyword, params.MapData, params.Offset, params.PageSize, timeList[0], timeList[1], params.OrderCountFrom, params.OrderCountTo)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 远程查询厂商门店信息
|
||
// @Description 远程查询厂商门店信息,这个是实时调用API远程查询
|
||
// @Param token header string true "认证token"
|
||
// @Param vendorStoreID query string true "门店ID"
|
||
// @Param vendorID query int true "门店所属的厂商ID"
|
||
// @Param vendorOrgCode query string false "厂商内组织代码"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetVendorStore [get]
|
||
func (c *StoreController) GetVendorStore() {
|
||
c.callGetVendorStore(func(params *tStoreGetVendorStoreParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.GetVendorStore(params.Ctx, params.VendorID, params.VendorOrgCode, params.VendorStoreID)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 修改门店信息
|
||
// @Description 修改门店信息
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID formData int true "京西门店编号,payload中的京西门店编号会被忽略"
|
||
// @Param payload formData string true "json数据,store对象"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /UpdateStore [put]
|
||
func (c *StoreController) UpdateStore() {
|
||
c.callUpdateStore(func(params *tStoreUpdateStoreParams) (retVal interface{}, errCode string, err error) {
|
||
payload := make(map[string]interface{})
|
||
if err = utils.UnmarshalUseNumber([]byte(params.Payload), &payload); err == nil {
|
||
retVal, err = cms.UpdateStore(params.Ctx, params.StoreID, payload, params.Ctx.GetUserName())
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 删除京西门店
|
||
// @Description 删除京西门店
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID query int true "门店ID"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /DeleteStore [delete]
|
||
func (c *StoreController) DeleteStore() {
|
||
c.callDeleteStore(func(params *tStoreDeleteStoreParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.DeleteStore(params.Ctx, params.StoreID)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 启用所有临时休息门店
|
||
// @Description 启用所有临时休息门店
|
||
// @Param token header string true "认证token"
|
||
// @Param isAsync formData bool true "是否异步操作"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /EnableHaveRestStores [put]
|
||
func (c *StoreController) EnableHaveRestStores() {
|
||
c.callEnableHaveRestStores(func(params *tStoreEnableHaveRestStoresParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.EnableHaveRestStores(params.Ctx, params.IsAsync, params.IsContinueWhenError)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 创建京西门店
|
||
// @Description 创建京西门店
|
||
// @Param token header string true "认证token"
|
||
// @Param payload formData string true "json数据,store对象"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /CreateStore [post]
|
||
func (c *StoreController) CreateStore() {
|
||
c.callCreateStore(func(params *tStoreCreateStoreParams) (retVal interface{}, errCode string, err error) {
|
||
store := &cms.StoreExt{}
|
||
if err = utils.UnmarshalUseNumber([]byte(params.Payload), store); err == nil {
|
||
retVal, err = cms.CreateStore(params.Ctx, store, params.Ctx.GetUserName())
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到门店映射信息
|
||
// @Description 得到门店映射信息
|
||
// @Param token header string false "认证token"
|
||
// @Param storeID query int true "门店ID"
|
||
// @Param vendorID query int false "厂商ID(缺省为全部)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetStoreVendorMaps [get]
|
||
func (c *StoreController) GetStoreVendorMaps() {
|
||
c.callGetStoreVendorMaps(func(params *tStoreGetStoreVendorMapsParams) (retVal interface{}, errCode string, err error) {
|
||
if c.GetString("vendorID") == "" {
|
||
params.VendorID = -1
|
||
}
|
||
retVal, err = cms.GetStoreVendorMaps(params.Ctx, nil, params.StoreID, params.VendorID)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 修改门店映射信息
|
||
// @Description 修改门店映射信息
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID query int true "门店ID"
|
||
// @Param vendorID query int true "厂商ID"
|
||
// @Param payload formData string true "json数据,storeMap对象"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /UpdateStoreVendorMap [put]
|
||
func (c *StoreController) UpdateStoreVendorMap() {
|
||
c.callUpdateStoreVendorMap(func(params *tStoreUpdateStoreVendorMapParams) (retVal interface{}, errCode string, err error) {
|
||
payload := make(map[string]interface{})
|
||
if err = utils.UnmarshalUseNumber([]byte(params.Payload), &payload); err == nil {
|
||
retVal, err = cms.UpdateStoreVendorMap(params.Ctx, nil, params.StoreID, params.VendorID, payload, params.Ctx.GetUserName())
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 新增门店映射信息
|
||
// @Description 新增门店映射信息
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID formData int true "门店ID,payload中的相应字段会被忽略"
|
||
// @Param vendorID formData int true "厂商ID,payload中的相应字段会被忽略"
|
||
// @Param vendorOrgCode formData string false "厂商内组织代码"
|
||
// @Param payload formData string true "json数据,storeMap对象({'vendorStoreID':'11732425','autoPickup':1,'deliveryCompetition':1, 'pricePercentage':100})"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /AddStoreVendorMap [post]
|
||
func (c *StoreController) AddStoreVendorMap() {
|
||
c.callAddStoreVendorMap(func(params *tStoreAddStoreVendorMapParams) (retVal interface{}, errCode string, err error) {
|
||
storeMap := &model.StoreMap{}
|
||
if err = utils.UnmarshalUseNumber([]byte(params.Payload), storeMap); err == nil {
|
||
retVal, err = cms.AddStoreVendorMap(params.Ctx, nil, params.VendorID, params.VendorOrgCode, params.StoreID, storeMap)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 删除门店映射信息
|
||
// @Description 删除门店映射信息
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID query int true "门店ID"
|
||
// @Param vendorID query int true "厂商ID"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /DeleteStoreVendorMap [delete]
|
||
func (c *StoreController) DeleteStoreVendorMap() {
|
||
c.callDeleteStoreVendorMap(func(params *tStoreDeleteStoreVendorMapParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.DeleteStoreVendorMap(params.Ctx, nil, params.StoreID, params.VendorID, params.Ctx.GetUserName())
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到门店差评总数
|
||
// @Description 得到门店差评总数,此函数为兼容老系统,之后会被替换
|
||
// @Param token header string true "认证token"
|
||
// @Param jxStoreId query int true "门店ID"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /TmpGetJxBadCommentsNo [get]
|
||
func (c *StoreController) TmpGetJxBadCommentsNo() {
|
||
c.callTmpGetJxBadCommentsNo(func(params *tStoreTmpGetJxBadCommentsNoParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.TmpGetJxBadCommentsNo(params.Ctx, params.JxStoreId)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到门店评价列表
|
||
// @Description 得到门店评价列表
|
||
// @Param token header string true "认证token"
|
||
// @Param jxStoreId query int true "门店ID"
|
||
// @Param type query int true "评论类型,0:差评,1:所有"
|
||
// @Param page query int true "起始页,从1开始"
|
||
// @Param size query int true "页大小(-1表示无限大)"
|
||
// @Param fromTime query string false "创建起始时间"
|
||
// @Param toTime query string false "创建结束时间"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /TmpGetJxBadCommentsByStoreId [get]
|
||
func (c *StoreController) TmpGetJxBadCommentsByStoreId() {
|
||
c.callTmpGetJxBadCommentsByStoreId(func(params *tStoreTmpGetJxBadCommentsByStoreIdParams) (retVal interface{}, errCode string, err error) {
|
||
timeList, err2 := jxutils.BatchStr2Time(params.FromTime, params.ToTime)
|
||
if err = err2; err == nil {
|
||
pageSize := jxutils.FormalizePageSize(params.Size)
|
||
offset := (params.Page - 1) * pageSize
|
||
retVal, err = cms.TmpGetJxBadCommentsByStoreId(params.Ctx, "", []int{params.JxStoreId}, offset, pageSize, params.Type, timeList[0], timeList[1])
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到门店评价列表(多店)
|
||
// @Description 得到门店评价列表(多店)
|
||
// @Param token header string true "认证token"
|
||
// @Param type query int true "评论类型,0:差评,1:所有,2:已解决"
|
||
// @Param keyword query string false "关键字"
|
||
// @Param storeIDs query string false "门店I列表"
|
||
// @Param fromTime query string false "创建起始时间"
|
||
// @Param toTime query string false "创建结束时间"
|
||
// @Param offset query int false "起始页,从1开始"
|
||
// @Param pageSize query int false "页大小(-1表示无限大)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /TmpGetJxBadComments [get]
|
||
func (c *StoreController) TmpGetJxBadComments() {
|
||
c.callTmpGetJxBadComments(func(params *tStoreTmpGetJxBadCommentsParams) (retVal interface{}, errCode string, err error) {
|
||
var storeIDs []int
|
||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err == nil {
|
||
timeList, err2 := jxutils.BatchStr2Time(params.FromTime, params.ToTime)
|
||
if err = err2; err == nil {
|
||
retVal, err = cms.TmpGetJxBadCommentsByStoreId(params.Ctx, params.Keyword, storeIDs, params.Offset, params.PageSize, params.Type, timeList[0], timeList[1])
|
||
}
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到门店快递映射信息
|
||
// @Description 得到门店快递映射信息
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID query int true "门店ID"
|
||
// @Param vendorID query int false "厂商ID(缺省为全部)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetStoreCourierMaps [get]
|
||
func (c *StoreController) GetStoreCourierMaps() {
|
||
c.callGetStoreCourierMaps(func(params *tStoreGetStoreCourierMapsParams) (retVal interface{}, errCode string, err error) {
|
||
if c.GetString("vendorID") == "" {
|
||
params.VendorID = -1
|
||
}
|
||
retVal, err = cms.GetStoreCourierMaps(params.Ctx, nil, params.StoreID, params.VendorID)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 修改门店快递映射信息
|
||
// @Description 修改门店快递映射信息
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID formData int true "门店ID,payload中的相应字段会被忽略"
|
||
// @Param vendorID formData int true "快递厂商ID,payload中的相应字段会被忽略"
|
||
// @Param payload formData string true "json数据,StoreCourierMap对象(当前只有status, vendorStoreId两项)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /UpdateStoreCourierMap [put]
|
||
func (c *StoreController) UpdateStoreCourierMap() {
|
||
c.callUpdateStoreCourierMap(func(params *tStoreUpdateStoreCourierMapParams) (retVal interface{}, errCode string, err error) {
|
||
storeCourierMap := make(map[string]interface{})
|
||
if err = utils.UnmarshalUseNumber([]byte(params.Payload), &storeCourierMap); err == nil {
|
||
retVal, err = cms.UpdateStoreCourierMap(params.Ctx, nil, params.StoreID, params.VendorID, storeCourierMap, params.Ctx.GetUserName())
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 新增门店快递映射信息
|
||
// @Description 新增门店快递映射信息
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID formData int true "门店ID,payload中的相应字段会被忽略"
|
||
// @Param vendorID formData int true "快递厂商ID,payload中的相应字段会被忽略"
|
||
// @Param payload formData string true "json数据,StoreCourierMap对象(当前只有status, vendorStoreId两项)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /AddStoreCourierMap [post]
|
||
func (c *StoreController) AddStoreCourierMap() {
|
||
c.callAddStoreCourierMap(func(params *tStoreAddStoreCourierMapParams) (retVal interface{}, errCode string, err error) {
|
||
storeCourierMap := &model.StoreCourierMap{}
|
||
if err = utils.UnmarshalUseNumber([]byte(params.Payload), storeCourierMap); err == nil {
|
||
retVal, err = cms.AddStoreCourierMap(params.Ctx, nil, params.StoreID, params.VendorID, storeCourierMap)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 删除门店快递映射信息
|
||
// @Description 删除门店快递映射信息
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID query int true "门店ID"
|
||
// @Param vendorID query int true "快递厂商ID"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /DeleteStoreCourierMap [delete]
|
||
func (c *StoreController) DeleteStoreCourierMap() {
|
||
c.callDeleteStoreCourierMap(func(params *tStoreDeleteStoreCourierMapParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.DeleteStoreCourierMap(params.Ctx, nil, params.StoreID, params.VendorID, params.Ctx.GetUserName())
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 自动创建或更新快递门店
|
||
// @Description 自动创建或更新快递门店
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID formData int false "门店ID"
|
||
// @Param isForceUpdate formData bool false "是否强制更新"
|
||
// @Param isAsync formData bool false "是否异步操作"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /UpdateOrCreateCourierStores [put]
|
||
func (c *StoreController) UpdateOrCreateCourierStores() {
|
||
c.callUpdateOrCreateCourierStores(func(params *tStoreUpdateOrCreateCourierStoresParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.UpdateOrCreateCourierStores(params.Ctx, params.StoreID, params.IsForceUpdate, params.IsAsync, params.IsContinueWhenError)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 导出门店健康度信息
|
||
// @Description 导出门店健康度信息
|
||
// @Param token header string true "认证token"
|
||
// @Param vendorIDs query string false "平台ID列表"
|
||
// @Param storeIDs query string false "门店ID列表"
|
||
// @Param isAsync query bool false "是否异步操作"
|
||
// @Param isContinueWhenError query bool false "单个同步失败是否继续,缺省false"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /ExportShopsHealthInfo [get]
|
||
func (c *StoreController) ExportShopsHealthInfo() {
|
||
c.callExportShopsHealthInfo(func(params *tStoreExportShopsHealthInfoParams) (retVal interface{}, errCode string, err error) {
|
||
var vendorIDList, storeIDList []int
|
||
if err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDList, params.StoreIDs, &storeIDList); err == nil {
|
||
retVal, err = cms.ExportShopsHealthInfo(params.Ctx, vendorIDList, storeIDList, params.IsAsync, params.IsContinueWhenError)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到工商执照企业信息
|
||
// @Description 得到工商执照企业信息
|
||
// @Param token header string true "认证token"
|
||
// @Param licenceCode query string true "营业执照号"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetCorporationInfo [get]
|
||
func (c *StoreController) GetCorporationInfo() {
|
||
c.callGetCorporationInfo(func(params *tStoreGetCorporationInfoParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.GetCorporationInfo(params.Ctx, params.LicenceCode)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 门店绑定打印
|
||
// @Description 门店绑定打印
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID formData int true "京西门店ID"
|
||
// @Param data formData string true "原始数据"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /BindPrinter [post]
|
||
func (c *StoreController) BindPrinter() {
|
||
c.callBindPrinter(func(params *tStoreBindPrinterParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = netprinter.BindPrinter(params.Ctx, params.StoreID, params.Data)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 同步门店资质信息至平台(当前只支持京东)
|
||
// @Description 同步门店资质信息至平台(当前只支持京东)
|
||
// @Param token header string true "认证token"
|
||
// @Param storeIDs formData string true "京西门店ID列表,必须非空值"
|
||
// @Param isAsync formData bool true "是否异步操作"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /SyncStoresQualify [post]
|
||
func (c *StoreController) SyncStoresQualify() {
|
||
c.callSyncStoresQualify(func(params *tStoreSyncStoresQualifyParams) (retVal interface{}, errCode string, err error) {
|
||
var storeIDs []int
|
||
err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs)
|
||
if err == nil {
|
||
retVal, err = cms.SyncStoresQualify(params.Ctx, storeIDs, params.IsAsync, params.IsContinueWhenError)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 门店评分
|
||
// @Description 门店评分
|
||
// @Param token header string true "认证token"
|
||
// @Param storeIDs formData string false "京西门店ID列表"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /ScoreStore [post]
|
||
func (c *StoreController) ScoreStore() {
|
||
c.callScoreStore(func(params *tStoreScoreStoreParams) (retVal interface{}, errCode string, err error) {
|
||
var storeIDList []int
|
||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDList); err == nil {
|
||
misc.ScoreStore(params.Ctx, storeIDList)
|
||
}
|
||
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到门店近期周平均分数数据
|
||
// @Description 得到门店近期周平均分数数据
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID query int true "京西门店ID"
|
||
// @Param weekIndex query int true "周索引(起始索引为0, -1为所有周数据)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetWeeklyStoreScore [get]
|
||
func (c *StoreController) GetWeeklyStoreScore() {
|
||
c.callGetWeeklyStoreScore(func(params *tStoreGetWeeklyStoreScoreParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = misc.GetWeeklyStoreScore(params.StoreID, params.WeekIndex)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到门店总分排名
|
||
// @Description 得到门店总分排名
|
||
// @Param token header string true "认证token"
|
||
// @Param storeIDs formData string false "京西门店ID列表"
|
||
// @Param cityCode formData int false "城市编码"
|
||
// @Param keyword formData string false "关键字"
|
||
// @Param beginTime formData string true "开始日期"
|
||
// @Param endTime formData string true "结束日期"
|
||
// @Param isDesc formData bool true "是否降序"
|
||
// @Param checkScoreLow formData int false "在某个分数范围-低"
|
||
// @Param checkScoreHigh formData int false "在某个分数范围-高"
|
||
// @Param offset formData int false "列表起始序号(以0开始,缺省为0)"
|
||
// @Param pageSize formData int false "列表页大小(缺省为50,-1表示全部)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetStoreTotalScoreList [post]
|
||
func (c *StoreController) GetStoreTotalScoreList() {
|
||
c.callGetStoreTotalScoreList(func(params *tStoreGetStoreTotalScoreListParams) (retVal interface{}, errCode string, err error) {
|
||
timeList, err := jxutils.BatchStr2Time(params.BeginTime, params.EndTime)
|
||
if err == nil {
|
||
var storeIDList []int
|
||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDList); err == nil {
|
||
retVal, err = misc.GetStoreTotalScoreList(storeIDList, params.CityCode, params.Keyword, timeList[0], timeList[1], params.IsDesc, params.CheckScoreLow, params.CheckScoreHigh, params.Offset, params.PageSize)
|
||
}
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到门店触犯红线/黄线数据
|
||
// @Description 得到门店触犯红线/黄线数据
|
||
// @Param token header string true "认证token"
|
||
// @Param storeIDs formData string false "京西门店ID列表"
|
||
// @Param cityCode formData int false "城市编码"
|
||
// @Param keyword formData string false "关键字"
|
||
// @Param dateTime formData string true "统计日期"
|
||
// @Param offset formData int false "列表起始序号(以0开始,缺省为0)"
|
||
// @Param pageSize formData int false "列表页大小(缺省为50,-1表示全部)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetStoreAlertList [post]
|
||
func (c *StoreController) GetStoreAlertList() {
|
||
c.callGetStoreAlertList(func(params *tStoreGetStoreAlertListParams) (retVal interface{}, errCode string, err error) {
|
||
timeList, err := jxutils.BatchStr2Time(params.DateTime)
|
||
if err == nil {
|
||
var storeIDList []int
|
||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDList); err == nil {
|
||
retVal, err = misc.GetStoreAlertList(storeIDList, params.CityCode, params.Keyword, timeList[0], params.Offset, params.PageSize)
|
||
}
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 同步快递平台门店信息并报警
|
||
// @Description 同步快递平台门店信息并报警
|
||
// @Param token header string true "认证token"
|
||
// @Param storeIDs formData string false "京西门店ID列表,必须非空值"
|
||
// @Param isAsync formData bool false "是否异步操作"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /SyncStoresCourierInfo [post]
|
||
func (c *StoreController) SyncStoresCourierInfo() {
|
||
c.callSyncStoresCourierInfo(func(params *tStoreSyncStoresCourierInfoParams) (retVal interface{}, errCode string, err error) {
|
||
var storeIDs []int
|
||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err == nil {
|
||
retVal, err = cms.SyncStoresCourierInfo(params.Ctx, storeIDs, params.IsAsync, params.IsContinueWhenError)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 根据位置得到推荐门店列表
|
||
// @Description 根据位置得到推荐门店列表
|
||
// @Param token header string false "认证token"
|
||
// @Param lng query float64 true "经度"
|
||
// @Param lat query float64 true "纬度"
|
||
// @Param needWalkDistance query bool false "是否需要返回步行距离(且以步行距离排序)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetStoreListByLocation [get]
|
||
func (c *StoreController) GetStoreListByLocation() {
|
||
c.callGetStoreListByLocation(func(params *tStoreGetStoreListByLocationParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = common.GetStoreListByLocation(params.Ctx, params.Lng, params.Lat, 20000, params.NeedWalkDistance, false)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 老格恢复拓店进度
|
||
// @Description 老格恢复拓店进度
|
||
// @Param token header string true "认证token"
|
||
// @Param vendorOrgCode formData string false "厂商内组织代码"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /JdStoreInfoCoordinateRecover [post]
|
||
func (c *StoreController) JdStoreInfoCoordinateRecover() {
|
||
c.callJdStoreInfoCoordinateRecover(func(params *tStoreJdStoreInfoCoordinateRecoverParams) (retVal interface{}, errCode string, err error) {
|
||
r := c.Ctx.Request
|
||
files := r.MultipartForm.File["userfiles"]
|
||
err = cms.JdStoreInfoCoordinateRecover(params.Ctx, params.VendorOrgCode, files)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 导出平台门店信息
|
||
// @Description 导出平台门店信息
|
||
// @Param token header string true "认证token"
|
||
// @Param vendorIDs formData string true "平台ID列表"
|
||
// @Param isAsync formData bool false "是否异步操作"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetVendorStoreInfo [post]
|
||
func (c *StoreController) GetVendorStoreInfo() {
|
||
var vendorIDList []int
|
||
c.callGetVendorStoreInfo(func(params *tStoreGetVendorStoreInfoParams) (retVal interface{}, errCode string, err error) {
|
||
if err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDList); err == nil {
|
||
retVal, err = cms.GetVendorStoreInfo(params.Ctx, vendorIDList, params.IsAsync, params.IsContinueWhenError)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 查询门店价格评分
|
||
// @Description 查询门店价格评分
|
||
// @Param token header string true "认证token"
|
||
// @Param storeIDs formData string false "门店列表"
|
||
// @Param vendorIDs formData string false "厂商列表"
|
||
// @Param snapDate formData string true "时间,默认前一天(格式2006-01-02"
|
||
// @Param fromScore formData int false "分数范围开始 默认0"
|
||
// @Param toScore formData int false "分数范围结束 默认100"
|
||
// @Param sort formData int false "分数排序,-1降序,-升序 ,直降排序,-2降序,2升序,秒杀排序,-3降序,3升序"
|
||
// @Param offset formData int false "门店列表起始序号(以0开始,缺省为0)"
|
||
// @Param pageSize formData int false "门店列表页大小(缺省为50,-1表示全部)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetStorePriceScore [post]
|
||
func (c *StoreController) GetStorePriceScore() {
|
||
var storeIDList, vendorIDList []int
|
||
c.callGetStorePriceScore(func(params *tStoreGetStorePriceScoreParams) (retVal interface{}, errCode string, err error) {
|
||
if jxutils.Strings2Objs(params.StoreIDs, &storeIDList, params.VendorIDs, &vendorIDList); err == nil {
|
||
retVal, err = cms.GetStorePriceScore(params.Ctx, storeIDList, vendorIDList, params.FromScore, params.ToScore, params.Sort, params.SnapDate, params.Offset, params.PageSize)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 生成门店价格分数表
|
||
// @Description 生成门店价格分数表
|
||
// @Param token header string true "认证token"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /CreateStorePriceScore [post]
|
||
func (c *StoreController) CreateStorePriceScore() {
|
||
c.callCreateStorePriceScore(func(params *tStoreCreateStorePriceScoreParams) (retVal interface{}, errCode string, err error) {
|
||
err = cms.CreateStorePriceScore(params.Ctx)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 刷新store_map的京东等级
|
||
// @Description 刷新store_map的京东等级
|
||
// @Param token header string true "认证token"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /RefreshJdLevel [post]
|
||
func (c *StoreController) RefreshJdLevel() {
|
||
c.callRefreshJdLevel(func(params *tStoreRefreshJdLevelParams) (retVal interface{}, errCode string, err error) {
|
||
err = cms.RefreshJdLevel(params.Ctx)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 同步指定京东门店
|
||
// @Description 同步京东门店
|
||
// @Param token header string true "认证token"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /SyncJdStore [post]
|
||
func (c *StoreController) SyncJdStore() {
|
||
c.callSyncJdStore(func(params *tStoreSyncJdStoreParams) (retVal interface{}, errCode string, err error) {
|
||
err = cms.UpdateJdStoreNameAll(params.Ctx)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 清空打印机打印队列
|
||
// @Description 清空打印机打印队列
|
||
// @Param token header string true "认证token"
|
||
// @Param storeIDs formData string true "门店列表"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /DeletePrinterSeq [post]
|
||
func (c *StoreController) DeletePrinterSeq() {
|
||
var storeIDList []int
|
||
c.callDeletePrinterSeq(func(params *tStoreDeletePrinterSeqParams) (retVal interface{}, errCode string, err error) {
|
||
if jxutils.Strings2Objs(params.StoreIDs, &storeIDList); err == nil {
|
||
err = cms.DeletePrinterSeq(params.Ctx, storeIDList)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|