This commit is contained in:
邹宗楠
2023-05-22 16:58:14 +08:00
parent 784d60912c
commit c011092a2b
5 changed files with 31 additions and 26 deletions

View File

@@ -336,11 +336,7 @@ func (c *OrderManager) GetOrders(ctx *jxcontext.Context, isIncludeFake bool, fro
}
}
}
//if isJxIncomeArea {
// begin = utils.MustInterface2Int64(params["jxIncomeBegin"])
// end = utils.MustInterface2Int64(params["jxIncomeEnd"])
//pageSize = math.MaxInt32
//}
orders, totalCount, err := dao.GetOrders(db, nil, false, isIncludeFake, fromDateStr, toDateStr, isDateFinish, skuIDs, isJxFirst, "", params, offset, pageSize)
if err == nil {
pagedInfo = &model.PagedInfo{
@@ -382,24 +378,15 @@ func (c *OrderManager) GetOrders(ctx *jxcontext.Context, isIncludeFake bool, fro
}
}
}
//count := &struct {
// Count int
//}{}
//sql2 := `
// SELECT COUNT(*) count
// FROM goods_order WHERE IF(store_id = 0, jx_store_id ,store_id) = ?
// WHERE order_created_at > ? AND order_created_at < ?
//`
//storeID := 0
//if order.StoreID == 0 {
// storeID = order.JxStoreID
//} else {
// storeID = order.StoreID
//}
//sqlParams2 := []interface{}{storeID, time.Now().Format("2006-01-02 00:00:00"), time.Now().Format("2006-01-02 23:59:59")}
//if err = dao.GetRow(db, &count, sql2, sqlParams2); err == nil {
// order.StoreDayOrderCount = count.Count
//}
// 统计订单的违约金
var damages = &struct {
Damages int64 `json:"damages"`
}{}
sqlDamages := ` SELECT SUM(w.desired_fee) damages FROM waybill w WHERE w.vendor_order_id = ? AND w.status = ? `
paramDamages := []interface{}{order.VendorOrderID, model.OrderStatusCanceled}
if err := dao.GetRow(db, damages, sqlDamages, paramDamages); err == nil {
order.LiquidatedDamages = damages.Damages
}
return retVal, err
}, orders)
tasksch.HandleTask(task, nil, true).Run()

View File

