作者 陈志颖

fix:修复共创合约参数

... ... @@ -71,7 +71,7 @@ type CreateCooperationContractCommand struct {
// 承接方列表
Undertakers []*CreateUndertakersCommand `cname:"承接方列表" json:"undertakers,omitempty"`
// 相关人列表
RelevantPeople []string `cname:"相关人列表" json:"relevantPeople,omitempty"`
RelevantIds []string `cname:"相关人列表" json:"relevantIds,omitempty"`
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
// 组织机构ID
... ...
... ... @@ -175,7 +175,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
// 获取相关人
var relevantPeople []*domain.Relevant
for _, relevantPersonUid := range createCooperationContractCommand.RelevantPeople {
for _, relevantPersonUid := range createCooperationContractCommand.RelevantIds {
var relevantDomain *domain.Relevant
relevantUid, _ := strconv.ParseInt(relevantPersonUid, 10, 64)
if data, err := userService.RelevantFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, relevantUid); err != nil {
... ...
package dto
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
"time"
)
type DividendsIncentivesEstimateDto struct {
// 分红订单产品ID
OrderGoodId int64 `json:"orderGoodId,string"`
// 共创合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
// 分红订单号或退货单号、
OrderNumber string `json:"orderNumber"`
// 来源单号
OriginalOrderNum string `json:"originalOrderNum"`
// 客户名称
CustomerName string `json:"customerName"`
// 订单区域
RegionName string `json:"region"`
// 订单金额
OrderAmount float64 `json:"orderAmount"`
// 订单/退货单日期
OrderDate string `json:"orderDate"`
}
func (dto *DividendsIncentivesEstimateDto) LoadDto(orderGood *domain.OrderGood, orderNumber string, originalOrderNum string, customerName string, regionName string, orderDate time.Time) error {
dto.OrderGoodId = orderGood.OrderGoodId
dto.CooperationContractNumber = orderGood.CooperationContractNumber
dto.OrderNumber = orderNumber
dto.OriginalOrderNum = originalOrderNum
dto.CustomerName = customerName
dto.RegionName = regionName
dto.OrderAmount = orderGood.OrderGoodAmount
dto.OrderDate = orderDate.String()
return nil
}
... ...
package dto
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
"time"
)
type StageAndUndertaker struct {
// 分红阶段
Stage int32 `json:"stage"`
}
type MoneyIncentivesEstimateDto struct {
// 共创合约ID
CooperationContractId int64 `json:"cooperationContractId,string"`
// 共创合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
// 共创合约名称
CooperationContractName string `json:"cooperationContractName"`
// 共创模式或者合伙模式
CooperationMode *domain.CooperationMode `json:"cooperationMode"`
// 共创合约发起部门
Department *domain.Department `json:"department"`
// 共创合约发起人
CooperationContractSponsor *domain.User `json:"cooperationContractSponsor"`
// 创建合约时间
CreatedAt time.Time `json:"createdAt"`
// 阶段和承接人
StageAndUndertaker *StageAndUndertaker `json:"stageAndUndertaker"`
}
func (dto *MoneyIncentivesEstimateDto) LoadDto(contract *domain.CooperationContract) error {
dto.CooperationContractId = contract.CooperationContractId
return nil
}
... ...
... ... @@ -17,6 +17,48 @@ import (
type DividendsEstimateService struct {
}
// ListDividendsIncentivesEstimate 返回业绩激励分红预算信息列表
func (dividendsEstimateService *DividendsEstimateService) ListDividendsIncentivesEstimate(listDividendsIncentivesEstimateQuery *query.ListDividendsIncentivesEstimateQuery) (interface{}, error) {
if err := listDividendsIncentivesEstimateQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return nil, nil
}
// ListMoneyIncentivesEstimate 返回金额激励分红预算信息列表
func (dividendsEstimateService *DividendsEstimateService) ListMoneyIncentivesEstimate(listMoneyIncentivesEstimateQuery *query.ListMoneyIncentivesEstimateQuery) (interface{}, error) {
if err := listMoneyIncentivesEstimateQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return nil, nil
}
// CancelDividendsEstimate 取消分红预算单
func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimate(cancelDividendsEstimateCommand *command.CancelDividendsEstimateCommand) (interface{}, error) {
if err := cancelDividendsEstimateCommand.ValidateCommand(); err != nil {
... ... @@ -278,48 +320,6 @@ func (dividendsEstimateService *DividendsEstimateService) ListDividendsEstimate(
}
}
// ListDividendsIncentivesEstimate 返回业绩激励分红预算列表
func (dividendsEstimateService *DividendsEstimateService) ListDividendsIncentivesEstimate(listDividendsIncentivesEstimateQuery *query.ListDividendsIncentivesEstimateQuery) (interface{}, error) {
if err := listDividendsIncentivesEstimateQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return nil, nil
}
// ListMoneyIncentivesEstimate 返回金额激励分红预算列表
func (dividendsEstimateService *DividendsEstimateService) ListMoneyIncentivesEstimate(listMoneyIncentivesEstimateQuery *query.ListMoneyIncentivesEstimateQuery) (interface{}, error) {
if err := listMoneyIncentivesEstimateQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return nil, nil
}
// RemoveDividendsEstimate 移除分红预算单(预留)
func (dividendsEstimateService *DividendsEstimateService) RemoveDividendsEstimate(removeDividendsEstimateCommand *command.RemoveDividendsEstimateCommand) (interface{}, error) {
if err := removeDividendsEstimateCommand.ValidateCommand(); err != nil {
... ...
... ... @@ -28,6 +28,8 @@ type CooperationContract struct {
Org *Org `json:"org"`
// 公司
Company *Company `json:"company"`
// 共创合约发起部门
Department *Department `json:"department"`
// 操作人
Operator *User `json:"operator"`
// 分红激励规则
... ...
... ... @@ -29,6 +29,8 @@ type CooperationContract struct {
Org *domain.Org `comment:"数据所属组织机构"`
// 公司
Company *domain.Company `comment:"公司"`
// 共创合约发起部门
Department *domain.Department `comment:"共创合约发起部门"`
// 操作人
Operator *domain.User `comment:"操作人"`
// 操作时间
... ...
... ... @@ -120,6 +120,7 @@ func TransformToCooperationContractDomainModelFromPgModels(
Status: cooperationContractModel.Status,
Org: cooperationContractModel.Org,
Company: cooperationContractModel.Company,
Department: cooperationContractModel.Department,
Operator: cooperationContractModel.Operator,
OperateTime: cooperationContractModel.OperateTime,
CreatedAt: cooperationContractModel.CreatedAt,
... ...