...
|
...
|
@@ -114,20 +114,6 @@ func (cashPoolService *CashPoolService) UpdateCashPool(updateCashPoolCommand *co |
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
//var cashPoolRepository domain.CashPoolRepository
|
|
|
//if value, err := factory.CreateCashPoolRepository(map[string] interface{} {
|
|
|
// "transactionContext": transactionContext,
|
|
|
//}); err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
//} else {
|
|
|
// cashPoolRepository = value
|
|
|
//}
|
|
|
//
|
|
|
//count, cashPools, err := cashPoolRepository.Find(map[string]interface{}{
|
|
|
// "companyId":
|
|
|
//})
|
|
|
|
|
|
return nil , nil
|
|
|
}
|
|
|
|
...
|
...
|
@@ -276,6 +262,9 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivityDeadline(listExc |
|
|
for _, activity := range activities {
|
|
|
deadlines = append(deadlines, activity.Deadline)
|
|
|
}
|
|
|
if len(deadlines) == 0 {
|
|
|
deadlines = []interface{}{}
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
"deadlines": deadlines,
|
|
|
}, nil
|
...
|
...
|
@@ -431,19 +420,6 @@ func (cashPoolService *CashPoolService) GetExchangeCashActivity(getExchangeCashA |
|
|
}
|
|
|
return activityFound, nil
|
|
|
}
|
|
|
// 返回兑换现金活动
|
|
|
//activityFound, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"exchangeCashActivityId": getExchangeCashActivityQuery.ExchangeCashActivityId})
|
|
|
//if err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
//}
|
|
|
//if activityFound == nil {
|
|
|
// return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(getExchangeCashActivityQuery.ExchangeCashActivityId)))
|
|
|
//} else {
|
|
|
// if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
// }
|
|
|
// return activityFound, nil
|
|
|
//}
|
|
|
}
|
|
|
|
|
|
// 更新兑换现金活动,名称,截止日期、汇率
|
...
|
...
|
@@ -497,7 +473,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if cashPools == nil {
|
|
|
if len(cashPools) == 0 {
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(activity.CompanyId)))
|
|
|
}
|
|
|
// 判断兑换活动清单中现金总金额是否超过平台未兑换现金值
|
...
|
...
|
@@ -521,7 +497,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金")
|
|
|
}
|
|
|
// 批量更新兑换清单中已兑换现金值
|
|
|
// 获取兑换清单列表
|
|
|
var exchangeCashPersonListRepository domain.ExchangeCashPersonListRepository
|
|
|
if value, err := factory.CreateExchangeCashPersonListRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
@@ -532,7 +507,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
|
|
}
|
|
|
_, people, err := exchangeCashPersonListRepository.Find(map[string]interface{}{
|
|
|
"exchangeCashActivityId": updateExchangeCashActivityCommand.ExchangeCashActivityId,
|
|
|
});
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -627,15 +602,19 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC |
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
// 获取兑换活动兑换汇率
|
|
|
var rate float64
|
|
|
var exchangeCashActivityRepository domain.ExchangeActivityRepository
|
|
|
if value, err := factory.CreateExchangeCashActivityRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
exchangeCashActivityRepository = value
|
|
|
}
|
|
|
activity, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"exchangeCashActivityId": createExchangeCashPersonCommand.ExchangeCashActivityId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if activity != nil {
|
|
|
rate = activity.Rate
|
|
|
}
|
|
|
rate := activity.Rate
|
|
|
// 根据uid/手机账号判断成员是否存在,素币是否超过本人持有的真实素币
|
|
|
var employeeRepository domain.EmployeeRepository
|
|
|
if value, err := factory.CreateEmployeeRepository(map[string]interface{}{
|
...
|
...
|
@@ -645,10 +624,17 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC |
|
|
} else {
|
|
|
employeeRepository = value
|
|
|
}
|
|
|
employee, err := employeeRepository.FindOne(map[string]interface{}{
|
|
|
getEmployee := map[string]interface{}{}
|
|
|
if createExchangeCashPersonCommand.PersonName == "" {
|
|
|
getEmployee = map[string]interface{}{
|
|
|
"uid": createExchangeCashPersonCommand.Uid,
|
|
|
}
|
|
|
} else {
|
|
|
getEmployee = map[string]interface{}{
|
|
|
"account": createExchangeCashPersonCommand.PersonAccount,
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
employee, err := employeeRepository.FindOne(getEmployee)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -892,6 +878,7 @@ func (cashPoolService *CashPoolService) ListExchangeCashPerson(listExchangeCashP |
|
|
} else {
|
|
|
exchangeCashPersonListRepository = value
|
|
|
}
|
|
|
// TODO 增加总榜单查询
|
|
|
if count, people, err := exchangeCashPersonListRepository.Find(tool_funs.SimpleStructToMap(listExchangeCashPersonQuery)); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
...
|
...
|
|