From 4e992596dd378bb68021875a90801b4c7ecaf288 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期五, 06 十二月 2024 00:52:07 +0800
Subject: [PATCH] 扣款只扣物业费和水电费扣款
---
service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java | 219 +++++++-----------------------------------------------
1 files changed, 29 insertions(+), 190 deletions(-)
diff --git a/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java
index c047bb4..796bbd4 100644
--- a/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java
+++ b/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java
@@ -250,29 +250,13 @@
payFeeDetailPo.setCashierId(userDtos.get(0).getUserId());
payFeeDetailPo.setCashierName(userDtos.get(0).getName());
payFeeDetailPo.setOpenInvoice("N");
- if (!StringUtil.isEmpty(paramObj.getString("cashAmount")) && !StringUtil.isEmpty(paramObj.getString("integralAmount"))) {
- BigDecimal cashAmount = new BigDecimal(paramObj.getString("cashAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
- BigDecimal integralAmount = new BigDecimal(paramObj.getString("integralAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
- if (!StringUtil.isEmpty(payFeeDetailPo.getRemark())) {
- payFeeDetailPo.setRemark(payFeeDetailPo.getRemark() + "锛岀幇閲戣处鎴锋姷鎵�" + cashAmount + "鍏冿紝绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
- } else {
- payFeeDetailPo.setRemark("鐜伴噾璐︽埛鎶垫墸" + cashAmount + "鍏冿紝绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
- }
- }
- if (!StringUtil.isEmpty(paramObj.getString("cashAmount")) && StringUtil.isEmpty(paramObj.getString("integralAmount"))) {
+
+ if (!StringUtil.isEmpty(paramObj.getString("cashAmount"))) {
BigDecimal cashAmount = new BigDecimal(paramObj.getString("cashAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
if (!StringUtil.isEmpty(payFeeDetailPo.getRemark())) {
payFeeDetailPo.setRemark(payFeeDetailPo.getRemark() + "锛岀幇閲戣处鎴锋姷鎵�" + cashAmount + "鍏�");
} else {
payFeeDetailPo.setRemark("鐜伴噾璐︽埛鎶垫墸" + cashAmount + "鍏�");
- }
- }
- if (StringUtil.isEmpty(paramObj.getString("cashAmount")) && !StringUtil.isEmpty(paramObj.getString("integralAmount"))) {
- BigDecimal integralAmount = new BigDecimal(paramObj.getString("integralAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
- if (!StringUtil.isEmpty(payFeeDetailPo.getRemark())) {
- payFeeDetailPo.setRemark(payFeeDetailPo.getRemark() + "锛岀Н鍒嗚处鎴锋姷鎵�" + integralAmount + "鍏�");
- } else {
- payFeeDetailPo.setRemark("绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
}
}
int flag = payFeeDetailNewV1InnerServiceSMOImpl.savePayFeeDetailNew(payFeeDetailPo);
@@ -332,94 +316,34 @@
return;
}
- BigDecimal integralSum = new BigDecimal(0);
BigDecimal cashSum = new BigDecimal(0);
for (int columnIndex = 0; columnIndex < jsonArray.size(); columnIndex++) {
JSONObject param = jsonArray.getJSONObject(columnIndex);
//璐︽埛閲戦
BigDecimal amount = new BigDecimal(param.getString("amount"));
- if ("2004".equals(param.getString("acctType"))) { //绉垎璐︽埛
- //鑾峰彇鏈�澶ф姷鎵gН鍒�
- BigDecimal maximumNumber = new BigDecimal(param.getString("maximumNumber"));
- //鑾峰彇绉垎鎶垫墸
- BigDecimal deductionProportion = new BigDecimal(param.getString("deductionProportion"));
- int flag = amount.compareTo(maximumNumber);
- BigDecimal redepositAmount = new BigDecimal("0.00");
- if (flag == 1) { //璐︽埛绉垎澶т簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤鏈�澶т娇鐢ㄧН鍒嗘姷鎵�
- redepositAmount = maximumNumber;
- }
- if (flag > -1) { //璐︽埛绉垎澶т簬绛変簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤鏈�澶т娇鐢ㄧН鍒嗘姷鎵�
- redepositAmount = maximumNumber;
- }
- if (flag == -1) { //璐︽埛绉垎灏忎簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤璐︽埛绉垎鎶垫墸
- redepositAmount = amount;
- }
- if (flag < 1) { //璐︽埛绉垎灏忎簬绛変簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤璐︽埛绉垎鎶垫墸
- redepositAmount = amount;
- }
- if (flag == 0) { //璐︽埛绉垎绛変簬鏈�澶т娇鐢ㄧН鍒�
- redepositAmount = amount;
- }
- //璁$畻绉垎鎹㈢畻鐨勯噾棰�
- BigDecimal divide = redepositAmount.divide(deductionProportion);
- BigDecimal receivedAmount = new BigDecimal(payFeeDetailPo.getReceivedAmount());
- //璁$畻瀹炰粯閲戦
- int flag2 = divide.compareTo(receivedAmount);
- BigDecimal subtract = new BigDecimal("0.00");
- //鐢熸垚鎶垫墸鏄庣粏璁板綍
- if (flag2 == -1) { //绉垎鎹㈢畻閲戦灏忎簬瀹炰粯閲戦
- subtract = receivedAmount.subtract(divide);
- } else if (flag < 1) { //绉垎鎹㈢畻閲戦灏忎簬绛変簬瀹炰粯閲戦
- subtract = receivedAmount.subtract(divide);
- }
-// integralSum = integralSum.add(subtract);
- payFeeDetailPo.setReceivedAmount(subtract.toString());
- integralSum = integralSum.add(divide);
- // todo 濡傛灉绉垎澶т簬0
- if (integralSum.doubleValue() > 0) {
- FeeAccountDetailPo feeAccountDetailPo = new FeeAccountDetailPo();
- feeAccountDetailPo.setFadId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_fadId));
- feeAccountDetailPo.setDetailId(payFeeDetailPo.getDetailId());
- feeAccountDetailPo.setCommunityId(payFeeDetailPo.getCommunityId());
- feeAccountDetailPo.setAmount(integralSum.doubleValue() + "");
- feeAccountDetailPo.setState("1003"); //1001 鏃犳姷鎵� 1002 鐜伴噾璐︽埛鎶垫墸 1003 绉垎璐︽埛鎶垫墸 1004 浼樻儬鍒告姷鎵�
- feeAccountDetailServiceSMOImpl.saveFeeAccountDetail(feeAccountDetailPo);
- }
- } else if (AccountDto.ACCT_TYPE_CASH.equals(param.getString("acctType"))) { //鐜伴噾璐︽埛
- //瀹炴敹閲戦
- BigDecimal receivedAmount = new BigDecimal(payFeeDetailPo.getReceivedAmount());
- int flag = amount.compareTo(receivedAmount);
- BigDecimal redepositAmount = new BigDecimal(0.00);
- if (flag == 1) { //鐜伴噾璐︽埛澶т簬瀹炴敹閲戦锛屽氨鐢ㄥ疄鏀堕噾棰�
- redepositAmount = receivedAmount;
- }
- if (flag > -1) { //鐜伴噾璐︽埛澶т簬绛変簬瀹炴敹閲戦锛屽氨鐢ㄥ疄鏀堕噾棰�
- redepositAmount = receivedAmount;
- }
- if (flag == -1) { //鐜伴噾璐︽埛灏忎簬瀹炴敹閲戦锛屽氨鐢ㄧ幇閲戣处鎴�
- redepositAmount = amount;
- }
- if (flag < 1) { //鐜伴噾璐︽埛灏忎簬绛変簬瀹炴敹閲戦锛屽氨鐢ㄧ幇閲戣处鎴�
- redepositAmount = amount;
- }
- if (flag == 0) { //鐜伴噾璐︽埛绛変簬瀹炴敹閲戦
- redepositAmount = amount;
- }
- cashSum = cashSum.add(redepositAmount);
+ //瀹炴敹閲戦
+ BigDecimal receivedAmount = new BigDecimal(payFeeDetailPo.getReceivedAmount());
+ int flag = amount.compareTo(receivedAmount);
+ BigDecimal redepositAmount = new BigDecimal(0.00);
+ if (flag == 1) { //鐜伴噾璐︽埛澶т簬瀹炴敹閲戦锛屽氨鐢ㄥ疄鏀堕噾棰�
+ redepositAmount = receivedAmount;
}
+ if (flag > -1) { //鐜伴噾璐︽埛澶т簬绛変簬瀹炴敹閲戦锛屽氨鐢ㄥ疄鏀堕噾棰�
+ redepositAmount = receivedAmount;
+ }
+ if (flag == -1) { //鐜伴噾璐︽埛灏忎簬瀹炴敹閲戦锛屽氨鐢ㄧ幇閲戣处鎴�
+ redepositAmount = amount;
+ }
+ if (flag < 1) { //鐜伴噾璐︽埛灏忎簬绛変簬瀹炴敹閲戦锛屽氨鐢ㄧ幇閲戣处鎴�
+ redepositAmount = amount;
+ }
+ if (flag == 0) { //鐜伴噾璐︽埛绛変簬瀹炴敹閲戦
+ redepositAmount = amount;
+ }
+ cashSum = cashSum.add(redepositAmount);
- // todo 濡傛灉绉垎澶т簬0
- if (integralSum.doubleValue() > 0) {
- FeeAccountDetailPo feeAccountDetailPo = new FeeAccountDetailPo();
- feeAccountDetailPo.setFadId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_fadId));
- feeAccountDetailPo.setDetailId(payFeeDetailPo.getDetailId());
- feeAccountDetailPo.setCommunityId(payFeeDetailPo.getCommunityId());
- feeAccountDetailPo.setAmount(integralSum.doubleValue() + "");
- feeAccountDetailPo.setState("1003"); //1001 鏃犳姷鎵� 1002 鐜伴噾璐︽埛鎶垫墸 1003 绉垎璐︽埛鎶垫墸 1004 浼樻儬鍒告姷鎵�
- feeAccountDetailServiceSMOImpl.saveFeeAccountDetail(feeAccountDetailPo);
- }
if (cashSum.doubleValue() > 0) {
//鐢熸垚鎶垫墸鏄庣粏璁板綍
FeeAccountDetailPo feeAccountDetailPo = new FeeAccountDetailPo();
@@ -784,7 +708,7 @@
endCalender.setTime(endTime);
BigDecimal receivedAmount = new BigDecimal(Double.parseDouble(paramInJson.getString("receivedAmount")));
cycles = receivedAmount.divide(feePrice, 4, BigDecimal.ROUND_HALF_EVEN);
- targetEndTime = computeFeeSMOImpl.getTargetEndTime(cycles.doubleValue(),endCalender.getTime(),true);
+ targetEndTime = computeFeeSMOImpl.getTargetEndTime(cycles.doubleValue(), endCalender.getTime(), true);
paramInJson.put("tmpCycles", cycles.doubleValue());
businessFeeDetail.put("cycles", cycles.doubleValue());
//澶勭悊 鍙兘杩樺瓨鍦� 瀹炴敹鎵嬪伐鍑忓厤鐨勬儏鍐�
@@ -799,7 +723,7 @@
}
} else if (PayFeeDataDto.TEMP_CYCLE_CUSTOM_END_TIME.equals(paramInJson.getString("cycles"))) { //todo 杩欓噷鎸夌即璐圭粨鏉熸椂闂寸即璐�
String custEndTime = paramInJson.getString("custEndTime");
- if(!custEndTime.contains(":")){
+ if (!custEndTime.contains(":")) {
custEndTime += " 23:59:59";
}
targetEndTime = DateUtil.getDateFromStringA(custEndTime);
@@ -821,7 +745,7 @@
}
} else if ("-105".equals(paramInJson.getString("cycles"))) { //杩欓噷鎸夎嚜瀹氫箟鏃堕棿娈�
String customEndTime = paramInJson.getString("customEndTime");
- if(!customEndTime.contains(":")){
+ if (!customEndTime.contains(":")) {
customEndTime += " 23:59:59";
}
targetEndTime = DateUtil.getDateFromStringA(customEndTime);
@@ -903,7 +827,7 @@
businessFee.put("state", FeeDto.STATE_FINISH);
businessFee.put("endTime", maxEndTime);
}
- }else{
+ } else {
businessFee.put("state", FeeDto.STATE_FINISH);
}
return businessFee;
@@ -924,13 +848,6 @@
BigDecimal receivedAmount = new BigDecimal(paramObj.getString("receivedAmount")); //瀹炴敹娆撅紙鎵f閲戦锛�
BigDecimal redepositAmount = new BigDecimal("0.00");//鎶垫墸閲戦
JSONObject param = jsonArray.getJSONObject(columnIndex);
- if (!StringUtil.isEmpty(param.getString("acctType")) && param.getString("acctType").equals("2004")) { //绉垎璐︽埛
- //鑾峰彇鎶垫墸姣斾緥
- BigDecimal deductionProportion = new BigDecimal(param.getString("deductionProportion"));
- //璁$畻瀹炴敹娆炬墍鎵g殑绉垎
- BigDecimal multiply = receivedAmount.multiply(deductionProportion);
- receivedAmount = multiply;
- }
//璐︽埛閲戦
BigDecimal amount = new BigDecimal(param.getString("amount"));
int flag = amount.compareTo(receivedAmount);
@@ -938,69 +855,6 @@
redepositAmount = amount;//鎶垫墸閲戦
} else {
redepositAmount = receivedAmount;//鎶垫墸閲戦
- }
- if ("2004".equals(param.getString("acctType"))) {
- //鑾峰彇鏈�澶ф姷鎵gН鍒�
- BigDecimal maximumNumber = new BigDecimal(param.getString("maximumNumber"));
- //鑾峰彇绉垎鎶垫墸
- BigDecimal deductionProportion = new BigDecimal(param.getString("deductionProportion"));
- int flag2 = amount.compareTo(maximumNumber);
- if (flag2 == 1) { //璐︽埛绉垎澶т簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤鏈�澶т娇鐢ㄧН鍒嗘姷鎵�
- int flag3 = maximumNumber.compareTo(receivedAmount);
- if (flag3 == 1) { //濡傛灉鏈�澶т娇鐢ㄧН鍒嗗ぇ浜庡疄鏀堕噾棰濇姷鎵gН鍒嗭紝灏辨妸瀹炴敹閲戦鎶垫墸绉垎璧嬪�肩粰鎶垫墸绉垎
- redepositAmount = receivedAmount;
- } else if (flag3 > -1) {//濡傛灉鏈�澶т娇鐢ㄧН鍒嗗ぇ浜庣瓑浜庡疄鏀堕噾棰濇姷鎵gН鍒嗭紝灏辨妸瀹炴敹閲戦鎶垫墸绉垎璧嬪�肩粰鎶垫墸绉垎
- redepositAmount = receivedAmount;
- } else {
- redepositAmount = maximumNumber;
- }
- }
- if (flag2 > -1) { //璐︽埛绉垎澶т簬绛変簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤鏈�澶т娇鐢ㄧН鍒嗘姷鎵�
- int flag3 = maximumNumber.compareTo(receivedAmount);
- if (flag3 == 1) { //濡傛灉鏈�澶т娇鐢ㄧН鍒嗗ぇ浜庡疄鏀堕噾棰濇姷鎵gН鍒嗭紝灏辨妸瀹炴敹閲戦鎶垫墸绉垎璧嬪�肩粰鎶垫墸绉垎
- redepositAmount = receivedAmount;
- } else if (flag3 > -1) {//濡傛灉鏈�澶т娇鐢ㄧН鍒嗗ぇ浜庣瓑浜庡疄鏀堕噾棰濇姷鎵gН鍒嗭紝灏辨妸瀹炴敹閲戦鎶垫墸绉垎璧嬪�肩粰鎶垫墸绉垎
- redepositAmount = receivedAmount;
- } else {
- redepositAmount = maximumNumber;
- }
- }
- if (flag2 == -1) { //璐︽埛绉垎灏忎簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤璐︽埛绉垎鎶垫墸
- int flag3 = amount.compareTo(receivedAmount);
- if (flag3 == 1) { //濡傛灉绉垎璐︽埛澶т簬瀹炴敹閲戦鎶垫墸绉垎锛屽氨鎶婂疄鏀堕噾棰濇姷鎵gН鍒嗚祴鍊肩粰鎶垫墸绉垎
- redepositAmount = receivedAmount;
- } else if (flag3 > -1) {//濡傛灉绉垎璐︽埛澶т簬绛変簬瀹炴敹閲戦鎶垫墸绉垎锛屽氨鎶婂疄鏀堕噾棰濇姷鎵gН鍒嗚祴鍊肩粰鎶垫墸绉垎
- redepositAmount = receivedAmount;
- } else {
- redepositAmount = amount;
- }
- }
- if (flag2 < 1) { //璐︽埛绉垎灏忎簬绛変簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤璐︽埛绉垎鎶垫墸
- int flag3 = amount.compareTo(receivedAmount);
- if (flag3 == 1) { //濡傛灉绉垎璐︽埛澶т簬瀹炴敹閲戦鎶垫墸绉垎锛屽氨鎶婂疄鏀堕噾棰濇姷鎵gН鍒嗚祴鍊肩粰鎶垫墸绉垎
- redepositAmount = receivedAmount;
- } else if (flag3 > -1) {//濡傛灉绉垎璐︽埛澶т簬绛変簬瀹炴敹閲戦鎶垫墸绉垎锛屽氨鎶婂疄鏀堕噾棰濇姷鎵gН鍒嗚祴鍊肩粰鎶垫墸绉垎
- redepositAmount = receivedAmount;
- } else {
- redepositAmount = amount;
- }
- }
- if (flag2 == 0) { //璐︽埛绉垎绛変簬鏈�澶т娇鐢ㄧН鍒�
- int flag3 = amount.compareTo(receivedAmount);
- if (flag3 == 1) { //濡傛灉绉垎璐︽埛澶т簬瀹炴敹閲戦鎶垫墸绉垎锛屽氨鎶婂疄鏀堕噾棰濇姷鎵gН鍒嗚祴鍊肩粰鎶垫墸绉垎
- redepositAmount = receivedAmount;
- } else if (flag3 > -1) {//濡傛灉绉垎璐︽埛澶т簬绛変簬瀹炴敹閲戦鎶垫墸绉垎锛屽氨鎶婂疄鏀堕噾棰濇姷鎵gН鍒嗚祴鍊肩粰鎶垫墸绉垎
- redepositAmount = receivedAmount;
- } else {
- redepositAmount = amount;
- }
- }
- //璁$畻绉垎鎹㈢畻鐨勯噾棰�
- BigDecimal divide = redepositAmount.divide(deductionProportion);
- BigDecimal divide1 = receivedAmount.divide(deductionProportion);
- //璁$畻杩橀渶鏀粯鐨勯噾棰�
- BigDecimal subtract = divide1.subtract(divide);
- paramObj.put("receivedAmount", subtract);
}
String acctId = param.getString("acctId");
if (StringUtil.isEmpty(acctId)) {
@@ -1011,7 +865,7 @@
//鏌ヨ璐︽埛閲戦
accountDtos = accountInnerServiceSMOImpl.queryAccounts(accountDto);
Assert.listOnlyOne(accountDtos, "鏌ヨ璐︽埛閲戦閿欒锛�");
- if (accountDtos != null && accountDtos.size() > 0) {
+ if (!ListUtil.isNull(accountDtos)) {
AccountDto accountDto1 = accountDtos.get(0);
BigDecimal accountDto1Amount = new BigDecimal(accountDto1.getAmount());
if (accountDto1Amount.compareTo(redepositAmount) == -1) {
@@ -1104,16 +958,8 @@
tmpPayFeeDetailPo.setState(FeeDetailDto.STATE_OWE);
tmpPayFeeDetailPo.setOpenInvoice("N");
tmpPayFeeDetailPo.setRemark("鎸夌即璐规椂闂存缂磋垂,杩欓儴鍒嗚垂鐢ㄦ寜娆犺垂鐨勬柟寮忛噸鏂扮敓鎴愶紝璇峰湪" + payObjNameRemark + "涓婃煡鐪�");
- if (!StringUtil.isEmpty(reqJson.getString("cashAmount")) && !StringUtil.isEmpty(reqJson.getString("integralAmount"))) {
- BigDecimal cashAmount = new BigDecimal(reqJson.getString("cashAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
- BigDecimal integralAmount = new BigDecimal(reqJson.getString("integralAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
- if (!StringUtil.isEmpty(tmpPayFeeDetailPo.getRemark())) {
- tmpPayFeeDetailPo.setRemark(tmpPayFeeDetailPo.getRemark() + "锛岀幇閲戣处鎴锋姷鎵�" + cashAmount + "鍏冿紝绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
- } else {
- tmpPayFeeDetailPo.setRemark("鐜伴噾璐︽埛鎶垫墸" + cashAmount + "鍏冿紝绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
- }
- }
- if (!StringUtil.isEmpty(reqJson.getString("cashAmount")) && StringUtil.isEmpty(reqJson.getString("integralAmount"))) {
+
+ if (!StringUtil.isEmpty(reqJson.getString("cashAmount"))) {
BigDecimal cashAmount = new BigDecimal(reqJson.getString("cashAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
if (!StringUtil.isEmpty(tmpPayFeeDetailPo.getRemark())) {
tmpPayFeeDetailPo.setRemark(tmpPayFeeDetailPo.getRemark() + "锛岀幇閲戣处鎴锋姷鎵�" + cashAmount + "鍏�");
@@ -1121,14 +967,7 @@
tmpPayFeeDetailPo.setRemark("鐜伴噾璐︽埛鎶垫墸" + cashAmount + "鍏�");
}
}
- if (StringUtil.isEmpty(reqJson.getString("cashAmount")) && !StringUtil.isEmpty(reqJson.getString("integralAmount"))) {
- BigDecimal integralAmount = new BigDecimal(reqJson.getString("integralAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
- if (!StringUtil.isEmpty(tmpPayFeeDetailPo.getRemark())) {
- tmpPayFeeDetailPo.setRemark(tmpPayFeeDetailPo.getRemark() + "锛岀Н鍒嗚处鎴锋姷鎵�" + integralAmount + "鍏�");
- } else {
- tmpPayFeeDetailPo.setRemark("绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
- }
- }
+
int flag = payFeeDetailNewV1InnerServiceSMOImpl.savePayFeeDetailNew(tmpPayFeeDetailPo);
if (flag < 1) {
--
Gitblit v1.8.0