作者 陈志颖

fix:根据共创项目名称查询申请

@@ -262,6 +262,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -262,6 +262,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
262 SalesmanPercentage: dividendsIncentivesRule.SalesmanPercentage, 262 SalesmanPercentage: dividendsIncentivesRule.SalesmanPercentage,
263 DividendsIncentivesPercentage: dividendsIncentivesRule.DividendsIncentivesPercentage, 263 DividendsIncentivesPercentage: dividendsIncentivesRule.DividendsIncentivesPercentage,
264 DividendsIncentivesStage: dividendsIncentivesRule.DividendsIncentivesStage, 264 DividendsIncentivesStage: dividendsIncentivesRule.DividendsIncentivesStage,
  265 + DividendsIncentivesStageCN: utils.NumberToCNNumber(int(dividendsIncentivesRule.DividendsIncentivesStage)),
265 DividendsIncentivesStageEnd: dividendsIncentivesRule.DividendsIncentivesStageEnd, 266 DividendsIncentivesStageEnd: dividendsIncentivesRule.DividendsIncentivesStageEnd,
266 DividendsIncentivesStageStart: dividendsIncentivesRule.DividendsIncentivesStageStart, 267 DividendsIncentivesStageStart: dividendsIncentivesRule.DividendsIncentivesStageStart,
267 Org: organization, 268 Org: organization,
@@ -281,6 +282,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -281,6 +282,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
281 CooperationContractNumber: contractNumber, 282 CooperationContractNumber: contractNumber,
282 MoneyIncentivesAmount: moneyIncentivesRule.MoneyIncentivesAmount, 283 MoneyIncentivesAmount: moneyIncentivesRule.MoneyIncentivesAmount,
283 MoneyIncentivesStage: moneyIncentivesRule.MoneyIncentivesStage, 284 MoneyIncentivesStage: moneyIncentivesRule.MoneyIncentivesStage,
  285 + MoneyIncentivesStageCN: utils.NumberToCNNumber(int(moneyIncentivesRule.MoneyIncentivesStage)),
284 MoneyIncentivesStageEnd: moneyIncentivesRule.MoneyIncentivesStageEnd, 286 MoneyIncentivesStageEnd: moneyIncentivesRule.MoneyIncentivesStageEnd,
285 MoneyIncentivesStageStart: moneyIncentivesRule.MoneyIncentivesStageStart, 287 MoneyIncentivesStageStart: moneyIncentivesRule.MoneyIncentivesStageStart,
286 MoneyIncentivesTime: moneyIncentivesRule.MoneyIncentivesTime, 288 MoneyIncentivesTime: moneyIncentivesRule.MoneyIncentivesTime,
@@ -1117,6 +1119,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1117,6 +1119,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1117 SalesmanPercentage: dividendsIncentivesRule.SalesmanPercentage, 1119 SalesmanPercentage: dividendsIncentivesRule.SalesmanPercentage,
1118 DividendsIncentivesPercentage: dividendsIncentivesRule.DividendsIncentivesPercentage, 1120 DividendsIncentivesPercentage: dividendsIncentivesRule.DividendsIncentivesPercentage,
1119 DividendsIncentivesStage: dividendsIncentivesRule.DividendsIncentivesStage, 1121 DividendsIncentivesStage: dividendsIncentivesRule.DividendsIncentivesStage,
  1122 + DividendsIncentivesStageCN: utils.NumberToCNNumber(int(dividendsIncentivesRule.DividendsIncentivesStage)),
1120 DividendsIncentivesStageEnd: dividendsIncentivesRule.DividendsIncentivesStageEnd, 1123 DividendsIncentivesStageEnd: dividendsIncentivesRule.DividendsIncentivesStageEnd,
1121 DividendsIncentivesStageStart: dividendsIncentivesRule.DividendsIncentivesStageStart, 1124 DividendsIncentivesStageStart: dividendsIncentivesRule.DividendsIncentivesStageStart,
1122 Org: organization, 1125 Org: organization,
@@ -1143,6 +1146,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1143,6 +1146,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1143 CooperationContractNumber: cooperationContract.CooperationContractNumber, 1146 CooperationContractNumber: cooperationContract.CooperationContractNumber,
1144 MoneyIncentivesAmount: moneyIncentivesRule.MoneyIncentivesAmount, 1147 MoneyIncentivesAmount: moneyIncentivesRule.MoneyIncentivesAmount,
1145 MoneyIncentivesStage: moneyIncentivesRule.MoneyIncentivesStage, 1148 MoneyIncentivesStage: moneyIncentivesRule.MoneyIncentivesStage,
  1149 + MoneyIncentivesStageCN: utils.NumberToCNNumber(int(moneyIncentivesRule.MoneyIncentivesStage)),
