1
This commit is contained in:
@@ -241,8 +241,11 @@ func (a *API) QueryBillList(req *request591.AlibabaWdkBillListRequest) (*domain5
|
|||||||
globals.SugarLogger.Debugf("进入 QueryBillList : %s", utils.Format4Output(req, false))
|
globals.SugarLogger.Debugf("进入 QueryBillList : %s", utils.Format4Output(req, false))
|
||||||
client := ability591.NewAbility591(&a.client)
|
client := ability591.NewAbility591(&a.client)
|
||||||
|
|
||||||
data, _ := client.AlibabaWdkBillList(req, a.token)
|
data, err := client.AlibabaWdkBillList(req, a.token)
|
||||||
|
if err != nil {
|
||||||
|
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(err, false))
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if !*data.ApiResult.Success {
|
if !*data.ApiResult.Success {
|
||||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||||
return nil, fmt.Errorf(*data.ApiResult.ErrMsg)
|
return nil, fmt.Errorf(*data.ApiResult.ErrMsg)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package tao_vegetable
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
domain3156 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability3156/domain"
|
domain3156 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability3156/domain"
|
||||||
request3156 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability3156/request"
|
request3156 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability3156/request"
|
||||||
@@ -9,9 +10,9 @@ import (
|
|||||||
request591 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability591/request"
|
request591 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability591/request"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/util"
|
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/util"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -227,34 +228,63 @@ func TestDeliveryTrajectory(t *testing.T) {
|
|||||||
|
|
||||||
func TestQueryBillList(t *testing.T) {
|
func TestQueryBillList(t *testing.T) {
|
||||||
queryData := time.Now()
|
queryData := time.Now()
|
||||||
create := time.Date(queryData.Year(), queryData.Month(), queryData.Day()-20, 0, 0, 0, 0, queryData.Location())
|
create := time.Date(queryData.Year(), queryData.Month(), queryData.Day()-90, 0, 0, 0, 0, queryData.Location())
|
||||||
end := time.Date(queryData.Year(), queryData.Month(), queryData.Day(), 23, 59, 59, 59, queryData.Location())
|
end := time.Date(queryData.Year(), queryData.Month(), queryData.Day(), 23, 59, 59, 59, queryData.Location())
|
||||||
createTime := util.LocalTime(create)
|
|
||||||
endTime := util.LocalTime(end)
|
data, err := GetOrderTotalShopMoney("", "JX100002", create, end)
|
||||||
|
|
||||||
|
globals.SugarLogger.Debugf("data:= %s", utils.Format4Output(data, false))
|
||||||
|
globals.SugarLogger.Debugf("data:= %s", utils.Format4Output(err, false))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderTotalShopMoney 获取门店结算信息
|
||||||
|
func GetOrderTotalShopMoney(appOrgCode string, vendorStoreID string, start, end time.Time) (map[string]string, error) {
|
||||||
|
if start.IsZero() || end.IsZero() {
|
||||||
|
return nil, errors.New("开始时间和结束时间不能为空")
|
||||||
|
}
|
||||||
|
|
||||||
|
settlement := make(map[string]string, 0)
|
||||||
|
|
||||||
|
api := apiTao
|
||||||
|
startBillDate := util.LocalTime(start)
|
||||||
|
endBillDate := util.LocalTime(end)
|
||||||
|
pageSize := 200
|
||||||
|
pageIndex := 1
|
||||||
|
|
||||||
param := &request591.AlibabaWdkBillListRequest{
|
param := &request591.AlibabaWdkBillListRequest{
|
||||||
TxdBillListGetRequest: &domain591.AlibabaWdkBillListTxdBillListGetRequest{
|
TxdBillListGetRequest: &domain591.AlibabaWdkBillListTxdBillListGetRequest{
|
||||||
EndBillDate: &endTime,
|
EndBillDate: &endBillDate,
|
||||||
StartBillDate: &createTime,
|
StartBillDate: &startBillDate,
|
||||||
ShopCode: utils.String2Pointer("JX668429"),
|
ShopCode: utils.String2Pointer(vendorStoreID),
|
||||||
PageSize: utils.Int64ToPointer(200),
|
PageSize: utils.Int64ToPointer(int64(pageSize)),
|
||||||
PageIndex: utils.Int64ToPointer(1),
|
PageIndex: utils.Int64ToPointer(int64(pageIndex)),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := apiTao.QueryBillList(param)
|
var totalIndex int64 = 0
|
||||||
if err != nil {
|
result, _ := api.QueryBillList(param)
|
||||||
fmt.Println("err === ", err)
|
for _, v := range *result.TxdBillDetailBOS {
|
||||||
return
|
if *v.OrderType == "positive" {
|
||||||
|
settlement[*v.BizOrderId] = *v.ReceivableAmount
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
globals.SugarLogger.Debugf("data:= %s", utils.Format4Output(data, false))
|
if *result.Total > int64(pageSize) {
|
||||||
}
|
totalIndex = *result.Total / int64(pageSize)
|
||||||
|
if *result.Total%int64(pageSize) != model.NO {
|
||||||
|
totalIndex += 1
|
||||||
|
}
|
||||||
|
|
||||||
func TestName2(t *testing.T) {
|
for i := 2; i <= int(totalIndex); i++ {
|
||||||
emoji := `【右上角关注点亮⭐️】`
|
param.TxdBillListGetRequest.PageIndex = utils.Int64ToPointer(int64(i))
|
||||||
a := replaceContentOther(emoji)
|
result2, _ := api.QueryBillList(param)
|
||||||
fmt.Println(a)
|
for _, v := range *result2.TxdBillDetailBOS {
|
||||||
}
|
if *v.OrderType == "positive" {
|
||||||
func replaceContentOther(content string) string {
|
settlement[*v.BizOrderId] = *v.ReceivableAmount
|
||||||
return strings.ReplaceAll(strings.ReplaceAll(content, "⃣️", " "), "•", "-")
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return settlement, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user