- 启用门店创建与修改

This commit is contained in:
gazebo
2019-07-25 14:41:09 +08:00
parent a59908988c
commit a542c59484

View File

@@ -43,6 +43,7 @@ type StoreExt struct {
DistrictName string `json:"districtName"`
StoreMapStr string `json:"-"`
CourierMapStr string `json:"-"`
PayeeBankName string `json:"payeeBankName"` // 开户行名称
StoreMaps []map[string]interface{} `orm:"-"`
CourierMaps []map[string]interface{} `orm:"-"`
@@ -159,7 +160,8 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
t1.payee_name,
t1.payee_account_no,
t1.payee_bank_branch_name,
t1.payee_bank_name,
t1.payee_bank_code,
bank.value payee_bank_name,
t1.pay_percentage,
t1.operator_name,
@@ -179,6 +181,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
CONCAT('[', GROUP_CONCAT(DISTINCT CONCAT('{"vendorStoreID":"', m2.vendor_store_id, '", "vendorID":', m2.vendor_id,
', "status":', m2.status, '}')), ']') courier_map_str
FROM store t1
LEFT JOIN new_config bank ON bank.type = ? AND bank.key = t1.payee_bank_code
LEFT JOIN place city ON t1.city_code = city.code AND city.level = 2
LEFT JOIN place district ON t1.district_code = district.code AND district.level = 3
LEFT JOIN store_map m1 ON t1.id = m1.store_id AND m1.deleted_at = ?
@@ -187,6 +190,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
LEFT JOIN store_courier_map m2 ON t1.id = m2.store_id AND m2.deleted_at = ?
`
sqlParams := []interface{}{
model.ConfigTypeBank,
utils.DefaultTimeValue,
utils.DefaultTimeValue,
}
@@ -314,7 +318,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
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
ORDER BY t1.id DESC
/*LIMIT ? OFFSET ?*/`
pageSize = jxutils.FormalizePageSize(pageSize)
@@ -501,7 +505,11 @@ func isUpdateStoreNeedSync(valid map[string]interface{}) bool {
func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interface{}, userName string) (num int64, err error) {
globals.SugarLogger.Debugf("UpdateStore storeID:%d, payload:%s", storeID, utils.Format4Output(payload, false))
if payeeBankBranchName := utils.Interface2String(payload["payeeBankBranchName"]); payeeBankBranchName != "" {
if strings.Index(payeeBankBranchName, "支行") == -1 || strings.Index(payeeBankBranchName, "分行") == -1 {
return 0, fmt.Errorf("你可能没有在使用最新的版本,请强制刷新浏览器或联系开发")
}
}
db := dao.GetDB()
store := &model.Store{}
store.ID = storeID
@@ -592,8 +600,6 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
// valid["districtCode"] = api.AutonaviAPI.GetCoordinateDistrictCode(lng, lat)
// }
globals.SugarLogger.Debugf("UpdateStore track:%s, valid:%s", ctx.GetTrackInfo(), utils.Format4Output(valid, true))
delete(valid, "payeeBankBranchName")
delete(valid, "payeeBankCode")
if len(valid) > 0 {
dao.Begin(db)
defer func() {
@@ -669,7 +675,11 @@ func EnableHaveRestStores(ctx *jxcontext.Context, isAsync, isContinueWhenError b
}
func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (id int, err error) {
return 0, fmt.Errorf("暂时禁用门店创建,请稍后")
if payeeBankBranchName := storeExt.PayeeBankBranchName; payeeBankBranchName != "" {
if strings.Index(payeeBankBranchName, "支行") == -1 || strings.Index(payeeBankBranchName, "分行") == -1 {
return 0, fmt.Errorf("你可能没有在使用最新的版本,请强制刷新浏览器或联系开发")
}
}
globals.SugarLogger.Debugf("CreateStore storeExt:%s", utils.Format4Output(storeExt, false))
store := &storeExt.Store
if store.ID != 0 && !jxutils.IsLegalStoreID(store.ID) {