@@ -70,7 +70,8 @@ type GoodsOrderExt struct {
OperatorPhone3 string `orm:"size(16)" json:"operatorPhone3"` // 饿百运营人电话
OperatorName3 string `orm:"size(32)" json:"operatorName3"` // 饿百运营人组(角色)
VendorPayType string `json:"vendorPayType"` // 支付方式,当订单来源小程序时通过支付方式区分订单来源(w06微信/tt抖音/ks快手/支付宝)
VendorPayType string `json:"vendorPayType"` // 支付方式,当订单来源小程序时通过支付方式区分订单来源(w06微信/tt抖音/ks快手/支付宝)
LiquidatedDamages int64 `json:"liquidated_damages"` // 违约金
}
type OrderSkuExt struct {

View File

@@ -449,7 +449,7 @@ type DeliveryFee struct {
func GetPlatformDesiredFee(db *DaoDB, storeIDs []int, finishedAtBegin, finishedAtEnd time.Time) (fee []*DeliveryFee, err error) {
sql := `
SELECT sum(b.desired_fee) actual_fee,b.order_vendor_id vendor_id FROM goods_order t2
RIGHT JOIN waybill b ON t2.vendor_order_id = b.vendor_order_id AND b.vendor_order_id <> b.vendor_waybill_id
RIGHT JOIN waybill b ON t2.vendor_order_id = b.vendor_order_id AND b.vendor_order_id <> b.vendor_waybill_id
WHERE t2.order_finished_at >= ? AND t2.order_finished_at <= ?
`
sqlParams := []interface{}{

View File

@@ -3,6 +3,7 @@ package delivery
import (
"crypto/rand"
"fmt"
"git.rosy.net.cn/jx-callback/business/jxutils"
"math/big"
"time"
@@ -279,6 +280,14 @@ func UpdateOrder2Complete() {
}
func makeRiderInfo(fakeWayBill *model.Waybill, riderInfo *mtpsapi.RiderInfo) {
order, _ := partner.CurOrderManager.LoadOrder(fakeWayBill.VendorOrderID, fakeWayBill.OrderVendorID)
storeId := 0
if order.StoreID != 0 {
storeId = order.StoreID
} else {
storeId = order.JxStoreID
}
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), storeId, order.VendorID, order.VendorOrgCode)
switch fakeWayBill.Status {
case 5: // 呼叫骑手
riderInfo.LogisticsContext = "呼叫骑手,新建运单"
@@ -294,6 +303,8 @@ func makeRiderInfo(fakeWayBill *model.Waybill, riderInfo *mtpsapi.RiderInfo) {
riderInfo.LogisticsContext = model.RiderWaitGetGoods
riderInfo.LogisticsStatus = 10
riderInfo.OpCode = tiktok_api.TiktokLogisticsORDERRECEIVED
riderInfo.Latitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lat))
riderInfo.Longitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lng))
// 下一状态以及推送时间
fakeWayBill.Status = model.WaybillStatusCourierArrived
fakeWayBill.VendorStatus = utils.Int64ToStr(model.WaybillStatusCourierArrived)
@@ -301,6 +312,8 @@ func makeRiderInfo(fakeWayBill *model.Waybill, riderInfo *mtpsapi.RiderInfo) {
riderInfo.LogisticsContext = model.RiderToStore
riderInfo.LogisticsStatus = 15
riderInfo.OpCode = tiktok_api.TiktokLogisticsRIDERARRIVED
riderInfo.Latitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lat))
riderInfo.Longitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lng))
// 下一状态以及推送时间
fakeWayBill.Status = model.WaybillStatusDelivering
fakeWayBill.VendorStatus = utils.Int64ToStr(model.WaybillStatusDelivering)
@@ -308,6 +321,8 @@ func makeRiderInfo(fakeWayBill *model.Waybill, riderInfo *mtpsapi.RiderInfo) {
riderInfo.LogisticsContext = model.RiderGetOrderDelivering
riderInfo.LogisticsStatus = 20
riderInfo.OpCode = tiktok_api.TiktokLogisticsRIDERPICKUP
riderInfo.Latitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lat))
riderInfo.Longitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lng))
// 下一状态以及推送时间
fakeWayBill.Status = model.WaybillStatusDelivered
fakeWayBill.VendorStatus = utils.Int64ToStr(model.WaybillStatusDelivered)
@@ -315,6 +330,8 @@ func makeRiderInfo(fakeWayBill *model.Waybill, riderInfo *mtpsapi.RiderInfo) {
riderInfo.LogisticsContext = model.RiderGetOrderDelivered
riderInfo.LogisticsStatus = 40
riderInfo.OpCode = tiktok_api.TiktokLogisticsDELIVERED
riderInfo.Latitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(order.ConsigneeLat))
riderInfo.Longitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(order.ConsigneeLng))
// 下一状态以及推送时间
fakeWayBill.Status = model.WaybillStatusFailed
fakeWayBill.VendorStatus = utils.Int64ToStr(model.WaybillStatusFailed)

View File

@@ -126,7 +126,7 @@ func (c *ReportController) GetManageState() {
// @Param storeIDs query string false "门店ID列表[1,2,3]"
// @Param brandIDs query string false "品牌ID列表[1,2,3]"
// @Param vendorID query int true "平台ID"
// @Param sortType query int false "排序类型,1 覆盖范围2市场规模3营业时长4商品数5虚高商品数6活动丰富度7无效订单数8拒绝订单数9门店评分正升序负倒序"
// @Param sortType query int false "排序类型,1 覆盖范围2市场规模3营业时长4商品数5虚高商品数6活动丰富度7无效订单数8拒绝订单数9门店评分10完成订单数,正升序,负倒序"
// @Param offset query int false "门店列表起始序号以0开始缺省为0"
// @Param pageSize query int false "门店列表页大小缺省为50-1表示全部"
// @Success 200 {object} controllers.CallResult