This commit is contained in:
邹宗楠
2023-09-21 17:00:34 +08:00
parent 8edeb75fd7
commit c20d32e975
2 changed files with 57 additions and 24 deletions

View File

@@ -241,8 +241,11 @@ func (a *API) QueryBillList(req *request591.AlibabaWdkBillListRequest) (*domain5
globals.SugarLogger.Debugf("进入 QueryBillList : %s", utils.Format4Output(req, false))
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 {
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
return nil, fmt.Errorf(*data.ApiResult.ErrMsg)

View File

@@ -2,6 +2,7 @@ package tao_vegetable
import (
"encoding/json"
"errors"
"fmt"
domain3156 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability3156/domain"
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"
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/util"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals"
"strconv"
"strings"
"testing"
"time"
)
@@ -227,34 +228,63 @@ func TestDeliveryTrajectory(t *testing.T) {
func TestQueryBillList(t *testing.T) {
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())
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{
TxdBillListGetRequest: &domain591.AlibabaWdkBillListTxdBillListGetRequest{
EndBillDate: &endTime,
StartBillDate: &createTime,
ShopCode: utils.String2Pointer("JX668429"),
PageSize: utils.Int64ToPointer(200),
PageIndex: utils.Int64ToPointer(1),
EndBillDate: &endBillDate,
StartBillDate: &startBillDate,
ShopCode: utils.String2Pointer(vendorStoreID),
PageSize: utils.Int64ToPointer(int64(pageSize)),
PageIndex: utils.Int64ToPointer(int64(pageIndex)),
},
}
data, err := apiTao.QueryBillList(param)
if err != nil {
fmt.Println("err === ", err)
return
var totalIndex int64 = 0
result, _ := api.QueryBillList(param)
for _, v := range *result.TxdBillDetailBOS {
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) {
emoji := `【右上角关注点亮⭐️】`
a := replaceContentOther(emoji)
fmt.Println(a)
}
func replaceContentOther(content string) string {
return strings.ReplaceAll(strings.ReplaceAll(content, "⃣️", " "), "•", "-")
for i := 2; i <= int(totalIndex); i++ {
param.TxdBillListGetRequest.PageIndex = utils.Int64ToPointer(int64(i))
result2, _ := api.QueryBillList(param)
for _, v := range *result2.TxdBillDetailBOS {
if *v.OrderType == "positive" {
settlement[*v.BizOrderId] = *v.ReceivableAmount
}
}
}
}
return settlement, nil
}