作者 陈志颖

fix:增加添加兑换素币清单时相同员工限制

... ... @@ -1738,6 +1738,18 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的员工")
}
// 判断当前员工是否已经存在兑换素币清单中
if _, people, err := exchangeCashPersonListRepository.Find(map[string]interface{}{
"exchangeCashActivityId": activityFound.ActivityId,
"uid": employeeFound.EmployeeInfo.Uid,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if len(people) > 0 {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "当前员工已存在素币兑换清单中")
}
}
// 判断该员工兑换的素币是否超过本人持有的素币
if employeeFound.SuMoney < createExchangeCashPersonCommand.ExchangedSuMoney {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "当前兑换素币超过本人持有的素币值")
... ...