| | |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.dto.contract.ContractDto; |
| | | import com.java110.dto.contractRoom.ContractRoomDto; |
| | | import com.java110.dto.fee.BillDto; |
| | | import com.java110.dto.fee.BillOweFeeDto; |
| | | import com.java110.dto.fee.FeeAttrDto; |
| | | import com.java110.dto.fee.FeeConfigDto; |
| | | import com.java110.dto.fee.FeeDto; |
| | | import com.java110.dto.fee.TempCarFeeResult; |
| | | import com.java110.dto.fee.*; |
| | | import com.java110.dto.machine.CarInoutDetailDto; |
| | | import com.java110.dto.machine.CarInoutDto; |
| | | import com.java110.dto.owner.OwnerCarDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | |
| | | import com.java110.dto.report.ReportCarDto; |
| | | import com.java110.dto.report.ReportFeeDto; |
| | | import com.java110.dto.report.ReportRoomDto; |
| | | import com.java110.dto.tempCarFeeConfig.TempCarFeeConfigAttrDto; |
| | | import com.java110.dto.tempCarFeeConfig.TempCarFeeConfigDto; |
| | | import com.java110.intf.community.ICommunityInnerServiceSMO; |
| | | import com.java110.intf.community.IParkingSpaceInnerServiceSMO; |
| | | import com.java110.intf.community.IRoomInnerServiceSMO; |
| | | import com.java110.intf.fee.IComputeTempCarFee; |
| | | import com.java110.intf.fee.IFeeInnerServiceSMO; |
| | | import com.java110.intf.fee.ITempCarFeeConfigAttrInnerServiceSMO; |
| | | import com.java110.intf.fee.ITempCarFeeConfigInnerServiceSMO; |
| | |
| | | import com.java110.po.feeReceiptDetail.FeeReceiptDetailPo; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.exception.ListenerExecuteException; |
| | | import com.java110.utils.factory.ApplicationContextFactory; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.DateUtil; |
| | |
| | | import javax.script.ScriptEngineManager; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 费用计算 服务类 |
| | |
| | | return resMonth; |
| | | } |
| | | |
| | | /** |
| | | * *字符串的日期格式的计算 |
| | | */ |
| | | public long daysBetween(Date smdate, Date bdate) { |
| | | long between_days = 0; |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(smdate); |
| | | long time1 = cal.getTimeInMillis(); |
| | | cal.setTime(bdate); |
| | | long time2 = cal.getTimeInMillis(); |
| | | between_days = (time2 - time1) / (1000 * 3600 * 24); |
| | | |
| | | return between_days; |
| | | } |
| | | |
| | | @Override |
| | | public Date getTargetEndTime(double month, Date startDate) { |
| | | Calendar endDate = Calendar.getInstance(); |
| | |
| | | |
| | | |
| | | @Override |
| | | public void computeTempCarStopTimeAndFee(List<CarInoutDto> carInoutDtos) { |
| | | public List<CarInoutDto> computeTempCarStopTimeAndFee(List<CarInoutDto> carInoutDtos) { |
| | | |
| | | if (carInoutDtos == null || carInoutDtos.size() < 1) { |
| | | return; |
| | | return null; |
| | | } |
| | | |
| | | //计算停车时间 |
| | | TempCarFeeConfigDto tempCarFeeConfigDto = new TempCarFeeConfigDto(); |
| | | tempCarFeeConfigDto.setPaId(carInoutDtos.get(0).getPaId()); |
| | | tempCarFeeConfigDto.setCommunityId(carInoutDtos.get(0).getCommunityId()); |
| | | List<TempCarFeeConfigDto> tempCarFeeConfigDtos = tempCarFeeConfigInnerServiceSMOImpl.queryTempCarFeeConfigs(tempCarFeeConfigDto); |
| | | |
| | | if (tempCarFeeConfigDtos == null || tempCarFeeConfigDtos.size() < 1) { |
| | | return; |
| | | } |
| | | TempCarFeeConfigAttrDto tempCarFeeConfigAttrDto = new TempCarFeeConfigAttrDto(); |
| | | tempCarFeeConfigAttrDto.setConfigId(tempCarFeeConfigDto.getConfigId()); |
| | | tempCarFeeConfigAttrDto.setCommunityId(tempCarFeeConfigDto.getCommunityId()); |
| | | carInoutDtos = tempCarFeeConfigInnerServiceSMOImpl.computeTempCarFee(carInoutDtos); |
| | | |
| | | List<TempCarFeeConfigAttrDto> tempCarFeeConfigAttrDtos = tempCarFeeConfigAttrInnerServiceSMOImpl.queryTempCarFeeConfigAttrs(tempCarFeeConfigAttrDto); |
| | | long time = 0; |
| | | for (CarInoutDto carInoutDto : carInoutDtos) { |
| | | try { |
| | | IComputeTempCarFee computeTempCarFee = ApplicationContextFactory.getBean(tempCarFeeConfigDtos.get(0).getRuleId(), IComputeTempCarFee.class); |
| | | TempCarFeeResult result = computeTempCarFee.computeTempCarFee(carInoutDtos.get(0), tempCarFeeConfigDtos.get(0),tempCarFeeConfigAttrDtos); |
| | | carInoutDto.setMin(result.getMin()); |
| | | carInoutDto.setHours(result.getHours()); |
| | | carInoutDto.setPayCharge(result.getPayCharge()+""); |
| | | } catch (Exception e) { |
| | | logger.error("临时车算费失败", e); |
| | | } |
| | | return carInoutDtos; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<CarInoutDetailDto> computeTempCarInoutDetailStopTimeAndFee(List<CarInoutDetailDto> carInoutDtos) { |
| | | if (carInoutDtos == null || carInoutDtos.size() < 1) { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | carInoutDtos = tempCarFeeConfigInnerServiceSMOImpl.computeTempCarInoutDetailFee(carInoutDtos); |
| | | |
| | | return carInoutDtos; |
| | | } |
| | | |
| | | |
| | |
| | | ComputeFeeSMOImpl computeFeeSMO = new ComputeFeeSMOImpl(); |
| | | try { |
| | | double month = computeFeeSMO.dayCompare( |
| | | DateUtil.getDateFromString("2021-6-1 00:00:00", DateUtil.DATE_FORMATE_STRING_A), |
| | | DateUtil.getDateFromString("2021-8-5 18:00:00", DateUtil.DATE_FORMATE_STRING_A) |
| | | DateUtil.getDateFromString("2021-09-30 14:20:02", DateUtil.DATE_FORMATE_STRING_A), |
| | | DateUtil.getDateFromString("2021-11-03 14:20:02", DateUtil.DATE_FORMATE_STRING_A) |
| | | ); |
| | | System.out.println(month); |
| | | System.out.println(Math.ceil(month)); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |