作者 陈志颖

合并分支 'dev' 到 'test'

Dev



查看合并请求 !77
... ... @@ -521,6 +521,7 @@ func (dividendsEstimateService *DividendsEstimateService) CreateDividendsEstimat
// ConfirmDividendsIncentivesEstimate 确定业绩激励分红预算
func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncentivesEstimate(confirmDividendsIncentivesEstimateCommand *command.ConfirmDividendsIncentivesEstimateCommand) (interface{}, error) {
start := time.Now()
if err := confirmDividendsIncentivesEstimateCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
... ... @@ -550,12 +551,14 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
}
// 获取公司信息
startGetCompany := time.Now()
var company *domain.Company
if data, err := companyService.CompanyFrom(confirmDividendsIncentivesEstimateCommand.CompanyId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
company = data
}
fmt.Println("获取公司信息耗时:", time.Since(startGetCompany))
// 组织机构REST服务初始化
var organizationService service.OrgService
... ... @@ -566,12 +569,14 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
}
// 获取组织机构信息
startGetOrg := time.Now()
var organization *domain.Org
if data, err := organizationService.OrgFrom(confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
organization = data
}
fmt.Println("获取组织机构数据耗时:", time.Since(startGetOrg))
// 用户REST服务初始化
var userService service.UserService
... ... @@ -582,12 +587,14 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
}
// 获取操作人
startGetOperator := time.Now()
var operator *domain.User
if data, err := userService.OperatorFrom(confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId, confirmDividendsIncentivesEstimateCommand.UserId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
operator = data
}
fmt.Println("获取操作人耗时:", time.Since(startGetOperator))
// 订单产品仓储初始化
var orderGoodRepository domain.OrderGoodRepository
... ... @@ -649,16 +656,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
cooperationContractRepository = value
}
// 共创项目仓储初始化
//var cooperationProjectRepository domain.CooperationProjectRepository
//if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
// "transactionContext": transactionContext,
//}); err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
//} else {
// cooperationProjectRepository = value
//}
// 初始化确认业绩激励分红预算领域服务
var confirmDividendsIncentivesEstimateService service.ConfirmDividendsIncentivesEstimateService
if value, err := factory.CreateConfirmDividendsIncentivesEstimateService(map[string]interface{}{
... ... @@ -672,26 +669,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
})
}
// 查询共创项目
//cooperationProjectsMap := make(map[string]*domain.CooperationProject, 0)
//if count, cooperationProjectsFound, err := cooperationProjectRepository.Find(map[string]interface{}{
// "companyId": confirmDividendsIncentivesEstimateCommand.CompanyId,
// "orgId": confirmDividendsIncentivesEstimateCommand.OrgId,
// "offsetLimit": false,
//}); err != nil {
// return nil, err
//} else {
// if count > 0 {
// for _, cooperationProjectFound := range cooperationProjectsFound {
// cooperationProjectsMap[cooperationProjectFound.CooperationProjectNumber] = cooperationProjectFound
// }
// }
//}
//
//log.Logger.Info("查询共创项目", map[string]interface{}{
// "cooperationProjectsMap": cooperationProjectsMap,
//})
// 统计成功预算的分红订单
estimateSuccessfullyDividendsOrders := make(map[string]string)
... ... @@ -699,12 +676,15 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
estimateFailedDividendsOrders := make(map[string]string)
// 获取订单产品
startGetOrderGoods := time.Now()
if _, orderGoods, err := orderGoodRepository.Find(map[string]interface{}{
"orderGoodIds": orderGoodIds,
"offsetLimit": false,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
fmt.Println("获取订单产品耗时:", time.Since(startGetOrderGoods))
dividendsEstimates := make([]*domain.DividendsEstimate, 0)
var cooperationContractNumbers []string
... ... @@ -716,8 +696,11 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
newCooperationContractNumbers := utils.RemoveDuplicationString(cooperationContractNumbers)
// 查询共创合约
cooperationContractsMap := make(map[string]*domain.CooperationContract, 0)
// 查询共创合约
startQueryContracts := time.Now()
if len(newCooperationContractNumbers) > 0 {
if count, cooperationContractsFound, err := cooperationContractRepository.Find(map[string]interface{}{
"cooperationContractNumbers": newCooperationContractNumbers,
"companyId": confirmDividendsIncentivesEstimateCommand.CompanyId,
... ... @@ -732,10 +715,12 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
}
}
}
log.Logger.Info("查询共创合约", map[string]interface{}{
"cooperationContractsMap": cooperationContractsMap,
})
} else {
return map[string]interface{}{
"report": fmt.Sprintf("已完成0单订单分红预算,生成0单分红预算,失败原因:产品未关联合约"),
}, nil
}
fmt.Println("查询共创合约耗时:", time.Since(startQueryContracts))
// 统计当前企业分红预算单数
count, err := dividendsEstimateDao.CountDividendsEstimate(map[string]interface{}{
... ... @@ -747,12 +732,19 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
var countDividendsEstimate int64
for _, orderGood := range orderGoods {
dividendsEstimate := &domain.DividendsEstimate{}
if orderGood.DividendsOrderNumber != "" { // 查询分红订单
orderGoodsToConfirm := make([]*domain.OrderGood, 0)
returnedOrderGoodsToConfirm := make([]*domain.OrderGood, 0)
for _, orderGood := range orderGoods {
if orderGood.DividendsOrderNumber != "" {
orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
// 分红订单产品预算
} else if orderGood.DividendsReturnedOrderNumber != "" {
returnedOrderGoodsToConfirm = append(returnedOrderGoodsToConfirm, orderGood)
}
}
startConfirm := time.Now()
if len(orderGoodsToConfirm) > 0 { // 分红订单产品预算
if dividendsEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId, cooperationContractsMap); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
... ... @@ -770,7 +762,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
// 统计分红预算单数目
countDividendsEstimate = countDividendsEstimate + 1
dividendsEstimate = &domain.DividendsEstimate{
dividendsEstimate := &domain.DividendsEstimate{
DividendsEstimateId: 0,
DividendsAccountStatus: domain.TO_BE_ACCOUNT,
DividendsAmount: dividendsEstimateDetail.DividendsAmount,
... ... @@ -779,8 +771,8 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
DividendsParticipateType: dividendsEstimateDetail.DividendsParticipateType,
DividendsType: domain.ORDER_DIVIDENDS,
DividendsTypeName: "订单分红",
OrderOrReturnedOrderNum: orderGood.DividendsOrderNumber,
CooperationContractNumber: orderGood.CooperationContractNumber,
OrderOrReturnedOrderNum: dividendsEstimateDetail.OrderOrReturnedOrderNumber,
CooperationContractNumber: dividendsEstimateDetail.CooperationContractNumber,
DividendsUser: dividendsEstimateDetail.DividendsUser,
DividendsPercentage: dividendsEstimateDetail.DividendsPercentage,
DividendsStage: dividendsEstimateDetail.DividendsStage,
... ... @@ -792,8 +784,8 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
CreatedAt: time.Now(),
DeletedAt: time.Time{},
UpdatedAt: time.Time{},
OrderGoodId: orderGood.OrderGoodId,
OrderGoodAmount: orderGood.OrderGoodAmount,
OrderGoodId: dividendsEstimateDetail.OrderGoodId,
OrderGoodAmount: dividendsEstimateDetail.OrderGoodAmount,
PaymentStatus: int32(1),
CooperationContractUndertakerId: dividendsEstimateDetail.CooperationContractUndertakerId,
}
... ... @@ -805,11 +797,8 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
}
}
}
} else if orderGood.DividendsReturnedOrderNumber != "" { // 查询分红退货单
orderGoodsToConfirm := make([]*domain.OrderGood, 0)
orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
// 分红退货单产品预算
if dividendsReturnedEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId, cooperationContractsMap); err != nil {
} else if len(returnedOrderGoodsToConfirm) > 0 { // 退货单产品预算
if dividendsReturnedEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(returnedOrderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId, cooperationContractsMap); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
for _, dividendsReturnedEstimateDetail := range dividendsReturnedEstimateDetails {
... ... @@ -826,7 +815,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
// 统计生成的预算单数量
countDividendsEstimate = countDividendsEstimate + 1
dividendsEstimate = &domain.DividendsEstimate{
dividendsEstimate := &domain.DividendsEstimate{
DividendsEstimateId: 0,
DividendsAccountStatus: domain.TO_BE_ACCOUNT,
DividendsAmount: dividendsReturnedEstimateDetail.DividendsAmount,
... ... @@ -835,8 +824,8 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
DividendsParticipateType: dividendsReturnedEstimateDetail.DividendsParticipateType,
DividendsType: domain.RETURN_WRITE_OFF,
DividendsTypeName: "退货冲销",
OrderOrReturnedOrderNum: orderGood.DividendsReturnedOrderNumber,
CooperationContractNumber: orderGood.CooperationContractNumber,
OrderOrReturnedOrderNum: dividendsReturnedEstimateDetail.OrderOrReturnedOrderNumber,
CooperationContractNumber: dividendsReturnedEstimateDetail.CooperationContractNumber,
DividendsUser: dividendsReturnedEstimateDetail.DividendsUser,
DividendsPercentage: dividendsReturnedEstimateDetail.DividendsPercentage,
DividendsStage: dividendsReturnedEstimateDetail.DividendsStage,
... ... @@ -848,8 +837,8 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
CreatedAt: time.Now(),
DeletedAt: time.Time{},
UpdatedAt: time.Time{},
OrderGoodId: orderGood.OrderGoodId,
OrderGoodAmount: orderGood.OrderGoodAmount,
OrderGoodId: dividendsReturnedEstimateDetail.OrderGoodId,
OrderGoodAmount: dividendsReturnedEstimateDetail.OrderGoodAmount,
PaymentStatus: int32(1),
CooperationContractUndertakerId: dividendsReturnedEstimateDetail.CooperationContractUndertakerId,
}
... ... @@ -862,15 +851,13 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
}
}
}
}
log.Logger.Info("新增的分红预算单", map[string]interface{}{
"dividendsEstimates": dividendsEstimates,
})
fmt.Println("订单分红耗时:", time.Since(startConfirm))
startInsert := time.Now()
if dividendsEstimatesSaved, err := dividendsEstimateRepository.SaveMany(dividendsEstimates); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
fmt.Println("插入预算单耗时:", time.Since(startInsert))
// 获取产品ID
orderGoodSavedIds := make([]int64, 0)
for _, dividendsEstimate := range dividendsEstimates {
... ... @@ -878,6 +865,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
}
// 更新订单产品分红状态
startUpdateGoodStatus := time.Now()
var orderGoodsSaved []*domain.OrderGood
if len(orderGoodSavedIds) > 0 {
// 订单产品ID去重
... ... @@ -899,6 +887,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
}
}
}
fmt.Println("更新订单产品分红状态耗时:", time.Since(startUpdateGoodStatus))
// 分离分红订单和退货单
dividendsOrderNumbers := make([]string, 0)
... ... @@ -915,15 +904,8 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
}
}
log.Logger.Info("分红订单", map[string]interface{}{
"dividendsOrderNumbers": dividendsOrderNumbers,
})
log.Logger.Info("分红退货单", map[string]interface{}{
"dividendsReturnedOrderNumbers": dividendsReturnedOrderNumbers,
})
// 查找分红订单
startUpdateOrder := time.Now()
if len(dividendsOrderNumbers) > 0 {
if countDividendsOrdersFound, dividendsOrdersFound, err := dividendsOrderRepository.Find(map[string]interface{}{
"dividendsOrderNumbers": dividendsOrderNumbers,
... ... @@ -966,8 +948,10 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
}
}
}
fmt.Println("更新订单耗时:", time.Since(startUpdateOrder))
// 查找分红退货单
startUpdateReturnedOrder := time.Now()
if len(dividendsReturnedOrderNumbers) > 0 {
if countDividendsReturnedOrdersFound, dividendsReturnedOrdersFound, err := dividendsReturnedOrderRepository.Find(map[string]interface{}{
"dividendsReturnedOrderNumbers": dividendsReturnedOrderNumbers,
... ... @@ -1010,9 +994,13 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
}
}
fmt.Println("更新退货单耗时:", time.Since(startUpdateReturnedOrder))
startCommit := time.Now()
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
fmt.Println("提交事务耗时:", time.Since(startCommit))
// 统计成功的分红预算
successfullyCount := len(dividendsEstimatesSaved)
... ... @@ -1029,6 +1017,8 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
failedReasonStr = "无"
}
fmt.Println("函数执行完毕:", time.Since(start))
return map[string]interface{}{
"report": fmt.Sprintf("已完成%d单订单分红预算,生成%d单分红预算,%d笔订单分红预算失败,失败原因:%s", len(estimateSuccessfullyDividendsOrders), successfullyCount, len(estimateFailedDividendsOrders), failedReasonStr),
}, nil
... ...
... ... @@ -17,7 +17,6 @@ var USER_MODULE_HOST = "http://127.0.0.1:8081"
// BASIC_MODULE_HOST 基础服务模块
var BASIC_MODULE_HOST = "http://127.0.0.1:8080"
// ENABLE_HTTPS 是否开启https访问
var ENABLE_HTTPS = "false"
... ...
... ... @@ -17,6 +17,9 @@ type DividendsEstimateDetail struct {
IsSuccessfully bool `json:"isSuccessfully"` // 是否预算成功
Reason string `json:"reason"` // 错误原因
CooperationContractUndertakerId int64 `json:"cooperationContractUndertakerId"` // 承接人记录ID
CooperationContractNumber string `json:"cooperationContractNumber"`
OrderGoodId int64 `json:"orderGoodId"`
OrderGoodAmount float64 `json:"orderGoodAmount"`
}
// GenerateSpecificDividendsEstimateNumber 批量生成自定义分红预算单号
... ...
... ... @@ -26,7 +26,7 @@ func (dao *DividendsEstimateDao) GenerateDividendsEstimateNumber(queryOptions ma
if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
query = query.Where(`dividends_estimate.company @> '{"companyId":"?"}'`, companyId)
}
if count, err := query.AllWithDeleted().SelectAndCount(); err != nil {
if count, err := query.AllWithDeleted().Count(); err != nil {
return "", err
} else {
if count < 1000 {
... ... @@ -118,7 +118,7 @@ func (dao *DividendsEstimateDao) CountDividendsEstimate(queryOptions map[string]
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query = query.Where(`dividends_estimate.org @> '{"orgId":"?"}'`, orgId)
}
if count, err := query.AllWithDeleted().SelectAndCount(); err != nil {
if count, err := query.AllWithDeleted().Count(); err != nil {
return 0, err
} else {
return count, nil
... ...
... ... @@ -97,26 +97,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
}
}
// 判断共创项目是否存在
//if _, ok := cooperationProjectsMap[cooperationContract.CooperationProjectNumber]; !ok {
// var orderNumber string
// if orderGood.DividendsOrderNumber != "" {
// orderNumber = orderGood.DividendsOrderNumber
// } else {
// orderNumber = orderGood.DividendsReturnedOrderNumber
// }
// dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
// DividendsUser: nil,
// DividendsParticipateType: 0,
// DividendsStage: 0,
// DividendsAmount: 0,
// OrderOrReturnedOrderNumber: orderNumber,
// IsSuccessfully: false,
// Reason: "共创项目" + cooperationContract.CooperationProjectNumber + "已结束或不存在",
// })
// continue
//}
if orderGood.DividendsOrderNumber != "" { // 获取分红订单
// 获取分红订单
dividendsOrder, err2 := dividendsOrderRepository.FindOne(map[string]interface{}{
... ... @@ -199,6 +179,9 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
IsSuccessfully: true,
CooperationContractUndertakerId: undertaker.UndertakerId,
DividendsPercentage: dividendsIncentivesRuleMatched.DividendsIncentivesPercentage,
CooperationContractNumber: orderGood.CooperationContractNumber,
OrderGoodId: orderGood.OrderGoodId,
OrderGoodAmount: orderGood.OrderGoodAmount,
})
}
// 添加推荐人分红预算信息详情
... ... @@ -226,6 +209,9 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
IsSuccessfully: true,
CooperationContractUndertakerId: undertaker.UndertakerId,
DividendsPercentage: dividendsIncentivesRuleMatched.ReferrerPercentage,
CooperationContractNumber: orderGood.CooperationContractNumber,
OrderGoodId: orderGood.OrderGoodId,
OrderGoodAmount: orderGood.OrderGoodAmount,
})
}
}
... ... @@ -254,6 +240,9 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
IsSuccessfully: true,
CooperationContractUndertakerId: undertaker.UndertakerId,
DividendsPercentage: dividendsIncentivesRuleMatched.SalesmanPercentage,
CooperationContractNumber: orderGood.CooperationContractNumber,
OrderGoodId: orderGood.OrderGoodId,
OrderGoodAmount: orderGood.OrderGoodAmount,
})
}
}
... ... @@ -337,6 +326,9 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
IsSuccessfully: true,
CooperationContractUndertakerId: undertaker.UndertakerId,
DividendsPercentage: dividendsIncentivesRuleMatched.DividendsIncentivesPercentage,
CooperationContractNumber: orderGood.CooperationContractNumber,
OrderGoodId: orderGood.OrderGoodId,
OrderGoodAmount: orderGood.OrderGoodAmount,
})
}
... ... @@ -365,6 +357,9 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
IsSuccessfully: true,
CooperationContractUndertakerId: undertaker.UndertakerId,
DividendsPercentage: dividendsIncentivesRuleMatched.ReferrerPercentage,
CooperationContractNumber: orderGood.CooperationContractNumber,
OrderGoodId: orderGood.OrderGoodId,
OrderGoodAmount: orderGood.OrderGoodAmount,
})
}
}
... ... @@ -394,6 +389,9 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
IsSuccessfully: true,
CooperationContractUndertakerId: undertaker.UndertakerId,
DividendsPercentage: dividendsIncentivesRuleMatched.SalesmanPercentage,
CooperationContractNumber: orderGood.CooperationContractNumber,
OrderGoodId: orderGood.OrderGoodId,
OrderGoodAmount: orderGood.OrderGoodAmount,
})
}
}
... ...
... ... @@ -9,7 +9,6 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log"
rawlog "log"
)
... ...
... ... @@ -223,15 +223,16 @@ func (repository *DividendsEstimateRepository) SaveMany(dividendsEstimates []*do
if _, err := tx.Model(&dividendsEstimateModels).Insert(); err != nil {
return nil, err
}
var dividendsEstimatesSaved []*domain.DividendsEstimate
for _, dividendsEstimateModel := range dividendsEstimateModels {
if dividendsEstimate, err := transform.TransformToDividendsEstimateDomainModelFromPgModels(dividendsEstimateModel); err != nil {
return dividendsEstimates, err
} else {
dividendsEstimatesSaved = append(dividendsEstimatesSaved, dividendsEstimate)
}
}
return dividendsEstimatesSaved, nil
//var dividendsEstimatesSaved []*domain.DividendsEstimate
//for _, dividendsEstimateModel := range dividendsEstimateModels {
// if dividendsEstimate, err := transform.TransformToDividendsEstimateDomainModelFromPgModels(dividendsEstimateModel); err != nil {
// return dividendsEstimates, err
// } else {
// dividendsEstimatesSaved = append(dividendsEstimatesSaved, dividendsEstimate)
// }
//}
//return dividendsEstimatesSaved, nil
return dividendsEstimates, nil
}
return nil, nil
}
... ... @@ -270,15 +271,16 @@ func (repository *DividendsEstimateRepository) UpdateMany(dividendsEstimates []*
if _, err := tx.Model(&dividendsEstimateModels).WherePK().Update(); err != nil {
return nil, err
}
var dividendsEstimatesUpdated []*domain.DividendsEstimate
for _, dividendsEstimateModel := range dividendsEstimateModels {
if dividendsEstimate, err := transform.TransformToDividendsEstimateDomainModelFromPgModels(dividendsEstimateModel); err != nil {
return dividendsEstimates, err
} else {
dividendsEstimatesUpdated = append(dividendsEstimatesUpdated, dividendsEstimate)
}
}
return dividendsEstimatesUpdated, nil
//var dividendsEstimatesUpdated []*domain.DividendsEstimate
//for _, dividendsEstimateModel := range dividendsEstimateModels {
// if dividendsEstimate, err := transform.TransformToDividendsEstimateDomainModelFromPgModels(dividendsEstimateModel); err != nil {
// return dividendsEstimates, err
// } else {
// dividendsEstimatesUpdated = append(dividendsEstimatesUpdated, dividendsEstimate)
// }
//}
//return dividendsEstimatesUpdated, nil
return dividendsEstimates, nil
}
func (repository *DividendsEstimateRepository) Remove(dividendsEstimate *domain.DividendsEstimate) (*domain.DividendsEstimate, error) {
... ...
... ... @@ -50,7 +50,8 @@ func (logger *BeegoLog) Debug(msg string, appends ...map[string]interface{}) {
logs.Debug(msg, make(map[string]interface{}, 0))
} else {
var out bytes.Buffer
err := json.Indent(&out, appendsJson, "", " ")
//err := json.Indent(&out, appendsJson, "", " ")
err := json.Compact(&out, appendsJson)
if err != nil {
fmt.Println(msg)
return
... ... @@ -65,7 +66,8 @@ func (logger *BeegoLog) Info(msg string, appends ...map[string]interface{}) {
logs.Info(msg, make(map[string]interface{}, 0))
} else {
var out bytes.Buffer
err := json.Indent(&out, appendsJson, "", " ")
//err := json.Indent(&out, appendsJson, "", " ")
err := json.Compact(&out, appendsJson)
if err != nil {
fmt.Println(msg)
return
... ...