作者 陈志颖

fix:未创建现金池报错信息修改

... ... @@ -438,3 +438,43 @@
BodyData:{}
2020/11/22 21:41:06.515 [D] [server.go:2843] <====Send RequestId:GET./list-interval/?companyId=381&offset=0&limit=20.1606052466500650000 BodyData:{"code":0,"data":{"count":3,"listIntervals":[{"listIntervalId":21,"companyId":381,"intervalStartTime":"2020-12-18T00:00:00+08:00","intervalEndTime":"2020-12-20T23:59:59+08:00"},{"listIntervalId":20,"companyId":381,"intervalStartTime":"2020-11-17T12:01:54.851528+08:00","intervalEndTime":"2020-11-20T12:01:54.851528+08:00"},{"listIntervalId":7,"companyId":381,"intervalStartTime":"2020-11-10T12:01:54.851528+08:00","intervalEndTime":"2020-11-16T12:01:54.851528+08:00"}]},"msg":"ok"}
2020/11/22 21:41:06.515 [D] [server.go:1925] | 127.0.0.1| 200 | 15.218351ms| match| GET  /list-interval/ r:/list-interval/
2020/11/22 21:44:19.290 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./cash-pool/activity.1606052659290749000
Auth=
BodyData:{
"companyId": 311,
"exchangeActivityName": "这是公司311的兑换活动7",
"deadline": "2021-01-04T16:00:00.000Z",
"exchangeRate": 5
}
2020/11/22 21:44:19.364 [D] [server.go:2843] <====Send RequestId:POST./cash-pool/activity.1606052659290749000 BodyData:{"code":0,"data":{"activityId":92,"exchangeActivityName":"这是公司311的兑换活动7","companyId":311,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2021-01-05T23:59:59+08:00","countDown":45,"rate":5,"createTime":"2020-11-22T21:44:19.36318+08:00"},"msg":"ok"}
2020/11/22 21:44:19.364 [D] [server.go:1925] | 127.0.0.1| 200 | 74.183207ms| match| POST  /cash-pool/activity r:/cash-pool/activity
2020/11/22 21:44:23.211 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./cash-pool/activity.1606052663211747000
Auth=
BodyData:{
"companyId": 311,
"exchangeActivityName": "这是公司311的兑换活动7",
"deadline": "2021-01-04T16:00:00.000Z",
"exchangeRate": 5
}
2020/11/22 21:44:23.236 [D] [server.go:2843] <====Send RequestId:POST./cash-pool/activity.1606052663211747000 BodyData:{"code":501,"msg":"内部服务出错:兑换活动截止时间不能重合"}
2020/11/22 21:44:23.236 [D] [server.go:1925] | 127.0.0.1| 200 | 25.067107ms| match| POST  /cash-pool/activity r:/cash-pool/activity
2020/11/22 21:44:27.802 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./cash-pool/activity.1606052667802560000
Auth=
BodyData:{
"companyId": 311,
"exchangeActivityName": "这是公司311的兑换活动7",
"deadline": "2021-01-05T16:00:00.000Z",
"exchangeRate": 5
}
2020/11/22 21:44:27.840 [D] [server.go:2843] <====Send RequestId:POST./cash-pool/activity.1606052667802560000 BodyData:{"code":0,"data":{"activityId":93,"exchangeActivityName":"这是公司311的兑换活动7","companyId":311,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2021-01-06T23:59:59+08:00","countDown":46,"rate":5,"createTime":"2020-11-22T21:44:27.822562+08:00"},"msg":"ok"}
2020/11/22 21:44:27.840 [D] [server.go:1925] | 127.0.0.1| 200 | 38.447584ms| match| POST  /cash-pool/activity r:/cash-pool/activity
2020/11/22 21:46:19.207 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./cash-pool/activity.1606052779207498000
Auth=
BodyData:{
"companyId": 311,
"exchangeActivityName": "这是公司311的兑换活动7",
"deadline": "2028-01-05T16:00:00.000Z",
"exchangeRate": 5
}
2020/11/22 21:46:19.214 [D] [server.go:2843] <====Send RequestId:POST./cash-pool/activity.1606052779207498000 BodyData:{"code":0,"data":{"activityId":94,"exchangeActivityName":"这是公司311的兑换活动7","companyId":311,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2028-01-06T23:59:59+08:00","countDown":2602,"rate":5,"createTime":"2020-11-22T21:46:19.209323+08:00"},"msg":"ok"}
2020/11/22 21:46:19.214 [D] [server.go:1925] | 127.0.0.1| 200 | 7.123034ms| match| POST  /cash-pool/activity r:/cash-pool/activity
... ...
... ... @@ -817,10 +817,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateExchangeCashActivityCommand.ExchangeCashActivityId)))
}
// 获取当前兑换活动汇率
activityFoundRate := activityFound.Rate
if updateExchangeCashActivityCommand.ExchangeRate != activityFoundRate && updateExchangeCashActivityCommand.ExchangeRate != 0 { // 更新兑换活动兑换汇率
// 获取当前公司现金池
_, cashPoolsFound, err := cashPoolRepository.Find(map[string]interface{}{
"companyId": activityFound.CompanyId,
... ... @@ -829,9 +825,13 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(cashPoolsFound) == 0 {
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(activityFound.CompanyId)))
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, "当前公司未创建现金池")
}
// 获取当前兑换活动汇率
activityFoundRate := activityFound.Rate
if updateExchangeCashActivityCommand.ExchangeRate != activityFoundRate && updateExchangeCashActivityCommand.ExchangeRate != 0 { // 更新兑换活动兑换汇率
// 判断兑换活动清单中现金总金额是否超过平台未兑换现金值
if activityFound.ExchangedSuMoney * updateExchangeCashActivityCommand.ExchangeRate > cashPoolsFound[0].UnExchangeCash {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金")
... ... @@ -912,7 +912,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
if cashPoolUpdated == nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
} else { // 未更新兑换活动汇率 TODO 更新截止时间
} else { // 未更新兑换活动汇率
updateExchangeCashActivityCommand.ExchangedCash = activityFound.ExchangedCash
}
... ...