作者 陈志颖

fix:修复导入判断

... ... @@ -1491,7 +1491,21 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
}
failureDataList = append(failureDataList, row)
continue
} else {
employeeFoundSuMoney := employeeFound.SuMoney
// 判断该员工兑换的素币是否超过本人持有的素币
if employeeFoundSuMoney < (createExchangeCashPersonCommand.ExchangedSuMoney - employeeFoundSuMoney) {
row := []interface{}{
createExchangeCashPersonCommand.PersonName,
createExchangeCashPersonCommand.PersonAccount,
createExchangeCashPersonCommand.ExchangedSuMoney,
"当前兑换素币超过本人持有的素币值",
}
failureDataList = append(failureDataList, row)
continue
}
}
employeeFoundSuMoney := employeeFound.SuMoney
// 判断当前员工是否已经在素币兑换清单中
... ... @@ -1511,23 +1525,22 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
failureDataList = append(failureDataList, row)
continue
}
if len(peopleFound) != 0 {
peopleFoundExchangedSuMoney := peopleFound[0].ExchangedSuMoney
// 判断该员工兑换的素币是否超过本人持有的素币
if createExchangeCashPersonCommand.ExchangedSuMoney > peopleFoundExchangedSuMoney {
if employeeFoundSuMoney < (createExchangeCashPersonCommand.ExchangedSuMoney - peopleFoundExchangedSuMoney) {
row := []interface{}{
createExchangeCashPersonCommand.PersonName,
createExchangeCashPersonCommand.PersonAccount,
createExchangeCashPersonCommand.ExchangedSuMoney,
"当前兑换素币超过本人持有的素币值",
}
failureDataList = append(failureDataList, row)
continue
}
}
}
//if len(peopleFound) != 0 {
// peopleFoundExchangedSuMoney := peopleFound[0].ExchangedSuMoney
// // 判断该员工兑换的素币是否超过本人持有的素币
// if createExchangeCashPersonCommand.ExchangedSuMoney > peopleFoundExchangedSuMoney {
// if employeeFoundSuMoney < (createExchangeCashPersonCommand.ExchangedSuMoney - peopleFoundExchangedSuMoney) {
// row := []interface{}{
// createExchangeCashPersonCommand.PersonName,
// createExchangeCashPersonCommand.PersonAccount,
// createExchangeCashPersonCommand.ExchangedSuMoney,
// "当前兑换素币超过本人持有的素币值",
// }
// failureDataList = append(failureDataList, row)
// continue
// }
// }
//}
if len(peopleFound) > 0 { // 当前导入员工在素币兑换清单中,判断追加素币兑换或撤回素币兑换
// 获取当前员工已兑换素币
personFoundExchangedSuMoney := peopleFound[0].ExchangedSuMoney
... ... @@ -1754,6 +1767,11 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
// 现金增量
cashIncrement := suMoneyIncrement * activityFound.Rate
// 判断该员工兑换的素币是否超过本人持有的素币
if employeeFoundSuMoney < createExchangeCashPersonCommand.ExchangedSuMoney {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "当前兑换素币超过本人持有的素币值")
}
// 更新兑换素币清单命令
updateExchangeCashPersonCommand := &command.UpdateExchangeCashPersonCommand{
ListId: peopleFound[0].ListId,
... ...