作者 yangfu

Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creat…

…ion-cooperation into dev
... ... @@ -147,12 +147,14 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred
// 预算明细
var creditAccounts []*domain.CreditAccount
var accountDetail []*domain.AccountDetail
var settlementAmount float64
for _, dividendsEstimate := range dividendsEstimates {
accountDetail = append(accountDetail, &domain.AccountDetail{
DividendsEstimateOrderNumber: dividendsEstimate.DividendsEstimateOrderNumber,
DividendsType: dividendsEstimate.DividendsType,
DividendsAmount: dividendsEstimate.DividendsAmount,
})
settlementAmount = settlementAmount + dividendsEstimate.DividendsAmount
}
// 生成账期结算单号
... ... @@ -167,7 +169,7 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred
CreditAccountOrderNum: creditAccountNumber,
PaymentStatus: 1,
PaymentTime: time.Time{},
SettlementAmount: dividendsEstimates[0].DividendsAmount,
SettlementAmount: settlementAmount,
SettlementTime: time.Now(),
Participator: &domain.Participator{ // 共创参与
UserId: dividendsEstimates[0].DividendsUser.UserId,
... ... @@ -183,7 +185,7 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred
Status: dividendsEstimates[0].DividendsUser.Status,
Company: dividendsEstimates[0].DividendsUser.Company,
},
AccountDetail: accountDetail,
AccountDetail: accountDetail, // 结算明细,多笔分红预算单
PaymentDocumentAttachment: nil,
Org: organization,
Company: company,
... ... @@ -318,8 +320,11 @@ func (creditAccountService *CreditAccountService) PayCreditAccount(payCreditAcco
defer func() {
_ = transactionContext.RollbackTransaction()
}()
// 参数类型转换
creditAccountId, _ := strconv.ParseInt(payCreditAccountCommand.CreditAccountId, 10, 64)
// 账期结算仓储初始化
var creditAccountRepository domain.CreditAccountRepository
if value, err1 := factory.CreateCreditAccountRepository(map[string]interface{}{
"transactionContext": transactionContext,
... ... @@ -328,6 +333,7 @@ func (creditAccountService *CreditAccountService) PayCreditAccount(payCreditAcco
} else {
creditAccountRepository = value
}
// 获取待支付的账期结算单
creditAccount, err := creditAccountRepository.FindOne(map[string]interface{}{"creditAccountId": creditAccountId})
if err != nil {
... ... @@ -339,8 +345,11 @@ func (creditAccountService *CreditAccountService) PayCreditAccount(payCreditAcco
if err2 := creditAccount.Update(tool_funs.SimpleStructToMap(payCreditAccountCommand)); err2 != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err2.Error())
}
// 支付状态设置
// 支付更新设置
creditAccount.PaymentStatus = 2
creditAccount.PaymentTime = time.Now()
if creditAccountSaved, err4 := creditAccountRepository.Save(creditAccount); err4 != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err4.Error())
} else {
... ...
... ... @@ -188,6 +188,22 @@ func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimat
cancelDividendsEstimateService = value
}
// 用户REST服务初始化
var userService service.UserService
if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
userService = value
}
// 获取操作人
var operator *domain.User
if data, err := userService.OperatorFrom(cancelDividendsEstimateCommand.CompanyId, cancelDividendsEstimateCommand.OrgId, cancelDividendsEstimateCommand.UserId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取操作人失败")
} else {
operator = data
}
// 分红预算仓储初始化
var dividendsEstimateRepository domain.DividendsEstimateRepository
if value, err := factory.CreateDividendsEstimateRepository(map[string]interface{}{
... ... @@ -235,7 +251,7 @@ func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimat
}
// 取消分红预算
if dividendsEstimatesCanceled, err := cancelDividendsEstimateService.CancelEstimate([]int64{cancelDividendsEstimateCommand.DividendsEstimateId}, cancelDividendsEstimateCommand.UserId); err != nil {
if dividendsEstimatesCanceled, err := cancelDividendsEstimateService.CancelEstimate([]int64{cancelDividendsEstimateCommand.DividendsEstimateId}, operator); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if err := transactionContext.CommitTransaction(); err != nil {
... ... @@ -271,6 +287,22 @@ func (dividendsEstimateService *DividendsEstimateService) BatchCancelDividendsEs
cancelDividendsEstimateService = value
}
// 用户REST服务初始化
var userService service.UserService
if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
userService = value
}
// 获取操作人
var operator *domain.User
if data, err := userService.OperatorFrom(batchCancelEstimateCommand.CompanyId, batchCancelEstimateCommand.OrgId, batchCancelEstimateCommand.UserId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取操作人失败")
} else {
operator = data
}
// 分红预算仓储初始化
var dividendsEstimateRepository domain.DividendsEstimateRepository
if value, err := factory.CreateDividendsEstimateRepository(map[string]interface{}{
... ... @@ -324,7 +356,7 @@ func (dividendsEstimateService *DividendsEstimateService) BatchCancelDividendsEs
}
}
// 批量取消分红预算单
if dividendsEstimatesCanceled, err := cancelDividendsEstimateService.CancelEstimate(dividendsEstimateIds, batchCancelEstimateCommand.UserId); err != nil {
if dividendsEstimatesCanceled, err := cancelDividendsEstimateService.CancelEstimate(dividendsEstimateIds, operator); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if err := transactionContext.CommitTransaction(); err != nil {
... ...
... ... @@ -629,10 +629,13 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD
// 获取分红订单
dividendsOrder, err := dividendsOrderRepository.FindOne(map[string]interface{}{"dividendsOrderId": updateDividendsOrderCommand.DividendsOrderId})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红订单不存在")
}
if dividendsOrder == nil {
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateDividendsOrderCommand.DividendsOrderId)))
}
// 新增订单产品
// 获取订单产品
var orderGoods []*domain.OrderGood
var dividendsOrderAmount float64
for _, orderGood := range updateDividendsOrderCommand.OrderGoods {
... ... @@ -660,9 +663,6 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD
dividendsOrderAmount = dividendsOrderAmount + orderGood.OrderGoodAmount
}
if dividendsOrder == nil {
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateDividendsOrderCommand.DividendsOrderId)))
}
if err := dividendsOrder.Update(tool_funs.SimpleStructToMap(updateDividendsOrderCommand)); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
... ...
... ... @@ -9,6 +9,8 @@ import (
)
type OrderGoods struct {
// 退货单产品ID
OrderGoodId string `json:"orderGoodId"`
// 订单产品金额
OrderGoodAmount float64 `cname:"订单产品金额" json:"orderGoodAmount"`
// 订单产品名称
... ...
... ... @@ -2,11 +2,9 @@ package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"reflect"
"strings"
"time"
"github.com/beego/beego/v2/core/validation"
)
type UpdateDividendsReturnedOrderCommand struct {
... ... @@ -21,7 +19,7 @@ type UpdateDividendsReturnedOrderCommand struct {
// 备注
Remarks string `cname:"备注" json:"remarks" valid:"Required"`
// 退货日期
DividendsReturnedDate time.Time `cname:"退货日期" json:"dividendsReturnedDate" valid:"Required"`
DividendsReturnedDate string `cname:"退货日期" json:"dividendsReturnedDate" valid:"Required"`
// 退货区域
RegionName string `cname:"退货区域" json:"regionName,omitempty"`
// 订单产品列表
... ...
... ... @@ -11,6 +11,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
"strconv"
"time"
)
... ... @@ -543,6 +544,8 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
defer func() {
_ = transactionContext.RollbackTransaction()
}()
// 分红退货单仓储初始化
var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository
if value, err := factory.CreateDividendsReturnedOrderRepository(map[string]interface{}{
"transactionContext": transactionContext,
... ... @@ -551,6 +554,15 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
} else {
dividendsReturnedOrderRepository = value
}
// 退货单时间转换
dividendsReturnedDateInt, err := strconv.ParseInt(updateDividendsReturnedOrderCommand.DividendsReturnedDate, 10, 64)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "订单时间错误")
}
dividendsReturnedDate := utils.TransformTimestampToTime(dividendsReturnedDateInt)
// 获取分红退货单
dividendsReturnedOrder, err := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{"dividendsReturnedOrderId": updateDividendsReturnedOrderCommand.DividendsReturnedOrderId})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -558,16 +570,51 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
if dividendsReturnedOrder == nil {
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateDividendsReturnedOrderCommand.DividendsReturnedOrderId)))
}
// 获取订单产品
var orderGoods []*domain.OrderGood
var dividendsReturnedOrderAmount float64
for _, orderGood := range updateDividendsReturnedOrderCommand.OrderGoods {
// 产品ID类型转换
orderGoodId, err3 := strconv.ParseInt(orderGood.OrderGoodId, 10, 64)
if err3 != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err3.Error())
}
orderGoods = append(orderGoods, &domain.OrderGood{
OrderGoodId: orderGoodId,
OrderGoodAmount: orderGood.OrderGoodAmount,
OrderGoodName: orderGood.OrderGoodName,
OrderGoodPrice: orderGood.OrderGoodPrice,
OrderGoodQuantity: orderGood.OrderGoodQuantity,
DividendsOrderNumber: "",
DividendsReturnedOrderNumber: dividendsReturnedOrder.DividendsReturnedOrderNumber,
CooperationContractNumber: orderGood.CooperationContractNumber,
OrderGoodExpense: orderGood.OrderGoodExpense,
OrgId: updateDividendsReturnedOrderCommand.OrgId,
CompanyId: updateDividendsReturnedOrderCommand.CompanyId,
CreatedAt: time.Time{},
UpdatedAt: time.Now(),
})
// 计算分红退货单金额
dividendsReturnedOrderAmount = dividendsReturnedOrderAmount + orderGood.OrderGoodAmount
}
if err := dividendsReturnedOrder.Update(tool_funs.SimpleStructToMap(updateDividendsReturnedOrderCommand)); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
if dividendsReturnedOrder, err := dividendsReturnedOrderRepository.Save(dividendsReturnedOrder); err != nil {
dividendsReturnedOrder.DividendsReturnedDate = dividendsReturnedDate
dividendsReturnedOrder.DividendsReturnedOrderRefund = dividendsReturnedOrderAmount
dividendsReturnedOrder.Goods = orderGoods
// 保存分红退货单更新
if dividendsReturnedOrderSaved, err := dividendsReturnedOrderRepository.Save(dividendsReturnedOrder); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return dividendsReturnedOrder, nil
return dividendsReturnedOrderSaved, nil
}
}
... ...
... ... @@ -72,9 +72,6 @@ func (dividendsReturnedOrder *DividendsReturnedOrder) Update(data map[string]int
if dividendsReturnedCustomerName, ok := data["dividendsReturnedCustomerName"]; ok {
dividendsReturnedOrder.DividendsReturnedCustomerName = dividendsReturnedCustomerName.(string)
}
if dividendsReturnedDate, ok := data["dividendsReturnedDate"]; ok {
dividendsReturnedOrder.DividendsReturnedDate = dividendsReturnedDate.(time.Time)
}
if regionNumber, ok := data["regionNumber"]; ok {
dividendsReturnedOrder.Region.RegionNumber = regionNumber.(string)
}
... ...
... ... @@ -7,5 +7,5 @@ import (
type CancelDividendsEstimate interface {
coreDomain.DomainEventPublisher
CancelEstimate(dividendsEstimateIds []int64, operatorId int64) ([]*domain.DividendsEstimate, error)
CancelEstimate(dividendsEstimateIds []int64, operator *domain.User) ([]*domain.DividendsEstimate, error)
}
... ...
... ... @@ -2,11 +2,9 @@ package domain_service
import (
"fmt"
"github.com/linmadan/egglib-go/core/application"
coreDomain "github.com/linmadan/egglib-go/core/domain"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/repository"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
)
... ... @@ -16,11 +14,10 @@ type CancelDividendsEstimateService struct {
transactionContext *pgTransaction.TransactionContext
}
func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEstimateIds []int64, operatorId int64) ([]*domain.DividendsEstimate, error) {
func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEstimateIds []int64, operator *domain.User) ([]*domain.DividendsEstimate, error) {
var dividendsEstimateRepository domain.DividendsEstimateRepository // 分红预算单仓储
var dividendsOrderRepository domain.DividendsOrderRepository // 分红订单仓储
var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository // 分红退货单仓储
var userService service.UserService // 用户服务
// 分红预算单仓储初始化
if repo, err := repository.NewDividendsEstimateRepository(domainService.transactionContext); err != nil {
... ... @@ -40,18 +37,6 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
} else {
dividendsReturnedOrderRepository = repo
}
// 用户服务初始化
if value, err := NewUserService(); err != nil {
userService = value
}
// 获取操作人
var operator *domain.User
if data, err := userService.OperatorFrom(0, 0, operatorId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
operator = data
}
// 获取分红预算单
if count, dividendsEstimates, err := dividendsEstimateRepository.Find(map[string]interface{}{
... ...
... ... @@ -232,7 +232,7 @@ func (repository *DividendsEstimateRepository) UpdateMany(dividendsEstimates []*
if _, err := tx.Model(&dividendsEstimateModels).WherePK().Update(); err != nil {
return nil, err
}
dividendsEstimatesUpdated := []*domain.DividendsEstimate{}
var dividendsEstimatesUpdated []*domain.DividendsEstimate
for _, dividendsEstimateModel := range dividendsEstimateModels {
if dividendsEstimate, err := transform.TransformToDividendsEstimateDomainModelFromPgModels(dividendsEstimateModel); err != nil {
return dividendsEstimates, err
... ...
... ... @@ -4,6 +4,7 @@ import (
"fmt"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log"
"time"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
... ... @@ -208,14 +209,19 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend
OrgId: goodDomain.OrgId,
CompanyId: goodDomain.CompanyId,
OrderGoodDividendsStatus: goodDomain.OrderGoodDividendsStatus,
CreatedAt: time.Time{},
CreatedAt: time.Now(),
DeletedAt: time.Time{},
UpdatedAt: time.Now(),
UpdatedAt: time.Time{},
})
}
// 添加分红订单产品
if _, err := tx.Model(&orderGoodsToAddModels).Insert(); err != nil {
return nil, err
log.Logger.Info("待添加的分红订单产品", map[string]interface{}{
"orderGoodsToAddModels": orderGoodsToAddModels,
})
if len(orderGoodsToAddModels) > 0 {
if _, err := tx.Model(&orderGoodsToAddModels).Insert(); err != nil {
return nil, err
}
}
// 待更新或者删除的ids
... ... @@ -234,8 +240,13 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend
}
}
}
if _, err := tx.Model(&orderGoodModelsToUpdate).WherePK().Update(); err != nil {
return nil, err
log.Logger.Info("待更新的分红订单产品", map[string]interface{}{
"orderGoodModelsToUpdate": orderGoodModelsToUpdate,
})
if len(orderGoodModelsToUpdate) > 0 {
if _, err := tx.Model(&orderGoodModelsToUpdate).WherePK().Update(); err != nil {
return nil, err
}
}
// 待删除的分红订单产品id
... ... @@ -248,15 +259,46 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend
}
}
}
if _, err := tx.Model(&orderGoodModelsToDelete).WherePK().Delete(); err != nil {
return nil, err
log.Logger.Info("待删除的订单产品", map[string]interface{}{
"orderGoodModelsToDelete": orderGoodModelsToDelete,
})
if len(orderGoodModelsToDelete) > 0 {
if _, err := tx.Model(&orderGoodModelsToDelete).Delete(); err != nil {
return nil, err
}
}
}
return dividendsOrder, nil
}
func (repository *DividendsOrderRepository) UpdateMany(dividendsOrders []*domain.DividendsOrder) ([]*domain.DividendsOrder, error) {
panic("implement me")
tx := repository.transactionContext.PgTx
var dividendsOrderModels []*models.DividendsOrder
for _, dividendsOrder := range dividendsOrders {
dividendsOrderModels = append(dividendsOrderModels, &models.DividendsOrder{
DividendsOrderId: dividendsOrder.DividendsOrderId,
DividendsOrderNumber: dividendsOrder.DividendsOrderNumber,
DividendsOriginalOrderNum: dividendsOrder.DividendsOriginalOrderNum,
DividendsOrderAmount: dividendsOrder.DividendsOrderAmount,
OrderTime: dividendsOrder.OrderTime,
DividendTime: dividendsOrder.DividendTime,
DividendStatus: dividendsOrder.DividendStatus,
Region: dividendsOrder.Region,
CustomerName: dividendsOrder.CustomerName,
Org: dividendsOrder.Org,
Company: dividendsOrder.Company,
CreatedAt: dividendsOrder.CreatedAt,
DeletedAt: dividendsOrder.DeletedAt,
UpdatedAt: time.Now(),
OperateTime: dividendsOrder.OperateTime,
Operator: dividendsOrder.Operator,
Remarks: dividendsOrder.Remarks,
})
}
if _, err := tx.Model(&dividendsOrderModels).WherePK().Update(); err != nil {
return nil, err
}
return dividendsOrders, nil
}
func (repository *DividendsOrderRepository) Remove(dividendsOrder *domain.DividendsOrder) (*domain.DividendsOrder, error) {
... ...
... ... @@ -181,7 +181,7 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder
// 获取分红退货订单产品
var orderGoodsFetched []*models.OrderGood
orderGoodsQuery := tx.Model(&orderGoodsFetched)
if err := orderGoodsQuery.Where("dividends_return_order_number = ?", dividendsReturnedOrder.DividendsReturnedOrderNumber).Select(); err != nil {
if err := orderGoodsQuery.Where("dividends_returned_order_number = ?", dividendsReturnedOrder.DividendsReturnedOrderNumber).Select(); err != nil {
return nil, err
}
... ... @@ -224,8 +224,10 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder
})
}
// 添加分红退货订单产品
if _, err := tx.Model(&orderGoodsToAddModels).Insert(); err != nil {
return nil, err
if len(orderGoodsToAddModels) > 0 {
if _, err := tx.Model(&orderGoodsToAddModels).Insert(); err != nil {
return nil, err
}
}
// 待更新或者删除的ids
... ... @@ -244,8 +246,10 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder
}
}
}
if _, err := tx.Model(&orderGoodModelsToUpdate).WherePK().Update(); err != nil {
return nil, err
if len(orderGoodModelsToUpdate) > 0 {
if _, err := tx.Model(&orderGoodModelsToUpdate).WherePK().Update(); err != nil {
return nil, err
}
}
// 待删除的分红退货订单产品id
... ... @@ -258,15 +262,45 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder
}
}
}
if _, err := tx.Model(&orderGoodModelsToDelete).WherePK().Delete(); err != nil {
return nil, err
if len(orderGoodModelsToDelete) > 0 {
if _, err := tx.Model(&orderGoodModelsToDelete).Delete(); err != nil {
return nil, err
}
}
}
return dividendsReturnedOrder, nil
}
func (repository *DividendsReturnedOrderRepository) UpdateMany(dividendsReturnedOrder []*domain.DividendsReturnedOrder) ([]*domain.DividendsReturnedOrder, error) {
panic("implement me")
func (repository *DividendsReturnedOrderRepository) UpdateMany(dividendsReturnedOrders []*domain.DividendsReturnedOrder) ([]*domain.DividendsReturnedOrder, error) {
tx := repository.transactionContext.PgTx
var dividendsReturnedOrderModels []*models.DividendsReturnedOrder
for _, dividendsReturnedOrder := range dividendsReturnedOrders {
dividendsReturnedOrderModels = append(dividendsReturnedOrderModels, &models.DividendsReturnedOrder{
DividendsReturnedOrderId: dividendsReturnedOrder.DividendsReturnedOrderId,
DividendsReturnedOrderNumber: dividendsReturnedOrder.DividendsOrderNumber,
DividendsReturnedOrderRefund: dividendsReturnedOrder.DividendsReturnedOrderRefund,
OriginalOrderNum: dividendsReturnedOrder.OriginalOrderNum,
DividendsOrderNumber: dividendsReturnedOrder.DividendsReturnedOrderNumber,
DividendsReturnedCustomerName: dividendsReturnedOrder.DividendsReturnedCustomerName,
OrderTime: dividendsReturnedOrder.OrderTime,
DividendsReturnedDate: dividendsReturnedOrder.DividendsReturnedDate,
Region: dividendsReturnedOrder.Region,
Remarks: dividendsReturnedOrder.Remarks,
DividendStatus: dividendsReturnedOrder.DividendStatus,
DividendTime: dividendsReturnedOrder.DividendTime,
Org: dividendsReturnedOrder.Org,
Company: dividendsReturnedOrder.Company,
CreatedAt: dividendsReturnedOrder.CreatedAt,
DeletedAt: dividendsReturnedOrder.DeletedAt,
UpdatedAt: time.Now(),
Operator: dividendsReturnedOrder.Operator,
OperateTime: dividendsReturnedOrder.OperateTime,
})
}
if _, err := tx.Model(&dividendsReturnedOrderModels).WherePK().Update(); err != nil {
return nil, err
}
return dividendsReturnedOrders, nil
}
func (repository *DividendsReturnedOrderRepository) Remove(dividendsReturnedOrder *domain.DividendsReturnedOrder) (*domain.DividendsReturnedOrder, error) {
... ...