This commit is contained in:
suyl
2021-06-03 17:24:36 +08:00
parent f4aab63317
commit e0bba30696
4 changed files with 73 additions and 2 deletions

View File

@@ -4901,8 +4901,14 @@ func AuditStoreMap(ctx *jxcontext.Context, ID int, vendorOrgCode, vendorStoreID
if vendorStoreID == "" { if vendorStoreID == "" {
return fmt.Errorf("请输入绑定的平台门店ID") return fmt.Errorf("请输入绑定的平台门店ID")
} }
storeMap := &model.StoreMap{} storeMap := &model.StoreMap{
AddStoreVendorMap(ctx, db, storeMapAudit.VendorID, vendorOrgCode, storeMapAudit.StoreID, storeMap) VendorStoreID: vendorStoreID,
IsSync: 0,
AutoPickup: 1,
DeliveryCompetition: 1,
PricePercentage: 100,
}
_, err = AddStoreVendorMap(ctx, db, storeMapAudit.VendorID, vendorOrgCode, storeMapAudit.StoreID, storeMap)
} else { } else {
if comment == "" { if comment == "" {
fmt.Errorf("审核不通过请输入原因!") fmt.Errorf("审核不通过请输入原因!")
@@ -4914,3 +4920,7 @@ func AuditStoreMap(ctx *jxcontext.Context, ID int, vendorOrgCode, vendorStoreID
dao.UpdateEntity(db, storeMapAudit, "AuditStatus", "AuditAt", "AuditOperator") dao.UpdateEntity(db, storeMapAudit, "AuditStatus", "AuditAt", "AuditOperator")
return err return err
} }
func GetStoreMapAudit(ctx *jxcontext.Context, storeIDs, vendorIDs, auditStatuss []int, fromTime, toTime string, offset, pageSize int) (page *model.PagedInfo, err error) {
return dao.GetStoreMapAudit(dao.GetDB(), storeIDs, vendorIDs, auditStatuss, utils.Str2Time(fromTime), utils.Str2Time(toTime), offset, pageSize)
}

View File

@@ -1283,3 +1283,48 @@ func GetStoreManageStateSimple(db *DaoDB, storeIDs, brandIDs []int, vendorID int
err = GetRows(db, &pagedInfo, sql, sqlParams...) err = GetRows(db, &pagedInfo, sql, sqlParams...)
return pagedInfo, err return pagedInfo, err
} }
func GetStoreMapAudit(db *DaoDB, storeIDs, vendorIDs, auditStatuss []int, fromTime, toTime time.Time, offset, pageSize int) (page *model.PagedInfo, err error) {
var (
storeMapAudits []*model.StoreMapAudit
)
sql := `
SELECT SQL_CALC_FOUND_ROWS *
FROM store_map_audit
WHERE 1 = 1
`
sqlParams := []interface{}{}
if len(storeIDs) > 0 {
sql += " AND store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
sqlParams = append(sqlParams, storeIDs)
}
if len(vendorIDs) > 0 {
sql += " AND vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")"
sqlParams = append(sqlParams, vendorIDs)
}
if len(auditStatuss) > 0 {
sql += " AND audit_status IN (" + GenQuestionMarks(len(auditStatuss)) + ")"
sqlParams = append(sqlParams, auditStatuss)
}
if fromTime != utils.ZeroTimeValue {
sql += " AND a.created_at > ?"
sqlParams = append(sqlParams, fromTime)
}
if toTime != utils.ZeroTimeValue {
sql += " AND a.created_at < ?"
sqlParams = append(sqlParams, toTime)
}
sql += " LIMIT ? OFFSET ?"
pageSize = jxutils.FormalizePageSize(pageSize)
offset = jxutils.FormalizePageOffset(offset)
sqlParams = append(sqlParams, pageSize, offset)
txDB, _ := Begin(db)
defer Commit(db, txDB)
if err = GetRowsTx(txDB, &storeMapAudits, sql, sqlParams...); err == nil {
page = &model.PagedInfo{
TotalCount: GetLastTotalRowCount2(db, txDB),
Data: storeMapAudits,
}
}
return page, err
}

View File

@@ -1152,6 +1152,13 @@ func (c *StoreController) AuditStoreMap() {
// @router /GetStoreMapAudit [get] // @router /GetStoreMapAudit [get]
func (c *StoreController) GetStoreMapAudit() { func (c *StoreController) GetStoreMapAudit() {
c.callGetStoreMapAudit(func(params *tStoreGetStoreMapAuditParams) (retVal interface{}, errCode string, err error) { c.callGetStoreMapAudit(func(params *tStoreGetStoreMapAuditParams) (retVal interface{}, errCode string, err error) {
var (
storeIDs []int
vendorIDs []int
auditStatuss []int
)
jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.VendorIDs, &vendorIDs, params.AuditStatuss, &auditStatuss)
retVal, err = cms.GetStoreMapAudit(params.Ctx, storeIDs, vendorIDs, auditStatuss, params.FromTime, params.ToTime, params.Offset, params.PageSize)
return retVal, "", err return retVal, "", err
}) })
} }

View File

@@ -2115,6 +2115,15 @@ func init() {
Filters: nil, Filters: nil,
Params: nil}) Params: nil})
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
web.ControllerComments{
Method: "GetStoreMapAudit",
Router: `/GetStoreMapAudit`,
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"], web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
web.ControllerComments{ web.ControllerComments{
Method: "AddStoreCategoryMap", Method: "AddStoreCategoryMap",