| | |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | } |
| | | model.setTotalArea(new BigDecimal(0)); |
| | | for(YwRoom r : rooms){ |
| | | model.setTotalArea(model.getTotalArea().add(Constants.formatBigdecimal(r.getArea()))); |
| | | model.setTotalArea(model.getTotalArea().add(Constants.formatBigdecimal(r.getRentArea()))); |
| | | } |
| | | model.setRoomList(rooms); |
| | | } |
| | |
| | | } |
| | | int num =1; |
| | | for(int i=0;i<billList1.size();i++){ |
| | | if(Constants.equalsInteger(billList1.get(i).getCostType(),Constants.ZERO)){ |
| | | billList1.get(i).setSortnum(num); |
| | | num++; |
| | | } |
| | | } |
| | | for(int i=0;i<billList2.size();i++){ |
| | | if(Constants.equalsInteger(billList1.get(i).getCostType(),Constants.ONE)) { |
| | | billList2.get(i).setSortnum(num); |
| | | num++; |
| | | } |
| | | } |
| | | if(model.getId()!=null){ |
| | | ywContractBillMapper.insert(billList1); |
| | |
| | | BigDecimal totalFee = new BigDecimal(0); |
| | | DateCompare dateCompare = DateCompare.dayCompare(bill.getStartDate(),bill.getEndDate(),freeStart, freeEnd); |
| | | if(Constants.equalsInteger(d.getCircleType(),Constants.ZERO)){ |
| | | //0=元每平米天 |
| | | //0=元每平米天 账单金额=账单周期的天数*租赁面积*单价; |
| | | int days = dateCompare.getDay() ; |
| | | BigDecimal areas = getAreasNumBYRooms(model.getRoomList()); |
| | | totalFee = new BigDecimal(days).multiply(areas).multiply(Constants.formatBigdecimal(d.getPrice()));//总价格 |
| | | }else if(Constants.equalsInteger(d.getCircleType(),Constants.ONE)){ |
| | | //1=元每平米月 |
| | | //1=元每平米月 账单金额=账单周期的月数(开始日期计算自然月)*租赁面积*单价+不满一个月的天数*租赁面积*单价*12/365; |
| | | BigDecimal areas = getAreasNumBYRooms(model.getRoomList()); |
| | | BigDecimal month =dateCompare.getMonthFloat(); |
| | | totalFee = month.multiply(areas).multiply(Constants.formatBigdecimal(d.getPrice()));//总价格 |
| | | }else if(Constants.equalsInteger(d.getCircleType(),Constants.TWO)){ |
| | | //2=元每平米年 |
| | | //2=元每平米年 账单金额=账单周期的月数(开始日期计算自然月)*单价*面积/12+不满一个月的天数*租赁面积*单价/365; |
| | | BigDecimal areas = getAreasNumBYRooms(model.getRoomList()); |
| | | BigDecimal year = dateCompare.getYearFloat(); |
| | | totalFee = year.multiply(areas).multiply(Constants.formatBigdecimal(d.getPrice()));//总价格 |
| | | BigDecimal month = new BigDecimal(dateCompare.getMonth()); |
| | | totalFee = ((month.multiply(Constants.formatBigdecimal(d.getPrice())).divide(new BigDecimal(12),2, RoundingMode.HALF_UP)) |
| | | .add(new BigDecimal(dateCompare.getMonthDays()).multiply(Constants.formatBigdecimal(d.getPrice())).divide(new BigDecimal(365),2, RoundingMode.HALF_UP))) |
| | | .multiply(areas);//总价格 |
| | | }else if(Constants.equalsInteger(d.getCircleType(),Constants.THREE)){ |
| | | //3=元每天 |
| | | //3=元每天 账单金额=账单周期的天数*单价; |
| | | int days = dateCompare.getDay() ; |
| | | totalFee = new BigDecimal(days).multiply(Constants.formatBigdecimal(d.getPrice()));//总价格 |
| | | }else if(Constants.equalsInteger(d.getCircleType(),Constants.FOUR)){ |
| | | //4=元每月 |
| | | //4=元每月 账单金额=账单周期的月数(开始日期计算自然月)*单价+不满一个月的天数*单价*12/365 |
| | | BigDecimal month = dateCompare.getMonthFloat(); |
| | | totalFee = month.multiply(Constants.formatBigdecimal(d.getPrice()));//总价格 |
| | | }else if(Constants.equalsInteger(d.getCircleType(),Constants.FIVE)){ |
| | | //5=元每年 |
| | | BigDecimal year = dateCompare.getYearFloat(); |
| | | totalFee = year.multiply(Constants.formatBigdecimal(d.getPrice()));//总价格 |
| | | //5=元每年 账单金额=账单周期的月数(开始日期计算自然月)*单价*面积/12+不满一个月的天数*租赁面积*单价/365; |
| | | BigDecimal month = new BigDecimal(dateCompare.getMonth()); |
| | | totalFee =( month.multiply(Constants.formatBigdecimal(d.getPrice())).divide(new BigDecimal(12),2, RoundingMode.HALF_UP)) |
| | | .add(new BigDecimal(dateCompare.getMonthDays()).multiply(Constants.formatBigdecimal(d.getPrice())).divide(new BigDecimal(365),2, RoundingMode.HALF_UP));//总价格 |
| | | }else if(Constants.equalsInteger(d.getCircleType(),Constants.SIX)){ |
| | | //6=元每场 |
| | | //6=元每场 账单金额=单价;只有选择一次性付款时,才能选择该单价维度; |
| | | totalFee =Constants.formatBigdecimal(d.getPrice()); |
| | | } |
| | | if(Constants.equalsInteger(model.getRoundedUp(),Constants.ONE)){ |
| | |
| | | BigDecimal data= new BigDecimal(0); |
| | | if(roomList!=null){ |
| | | for(YwRoom r :roomList){ |
| | | data = data.add(Constants.formatBigdecimal(r.getArea())); |
| | | data = data.add(Constants.formatBigdecimal(r.getRentArea())); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | model.setTotalArea(new BigDecimal(0)); |
| | | for(YwRoom r : rooms){ |
| | | model.setTotalArea(model.getTotalArea().add(Constants.formatBigdecimal(r.getArea()))); |
| | | model.setTotalArea(model.getTotalArea().add(Constants.formatBigdecimal(r.getRentArea()))); |
| | | } |
| | | model.setRoomList(rooms); |
| | | YwCustomer customer = customerMapper.selectById(model.getRenterId()); |