正在显示
1 个修改的文件
包含
9 行增加
和
8 行删除
@@ -4,7 +4,6 @@ import ( | @@ -4,7 +4,6 @@ import ( | ||
4 | "fmt" | 4 | "fmt" |
5 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/utils" | 5 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/utils" |
6 | "math" | 6 | "math" |
7 | - "strconv" | ||
8 | "time" | 7 | "time" |
9 | 8 | ||
10 | "github.com/linmadan/egglib-go/utils/tool_funs" | 9 | "github.com/linmadan/egglib-go/utils/tool_funs" |
@@ -1257,7 +1256,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC | @@ -1257,7 +1256,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC | ||
1257 | 1256 | ||
1258 | // 更新素币兑换活动命令 | 1257 | // 更新素币兑换活动命令 |
1259 | exchangedSuMoney, _ := decimal.NewFromFloat(activityFoundExchangedSuMoney).Add(decimal.NewFromFloat(updateExchangeCashPersonCommand.ExchangedSuMoney).Sub(decimal.NewFromFloat(personFoundExchangedSuMoney))).Float64() | 1258 | exchangedSuMoney, _ := decimal.NewFromFloat(activityFoundExchangedSuMoney).Add(decimal.NewFromFloat(updateExchangeCashPersonCommand.ExchangedSuMoney).Sub(decimal.NewFromFloat(personFoundExchangedSuMoney))).Float64() |
1260 | - exchangedCash, _ := decimal.NewFromFloat(activityFoundExchangedCash).Add(decimal.NewFromFloat(updateExchangeCashPersonCommand.ExchangedSuMoney).Sub(decimal.NewFromFloat(personFoundExchangedSuMoney))).Mul(decimal.NewFromFloat(activityFound.Rate)).Float64() | 1259 | + exchangedCash, _ := decimal.NewFromFloat(activityFoundExchangedCash).Add(decimal.NewFromFloat(updateExchangeCashPersonCommand.ExchangedSuMoney).Sub(decimal.NewFromFloat(personFoundExchangedSuMoney)).Mul(decimal.NewFromFloat(activityFound.Rate))).Float64() |
1261 | updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{ | 1260 | updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{ |
1262 | ExchangeCashActivityId: personFound.ExchangeCashActivityId, | 1261 | ExchangeCashActivityId: personFound.ExchangeCashActivityId, |
1263 | //ExchangedSuMoney: activityFoundExchangedSuMoney + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney), | 1262 | //ExchangedSuMoney: activityFoundExchangedSuMoney + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney), |
@@ -1345,7 +1344,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC | @@ -1345,7 +1344,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC | ||
1345 | } | 1344 | } |
1346 | 1345 | ||
1347 | //systemExchangedCash := cashPoolFoundExchangedCash + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney) * activityUpdated.Rate | 1346 | //systemExchangedCash := cashPoolFoundExchangedCash + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney) * activityUpdated.Rate |
1348 | - systemExchangedCash, _ := decimal.NewFromFloat(cashPoolFoundExchangedCash).Add(decimal.NewFromFloat(updateExchangeCashPersonCommand.ExchangedSuMoney).Sub(decimal.NewFromFloat(personFoundExchangedSuMoney))).Mul(decimal.NewFromFloat(activityUpdated.Rate)).Float64() | 1347 | + systemExchangedCash, _ := decimal.NewFromFloat(cashPoolFoundExchangedCash).Add(decimal.NewFromFloat(updateExchangeCashPersonCommand.ExchangedSuMoney).Sub(decimal.NewFromFloat(personFoundExchangedSuMoney)).Mul(decimal.NewFromFloat(activityUpdated.Rate))).Float64() |
1349 | //systemExchangedSuMoney := cashPoolsFound[0].ExchangedSuMoney + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney) | 1348 | //systemExchangedSuMoney := cashPoolsFound[0].ExchangedSuMoney + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney) |
1350 | 1349 | ||
1351 | // 计算现金池平均兑换汇率 | 1350 | // 计算现金池平均兑换汇率 |
@@ -1583,7 +1582,8 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc | @@ -1583,7 +1582,8 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc | ||
1583 | } | 1582 | } |
1584 | 1583 | ||
1585 | // 新增兑换素币清单 | 1584 | // 新增兑换素币清单 |
1586 | - newPersonExchangedCash, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", createExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate), 64) | 1585 | + //newPersonExchangedCash, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", createExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate), 64) |
1586 | + newPersonExchangedCash, _ := decimal.NewFromFloat(createExchangeCashPersonCommand.ExchangedSuMoney).Mul(decimal.NewFromFloat(activityFound.Rate)).Float64() | ||
1587 | newPerson := &domain.ExchangeCashPersonList{ | 1587 | newPerson := &domain.ExchangeCashPersonList{ |
1588 | EmployeeInfo: &domain.EmployeeInfo{ | 1588 | EmployeeInfo: &domain.EmployeeInfo{ |
1589 | Uid: employeeFound.EmployeeInfo.Uid, | 1589 | Uid: employeeFound.EmployeeInfo.Uid, |
@@ -1744,8 +1744,8 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc | @@ -1744,8 +1744,8 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc | ||
1744 | Cash: cashPoolFound.Cash, | 1744 | Cash: cashPoolFound.Cash, |
1745 | //ExchangedCash: cashPoolFoundExchangedCash + personSaved.ExchangedCash, | 1745 | //ExchangedCash: cashPoolFoundExchangedCash + personSaved.ExchangedCash, |
1746 | //UnExchangeCash: cashPoolFoundUnExchangeCash - personSaved.ExchangedCash, | 1746 | //UnExchangeCash: cashPoolFoundUnExchangeCash - personSaved.ExchangedCash, |
1747 | - ExchangedCash: newExchangedCash, | ||
1748 | - UnExchangeCash: unExchangeCash, | 1747 | + ExchangedCash: newExchangedCash, |
1748 | + UnExchangeCash: unExchangeCash, | ||
1749 | ExchangedSuMoney: systemExchangedSuMoney, | 1749 | ExchangedSuMoney: systemExchangedSuMoney, |
1750 | UnExchangeSuMoney: systemUnExchangeSuMoney, | 1750 | UnExchangeSuMoney: systemUnExchangeSuMoney, |
1751 | Rate: newRate, | 1751 | Rate: newRate, |
@@ -2349,7 +2349,8 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC | @@ -2349,7 +2349,8 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC | ||
2349 | } | 2349 | } |
2350 | 2350 | ||
2351 | // 新增兑换清单命令 | 2351 | // 新增兑换清单命令 |
2352 | - newPersonExchangedCash, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", createExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate), 64) | 2352 | + //newPersonExchangedCash, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", createExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate), 64) |
2353 | + newPersonExchangedCash, _ := decimal.NewFromFloat(createExchangeCashPersonCommand.ExchangedSuMoney).Mul(decimal.NewFromFloat(activityFound.Rate)).Float64() | ||
2353 | newPerson := &domain.ExchangeCashPersonList{ | 2354 | newPerson := &domain.ExchangeCashPersonList{ |
2354 | EmployeeInfo: &domain.EmployeeInfo{ | 2355 | EmployeeInfo: &domain.EmployeeInfo{ |
2355 | Uid: employeeFound.EmployeeInfo.Uid, | 2356 | Uid: employeeFound.EmployeeInfo.Uid, |
@@ -2387,7 +2388,7 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC | @@ -2387,7 +2388,7 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC | ||
2387 | 2388 | ||
2388 | // 更新兑换活动命令 | 2389 | // 更新兑换活动命令 |
2389 | exchangedSuMoney, _ := decimal.NewFromFloat(activityFoundExchangedSuMoney).Add(decimal.NewFromFloat(createExchangeCashPersonCommand.ExchangedSuMoney)).Float64() | 2390 | exchangedSuMoney, _ := decimal.NewFromFloat(activityFoundExchangedSuMoney).Add(decimal.NewFromFloat(createExchangeCashPersonCommand.ExchangedSuMoney)).Float64() |
2390 | - exchangedCash, _ := decimal.NewFromFloat(activityFoundExchangedCash).Add(decimal.NewFromFloat(createExchangeCashPersonCommand.ExchangedSuMoney)).Mul(decimal.NewFromFloat(activityFound.Rate)).Float64() | 2391 | + exchangedCash, _ := decimal.NewFromFloat(activityFoundExchangedCash).Add(decimal.NewFromFloat(createExchangeCashPersonCommand.ExchangedSuMoney).Mul(decimal.NewFromFloat(activityFound.Rate))).Float64() |
2391 | updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{ | 2392 | updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{ |
2392 | ExchangeCashActivityId: personSaved.ExchangeCashActivityId, | 2393 | ExchangeCashActivityId: personSaved.ExchangeCashActivityId, |
2393 | ExchangeActivityName: activityFound.ExchangeActivityName, | 2394 | ExchangeActivityName: activityFound.ExchangeActivityName, |
-
请 注册 或 登录 后发表评论