| | |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.RoomDto; |
| | | import com.java110.dto.room.RoomDto; |
| | | import com.java110.dto.fee.BillOweFeeDto; |
| | | import com.java110.dto.fee.FeeConfigDto; |
| | | import com.java110.dto.fee.FeeDto; |
| | |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.ListUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | |
| | | |
| | | List<FeeDto> resultFees = new ArrayList<>(); |
| | | |
| | | if (ownerRoomRelDtos != null && ownerRoomRelDtos.size() > 0) { |
| | | if (!ListUtil.isNull(ownerRoomRelDtos)) { |
| | | getRoomOweFee(ownerRoomRelDtos, reqJson, resultFees); |
| | | } |
| | | |
| | |
| | | ownerCarDto.setCommunityId(reqJson.getString("communityId")); |
| | | List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto); |
| | | |
| | | if (ownerCarDtos != null && ownerCarDtos.size() > 0) { |
| | | if (!ListUtil.isNull(ownerCarDtos)) { |
| | | getParkingSpaceOweFee(ownerCarDtos, reqJson, resultFees); |
| | | } |
| | | |
| | |
| | | |
| | | if (FeeConfigDto.BILL_TYPE_EVERY.equals(tmpFeeConfigDto.getBillType())) {//直接计算 欠费金额 |
| | | computeFeePriceByRoom(feeDto); |
| | | double month = dayCompare(endTime, DateUtil.getCurrentDate()); |
| | | double month = DateUtil.dayCompare(endTime, DateUtil.getCurrentDate()); |
| | | BigDecimal feePrice = new BigDecimal(feeDto.getFeePrice()); |
| | | feePrice = feePrice.multiply(new BigDecimal(month)); |
| | | FeeDto tmpFeeDto = new FeeDto(); |
| | |
| | | } |
| | | |
| | | feeDto.setFeePrice(feePrice); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 计算2个日期之间相差的 以年、月、日为单位,各自计算结果是多少 |
| | | * 比如:2011-02-02 到 2017-03-02 |
| | | * 以年为单位相差为:6年 |
| | | * 以月为单位相差为:73个月 |
| | | * 以日为单位相差为:2220天 |
| | | * |
| | | * @param fromDate |
| | | * @param toDate |
| | | * @return |
| | | */ |
| | | public static double dayCompare(Date fromDate, Date toDate) { |
| | | Calendar from = Calendar.getInstance(); |
| | | from.setTime(fromDate); |
| | | Calendar to = Calendar.getInstance(); |
| | | to.setTime(toDate); |
| | | |
| | | long t1 = from.getTimeInMillis(); |
| | | long t2 = to.getTimeInMillis(); |
| | | double days = (t2 - t1)*1.00/ (24 * 60 * 60 * 1000); |
| | | |
| | | BigDecimal tmpDays = new BigDecimal(days); |
| | | BigDecimal monthDay = new BigDecimal(30); |
| | | |
| | | return tmpDays.divide(monthDay, 2, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | } |