old mode 100644
new mode 100755
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | 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.*; |
| | | |
| | | @Service |
| | | public class QueryOweFeeImpl implements IQueryOweFee { |
| | |
| | | List<RoomDto> tmpRoomDtos = new ArrayList<>(); |
| | | List<RoomDto> tempRooms = new ArrayList<>(); |
| | | int threadNum = Java110ThreadPoolFactory.JAVA110_DEFAULT_THREAD_NUM; |
| | | for (int roomIndex = 0; roomIndex < roomDtos.size(); roomIndex++) { |
| | | tempRooms.add(roomDtos.get(roomIndex)); |
| | | if (roomIndex % threadNum == 0 && roomIndex != 0) { |
| | | tmpRoomDtos.addAll(doGetTmpRoomDto(tempRooms, feeDto, threadNum)); |
| | | tempRooms = new ArrayList(); |
| | | |
| | | tempRooms.addAll(doGetTmpRoomDto(roomDtos, feeDto, threadNum)); |
| | | for (RoomDto tmpRoomDto : tempRooms) { |
| | | if (tmpRoomDto == null) { |
| | | continue; |
| | | } |
| | | } |
| | | if (tempRooms.size() > 0) { |
| | | tmpRoomDtos.addAll(doGetTmpRoomDto(tempRooms, feeDto, tempRooms.size())); |
| | | tmpRoomDtos.add(tmpRoomDto); |
| | | } |
| | | |
| | | return ResultVo.createResponseEntity(tmpRoomDtos); |
| | |
| | | }); |
| | | } |
| | | return java110ThreadPoolFactory.get(); |
| | | }finally { |
| | | if(java110ThreadPoolFactory != null){ |
| | | } finally { |
| | | if (java110ThreadPoolFactory != null) { |
| | | java110ThreadPoolFactory.stop(); |
| | | } |
| | | } |
| | |
| | | tmpFeeDto.setState(FeeDto.STATE_DOING); |
| | | tmpFeeDto.setPayerObjId(tmpRoomDto.getRoomId()); |
| | | tmpFeeDto.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_ROOM); |
| | | List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto); |
| | | List<FeeDto> feeDtos = feeInnerServiceSMOImpl.querySimpleFees(tmpFeeDto); |
| | | |
| | | if (feeDtos == null || feeDtos.size() < 1) { |
| | | return null; |
| | |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | } else if ("9009".equals(computingFormula)) { //(本期度数-上期度数)*动态单价+附加费 |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | feePrice = -1.00; |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees())); |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getMwPrice())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | } else { |
| | | feePrice = 0.00; |
| | | } |
| | |
| | | feeDto.setAmountOwed(price.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue() + ""); |
| | | feeDto.setDeadlineTime(targetEndDate); |
| | | //动态费用 |
| | | if ("4004".equals(computingFormula)) { |
| | | if ("4004".equals(computingFormula) |
| | | && FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag()) |
| | | ) { |
| | | feeDto.setAmountOwed(feeDto.getFeePrice() + ""); |
| | | feeDto.setDeadlineTime(DateUtil.getCurrentDate()); |
| | | } |
| | |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | } else if ("9009".equals(computingFormula)) { |
| | | |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | feePrice = -1.00; |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees())); |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getMwPrice())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | } else { |
| | | feePrice = 0.00; |
| | | } |
| | |
| | | return targetEndDateAndOweMonth; |
| | | } |
| | | if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) { |
| | | if (!StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | if (feeDto.getDeadlineTime() != null) { |
| | | targetEndDate = feeDto.getDeadlineTime(); |
| | | } else if (!StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | targetEndDate = feeDto.getCurReadingTime(); |
| | | } else if (feeDto.getImportFeeEndTime() == null) { |
| | | targetEndDate = feeDto.getConfigEndTime(); |