This commit is contained in:
suyl
2021-06-02 18:28:38 +08:00
parent c219481ad5
commit 34e3dc9910
8 changed files with 95 additions and 39 deletions

View File

@@ -226,7 +226,6 @@ func (c *BaseScheduler) AgreeOrRefuseRefund(ctx *jxcontext.Context, afsOrderID s
for _, sku := range order.Skus {
skuMap[sku.SkuID] = sku
}
storeDetail, _ := dao.GetStoreDetail(db, jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, "")
waybills, _ := dao.GetWaybills(db, order.VendorOrderID)
//京东商城和京西要重新算totalshopmoney等
if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX {
@@ -238,9 +237,9 @@ func (c *BaseScheduler) AgreeOrRefuseRefund(ctx *jxcontext.Context, afsOrderID s
}
order.TotalShopMoney = utils.Float64TwoInt64(float64(float64(order.TotalShopMoney)/jdshopapi.JdsPayPercentage-float64(diff)) * jdshopapi.JdsPayPercentage)
if len(waybills) > 0 {
jxutils.RefreshOrderEarningPrice3(order, storeDetail.PayPercentage, waybills[0])
jxutils.RefreshOrderEarningPrice3(order, order.OrderPayPercentage, waybills[0])
} else {
jxutils.RefreshOrderEarningPrice2(order, storeDetail.PayPercentage)
jxutils.RefreshOrderEarningPrice2(order, order.OrderPayPercentage)
}
dao.UpdateEntity(db, order, "TotalShopMoney", "NewEarningPrice")
}

View File

@@ -1323,12 +1323,9 @@ func (s *DefScheduler) updateOrderByBill(order *model.GoodsOrder, bill *model.Wa
} else {
order.WaybillVendorID = bill.WaybillVendorID
order.VendorWaybillID = bill.VendorWaybillID
if bill.Status == model.WaybillStatusDelivered {
storeDetail, _ := partner.CurOrderManager.LoadStoreDetail(jxutils.GetSaleStoreIDFromOrder(order), order.VendorID)
if storeDetail != nil {
jxutils.RefreshOrderEarningPrice3(order, storeDetail.PayPercentage, bill)
updateFields = append(updateFields, "NewEarningPrice")
}
if bill.DesiredFee != 0 {
jxutils.RefreshOrderEarningPrice3(order, order.OrderPayPercentage, bill)
updateFields = append(updateFields, "NewEarningPrice")
}
}
if revertStatus {

View File

@@ -2,6 +2,7 @@ package cms
import (
"bytes"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
@@ -4816,3 +4817,29 @@ func GetPageBrands(ctx *jxcontext.Context) (brands []*model.PageBrand, err error
dao.GetRows(db, &brands, sql)
return brands, err
}
func AddStoreMapAudit(ctx *jxcontext.Context, storeID, vendorID int, vendorOrgCode, vendorStoreID, vendorStoreName, vendorAccount, vendorPasswaord string) (err error) {
var (
db = dao.GetDB()
storeMapAudit = &model.StoreMapAudit{
StoreID: storeID,
VendorID: vendorID,
VendorOrgCode: vendorOrgCode,
VendorStoreID: vendorStoreID,
VendorStoreName: vendorStoreName,
VendorAccount: vendorAccount,
}
)
if vendorPasswaord != "" {
if configList, err := dao.QueryConfigs(db, "jxKeyIV", model.ConfigTypeSys, ""); err == nil && len(configList) > 0 {
aesKey, iv := configList[0].Value, configList[0].Value
if data, err2 := utils.AESCBCEncpryt([]byte(vendorPasswaord), []byte(aesKey), []byte(iv)); err2 == nil {
vendorPasswaord = base64.StdEncoding.EncodeToString(data)
}
}
storeMapAudit.VendorPasswaord = vendorPasswaord
}
dao.WrapAddIDCULDEntity(storeMapAudit, ctx.GetUserName())
dao.CreateEntity(db, storeMapAudit)
return err
}

View File

@@ -25,9 +25,9 @@ const (
StoreAuditStatusUpdated = 2
StoreAuditStatusAll = -9
StoreMapAuditStatusWait = 1 //待审核
StoreMapAuditStatusPass = 2 //审核通过
StoreMapAuditStatusUnPass = 3 //审核不通过
StoreMapAuditStatusWait = 0 //待审核
StoreMapAuditStatusPass = 1 //审核通过
StoreMapAuditStatusUnPass = -1 //审核不通过
)
const (
@@ -894,3 +894,27 @@ func (v *StoreManageState) TableUnique() [][]string {
[]string{"StoreID", "VendorID"},
}
}
type StoreMapAudit struct {
ModelIDCULD
StoreID int `orm:"column(store_id)" json:"storeID"`
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorOrgCode string `orm:"size(32)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
VendorStoreName string `orm:"size(255)" json:"vendorStoreName"` //平台门店名,由京西到平台
VendorAccount string `orm:"size(255)" json:"vendorAccount"` //商户在平台上的账号(授权用
VendorPasswaord string `orm:"size(255)" json:"vendorPasswaord"` //商户在平台上的密码( aes cbc base64后的
AuditStatus int `json:"auditStatus"` //审核状态(授权状态
AuditAt time.Time `json:"auditAt"` //审核时间
AuditOperator string `json:"auditOperator"` //审核人
Comment string `orm:"size(255)" json:"comment"` //备注(审核不通过原因
}
func (v *StoreMapAudit) TableIndex() [][]string {
return [][]string{
[]string{"StoreID", "VendorStoreID"},
}
}

View File

@@ -78,7 +78,6 @@ func (c *PurchaseHandler) updateOrderFinancialInfo(a *jdapi.API, orderID string)
if err == nil {
if orderSettlement != nil {
updateOrderBySettleMent(order, orderSettlement)
globals.SugarLogger.Debugf("updateOrderBySettleMent: %v , %v", order.NewEarningPrice, order.TotalShopMoney)
err = partner.CurOrderManager.UpdateOrderFields(order, []string{ /*"WaybillTipMoney", */ "TotalShopMoney", "PmSubsidyMoney", "NewEarningPrice"})
}
}
@@ -178,18 +177,11 @@ func updateOrderBySettleMent(order *model.GoodsOrder, orderSettlement *jdapi.Ord
order.TotalShopMoney = orderSettlement.SettlementAmount
order.PmSubsidyMoney = orderSettlement.PlatOrderGoodsDiscountMoney + orderSettlement.PlatSkuGoodsDiscountMoney
if order.TotalShopMoney > 0 {
if jxutils.GetSaleStoreIDFromOrder(order) != 0 {
storeDetail, err := partner.CurOrderManager.LoadStoreDetail(jxutils.GetSaleStoreIDFromOrder(order), order.VendorID)
if storeDetail != nil && err == nil {
jxutils.RefreshOrderEarningPrice2(order, storeDetail.PayPercentage)
}
} else {
order2, err := partner.CurOrderManager.LoadOrder(order.VendorOrderID, order.VendorID)
if order2 != nil && err == nil {
storeDetail, err := partner.CurOrderManager.LoadStoreDetail(jxutils.GetSaleStoreIDFromOrder(order2), order.VendorID)
if storeDetail != nil && err == nil {
jxutils.RefreshOrderEarningPrice2(order, storeDetail.PayPercentage)
}
if order2, _ := partner.CurOrderManager.LoadOrder(order.VendorOrderID, order.VendorID); order2 != nil {
if order2.EarningType == model.EarningTypePoints {
order.NewEarningPrice = order.TotalShopMoney * int64((100 - order2.OrderPayPercentage/2)) / 100
} else {
order.NewEarningPrice = order2.EarningPrice
}
}
} else {
@@ -587,7 +579,7 @@ func (c *PurchaseHandler) ListOrders(ctx *jxcontext.Context, vendorOrgCode strin
if vendorStoreID != "" {
queryParam.DeliveryStationNo = vendorStoreID
}
globals.SugarLogger.Debugf("jd ListOrders queryParam", utils.Format4Output(queryParam,true))
globals.SugarLogger.Debugf("jd ListOrders queryParam", utils.Format4Output(queryParam, true))
orderList, _, err := getAPI(vendorOrgCode).OrderQuery2(queryParam)
if err == nil {
vendorOrderIDs = make([]string, len(orderList))