作者 陈志颖

fix:修复导入判断

@@ -1491,7 +1491,21 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc @@ -1491,7 +1491,21 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
1491 } 1491 }
1492 failureDataList = append(failureDataList, row) 1492 failureDataList = append(failureDataList, row)
1493 continue 1493 continue
  1494 + } else {
  1495 + employeeFoundSuMoney := employeeFound.SuMoney
  1496 + // 判断该员工兑换的素币是否超过本人持有的素币
  1497 + if employeeFoundSuMoney < (createExchangeCashPersonCommand.ExchangedSuMoney - employeeFoundSuMoney) {
  1498 + row := []interface{}{
  1499 + createExchangeCashPersonCommand.PersonName,
  1500 + createExchangeCashPersonCommand.PersonAccount,
  1501 + createExchangeCashPersonCommand.ExchangedSuMoney,
  1502 + "当前兑换素币超过本人持有的素币值",
1494 } 1503 }
  1504 + failureDataList = append(failureDataList, row)
  1505 + continue
  1506 + }
  1507 + }
  1508 +
1495 employeeFoundSuMoney := employeeFound.SuMoney 1509 employeeFoundSuMoney := employeeFound.SuMoney
1496 1510
1497 // 判断当前员工是否已经在素币兑换清单中 1511 // 判断当前员工是否已经在素币兑换清单中
@@ -1511,23 +1525,22 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc @@ -1511,23 +1525,22 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
1511 failureDataList = append(failureDataList, row) 1525 failureDataList = append(failureDataList, row)
1512 continue 1526 continue
1513 } 1527 }
1514 - if len(peopleFound) != 0 {  
1515 - peopleFoundExchangedSuMoney := peopleFound[0].ExchangedSuMoney  
1516 - // 判断该员工兑换的素币是否超过本人持有的素币  
1517 - if createExchangeCashPersonCommand.ExchangedSuMoney > peopleFoundExchangedSuMoney {  
1518 - if employeeFoundSuMoney < (createExchangeCashPersonCommand.ExchangedSuMoney - peopleFoundExchangedSuMoney) {  
1519 - row := []interface{}{  
1520 - createExchangeCashPersonCommand.PersonName,  
1521 - createExchangeCashPersonCommand.PersonAccount,  
1522 - createExchangeCashPersonCommand.ExchangedSuMoney,  
1523 - "当前兑换素币超过本人持有的素币值",  
1524 - }  
1525 - failureDataList = append(failureDataList, row)  
1526 - continue  
1527 - }  
1528 - }  
1529 - }  
1530 - 1528 + //if len(peopleFound) != 0 {
  1529 + // peopleFoundExchangedSuMoney := peopleFound[0].ExchangedSuMoney
  1530 + // // 判断该员工兑换的素币是否超过本人持有的素币
  1531 + // if createExchangeCashPersonCommand.ExchangedSuMoney > peopleFoundExchangedSuMoney {
  1532 + // if employeeFoundSuMoney < (createExchangeCashPersonCommand.ExchangedSuMoney - peopleFoundExchangedSuMoney) {
  1533 + // row := []interface{}{
  1534 + // createExchangeCashPersonCommand.PersonName,
  1535 + // createExchangeCashPersonCommand.PersonAccount,
  1536 + // createExchangeCashPersonCommand.ExchangedSuMoney,
  1537 + // "当前兑换素币超过本人持有的素币值",
  1538 + // }
  1539 + // failureDataList = append(failureDataList, row)
  1540 + // continue
  1541 + // }
  1542 + // }
  1543 + //}
1531 if len(peopleFound) > 0 { // 当前导入员工在素币兑换清单中,判断追加素币兑换或撤回素币兑换 1544 if len(peopleFound) > 0 { // 当前导入员工在素币兑换清单中,判断追加素币兑换或撤回素币兑换
1532 // 获取当前员工已兑换素币 1545 // 获取当前员工已兑换素币
1533 personFoundExchangedSuMoney := peopleFound[0].ExchangedSuMoney 1546 personFoundExchangedSuMoney := peopleFound[0].ExchangedSuMoney
@@ -1754,6 +1767,11 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc @@ -1754,6 +1767,11 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
1754 // 现金增量 1767 // 现金增量
1755 cashIncrement := suMoneyIncrement * activityFound.Rate 1768 cashIncrement := suMoneyIncrement * activityFound.Rate
1756 1769
  1770 + // 判断该员工兑换的素币是否超过本人持有的素币
  1771 + if employeeFoundSuMoney < createExchangeCashPersonCommand.ExchangedSuMoney {
  1772 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "当前兑换素币超过本人持有的素币值")
  1773 + }
  1774 +
1757 // 更新兑换素币清单命令 1775 // 更新兑换素币清单命令
1758 updateExchangeCashPersonCommand := &command.UpdateExchangeCashPersonCommand{ 1776 updateExchangeCashPersonCommand := &command.UpdateExchangeCashPersonCommand{
1759 ListId: peopleFound[0].ListId, 1777 ListId: peopleFound[0].ListId,