作者 陈志颖

fix:修改路由方法名

@@ -33,6 +33,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co @@ -33,6 +33,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
33 }() 33 }()
34 34
35 // TODO 判断公司是否存在 35 // TODO 判断公司是否存在
  36 +
36 //var cashPoolDao *dao.CashPoolDao 37 //var cashPoolDao *dao.CashPoolDao
37 //if value, err := factory.CreateCashPoolDao(map[string]interface{}{ 38 //if value, err := factory.CreateCashPoolDao(map[string]interface{}{
38 // "transactionContext": transactionContext, 39 // "transactionContext": transactionContext,
@@ -43,6 +44,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co @@ -43,6 +44,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
43 //} 44 //}
44 45
45 // TODO 统计系统已兑换现金、未兑换现金、已兑换素币、未兑换素币 46 // TODO 统计系统已兑换现金、未兑换现金、已兑换素币、未兑换素币
  47 +
46 var systemUnExchangeCash float64 48 var systemUnExchangeCash float64
47 //systemExchangedCash, err := cashPoolDao.CalculateSystemCash(createCashPoolCommand.CompanyId) 49 //systemExchangedCash, err := cashPoolDao.CalculateSystemCash(createCashPoolCommand.CompanyId)
48 //if err != nil { 50 //if err != nil {
@@ -55,7 +57,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co @@ -55,7 +57,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
55 //} 57 //}
56 58
57 var cashPoolRepository domain.CashPoolRepository 59 var cashPoolRepository domain.CashPoolRepository
58 - if value, err := factory.CreateCashPoolRepository(map[string]interface{}{ 60 + if value, err := factory.CreateCashPoolRepository(map[string] interface{} {
59 "transactionContext": transactionContext, 61 "transactionContext": transactionContext,
60 }); err != nil { 62 }); err != nil {
61 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 63 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -64,6 +66,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co @@ -64,6 +66,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
64 } 66 }
65 67
66 // TODO 获取系统未兑换现金 68 // TODO 获取系统未兑换现金
  69 +
