正在显示
5 个修改的文件
包含
35 行增加
和
24 行删除
| @@ -296,7 +296,7 @@ func (cashPoolService *CashPoolService) GetExchangeCashActivity(getExchangeCashA | @@ -296,7 +296,7 @@ func (cashPoolService *CashPoolService) GetExchangeCashActivity(getExchangeCashA | ||
| 296 | } else { | 296 | } else { |
| 297 | exchangeCashActivityRepository = value | 297 | exchangeCashActivityRepository = value |
| 298 | } | 298 | } |
| 299 | - activity, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"activityId": getExchangeCashActivityQuery.ExchangeCashActivityId}) | 299 | + activity, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"exchangeCashActivityId": getExchangeCashActivityQuery.ExchangeCashActivityId}) |
| 300 | if err != nil { | 300 | if err != nil { |
| 301 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 301 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 302 | } | 302 | } |
| @@ -385,18 +385,20 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC | @@ -385,18 +385,20 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC | ||
| 385 | transactionContext.RollbackTransaction() | 385 | transactionContext.RollbackTransaction() |
| 386 | }() | 386 | }() |
| 387 | 387 | ||
| 388 | - var exchangeCashActivityRepository domain.ExchangeActivityRepository | ||
| 389 | - activity, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"activityId": createExchangeCashPersonCommand.ExchangeCashActivityId}) | ||
| 390 | - if err != nil { | ||
| 391 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 392 | - } | ||
| 393 | - if activity.Rate == 0 { | ||
| 394 | - return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string("请设置汇率"))) | ||
| 395 | - } | 388 | + // TODO 获取兑换活动兑换汇率 |
| 389 | + //var exchangeCashActivityRepository domain.ExchangeActivityRepository | ||
| 390 | + //activity, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"activityId": createExchangeCashPersonCommand.ExchangeCashActivityId}) | ||
| 391 | + //if err != nil { | ||
| 392 | + // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 393 | + //} | ||
| 394 | + //if activity.Rate == 0 { | ||
| 395 | + // return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string("请设置汇率"))) | ||
| 396 | + //} | ||
| 396 | 397 | ||
| 397 | // TODO 清单中现金总额超过现金池时创建失败,提示:“已超过投入现金池的未兑换现金” | 398 | // TODO 清单中现金总额超过现金池时创建失败,提示:“已超过投入现金池的未兑换现金” |
| 398 | 399 | ||
| 399 | 400 | ||
| 401 | + | ||
| 400 | // TODO 新增兑换人员时,判断成员是否存在,判断素币值是否超过本人持有的素币,以手机账号为判断依据 | 402 | // TODO 新增兑换人员时,判断成员是否存在,判断素币值是否超过本人持有的素币,以手机账号为判断依据 |
| 401 | 403 | ||
| 402 | 404 | ||
| @@ -407,7 +409,8 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC | @@ -407,7 +409,8 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC | ||
| 407 | }, | 409 | }, |
| 408 | ExchangeCashActivityId: createExchangeCashPersonCommand.ExchangeCashActivityId, | 410 | ExchangeCashActivityId: createExchangeCashPersonCommand.ExchangeCashActivityId, |
| 409 | ExchangedSuMoney: createExchangeCashPersonCommand.ExchangedSuMoney, | 411 | ExchangedSuMoney: createExchangeCashPersonCommand.ExchangedSuMoney, |
| 410 | - ExchangedCash: createExchangeCashPersonCommand.ExchangedSuMoney * activity.Rate, | 412 | + //ExchangedCash: createExchangeCashPersonCommand.ExchangedSuMoney * activity.Rate, |
| 413 | + ExchangedCash: createExchangeCashPersonCommand.ExchangedSuMoney, | ||
| 411 | } | 414 | } |
| 412 | 415 | ||
| 413 | var exchangeCashPersonListRepository domain.ExchangeCashPersonListRepository | 416 | var exchangeCashPersonListRepository domain.ExchangeCashPersonListRepository |
| @@ -456,7 +459,7 @@ func (cashPoolService *CashPoolService) GetExchangeCashPerson(getExchangeCashPer | @@ -456,7 +459,7 @@ func (cashPoolService *CashPoolService) GetExchangeCashPerson(getExchangeCashPer | ||
| 456 | } else { | 459 | } else { |
| 457 | exchangeCashPersonListRepository = value | 460 | exchangeCashPersonListRepository = value |
| 458 | } | 461 | } |
| 459 | - person, err := exchangeCashPersonListRepository.FindOne(map[string]interface{}{"personId": getExchangeCashPersonQuery.ExchangeCashPersonId}) | 462 | + person, err := exchangeCashPersonListRepository.FindOne(map[string]interface{}{"exchangeCashListId": getExchangeCashPersonQuery.ExchangeCashPersonId}) |
| 460 | if err != nil { | 463 | if err != nil { |
| 461 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 464 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 462 | } | 465 | } |
| @@ -39,7 +39,7 @@ func (repository *ExchangeCashActivityRepository) FindOne(queryOptions map[strin | @@ -39,7 +39,7 @@ func (repository *ExchangeCashActivityRepository) FindOne(queryOptions map[strin | ||
| 39 | exchangeCashActivityModel := new(models.ExchangeCashActivity) | 39 | exchangeCashActivityModel := new(models.ExchangeCashActivity) |
| 40 | query := tx.Model(exchangeCashActivityModel) | 40 | query := tx.Model(exchangeCashActivityModel) |
| 41 | if exchangeCashActivityId, ok := queryOptions["exchangeCashActivityId"]; ok { | 41 | if exchangeCashActivityId, ok := queryOptions["exchangeCashActivityId"]; ok { |
| 42 | - query = query.Where("exchange_cash_activities.id = ?", exchangeCashActivityId) | 42 | + query = query.Where("exchange_cash_activity.id = ?", exchangeCashActivityId) |
| 43 | } | 43 | } |
| 44 | if err := query.First(); err != nil { | 44 | if err := query.First(); err != nil { |
| 45 | if err.Error() == "pg: no rows in result set" { | 45 | if err.Error() == "pg: no rows in result set" { |
| @@ -38,7 +38,7 @@ func (repository *ExchangeCashPersonListRepository) FindOne(queryOptions map[str | @@ -38,7 +38,7 @@ func (repository *ExchangeCashPersonListRepository) FindOne(queryOptions map[str | ||
| 38 | exchangeCashListModel := new(models.ExchangeCashPersonList) | 38 | exchangeCashListModel := new(models.ExchangeCashPersonList) |
| 39 | query := tx.Model(exchangeCashListModel) | 39 | query := tx.Model(exchangeCashListModel) |
| 40 | if exchangeCashListId, ok := queryOptions["exchangeCashListId"]; ok { | 40 | if exchangeCashListId, ok := queryOptions["exchangeCashListId"]; ok { |
| 41 | - query = query.Where("exchange_cash_person_lists.id = ?", exchangeCashListId) | 41 | + query = query.Where("exchange_cash_person_list.id = ?", exchangeCashListId) |
| 42 | } | 42 | } |
| 43 | if err := query.First(); err != nil { | 43 | if err := query.First(); err != nil { |
| 44 | if err.Error() == "pg: no rows in result set" { | 44 | if err.Error() == "pg: no rows in result set" { |
| @@ -59,11 +59,11 @@ func (repository *ExchangeCashPersonListRepository) Find(queryOptions map[string | @@ -59,11 +59,11 @@ func (repository *ExchangeCashPersonListRepository) Find(queryOptions map[string | ||
| 59 | var exchangeCashListModels []*models.ExchangeCashPersonList | 59 | var exchangeCashListModels []*models.ExchangeCashPersonList |
| 60 | exchangeCashPeople := make([]*domain.ExchangeCashPersonList, 0) | 60 | exchangeCashPeople := make([]*domain.ExchangeCashPersonList, 0) |
| 61 | query := tx.Model(&exchangeCashListModels) | 61 | query := tx.Model(&exchangeCashListModels) |
| 62 | - if exchangeCashActivityId, ok := queryOptions["activityId"]; ok { | ||
| 63 | - query = query.Where("exchange_cash_person_lists.activity_id = ?", exchangeCashActivityId) | 62 | + if exchangeCashActivityId, ok := queryOptions["exchangeCashActivityId"]; ok { |
| 63 | + query = query.Where("exchange_cash_person_list.activity_id = ?", exchangeCashActivityId) | ||
| 64 | } | 64 | } |
| 65 | - if personNameMatch, ok := queryOptions["personNameMatch"]; ok && (personNameMatch != ""){ | ||
| 66 | - query = query.Where("exchange_cash_person_lists.employee_name LIKE ?", fmt.Sprintf("%%%s%%", personNameMatch.(string))) | 65 | + if personNameMatch, ok := queryOptions["exchangeCashPersonNameMatch"]; ok && (personNameMatch != ""){ |
| 66 | + query = query.Where("exchange_cash_person_list.employee_name LIKE ?", fmt.Sprintf("%%%s%%", personNameMatch.(string))) | ||
| 67 | } | 67 | } |
| 68 | if offset, ok := queryOptions["offset"]; ok { | 68 | if offset, ok := queryOptions["offset"]; ok { |
| 69 | offset := offset.(int) | 69 | offset := offset.(int) |
| @@ -361,8 +361,10 @@ func (controller *SuMoneyController) ImportExchangeList () { | @@ -361,8 +361,10 @@ func (controller *SuMoneyController) ImportExchangeList () { | ||
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | var response utils.JsonResponse | 363 | var response utils.JsonResponse |
| 364 | + | ||
| 364 | dataList := make([]interface{}, 0) | 365 | dataList := make([]interface{}, 0) |
| 365 | rows, _ := xlsx.GetRows("Sheet1") | 366 | rows, _ := xlsx.GetRows("Sheet1") |
| 367 | + | ||
| 366 | for i, row := range rows { | 368 | for i, row := range rows { |
| 367 | if i > 0 { | 369 | if i > 0 { |
| 368 | for _, _ = range row { | 370 | for _, _ = range row { |
| @@ -377,10 +379,16 @@ func (controller *SuMoneyController) ImportExchangeList () { | @@ -377,10 +379,16 @@ func (controller *SuMoneyController) ImportExchangeList () { | ||
| 377 | response = utils.ResponseError(controller.Ctx, err) | 379 | response = utils.ResponseError(controller.Ctx, err) |
| 378 | } else { | 380 | } else { |
| 379 | dataList = append(dataList, data) | 381 | dataList = append(dataList, data) |
| 380 | - response = utils.ResponseData(controller.Ctx, dataList) | ||
| 381 | } | 382 | } |
| 382 | } | 383 | } |
| 383 | } | 384 | } |
| 385 | + | ||
| 386 | + ret := map[string]interface{}{ | ||
| 387 | + "count": len(dataList), | ||
| 388 | + "people": dataList, | ||
| 389 | + } | ||
| 390 | + response = utils.ResponseData(controller.Ctx, ret) | ||
| 391 | + | ||
| 384 | controller.Data["json"] = response | 392 | controller.Data["json"] = response |
| 385 | controller.ServeJSON() | 393 | controller.ServeJSON() |
| 386 | } | 394 | } |
| @@ -23,10 +23,10 @@ func init() { | @@ -23,10 +23,10 @@ func init() { | ||
| 23 | beego.Router("/cash-pool/activity", &controllers.SuMoneyController{}, "POST:CreateExchangeActivities") // 新增兑换活动 | 23 | beego.Router("/cash-pool/activity", &controllers.SuMoneyController{}, "POST:CreateExchangeActivities") // 新增兑换活动 |
| 24 | beego.Router("/cash-pool/activity/:activityId", &controllers.SuMoneyController{}, "DELETE:RemoveExchangeActivities") // 删除兑换活动 | 24 | beego.Router("/cash-pool/activity/:activityId", &controllers.SuMoneyController{}, "DELETE:RemoveExchangeActivities") // 删除兑换活动 |
| 25 | 25 | ||
| 26 | - beego.Router("/cash-pool/activity/exchange-listInterval", &controllers.SuMoneyController{}, "GET:ListExchangeList") // 返回素币兑换清单 | ||
| 27 | - beego.Router("/cash-pool/activity/exchange-listInterval/:listId", &controllers.SuMoneyController{}, "GET:GetExchangeCashPerson") // 返回素币兑换人员 | ||
| 28 | - beego.Router("/cash-pool/activity/exchange-listInterval", &controllers.SuMoneyController{}, "POST:CreateExchangeList") // 新增素币兑换清单 | ||
| 29 | - beego.Router("/cash-pool/activity/exchange-listInterval/:listId", &controllers.SuMoneyController{}, "PUT:UpdateExchangeList") // 编辑素币兑换清单 | ||
| 30 | - beego.Router("/cash-pool/activity/exchange-listInterval/:listId", &controllers.SuMoneyController{}, "DELETE:RemoveExchangeCashPerson") // 删除素币兑换清单 | ||
| 31 | - beego.Router("/cash-pool/activity/exchange-listInterval/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 | } |
-
请 注册 或 登录 后发表评论