1146 MoneyIncentivesStageEnd: moneyIncentivesRule.MoneyIncentivesStageEnd, 1150 MoneyIncentivesStageEnd: moneyIncentivesRule.MoneyIncentivesStageEnd,
1147 MoneyIncentivesStageStart: moneyIncentivesRule.MoneyIncentivesStageStart, 1151 MoneyIncentivesStageStart: moneyIncentivesRule.MoneyIncentivesStageStart,
1148 MoneyIncentivesTime: moneyIncentivesRule.MoneyIncentivesTime, 1152 MoneyIncentivesTime: moneyIncentivesRule.MoneyIncentivesTime,
@@ -175,6 +175,8 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro @@ -175,6 +175,8 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
175 "orgId": createCooperationProjectCommand.OrgId, 175 "orgId": createCooperationProjectCommand.OrgId,
176 "cooperationProjectNumber": projectNumber, 176 "cooperationProjectNumber": projectNumber,
177 }) 177 })
  178 + // TODO 校验共创项目名称是否唯一
  179 +
178 if !numberAvailable { 180 if !numberAvailable {
179 return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增共创项目异常") 181 return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增共创项目异常")
180 } 182 }
@@ -10,7 +10,7 @@ type DividendsReturnedOrder struct { @@ -10,7 +10,7 @@ type DividendsReturnedOrder struct {
10 // 分红退货单记录ID 10 // 分红退货单记录ID
11 DividendsReturnedOrderId int64 `comment:"分红退货单记录ID" pg:",pk"` 11 DividendsReturnedOrderId int64 `comment:"分红退货单记录ID" pg:",pk"`
12 // 分红退货单号 12 // 分红退货单号
13 - DividendsReturnedOrderNumber string `comment:"分红退货单号"` 13 + DividendsReturnedOrderNumber string `comment:"分红退货单号" pg:",unique"`
14 // 退货金额 14 // 退货金额
15 DividendsReturnedOrderRefund float64 `comment:"退货金额"` 15 DividendsReturnedOrderRefund float64 `comment:"退货金额"`
16 // 源单号(原始订单号) 16 // 源单号(原始订单号)
@@ -234,6 +234,8 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string @@ -234,6 +234,8 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
234 if cooperationProjectName, ok := queryOptions["cooperationProjectName"]; ok && cooperationProjectName != "" { 234 if cooperationProjectName, ok := queryOptions["cooperationProjectName"]; ok && cooperationProjectName != "" {
235 query.Join("LEFT JOIN cooperation_projects AS a"). 235 query.Join("LEFT JOIN cooperation_projects AS a").
236 JoinOn("a.cooperation_project_number = cooperation_application.cooperation_project_number"). 236 JoinOn("a.cooperation_project_number = cooperation_application.cooperation_project_number").
  237 + JoinOn("a.company->>'companyId' = cooperation_application.company->>'companyId'").
  238 + JoinOn("a.org->>'orgId' = cooperation_application.org->>'orgId'").
237 Where("a.cooperation_project_name like ?", fmt.Sprintf("%%%s%%", cooperationProjectName)) 239 Where("a.cooperation_project_name like ?", fmt.Sprintf("%%%s%%", cooperationProjectName))
238 } 240 }
239 if applicantName, ok := queryOptions["applicantName"]; ok && applicantName != "" { 241 if applicantName, ok := queryOptions["applicantName"]; ok && applicantName != "" {
@@ -254,14 +256,14 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string @@ -254,14 +256,14 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
254 } 256 }
255 } 257 }
256 if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 { 258 if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
257 - query.Where("company->>'companyId' = '?'", companyId) 259 + query.Where("cooperation_application.company->>'companyId' = '?'", companyId)
258 } 260 }
259 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 261 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
260 - query.Where("org->>'orgId' = '?'", orgId) 262 + query.Where("cooperation_application.org->>'orgId' = '?'", orgId)
261 } 263 }
262 if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 264 if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
263 newOrgIds := utils.SliceItoa(orgIds.([]int64)) 265 newOrgIds := utils.SliceItoa(orgIds.([]int64))
264 - query.Where("org->>'orgId' in (?)", pg.In(newOrgIds)) 266 + query.Where("cooperation_application.org->>'orgId' in (?)", pg.In(newOrgIds))
265 } 267 }
266 offsetLimitFlag := true 268 offsetLimitFlag := true
267 if offsetLimit, ok := queryOptions["offsetLimit"]; ok { 269 if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
@@ -271,7 +273,7 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string @@ -271,7 +273,7 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
271 query.SetOffsetAndLimit(20) 273 query.SetOffsetAndLimit(20)
272 } 274 }
273 275
274 - query.SetOrderDirect("cooperation_application_id", "DESC") 276 + query.SetOrderDirect("created_at", "DESC")
275 if count, err := query.SelectAndCount(); err != nil { 277 if count, err := query.SelectAndCount(); err != nil {
276 return 0, cooperationApplications, err 278 return 0, cooperationApplications, err
277 } else { 279 } else {