| | |
| | | |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.core.smo.IComputeFeeSMO; |
| | | import com.java110.dto.contract.ContractDto; |
| | | import com.java110.dto.fee.FeeAttrDto; |
| | | import com.java110.dto.fee.FeeDetailDto; |
| | | import com.java110.dto.fee.FeeDto; |
| | | import com.java110.dto.owner.OwnerCarDto; |
| | | import com.java110.dto.payFee.PayFeeDetailMonthDto; |
| | | import com.java110.dto.payFee.PayFeeMonthOwnerDto; |
| | | import com.java110.dto.room.RoomDto; |
| | | import com.java110.intf.community.IRoomInnerServiceSMO; |
| | | import com.java110.intf.fee.IPayFeeDetailMonthInnerServiceSMO; |
| | | import com.java110.intf.store.IContractInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerCarInnerServiceSMO; |
| | | import com.java110.po.payFee.PayFeeDetailMonthPo; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.ListUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IRoomInnerServiceSMO roomInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IContractInnerServiceSMO contractInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IComputeFeeSMO computeFeeSMOImpl; |
| | |
| | | payFeeMonthOwnerDto.setLink(FeeAttrDto.getFeeAttrValue(feeDto, FeeAttrDto.SPEC_CD_OWNER_LINK)); |
| | | payFeeMonthOwnerDto.setObjName(FeeAttrDto.getFeeAttrValue(feeDto, FeeAttrDto.SPEC_CD_PAY_OBJECT_NAME)); |
| | | payFeeMonthOwnerDto.setObjId(feeDto.getPayerObjId()); |
| | | payFeeMonthOwnerDto.setObjFpcId("-1"); |
| | | |
| | | if(StringUtil.isEmpty(feeDto.getPayerObjId())){ |
| | | return payFeeMonthOwnerDto; |
| | | } |
| | | |
| | | // 如果是房屋 |
| | | if(FeeDto.PAYER_OBJ_TYPE_ROOM.equals(feeDto.getPayerObjType())){ |
| | | |
| | | RoomDto roomDto = new RoomDto(); |
| | | roomDto.setRoomId(feeDto.getPayerObjId()); |
| | | roomDto.setCommunityId(feeDto.getCommunityId()); |
| | | List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto); |
| | | if(!ListUtil.isNull(roomDtos)){ |
| | | payFeeMonthOwnerDto.setObjFpcId(roomDtos.get(0).getFloorId()); |
| | | } |
| | | }else if(FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())){ |
| | | |
| | | OwnerCarDto ownerCarDto = new OwnerCarDto(); |
| | | ownerCarDto.setMemberId(feeDto.getPayerObjId()); |
| | | ownerCarDto.setCommunityId(feeDto.getCommunityId()); |
| | | List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto); |
| | | if(!ListUtil.isNull(ownerCarDtos)){ |
| | | payFeeMonthOwnerDto.setObjFpcId(ownerCarDtos.get(0).getPaId()); |
| | | } |
| | | }else { |
| | | ContractDto contractDto = new ContractDto(); |
| | | contractDto.setContractId(feeDto.getPayerObjId()); |
| | | List<ContractDto> contractDtos = contractInnerServiceSMOImpl.queryContracts(contractDto); |
| | | if(!ListUtil.isNull(contractDtos)){ |
| | | payFeeMonthOwnerDto.setObjFpcId(contractDtos.get(0).getContractType()); |
| | | } |
| | | } |
| | | return payFeeMonthOwnerDto; |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public void waitDispersedOweFee(FeeDto feeDto, PayFeeMonthOwnerDto payFeeMonthOwnerDto, Double feePrice, Date deadlineTime) { |
| | | // todo 费用已经结束 |
| | | if (FeeDto.STATE_FINISH.equals(feeDto.getState())) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // todo 清理 detailId 为-1 的数据 |
| | | PayFeeDetailMonthPo payFeeDetailMonthPo = new PayFeeDetailMonthPo(); |
| | |
| | | payFeeDetailMonthPo.setDetailId("-1"); |
| | | payFeeDetailMonthInnerServiceSMOImpl.deletePayFeeDetailMonth(payFeeDetailMonthPo); |
| | | |
| | | // todo 费用已经结束 |
| | | if (FeeDto.STATE_FINISH.equals(feeDto.getState())) { |
| | | return; |
| | | } |
| | | |
| | | List<PayFeeDetailMonthPo> payFeeDetailMonthPos = new ArrayList<>(); |
| | | // todo 处理 开始时间和结束时间 |
| | | Date startTime = DateUtil.timeToDate(feeDto.getEndTime()); |
| | | Date endTime = DateUtil.timeToDate(deadlineTime); |
| | | Date endTime = DateUtil.deadTimeToDate(deadlineTime); |
| | | |
| | | BigDecimal receivableAmount = new BigDecimal(feePrice); |
| | | |
| | |
| | | if (day < 1) { |
| | | day = 1; |
| | | } |
| | | dayReceivableAmount = receivableAmount.divide(new BigDecimal(day), 4, BigDecimal.ROUND_HALF_UP);// 日 应收 |
| | | dayReceivableAmount = receivableAmount.divide(new BigDecimal(day), 8, BigDecimal.ROUND_HALF_UP);// 日 应收 |
| | | } |
| | | |
| | | // todo 寻找第一个自然月 一日 |
| | |
| | | curMonthMaxDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); |
| | | |
| | | // todo 如果不是整月,则转换为按天计算 |
| | | if (curDay != curMonthMaxDay) { |
| | | // if (curDay != curMonthMaxDay) { |
| | | //todo 周期性费用 日应收重新算 |
| | | if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) { |
| | | dayReceivableAmount = receivableAmount.divide(new BigDecimal(curMonthMaxDay), 4, BigDecimal.ROUND_HALF_UP);// 日 实收 |
| | | dayReceivableAmount = receivableAmount.divide(new BigDecimal(curMonthMaxDay), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 |
| | | } |
| | | // todo 计算 应收 |
| | | curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP); |
| | | } else { // todo 如果是整月 那就按月计算,以免 转换成天再 乘以天数后的误差 |
| | | curMonthReceivableAmount = receivableAmount; |
| | | } |
| | | // } else { // todo 如果是整月 那就按月计算,以免 转换成天再 乘以天数后的误差 |
| | | // curMonthReceivableAmount = receivableAmount; |
| | | // } |
| | | // todo 保存数据到pay_fee_detail_month |
| | | toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), 0, null, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime, deadlineTime); |
| | | |
| | |
| | | BigDecimal receivableAmount = new BigDecimal(Double.parseDouble(feeDetailDto.getReceivableAmount())); |
| | | BigDecimal receivedAmount = new BigDecimal(Double.parseDouble(feeDetailDto.getReceivedAmount())); |
| | | |
| | | BigDecimal dayReceivableAmount = receivableAmount.divide(new BigDecimal(day), 4, BigDecimal.ROUND_HALF_UP);// 日 应收 |
| | | BigDecimal dayReceivedAmount = receivedAmount.divide(new BigDecimal(day), 4, BigDecimal.ROUND_HALF_UP);// 日 实收 |
| | | BigDecimal dayReceivableAmount = receivableAmount.divide(new BigDecimal(day), 8, BigDecimal.ROUND_HALF_UP);// 日 应收 |
| | | BigDecimal dayReceivedAmount = receivedAmount.divide(new BigDecimal(day), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 |
| | | |
| | | // todo 寻找第一个自然月 一日 |
| | | Calendar firstMonthDayCal = Calendar.getInstance(); |
| | |
| | | tmpPayFeeDetailMonthPo.setState("W"); // todo 这里暂时写死,目前用不到,算是预留字段 |
| | | tmpPayFeeDetailMonthPo.setFeeName(feeDto.getFeeName()); |
| | | tmpPayFeeDetailMonthPo.setConfigId(feeDto.getConfigId()); |
| | | tmpPayFeeDetailMonthPo.setFeeTypeCd(feeDto.getFeeTypeCd()); |
| | | |
| | | //todo 查询obj_fpc_id |
| | | tmpPayFeeDetailMonthPo.setObjFpcId(payFeeMonthOwnerDto.getObjFpcId()); |
| | | |
| | | payFeeDetailMonthPos.add(tmpPayFeeDetailMonthPo); |
| | | |
| | | } |