作者 陈志颖

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

@@ -2012,7 +2012,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc @@ -2012,7 +2012,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
2012 createExchangeCashPersonCommand.PersonName, 2012 createExchangeCashPersonCommand.PersonName,
2013 createExchangeCashPersonCommand.PersonAccount, 2013 createExchangeCashPersonCommand.PersonAccount,
2014 createExchangeCashPersonCommand.ExchangedSuMoney, 2014 createExchangeCashPersonCommand.ExchangedSuMoney,
2015 - "当前兑换素币超过本人持有的素币值", 2015 + "内部业务错误" + err.Error(),
2016 } 2016 }
2017 failureDataList = append(failureDataList, row) 2017 failureDataList = append(failureDataList, row)
2018 continue 2018 continue
@@ -2243,7 +2243,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC @@ -2243,7 +2243,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
2243 getEmployee := map[string]interface{}{ 2243 getEmployee := map[string]interface{}{
2244 "uid": createExchangeCashPersonCommand.Uid, 2244 "uid": createExchangeCashPersonCommand.Uid,
2245 "companyId": activityFound.CompanyId, 2245 "companyId": activityFound.CompanyId,
2246 - "status": 1,  
2247 } 2246 }
2248 2247
2249 // 判断当前员工是否有效 2248 // 判断当前员工是否有效
@@ -2351,11 +2350,16 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC @@ -2351,11 +2350,16 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
2351 cashPoolFoundExchangedCash := cashPoolsFound[0].ExchangedCash 2350 cashPoolFoundExchangedCash := cashPoolsFound[0].ExchangedCash
2352 2351
2353 // 判断是否超过平台未兑换现金 2352 // 判断是否超过平台未兑换现金
2354 - if activityUpdated.ExchangedSuMoney > activityFoundExchangedSuMoney {  
2355 - if (activityUpdated.ExchangedSuMoney - activityFoundExchangedSuMoney) * activityUpdated.Rate > cashPoolFoundUnExchangeCash { 2353 + //if activityUpdated.ExchangedSuMoney > activityFoundExchangedSuMoney {
  2354 + // if (activityUpdated.ExchangedSuMoney - activityFoundExchangedSuMoney) * activityUpdated.Rate > cashPoolFoundUnExchangeCash {
  2355 + // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金")
  2356 + // }
  2357 + //}
  2358 +
  2359 + // 判断是否超过平台未兑换现金
  2360 + if createExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate > cashPoolFoundUnExchangeCash {
2356 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金") 2361 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金")
2357 } 2362 }
2358 - }  
2359 2363
2360 // 获取平台素币兑换情况 2364 // 获取平台素币兑换情况
2361 systemSuMoneyStatistics, err := employeeDao.CalculateSystemSuMoney(activityFound.CompanyId) 2365 systemSuMoneyStatistics, err := employeeDao.CalculateSystemSuMoney(activityFound.CompanyId)
@@ -13,6 +13,7 @@ type EmployeeDao struct { @@ -13,6 +13,7 @@ type EmployeeDao struct {
13 transactionContext *pgTransaction.TransactionContext 13 transactionContext *pgTransaction.TransactionContext
14 } 14 }
15 15
  16 +// 删除用户
16 func (dao *EmployeeDao) BatchRemove(uids []int64) error { 17 func (dao *EmployeeDao) BatchRemove(uids []int64) error {
17 tx := dao.transactionContext.PgTx 18 tx := dao.transactionContext.PgTx
18 _, err := tx.QueryOne( 19 _, err := tx.QueryOne(
@@ -22,6 +23,7 @@ func (dao *EmployeeDao) BatchRemove(uids []int64) error { @@ -22,6 +23,7 @@ func (dao *EmployeeDao) BatchRemove(uids []int64) error {
22 return err 23 return err
23 } 24 }
24 25
  26 +// 设置用户状态
25 func (dao *EmployeeDao) BatchSetStatus(uids []int64, status int) error { 27 func (dao *EmployeeDao) BatchSetStatus(uids []int64, status int) error {
26 tx := dao.transactionContext.PgTx 28 tx := dao.transactionContext.PgTx
27 _, err := tx.QueryOne( 29 _, err := tx.QueryOne(
@@ -49,7 +51,7 @@ func (dao *EmployeeDao) ChangePrincipal(companyId int64, employeeAccount string) @@ -49,7 +51,7 @@ func (dao *EmployeeDao) ChangePrincipal(companyId int64, employeeAccount string)
49 return nil 51 return nil
50 } 52 }
51 53
52 -// 54 +// 更新用户素币
53 func (dao *EmployeeDao) TransferSuMoney(uid int64, suMoney float64) error { 55 func (dao *EmployeeDao) TransferSuMoney(uid int64, suMoney float64) error {
54 tx := dao.transactionContext.PgTx 56 tx := dao.transactionContext.PgTx
55 _, err := tx.QueryOne( 57 _, err := tx.QueryOne(