作者 陈志颖

fix:新增素币兑换清单判断

... ... @@ -2012,7 +2012,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
createExchangeCashPersonCommand.PersonName,
createExchangeCashPersonCommand.PersonAccount,
createExchangeCashPersonCommand.ExchangedSuMoney,
"当前兑换素币超过本人持有的素币值",
"内部业务错误" + err.Error(),
}
failureDataList = append(failureDataList, row)
continue
... ... @@ -2243,7 +2243,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
getEmployee := map[string]interface{}{
"uid": createExchangeCashPersonCommand.Uid,
"companyId": activityFound.CompanyId,
"status": 1,
}
// 判断当前员工是否有效
... ... @@ -2351,11 +2350,16 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
cashPoolFoundExchangedCash := cashPoolsFound[0].ExchangedCash
// 判断是否超过平台未兑换现金
if activityUpdated.ExchangedSuMoney > activityFoundExchangedSuMoney {
if (activityUpdated.ExchangedSuMoney - activityFoundExchangedSuMoney) * activityUpdated.Rate > cashPoolFoundUnExchangeCash {
//if activityUpdated.ExchangedSuMoney > activityFoundExchangedSuMoney {
// if (activityUpdated.ExchangedSuMoney - activityFoundExchangedSuMoney) * activityUpdated.Rate > cashPoolFoundUnExchangeCash {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金")
// }
//}
// 判断是否超过平台未兑换现金
if createExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate > cashPoolFoundUnExchangeCash {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金")
}
}
// 获取平台素币兑换情况
systemSuMoneyStatistics, err := employeeDao.CalculateSystemSuMoney(activityFound.CompanyId)
... ...
... ... @@ -13,6 +13,7 @@ type EmployeeDao struct {
transactionContext *pgTransaction.TransactionContext
}
// 删除用户
func (dao *EmployeeDao) BatchRemove(uids []int64) error {
tx := dao.transactionContext.PgTx
_, err := tx.QueryOne(
... ... @@ -22,6 +23,7 @@ func (dao *EmployeeDao) BatchRemove(uids []int64) error {
return err
}
// 设置用户状态
func (dao *EmployeeDao) BatchSetStatus(uids []int64, status int) error {
tx := dao.transactionContext.PgTx
_, err := tx.QueryOne(
... ... @@ -49,7 +51,7 @@ func (dao *EmployeeDao) ChangePrincipal(companyId int64, employeeAccount string)
return nil
}
//
// 更新用户素币
func (dao *EmployeeDao) TransferSuMoney(uid int64, suMoney float64) error {
tx := dao.transactionContext.PgTx
_, err := tx.QueryOne(
... ...