作者 陈志颖

Merge branch 'dev-chenzhiying' into dev

... ... @@ -262,6 +262,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
SalesmanPercentage: dividendsIncentivesRule.SalesmanPercentage,
DividendsIncentivesPercentage: dividendsIncentivesRule.DividendsIncentivesPercentage,
DividendsIncentivesStage: dividendsIncentivesRule.DividendsIncentivesStage,
DividendsIncentivesStageCN: utils.NumberToCNNumber(int(dividendsIncentivesRule.DividendsIncentivesStage)),
DividendsIncentivesStageEnd: dividendsIncentivesRule.DividendsIncentivesStageEnd,
DividendsIncentivesStageStart: dividendsIncentivesRule.DividendsIncentivesStageStart,
Org: organization,
... ... @@ -281,6 +282,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
CooperationContractNumber: contractNumber,
MoneyIncentivesAmount: moneyIncentivesRule.MoneyIncentivesAmount,
MoneyIncentivesStage: moneyIncentivesRule.MoneyIncentivesStage,
MoneyIncentivesStageCN: utils.NumberToCNNumber(int(moneyIncentivesRule.MoneyIncentivesStage)),
MoneyIncentivesStageEnd: moneyIncentivesRule.MoneyIncentivesStageEnd,
MoneyIncentivesStageStart: moneyIncentivesRule.MoneyIncentivesStageStart,
MoneyIncentivesTime: moneyIncentivesRule.MoneyIncentivesTime,
... ... @@ -1117,6 +1119,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
SalesmanPercentage: dividendsIncentivesRule.SalesmanPercentage,
DividendsIncentivesPercentage: dividendsIncentivesRule.DividendsIncentivesPercentage,
DividendsIncentivesStage: dividendsIncentivesRule.DividendsIncentivesStage,
DividendsIncentivesStageCN: utils.NumberToCNNumber(int(dividendsIncentivesRule.DividendsIncentivesStage)),
DividendsIncentivesStageEnd: dividendsIncentivesRule.DividendsIncentivesStageEnd,
DividendsIncentivesStageStart: dividendsIncentivesRule.DividendsIncentivesStageStart,
Org: organization,
... ... @@ -1143,6 +1146,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
CooperationContractNumber: cooperationContract.CooperationContractNumber,
MoneyIncentivesAmount: moneyIncentivesRule.MoneyIncentivesAmount,
MoneyIncentivesStage: moneyIncentivesRule.MoneyIncentivesStage,
MoneyIncentivesStageCN: utils.NumberToCNNumber(int(moneyIncentivesRule.MoneyIncentivesStage)),
MoneyIncentivesStageEnd: moneyIncentivesRule.MoneyIncentivesStageEnd,
MoneyIncentivesStageStart: moneyIncentivesRule.MoneyIncentivesStageStart,
MoneyIncentivesTime: moneyIncentivesRule.MoneyIncentivesTime,
... ...
... ... @@ -175,6 +175,8 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
"orgId": createCooperationProjectCommand.OrgId,
"cooperationProjectNumber": projectNumber,
})
// TODO 校验共创项目名称是否唯一
if !numberAvailable {
return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增共创项目异常")
}
... ...
... ... @@ -10,7 +10,7 @@ type DividendsReturnedOrder struct {
// 分红退货单记录ID
DividendsReturnedOrderId int64 `comment:"分红退货单记录ID" pg:",pk"`
// 分红退货单号
DividendsReturnedOrderNumber string `comment:"分红退货单号"`
DividendsReturnedOrderNumber string `comment:"分红退货单号" pg:",unique"`
// 退货金额
DividendsReturnedOrderRefund float64 `comment:"退货金额"`
// 源单号(原始订单号)
... ...
... ... @@ -234,6 +234,8 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
if cooperationProjectName, ok := queryOptions["cooperationProjectName"]; ok && cooperationProjectName != "" {
query.Join("LEFT JOIN cooperation_projects AS a").
JoinOn("a.cooperation_project_number = cooperation_application.cooperation_project_number").
JoinOn("a.company->>'companyId' = cooperation_application.company->>'companyId'").
JoinOn("a.org->>'orgId' = cooperation_application.org->>'orgId'").
Where("a.cooperation_project_name like ?", fmt.Sprintf("%%%s%%", cooperationProjectName))
}
if applicantName, ok := queryOptions["applicantName"]; ok && applicantName != "" {
... ... @@ -254,14 +256,14 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
}
}
if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
query.Where("company->>'companyId' = '?'", companyId)
query.Where("cooperation_application.company->>'companyId' = '?'", companyId)
}
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
query.Where("cooperation_application.org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
query.Where("cooperation_application.org->>'orgId' in (?)", pg.In(newOrgIds))
}
offsetLimitFlag := true
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
... ... @@ -271,7 +273,7 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("cooperation_application_id", "DESC")
query.SetOrderDirect("created_at", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, cooperationApplications, err
} else {
... ...