linwei
2024-01-31 b3b566ebdfed4005aaa513da3d5d2fd3924903cc
src/main/java/org/springblade/modules/house/service/impl/HouseRentalServiceImpl.java
@@ -20,6 +20,8 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.logging.log4j.util.Strings;
import org.springblade.common.cache.SysCache;
import org.springblade.common.utils.SpringUtils;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.grid.service.IGridService;
@@ -33,7 +35,9 @@
import org.springblade.modules.house.vo.HouseRentalTenantVO;
import org.springblade.modules.house.vo.HouseRentalVO;
import org.springblade.modules.house.vo.HouseholdVO;
import org.springblade.modules.system.entity.Dept;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.service.IDeptService;
import org.springblade.modules.system.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -68,6 +72,8 @@
    */
   @Override
   public IPage<HouseRentalTenantVO> selectHouseRentalPage(IPage<HouseRentalTenantVO> page, HouseRentalTenantVO houseRental) {
      List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId());
      Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2;
      List<String> list = new ArrayList<>();
      if (null!=houseRental.getRoleName() && !houseRental.getRoleName().equals("")){
         if (houseRental.getRoleName().equals("网格员")){
@@ -80,7 +86,7 @@
            houseRental.setAuditStatus(2);
         }
      }
      List<HouseRentalTenantVO> houseRentalTenantVOS = baseMapper.selectHouseRentalPage(page, houseRental, list);
      List<HouseRentalTenantVO> houseRentalTenantVOS = baseMapper.selectHouseRentalPage(page, houseRental, list,regionChildCodesList,isAdministrator);
      for (HouseRentalTenantVO houseRentalTenantVO : houseRentalTenantVOS) {
         if(houseRentalTenantVO.getStatus().equals(1)){
            houseRentalTenantVO.setStatus(30);
@@ -121,20 +127,16 @@
   @Override
   @Transactional(rollbackFor = Exception.class)
   public Boolean add(HouseRentalVO houseRentalVO) {
//      // 判断添加人是否房屋业主
//      Long count = iHouseholdService.count(Wrappers.<HouseholdEntity>lambdaQuery()
//         .eq(HouseholdEntity::getHouseCode, houseRentalVO.getHouseCode())
//         .eq(HouseholdEntity::getAssociatedUserId, AuthUtil.getUserId())
//         .eq(HouseholdEntity::getRelationship, 1));
//      if (count == 0) {
//         return false;
//      }
      houseRentalVO.setCreateUser(AuthUtil.getUserId());
      houseRentalVO.setCreateTime(new Date());
      houseRentalVO.setUpdateUser(AuthUtil.getUserId());
      houseRentalVO.setUpdateTime(new Date());
      // 网格员新增默认是审核通过
      houseRentalVO.setAuditStatus(1);
      if (!Strings.isBlank(houseRentalVO.getRoleName()) && houseRentalVO.getRoleName().equals("居民")){
         // 待审核
         houseRentalVO.setAuditStatus(0);
      }
      //保存自身
      boolean save = save(houseRentalVO);
      List<String> phoneList = new ArrayList<>();
@@ -320,6 +322,6 @@
   @Override
   public Integer getStatisticsCount(HouseRentalTenantVO houseRental) {
      return baseMapper.getStatisticsCount(AuthUtil.getUserId());
      return baseMapper.getStatisticsCount(houseRental.getUserId(), houseRental.getNeiCode());
   }
}