This commit is contained in:
邹宗楠
2025-09-04 14:34:37 +08:00
parent ef28818502
commit 9e5e22df41
5 changed files with 63 additions and 37 deletions

View File

@@ -1213,12 +1213,7 @@ func (c *OrderManager) GetStoresOrderSaleInfoNew(ctx *jxcontext.Context, storeID
}
for _, vf := range fineList {
if v.StoreID == vf.StoreID && v.VendorID == vf.VendorID {
switch vf.BillType {
case 21:
v.PromotionFee += vf.SettleAmount
default:
v.FineFee += vf.SettleAmount
}
v.FineFee += vf.SettleAmount
}
}
}

View File

@@ -36,8 +36,6 @@ type StoresOrderSaleInfo struct {
PlatformSettlement int64 `json:"platformSettlement"` // 真实订单的平台结算(无扣点)
ActualFee int64 `json:"actualFee"` // 真三方运单配送费
ServerFee int64 `json:"serverFee"` // 附加服务费
FineFee int64 `json:"fineFee"` // 罚款金额
PromotionFee int64 `json:"promotionFee"` // 推广金额
}
type OrderSkuWithActualPayPrice struct {

View File

@@ -605,7 +605,7 @@ func LoadingStoreOrderSettleAmount(startTime, endTime int64, jxStoreId []int) er
Offset: 0,
Limit: 200,
}
storeOrder, fineList, settleId, err := mtwm.GetAPI(storeListValue.VendorOrgCode, storeListValue.StoreID, storeListValue.VendorStoreID).GetStoreBillList(billListParam)
_, fineList, settleId, err := mtwm.GetAPI(storeListValue.VendorOrgCode, storeListValue.StoreID, storeListValue.VendorStoreID).GetStoreBillList(billListParam)
if err != nil {
globals.SugarLogger.Debugf("GetStoreBillList err : %v", err)
return nil, err
@@ -626,33 +626,33 @@ func LoadingStoreOrderSettleAmount(startTime, endTime int64, jxStoreId []int) er
}
}
for _, so := range storeOrder {
goodsOrder, _ := partner.CurOrderManager.LoadOrder(so.OrderId, model.VendorIDMTWM)
// 更新订单的结算信息
if so.PlatformSettlement > 0 && goodsOrder != nil {
dao.UpdateEntity(db, goodsOrder, "TotalShopMoney")
//goodsOrderSql := `UPDATE goods_order g SET g.total_shop_money = ? WHERE g.vendor_order_id = ? `
//if _, err := dao.ExecuteSQL(db, goodsOrderSql, []interface{}{so.PlatformSettlement, so.OrderId}...); err != nil {
// globals.SugarLogger.Debugf("更新订单结算信息错误: %v", err)
//}
}
// 更新订单的配送信息
//if goodsOrder.JxStoreID == 804947 {
// if so.TimingFee != 0 || so.DeliveryFee != 0 {
// if so.TimingFee < 0 {
// so.TimingFee = so.TimingFee * -1
// }
// if so.DeliveryFee < 0 {
// so.DeliveryFee = so.DeliveryFee * -1
// }
// wayBillSql := `UPDATE waybill w SET w.desired_fee = ?,w.punctual_fee = ? WHERE w.vendor_order_id = ? AND w.vendor_waybill_id = ? `
// if _, err := dao.ExecuteSQL(db, wayBillSql, []interface{}{so.DeliveryFee, so.TimingFee, so.OrderId, so.OrderId}...); err != nil {
// globals.SugarLogger.Debugf("更新订单物流结算信息错误: %v", err)
// }
// }
//}
}
//for _, so := range storeOrder {
// goodsOrder, _ := partner.CurOrderManager.LoadOrder(so.OrderId, model.VendorIDMTWM)
//
// // 更新订单的结算信息
// if so.PlatformSettlement > 0 && goodsOrder != nil {
// dao.UpdateEntity(db, goodsOrder, "TotalShopMoney")
// //goodsOrderSql := `UPDATE goods_order g SET g.total_shop_money = ? WHERE g.vendor_order_id = ? `
// //if _, err := dao.ExecuteSQL(db, goodsOrderSql, []interface{}{so.PlatformSettlement, so.OrderId}...); err != nil {
// // globals.SugarLogger.Debugf("更新订单结算信息错误: %v", err)
// //}
// }
// // 更新订单的配送信息
// //if goodsOrder.JxStoreID == 804947 {
// // if so.TimingFee != 0 || so.DeliveryFee != 0 {
// // if so.TimingFee < 0 {
// // so.TimingFee = so.TimingFee * -1
// // }
// // if so.DeliveryFee < 0 {
// // so.DeliveryFee = so.DeliveryFee * -1
// // }
// // wayBillSql := `UPDATE waybill w SET w.desired_fee = ?,w.punctual_fee = ? WHERE w.vendor_order_id = ? AND w.vendor_waybill_id = ? `
// // if _, err := dao.ExecuteSQL(db, wayBillSql, []interface{}{so.DeliveryFee, so.TimingFee, so.OrderId, so.OrderId}...); err != nil {
// // globals.SugarLogger.Debugf("更新订单物流结算信息错误: %v", err)
// // }
// // }
// //}
//}
if fineList != nil && len(fineList) > 0 {
fine := make([]*model.StoreFine, 0, len(fineList))
@@ -668,7 +668,9 @@ func LoadingStoreOrderSettleAmount(startTime, endTime int64, jxStoreId []int) er
BillId: f.Id,
FinishTime: utils.Str2Time(f.FinishTime),
})
weixinmsg.SendStoreMessage(jxcontext.AdminCtx, "美团账户罚没通知", fmt.Sprintf("您的美团门店有笔违约处罚,发生时间:%s,罚没金额:%d,罚没原因:%s", f.FinishTime, f.SettleAmount, f.ChargeFeeDesc), []int{storeListValue.StoreID}, nil, "", 1, false, false)
if f.BillChargeType != 21 {
weixinmsg.SendStoreMessage(jxcontext.AdminCtx, "美团账户罚没通知", fmt.Sprintf("您的美团门店有笔违约处罚,发生时间:%s,罚没金额:%d 元,罚没原因:%s", f.FinishTime, f.SettleAmount/100, f.ChargeFeeDesc), []int{storeListValue.StoreID}, nil, "", 1, false, false)
}
}
err = dao.CreateMultiEntities(db, fine)
}

View File

@@ -6,6 +6,7 @@ import (
"errors"
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
"git.rosy.net.cn/jx-callback/business/authz/autils"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/business/partner"
"git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm"
"strings"
@@ -114,6 +115,28 @@ func (c *StoreController) UpdateStore() {
})
}
// @Title 获取门店违约金详情
// @Description 获取门店违约金详情
// @Param token header string true "认证token"
// @Param storeIDs query string false "京西门店ID列表[1,2,3],缺省不限制"
// @Param fromTime query string true "起始时间"
// @Param toTime query string true "结束时间"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetStoreFineDesc [get]
func (c *StoreController) GetStoreFineDesc() {
c.callGetStoreFineDesc(func(params *tStoreGetStoreFineDescParams) (retVal interface{}, errCode string, err error) {
timeList, err := jxutils.BatchStr2Time(params.FromTime, params.ToTime)
if err == nil {
var storeIDList []int
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDList); err == nil {
retVal, err = dao.StatisticsFineFee(dao.GetDB(), timeList[0], timeList[1], storeIDList)
}
}
return retVal, "", err
})
}
// @Title 删除京西门店
// @Description 删除京西门店
// @Param token header string true "认证token"

View File

@@ -3138,6 +3138,14 @@ func init() {
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.ControllerComments{
Method: "GetStoreFineDesc",
Router: `/GetStoreFineDesc`,
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.ControllerComments{