67 //count, cashPools, err := cashPoolRepository.Find(map[string]interface{}{ 70 //count, cashPools, err := cashPoolRepository.Find(map[string]interface{}{
68 // "companyId": createCashPoolCommand.CompanyId, 71 // "companyId": createCashPoolCommand.CompanyId,
69 //}) 72 //})
@@ -94,7 +97,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co @@ -94,7 +97,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
94 CreateTime: time.Now(), 97 CreateTime: time.Now(),
95 } 98 }
96 99
97 - if value, err := factory.CreateCashPoolRepository(map[string]interface{}{ 100 + if value, err := factory.CreateCashPoolRepository(map[string] interface{} {
98 "transactionContext": transactionContext, 101 "transactionContext": transactionContext,
99 }); err != nil { 102 }); err != nil {
100 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 103 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -128,7 +131,7 @@ func (cashPoolService *CashPoolService) GetCashPool(getCashPoolQuery *query.GetC @@ -128,7 +131,7 @@ func (cashPoolService *CashPoolService) GetCashPool(getCashPoolQuery *query.GetC
128 transactionContext.RollbackTransaction() 131 transactionContext.RollbackTransaction()
129 }() 132 }()
130 var cashPoolRepository domain.CashPoolRepository 133 var cashPoolRepository domain.CashPoolRepository
131 - if value, err := factory.CreateCashPoolRepository(map[string]interface{}{ 134 + if value, err := factory.CreateCashPoolRepository(map[string] interface{} {
132 "transactionContext": transactionContext, 135 "transactionContext": transactionContext,
133 }); err != nil { 136 }); err != nil {
134 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 137 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -143,20 +146,21 @@ func (cashPoolService *CashPoolService) GetCashPool(getCashPoolQuery *query.GetC @@ -143,20 +146,21 @@ func (cashPoolService *CashPoolService) GetCashPool(getCashPoolQuery *query.GetC
143 } 146 }
144 // TODO 初始状态下,现金池返回默认值 147 // TODO 初始状态下,现金池返回默认值
145 if count == 0 { 148 if count == 0 {
146 - return map[string]interface{}{ 149 + return map[string] interface{} {
147 "cashPoolId": 0, 150 "cashPoolId": 0,
148 "cash": 0, 151 "cash": 0,
149 - "companyId": 0, 152 + "companyId": getCashPoolQuery.CompanyId,
150 "exchangedCash": 0, 153 "exchangedCash": 0,
151 "unExchangeCash": 0, 154 "unExchangeCash": 0,
152 "exchangedSuMoney": 0, 155 "exchangedSuMoney": 0,
153 "unExchangeSuMoney": 0, 156 "unExchangeSuMoney": 0,
154 "rate": 0, 157 "rate": 0,
155 - "createTime": "2020-11-03T17:23:00.848676+08:00", 158 + "createTime": time.Now(),
156 }, nil 159 }, nil
157 - } 160 + } else {
158 return cashPools[0], nil 161 return cashPools[0], nil
159 } 162 }
  163 + }
160 } 164 }
161 165
162 // 新增兑换现金活动 166 // 新增兑换现金活动
@@ -254,7 +258,6 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashActivity(removeExchang @@ -254,7 +258,6 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashActivity(removeExchang
254 if err := removeExchangeCashActivityCommand.ValidateCommand(); err != nil { 258 if err := removeExchangeCashActivityCommand.ValidateCommand(); err != nil {
255 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 259 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
256 } 260 }
257 -  
258 transactionContext, err := factory.CreateTransactionContext(nil) 261 transactionContext, err := factory.CreateTransactionContext(nil)
259 if err != nil { 262 if err != nil {
260 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 263 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -265,7 +268,6 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashActivity(removeExchang @@ -265,7 +268,6 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashActivity(removeExchang
265 defer func() { 268 defer func() {
266 transactionContext.RollbackTransaction() 269 transactionContext.RollbackTransaction()
267 }() 270 }()
268 -  
269 var exchangeCashActivityRepository domain.ExchangeActivityRepository 271 var exchangeCashActivityRepository domain.ExchangeActivityRepository
270 if value, err := factory.CreateExchangeCashActivityRepository(map[string]interface{}{ 272 if value, err := factory.CreateExchangeCashActivityRepository(map[string]interface{}{
271 "transactionContext": transactionContext, 273 "transactionContext": transactionContext,
@@ -274,7 +276,6 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashActivity(removeExchang @@ -274,7 +276,6 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashActivity(removeExchang
274 } else { 276 } else {
275 exchangeCashActivityRepository = value 277 exchangeCashActivityRepository = value
276 } 278 }
277 -  
278 activity, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"activityId": removeExchangeCashActivityCommand.ActivityId}) 279 activity, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"activityId": removeExchangeCashActivityCommand.ActivityId})
279 if err != nil { 280 if err != nil {
280 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 281 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -334,7 +335,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang @@ -334,7 +335,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
334 if err := updateExchangeCashActivityCommand.ValidateCommand(); err != nil { 335 if err := updateExchangeCashActivityCommand.ValidateCommand(); err != nil {
335 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 336 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
336 } 337 }
337 -  
338 transactionContext, err := factory.CreateTransactionContext(nil) 338 transactionContext, err := factory.CreateTransactionContext(nil)
339 if err != nil { 339 if err != nil {
340 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 340 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -345,7 +345,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang @@ -345,7 +345,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
345 defer func() { 345 defer func() {
346 transactionContext.RollbackTransaction() 346 transactionContext.RollbackTransaction()
347 }() 347 }()
348 -  
349 var exchangeCashActivityRepository domain.ExchangeActivityRepository 348 var exchangeCashActivityRepository domain.ExchangeActivityRepository
350 if value, err := factory.CreateExchangeCashActivityRepository(map[string]interface{}{ 349 if value, err := factory.CreateExchangeCashActivityRepository(map[string]interface{}{
351 "transactionContext": transactionContext, 350 "transactionContext": transactionContext,
@@ -354,7 +353,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang @@ -354,7 +353,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
354 } else { 353 } else {
355 exchangeCashActivityRepository = value 354 exchangeCashActivityRepository = value
356 } 355 }
357 -  
358 activity, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"activityId": updateExchangeCashActivityCommand.ExchangeCashActivityId}) 356 activity, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"activityId": updateExchangeCashActivityCommand.ExchangeCashActivityId})
359 if err != nil { 357 if err != nil {
360 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 358 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -369,6 +367,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang @@ -369,6 +367,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
369 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 367 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
370 } else { 368 } else {
371 // TODO 更新现金池已兑换素币、已兑换现金值、未兑换素币、未兑换现金值、平均汇率 369 // TODO 更新现金池已兑换素币、已兑换现金值、未兑换素币、未兑换现金值、平均汇率
  370 +
372 //var cashPoolRepository domain.CashPoolRepository 371 //var cashPoolRepository domain.CashPoolRepository
373 //if value, err := factory.CreateCashPoolRepository(map[string]interface{}{ 372 //if value, err := factory.CreateCashPoolRepository(map[string]interface{}{
374 // "transactionContext": transactionContext, 373 // "transactionContext": transactionContext,
@@ -390,7 +389,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC @@ -390,7 +389,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
390 if err := createExchangeCashPersonCommand.ValidateCommand(); err != nil { 389 if err := createExchangeCashPersonCommand.ValidateCommand(); err != nil {
391 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 390 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
392 } 391 }
393 -  
394 transactionContext, err := factory.CreateTransactionContext(nil) 392 transactionContext, err := factory.CreateTransactionContext(nil)
395 if err != nil { 393 if err != nil {
396 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 394 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -403,6 +401,7 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC @@ -403,6 +401,7 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
403 }() 401 }()
404 402
405 // TODO 获取兑换活动兑换汇率 403 // TODO 获取兑换活动兑换汇率
  404 +
406 //var exchangeCashActivityRepository domain.ExchangeActivityRepository 405 //var exchangeCashActivityRepository domain.ExchangeActivityRepository
407 //activity, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"exchangeCashActivityId": createExchangeCashPersonCommand.ExchangeCashActivityId}) 406 //activity, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"exchangeCashActivityId": createExchangeCashPersonCommand.ExchangeCashActivityId})
408 //if err != nil { 407 //if err != nil {
@@ -414,12 +413,11 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC @@ -414,12 +413,11 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
414 // fmt.Print(activity.Rate) 413 // fmt.Print(activity.Rate)
415 //} 414 //}
416 415
417 -  
418 // TODO 清单中现金总额超过现金池时创建失败,提示:“已超过投入现金池的未兑换现金” 416 // TODO 清单中现金总额超过现金池时创建失败,提示:“已超过投入现金池的未兑换现金”
419 417
  418 + // TODO 新增兑换清单时,根据uid判断成员是否存在,判断素币值是否超过本人持有的素币
420 419
421 - // TODO 新增兑换人员时,判断成员是否存在,判断素币值是否超过本人持有的素币,以手机账号为判断依据  
422 - 420 + // TODO 导入兑换清单时,时根据手机账号判断成员是否存在,判断素币是否超过本人持有的素币
423 421
424 newPerson := &domain.ExchangeCashPersonList{ 422 newPerson := &domain.ExchangeCashPersonList{
425 EmployeeInfo: &domain.EmployeeInfo{ 423 EmployeeInfo: &domain.EmployeeInfo{
@@ -444,7 +442,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC @@ -444,7 +442,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
444 } else { 442 } else {
445 // TODO 更新活动已兑换素币值、已兑换现金值、兑换汇率 443 // TODO 更新活动已兑换素币值、已兑换现金值、兑换汇率
446 444
447 -  
448 if err := transactionContext.CommitTransaction(); err != nil { 445 if err := transactionContext.CommitTransaction(); err != nil {
449 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 446 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
450 } 447 }
@@ -457,7 +454,6 @@ func (cashPoolService *CashPoolService) GetExchangeCashPerson(getExchangeCashPer @@ -457,7 +454,6 @@ func (cashPoolService *CashPoolService) GetExchangeCashPerson(getExchangeCashPer
457 if err := getExchangeCashPersonQuery.ValidateQuery(); err != nil { 454 if err := getExchangeCashPersonQuery.ValidateQuery(); err != nil {
458 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 455 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
459 } 456 }
460 -  
461 transactionContext, err := factory.CreateTransactionContext(nil) 457 transactionContext, err := factory.CreateTransactionContext(nil)
462 if err != nil { 458 if err != nil {
463 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 459 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -468,7 +464,6 @@ func (cashPoolService *CashPoolService) GetExchangeCashPerson(getExchangeCashPer @@ -468,7 +464,6 @@ func (cashPoolService *CashPoolService) GetExchangeCashPerson(getExchangeCashPer
468 defer func() { 464 defer func() {
469 transactionContext.RollbackTransaction() 465 transactionContext.RollbackTransaction()
470 }() 466 }()
471 -  
472 var exchangeCashPersonListRepository domain.ExchangeCashPersonListRepository 467 var exchangeCashPersonListRepository domain.ExchangeCashPersonListRepository
473 if value, err := factory.CreateExchangeCashPersonListRepository(map[string]interface{}{ 468 if value, err := factory.CreateExchangeCashPersonListRepository(map[string]interface{}{
474 "transactionContext": transactionContext, 469 "transactionContext": transactionContext,
@@ -514,7 +509,6 @@ func (cashPoolService *CashPoolService) ListExchangeCashPerson(listExchangeCashP @@ -514,7 +509,6 @@ func (cashPoolService *CashPoolService) ListExchangeCashPerson(listExchangeCashP
514 } else { 509 } else {
515 exchangeCashPersonListRepository = value 510 exchangeCashPersonListRepository = value
516 } 511 }
517 -  
518 if count, people, err := exchangeCashPersonListRepository.Find(tool_funs.SimpleStructToMap(listExchangeCashPersonQuery)); err != nil { 512 if count, people, err := exchangeCashPersonListRepository.Find(tool_funs.SimpleStructToMap(listExchangeCashPersonQuery)); err != nil {
519 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 513 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
520 } else { 514 } else {
@@ -533,7 +527,6 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC @@ -533,7 +527,6 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC
533 if err := removeExchangeCashPersonCommand.ValidateCommand(); err != nil { 527 if err := removeExchangeCashPersonCommand.ValidateCommand(); err != nil {
534 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 528 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
535 } 529 }
536 -  
537 transactionContext, err := factory.CreateTransactionContext(nil) 530 transactionContext, err := factory.CreateTransactionContext(nil)
538 if err != nil { 531 if err != nil {
539 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 532 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -544,7 +537,6 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC @@ -544,7 +537,6 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC
544 defer func() { 537 defer func() {
545 transactionContext.RollbackTransaction() 538 transactionContext.RollbackTransaction()
546 }() 539 }()
547 -  
548 var exchangeCashPersonListRepository domain.ExchangeCashPersonListRepository 540 var exchangeCashPersonListRepository domain.ExchangeCashPersonListRepository
549 if value, err := factory.CreateExchangeCashPersonListRepository(map[string]interface{}{ 541 if value, err := factory.CreateExchangeCashPersonListRepository(map[string]interface{}{
550 "transactionContext": transactionContext, 542 "transactionContext": transactionContext,
@@ -553,7 +545,6 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC @@ -553,7 +545,6 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC
553 } else { 545 } else {
554 exchangeCashPersonListRepository = value 546 exchangeCashPersonListRepository = value
555 } 547 }
556 -  
557 person, err := exchangeCashPersonListRepository.FindOne(map[string]interface{}{"id": removeExchangeCashPersonCommand.ListId}) 548 person, err := exchangeCashPersonListRepository.FindOne(map[string]interface{}{"id": removeExchangeCashPersonCommand.ListId})
558 if err != nil { 549 if err != nil {
559 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 550 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -611,7 +602,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC @@ -611,7 +602,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC
611 } else { 602 } else {
612 // TODO 更新个人当前可用素币值,生成素币兑换流水记录(获取更新前的已兑换素币值,判断是扣除还是增加),记录描述:参与素币兑换现金活动(红色表示取活动名称) 603 // TODO 更新个人当前可用素币值,生成素币兑换流水记录(获取更新前的已兑换素币值,判断是扣除还是增加),记录描述:参与素币兑换现金活动(红色表示取活动名称)
613 604
614 -  
615 // TODO 更新相应兑换活动已兑换素币值、已兑换现金值、兑换汇率 605 // TODO 更新相应兑换活动已兑换素币值、已兑换现金值、兑换汇率
616 606
617 if err := transactionContext.CommitTransaction(); err != nil { 607 if err := transactionContext.CommitTransaction(); err != nil {
@@ -20,19 +20,14 @@ type SuMoneyController struct { @@ -20,19 +20,14 @@ type SuMoneyController struct {
20 func (controller *SuMoneyController) OperationSuMoney() { 20 func (controller *SuMoneyController) OperationSuMoney() {
21 suMoneyService := service.NewSuMoneyService(nil) 21 suMoneyService := service.NewSuMoneyService(nil)
22 operationSuMoneyCommand := &command.OperationSuMoneyCommand{} 22 operationSuMoneyCommand := &command.OperationSuMoneyCommand{}
23 -  
24 json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), operationSuMoneyCommand) 23 json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), operationSuMoneyCommand)
25 -  
26 data, err := suMoneyService.OperationSuMoney(operationSuMoneyCommand) 24 data, err := suMoneyService.OperationSuMoney(operationSuMoneyCommand)
27 -  
28 var response utils.JsonResponse 25 var response utils.JsonResponse
29 -  
30 if err != nil { 26 if err != nil {
31 response = utils.ResponseError(controller.Ctx, err) 27 response = utils.ResponseError(controller.Ctx, err)
32 } else { 28 } else {
33 response = utils.ResponseData(controller.Ctx, data) 29 response = utils.ResponseData(controller.Ctx, data)
34 } 30 }
35 -  
36 controller.Data["json"] = response 31 controller.Data["json"] = response
37 controller.ServeJSON() 32 controller.ServeJSON()
38 } 33 }
@@ -40,20 +35,15 @@ func (controller *SuMoneyController) OperationSuMoney() { @@ -40,20 +35,15 @@ func (controller *SuMoneyController) OperationSuMoney() {
40 func (controller *SuMoneyController) GetSuMoneyTransactionRecord() { 35 func (controller *SuMoneyController) GetSuMoneyTransactionRecord() {
41 suMoneyService := service.NewSuMoneyService(nil) 36 suMoneyService := service.NewSuMoneyService(nil)
42 getSuMoneyTransactionRecordQuery := &query.GetSuMoneyTransactionRecordQuery{} 37 getSuMoneyTransactionRecordQuery := &query.GetSuMoneyTransactionRecordQuery{}
43 -  
44 suMoneyTransactionRecordId, _ := controller.GetInt64(":suMoneyTransactionRecordId") 38 suMoneyTransactionRecordId, _ := controller.GetInt64(":suMoneyTransactionRecordId")
45 getSuMoneyTransactionRecordQuery.SuMoneyTransactionRecordId = suMoneyTransactionRecordId 39 getSuMoneyTransactionRecordQuery.SuMoneyTransactionRecordId = suMoneyTransactionRecordId
46 -  
47 data, err := suMoneyService.GetSuMoneyTransactionRecord(getSuMoneyTransactionRecordQuery) 40 data, err := suMoneyService.GetSuMoneyTransactionRecord(getSuMoneyTransactionRecordQuery)
48 -  
49 var response utils.JsonResponse 41 var response utils.JsonResponse
50 -  
51 if err != nil { 42 if err != nil {
52 response = utils.ResponseError(controller.Ctx, err) 43 response = utils.ResponseError(controller.Ctx, err)
53 } else { 44 } else {
54 response = utils.ResponseData(controller.Ctx, data) 45 response = utils.ResponseData(controller.Ctx, data)
55 } 46 }
56 -  
57 controller.Data["json"] = response 47 controller.Data["json"] = response
58 controller.ServeJSON() 48 controller.ServeJSON()
59 } 49 }
@@ -61,19 +51,14 @@ func (controller *SuMoneyController) GetSuMoneyTransactionRecord() { @@ -61,19 +51,14 @@ func (controller *SuMoneyController) GetSuMoneyTransactionRecord() {
61 func (controller *SuMoneyController) ExchangeSuMoney() { 51 func (controller *SuMoneyController) ExchangeSuMoney() {
62 suMoneyService := service.NewSuMoneyService(nil) 52 suMoneyService := service.NewSuMoneyService(nil)
63 exchangeSuMoneyCommand := &command.ExchangeSuMoneyCommand{} 53 exchangeSuMoneyCommand := &command.ExchangeSuMoneyCommand{}
64 -  
65 json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), exchangeSuMoneyCommand) 54 json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), exchangeSuMoneyCommand)
66 -  
67 data, err := suMoneyService.ExchangeSuMoney(exchangeSuMoneyCommand) 55 data, err := suMoneyService.ExchangeSuMoney(exchangeSuMoneyCommand)
68 -  
69 var response utils.JsonResponse 56 var response utils.JsonResponse
70 -  
71 if err != nil { 57 if err != nil {
72 response = utils.ResponseError(controller.Ctx, err) 58 response = utils.ResponseError(controller.Ctx, err)
73 } else { 59 } else {
74 response = utils.ResponseData(controller.Ctx, data) 60 response = utils.ResponseData(controller.Ctx, data)
75 } 61 }
76 -  
77 controller.Data["json"] = response 62 controller.Data["json"] = response
78 controller.ServeJSON() 63 controller.ServeJSON()
79 } 64 }
@@ -102,19 +87,14 @@ func (controller *SuMoneyController) SearchSuMoneyTransactionRecord() { @@ -102,19 +87,14 @@ func (controller *SuMoneyController) SearchSuMoneyTransactionRecord() {
102 func (controller *SuMoneyController) SuMoneyTransactionRecordStatistics() { 87 func (controller *SuMoneyController) SuMoneyTransactionRecordStatistics() {
103 suMoneyService := service.NewSuMoneyService(nil) 88 suMoneyService := service.NewSuMoneyService(nil)
104 suMoneyTransactionRecordStatisticsCommand := &command.SuMoneyTransactionRecordStatisticsCommand{} 89 suMoneyTransactionRecordStatisticsCommand := &command.SuMoneyTransactionRecordStatisticsCommand{}
105 -  
106 json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), suMoneyTransactionRecordStatisticsCommand) 90 json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), suMoneyTransactionRecordStatisticsCommand)
107 -  
108 data, err := suMoneyService.SuMoneyTransactionRecordStatistics(suMoneyTransactionRecordStatisticsCommand) 91 data, err := suMoneyService.SuMoneyTransactionRecordStatistics(suMoneyTransactionRecordStatisticsCommand)
109 -  
110 var response utils.JsonResponse 92 var response utils.JsonResponse
111 -  
112 if err != nil { 93 if err != nil {
113 response = utils.ResponseError(controller.Ctx, err) 94 response = utils.ResponseError(controller.Ctx, err)
114 } else { 95 } else {
115 response = utils.ResponseData(controller.Ctx, data) 96 response = utils.ResponseData(controller.Ctx, data)
116 } 97 }
117 -  
118 controller.Data["json"] = response 98 controller.Data["json"] = response
119 controller.ServeJSON() 99 controller.ServeJSON()
120 } 100 }
@@ -257,9 +237,6 @@ func (controller *SuMoneyController) ListExchangeList () { @@ -257,9 +237,6 @@ func (controller *SuMoneyController) ListExchangeList () {
257 listExchangeCashListQuery.Offset = offset 237 listExchangeCashListQuery.Offset = offset
258 limit, _ := controller.GetInt("limit") 238 limit, _ := controller.GetInt("limit")
259 listExchangeCashListQuery.Limit = limit 239 listExchangeCashListQuery.Limit = limit
260 -  
261 - fmt.Println("hahahhah", listExchangeCashListQuery)  
262 -  
263 data, err := cashPoolService.ListExchangeCashPerson(listExchangeCashListQuery) 240 data, err := cashPoolService.ListExchangeCashPerson(listExchangeCashListQuery)
264 var response utils.JsonResponse 241 var response utils.JsonResponse
265 if err != nil { 242 if err != nil {
@@ -14,19 +14,19 @@ func init() { @@ -14,19 +14,19 @@ func init() {
14 beego.Router("/su-money/su-money-transaction-record-statistics", &controllers.SuMoneyController{}, "Post:SuMoneyTransactionRecordStatistics") // 返回素币事务记录统计 14 beego.Router("/su-money/su-money-transaction-record-statistics", &controllers.SuMoneyController{}, "Post:SuMoneyTransactionRecordStatistics") // 返回素币事务记录统计
15 15
16 /**********************************************现金池*******************************************/ 16 /**********************************************现金池*******************************************/
17 - beego.Router("/cash-pool/input", &controllers.SuMoneyController{}, "POST:CashInput") // 现金池投入  
18 - beego.Router("/cash-pool/cash-pool", &controllers.SuMoneyController{}, "GET:GetCashPool") // 返回现金池统计 17 + beego.Router("/cash-pool/input", &controllers.SuMoneyController{}, "Post:CashInput") // 现金池投入
  18 + beego.Router("/cash-pool/cash-pool", &controllers.SuMoneyController{}, "Get:GetCashPool") // 返回现金池统计
19 19
20 - beego.Router("/cash-pool/activity/", &controllers.SuMoneyController{}, "GET:ListExchangeActivities") // 返回兑换活动列表  
21 - beego.Router("/cash-pool/activity/:activityId", &controllers.SuMoneyController{}, "GET:GetExchangeCashActivity") // 返回兑换活动  
22 - beego.Router("/cash-pool/activity/:activityId", &controllers.SuMoneyController{}, "PUT:UpdateExchangeActivities") // 编辑兑换活动  
23 - beego.Router("/cash-pool/activity", &controllers.SuMoneyController{}, "POST:CreateExchangeActivities") // 新增兑换活动  
24 - beego.Router("/cash-pool/activity/:activityId", &controllers.SuMoneyController{}, "DELETE:RemoveExchangeActivities") // 删除兑换活动 20 + beego.Router("/cash-pool/activity/", &controllers.SuMoneyController{}, "Get:ListExchangeActivities") // 返回兑换活动列表
  21 + beego.Router("/cash-pool/activity/:activityId", &controllers.SuMoneyController{}, "Get:GetExchangeCashActivity") // 返回兑换活动
  22 + beego.Router("/cash-pool/activity/:activityId", &controllers.SuMoneyController{}, "Put:UpdateExchangeActivities") // 编辑兑换活动
  23 + beego.Router("/cash-pool/activity", &controllers.SuMoneyController{}, "Post:CreateExchangeActivities") // 新增兑换活动
  24 + beego.Router("/cash-pool/activity/:activityId", &controllers.SuMoneyController{}, "Delete:RemoveExchangeActivities") // 删除兑换活动
25 25
26 - beego.Router("/cash-pool/activity/exchange-list", &controllers.SuMoneyController{}, "GET:ListExchangeList") // 返回素币兑换清单  
27 - beego.Router("/cash-pool/activity/exchange-list/:listId", &controllers.SuMoneyController{}, "GET:GetExchangeCashPerson") // 返回素币兑换人员  
28 - beego.Router("/cash-pool/activity/exchange-list", &controllers.SuMoneyController{}, "POST:CreateExchangeList") // 新增素币兑换清单  
29 - beego.Router("/cash-pool/activity/exchange-list/:listId", &controllers.SuMoneyController{}, "PUT:UpdateExchangeList") // 编辑素币兑换清单  
30 - beego.Router("/cash-pool/activity/exchange-list/:listId", &controllers.SuMoneyController{}, "DELETE:RemoveExchangeCashPerson") // 删除素币兑换清单  
31 - beego.Router("/cash-pool/activity/exchange-list/import", &controllers.SuMoneyController{}, "POST:ImportExchangeList") // 导入素币兑换清单 26 + beego.Router("/cash-pool/activity/exchange-list", &controllers.SuMoneyController{}, "Get:ListExchangeList") // 返回素币兑换清单
  27 + beego.Router("/cash-pool/activity/exchange-list/:listId", &controllers.SuMoneyController{}, "Get:GetExchangeCashPerson") // 返回素币兑换人员
  28 + beego.Router("/cash-pool/activity/exchange-list", &controllers.SuMoneyController{}, "Post:CreateExchangeList") // 新增素币兑换清单
  29 + beego.Router("/cash-pool/activity/exchange-list/:listId", &controllers.SuMoneyController{}, "Put:UpdateExchangeList") // 编辑素币兑换清单
  30 + beego.Router("/cash-pool/activity/exchange-list/:listId", &controllers.SuMoneyController{}, "Delete:RemoveExchangeCashPerson") // 删除素币兑换清单
  31 + beego.Router("/cash-pool/activity/exchange-list/import", &controllers.SuMoneyController{}, "Post:ImportExchangeList") // 导入素币兑换清单
32 } 32 }