正在显示
1 个修改的文件
包含
16 行增加
和
26 行删除
@@ -97,8 +97,6 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co | @@ -97,8 +97,6 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co | ||
97 | systemExchangedSuMoney := systemSuMoneyStatistics["systemExchangedSuMoney"].(float64) // 平台已兑换素币 | 97 | systemExchangedSuMoney := systemSuMoneyStatistics["systemExchangedSuMoney"].(float64) // 平台已兑换素币 |
98 | systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64) // 平台未兑换素币 | 98 | systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64) // 平台未兑换素币 |
99 | 99 | ||
100 | - | ||
101 | - | ||
102 | // 获取当前公司现金池 | 100 | // 获取当前公司现金池 |
103 | count, cashPools, err := cashPoolRepository.Find(tool_funs.SimpleStructToMap(createCashPoolCommand)) | 101 | count, cashPools, err := cashPoolRepository.Find(tool_funs.SimpleStructToMap(createCashPoolCommand)) |
104 | if err != nil { | 102 | if err != nil { |
@@ -363,13 +361,13 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang | @@ -363,13 +361,13 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang | ||
363 | t2 := time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local) | 361 | t2 := time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local) |
364 | 362 | ||
365 | // 获取该公司所有兑换现金活动 | 363 | // 获取该公司所有兑换现金活动 |
366 | - if _, activities, err := exchangeActivityRepository.FindAll(map[string]interface{}{ | 364 | + if _, activitiesFound, err := exchangeActivityRepository.FindAll(map[string]interface{}{ |
367 | "companyId": createExchangeCashActivityCommand.CompanyId, | 365 | "companyId": createExchangeCashActivityCommand.CompanyId, |
368 | }); err != nil { | 366 | }); err != nil { |
369 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 367 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
370 | } else { | 368 | } else { |
371 | - for _, activity := range activities { | ||
372 | - if t2.Format("2006-01-02") == activity.Deadline.Local().Format("2006-01-02") { | 369 | + for _, activityFound := range activitiesFound { |
370 | + if t2.Equal(activityFound.Deadline.Local()) { | ||
373 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "兑换活动截止时间不能重合") | 371 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "兑换活动截止时间不能重合") |
374 | } | 372 | } |
375 | } | 373 | } |
@@ -930,10 +928,10 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang | @@ -930,10 +928,10 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang | ||
930 | systemExchangedSuMoney := systemSuMoneyStatistics["systemExchangedSuMoney"].(float64) | 928 | systemExchangedSuMoney := systemSuMoneyStatistics["systemExchangedSuMoney"].(float64) |
931 | systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64) | 929 | systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64) |
932 | 930 | ||
933 | - // 更新兑换活动命令已兑换现金 | ||
934 | - updateExchangeCashActivityCommand.ExchangedCash = updateExchangeCashActivityCommand.ExchangeRate * activityFoundExchangedSuMoney | ||
935 | - deadline := updateExchangeCashActivityCommand.Deadline.Local() | ||
936 | - updateExchangeCashActivityCommand.Deadline = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local) | 931 | + //// 更新兑换活动命令已兑换现金 |
932 | + //updateExchangeCashActivityCommand.ExchangedCash = updateExchangeCashActivityCommand.ExchangeRate * activityFoundExchangedSuMoney | ||
933 | + //deadline := updateExchangeCashActivityCommand.Deadline.Local() | ||
934 | + //updateExchangeCashActivityCommand.Deadline = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local) | ||
937 | 935 | ||
938 | // 计算平均兑换汇率 | 936 | // 计算平均兑换汇率 |
939 | var rate float64 | 937 | var rate float64 |
@@ -968,12 +966,12 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang | @@ -968,12 +966,12 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang | ||
968 | if cashPoolUpdated == nil { | 966 | if cashPoolUpdated == nil { |
969 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 967 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
970 | } | 968 | } |
971 | - } else { // 更新兑换活动时间 | ||
972 | - updateExchangeCashActivityCommand.ExchangedCash = activityFoundExchangedCash | ||
973 | - deadline := updateExchangeCashActivityCommand.Deadline.Local() | ||
974 | - updateExchangeCashActivityCommand.Deadline = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local) | ||
975 | } | 969 | } |
976 | 970 | ||
971 | + updateExchangeCashActivityCommand.ExchangedCash = activityFoundExchangedCash | ||
972 | + deadline := updateExchangeCashActivityCommand.Deadline.Local() | ||
973 | + updateExchangeCashActivityCommand.Deadline = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local) | ||
974 | + | ||
977 | // 更新兑换活动倒计时 | 975 | // 更新兑换活动倒计时 |
978 | t1 := time.Now().Local() | 976 | t1 := time.Now().Local() |
979 | //var t2 = activityFound.Deadline.Local() | 977 | //var t2 = activityFound.Deadline.Local() |
@@ -991,19 +989,19 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang | @@ -991,19 +989,19 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang | ||
991 | var currentExchangeCashActivityIndex int | 989 | var currentExchangeCashActivityIndex int |
992 | 990 | ||
993 | // 获取该公司所有兑换现金活动 | 991 | // 获取该公司所有兑换现金活动 |
994 | - if _, activities, err := exchangeCashActivityRepository.FindAll(map[string]interface{}{ | 992 | + if _, activitiesFound, err := exchangeCashActivityRepository.FindAll(map[string]interface{}{ |
995 | "companyId": activityFound.CompanyId, | 993 | "companyId": activityFound.CompanyId, |
996 | }); err != nil { | 994 | }); err != nil { |
997 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 995 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
998 | } else { | 996 | } else { |
999 | - for i, activity := range activities { | ||
1000 | - if activityFound.Deadline.Local().Format("2006-01-02") == activity.Deadline.Local().Format("2006-01-02") { | 997 | + for i, activity := range activitiesFound { |
998 | + if activityFound.Deadline.Local().Equal(activity.Deadline.Local()) { | ||
1001 | currentExchangeCashActivityIndex = i | 999 | currentExchangeCashActivityIndex = i |
1002 | } | 1000 | } |
1003 | } | 1001 | } |
1004 | - for i, activity := range activities { | 1002 | + for i, activity := range activitiesFound { |
1005 | if i != currentExchangeCashActivityIndex { | 1003 | if i != currentExchangeCashActivityIndex { |
1006 | - if updateExchangeCashActivityCommand.Deadline.Local().Format("2006-01-02") == activity.Deadline.Local().Format("2006-01-02") { | 1004 | + if updateExchangeCashActivityCommand.Deadline.Local().Equal(activity.Deadline.Local()) { |
1007 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "兑换活动截止时间不能重合") | 1005 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "兑换活动截止时间不能重合") |
1008 | } | 1006 | } |
1009 | } | 1007 | } |
@@ -2350,13 +2348,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC | @@ -2350,13 +2348,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC | ||
2350 | cashPoolFoundExchangedCash := cashPoolsFound[0].ExchangedCash | 2348 | cashPoolFoundExchangedCash := cashPoolsFound[0].ExchangedCash |
2351 | 2349 | ||
2352 | // 判断是否超过平台未兑换现金 | 2350 | // 判断是否超过平台未兑换现金 |
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 { | 2351 | if createExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate > cashPoolFoundUnExchangeCash { |
2361 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金") | 2352 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金") |
2362 | } | 2353 | } |
@@ -2646,7 +2637,6 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC | @@ -2646,7 +2637,6 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC | ||
2646 | getEmployee := map[string]interface{}{ | 2637 | getEmployee := map[string]interface{}{ |
2647 | "uid": personFound.EmployeeInfo.Uid, | 2638 | "uid": personFound.EmployeeInfo.Uid, |
2648 | "companyId": activityFound.CompanyId, | 2639 | "companyId": activityFound.CompanyId, |
2649 | - "status": 1, | ||
2650 | } | 2640 | } |
2651 | 2641 | ||
2652 | // 判断当前员工是否有效 | 2642 | // 判断当前员工是否有效 |
-
请 注册 或 登录 后发表评论