作者 陈志颖

合并分支 'dev' 到 'test'

Dev



查看合并请求 !83
... ... @@ -295,7 +295,7 @@ func (cooperationApplicationService *CooperationApplicationService) ApprovalCoop
// 校验共创申请是否已经审核过
if cooperationApplication.CooperationApplicationStatus != 1 {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "申请已经审核过")
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "申请已经审核过")
}
if approvalCooperationApplicationCommand.Action == 1 {
... ... @@ -464,7 +464,7 @@ func (cooperationApplicationService *CooperationApplicationService) OneClickAppr
for i, cooperationApplication := range cooperationApplications {
// 校验共创申请是否已经审核过
if cooperationApplication.CooperationApplicationStatus != 1 {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "申请已经审核过")
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "申请已经审核过")
}
// 更新共创申请
if oneClickApprovalCooperationApplicationCommand.Action == 1 {
... ...
... ... @@ -1275,7 +1275,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
for _, rule := range cooperationContractFound.DividendsIncentivesRules {
jsons, errs := json.Marshal(rule)
if errs != nil {
fmt.Println(errs.Error())
(errs.Error())
}
cooperationContractFoundBytes = append(cooperationContractFoundBytes, jsons...)
}
... ... @@ -1288,7 +1288,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
for _, rule := range cooperationContract.DividendsIncentivesRules {
jsons, errs := json.Marshal(rule)
if errs != nil {
fmt.Println(errs.Error())
(errs.Error())
}
cooperationContractBytes = append(cooperationContractBytes, jsons...)
}
... ... @@ -1331,7 +1331,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
for _, rule := range cooperationContractFound.MoneyIncentivesRules {
jsons, errs := json.Marshal(rule)
if errs != nil {
fmt.Println(errs.Error())
(errs.Error())
}
cooperationContractFoundBytes = append(cooperationContractFoundBytes, jsons...)
}
... ... @@ -1344,7 +1344,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
for _, rule := range cooperationContract.MoneyIncentivesRules {
jsons, errs := json.Marshal(rule)
if errs != nil {
fmt.Println(errs.Error())
(errs.Error())
}
cooperationContractBytes = append(cooperationContractBytes, jsons...)
}
... ... @@ -1388,7 +1388,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
for _, undertaker := range cooperationContractFound.Undertakers {
jsons, errs := json.Marshal(undertaker)
if errs != nil {
fmt.Println(errs.Error())
(errs.Error())
}
cooperationContractFoundBytes = append(cooperationContractFoundBytes, jsons...)
}
... ... @@ -1400,7 +1400,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
for _, undertaker := range cooperationContract.Undertakers {
jsons, errs := json.Marshal(undertaker) //转换成JSON返回的是byte[]
if errs != nil {
fmt.Println(errs.Error())
(errs.Error())
}
cooperationContractBytes = append(cooperationContractBytes, jsons...)
}
... ...
... ... @@ -26,9 +26,9 @@ func (batchRemoveCooperationModeCommand *BatchRemoveCooperationModeCommand) Vali
for _, cooperationModeId := range batchRemoveCooperationModeCommand.CooperationModeIds {
switch v := reflect.ValueOf(cooperationModeId); v.Kind() {
case reflect.String:
fmt.Println(v.String())
(v.String())
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
fmt.Println(v.Int())
(v.Int())
_ = validation.SetError("CustomValid", "共创模式ID类型错误")
default:
fmt.Printf("unhandled kind %s", v.Kind())
... ...
... ... @@ -405,8 +405,8 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
t := reflect.TypeOf(dividendsOrder)
v := reflect.ValueOf(dividendsOrder)
for k := 0; k < t.NumField(); k++ {
//fmt.Println("name:", fmt.Sprintf("%+v", t.Field(k).Name), ", value:", fmt.Sprintf("%v", v.Field(k).Interface()), ", yaml:", t.Field(k).Tag.Get("yaml"))
//fmt.Println("name:", fmt.Sprintf("%+v", t.Field(k).Name), ", value:", fmt.Sprintf("%v", v.Field(k).Interface()))
//("name:", fmt.Sprintf("%+v", t.Field(k).Name), ", value:", fmt.Sprintf("%v", v.Field(k).Interface()), ", yaml:", t.Field(k).Tag.Get("yaml"))
//("name:", fmt.Sprintf("%+v", t.Field(k).Name), ", value:", fmt.Sprintf("%v", v.Field(k).Interface()))
if t.Field(k).Name != "Expense" {
if v.Field(k).Interface() == "" {
col := strconv.Itoa(k + 1)
... ... @@ -1151,24 +1151,24 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba
}
// 分红退货单仓储初始化
var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository
if value, err := factory.CreateDividendsReturnedOrderRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
dividendsReturnedOrderRepository = value
}
//var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository
//if value, err := factory.CreateDividendsReturnedOrderRepository(map[string]interface{}{
// "transactionContext": transactionContext,
//}); err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
//} else {
// dividendsReturnedOrderRepository = value
//}
// 分红预算单仓储初始化
var dividendsEstimateRepository domain.DividendsEstimateRepository
if value, err := factory.CreateDividendsEstimateRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
dividendsEstimateRepository = value
}
//var dividendsEstimateRepository domain.DividendsEstimateRepository
//if value, err := factory.CreateDividendsEstimateRepository(map[string]interface{}{
// "transactionContext": transactionContext,
//}); err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
//} else {
// dividendsEstimateRepository = value
//}
// 分红预算单DAO初始化
//var dividendsEstimateDao *dao.DividendsEstimateDao
... ... @@ -1181,14 +1181,14 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba
//}
// 分红退货单DAO初始化
//var dividendsReturnedOrderDao *dao.DividendsReturnedOrderDao
//if value, err := factory.CreateDividendsReturnedOrderDao(map[string]interface{}{
// "transactionContext": transactionContext,
//}); err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
//} else {
// dividendsReturnedOrderDao = value
//}
var dividendsReturnedOrderDao *dao.DividendsReturnedOrderDao
if value, err := factory.CreateDividendsReturnedOrderDao(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
} else {
dividendsReturnedOrderDao = value
}
dividendsOrderIds, err := utils.SliceAtoi(batchRemoveDividendsOrderCommand.DividendsOrderIds)
if err != nil {
... ... @@ -1205,51 +1205,51 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba
if count > 0 {
for _, dividendsOrder := range dividendsOrders {
// 校验分红订单是否有关联的退货单
//startCount := time.Now()
//if countReturnedOrder, _, err := dividendsReturnedOrderRepository.Find(map[string]interface{}{
// "dividendsOrderNumber": dividendsOrder.DividendsOrderNumber,
// "companyId": dividendsOrder.Company.CompanyId,
// "limit": 1,
// "offset": 0,
//}); err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
//} else {
// if countReturnedOrder > 0 {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的退货单,不可删除", dividendsOrder.DividendsOrderNumber))
// }
//}
//("退货单计数:", time.Since(startCount))
startCount := time.Now()
if countReturnedOrder, _, err := dividendsReturnedOrderRepository.Find(map[string]interface{}{
if returnedOrderExist, err := dividendsReturnedOrderDao.CheckDividendsReturnedOrderExist(map[string]interface{}{
"dividendsOrderNumber": dividendsOrder.DividendsOrderNumber,
"companyId": dividendsOrder.Company.CompanyId,
"limit": 1,
"offset": 0,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if countReturnedOrder > 0 {
if returnedOrderExist {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的退货单,不可删除", dividendsOrder.DividendsOrderNumber))
}
}
fmt.Println("退货单计数:", time.Since(startCount))
//startCount := time.Now()
//if returnedOrderExist, err := dividendsReturnedOrderDao.CheckDividendsReturnedOrderExist(map[string]interface{}{
// "dividendsOrderNumber": dividendsOrder.DividendsOrderNumber,
// 校验分红订单是否有分红预算
//startEstimateCount := time.Now()
//if countRelative, _, err2 := dividendsEstimateRepository.Find(map[string]interface{}{
// "companyId": dividendsOrder.Company.CompanyId,
//}); err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// "orgId": dividendsOrder.Org.OrgId,
// "orderOrReturnedOrderNum": dividendsOrder.DividendsOrderNumber,
// "limit": 1,
// "offset": 0,
// "isCanceled": false,
//}); err2 != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err2.Error())
//} else {
// if returnedOrderExist {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的退货单,不可删除", dividendsOrder.DividendsOrderNumber))
// if countRelative > 0 {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的预算单,不可删除", dividendsOrder.DividendsOrderNumber))
// }
//}
//fmt.Println("退货单计数:", time.Since(startCount))
// 校验分红订单是否有分红预算
startEstimateCount := time.Now()
if countRelative, _, err2 := dividendsEstimateRepository.Find(map[string]interface{}{
"companyId": dividendsOrder.Company.CompanyId,
"orgId": dividendsOrder.Org.OrgId,
"orderOrReturnedOrderNum": dividendsOrder.DividendsOrderNumber,
"limit": 1,
"offset": 0,
"isCanceled": false,
}); err2 != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err2.Error())
} else {
if countRelative > 0 {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的预算单,不可删除", dividendsOrder.DividendsOrderNumber))
}
}
fmt.Println("预算单计数:", time.Since(startEstimateCount))
//("预算单计数:", time.Since(startEstimateCount))
//startEstimateCount := time.Now()
//if estimateOrderExist, err3 := dividendsEstimateDao.CheckDividendsEstimateOrderExist(map[string]interface{}{
... ... @@ -1265,6 +1265,10 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba
// }
//}
//fmt.Println("预算单计数:", time.Since(startEstimateCount))
if dividendsOrder.DividendStatus != 1 {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的预算单,不可删除", dividendsOrder.DividendsOrderNumber))
}
}
fmt.Println("截止目前耗时2:", time.Since(start))
... ... @@ -1272,6 +1276,7 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
fmt.Println("截止目前耗时3:", time.Since(start))
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -445,7 +445,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
t := reflect.TypeOf(dividendsReturnedOrder)
v := reflect.ValueOf(dividendsReturnedOrder)
for k := 0; k < t.NumField(); k++ {
//fmt.Println("name:", fmt.Sprintf("%+v", t.Field(k).Name), ", value:", fmt.Sprintf("%v", v.Field(k).Interface()))
//("name:", fmt.Sprintf("%+v", t.Field(k).Name), ", value:", fmt.Sprintf("%v", v.Field(k).Interface()))
//if t.Field(k).Name != "RegionName" {
if v.Field(k).Interface() == "" {
col := strconv.Itoa(k + 1)
... ...
... ... @@ -3,6 +3,9 @@ package subscriber
import (
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/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/event"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log"
)
type MessageServiceSubscriber struct {
... ... @@ -10,11 +13,157 @@ type MessageServiceSubscriber struct {
}
func (subscriber *MessageServiceSubscriber) HandleEvent(domainEvent coreDomain.DomainEvent) error {
// 消息推送服务
messageServiceGateway, err := factory.CreateMessageServiceGateway(nil)
if err != nil {
log.Logger.Error("消息推送服务初始化", map[string]interface{}{
"err": err.Error(),
})
return nil
}
switch domainEvent.EventType() {
case event.COOPERATION_APPLICATION_AGREED: // 共创申请审核通过
cooperationApplicationAgreedEvent := domainEvent.(*event.CooperationApplicationAgreed)
data, err1 := messageServiceGateway.AgreeCooperationApplication(
cooperationApplicationAgreedEvent.CreationProjectId,
cooperationApplicationAgreedEvent.CreationProjectName,
cooperationApplicationAgreedEvent.CreationProjectNumber,
cooperationApplicationAgreedEvent.UserId,
cooperationApplicationAgreedEvent.UserBaseId,
cooperationApplicationAgreedEvent.OrgId,
cooperationApplicationAgreedEvent.CompanyId,
)
if err1 != nil {
log.Logger.Error("推送消息错误", map[string]interface{}{
"err": err1.Error(),
})
return nil
} else {
log.Logger.Info("推送数据返回", data)
}
break
case event.CREATION_CONTRACT_INFORM_JOINT: // 共创确认
creationContractInformJointEvent := domainEvent.(*event.CreationContractInformJoint)
data, err2 := messageServiceGateway.InformJoinCreationContract(
creationContractInformJointEvent.CreationContractId,
creationContractInformJointEvent.CreationContractName,
creationContractInformJointEvent.CreationContractNumber,
creationContractInformJointEvent.CreationProjectId,
creationContractInformJointEvent.CreationProjectName,
creationContractInformJointEvent.UserId,
creationContractInformJointEvent.UserBaseId,
creationContractInformJointEvent.OrgId,
creationContractInformJointEvent.CompanyId,
)
if err2 != nil {
log.Logger.Error("推送消息错误", map[string]interface{}{
"err": err2.Error(),
})
return nil
} else {
log.Logger.Info("推送数据返回", data)
}
break
case event.COOPERATION_APPLICATION_REJECTED: // 共创申请审核拒绝
cooperationApplicationRejectedEvent := domainEvent.(*event.CooperationApplicationRejected)
data, err3 := messageServiceGateway.RejectCooperationApplication(
cooperationApplicationRejectedEvent.CreationProjectId,
cooperationApplicationRejectedEvent.CreationProjectName,
cooperationApplicationRejectedEvent.CreationProjectNumber,
cooperationApplicationRejectedEvent.UserId,
cooperationApplicationRejectedEvent.UserBaseId,
cooperationApplicationRejectedEvent.OrgId,
cooperationApplicationRejectedEvent.CompanyId,
)
if err3 != nil {
log.Logger.Error("推送消息错误", map[string]interface{}{
"err": err3.Error(),
})
return nil
} else {
log.Logger.Info("推送数据返回", data)
}
break
case event.CREDIT_ACCOUNT_PAID: // 账期结算支付
creditAccountPaidEvent := domainEvent.(*event.CreditAccountPaid)
data, err4 := messageServiceGateway.PayCreditAccount(
creditAccountPaidEvent.CreditAccountOrderNum,
creditAccountPaidEvent.SettlementAmount,
creditAccountPaidEvent.CreditAccountId,
creditAccountPaidEvent.DividendsEstimateId,
creditAccountPaidEvent.DividendsEstimateOrderNumber,
creditAccountPaidEvent.UserId,
creditAccountPaidEvent.UserBaseId,
creditAccountPaidEvent.OrgId,
creditAccountPaidEvent.CompanyId,
)
if err4 != nil {
log.Logger.Error("推送消息错误", map[string]interface{}{
"err": err4.Error(),
})
return nil
} else {
log.Logger.Info("推送数据返回", data)
}
break
case event.DIVIDENDS_ESTIMATED: // 账期结算
dividendsEstimatedEvent := domainEvent.(*event.DividendsEstimated)
data, err5 := messageServiceGateway.DividendsEstimate(
dividendsEstimatedEvent.CreditAccountOrderNum,
dividendsEstimatedEvent.SettlementAmount,
dividendsEstimatedEvent.CreditAccountId,
dividendsEstimatedEvent.DividendsEstimateId,
dividendsEstimatedEvent.DividendsEstimateOrderNumber,
dividendsEstimatedEvent.UserId,
dividendsEstimatedEvent.UserBaseId,
dividendsEstimatedEvent.OrgId,
dividendsEstimatedEvent.CompanyId,
)
if err5 != nil {
log.Logger.Error("推送消息错误", map[string]interface{}{
"err": err5.Error(),
})
return nil
} else {
log.Logger.Info("推送数据返回", data)
}
break
case event.DIVIDENDS_INFORM_EXPECTED: // 分红预算
dividendsInformExpectedEvent := domainEvent.(*event.DividendsInformExpected)
data, err6 := messageServiceGateway.InformExpectedDividends(
dividendsInformExpectedEvent.CreationContractId,
dividendsInformExpectedEvent.CreationContractName,
dividendsInformExpectedEvent.CreationContractNumber,
dividendsInformExpectedEvent.CreationProjectId,
dividendsInformExpectedEvent.CreationProjectName,
dividendsInformExpectedEvent.ProductName,
dividendsInformExpectedEvent.UserId,
dividendsInformExpectedEvent.UserBaseId,
dividendsInformExpectedEvent.OrgId,
dividendsInformExpectedEvent.CompanyId,
dividendsInformExpectedEvent.DividendsEstimateId,
dividendsInformExpectedEvent.DividendsAmount,
)
if err6 != nil {
log.Logger.Error("推送消息错误", map[string]interface{}{
"err": err6.Error(),
})
return nil
} else {
log.Logger.Info("推送数据返回", data)
}
break
}
return nil
}
func (subscriber *MessageServiceSubscriber) SubscribedToEventTypes() []string {
return []string{
//event.CONFERENCE_MESSAGE, // 日程预约消息通知
event.COOPERATION_APPLICATION_AGREED, // 同意共创申请
event.CREATION_CONTRACT_INFORM_JOINT, // 确认共创
event.COOPERATION_APPLICATION_REJECTED, // 拒绝共创申请
event.CREDIT_ACCOUNT_PAID, // 账期支付
event.DIVIDENDS_ESTIMATED, // 账期结算
event.DIVIDENDS_INFORM_EXPECTED, // 分红预算
}
}
... ...
package event
import coreDomain "github.com/linmadan/egglib-go/core/domain"
const COOPERATION_APPLICATION_AGREED = "=cooperation-application-agreed"
type CooperationApplicationAgreed struct {
coreDomain.BaseEvent
// 共创项目ID
CreationProjectId int64 `json:"creationProjectId"`
// 共创项目名称
CreationProjectName string `json:"creationProjectName"`
// 共创项目编号
CreationProjectNumber string `json:"creationProjectNumber"`
// 申请人ID
UserId int64 `json:"userId"`
// 申请人基础ID
UserBaseId int64 `json:"userBaseId"`
// 组织机构ID
OrgId int64 `json:"orgId"`
// 公司ID
CompanyId int64 `json:"companyId"`
}
func (event *CooperationApplicationAgreed) EventType() string {
return COOPERATION_APPLICATION_AGREED
}
... ...
package event
import coreDomain "github.com/linmadan/egglib-go/core/domain"
const COOPERATION_APPLICATION_REJECTED = "cooperation-application-rejected"
type CooperationApplicationRejected struct {
coreDomain.BaseEvent
// 共创项目ID
CreationProjectId int64 `json:"creationProjectId"`
// 共创项目名称
CreationProjectName string `json:"creationProjectName"`
// 共创项目编号
CreationProjectNumber string `json:"creationProjectNumber"`
// 申请人ID
UserId int64 `json:"userId"`
// 申请人基础ID
UserBaseId int64 `json:"userBaseId"`
// 组织机构ID
OrgId int64 `json:"orgId"`
// 公司ID
CompanyId int64 `json:"companyId"`
}
func (event *CooperationApplicationRejected) EventType() string {
return COOPERATION_APPLICATION_REJECTED
}
... ...
package event
import coreDomain "github.com/linmadan/egglib-go/core/domain"
const CREATION_CONTRACT_INFORM_JOINT = "creation-contract-inform-joint"
type CreationContractInformJoint struct {
coreDomain.BaseEvent
// 共创合约ID
CreationContractId int64 `json:"creationContractId"`
// 共创合约名称
CreationContractName string `json:"creationContractName"`
// 共创合约编号
CreationContractNumber string `json:"creationContractNumber"`
// 共创项目ID
CreationProjectId int64 `json:"creationProjectId"`
// 共创项目名称
CreationProjectName string `json:"creationProjectName"`
// 申请人ID
UserId int64 `json:"userId"`
// 申请人基础ID
UserBaseId int64 `json:"userBaseId"`
// 组织机构ID
OrgId int64 `json:"orgId"`
// 公司ID
CompanyId int64 `json:"companyId"`
}
func (event *CreationContractInformJoint) EventType() string {
return CREATION_CONTRACT_INFORM_JOINT
}
... ...
package event
import coreDomain "github.com/linmadan/egglib-go/core/domain"
const CREDIT_ACCOUNT_PAID = "credit-account-paid"
type CreditAccountPaid struct {
coreDomain.BaseEvent
// 账期结算单编号
CreditAccountOrderNum string `json:"creditAccountOrderNum"`
// 结算金额
SettlementAmount string `json:"settlementAmount"`
// 账期结算单ID
CreditAccountId int64 `json:"creditAccountId"`
// 分红预算单ID
DividendsEstimateId int64 `json:"dividendsEstimateId"`
// 分红预算单编号
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
// 申请人ID
UserId int64 `json:"userId"`
// 申请人基础ID
UserBaseId int64 `json:"userBaseId"`
// 组织机构ID
OrgId int64 `json:"orgId"`
// 公司ID
CompanyId int64 `json:"companyId"`
}
func (event *CreditAccountPaid) EventType() string {
return CREDIT_ACCOUNT_PAID
}
... ...
package event
import coreDomain "github.com/linmadan/egglib-go/core/domain"
const DIVIDENDS_ESTIMATED = "dividends-estimated"
type DividendsEstimated struct {
coreDomain.BaseEvent
// 账期结算单编号
CreditAccountOrderNum string `json:"creditAccountOrderNum"`
// 结算金额
SettlementAmount string `json:"settlementAmount"`
// 账期结算单ID
CreditAccountId int64 `json:"creditAccountId"`
// 分红预算单ID
DividendsEstimateId int64 `json:"dividendsEstimateId"`
// 分红预算单编号
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
// 申请人ID
UserId int64 `json:"userId"`
// 申请人基础ID
UserBaseId int64 `json:"userBaseId"`
// 组织机构ID
OrgId int64 `json:"orgId"`
// 公司ID
CompanyId int64 `json:"companyId"`
}
func (event *DividendsEstimated) EventType() string {
return DIVIDENDS_ESTIMATED
}
... ...
package event
import coreDomain "github.com/linmadan/egglib-go/core/domain"
const DIVIDENDS_INFORM_EXPECTED = "dividends-inform-expected"
type DividendsInformExpected struct {
coreDomain.BaseEvent
// 共创合约ID
CreationContractId int64 `json:"creationContractId"`
// 共创合约名称
CreationContractName string `json:"creationContractName"`
// 共创合约编号
CreationContractNumber string `json:"creationContractNumber"`
// 共创项目ID
CreationProjectId int64 `json:"creationProjectId"`
// 共创项目名称
CreationProjectName string `json:"creationProjectName"`
// 产品名称
ProductName string `json:"productName"`
// 申请人ID
UserId int64 `json:"userId"`
// 申请人基础ID
UserBaseId int64 `json:"userBaseId"`
// 组织机构ID
OrgId int64 `json:"orgId"`
// 公司ID
CompanyId int64 `json:"companyId"`
// 分红预算单ID
DividendsEstimateId int64 `json:"dividendsEstimateId"`
// 分红金额
DividendsAmount string `json:"dividendsAmount"`
}
func (event *DividendsInformExpected) EventType() string {
return DIVIDENDS_ESTIMATED
}
... ...
package service
import coreDomain "github.com/linmadan/egglib-go/core/domain"
type AgreeContractApplicationService interface {
coreDomain.DomainEventPublisher
Agree() error
}
... ...
package service
import coreDomain "github.com/linmadan/egglib-go/core/domain"
type RejectContractApplicationService interface {
coreDomain.DomainEventPublisher
Reject() error
}
... ...
... ... @@ -145,15 +145,23 @@ func (dao *CooperationContractDao) SearchCooperationContractByUndertaker(queryOp
query = query.Where(`A.cooperation_contract_sponsor->>'userName')::text LIKE ?`, fmt.Sprintf("%%%s%%", sponsorName))
}
if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
query.Where("cooperation_contract_undertaker.company->>'companyId' = '?'", companyId)
query.Where("A.company->>'companyId' = '?'", companyId)
query.Where("B.company->>'companyId' = '?'", companyId)
}
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("cooperation_contract_undertaker.org->>'orgId' = '?'", orgId)
query.Where("A.org->>'orgId' = '?'", orgId)
query.Where("B.org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("cooperation_contract_undertaker.org->>'orgId' in (?)", pg.In(newOrgIds))
query.Where("A.org->>'orgId' in (?)", pg.In(newOrgIds))
query.Where("B.org->>'orgId' in (?)", pg.In(newOrgIds))
}
query.Where("A.deleted_at IS NULL")
query.Where("B.deleted_at IS NULL")
query.Join("JOIN cooperation_contracts AS A ON A.cooperation_contract_number = cooperation_contract_undertaker.cooperation_contract_number")
query.Join("JOIN cooperation_modes AS B ON B.cooperation_mode_number = A.cooperation_mode_number")
query = query.Order("cooperation_contract_undertaker_id DESC")
... ...
... ... @@ -178,7 +178,7 @@ func (service *UserService) VisitorFrom(companyId int64, orgId int64, userBaseId
if userAdaptor, err := adaptor.NewUserAdaptor(); err != nil {
return nil, err
} else {
if visitor, err := userAdaptor.ToParticipator(companyId, orgId, userBaseId, "Visitor"); err != nil {
if visitor, err := userAdaptor.ToVisitor(companyId, orgId, userBaseId); err != nil {
return nil, err
} else {
if visitor != nil {
... ...
... ... @@ -6,7 +6,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
)
func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel *models.DividendsOrder, goods []*models.OrderGood) (*domain.DividendsOrder, error) {
func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModels []*models.DividendsOrder, goods []*models.OrderGood) ([]*domain.DividendsOrder, error) {
var orderGoods []*domain.OrderGood
for _, good := range goods {
orderGoodAmount, _ := decimal.NewFromFloatWithExponent(good.OrderGoodAmount, -2).Float64()
... ... @@ -16,18 +16,24 @@ func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel *model
OrderGoodName: good.OrderGoodName,
OrderGoodPrice: good.OrderGoodPrice,
OrderGoodQuantity: good.OrderGoodQuantity,
DividendsOrderNumber: good.DividendsReturnedOrderNumber,
DividendsReturnedOrderNumber: good.DividendsOrderNumber,
DividendsOrderNumber: good.DividendsOrderNumber,
DividendsReturnedOrderNumber: good.DividendsReturnedOrderNumber,
CooperationContractNumber: good.CooperationContractNumber,
OrderGoodDividendsStatus: good.OrderGoodDividendsStatus,
OrderGoodExpense: good.OrderGoodExpense,
OrgId: good.OrgId,
CompanyId: good.CompanyId,
CreatedAt: good.CreatedAt,
DeletedAt: good.DeletedAt,
UpdatedAt: good.UpdatedAt,
})
}
var dividendsOrders []*domain.DividendsOrder
for _, dividendsOrderModel := range dividendsOrderModels {
dividendsOrderAmount, _ := decimal.NewFromFloatWithExponent(dividendsOrderModel.DividendsOrderAmount, -2).Float64()
return &domain.DividendsOrder{
dividendsOrder := &domain.DividendsOrder{
DividendsOrderId: dividendsOrderModel.DividendsOrderId,
DividendsOrderNumber: dividendsOrderModel.DividendsOrderNumber,
DividendsOriginalOrderNum: dividendsOrderModel.DividendsOriginalOrderNum,
... ... @@ -38,7 +44,6 @@ func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel *model
Region: dividendsOrderModel.Region,
CustomerName: dividendsOrderModel.CustomerName,
Org: dividendsOrderModel.Org,
Goods: orderGoods,
Company: dividendsOrderModel.Company,
CreatedAt: dividendsOrderModel.CreatedAt,
DeletedAt: dividendsOrderModel.DeletedAt,
... ... @@ -46,5 +51,37 @@ func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel *model
OperateTime: dividendsOrderModel.OperateTime,
Operator: dividendsOrderModel.Operator,
Remarks: dividendsOrderModel.Remarks,
}, nil
}
var newOrderGoods []*domain.OrderGood
for _, orderGood := range orderGoods {
if orderGood.CompanyId == dividendsOrder.Company.CompanyId && orderGood.DividendsOrderNumber == dividendsOrder.DividendsOrderNumber {
newOrderGoods = append(newOrderGoods, orderGood)
}
}
dividendsOrder.Goods = newOrderGoods
dividendsOrders = append(dividendsOrders, dividendsOrder)
}
return dividendsOrders, nil
//return &domain.DividendsOrder{
// DividendsOrderId: dividendsOrderModel.DividendsOrderId,
// DividendsOrderNumber: dividendsOrderModel.DividendsOrderNumber,
// DividendsOriginalOrderNum: dividendsOrderModel.DividendsOriginalOrderNum,
// DividendsOrderAmount: dividendsOrderAmount,
// OrderTime: dividendsOrderModel.OrderTime,
// DividendTime: dividendsOrderModel.DividendTime,
// DividendStatus: dividendsOrderModel.DividendStatus,
// Region: dividendsOrderModel.Region,
// CustomerName: dividendsOrderModel.CustomerName,
// Org: dividendsOrderModel.Org,
// Goods: orderGoods,
// Company: dividendsOrderModel.Company,
// CreatedAt: dividendsOrderModel.CreatedAt,
// DeletedAt: dividendsOrderModel.DeletedAt,
// UpdatedAt: dividendsOrderModel.UpdatedAt,
// OperateTime: dividendsOrderModel.OperateTime,
// Operator: dividendsOrderModel.Operator,
// Remarks: dividendsOrderModel.Remarks,
//}, nil
}
... ...
... ... @@ -402,10 +402,10 @@ func (repository *DividendsOrderRepository) SaveMany(dividendsOrders []*domain.D
return nil, fmt.Errorf("分红订单关联的产品不存在")
}
// 聚合分红订单
if dividendsOrder, err := transform.TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel, orderGoodModels); err != nil {
if dividendsOrder, err := transform.TransformToDividendsOrderDomainModelFromPgModels([]*models.DividendsOrder{dividendsOrderModel}, orderGoodModels); err != nil {
return dividendsOrders, err
} else {
dividendsOrders = append(dividendsOrders, dividendsOrder)
dividendsOrders = append(dividendsOrders, dividendsOrder...)
}
}
return dividendsOrdersSaved, nil
... ... @@ -488,14 +488,17 @@ func (repository *DividendsOrderRepository) BatchRemove(dividendsOrders []*domai
if _, err := tx.Model(&dividendsOrderModels).WherePK().Delete(); err != nil {
return dividendsOrders, err
} else {
var dividendsOrderNumbers []string
for _, dividendsOrder := range dividendsOrders {
dividendsOrderNumbers = append(dividendsOrderNumbers, dividendsOrder.DividendsOrderNumber)
}
// 删除订单产品
var orderGoodModels []*models.OrderGood
orderGoodQuery := tx.Model(&orderGoodModels)
if err := orderGoodQuery.
Where("company_id = ?", dividendsOrder.Company.CompanyId).
Where("org_id = ?", dividendsOrder.Org.OrgId).
Where("dividends_order_number = ?", dividendsOrder.DividendsOrderNumber).
Where("company_id = ?", dividendsOrders[0].Company.CompanyId).
Where("org_id = ?", dividendsOrders[0].Org.OrgId).
Where("dividends_order_number in (?)", pg.In(dividendsOrderNumbers)).
Select(); err != nil {
return nil, err
} else {
... ... @@ -506,7 +509,6 @@ func (repository *DividendsOrderRepository) BatchRemove(dividendsOrders []*domai
}
}
}
}
return dividendsOrders, nil
}
... ... @@ -548,7 +550,11 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte
return nil, fmt.Errorf("分红订单关联的产品不存在")
}
// 聚合分红订单
return transform.TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel, orderGoodModels)
result, err := transform.TransformToDividendsOrderDomainModelFromPgModels([]*models.DividendsOrder{dividendsOrderModel}, orderGoodModels)
if err != nil {
return nil, fmt.Errorf("分红订单不存在")
}
return result[0], nil
}
}
... ... @@ -591,26 +597,28 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa
return 0, dividendsOrders, err
} else {
if count > 0 {
var dividendsOrderNumbers []string
for _, dividendsOrderModel := range dividendsOrderModels {
dividendsOrderNumbers = append(dividendsOrderNumbers, dividendsOrderModel.DividendsOrderNumber)
}
//获取订单产品
var orderGoodModels []*models.OrderGood
orderGoodModelQuery := tx.Model(&orderGoodModels)
if err := orderGoodModelQuery.
Where("company_id = ?", dividendsOrderModel.Company.CompanyId).
Where("org_id = ?", dividendsOrderModel.Org.OrgId).
Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber).
Where("company_id = ?", dividendsOrderModels[0].Company.CompanyId).
//Where("org_id = ?", dividendsOrderModel.Org.OrgId).
Where("dividends_order_number in (?)", pg.In(dividendsOrderNumbers)).
Select(); err != nil {
log.Logger.Error("分红订单关联的产品不存在", map[string]interface{}{
"dividendsOrderModel": dividendsOrderModel,
})
//log.Logger.Error("分红订单关联的产品不存在", map[string]interface{}{
// "dividendsOrderModel": dividendsOrderModel,
//})
return 0, nil, fmt.Errorf("分红订单关联的产品不存在")
}
// 聚合分红订单
if dividendsOrder, err := transform.TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel, orderGoodModels); err != nil {
if dividendsOrder, err := transform.TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModels, orderGoodModels); err != nil {
return 0, dividendsOrders, err
} else {
dividendsOrders = append(dividendsOrders, dividendsOrder)
}
dividendsOrders = append(dividendsOrders, dividendsOrder...)
}
}
return int64(count), dividendsOrders, nil
... ...
... ... @@ -65,6 +65,23 @@ func (adaptor *UserAdaptor) ToParticipator(companyId int64, orgId int64, userId
return map[string]interface{}{}, nil
}
func (adaptor *UserAdaptor) ToVisitor(companyId int64, orgId int64, userBaseId int64) (interface{}, error) {
userServiceGateway := service_gateway.NewHttplibUserServiceGateway()
response, err := userServiceGateway.GetUserInfo(companyId, orgId, userBaseId)
if err != nil {
return map[string]interface{}{}, err
}
if userTranslator, err := translator.NewUserTranslator(); err != nil {
return map[string]interface{}{}, err
} else {
visitor, err := userTranslator.ToVisitorFromRepresentation(response)
if err != nil {
return map[string]interface{}{}, nil
}
return visitor, nil
}
}
func NewUserAdaptor() (*UserAdaptor, error) {
return &UserAdaptor{}, nil
}
... ...
... ... @@ -11,14 +11,25 @@ type HttplibBasicServiceGateway struct {
}
// AgreeCooperationApplication 同意共创申请
func (serviceGateway *HttplibBasicServiceGateway) AgreeCooperationApplication() (map[string]interface{}, error) {
func (serviceGateway *HttplibBasicServiceGateway) AgreeCooperationApplication(
creationProjectId int64,
creationProjectName string,
creationProjectNumber string,
userId int64,
userBaseId int64,
orgId int64,
companyId int64,
) (map[string]interface{}, error) {
url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/agree-join-creation-project"}, "/")
request := serviceGateway.createRequest(url, "post")
request.Header("companyId", "")
request.Header("userId", "")
request.Header("orgId", "")
request.Header("userBasic", "")
options := map[string]interface{}{}
options := make(map[string]interface{})
options["creationProjectId"] = creationProjectId
options["creationProjectName"] = creationProjectName
options["creationProjectNumber"] = creationProjectNumber
options["userId"] = userId
options["userBaseId"] = userBaseId
options["orgId"] = orgId
options["companyId"] = companyId
_, err := request.JSONBody(options)
if err != nil {
return nil, err
... ... @@ -33,14 +44,25 @@ func (serviceGateway *HttplibBasicServiceGateway) AgreeCooperationApplication()
}
// RejectCooperationApplication 拒绝共创申请
func (serviceGateway *HttplibBasicServiceGateway) RejectCooperationApplication() (map[string]interface{}, error) {
func (serviceGateway *HttplibBasicServiceGateway) RejectCooperationApplication(
creationProjectId int64,
creationProjectName string,
creationProjectNumber string,
userId int64,
userBaseId int64,
orgId int64,
companyId int64,
) (map[string]interface{}, error) {
url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/refuse-join-creation-project"}, "/")
request := serviceGateway.createRequest(url, "post")
request.Header("companyId", "")
request.Header("userId", "")
request.Header("orgId", "")
request.Header("userBasic", "")
options := make(map[string]interface{})
options["creationProjectId"] = creationProjectId
options["creationProjectName"] = creationProjectName
options["creationProjectNumber"] = creationProjectNumber
options["userId"] = userId
options["userBaseId"] = userBaseId
options["orgId"] = orgId
options["companyId"] = companyId
_, err2 := request.JSONBody(options)
if err2 != nil {
return nil, err2
... ... @@ -55,14 +77,35 @@ func (serviceGateway *HttplibBasicServiceGateway) RejectCooperationApplication()
}
// InformExpectedDividends 分红预算消息
func (serviceGateway *HttplibBasicServiceGateway) InformExpectedDividends() (map[string]interface{}, error) {
func (serviceGateway *HttplibBasicServiceGateway) InformExpectedDividends(
creationContractId int64,
creationContractName string,
creationContractNumber string,
creationProjectId int64,
creationProjectName string,
productName string,
userId int64,
userBaseId int64,
orgId int64,
companyId int64,
dividendsEstimateId int64,
dividendsAmount string,
) (map[string]interface{}, error) {
url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-expected-dividends"}, "/")
request := serviceGateway.createRequest(url, "post")
request.Header("companyId", "")
request.Header("userId", "")
request.Header("orgId", "")
request.Header("userBasic", "")
options := make(map[string]interface{})
options["creationContractId"] = creationContractId
options["creationContractName"] = creationContractName
options["creationContractNumber"] = creationContractNumber
options["creationProjectId"] = creationProjectId
options["creationProjectName"] = creationProjectName
options["productName"] = productName
options["userId"] = userId
options["userBaseId"] = userBaseId
options["orgId"] = orgId
options["companyId"] = companyId
options["dividendsEstimateId"] = dividendsEstimateId
options["dividendsAmount"] = dividendsAmount
_, err2 := request.JSONBody(options)
if err2 != nil {
return nil, err2
... ... @@ -77,10 +120,29 @@ func (serviceGateway *HttplibBasicServiceGateway) InformExpectedDividends() (map
}
// InformJoinCreationContract 确认共创
func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract() (map[string]interface{}, error) {
func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract(
creationContractId int64,
creationContractName string,
creationContractNumber string,
creationProjectId int64,
creationProjectName string,
userId int64,
userBaseId int64,
orgId int64,
companyId int64,
) (map[string]interface{}, error) {
url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-join-creation-contract"}, "/")
request := serviceGateway.createRequest(url, "post")
options := make(map[string]interface{})
options["creationContractId"] = creationContractId
options["creationContractName"] = creationContractName
options["creationContractNumber"] = creationContractNumber
options["creationProjectId"] = creationProjectId
options["creationProjectName"] = creationProjectName
options["userId"] = userId
options["userBaseId"] = userBaseId
options["orgId"] = orgId
options["companyId"] = companyId
_, err2 := request.JSONBody(options)
if err2 != nil {
return nil, err2
... ... @@ -95,14 +157,29 @@ func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract() (
}
// PayCreditAccount 账期支付
func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount() (map[string]interface{}, error) {
func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount(
creditAccountOrderNum string,
settlementAmount string,
creditAccountId int64,
dividendsEstimateId int64,
dividendsEstimateOrderNumber string,
userId int64,
userBaseId int64,
orgId int64,
companyId int64,
) (map[string]interface{}, error) {
url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/notice-personal/credit-account/payment"}, "/")
request := serviceGateway.createRequest(url, "post")
request.Header("companyId", "")
request.Header("userId", "")
request.Header("orgId", "")
request.Header("userBasic", "")
options := make(map[string]interface{})
options["creditAccountOrderNum"] = creditAccountOrderNum
options["settlementAmount"] = settlementAmount
options["creditAccountId"] = creditAccountId
options["dividendsEstimateId"] = dividendsEstimateId
options["dividendsEstimateOrderNumber"] = dividendsEstimateOrderNumber
options["userId"] = userId
options["userBaseId"] = userBaseId
options["orgId"] = orgId
options["companyId"] = companyId
_, err2 := request.JSONBody(options)
if err2 != nil {
return nil, err2
... ... @@ -117,14 +194,29 @@ func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount() (map[string
}
// DividendsEstimate 分红预算
func (serviceGateway *HttplibBasicServiceGateway) DividendsEstimate() (map[string]interface{}, error) {
func (serviceGateway *HttplibBasicServiceGateway) DividendsEstimate(
creditAccountOrderNum string,
settlementAmount string,
creditAccountId int64,
dividendsEstimateId int64,
dividendsEstimateOrderNumber string,
userId int64,
userBaseId int64,
orgId int64,
companyId int64,
) (map[string]interface{}, error) {
url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/credit-account/dividends-estimate"}, "/")
request := serviceGateway.createRequest(url, "post")
request.Header("companyId", "")
request.Header("userId", "")
request.Header("orgId", "")
request.Header("userBasic", "")
options := make(map[string]interface{})
options["creditAccountOrderNum"] = creditAccountOrderNum
options["settlementAmount"] = settlementAmount
options["creditAccountId"] = creditAccountId
options["dividendsEstimateId"] = dividendsEstimateId
options["dividendsEstimateOrderNumber"] = dividendsEstimateOrderNumber
options["userId"] = userId
options["userBaseId"] = userBaseId
options["orgId"] = orgId
options["companyId"] = companyId
_, err2 := request.JSONBody(options)
if err2 != nil {
return nil, err2
... ...
... ... @@ -13,10 +13,10 @@ type UserServiceGateway interface {
}
type BasicServiceGateway interface {
AgreeCooperationApplication() (map[string]interface{}, error)
RejectCooperationApplication() (map[string]interface{}, error)
InformExpectedDividends() (map[string]interface{}, error)
InformJoinCreationContract() (map[string]interface{}, error)
PayCreditAccount() (map[string]interface{}, error)
DividendsEstimate() (map[string]interface{}, error)
AgreeCooperationApplication(creationProjectId int64, creationProjectName string, creationProjectNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error)
RejectCooperationApplication(creationProjectId int64, creationProjectName string, creationProjectNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error)
InformExpectedDividends(creationContractId int64, creationContractName string, creationContractNumber string, creationProjectId int64, creationProjectName string, productName string, userId int64, userBaseId int64, orgId int64, companyId int64, dividendsEstimateId int64, dividendsAmount string) (map[string]interface{}, error)
InformJoinCreationContract(creationContractId int64, creationContractName string, creationContractNumber string, creationProjectId int64, creationProjectName string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error)
PayCreditAccount(creditAccountOrderNum string, settlementAmount string, creditAccountId int64, dividendsEstimateId int64, dividendsEstimateOrderNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error)
DividendsEstimate(creditAccountOrderNum string, settlementAmount string, creditAccountId int64, dividendsEstimateId int64, dividendsEstimateOrderNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error)
}
... ...
package utils
import (
"fmt"
"strconv"
"time"
)
... ... @@ -48,6 +47,6 @@ func TransformTimestampToTime(timeStamp int64) time.Time {
ipart, _ := strconv.ParseInt(tIpartStr, 10, 64)
//decpart, _ := strconv.ParseInt(tDecpartStr, 10, 64)
myTime := time.Unix(ipart, 0)
fmt.Println(myTime)
//(myTime)
return time.Date(myTime.Year(), myTime.Month(), myTime.Day(), myTime.Hour(), myTime.Minute(), myTime.Second(), 0, time.Local)
}
... ...
... ... @@ -99,19 +99,19 @@ func NewBeegoLog(conf LoggerConfig) *BeegoLog {
confByte, _ := json.Marshal(conf)
err := logger.SetLogger(logs.AdapterFile, string(confByte))
if err != nil {
fmt.Println(err.Error())
(err.Error())
return nil
}
} else if constant.LOG_TYPE == "es" { // 日志存储到ES
err := logger.SetLogger(logs.AdapterEs, `{"dsn":"http://192.168.100.222:9200/","level":7}`)
if err != nil {
fmt.Println(err.Error())
(err.Error())
return nil
}
} else { // 日志输出到控制台
err := logger.SetLogger(logs.AdapterConsole, `{"level":7,"color":true}`)
if err != nil {
fmt.Println(err.Error())
(err.Error())
return nil
}
}
... ...