|
@@ -103,6 +103,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co |
|
@@ -103,6 +103,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co |
103
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
103
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
104
|
}
|
104
|
}
|
105
|
cashPoolExchangeCash := cashPools[0].ExchangedCash
|
105
|
cashPoolExchangeCash := cashPools[0].ExchangedCash
|
|
|
106
|
+ cashPoolUnExchangeCash := cashPools[0].UnExchangeCash
|
106
|
|
107
|
|
107
|
// 不存在现金池
|
108
|
// 不存在现金池
|
108
|
if count == 0 { // 新增现金池
|
109
|
if count == 0 { // 新增现金池
|
|
@@ -160,7 +161,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co |
|
@@ -160,7 +161,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co |
160
|
CashPoolId: cashPools[0].CashPoolId,
|
161
|
CashPoolId: cashPools[0].CashPoolId,
|
161
|
Cash: createCashPoolCommand.Cash,
|
162
|
Cash: createCashPoolCommand.Cash,
|
162
|
ExchangedCash: cashPoolExchangeCash,
|
163
|
ExchangedCash: cashPoolExchangeCash,
|
163
|
- UnExchangeCash: cashPools[0].UnExchangeCash + (createCashPoolCommand.Cash - cashPools[0].Cash),
|
164
|
+ UnExchangeCash: cashPoolUnExchangeCash + (createCashPoolCommand.Cash - cashPools[0].Cash),
|
164
|
ExchangedSuMoney: systemExchangedSuMoney,
|
165
|
ExchangedSuMoney: systemExchangedSuMoney,
|
165
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|
166
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|
166
|
Rate: newRate,
|
167
|
Rate: newRate,
|
|
@@ -838,6 +839,9 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
|
@@ -838,6 +839,9 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
838
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateExchangeCashActivityCommand.ExchangeCashActivityId)))
|
839
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateExchangeCashActivityCommand.ExchangeCashActivityId)))
|
839
|
}
|
840
|
}
|
840
|
|
841
|
|
|
|
842
|
+ activityFoundExchangedSuMoney := activityFound.ExchangedSuMoney
|
|
|
843
|
+ activityFoundExchangedCash := activityFound.ExchangedCash
|
|
|
844
|
+
|
841
|
// 获取当前公司现金池
|
845
|
// 获取当前公司现金池
|
842
|
_, cashPoolsFound, err := cashPoolRepository.Find(map[string]interface{}{
|
846
|
_, cashPoolsFound, err := cashPoolRepository.Find(map[string]interface{}{
|
843
|
"companyId": activityFound.CompanyId,
|
847
|
"companyId": activityFound.CompanyId,
|
|
@@ -879,7 +883,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
|
@@ -879,7 +883,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
879
|
|
883
|
|
880
|
if updateExchangeCashActivityCommand.ExchangeRate != activityFoundRate && updateExchangeCashActivityCommand.ExchangeRate != 0 { // 更新兑换活动兑换汇率
|
884
|
if updateExchangeCashActivityCommand.ExchangeRate != activityFoundRate && updateExchangeCashActivityCommand.ExchangeRate != 0 { // 更新兑换活动兑换汇率
|
881
|
// 判断兑换活动清单中现金总金额是否超过平台未兑换现金值
|
885
|
// 判断兑换活动清单中现金总金额是否超过平台未兑换现金值
|
882
|
- if activityFound.ExchangedSuMoney * updateExchangeCashActivityCommand.ExchangeRate > cashPoolFoundUnExchangeCash {
|
886
|
+ if activityFoundExchangedSuMoney * updateExchangeCashActivityCommand.ExchangeRate > cashPoolFoundUnExchangeCash {
|
883
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金")
|
887
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金")
|
884
|
}
|
888
|
}
|
885
|
|
889
|
|
|
@@ -924,7 +928,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
|
@@ -924,7 +928,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
924
|
systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64)
|
928
|
systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64)
|
925
|
|
929
|
|
926
|
// 更新兑换活动命令已兑换现金
|
930
|
// 更新兑换活动命令已兑换现金
|
927
|
- updateExchangeCashActivityCommand.ExchangedCash = updateExchangeCashActivityCommand.ExchangeRate * activityFound.ExchangedSuMoney
|
931
|
+ updateExchangeCashActivityCommand.ExchangedCash = updateExchangeCashActivityCommand.ExchangeRate * activityFoundExchangedSuMoney
|
928
|
deadline := updateExchangeCashActivityCommand.Deadline.Local()
|
932
|
deadline := updateExchangeCashActivityCommand.Deadline.Local()
|
929
|
updateExchangeCashActivityCommand.Deadline = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local)
|
933
|
updateExchangeCashActivityCommand.Deadline = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local)
|
930
|
|
934
|
|
|
@@ -933,14 +937,14 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
|
@@ -933,14 +937,14 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
933
|
if systemExchangedSuMoney == 0 {
|
937
|
if systemExchangedSuMoney == 0 {
|
934
|
rate = 0
|
938
|
rate = 0
|
935
|
} else {
|
939
|
} else {
|
936
|
- rate = (cashPoolFoundExchangedCash + (updateExchangeCashActivityCommand.ExchangedCash - activityFound.ExchangedCash)) / systemExchangedSuMoney
|
940
|
+ rate = (cashPoolFoundExchangedCash + (updateExchangeCashActivityCommand.ExchangedCash - activityFoundExchangedCash)) / systemExchangedSuMoney
|
937
|
}
|
941
|
}
|
938
|
|
942
|
|
939
|
// 更新现金池命令
|
943
|
// 更新现金池命令
|
940
|
updateCashPoolCommand := &command.UpdateCashPoolCommand{
|
944
|
updateCashPoolCommand := &command.UpdateCashPoolCommand{
|
941
|
CashPoolId: cashPoolsFound[0].CashPoolId,
|
945
|
CashPoolId: cashPoolsFound[0].CashPoolId,
|
942
|
- ExchangedCash: cashPoolFoundExchangedCash + (updateExchangeCashActivityCommand.ExchangedCash - activityFound.ExchangedCash),
|
|
|
943
|
- UnExchangeCash: cashPoolFoundUnExchangeCash - (updateExchangeCashActivityCommand.ExchangedCash - activityFound.ExchangedCash) ,
|
946
|
+ ExchangedCash: cashPoolFoundExchangedCash + (updateExchangeCashActivityCommand.ExchangedCash - activityFoundExchangedCash),
|
|
|
947
|
+ UnExchangeCash: cashPoolFoundUnExchangeCash - (updateExchangeCashActivityCommand.ExchangedCash - activityFoundExchangedCash) ,
|
944
|
ExchangedSuMoney: systemExchangedSuMoney,
|
948
|
ExchangedSuMoney: systemExchangedSuMoney,
|
945
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|
949
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|
946
|
Rate: rate,
|
950
|
Rate: rate,
|
|
@@ -962,7 +966,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
|
@@ -962,7 +966,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
962
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
966
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
963
|
}
|
967
|
}
|
964
|
} else { // 更新兑换活动时间
|
968
|
} else { // 更新兑换活动时间
|
965
|
- updateExchangeCashActivityCommand.ExchangedCash = activityFound.ExchangedCash
|
969
|
+ updateExchangeCashActivityCommand.ExchangedCash = activityFoundExchangedCash
|
966
|
deadline := updateExchangeCashActivityCommand.Deadline.Local()
|
970
|
deadline := updateExchangeCashActivityCommand.Deadline.Local()
|
967
|
updateExchangeCashActivityCommand.Deadline = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local)
|
971
|
updateExchangeCashActivityCommand.Deadline = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local)
|
968
|
}
|
972
|
}
|
|
@@ -979,7 +983,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
|
@@ -979,7 +983,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
979
|
}
|
983
|
}
|
980
|
|
984
|
|
981
|
// 更新兑换活动命令已兑换素币
|
985
|
// 更新兑换活动命令已兑换素币
|
982
|
- updateExchangeCashActivityCommand.ExchangedSuMoney = activityFound.ExchangedSuMoney
|
986
|
+ updateExchangeCashActivityCommand.ExchangedSuMoney = activityFoundExchangedSuMoney
|
983
|
|
987
|
|
984
|
var currentExchangeCashActivityIndex int
|
988
|
var currentExchangeCashActivityIndex int
|
985
|
|
989
|
|
|
@@ -1107,6 +1111,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
|
@@ -1107,6 +1111,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
1107
|
if personFound == nil {
|
1111
|
if personFound == nil {
|
1108
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateExchangeCashPersonCommand.ListId)))
|
1112
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateExchangeCashPersonCommand.ListId)))
|
1109
|
}
|
1113
|
}
|
|
|
1114
|
+ personFoundExchangedSuMoney := personFound.ExchangedSuMoney
|
1110
|
|
1115
|
|
1111
|
// 获取相关兑换活动
|
1116
|
// 获取相关兑换活动
|
1112
|
activityFound, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"activityId": personFound.ExchangeCashActivityId})
|
1117
|
activityFound, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"activityId": personFound.ExchangeCashActivityId})
|
|
@@ -1116,6 +1121,8 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
|
@@ -1116,6 +1121,8 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
1116
|
if activityFound == nil {
|
1121
|
if activityFound == nil {
|
1117
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(personFound.ExchangeCashActivityId)))
|
1122
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(personFound.ExchangeCashActivityId)))
|
1118
|
}
|
1123
|
}
|
|
|
1124
|
+ activityFoundExchangedSuMoney := activityFound.ExchangedSuMoney
|
|
|
1125
|
+ activityFoundExchangedCash := activityFound.ExchangedCash
|
1119
|
|
1126
|
|
1120
|
// 获取员工查询条件
|
1127
|
// 获取员工查询条件
|
1121
|
getEmployee := map[string]interface{}{
|
1128
|
getEmployee := map[string]interface{}{
|
|
@@ -1134,12 +1141,11 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
|
@@ -1134,12 +1141,11 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
1134
|
employeeFoundSuMoney := employeeFound.SuMoney
|
1141
|
employeeFoundSuMoney := employeeFound.SuMoney
|
1135
|
|
1142
|
|
1136
|
// 判断该员工兑换的素币是否超过本人持有的素币
|
1143
|
// 判断该员工兑换的素币是否超过本人持有的素币
|
1137
|
- if employeeFoundSuMoney < updateExchangeCashPersonCommand.ExchangedSuMoney {
|
1144
|
+ if updateExchangeCashPersonCommand.ExchangedSuMoney > personFoundExchangedSuMoney {
|
|
|
1145
|
+ if employeeFoundSuMoney < (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney) {
|
1138
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "当前兑换素币超过本人持有的素币值")
|
1146
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "当前兑换素币超过本人持有的素币值")
|
1139
|
}
|
1147
|
}
|
1140
|
-
|
|
|
1141
|
- // 获取兑换清单员工已兑换素币
|
|
|
1142
|
- personFoundExchangedSuMoney := personFound.ExchangedSuMoney
|
1148
|
+ }
|
1143
|
|
1149
|
|
1144
|
// 更新兑换清单,个人已兑换现金计算
|
1150
|
// 更新兑换清单,个人已兑换现金计算
|
1145
|
updateExchangeCashPersonCommand.ExchangedCash = updateExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate
|
1151
|
updateExchangeCashPersonCommand.ExchangedCash = updateExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate
|
|
@@ -1158,8 +1164,8 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
|
@@ -1158,8 +1164,8 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
1158
|
// 更新素币兑换活动命令
|
1164
|
// 更新素币兑换活动命令
|
1159
|
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
|
1165
|
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
|
1160
|
ExchangeCashActivityId: personFound.ExchangeCashActivityId,
|
1166
|
ExchangeCashActivityId: personFound.ExchangeCashActivityId,
|
1161
|
- ExchangedSuMoney: activityFound.ExchangedSuMoney + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney),
|
|
|
1162
|
- ExchangedCash: activityFound.ExchangedCash + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney) * activityFound.Rate,
|
1167
|
+ ExchangedSuMoney: activityFoundExchangedSuMoney + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney),
|
|
|
1168
|
+ ExchangedCash: activityFoundExchangedCash + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney) * activityFound.Rate,
|
1163
|
Deadline: activityFound.Deadline,
|
1169
|
Deadline: activityFound.Deadline,
|
1164
|
CountDown: activityFound.CountDown,
|
1170
|
CountDown: activityFound.CountDown,
|
1165
|
ExchangeRate: activityFound.Rate,
|
1171
|
ExchangeRate: activityFound.Rate,
|
|
@@ -1229,13 +1235,16 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
|
@@ -1229,13 +1235,16 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
1229
|
}
|
1235
|
}
|
1230
|
|
1236
|
|
1231
|
cashPoolFoundUnExchangeCash := cashPoolsFound[0].UnExchangeCash
|
1237
|
cashPoolFoundUnExchangeCash := cashPoolsFound[0].UnExchangeCash
|
|
|
1238
|
+ cashPoolFoundExchangedCash := cashPoolsFound[0].ExchangedCash
|
1232
|
|
1239
|
|
1233
|
// 判断是否超过平台未兑换现金
|
1240
|
// 判断是否超过平台未兑换现金
|
1234
|
- if activityUpdated.ExchangedSuMoney * activityUpdated.Rate > cashPoolFoundUnExchangeCash {
|
1241
|
+ if activityUpdated.ExchangedSuMoney > activityFoundExchangedSuMoney {
|
|
|
1242
|
+ if (activityUpdated.ExchangedSuMoney - activityFoundExchangedSuMoney) * activityUpdated.Rate > cashPoolFoundUnExchangeCash {
|
1235
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金")
|
1243
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金")
|
1236
|
}
|
1244
|
}
|
|
|
1245
|
+ }
|
1237
|
|
1246
|
|
1238
|
- systemExchangedCash := cashPoolsFound[0].ExchangedCash + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney) * activityUpdated.Rate
|
1247
|
+ systemExchangedCash := cashPoolFoundExchangedCash + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney) * activityUpdated.Rate
|
1239
|
//systemExchangedSuMoney := cashPoolsFound[0].ExchangedSuMoney + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney)
|
1248
|
//systemExchangedSuMoney := cashPoolsFound[0].ExchangedSuMoney + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney)
|
1240
|
|
1249
|
|
1241
|
// 计算现金池平均兑换汇率
|
1250
|
// 计算现金池平均兑换汇率
|
|
@@ -1251,7 +1260,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
|
@@ -1251,7 +1260,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC |
1251
|
CashPoolId: cashPoolsFound[0].CashPoolId,
|
1260
|
CashPoolId: cashPoolsFound[0].CashPoolId,
|
1252
|
Cash: cashPoolsFound[0].Cash,
|
1261
|
Cash: cashPoolsFound[0].Cash,
|
1253
|
ExchangedCash: systemExchangedCash,
|
1262
|
ExchangedCash: systemExchangedCash,
|
1254
|
- UnExchangeCash: cashPoolsFound[0].UnExchangeCash - (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney) * activityUpdated.Rate,
|
1263
|
+ UnExchangeCash: cashPoolFoundUnExchangeCash - (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney) * activityUpdated.Rate,
|
1255
|
Rate: newRate,
|
1264
|
Rate: newRate,
|
1256
|
ExchangedSuMoney: systemExchangedSuMoney,
|
1265
|
ExchangedSuMoney: systemExchangedSuMoney,
|
1257
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|
1266
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|
|
@@ -1395,6 +1404,9 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
@@ -1395,6 +1404,9 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
1395
|
continue
|
1404
|
continue
|
1396
|
}
|
1405
|
}
|
1397
|
|
1406
|
|
|
|
1407
|
+ activityFoundExchangedSuMoney := activityFound.ExchangedSuMoney
|
|
|
1408
|
+ activityFoundExchangedCash := activityFound.ExchangedCash
|
|
|
1409
|
+
|
1398
|
// 获取当前公司现金池
|
1410
|
// 获取当前公司现金池
|
1399
|
_, cashPoolsFound, err := cashPoolRepository.Find(map[string]interface{}{
|
1411
|
_, cashPoolsFound, err := cashPoolRepository.Find(map[string]interface{}{
|
1400
|
"companyId": activityFound.CompanyId,
|
1412
|
"companyId": activityFound.CompanyId,
|
|
@@ -1420,6 +1432,9 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
@@ -1420,6 +1432,9 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
1420
|
continue
|
1432
|
continue
|
1421
|
}
|
1433
|
}
|
1422
|
|
1434
|
|
|
|
1435
|
+ cashPoolFoundUnExchangeCash := cashPoolsFound[0].UnExchangeCash
|
|
|
1436
|
+ cashPoolFoundExchangedCash := cashPoolsFound[0].ExchangedCash
|
|
|
1437
|
+
|
1423
|
// 获取员工查询条件
|
1438
|
// 获取员工查询条件
|
1424
|
getEmployee := map[string]interface{}{
|
1439
|
getEmployee := map[string]interface{}{
|
1425
|
"account": createExchangeCashPersonCommand.PersonAccount,
|
1440
|
"account": createExchangeCashPersonCommand.PersonAccount,
|
|
@@ -1448,6 +1463,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
@@ -1448,6 +1463,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
1448
|
failureDataList = append(failureDataList, row)
|
1463
|
failureDataList = append(failureDataList, row)
|
1449
|
continue
|
1464
|
continue
|
1450
|
}
|
1465
|
}
|
|
|
1466
|
+ employeeFoundSuMoney := employeeFound.SuMoney
|
1451
|
|
1467
|
|
1452
|
// 判断当前员工是否已经在素币兑换清单中
|
1468
|
// 判断当前员工是否已经在素币兑换清单中
|
1453
|
_, peopleFound, err := exchangeCashPersonListRepository.Find(map[string]interface{}{
|
1469
|
_, peopleFound, err := exchangeCashPersonListRepository.Find(map[string]interface{}{
|
|
@@ -1465,10 +1481,12 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
@@ -1465,10 +1481,12 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
1465
|
}
|
1481
|
}
|
1466
|
failureDataList = append(failureDataList, row)
|
1482
|
failureDataList = append(failureDataList, row)
|
1467
|
continue
|
1483
|
continue
|
1468
|
- }
|
|
|
1469
|
-
|
1484
|
+ } else {
|
|
|
1485
|
+ if len(peopleFound) != 0 {
|
|
|
1486
|
+ peopleFoundExchangedSuMoney := peopleFound[0].ExchangedSuMoney
|
1470
|
// 判断该员工兑换的素币是否超过本人持有的素币
|
1487
|
// 判断该员工兑换的素币是否超过本人持有的素币
|
1471
|
- if employeeFound.SuMoney < createExchangeCashPersonCommand.ExchangedSuMoney {
|
1488
|
+ if createExchangeCashPersonCommand.ExchangedSuMoney > peopleFoundExchangedSuMoney {
|
|
|
1489
|
+ if employeeFoundSuMoney < (createExchangeCashPersonCommand.ExchangedSuMoney - peopleFoundExchangedSuMoney) {
|
1472
|
row := []interface{}{
|
1490
|
row := []interface{}{
|
1473
|
createExchangeCashPersonCommand.PersonName,
|
1491
|
createExchangeCashPersonCommand.PersonName,
|
1474
|
createExchangeCashPersonCommand.PersonAccount,
|
1492
|
createExchangeCashPersonCommand.PersonAccount,
|
|
@@ -1478,6 +1496,9 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
@@ -1478,6 +1496,9 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
1478
|
failureDataList = append(failureDataList, row)
|
1496
|
failureDataList = append(failureDataList, row)
|
1479
|
continue
|
1497
|
continue
|
1480
|
}
|
1498
|
}
|
|
|
1499
|
+ }
|
|
|
1500
|
+ }
|
|
|
1501
|
+ }
|
1481
|
|
1502
|
|
1482
|
if len(peopleFound) > 0 { // 当前导入员工在素币兑换清单中,判断追加素币兑换或撤回素币兑换
|
1503
|
if len(peopleFound) > 0 { // 当前导入员工在素币兑换清单中,判断追加素币兑换或撤回素币兑换
|
1483
|
// 获取当前员工已兑换素币
|
1504
|
// 获取当前员工已兑换素币
|
|
@@ -1488,7 +1509,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
@@ -1488,7 +1509,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
1488
|
|
1509
|
|
1489
|
if createExchangeCashPersonCommand.ExchangedSuMoney < personFoundExchangedSuMoney { // 当前兑换的素币小于本人已兑换素币,撤回兑换素币
|
1510
|
if createExchangeCashPersonCommand.ExchangedSuMoney < personFoundExchangedSuMoney { // 当前兑换的素币小于本人已兑换素币,撤回兑换素币
|
1490
|
// 素币减量
|
1511
|
// 素币减量
|
1491
|
- suMoneyDecrement := peopleFound[0].ExchangedSuMoney - createExchangeCashPersonCommand.ExchangedSuMoney
|
1512
|
+ suMoneyDecrement := personFoundExchangedSuMoney - createExchangeCashPersonCommand.ExchangedSuMoney
|
1492
|
|
1513
|
|
1493
|
// 现金减量
|
1514
|
// 现金减量
|
1494
|
cashDecrement := suMoneyDecrement * activityFound.Rate
|
1515
|
cashDecrement := suMoneyDecrement * activityFound.Rate
|
|
@@ -1529,8 +1550,8 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
@@ -1529,8 +1550,8 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
1529
|
// 更新素币兑换活动命令
|
1550
|
// 更新素币兑换活动命令
|
1530
|
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
|
1551
|
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
|
1531
|
ExchangeCashActivityId: peopleFound[0].ExchangeCashActivityId,
|
1552
|
ExchangeCashActivityId: peopleFound[0].ExchangeCashActivityId,
|
1532
|
- ExchangedSuMoney: activityFound.ExchangedSuMoney - suMoneyDecrement,
|
|
|
1533
|
- ExchangedCash: activityFound.ExchangedCash - cashDecrement,
|
1553
|
+ ExchangedSuMoney: activityFoundExchangedSuMoney - suMoneyDecrement,
|
|
|
1554
|
+ ExchangedCash: activityFoundExchangedCash - cashDecrement,
|
1534
|
Deadline: activityFound.Deadline,
|
1555
|
Deadline: activityFound.Deadline,
|
1535
|
CountDown: activityFound.CountDown,
|
1556
|
CountDown: activityFound.CountDown,
|
1536
|
ExchangeRate: activityFound.Rate,
|
1557
|
ExchangeRate: activityFound.Rate,
|
|
@@ -1606,7 +1627,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
@@ -1606,7 +1627,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
1606
|
}
|
1627
|
}
|
1607
|
|
1628
|
|
1608
|
// 判断兑换活动的现金是否超过现金池未兑换现金
|
1629
|
// 判断兑换活动的现金是否超过现金池未兑换现金
|
1609
|
- if activityUpdated.ExchangedSuMoney * updateExchangeCashActivityCommand.ExchangeRate > cashPoolsFound[0].UnExchangeCash {
|
1630
|
+ if activityUpdated.ExchangedSuMoney * updateExchangeCashActivityCommand.ExchangeRate > cashPoolFoundUnExchangeCash {
|
1610
|
row := []interface{}{
|
1631
|
row := []interface{}{
|
1611
|
createExchangeCashPersonCommand.PersonName,
|
1632
|
createExchangeCashPersonCommand.PersonName,
|
1612
|
createExchangeCashPersonCommand.PersonAccount,
|
1633
|
createExchangeCashPersonCommand.PersonAccount,
|
|
@@ -1647,15 +1668,15 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
@@ -1647,15 +1668,15 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
1647
|
if systemExchangedSuMoney == 0 {
|
1668
|
if systemExchangedSuMoney == 0 {
|
1648
|
newRate = 0
|
1669
|
newRate = 0
|
1649
|
} else {
|
1670
|
} else {
|
1650
|
- newRate = (cashPoolsFound[0].ExchangedCash + personUpdated.ExchangedCash) / systemExchangedSuMoney
|
1671
|
+ newRate = (cashPoolFoundExchangedCash + personUpdated.ExchangedCash) / systemExchangedSuMoney
|
1651
|
}
|
1672
|
}
|
1652
|
|
1673
|
|
1653
|
// 更新现金池命令
|
1674
|
// 更新现金池命令
|
1654
|
updateCashPoolCommand := &command.UpdateCashPoolCommand{
|
1675
|
updateCashPoolCommand := &command.UpdateCashPoolCommand{
|
1655
|
CashPoolId: cashPoolsFound[0].CashPoolId,
|
1676
|
CashPoolId: cashPoolsFound[0].CashPoolId,
|
1656
|
Cash: cashPoolsFound[0].Cash,
|
1677
|
Cash: cashPoolsFound[0].Cash,
|
1657
|
- ExchangedCash: cashPoolsFound[0].ExchangedCash - cashDecrement,
|
|
|
1658
|
- UnExchangeCash: cashPoolsFound[0].UnExchangeCash + cashDecrement,
|
1678
|
+ ExchangedCash: cashPoolFoundExchangedCash - cashDecrement,
|
|
|
1679
|
+ UnExchangeCash: cashPoolFoundUnExchangeCash + cashDecrement,
|
1659
|
ExchangedSuMoney: systemExchangedSuMoney,
|
1680
|
ExchangedSuMoney: systemExchangedSuMoney,
|
1660
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|
1681
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|
1661
|
Rate: newRate,
|
1682
|
Rate: newRate,
|
|
@@ -1739,8 +1760,8 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
@@ -1739,8 +1760,8 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
1739
|
// 更新素币兑换活动命令
|
1760
|
// 更新素币兑换活动命令
|
1740
|
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
|
1761
|
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
|
1741
|
ExchangeCashActivityId: peopleFound[0].ExchangeCashActivityId,
|
1762
|
ExchangeCashActivityId: peopleFound[0].ExchangeCashActivityId,
|
1742
|
- ExchangedSuMoney: activityFound.ExchangedSuMoney + suMoneyIncrement,
|
|
|
1743
|
- ExchangedCash: activityFound.ExchangedCash + cashIncrement,
|
1763
|
+ ExchangedSuMoney: activityFoundExchangedSuMoney + suMoneyIncrement,
|
|
|
1764
|
+ ExchangedCash: activityFoundExchangedCash + cashIncrement,
|
1744
|
Deadline: activityFound.Deadline,
|
1765
|
Deadline: activityFound.Deadline,
|
1745
|
CountDown: activityFound.CountDown,
|
1766
|
CountDown: activityFound.CountDown,
|
1746
|
ExchangeRate: activityFound.Rate,
|
1767
|
ExchangeRate: activityFound.Rate,
|
|
@@ -1816,7 +1837,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
@@ -1816,7 +1837,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
1816
|
}
|
1837
|
}
|
1817
|
|
1838
|
|
1818
|
// 判断兑换活动的现金是否超过现金池未兑换现金
|
1839
|
// 判断兑换活动的现金是否超过现金池未兑换现金
|
1819
|
- if activityUpdated.ExchangedSuMoney * updateExchangeCashActivityCommand.ExchangeRate > cashPoolsFound[0].UnExchangeCash {
|
1840
|
+ if activityUpdated.ExchangedSuMoney * updateExchangeCashActivityCommand.ExchangeRate > cashPoolFoundUnExchangeCash {
|
1820
|
row := []interface{}{
|
1841
|
row := []interface{}{
|
1821
|
createExchangeCashPersonCommand.PersonName,
|
1842
|
createExchangeCashPersonCommand.PersonName,
|
1822
|
createExchangeCashPersonCommand.PersonAccount,
|
1843
|
createExchangeCashPersonCommand.PersonAccount,
|
|
@@ -1857,15 +1878,15 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
@@ -1857,15 +1878,15 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
1857
|
if systemExchangedSuMoney == 0 {
|
1878
|
if systemExchangedSuMoney == 0 {
|
1858
|
newRate = 0
|
1879
|
newRate = 0
|
1859
|
} else {
|
1880
|
} else {
|
1860
|
- newRate = (cashPoolsFound[0].ExchangedCash + personUpdated.ExchangedCash) / systemExchangedSuMoney
|
1881
|
+ newRate = (cashPoolFoundExchangedCash + personUpdated.ExchangedCash) / systemExchangedSuMoney
|
1861
|
}
|
1882
|
}
|
1862
|
|
1883
|
|
1863
|
// 更新现金池命令
|
1884
|
// 更新现金池命令
|
1864
|
updateCashPoolCommand := &command.UpdateCashPoolCommand{
|
1885
|
updateCashPoolCommand := &command.UpdateCashPoolCommand{
|
1865
|
CashPoolId: cashPoolsFound[0].CashPoolId,
|
1886
|
CashPoolId: cashPoolsFound[0].CashPoolId,
|
1866
|
Cash: cashPoolsFound[0].Cash,
|
1887
|
Cash: cashPoolsFound[0].Cash,
|
1867
|
- ExchangedCash: cashPoolsFound[0].ExchangedCash + cashIncrement,
|
|
|
1868
|
- UnExchangeCash: cashPoolsFound[0].UnExchangeCash - cashIncrement,
|
1888
|
+ ExchangedCash: cashPoolFoundExchangedCash + cashIncrement,
|
|
|
1889
|
+ UnExchangeCash: cashPoolFoundUnExchangeCash - cashIncrement,
|
1869
|
ExchangedSuMoney: systemExchangedSuMoney,
|
1890
|
ExchangedSuMoney: systemExchangedSuMoney,
|
1870
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|
1891
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|
1871
|
Rate: newRate,
|
1892
|
Rate: newRate,
|
|
@@ -1972,8 +1993,8 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
@@ -1972,8 +1993,8 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
1972
|
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
|
1993
|
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
|
1973
|
ExchangeCashActivityId: personSaved.ExchangeCashActivityId,
|
1994
|
ExchangeCashActivityId: personSaved.ExchangeCashActivityId,
|
1974
|
ExchangeActivityName: activityFound.ExchangeActivityName,
|
1995
|
ExchangeActivityName: activityFound.ExchangeActivityName,
|
1975
|
- ExchangedSuMoney: activityFound.ExchangedSuMoney + createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
1976
|
- ExchangedCash: activityFound.ExchangedCash + createExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate,
|
1996
|
+ ExchangedSuMoney: activityFoundExchangedSuMoney + createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
1997
|
+ ExchangedCash: activityFoundExchangedCash + createExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate,
|
1977
|
Deadline: activityFound.Deadline,
|
1998
|
Deadline: activityFound.Deadline,
|
1978
|
CountDown: activityFound.CountDown,
|
1999
|
CountDown: activityFound.CountDown,
|
1979
|
ExchangeRate: activityFound.Rate,
|
2000
|
ExchangeRate: activityFound.Rate,
|
|
@@ -2015,7 +2036,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
@@ -2015,7 +2036,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
2015
|
}
|
2036
|
}
|
2016
|
|
2037
|
|
2017
|
// 判断兑换活动的现金是否超过现金池未兑换现金
|
2038
|
// 判断兑换活动的现金是否超过现金池未兑换现金
|
2018
|
- if activityUpdated.ExchangedSuMoney * updateExchangeCashActivityCommand.ExchangeRate > cashPoolsFound[0].UnExchangeCash {
|
2039
|
+ if activityUpdated.ExchangedSuMoney * updateExchangeCashActivityCommand.ExchangeRate > cashPoolFoundUnExchangeCash {
|
2019
|
row := []interface{}{
|
2040
|
row := []interface{}{
|
2020
|
createExchangeCashPersonCommand.PersonName,
|
2041
|
createExchangeCashPersonCommand.PersonName,
|
2021
|
createExchangeCashPersonCommand.PersonAccount,
|
2042
|
createExchangeCashPersonCommand.PersonAccount,
|
|
@@ -2056,15 +2077,15 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
@@ -2056,15 +2077,15 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
2056
|
if systemExchangedSuMoney == 0 {
|
2077
|
if systemExchangedSuMoney == 0 {
|
2057
|
newRate = 0
|
2078
|
newRate = 0
|
2058
|
} else {
|
2079
|
} else {
|
2059
|
- newRate = (cashPoolsFound[0].ExchangedCash + personSaved.ExchangedCash) / systemExchangedSuMoney
|
2080
|
+ newRate = (cashPoolFoundExchangedCash + personSaved.ExchangedCash) / systemExchangedSuMoney
|
2060
|
}
|
2081
|
}
|
2061
|
|
2082
|
|
2062
|
// 更新现金池命令
|
2083
|
// 更新现金池命令
|
2063
|
updateCashPoolCommand := &command.UpdateCashPoolCommand{
|
2084
|
updateCashPoolCommand := &command.UpdateCashPoolCommand{
|
2064
|
CashPoolId: cashPoolsFound[0].CashPoolId,
|
2085
|
CashPoolId: cashPoolsFound[0].CashPoolId,
|
2065
|
Cash: cashPoolsFound[0].Cash,
|
2086
|
Cash: cashPoolsFound[0].Cash,
|
2066
|
- ExchangedCash: cashPoolsFound[0].ExchangedCash + personSaved.ExchangedCash,
|
|
|
2067
|
- UnExchangeCash: cashPoolsFound[0].UnExchangeCash - personSaved.ExchangedCash,
|
2087
|
+ ExchangedCash: cashPoolFoundExchangedCash + personSaved.ExchangedCash,
|
|
|
2088
|
+ UnExchangeCash: cashPoolFoundUnExchangeCash - personSaved.ExchangedCash,
|
2068
|
ExchangedSuMoney: systemExchangedSuMoney,
|
2089
|
ExchangedSuMoney: systemExchangedSuMoney,
|
2069
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|
2090
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|
2070
|
Rate: newRate,
|
2091
|
Rate: newRate,
|
|
@@ -2208,6 +2229,8 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC |
|
@@ -2208,6 +2229,8 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC |
2208
|
if err != nil {
|
2229
|
if err != nil {
|
2209
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
2230
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
2210
|
}
|
2231
|
}
|
|
|
2232
|
+ activityFoundExchangedSuMoney := activityFound.ExchangedSuMoney
|
|
|
2233
|
+ activityFoundExchangedCash := activityFound.ExchangedCash
|
2211
|
|
2234
|
|
2212
|
getEmployee := map[string]interface{}{
|
2235
|
getEmployee := map[string]interface{}{
|
2213
|
"uid": createExchangeCashPersonCommand.Uid,
|
2236
|
"uid": createExchangeCashPersonCommand.Uid,
|
|
@@ -2285,8 +2308,8 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC |
|
@@ -2285,8 +2308,8 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC |
2285
|
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
|
2308
|
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
|
2286
|
ExchangeCashActivityId: personSaved.ExchangeCashActivityId,
|
2309
|
ExchangeCashActivityId: personSaved.ExchangeCashActivityId,
|
2287
|
ExchangeActivityName: activityFound.ExchangeActivityName,
|
2310
|
ExchangeActivityName: activityFound.ExchangeActivityName,
|
2288
|
- ExchangedSuMoney: activityFound.ExchangedSuMoney + createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
2289
|
- ExchangedCash: activityFound.ExchangedCash + createExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate,
|
2311
|
+ ExchangedSuMoney: activityFoundExchangedSuMoney + createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
2312
|
+ ExchangedCash: activityFoundExchangedCash + createExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate,
|
2290
|
Deadline: activityFound.Deadline,
|
2313
|
Deadline: activityFound.Deadline,
|
2291
|
CountDown: activityFound.CountDown,
|
2314
|
CountDown: activityFound.CountDown,
|
2292
|
ExchangeRate: activityFound.Rate,
|
2315
|
ExchangeRate: activityFound.Rate,
|
|
@@ -2317,6 +2340,7 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC |
|
@@ -2317,6 +2340,7 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC |
2317
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, "当前现金池为空,请先投入现金")
|
2340
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, "当前现金池为空,请先投入现金")
|
2318
|
}
|
2341
|
}
|
2319
|
cashPoolFoundUnExchangeCash := cashPoolsFound[0].UnExchangeCash
|
2342
|
cashPoolFoundUnExchangeCash := cashPoolsFound[0].UnExchangeCash
|
|
|
2343
|
+ cashPoolFoundExchangedCash := cashPoolsFound[0].ExchangedCash
|
2320
|
|
2344
|
|
2321
|
// 判断兑换活动的现金是否超过现金池未兑换现金
|
2345
|
// 判断兑换活动的现金是否超过现金池未兑换现金
|
2322
|
if activityUpdated.ExchangedSuMoney * updateExchangeCashActivityCommand.ExchangeRate > cashPoolFoundUnExchangeCash {
|
2346
|
if activityUpdated.ExchangedSuMoney * updateExchangeCashActivityCommand.ExchangeRate > cashPoolFoundUnExchangeCash {
|
|
@@ -2339,15 +2363,15 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC |
|
@@ -2339,15 +2363,15 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC |
2339
|
if systemExchangedSuMoney == 0 {
|
2363
|
if systemExchangedSuMoney == 0 {
|
2340
|
newRate = 0
|
2364
|
newRate = 0
|
2341
|
} else {
|
2365
|
} else {
|
2342
|
- newRate = (cashPoolsFound[0].ExchangedCash + personSaved.ExchangedCash) / systemExchangedSuMoney
|
2366
|
+ newRate = (cashPoolFoundExchangedCash + personSaved.ExchangedCash) / systemExchangedSuMoney
|
2343
|
}
|
2367
|
}
|
2344
|
|
2368
|
|
2345
|
// 更新现金池命令
|
2369
|
// 更新现金池命令
|
2346
|
updateCashPoolCommand := &command.UpdateCashPoolCommand{
|
2370
|
updateCashPoolCommand := &command.UpdateCashPoolCommand{
|
2347
|
CashPoolId: cashPoolsFound[0].CashPoolId,
|
2371
|
CashPoolId: cashPoolsFound[0].CashPoolId,
|
2348
|
Cash: cashPoolsFound[0].Cash,
|
2372
|
Cash: cashPoolsFound[0].Cash,
|
2349
|
- ExchangedCash: cashPoolsFound[0].ExchangedCash + personSaved.ExchangedCash,
|
|
|
2350
|
- UnExchangeCash: cashPoolsFound[0].UnExchangeCash - personSaved.ExchangedCash,
|
2373
|
+ ExchangedCash: cashPoolFoundExchangedCash + personSaved.ExchangedCash,
|
|
|
2374
|
+ UnExchangeCash: cashPoolFoundUnExchangeCash - personSaved.ExchangedCash,
|
2351
|
ExchangedSuMoney: systemExchangedSuMoney,
|
2375
|
ExchangedSuMoney: systemExchangedSuMoney,
|
2352
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|
2376
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|
2353
|
Rate: newRate,
|
2377
|
Rate: newRate,
|
|
@@ -2601,6 +2625,9 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC |
|
@@ -2601,6 +2625,9 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC |
2601
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(personFound.ExchangeCashActivityId)))
|
2625
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(personFound.ExchangeCashActivityId)))
|
2602
|
}
|
2626
|
}
|
2603
|
|
2627
|
|
|
|
2628
|
+ activityFoundExchangedSuMoney := activityFound.ExchangedSuMoney
|
|
|
2629
|
+ activityFoundExchangedCash := activityFound.ExchangedCash
|
|
|
2630
|
+
|
2604
|
// 判断当前人员状态
|
2631
|
// 判断当前人员状态
|
2605
|
getEmployee := map[string]interface{}{
|
2632
|
getEmployee := map[string]interface{}{
|
2606
|
"uid": personFound.EmployeeInfo.Uid,
|
2633
|
"uid": personFound.EmployeeInfo.Uid,
|
|
@@ -2620,8 +2647,8 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC |
|
@@ -2620,8 +2647,8 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC |
2620
|
// 更新兑换素币活动命令
|
2647
|
// 更新兑换素币活动命令
|
2621
|
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
|
2648
|
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
|
2622
|
ExchangeCashActivityId: personFound.ExchangeCashActivityId,
|
2649
|
ExchangeCashActivityId: personFound.ExchangeCashActivityId,
|
2623
|
- ExchangedSuMoney: activityFound.ExchangedSuMoney - personFoundExchangedSuMoney,
|
|
|
2624
|
- ExchangedCash: activityFound.ExchangedCash - personFoundExchangedCash,
|
2650
|
+ ExchangedSuMoney: activityFoundExchangedSuMoney - personFoundExchangedSuMoney,
|
|
|
2651
|
+ ExchangedCash: activityFoundExchangedCash - personFoundExchangedCash,
|
2625
|
Deadline: activityFound.Deadline,
|
2652
|
Deadline: activityFound.Deadline,
|
2626
|
CountDown: activityFound.CountDown,
|
2653
|
CountDown: activityFound.CountDown,
|
2627
|
ExchangeRate: activityFound.Rate,
|
2654
|
ExchangeRate: activityFound.Rate,
|
|
@@ -2681,12 +2708,15 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC |
|
@@ -2681,12 +2708,15 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC |
2681
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(activityFound.CompanyId)))
|
2708
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(activityFound.CompanyId)))
|
2682
|
}
|
2709
|
}
|
2683
|
|
2710
|
|
|
|
2711
|
+ cashPoolFoundExchangedCash := cashPoolsFound[0].ExchangedCash
|
|
|
2712
|
+ cashPoolFoundUnExchangeCash := cashPoolsFound[0].UnExchangeCash
|
|
|
2713
|
+
|
2684
|
// 计算平均兑换汇率
|
2714
|
// 计算平均兑换汇率
|
2685
|
var newRate float64
|
2715
|
var newRate float64
|
2686
|
if systemExchangedSuMoney == 0 {
|
2716
|
if systemExchangedSuMoney == 0 {
|
2687
|
newRate = 0
|
2717
|
newRate = 0
|
2688
|
} else {
|
2718
|
} else {
|
2689
|
- newRate = (cashPoolsFound[0].ExchangedCash - personFoundExchangedCash) / systemExchangedSuMoney
|
2719
|
+ newRate = (cashPoolFoundExchangedCash - personFoundExchangedCash) / systemExchangedSuMoney
|
2690
|
}
|
2720
|
}
|
2691
|
|
2721
|
|
2692
|
// 更新现金池命令
|
2722
|
// 更新现金池命令
|
|
@@ -2694,8 +2724,8 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC |
|
@@ -2694,8 +2724,8 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC |
2694
|
CashPoolId: cashPoolsFound[0].CashPoolId,
|
2724
|
CashPoolId: cashPoolsFound[0].CashPoolId,
|
2695
|
Cash: cashPoolsFound[0].Cash,
|
2725
|
Cash: cashPoolsFound[0].Cash,
|
2696
|
LastRate: cashPoolsFound[0].LastRate,
|
2726
|
LastRate: cashPoolsFound[0].LastRate,
|
2697
|
- ExchangedCash: cashPoolsFound[0].ExchangedCash - personFoundExchangedCash,
|
|
|
2698
|
- UnExchangeCash: cashPoolsFound[0].UnExchangeCash + personFoundExchangedCash,
|
2727
|
+ ExchangedCash: cashPoolFoundExchangedCash - personFoundExchangedCash,
|
|
|
2728
|
+ UnExchangeCash: cashPoolFoundUnExchangeCash + personFoundExchangedCash,
|
2699
|
Rate: newRate,
|
2729
|
Rate: newRate,
|
2700
|
ExchangedSuMoney: systemExchangedSuMoney,
|
2730
|
ExchangedSuMoney: systemExchangedSuMoney,
|
2701
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|
2731
|
UnExchangeSuMoney: systemUnExchangeSuMoney,
|