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,22 +86,22 @@
            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.setAuditStatus(30);
            houseRentalTenantVO.setStatus(30);
         }
         if(houseRentalTenantVO.getStatus().equals(0) && houseRentalTenantVO.getAuditStatus().equals(0)){
            houseRentalTenantVO.setAuditStatus(0);
            houseRentalTenantVO.setStatus(0);
         }
         if(houseRentalTenantVO.getStatus().equals(0) && houseRentalTenantVO.getAuditStatus().equals(1)){
            houseRentalTenantVO.setAuditStatus(1);
            houseRentalTenantVO.setStatus(1);
         }
         if(houseRentalTenantVO.getStatus().equals(0) && houseRentalTenantVO.getDldType().equals(3)){
            houseRentalTenantVO.setAuditStatus(20);
            houseRentalTenantVO.setStatus(20);
         }
         if(houseRentalTenantVO.getStatus().equals(0) && houseRentalTenantVO.getDldType().equals(2)){
            houseRentalTenantVO.setAuditStatus(10);
            houseRentalTenantVO.setStatus(10);
         }
      }
      return page.setRecords(houseRentalTenantVOS);
@@ -125,6 +131,12 @@
      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<>();
@@ -174,10 +186,8 @@
      boolean update = iHouseholdService.update(Wrappers.<HouseholdEntity>lambdaUpdate()
         .set(HouseholdEntity::getIsDeleted, 1)
         .eq(HouseholdEntity::getHousingRentalId, id));
      if (update) {
         return true && b;
      }
      return false;
      // 返回
      return b;
   }
   /**
@@ -312,6 +322,6 @@
   @Override
   public Integer getStatisticsCount(HouseRentalTenantVO houseRental) {
      return baseMapper.getStatisticsCount(AuthUtil.getUserId());
      return baseMapper.getStatisticsCount(houseRental.getUserId(), houseRental.getNeiCode());
   }
}