| | |
| | | import com.java110.intf.community.IRoomInnerServiceSMO; |
| | | import com.java110.intf.fee.IPayFeeDetailMonthInnerServiceSMO; |
| | | import com.java110.po.payFeeDetailMonth.PayFeeDetailMonthPo; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.DateUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | 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; |
| | | } |
| | | |
| | |
| | | * @param feeDto |
| | | * @param payFeeMonthOwnerDto |
| | | */ |
| | | @Autowired |
| | | @Override |
| | | public void waitDispersedFeeDetail(FeeDto feeDto, PayFeeMonthOwnerDto payFeeMonthOwnerDto) { |
| | | PayFeeDetailMonthDto payFeeDetailMonthDto = new PayFeeDetailMonthDto(); |
| | | payFeeDetailMonthDto.setCommunityId(feeDto.getCommunityId()); |
| | |
| | | * @param feePrice |
| | | * @param deadlineTime |
| | | */ |
| | | @Autowired |
| | | @Override |
| | | public void waitDispersedOweFee(FeeDto feeDto, PayFeeMonthOwnerDto payFeeMonthOwnerDto, Double feePrice, Date deadlineTime) { |
| | | // todo 费用已经结束 |
| | | if (FeeDto.STATE_FINISH.equals(feeDto.getState())) { |
| | |
| | | |
| | | 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); |
| | |
| | | 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 保存数据到pay_fee_detail_month |
| | | toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), 0, null, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime); |
| | | toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), 0, null, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime,deadlineTime); |
| | | |
| | | // todo 将startTime 修改为 下月1日时间 |
| | | startMonthDayTime = firstMonthDayTime; |
| | |
| | | } |
| | | |
| | | 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 保存数据到pay_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); |
| | | |
| | | } |
| | |
| | | curMonthReceivedAmount = new BigDecimal(curDay).multiply(dayReceivedAmount).setScale(4, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | // todo 保存数据到pay_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 将startTime 修改为 下月1日时间 |
| | | startMonthDayTime = firstMonthDayTime; |
| | |
| | | curMonthReceivedAmount = new BigDecimal(curDay).multiply(dayReceivedAmount).setScale(4, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | // todo 保存数据到pay_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); |
| | | |
| | | } |
| | |
| | | FeeDto feeDto, |
| | | PayFeeMonthOwnerDto payFeeMonthOwnerDto, |
| | | List<PayFeeDetailMonthPo> payFeeDetailMonthPos, |
| | | Date curTime) { |
| | | Date curTime, |
| | | Date deadlineTime) { |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(curTime); |
| | |
| | | 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()); |
| | |
| | | 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 交费记录 保存时 |
| | |
| | | payFeeDetailMonthPos.add(tmpPayFeeDetailMonthPo); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |