| | |
| | | package com.java110.core.smo.impl; |
| | | |
| | | import com.java110.config.properties.code.Java110Properties; |
| | | import com.java110.core.context.Environment; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import com.java110.core.smo.IComputeFeeSMO; |
| | | import com.java110.dto.RoomDto; |
| | | 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.*; |
| | | 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.utils.util.DateUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | 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.*; |
| | | |
| | | /** |
| | | * 费用计算 服务类 |
| | |
| | | |
| | | @Autowired(required = false) |
| | | private ITempCarFeeConfigAttrInnerServiceSMO tempCarFeeConfigAttrInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private Java110Properties java110Properties; |
| | | |
| | | @Override |
| | | public Date getFeeEndTime() { |
| | |
| | | feeReceiptDetailPo.setArea(sub.doubleValue() + ""); |
| | | feeReceiptDetailPo.setSquarePrice(feeDto.getMwPrice() + "/" + feeDto.getAdditionalAmount()); |
| | | } |
| | | } else if ("1101".equals(computingFormula)) { //租金 |
| | | feeReceiptDetailPo.setArea(roomDtos.get(0).getBuiltUpArea()); |
| | | feeReceiptDetailPo.setSquarePrice(roomDtos.get(0).getRoomRent()); |
| | | } else { |
| | | } |
| | | } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())) {//车位相关 |
| | |
| | | BigDecimal feePrice = new BigDecimal("0.0"); |
| | | BigDecimal feeTotalPrice = new BigDecimal(0.0); |
| | | Map<String, Object> feeAmount = new HashMap<>(); |
| | | if (Environment.isOwnerPhone(java110Properties)) { |
| | | return getOwnerPhoneFee(feeAmount); |
| | | } |
| | | if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(feeDto.getPayerObjType())) { //房屋相关 |
| | | String computingFormula = feeDto.getComputingFormula(); |
| | | if (roomDto == null) { |
| | |
| | | throw new IllegalArgumentException("暂不支持该类公式"); |
| | | } |
| | | } |
| | | |
| | | feePrice.setScale(3, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | feeAmount.put("feePrice", feePrice); |
| | | feeAmount.put("feeTotalPrice", feeTotalPrice); |
| | |
| | | return resMonth; |
| | | } |
| | | |
| | | |
| | | //手机端缴费处理 |
| | | public Map getOwnerPhoneFee(Map feeAmount) { |
| | | feeAmount.put("feePrice", new BigDecimal(1.00 / 100)); |
| | | feeAmount.put("feeTotalPrice", new BigDecimal(1.00 / 100)); |
| | | return feeAmount; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * *字符串的日期格式的计算 |
| | | */ |
| | | 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 List<CarInoutDetailDto> computeTempCarInoutDetailStopTimeAndFee(List<CarInoutDetailDto> carInoutDtos) { |
| | | if (carInoutDtos == null || carInoutDtos.size() < 1) { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | carInoutDtos = tempCarFeeConfigInnerServiceSMOImpl.computeTempCarInoutDetailFee(carInoutDtos); |
| | | |
| | | return carInoutDtos; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | 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(); |
| | | } |