From 2b919980a8c70554a64cb3d03cc95679af4d817f Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: 星期一, 03 七月 2023 00:22:16 +0800
Subject: [PATCH] Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity
---
service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java | 83 +++++++++++++++++++++++++----------------
1 files changed, 51 insertions(+), 32 deletions(-)
diff --git a/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java b/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java
index 92142c7..7039961 100644
--- a/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java
+++ b/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java
@@ -5,11 +5,11 @@
import com.java110.dto.fee.FeeAttrDto;
import com.java110.dto.fee.FeeDetailDto;
import com.java110.dto.fee.FeeDto;
-import com.java110.dto.payFeeDetailMonth.PayFeeDetailMonthDto;
-import com.java110.dto.payFeeDetailMonth.PayFeeMonthOwnerDto;
+import com.java110.dto.payFee.PayFeeDetailMonthDto;
+import com.java110.dto.payFee.PayFeeMonthOwnerDto;
import com.java110.intf.community.IRoomInnerServiceSMO;
import com.java110.intf.fee.IPayFeeDetailMonthInnerServiceSMO;
-import com.java110.po.payFeeDetailMonth.PayFeeDetailMonthPo;
+import com.java110.po.payFee.PayFeeDetailMonthPo;
import com.java110.utils.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -52,16 +52,16 @@
Double feePrice = Double.parseDouble(feePriceAll.get("feePrice").toString());
//todo 濡傛灉鏄竴娆℃�ц垂鐢� 闄や互
- if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getPayerObjType())) {
- return feePrice;
- }
- double maxMonth = Math.ceil(computeFeeSMOImpl.dayCompare(feeDto.getStartTime(), feeDto.getEndTime()));
- if (maxMonth <= 0) {
- return feePrice;
-
- }
- BigDecimal feePriceDec = new BigDecimal(feePrice).divide(new BigDecimal(maxMonth), 2, BigDecimal.ROUND_HALF_UP);
- feePrice = feePriceDec.doubleValue();
+// if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getPayerObjType())) {
+// return feePrice;
+// }
+// double maxMonth = Math.ceil(computeFeeSMOImpl.dayCompare(feeDto.getStartTime(), feeDto.getEndTime()));
+// if (maxMonth <= 0) {
+// return feePrice;
+//
+// }
+// BigDecimal feePriceDec = new BigDecimal(feePrice).divide(new BigDecimal(maxMonth), 2, BigDecimal.ROUND_HALF_UP);
+// feePrice = feePriceDec.doubleValue();
return feePrice;
}
@@ -95,6 +95,8 @@
if (feeDetailDtos == null || feeDetailDtos.size() < 1) {
return;
}
+
+
for (FeeDetailDto feeDetailDto : feeDetailDtos) {
// todo 閫愭潯鍘荤鏁�
@@ -132,6 +134,17 @@
BigDecimal receivableAmount = new BigDecimal(feePrice);
+ BigDecimal dayReceivableAmount = null;
+
+ //todo 涓�娆℃�ц垂鐢� 鏃ュ簲鏀惰绠�
+ if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) {
+ int day = DateUtil.daysBetween(endTime, startTime);
+ if (day < 1) {
+ day = 1;
+ }
+ dayReceivableAmount = receivableAmount.divide(new BigDecimal(day), 4, BigDecimal.ROUND_HALF_UP);// 鏃� 搴旀敹
+ }
+
// todo 瀵绘壘绗竴涓嚜鐒舵湀 涓�鏃�
Calendar firstMonthDayCal = Calendar.getInstance();
firstMonthDayCal.setTime(startTime);
@@ -144,20 +157,23 @@
int curDay = 0;
int curMonthMaxDay = 30;
BigDecimal curMonthReceivableAmount = null;
- BigDecimal dayReceivableAmount = null;
+
while (firstMonthDayTime.getTime() < endTime.getTime()) {
curDay = DateUtil.daysBetween(firstMonthDayTime, startMonthDayTime);
- // todo 璁$畻褰撴湀澶╂暟
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(startMonthDayTime);
- curMonthMaxDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
- dayReceivableAmount = receivableAmount.divide(new BigDecimal(curMonthMaxDay), 4, BigDecimal.ROUND_HALF_UP);// 鏃� 瀹炴敹
+ //todo 鍛ㄦ湡鎬ц垂鐢� 鏃ュ簲鏀堕噸鏂扮畻
+ if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) {
+ // todo 璁$畻褰撴湀澶╂暟
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(startMonthDayTime);
+ curMonthMaxDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
+ dayReceivableAmount = receivableAmount.divide(new BigDecimal(curMonthMaxDay), 4, BigDecimal.ROUND_HALF_UP);// 鏃� 瀹炴敹
+ }
// todo 璁$畻 搴旀敹
curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP);
// todo 淇濆瓨鏁版嵁鍒皃ay_fee_detail_month
- toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), 0, null, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime);
+ toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), 0, null, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime,deadlineTime);
// todo 灏唖tartTime 淇敼涓� 涓嬫湀1鏃ユ椂闂�
startMonthDayTime = firstMonthDayTime;
@@ -172,17 +188,19 @@
}
curDay = DateUtil.daysBetween(endTime, startMonthDayTime);
-
- // todo 璁$畻褰撴湀澶╂暟
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(startMonthDayTime);
- curMonthMaxDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
- dayReceivableAmount = receivableAmount.divide(new BigDecimal(curMonthMaxDay), 4, BigDecimal.ROUND_HALF_UP);// 鏃� 瀹炴敹
+ //todo 鍛ㄦ湡鎬ц垂鐢� 鏃ュ簲鏀堕噸鏂扮畻
+ if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) {
+ // todo 璁$畻褰撴湀澶╂暟
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(startMonthDayTime);
+ curMonthMaxDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
+ dayReceivableAmount = receivableAmount.divide(new BigDecimal(curMonthMaxDay), 4, BigDecimal.ROUND_HALF_UP);// 鏃� 瀹炴敹
+ }
// todo 璁$畻 搴旀敹
curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP);
// todo 淇濆瓨鏁版嵁鍒皃ay_fee_detail_month
- toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), 0, null, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime);
+ toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), 0, null, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime,deadlineTime);
payFeeDetailMonthInnerServiceSMOImpl.savePayFeeDetailMonths(payFeeDetailMonthPos);
}
@@ -225,7 +243,7 @@
curMonthReceivedAmount = new BigDecimal(curDay).multiply(dayReceivedAmount).setScale(4, BigDecimal.ROUND_HALF_UP);
// todo 淇濆瓨鏁版嵁鍒皃ay_fee_detail_month
- toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), curMonthReceivedAmount.doubleValue(), feeDetailDto, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime);
+ toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), curMonthReceivedAmount.doubleValue(), feeDetailDto, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime,endTime);
// todo 灏唖tartTime 淇敼涓� 涓嬫湀1鏃ユ椂闂�
startMonthDayTime = firstMonthDayTime;
@@ -246,7 +264,7 @@
curMonthReceivedAmount = new BigDecimal(curDay).multiply(dayReceivedAmount).setScale(4, BigDecimal.ROUND_HALF_UP);
// todo 淇濆瓨鏁版嵁鍒皃ay_fee_detail_month
- toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), curMonthReceivedAmount.doubleValue(), feeDetailDto, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime);
+ toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), curMonthReceivedAmount.doubleValue(), feeDetailDto, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime,endTime);
payFeeDetailMonthInnerServiceSMOImpl.savePayFeeDetailMonths(payFeeDetailMonthPos);
}
@@ -265,7 +283,8 @@
FeeDto feeDto,
PayFeeMonthOwnerDto payFeeMonthOwnerDto,
List<PayFeeDetailMonthPo> payFeeDetailMonthPos,
- Date curTime) {
+ Date curTime,
+ Date deadlineTime) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(curTime);
@@ -286,7 +305,7 @@
getDiscountAmount(Double.parseDouble(tmpPayFeeDetailMonthPo.getReceivableAmount()),
Double.parseDouble(tmpPayFeeDetailMonthPo.getReceivedAmount()),
calendar.getTime(), feeDto) + "");
- tmpPayFeeDetailMonthPo.setMonthId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_monthId));
+ tmpPayFeeDetailMonthPo.setMonthId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_monthId,true));
tmpPayFeeDetailMonthPo.setRemark("绋嬪簭璁$畻鐢熸垚");
tmpPayFeeDetailMonthPo.setObjName(payFeeMonthOwnerDto.getObjName());
tmpPayFeeDetailMonthPo.setObjId(payFeeMonthOwnerDto.getObjId());
@@ -294,6 +313,7 @@
tmpPayFeeDetailMonthPo.setOwnerName(payFeeMonthOwnerDto.getOwnerName());
tmpPayFeeDetailMonthPo.setLink(payFeeMonthOwnerDto.getLink());
tmpPayFeeDetailMonthPo.setCurMonthTime(DateUtil.getFormatTimeStringB(calendar.getTime()));
+ tmpPayFeeDetailMonthPo.setDeadlineTime(DateUtil.getFormatTimeStringA(deadlineTime));
if (feeDetailDto == null) {
tmpPayFeeDetailMonthPo.setPayFeeTime(null);
} else { // todo 浜よ垂璁板綍 淇濆瓨鏃�
@@ -305,7 +325,6 @@
payFeeDetailMonthPos.add(tmpPayFeeDetailMonthPo);
}
-
}
--
Gitblit v1.8.0