...
|
...
|
@@ -1049,6 +1049,7 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC |
|
|
|
|
|
// 更新兑换清单
|
|
|
func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeCashPersonCommand *command.UpdateExchangeCashPersonCommand) (interface{}, error) {
|
|
|
fmt.Print(updateExchangeCashPersonCommand, "\n")
|
|
|
if err := updateExchangeCashPersonCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -1079,7 +1080,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
|
|
} else {
|
|
|
exchangeCashPersonListRepository = value
|
|
|
}
|
|
|
person, err := exchangeCashPersonListRepository.FindOne(map[string]interface{}{"listId": updateExchangeCashPersonCommand.ListId})
|
|
|
person, err := exchangeCashPersonListRepository.FindOne(map[string]interface{}{"id": updateExchangeCashPersonCommand.ListId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -1089,6 +1090,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
|
|
if err := person.Update(tool_funs.SimpleStructToMap(updateExchangeCashPersonCommand)); err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
fmt.Print(person, "\n")
|
|
|
// 更新兑换活动
|
|
|
var exchangeCashActivityRepository domain.ExchangeActivityRepository
|
|
|
if value, err := factory.CreateExchangeCashActivityRepository(map[string]interface{}{
|
...
|
...
|
@@ -1129,7 +1131,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
|
|
} else {
|
|
|
cashPoolDao = value
|
|
|
}
|
|
|
activitySuMoneyStatistics, err := cashPoolDao.CalculateActivityExchangedSuMoney(activityFound.CompanyId)
|
|
|
activitySuMoneyStatistics, err := cashPoolDao.CalculateActivityExchangedSuMoney(activityFound.ActivityId)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -1160,13 +1162,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
|
|
OperationType: 0,
|
|
|
OperationDescription: "参与兑换素币活动",
|
|
|
}
|
|
|
//if (person.ExchangedSuMoney - updateExchangeCashPersonCommand.ExchangedSuMoney) > 0 {
|
|
|
// operationSuMoneyCommand.SuMoney = math.Abs(person.ExchangedSuMoney - updateExchangeCashPersonCommand.ExchangedSuMoney)
|
|
|
// operationSuMoneyCommand.OperationType = 1
|
|
|
//} else {
|
|
|
// operationSuMoneyCommand.SuMoney = math.Abs(person.ExchangedSuMoney - updateExchangeCashPersonCommand.ExchangedSuMoney)
|
|
|
// operationSuMoneyCommand.OperationType = 3
|
|
|
//}
|
|
|
if updateExchangeCashActivityCommand.ExchangedSuMoney - person.ExchangedSuMoney > 0 {
|
|
|
operationSuMoneyCommand.SuMoney = math.Abs(updateExchangeCashActivityCommand.ExchangedSuMoney - person.ExchangedSuMoney)
|
|
|
operationSuMoneyCommand.OperationType = 5
|
...
|
...
|
|