|
|
@@ -28,14 +28,13 @@ public class TransferUtils {
|
|
|
* @param entProfit
|
|
|
* @param entAccount
|
|
|
* @param entAccountCard
|
|
|
- * @param applyAmount
|
|
|
* @return
|
|
|
*/
|
|
|
- public static List<InvAccountOp> invAccountEntOpList(JSONObject entProfit, InvAccount entAccount, InvAccountCard entAccountCard, String applyAmount, String operateId) {
|
|
|
+ public static List<InvAccountOp> invAccountEntOpList(JSONObject entProfit, InvAccount entAccount, InvAccountCard entAccountCard, String operateId) {
|
|
|
List<InvAccountOp> list = new ArrayList<>();
|
|
|
if (entProfit != null) {
|
|
|
for (Map.Entry<String, Object> entry : entProfit.entrySet()) {
|
|
|
- if (Integer.parseInt(entry.getValue().toString()) != 0) {
|
|
|
+ if (new BigDecimal(entry.getValue().toString()).compareTo(BigDecimal.ZERO) != 0) {
|
|
|
InvAccountOp invAccountOp = new InvAccountOp();
|
|
|
invAccountOp.setAccountId(entAccount.getAccountId());
|
|
|
invAccountOp.setAccountName(entAccount.getAccountName());
|
|
|
@@ -43,7 +42,7 @@ public class TransferUtils {
|
|
|
invAccountOp.setCardName(entAccountCard.getBankName());
|
|
|
invAccountOp.setAccountOperateId(operateId);
|
|
|
invAccountOp.setProfit(entry.getKey());
|
|
|
- invAccountOp.setMoney(new BigDecimal(entry.getValue().toString()).multiply(new BigDecimal(applyAmount)).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP).toString());
|
|
|
+ invAccountOp.setMoney(entry.getValue().toString());
|
|
|
list.add(invAccountOp);
|
|
|
}
|
|
|
}
|
|
|
@@ -58,13 +57,12 @@ public class TransferUtils {
|
|
|
* @param outProfit
|
|
|
* @param outAccount
|
|
|
* @param outAccountCard
|
|
|
- * @param applyAmount
|
|
|
* @return
|
|
|
*/
|
|
|
- public static List<InvAccountOp> invAccountOutOpList(JSONObject outProfit, InvAccount outAccount, InvAccountCard outAccountCard, String applyAmount, String operateId) {
|
|
|
+ public static List<InvAccountOp> invAccountOutOpList(JSONObject outProfit, InvAccount outAccount, InvAccountCard outAccountCard, String operateId) {
|
|
|
List<InvAccountOp> list = new ArrayList<>();
|
|
|
for (Map.Entry<String, Object> entry : outProfit.entrySet()) {
|
|
|
- if (Integer.parseInt(entry.getValue().toString()) != 0) {
|
|
|
+ if (new BigDecimal(entry.getValue().toString()).compareTo(BigDecimal.ZERO) != 0) {
|
|
|
InvAccountOp invAccountOp = new InvAccountOp();
|
|
|
invAccountOp.setAccountId(outAccount.getAccountId());
|
|
|
invAccountOp.setAccountName(outAccount.getAccountName());
|
|
|
@@ -72,7 +70,7 @@ public class TransferUtils {
|
|
|
invAccountOp.setCardName(outAccountCard.getBankName());
|
|
|
invAccountOp.setProfit(entry.getKey());
|
|
|
invAccountOp.setAccountOperateId(operateId);
|
|
|
- invAccountOp.setMoney(new BigDecimal(String.valueOf(entry.getValue())).multiply(new BigDecimal(applyAmount)).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP).toString());
|
|
|
+ invAccountOp.setMoney(String.valueOf(entry.getValue()));
|
|
|
list.add(invAccountOp);
|
|
|
}
|
|
|
}
|
|
|
@@ -231,8 +229,14 @@ public class TransferUtils {
|
|
|
for (Map.Entry<String, Object> entry : entProfit.entrySet()) {
|
|
|
entAmount = entAmount.add(new BigDecimal(entry.getValue().toString()));
|
|
|
}
|
|
|
- if (!(new BigDecimal(String.valueOf(entAmount)).add(new BigDecimal(String.valueOf(outAmount)))).toString().equals("0")) {
|
|
|
- throw new SystemException("金额未完全分配");
|
|
|
+ String string = (new BigDecimal(String.valueOf(entAmount)).add(new BigDecimal(String.valueOf(outAmount)))).toString();
|
|
|
+
|
|
|
+ if (!string.equals("0")) {
|
|
|
+ if (!string.equals("0.00")){
|
|
|
+ if (!string.equals("0.0")){
|
|
|
+ throw new SystemException("金额未完全分配");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
@@ -367,6 +371,9 @@ public class TransferUtils {
|
|
|
if (enterAccountCard.getBalance().equals("0") || enterAccountCard.getBalance().equals("0.00")) {
|
|
|
throw new SystemException("账户余额不足");
|
|
|
}
|
|
|
+ if (new BigDecimal(enterAccountCard.getBalance()).compareTo(invAccountExcelApplyAmount) < 0 ){
|
|
|
+ throw new SystemException("账户余额不足");
|
|
|
+ }
|
|
|
}
|
|
|
if (!enterAccountCard.getBalance().isEmpty()) {
|
|
|
enterAccountCard.setBalance(new BigDecimal(enterAccountCard.getBalance()).subtract(invAccountExcelApplyAmount).toString());
|