| | |
| | | import static java.util.Objects.nonNull; |
| | | import static org.apache.commons.lang3.StringUtils.isNotBlank; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R registerRentingHouse(RentingHouseRegisterDTO registerDTO) { |
| | | checkDepositMoney(registerDTO); |
| | | Long communityId = registerDTO.getCommunityId(); |
| | | Long userId = registerDTO.getUserId(); |
| | | RentingHourseRegister houseRegister = new RentingHourseRegister(); |
| | |
| | | return R.fail("新增房源失败"); |
| | | } |
| | | |
| | | private void checkDepositMoney(RentingHouseRegisterDTO registerDTO) { |
| | | BigDecimal depositMoney = registerDTO.getDepositMoney(); |
| | | BigDecimal monthlyRentMoney = registerDTO.getMonthlyRentMoney(); |
| | | if (nonNull(depositMoney) && nonNull(monthlyRentMoney) && depositMoney.compareTo(monthlyRentMoney) == 1) { |
| | | throw new ServiceException("500", "定金不能超过月租金"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 编辑房源信息 |
| | | * @param registerDTO |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R updateRentingHouse(RentingHouseRegisterDTO registerDTO) { |
| | | checkDepositMoney(registerDTO); |
| | | Long id = registerDTO.getId(); |
| | | Long userId = registerDTO.getUserId(); |
| | | RentingHourseRegister houseRegister = this.baseMapper.selectById(id); |