...
|
...
|
@@ -1414,7 +1414,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
err.Error(),
|
|
|
"请先创建素币兑换活动",
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
...
|
...
|
@@ -1424,7 +1424,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
"当前未创建素币兑换活动",
|
|
|
"请先创建兑换素币活动",
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
...
|
...
|
@@ -1441,7 +1441,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
err.Error(),
|
|
|
"当前现金池为空,请先投入现金",
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
...
|
...
|
@@ -1470,7 +1470,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
err.Error(),
|
|
|
"无效的员工",
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
...
|
...
|
@@ -1487,54 +1487,11 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
}
|
|
|
employeeFoundSuMoney := employeeFound.SuMoney // 当前导入员工持有的素币值
|
|
|
|
|
|
//else {
|
|
|
// employeeFoundSuMoney := employeeFound.SuMoney
|
|
|
// // 判断该员工兑换的素币是否超过本人持有的素币
|
|
|
// if employeeFoundSuMoney < (createExchangeCashPersonCommand.ExchangedSuMoney - employeeFoundSuMoney) {
|
|
|
// row := []interface{}{
|
|
|
// createExchangeCashPersonCommand.PersonName,
|
|
|
// createExchangeCashPersonCommand.PersonAccount,
|
|
|
// createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
// "当前兑换素币超过本人持有的素币值",
|
|
|
// }
|
|
|
// failureDataList = append(failureDataList, row)
|
|
|
// continue
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
//// 判断当前员工是否已经在素币兑换清单中
|
|
|
//_, peopleFound, err := exchangeCashPersonListRepository.Find(map[string]interface{}{
|
|
|
// "employeeAccount": employeeFound.EmployeeInfo.EmployeeAccount,
|
|
|
// "exchangeCashActivityId": activityFound.ActivityId,
|
|
|
// "offset": 0,
|
|
|
// "limit": 1,
|
|
|
//})
|
|
|
//if err != nil {
|
|
|
// row := []interface{}{
|
|
|
// createExchangeCashPersonCommand.PersonName,
|
|
|
// createExchangeCashPersonCommand.PersonAccount,
|
|
|
// createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
// err.Error(),
|
|
|
// }
|
|
|
// failureDataList = append(failureDataList, row)
|
|
|
// continue
|
|
|
//}
|
|
|
|
|
|
// 判断当前员工是否已经在素币兑换清单中
|
|
|
personFound, _ := exchangeCashPersonListRepository.FindOne(map[string]interface{}{
|
|
|
"employeeAccount": employeeFound.EmployeeInfo.EmployeeAccount,
|
|
|
"activityId": activityFound.ActivityId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
row := []interface{}{
|
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
err.Error(),
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
|
|
}
|
|
|
if personFound == nil { // 当前人员不在兑换素币清单中,新增兑换素币清单
|
|
|
// 判断该员工兑换的素币是否超过本人持有的素币
|
|
|
if (createExchangeCashPersonCommand.ExchangedSuMoney - employeeFoundSuMoney) > employeeFoundSuMoney {
|
...
|
...
|
@@ -1542,7 +1499,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
"当前兑换素币超过本人持有的素币值",
|
|
|
"当前兑换素币超过本人持有的素币",
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
...
|
...
|
@@ -1576,7 +1533,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
"保存到兑换素币清单失败",
|
|
|
"保存到素币兑换清单失败",
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
...
|
...
|
@@ -1596,7 +1553,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
"内部业务错误" + err.Error(),
|
|
|
err.Error(),
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
...
|
...
|
@@ -1734,7 +1691,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
err.Error(),
|
|
|
"更新现金池失败",
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
...
|
...
|
@@ -1745,7 +1702,6 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
if createExchangeCashPersonCommand.ExchangedSuMoney < personFoundExchangedSuMoney { // 当前兑换的素币小于本人已兑换素币,撤回兑换素币
|
|
|
// 素币减量
|
|
|
suMoneyDecrement := personFoundExchangedSuMoney - createExchangeCashPersonCommand.ExchangedSuMoney
|
|
|
|
|
|
// 现金减量
|
|
|
cashDecrement := suMoneyDecrement * activityFound.Rate
|
|
|
|
...
|
...
|
@@ -1782,7 +1738,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
"保存到兑换素币清单失败",
|
|
|
"保存到素币兑换清单失败",
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
...
|
...
|
@@ -1823,7 +1779,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
"兑换现金活动保存失败",
|
|
|
"素币兑换活动保存失败",
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
...
|
...
|
@@ -1853,7 +1809,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
"操作个人素币失败",
|
|
|
"操作素币失败",
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
...
|
...
|
@@ -1935,7 +1891,6 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
} else { // 当前兑换素币大于等于已兑换素币,追加兑换素币
|
|
|
// 素币增量
|
|
|
suMoneyIncrement := createExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney
|
|
|
|
|
|
// 现金增量
|
|
|
cashIncrement := suMoneyIncrement * activityFound.Rate
|
|
|
|
...
|
...
|
@@ -2025,7 +1980,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
"保存到兑换现金活动失败",
|
|
|
"保存到素币兑换活动失败",
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
...
|
...
|
@@ -2080,7 +2035,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
"内部业务错误" + err.Error(),
|
|
|
err.Error(),
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
...
|
...
|
@@ -2090,7 +2045,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
"无效的公司员工",
|
|
|
"获取公司平台素币兑换情况失败",
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
...
|
...
|
@@ -2141,49 +2096,13 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc |
|
|
createExchangeCashPersonCommand.PersonName,
|
|
|
createExchangeCashPersonCommand.PersonAccount,
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
err.Error(),
|
|
|
"更新现金池失败",
|
|
|
}
|
|
|
failureDataList = append(failureDataList, row)
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//if len(peopleFound) != 0 {
|
|
|
// peopleFoundExchangedSuMoney := peopleFound[0].ExchangedSuMoney
|
|
|
// // 判断该员工兑换的素币是否超过本人持有的素币
|
|
|
// if createExchangeCashPersonCommand.ExchangedSuMoney > peopleFoundExchangedSuMoney {
|
|
|
// if employeeFoundSuMoney < (createExchangeCashPersonCommand.ExchangedSuMoney - peopleFoundExchangedSuMoney) {
|
|
|
// row := []interface{}{
|
|
|
// createExchangeCashPersonCommand.PersonName,
|
|
|
// createExchangeCashPersonCommand.PersonAccount,
|
|
|
// createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
// "当前兑换素币超过本人持有的素币值",
|
|
|
// }
|
|
|
// failureDataList = append(failureDataList, row)
|
|
|
// continue
|
|
|
// }
|
|
|
// }
|
|
|
//}
|
|
|
//if len(peopleFound) > 0 { // 当前导入员工在素币兑换清单中,判断追加素币兑换或撤回素币兑换
|
|
|
// // 获取当前员工已兑换素币
|
|
|
// //personFoundExchangedSuMoney := peopleFound[0].ExchangedSuMoney
|
|
|
//
|
|
|
// // 获取当前兑换员工已兑换现金
|
|
|
// //personFoundExchangedCash := peopleFound[0].ExchangedCash
|
|
|
//
|
|
|
//
|
|
|
//} else if len(peopleFound) == 0 { // 导入兑换素币清单员工不存在兑换素币清单中,新增兑换素币清单
|
|
|
//
|
|
|
//} else { // 未知情况
|
|
|
// row := []interface{}{
|
|
|
// createExchangeCashPersonCommand.PersonName,
|
|
|
// createExchangeCashPersonCommand.PersonAccount,
|
|
|
// createExchangeCashPersonCommand.ExchangedSuMoney,
|
|
|
// "未知错误",
|
|
|
// }
|
|
|
// failureDataList = append(failureDataList, row)
|
|
|
// continue
|
|
|
//}
|
|
|
}
|
|
|
|
|
|
if len(failureDataList) == 0 {
|
...
|
...
|
|