From a20310f135ebf1c8ccff2b619f3eff3d704436a0 Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: 星期四, 08 十二月 2022 13:12:03 +0800
Subject: [PATCH] Merge branch 'xinghong-dev' of http://git.homecommunity.cn/supervip/MicroCommunity
---
service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeMonthStatisticsInnerServiceSMOImpl.java | 217 +++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 189 insertions(+), 28 deletions(-)
diff --git a/service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeMonthStatisticsInnerServiceSMOImpl.java b/service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeMonthStatisticsInnerServiceSMOImpl.java
index e43fe25..df552c5 100755
--- a/service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeMonthStatisticsInnerServiceSMOImpl.java
+++ b/service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeMonthStatisticsInnerServiceSMOImpl.java
@@ -2,8 +2,10 @@
import com.alibaba.fastjson.JSONObject;
import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.core.log.LoggerFactory;
import com.java110.core.smo.IComputeFeeSMO;
import com.java110.dto.RoomDto;
+import com.java110.dto.fee.FeeConfigDto;
import com.java110.dto.fee.FeeDto;
import com.java110.dto.owner.OwnerCarDto;
import com.java110.dto.report.ReportCarDto;
@@ -11,15 +13,19 @@
import com.java110.dto.report.ReportFeeDto;
import com.java110.dto.report.ReportRoomDto;
import com.java110.dto.reportFeeMonthStatistics.ReportFeeMonthStatisticsDto;
+import com.java110.intf.community.IFloorInnerServiceSMO;
+import com.java110.intf.community.IRoomInnerServiceSMO;
+import com.java110.intf.community.IUnitInnerServiceSMO;
import com.java110.intf.report.IGeneratorFeeMonthStatisticsInnerServiceSMO;
+import com.java110.intf.report.IReportFeeMonthStatisticsInnerServiceSMO;
import com.java110.intf.user.IOwnerCarInnerServiceSMO;
import com.java110.po.reportFeeMonthStatistics.ReportFeeMonthStatisticsPo;
import com.java110.report.dao.IReportCommunityServiceDao;
import com.java110.report.dao.IReportFeeMonthStatisticsServiceDao;
import com.java110.report.dao.IReportFeeServiceDao;
+import com.java110.utils.constant.FeeConfigConstant;
import com.java110.utils.util.*;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.RequestBody;
@@ -47,6 +53,9 @@
private IReportFeeMonthStatisticsServiceDao reportFeeMonthStatisticsServiceDaoImpl;
@Autowired
+ private IReportFeeMonthStatisticsInnerServiceSMO reportFeeMonthStatisticsInnerServiceSMOImpl;
+
+ @Autowired
private IReportCommunityServiceDao reportCommunityServiceDaoImpl;
@Autowired
@@ -58,6 +67,15 @@
@Autowired
private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl;
+ @Autowired
+ private IRoomInnerServiceSMO roomInnerServiceSMOImpl;
+
+ @Autowired
+ private IUnitInnerServiceSMO unitInnerServiceSMOImpl;
+
+ @Autowired
+ private IFloorInnerServiceSMO floorInnerServiceSMOImpl;
+
@Override
public int generatorData(@RequestBody ReportFeeMonthStatisticsPo reportFeeMonthStatisticsPo) {
@@ -66,10 +84,13 @@
}
@Async
- private void doGeneratorData(ReportFeeMonthStatisticsPo reportFeeMonthStatisticsPo) {
+ public void doGeneratorData(ReportFeeMonthStatisticsPo reportFeeMonthStatisticsPo) {
String communityId = reportFeeMonthStatisticsPo.getCommunityId();
Assert.hasLength(communityId, "鏈寘鍚皬鍖轰俊鎭�");
+
+ //杩欓噷澶勭悊 鎶ヨ〃涓殑璐圭敤鏄惁琚汉涓� 鍙栨秷 鎴栬�呰垂鐢ㄩ」鏄惁琚垹闄わ紝杩欑鏁版嵁 鎶ヨ〃涓仛娓呯悊锛屼互闃插奖鍝� 鎶ヨ〃鐨勫噯纭害
+ feeDataFiltering(communityId);
//澶勭悊鎴垮眿璐圭敤
dealRoomFee(reportFeeMonthStatisticsPo);
@@ -79,6 +100,31 @@
//澶勭悊缂磋垂缁撴潫鐨勬儏鍐�
dealFinishFee(communityId);
+ }
+
+ private void feeDataFiltering(String communityId) {
+ Map reportFeeDto = new HashMap();
+ reportFeeDto.put("communityId", communityId);
+ List<Map> feeDtos = reportFeeMonthStatisticsServiceDaoImpl.queryInvalidFeeMonthStatistics(reportFeeDto);
+
+ List<String> feeIds = new ArrayList<>();
+ for (Map feeDto : feeDtos) {
+ if (!feeDto.containsKey("feeId") || StringUtil.isNullOrNone(feeDto.get("feeId"))) {
+ continue;
+ }
+
+ feeIds.add(feeDto.get("feeId").toString());
+
+ if (feeIds.size() >= 50) {
+ reportFeeDto.put("feeIds", feeIds);
+ reportFeeMonthStatisticsServiceDaoImpl.deleteInvalidFee(reportFeeDto);
+ feeIds = new ArrayList<>();
+ }
+ }
+ reportFeeDto.put("feeIds", feeIds);
+ if (feeIds.size() > 0) {
+ reportFeeMonthStatisticsServiceDaoImpl.deleteInvalidFee(reportFeeDto);
+ }
}
private void dealFinishFee(String communityId) {
@@ -215,7 +261,7 @@
reportFeeMonthStatisticsDto.setCommunityId(tmpReportCarDto.getCommunityId());
reportFeeMonthStatisticsDto.setConfigId(tmpReportFeeDto.getConfigId());
reportFeeMonthStatisticsDto.setObjId(tmpReportFeeDto.getPayerObjId());
- //reportFeeMonthStatisticsDto.setFeeId(tmpReportFeeDto.getFeeId());
+ reportFeeMonthStatisticsDto.setFeeId(tmpReportFeeDto.getFeeId());//杩欓噷涓嶈兘娉ㄩ噴 濡傛灉涓�涓垂鐢ㄥ垱寤哄鏉℃椂浼氭湁bug
reportFeeMonthStatisticsDto.setObjType(tmpReportFeeDto.getPayerObjType());
reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear() + "");
reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth() + "");
@@ -248,9 +294,16 @@
// reportFeeMonthStatisticsPo.setReceivedAmount("0");
reportFeeMonthStatisticsPo.setOweAmount(oweAmount + "");
reportFeeMonthStatisticsPo.setUpdateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
+ // 缂磋垂浜嗗氨寰楀埛
+ reportFeeMonthStatisticsPo.setHisOweAmount(getHisOweAmount(tmpReportFeeDto) + "");
+ //鏈夊彲鑳芥槸鏈堝唴鍒涘缓鐨勮垂鐢� 姣斿鐢佃垂姘磋垂
+ reportFeeMonthStatisticsPo.setCurReceivableAmount(getCurFeeReceivableAmount(tmpReportFeeDto) + "");
reportFeeMonthStatisticsPo.setCurReceivedAmount(getReceivedAmount(tmpReportFeeDto, 1) + "");
reportFeeMonthStatisticsPo.setHisOweReceivedAmount(getReceivedAmount(tmpReportFeeDto, 2) + "");
reportFeeMonthStatisticsPo.setPreReceivedAmount(getReceivedAmount(tmpReportFeeDto, 3) + "");
+ if (!StringUtil.isEmpty(statistic.getObjType()) && statistic.getObjType().equals("3333")) { //鎴垮眿
+ reportFeeMonthStatisticsPo.setObjNameNum(statistic.getFloorNum() + "-" + statistic.getUnitNum() + "-" + statistic.getRoomNum());
+ }
reportFeeMonthStatisticsServiceDaoImpl.updateReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsPo));
} else {
reportFeeMonthStatisticsPo.setOweAmount(oweAmount + "");
@@ -268,6 +321,7 @@
reportFeeMonthStatisticsPo.setObjType(FeeDto.PAYER_OBJ_TYPE_CAR);
reportFeeMonthStatisticsPo.setFeeName(tmpReportFeeDto.getFeeName());
reportFeeMonthStatisticsPo.setObjName(tmpReportCarDto.getCarNum() + "(" + tmpReportCarDto.getAreaNum() + "鍋滆溅鍦�" + tmpReportCarDto.getNum() + "杞︿綅)");
+ reportFeeMonthStatisticsPo.setObjNameNum(tmpReportCarDto.getAreaNum() + "-" + tmpReportCarDto.getNum() + "-" + tmpReportCarDto.getCarNum());
reportFeeMonthStatisticsPo.setUpdateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
reportFeeMonthStatisticsPo.setHisOweAmount(getHisOweAmount(tmpReportFeeDto) + "");
reportFeeMonthStatisticsPo.setCurReceivableAmount(getCurFeeReceivableAmount(tmpReportFeeDto) + "");
@@ -341,7 +395,7 @@
} else {
double month = computeFeeSMOImpl.dayCompare(tmpReportFeeDto.getEndTime(), curMonthDate.getTime());
BigDecimal curDegree = new BigDecimal(month);
- receivableAmount = curDegree.multiply(new BigDecimal(tmpReportFeeDto.getFeePrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ receivableAmount = curDegree.multiply(new BigDecimal(tmpReportFeeDto.getFeePrice())).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue();
}
@@ -363,6 +417,7 @@
reportFeeMonthStatisticsPo.setObjType(FeeDto.PAYER_OBJ_TYPE_CAR);
reportFeeMonthStatisticsPo.setFeeName(tmpReportFeeDto.getFeeName());
reportFeeMonthStatisticsPo.setObjName(tmpReportCarDto.getCarNum() + "(" + tmpReportCarDto.getAreaNum() + "鍋滆溅鍦�" + tmpReportCarDto.getNum() + "杞︿綅)");
+ reportFeeMonthStatisticsPo.setObjNameNum(tmpReportCarDto.getAreaNum() + "-" + tmpReportCarDto.getNum() + "-" + tmpReportCarDto.getCarNum());
reportFeeMonthStatisticsPo.setUpdateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
reportFeeMonthStatisticsServiceDaoImpl.saveReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsPo));
@@ -409,13 +464,16 @@
reportFeeMonthStatisticsDto.setCommunityId(reportRoomDto.getCommunityId());
reportFeeMonthStatisticsDto.setConfigId(tmpReportFeeDto.getConfigId());
reportFeeMonthStatisticsDto.setObjId(tmpReportFeeDto.getPayerObjId());
- //reportFeeMonthStatisticsDto.setFeeId(tmpReportFeeDto.getFeeId());
+ reportFeeMonthStatisticsDto.setFeeId(tmpReportFeeDto.getFeeId()); //杩欓噷涓嶈兘娉ㄩ噴锛屽洜涓轰竴涓垂鐢ㄥ娆″垱寤烘椂浼氬瓨鍦ㄨ鐩� 瀛樺湪bug闂
reportFeeMonthStatisticsDto.setObjType(tmpReportFeeDto.getPayerObjType());
+ int year = DateUtil.getYear();
+ int month = DateUtil.getMonth();
reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear() + "");
reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth() + "");
List<ReportFeeMonthStatisticsDto> statistics = BeanConvertUtil.covertBeanList(
reportFeeMonthStatisticsServiceDaoImpl.getReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsDto)),
ReportFeeMonthStatisticsDto.class);
+ //List<ReportFeeMonthStatisticsDto> statistics = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeMonthStatisticss(reportFeeMonthStatisticsDto);
//double receivedAmount = getReceivedAmount(tmpReportFeeDto); //瀹炴敹
@@ -445,9 +503,51 @@
reportFeeMonthStatisticsPo.setFeeId(tmpReportFeeDto.getFeeId());
reportFeeMonthStatisticsPo.setUpdateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
reportFeeMonthStatisticsPo.setFeeName(StringUtil.isEmpty(tmpReportFeeDto.getImportFeeName()) ? tmpReportFeeDto.getFeeName() : tmpReportFeeDto.getImportFeeName());
- reportFeeMonthStatisticsPo.setCurReceivedAmount(getReceivedAmount(tmpReportFeeDto, 1) + "");
- reportFeeMonthStatisticsPo.setHisOweReceivedAmount(getReceivedAmount(tmpReportFeeDto, 2) + "");
- reportFeeMonthStatisticsPo.setPreReceivedAmount(getReceivedAmount(tmpReportFeeDto, 3) + "");
+ // 缂磋垂浜嗗氨寰楀埛
+ reportFeeMonthStatisticsPo.setHisOweAmount(MoneyUtil.computePriceScale(getHisOweAmount(tmpReportFeeDto),
+ tmpReportFeeDto.getScale(),
+ Integer.parseInt(tmpReportFeeDto.getDecimalPlace())) + "");
+ //鏈夊彲鑳芥槸鏈堝唴鍒涘缓鐨勮垂鐢� 姣斿鐢佃垂姘磋垂
+ reportFeeMonthStatisticsPo.setCurReceivableAmount(
+ MoneyUtil.computePriceScale(getCurFeeReceivableAmount(tmpReportFeeDto),
+ tmpReportFeeDto.getScale(),
+ Integer.parseInt(tmpReportFeeDto.getDecimalPlace())) + "");
+ reportFeeMonthStatisticsPo.setCurReceivedAmount(
+ MoneyUtil.computePriceScale(getReceivedAmount(tmpReportFeeDto, 1),
+ tmpReportFeeDto.getScale(),
+ Integer.parseInt(tmpReportFeeDto.getDecimalPlace())) + "");
+ reportFeeMonthStatisticsPo.setHisOweReceivedAmount(
+ MoneyUtil.computePriceScale(getReceivedAmount(tmpReportFeeDto, 2),
+ tmpReportFeeDto.getScale(),
+ Integer.parseInt(tmpReportFeeDto.getDecimalPlace())) + "");
+ reportFeeMonthStatisticsPo.setPreReceivedAmount(MoneyUtil.computePriceScale(getReceivedAmount(tmpReportFeeDto, 3),
+ tmpReportFeeDto.getScale(),
+ Integer.parseInt(tmpReportFeeDto.getDecimalPlace())) + "");
+ /*if (!StringUtil.isEmpty(statistic.getObjType()) && statistic.getObjType().equals("3333")) { //鎴垮眿
+ if (!StringUtil.isEmpty(statistic.getObjId())) {
+ //鑾峰彇浠樿垂瀵硅薄ID
+ String objId = statistic.getObjId();
+ RoomDto roomDto = new RoomDto();
+ roomDto.setRoomId(objId);
+ List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
+ if (roomDtos != null && roomDtos.size() == 1) {
+ String roomNum = roomDtos.get(0).getRoomNum();
+ UnitDto unitDto = new UnitDto();
+ unitDto.setUnitId(roomDtos.get(0).getUnitId());
+ List<UnitDto> unitDtos = unitInnerServiceSMOImpl.queryUnits(unitDto);
+ if (unitDtos != null && unitDtos.size() == 1) {
+ String unitNum = unitDtos.get(0).getUnitNum();
+ FloorDto floorDto = new FloorDto();
+ floorDto.setFloorId(unitDtos.get(0).getFloorId());
+ List<FloorDto> floorDtos = floorInnerServiceSMOImpl.queryFloors(floorDto);
+ if(floorDtos != null && floorDtos.size() == 1){
+ String floorNum = floorDtos.get(0).getFloorNum();
+ statistic.setObjNameNum(floorNum + "-" + unitNum + "-" + roomNum);
+ }
+ }
+ }
+ }
+ }*/
reportFeeMonthStatisticsServiceDaoImpl.updateReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsPo));
} else {
reportFeeMonthStatisticsPo.setOweAmount(oweAmount + "");
@@ -466,8 +566,10 @@
reportFeeMonthStatisticsPo.setFeeName(StringUtil.isEmpty(tmpReportFeeDto.getImportFeeName()) ? tmpReportFeeDto.getFeeName() : tmpReportFeeDto.getImportFeeName());
if (RoomDto.ROOM_TYPE_ROOM.equals(reportRoomDto.getRoomType())) {
reportFeeMonthStatisticsPo.setObjName(reportRoomDto.getFloorNum() + "鏍�" + reportRoomDto.getUnitNum() + "鍗曞厓" + reportRoomDto.getRoomNum() + "瀹�");
+ reportFeeMonthStatisticsPo.setObjNameNum(reportRoomDto.getFloorNum() + "-" + reportRoomDto.getUnitNum() + "-" + reportRoomDto.getRoomNum());
} else {
reportFeeMonthStatisticsPo.setObjName(reportRoomDto.getFloorNum() + "鏍�" + reportRoomDto.getRoomNum() + "瀹�");
+ reportFeeMonthStatisticsPo.setObjNameNum(reportRoomDto.getFloorNum() + "-" + reportRoomDto.getRoomNum());
}
//璁$畻鍘嗗彶娆犺垂
reportFeeMonthStatisticsPo.setHisOweAmount(getHisOweAmount(tmpReportFeeDto) + "");
@@ -477,6 +579,8 @@
reportFeeMonthStatisticsPo.setPreReceivedAmount(getReceivedAmount(tmpReportFeeDto, 3) + "");
reportFeeMonthStatisticsPo.setUpdateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
reportFeeMonthStatisticsServiceDaoImpl.saveReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsPo));
+ //澶勭悊姘寸數璐癸紝姘寸數璐规牴鎹紑濮嬫椂闂磋鍦ㄧ浉搴旀湀琛ュ厖鏁版嵁
+ dealMeteWater(reportFeeMonthStatisticsPo, tmpReportFeeDto);
}
@@ -488,6 +592,45 @@
tmpReportFeeMonthStatisticsPo.setCurMaxTime(DateUtil.getFormatTimeString(endTime, DateUtil.DATE_FORMATE_STRING_A));
tmpReportFeeMonthStatisticsPo.setOweAmount("0");
reportFeeMonthStatisticsServiceDaoImpl.updateReportFeeMonthStatisticsOwe(BeanConvertUtil.beanCovertMap(tmpReportFeeMonthStatisticsPo));
+ }
+
+ /**
+ * 澶勭悊姘寸數璐�
+ *
+ * @param reportFeeMonthStatisticsPo
+ * @param tmpReportFeeDto
+ */
+ private void dealMeteWater(ReportFeeMonthStatisticsPo reportFeeMonthStatisticsPo, ReportFeeDto tmpReportFeeDto) {
+
+ //濡傛灉鏄� 姘磋垂 鐢佃垂 鐓ゆ皵璐�
+ if (!FeeConfigDto.FEE_TYPE_CD_METER.equals(tmpReportFeeDto.getFeeTypeCd())
+ && !FeeConfigDto.FEE_TYPE_CD_WATER.equals(tmpReportFeeDto.getFeeTypeCd())
+ && !FeeConfigDto.FEE_TYPE_CD_GAS.equals(tmpReportFeeDto.getFeeTypeCd())
+ ) {
+ return;
+ }
+ //鏍规嵁璐圭敤寮�濮嬫椂闂� 璁$畻鏈堜唤
+ Date endTime = tmpReportFeeDto.getEndTime();
+ //鍘婚櫎 0 鍥犱负琛ㄩ噷鐨勬湀浠芥槸娌℃湁闆�
+ String curMonth = Integer.parseInt(DateUtil.getFormatTimeString(endTime, "MM")) + "";
+ String curYear = DateUtil.getFormatTimeString(endTime, "YYYY");
+ //鏌ヨ鏄惁瀛樺湪 鏁版嵁
+ ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto = new ReportFeeMonthStatisticsDto();
+ reportFeeMonthStatisticsDto.setCommunityId(tmpReportFeeDto.getCommunityId());
+ reportFeeMonthStatisticsDto.setConfigId(tmpReportFeeDto.getConfigId());
+ reportFeeMonthStatisticsDto.setObjId(tmpReportFeeDto.getPayerObjId());
+ //reportFeeMonthStatisticsDto.setFeeId(tmpReportFeeDto.getFeeId());
+ reportFeeMonthStatisticsDto.setObjType(tmpReportFeeDto.getPayerObjType());
+ reportFeeMonthStatisticsDto.setFeeYear(curYear);
+ reportFeeMonthStatisticsDto.setFeeMonth(curMonth);
+ List<ReportFeeMonthStatisticsDto> statistics = BeanConvertUtil.covertBeanList(
+ reportFeeMonthStatisticsServiceDaoImpl.getReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsDto)),
+ ReportFeeMonthStatisticsDto.class);
+ if (!ListUtil.isNull(statistics)) {
+ return;
+ }
+ reportFeeMonthStatisticsPo.setStatisticsId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_statisticsId));
+ reportFeeMonthStatisticsServiceDaoImpl.saveReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsPo));
}
@@ -515,11 +658,17 @@
BigDecimal feePriceDec = new BigDecimal(tmpReportFeeDto.getFeePrice());
Date curDate = DateUtil.getFirstDate();
+ Date nowDate = DateUtil.getCurrentDate();
double month = 0.0;
//宸茬粡瓒呰繃鎴鏃堕棿 鍜� 杩樻病鏈夊埌寮�濮嬫椂闂�
if (curDate.getTime() > tmpReportFeeDto.getDeadlineTime().getTime()
- || curDate.getTime() < tmpReportFeeDto.getEndTime().getTime()) {
+ || nowDate.getTime() < tmpReportFeeDto.getEndTime().getTime()) {
return 0.0;
+ }
+
+ //濡傛灉 1鍙峰皬浜� 璁¤垂璧峰鏃堕棿 閭d箞 灏哻urDate 鏀逛负 褰撳墠鏃堕棿
+ if (curDate.getTime() < tmpReportFeeDto.getEndTime().getTime()) {
+ curDate = tmpReportFeeDto.getEndTime();
}
//杩欓噷闇�瑕佸垽鏂� 缁撴潫鏃堕棿 鏄惁 澶т簬浜嗗綋鏈堟渶鍚庝竴澶╋紝褰撴湀澶╂暟 * 姣忓ぉ閲戦
@@ -534,15 +683,15 @@
if (allDays == 0) { // 闃叉闄ゆ暟涓�0
return 0;
}
- BigDecimal moneyPreDay = feePriceDec.divide(new BigDecimal(allDays), 2, BigDecimal.ROUND_HALF_EVEN);
+ BigDecimal moneyPreDay = feePriceDec.divide(new BigDecimal(allDays), FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN);
if (tmpReportFeeDto.getDeadlineTime().getTime() > nextDate.getTime()) {
int day = DateUtil.getCurrentMonthDay();
- return moneyPreDay.multiply(new BigDecimal(day)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+ return moneyPreDay.multiply(new BigDecimal(day)).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP).doubleValue();
}
// 缁撴潫鏃堕棿 鍦ㄥ綋鏈堝唴
double hisDays = computeFeeSMOImpl.daysBetween(tmpReportFeeDto.getEndTime(), curDate);
- BigDecimal hisDayDec = moneyPreDay.multiply(new BigDecimal(hisDays)).setScale(2, BigDecimal.ROUND_HALF_UP);
- return feePriceDec.subtract(hisDayDec).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+ BigDecimal hisDayDec = moneyPreDay.multiply(new BigDecimal(hisDays)).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP);
+ return feePriceDec.subtract(hisDayDec).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP).doubleValue();
}
month = computeFeeSMOImpl.dayCompare(curDate, tmpReportFeeDto.getDeadlineTime());
@@ -550,7 +699,7 @@
return 0;
}
if (month < 1) {
- return feePriceDec.multiply(new BigDecimal(month)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ return feePriceDec.multiply(new BigDecimal(month)).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue();
}
return tmpReportFeeDto.getFeePrice();
@@ -583,11 +732,11 @@
return 0;
}
//杩欐槸姣忓ぉ鐨勯挶
- BigDecimal moneyPreDay = feePriceDec.divide(new BigDecimal(allDays), 2, BigDecimal.ROUND_HALF_EVEN);
+ BigDecimal moneyPreDay = feePriceDec.divide(new BigDecimal(allDays), FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN);
double hisDays = computeFeeSMOImpl.daysBetween(tmpReportFeeDto.getEndTime(), curDate);
- return moneyPreDay.multiply(new BigDecimal(hisDays)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+ return moneyPreDay.multiply(new BigDecimal(hisDays)).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP).doubleValue();
}
double month = 0.0;
@@ -597,7 +746,7 @@
month = computeFeeSMOImpl.dayCompare(tmpReportFeeDto.getEndTime(), curDate);
}
BigDecimal curDegree = new BigDecimal(month);
- return curDegree.multiply(feePriceDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ return curDegree.multiply(feePriceDec).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue();
}
@@ -650,7 +799,7 @@
} else {
double month = computeFeeSMOImpl.dayCompare(tmpReportFeeDto.getEndTime(), curMonthDate.getTime());
BigDecimal curDegree = new BigDecimal(month);
- receivableAmount = curDegree.multiply(new BigDecimal(tmpReportFeeDto.getFeePrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ receivableAmount = curDegree.multiply(new BigDecimal(tmpReportFeeDto.getFeePrice())).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue();
}
ReportFeeMonthStatisticsPo reportFeeMonthStatisticsPo = new ReportFeeMonthStatisticsPo();
reportFeeMonthStatisticsPo.setDeadlineTime(DateUtil.getFormatTimeString(curMonthDate.getTime(), DateUtil.DATE_FORMATE_STRING_A));
@@ -672,8 +821,10 @@
reportFeeMonthStatisticsPo.setFeeName(StringUtil.isEmpty(tmpReportFeeDto.getImportFeeName()) ? tmpReportFeeDto.getFeeName() : tmpReportFeeDto.getImportFeeName());
if (RoomDto.ROOM_TYPE_ROOM.equals(reportRoomDto.getRoomType())) {
reportFeeMonthStatisticsPo.setObjName(reportRoomDto.getFloorNum() + "鏍�" + reportRoomDto.getUnitNum() + "鍗曞厓" + reportRoomDto.getRoomNum() + "瀹�");
+ reportFeeMonthStatisticsPo.setObjNameNum(reportRoomDto.getFloorNum() + "-" + reportRoomDto.getUnitNum() + "-" + reportRoomDto.getRoomNum());
} else {
reportFeeMonthStatisticsPo.setObjName(reportRoomDto.getFloorNum() + "鏍�" + reportRoomDto.getRoomNum() + "瀹�");
+ reportFeeMonthStatisticsPo.setObjNameNum(reportRoomDto.getFloorNum() + "-" + reportRoomDto.getRoomNum());
}
//璁$畻鍘嗗彶娆犺垂
reportFeeMonthStatisticsPo.setHisOweAmount("0");
@@ -768,6 +919,11 @@
}
Date endTime = ownerCarDtos.get(0).getEndTime();
+ Date maxEndDate = tmpReportFeeDto.getDeadlineTime();
+ if (FeeDto.FEE_FLAG_CYCLE.equals(tmpReportFeeDto.getFeeFlag())) {
+ maxEndDate = tmpReportFeeDto.getConfigEndTime();
+ }
+
//1.0 璐圭敤鍒版湡鏃堕棿鍜岃垂鐢ㄧ粨鏉熸椂闂� 閮戒笉鍦ㄥ綋鏈�
if (!belongCurMonth(tmpReportFeeDto.getEndTime())
&& !belongCurMonth(endTime)
@@ -781,15 +937,15 @@
//绠楀ぉ鏁�
double month = computeFeeSMOImpl.dayCompare(tmpReportFeeDto.getEndTime(), DateUtil.getNextMonthFirstDate());
BigDecimal curDegree = new BigDecimal(month);
- return curDegree.multiply(feePriceDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ return curDegree.multiply(feePriceDec).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue();
}
//3.0 璐圭敤鍒版湡鏃堕棿 涓嶅湪褰撴湀锛岃垂鐢ㄧ粨鏉熸椂闂村湪褰撴湀
if (!belongCurMonth(tmpReportFeeDto.getEndTime())
&& belongCurMonth(endTime)) {
//绠楀ぉ鏁�
- double month = computeFeeSMOImpl.dayCompare(DateUtil.getFirstDate(), tmpReportFeeDto.getConfigEndTime());
+ double month = computeFeeSMOImpl.dayCompare(DateUtil.getFirstDate(), maxEndDate);
BigDecimal curDegree = new BigDecimal(month);
- return curDegree.multiply(feePriceDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ return curDegree.multiply(feePriceDec).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue();
}
return 0.0;
}
@@ -809,7 +965,7 @@
}
BigDecimal feePriceDec = new BigDecimal(tmpReportFeeDto.getFeePrice());
- double money = feePriceDec.divide(new BigDecimal(month), 2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ double money = feePriceDec.divide(new BigDecimal(month), FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue();
return money;
}
@@ -833,28 +989,33 @@
return computeOnceFee(tmpReportFeeDto);
}
+ Date maxEndDate = tmpReportFeeDto.getDeadlineTime();
+ if (FeeDto.FEE_FLAG_CYCLE.equals(tmpReportFeeDto.getFeeFlag())) {
+ maxEndDate = tmpReportFeeDto.getConfigEndTime();
+ }
+
//1.0 璐圭敤鍒版湡鏃堕棿鍜岃垂鐢ㄧ粨鏉熸椂闂� 閮戒笉鍦ㄥ綋鏈�
if (!belongCurMonth(tmpReportFeeDto.getEndTime())
- && !belongCurMonth(tmpReportFeeDto.getConfigEndTime())
+ && !belongCurMonth(maxEndDate)
&& tmpReportFeeDto.getEndTime().getTime() < DateUtil.getFirstDate().getTime()) {
return feePrice;
}
//2.0 璐圭敤鍒版湡鏃堕棿 鍦ㄥ綋鏈堬紝璐圭敤缁撴潫鏃堕棿涓嶅湪褰撴湀
if (belongCurMonth(tmpReportFeeDto.getEndTime())
- && !belongCurMonth(tmpReportFeeDto.getConfigEndTime())) {
+ && !belongCurMonth(maxEndDate)) {
//绠楀ぉ鏁�
double month = computeFeeSMOImpl.dayCompare(tmpReportFeeDto.getEndTime(), DateUtil.getNextMonthFirstDate());
BigDecimal curDegree = new BigDecimal(month);
- return curDegree.multiply(feePriceDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ return curDegree.multiply(feePriceDec).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue();
}
//3.0 璐圭敤鍒版湡鏃堕棿 涓嶅湪褰撴湀锛岃垂鐢ㄧ粨鏉熸椂闂村湪褰撴湀
if (!belongCurMonth(tmpReportFeeDto.getEndTime())
- && belongCurMonth(tmpReportFeeDto.getConfigEndTime())) {
+ && belongCurMonth(maxEndDate)) {
//绠楀ぉ鏁�
- double month = computeFeeSMOImpl.dayCompare(DateUtil.getFirstDate(), tmpReportFeeDto.getConfigEndTime());
+ double month = computeFeeSMOImpl.dayCompare(DateUtil.getFirstDate(), maxEndDate);
BigDecimal curDegree = new BigDecimal(month);
- return curDegree.multiply(feePriceDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ return curDegree.multiply(feePriceDec).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue();
}
return 0.0;
}
--
Gitblit v1.8.0