作者 陈志颖

fix:修复更新兑换清单活动id获取错误问题

@@ -1049,6 +1049,7 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC @@ -1049,6 +1049,7 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC
1049 1049
1050 // 更新兑换清单 1050 // 更新兑换清单
1051 func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeCashPersonCommand *command.UpdateExchangeCashPersonCommand) (interface{}, error) { 1051 func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeCashPersonCommand *command.UpdateExchangeCashPersonCommand) (interface{}, error) {
  1052 + fmt.Print(updateExchangeCashPersonCommand, "\n")
1052 if err := updateExchangeCashPersonCommand.ValidateCommand(); err != nil { 1053 if err := updateExchangeCashPersonCommand.ValidateCommand(); err != nil {
1053 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 1054 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
1054 } 1055 }
@@ -1079,7 +1080,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC @@ -1079,7 +1080,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC
1079 } else { 1080 } else {
1080 exchangeCashPersonListRepository = value 1081 exchangeCashPersonListRepository = value
1081 } 1082 }
1082 - person, err := exchangeCashPersonListRepository.FindOne(map[string]interface{}{"listId": updateExchangeCashPersonCommand.ListId}) 1083 + person, err := exchangeCashPersonListRepository.FindOne(map[string]interface{}{"id": updateExchangeCashPersonCommand.ListId})
1083 if err != nil { 1084 if err != nil {
1084 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1085 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1085 } 1086 }
@@ -1089,6 +1090,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC @@ -1089,6 +1090,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC
1089 if err := person.Update(tool_funs.SimpleStructToMap(updateExchangeCashPersonCommand)); err != nil { 1090 if err := person.Update(tool_funs.SimpleStructToMap(updateExchangeCashPersonCommand)); err != nil {
1090 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 1091 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
1091 } 1092 }
  1093 + fmt.Print(person, "\n")
1092 // 更新兑换活动 1094 // 更新兑换活动
1093 var exchangeCashActivityRepository domain.ExchangeActivityRepository 1095 var exchangeCashActivityRepository domain.ExchangeActivityRepository
1094 if value, err := factory.CreateExchangeCashActivityRepository(map[string]interface{}{ 1096 if value, err := factory.CreateExchangeCashActivityRepository(map[string]interface{}{
@@ -1129,7 +1131,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC @@ -1129,7 +1131,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC
1129 } else { 1131 } else {
1130 cashPoolDao = value 1132 cashPoolDao = value
1131 } 1133 }
1132 - activitySuMoneyStatistics, err := cashPoolDao.CalculateActivityExchangedSuMoney(activityFound.CompanyId) 1134 + activitySuMoneyStatistics, err := cashPoolDao.CalculateActivityExchangedSuMoney(activityFound.ActivityId)
1133 if err != nil { 1135 if err != nil {
1134 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1136 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1135 } 1137 }
@@ -1160,13 +1162,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC @@ -1160,13 +1162,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC
1160 OperationType: 0, 1162 OperationType: 0,
1161 OperationDescription: "参与兑换素币活动", 1163 OperationDescription: "参与兑换素币活动",
1162 } 1164 }
1163 - //if (person.ExchangedSuMoney - updateExchangeCashPersonCommand.ExchangedSuMoney) > 0 {  
1164 - // operationSuMoneyCommand.SuMoney = math.Abs(person.ExchangedSuMoney - updateExchangeCashPersonCommand.ExchangedSuMoney)  
1165 - // operationSuMoneyCommand.OperationType = 1  
1166 - //} else {  
1167 - // operationSuMoneyCommand.SuMoney = math.Abs(person.ExchangedSuMoney - updateExchangeCashPersonCommand.ExchangedSuMoney)  
1168 - // operationSuMoneyCommand.OperationType = 3  
1169 - //}  
1170 if updateExchangeCashActivityCommand.ExchangedSuMoney - person.ExchangedSuMoney > 0 { 1165 if updateExchangeCashActivityCommand.ExchangedSuMoney - person.ExchangedSuMoney > 0 {
1171 operationSuMoneyCommand.SuMoney = math.Abs(updateExchangeCashActivityCommand.ExchangedSuMoney - person.ExchangedSuMoney) 1166 operationSuMoneyCommand.SuMoney = math.Abs(updateExchangeCashActivityCommand.ExchangedSuMoney - person.ExchangedSuMoney)
1172 operationSuMoneyCommand.OperationType = 5 1167 operationSuMoneyCommand.OperationType = 5