Accept Merge Request #170: (su -> mark)

Merge Request: 报警汇总,同步错误返回修改
Created By: @苏尹岚
Accepted By: @苏尹岚
URL: https://rosydev.coding.net/p/jx-callback/d/jx-callback/git/merge/170
This commit is contained in:
苏尹岚
2020-02-03 09:36:32 +08:00
28 changed files with 392 additions and 121 deletions

View File

@@ -1162,3 +1162,28 @@ func GetOrdersSupplementNoPage(db *DaoDB, ID int, storIDs, vendorIDs, statuss []
err = GetRows(db, &orderSupplementFee, sql, sqlParams...)
return orderSupplementFee, err
}
func GetJxOrderCount(db *DaoDB, storeID int, orderID string, date time.Time) (count int, err error) {
if utils.IsTimeZero(date) {
date = time.Now()
}
sql := `
SELECT COUNT(*) ct
FROM goods_order t1
WHERE t1.vendor_id = ? AND t1.jx_store_id = ? AND (t1.status >= ? OR t1.order_seq > 0) AND t1.order_created_at >= ? AND t1.order_created_at < ?
`
sqlParams := []interface{}{
model.VendorIDJX,
storeID,
model.OrderStatusNew,
utils.Time2Date(date),
utils.Time2Date(date).Add(24 * time.Hour),
}
if orderID != "" {
sql += " AND t1.vendor_order_id = ?"
sqlParams = append(sqlParams, orderID)
}
err = GetRow(db, &count, sql, sqlParams...)
return count, err
}

View File

@@ -47,3 +47,11 @@ func TestGetPendingFakeOrders(t *testing.T) {
}
t.Log(len(orderList))
}
func TestGetJxOrderSeq(t *testing.T) {
count, err := GetJxOrderCount(GetDB(), 100118, "23423", time.Now())
if err != nil {
t.Fatal(err)
}
t.Log(count)
}

View File

@@ -95,6 +95,9 @@ func GetOperateEvents(db *DaoDB, name string, apiFunctions []string, operateType
for _, v := range operateEventExt {
accessUUidList = append(accessUUidList, v.AccessUUID)
}
if len(accessUUidList) == 0 {
return operateEventExt, totalCount, err
}
sql2 := `
SELECT *
FROM operate_event_detail

View File

@@ -211,7 +211,7 @@ func GetStoreCourierList(db *DaoDB, storeIDs []int, status, auditStatus int) (co
return nil, err
}
func GetStoresMapList2(db *DaoDB, vendorIDs, storeIDs []int, status, isSync int, pricePack string, mustDirty bool) (storeMapList []*model.StoreMap, err error) {
func GetStoresMapList2(db *DaoDB, vendorIDs, storeIDs, storeStatuss []int, status, isSync int, pricePack string, mustDirty bool) (storeMapList []*model.StoreMap, err error) {
sql := `
SELECT t1.*
FROM store_map t1
@@ -230,6 +230,10 @@ func GetStoresMapList2(db *DaoDB, vendorIDs, storeIDs []int, status, isSync int,
sql += " AND t1.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
sqlParams = append(sqlParams, storeIDs)
}
if len(storeStatuss) > 0 {
sql += " AND t2.status IN (" + GenQuestionMarks(len(storeStatuss)) + ")"
sqlParams = append(sqlParams, storeStatuss)
}
if status != model.StoreStatusAll {
sql += " AND t1.status = ?"
sqlParams = append(sqlParams, status)
@@ -252,8 +256,8 @@ func GetStoresMapList2(db *DaoDB, vendorIDs, storeIDs []int, status, isSync int,
return nil, err
}
func GetStoresMapList(db *DaoDB, vendorIDs, storeIDs []int, status, isSync int, pricePack string) (storeMapList []*model.StoreMap, err error) {
return GetStoresMapList2(db, vendorIDs, storeIDs, status, isSync, pricePack, false)
func GetStoresMapList(db *DaoDB, vendorIDs, storeIDs, storeStatuss []int, status, isSync int, pricePack string) (storeMapList []*model.StoreMap, err error) {
return GetStoresMapList2(db, vendorIDs, storeIDs, storeStatuss, status, isSync, pricePack, false)
}
func StoreMapList2Map(storeMapList []*model.StoreMap) (storeMapMap map[int][]*model.StoreMap) {

View File

@@ -1253,7 +1253,7 @@ func UpdateActPrice4StoreSkuNameNew(db *DaoDB, storeIDs, skuIDs []int, skuNamesI
vendorIDs = []int{actVendorID}
}
} else {
storeMapList, err := GetStoresMapList(db, nil, storeIDs, model.StoreStatusAll, model.StoreIsSyncAll, "")
storeMapList, err := GetStoresMapList(db, nil, storeIDs, nil, model.StoreStatusAll, model.StoreIsSyncAll, "")
if err != nil {
return err
}

View File

@@ -40,7 +40,7 @@ func TestGetStoreList4Role(t *testing.T) {
}
func TestGetStoresMapList(t *testing.T) {
storeList, err := GetStoresMapList(GetDB(), nil, nil, model.StoreStatusClosed, model.StoreIsSyncYes, "")
storeList, err := GetStoresMapList(GetDB(), nil, nil, nil, model.StoreStatusClosed, model.StoreIsSyncYes, "")
t.Log(utils.Format4Output(storeList, false))
if err != nil {
t.Fatal(err)