Browse Source

Merge remote-tracking branch 'remotes/origin/dev_epidemic_situation' into dev

master
jianjun 3 years ago
parent
commit
9c42c035f7
  1. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java
  2. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java
  3. 35
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java

@ -29,7 +29,6 @@ import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.ImportErrorMsgConstants;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.IcBuildingUnitDao;
import com.epmet.dto.BuildingTreeLevelDTO;
@ -42,8 +41,6 @@ import com.epmet.entity.IcBuildingUnitEntity;
import com.epmet.excel.IcBuildingExcel;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.service.BuildingService;
import com.epmet.service.IcBuildingService;
import com.epmet.service.NeighborHoodService;
import com.epmet.util.ExcelPoiUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -118,7 +115,7 @@ public class BuildingController {
@PostMapping("treelist")
public Result treeList(@LoginUser TokenDto tokenDTO){
List<BuildingTreeLevelDTO> buildingTreeLevelDTOS =buildingService.treeList(tokenDTO.getUserId());
List<BuildingTreeLevelDTO> buildingTreeLevelDTOS =buildingService.treeList(tokenDTO.getCustomerId(), tokenDTO.getUserId());
return new Result().ok(buildingTreeLevelDTOS);
}
/**

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java

@ -27,7 +27,6 @@ import com.epmet.dto.result.BuildingResultPagedDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.excel.IcBuildingExcel;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@ -57,7 +56,7 @@ public interface BuildingService {
void addBuilding(String customerId, IcBulidingFormDTO formDTO);
List<BuildingTreeLevelDTO> treeList(String customerId);
List<BuildingTreeLevelDTO> treeList(String customerId, String staffId);
List<Integer> importExcel(String customerId, List<IcBuildingExcel> list, String staffId, List<Integer> numList);

35
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java

@ -13,45 +13,37 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.ImportErrorMsgConstants;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.*;
import com.epmet.dto.BuildingTreeLevelDTO;
import com.epmet.dto.CustomerStaffAgencyDTO;
import com.epmet.dto.IcBuildingDTO;
import com.epmet.dto.form.IcBulidingFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.*;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.BuildingResultPagedDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.entity.*;
import com.epmet.enums.BuildingTypeEnums;
import com.epmet.excel.IcBuildingExcel;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.model.BuildingInfoModel;
import com.epmet.model.HouseInfoModel;
import com.epmet.model.ImportBuildingInfoListener;
import com.epmet.redis.IcHouseRedis;
import com.epmet.service.*;
import com.epmet.service.BuildingService;
import com.epmet.service.IcBuildingService;
import com.epmet.service.IcBuildingUnitService;
import com.epmet.service.IcHouseService;
import com.epmet.util.ExcelPoiUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@ -128,8 +120,8 @@ public class BuildingServiceImpl implements BuildingService {
}
@Override
public List<BuildingTreeLevelDTO> treeList(String staffId) {
CustomerStaffAgencyDTO agency = customerStaffAgencyDao.selectLatestCustomerByStaff(staffId);
public List<BuildingTreeLevelDTO> treeList(String customerId, String staffId) {
CustomerStaffInfoCacheResult agency = CustomerStaffRedis.getStaffInfo(customerId, staffId);
if(null == agency || StringUtils.isBlank(agency.getAgencyId())){
log.error("com.epmet.service.impl.BuildingServiceImpl.treeList,没有找到工作人员所属的机关信息,用户Id:{}",staffId);
return new ArrayList<>();
@ -163,7 +155,7 @@ public class BuildingServiceImpl implements BuildingService {
//2.获取组织所在网格
List<String> agencyIdList = customerAgencyList.stream().map(a->a.getId()).collect(Collectors.toList());
List<String> agencyIdList = customerAgencyList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList());
// agencyIdList.add(customerAgency.getId());
List<CustomerGridEntity> customerGridList = customerGridDao.selectList(new QueryWrapper<CustomerGridEntity>().lambda().in(CustomerGridEntity::getPid, agencyIdList));
@ -222,8 +214,12 @@ public class BuildingServiceImpl implements BuildingService {
agencyList.addAll(neighbourHoodList);
return covertToTree(customerAgency,agencyList);
}
//获取楼里已经有多少个房屋
LambdaQueryWrapper<IcHouseEntity> icHouseEntityWrapper = new QueryWrapper<IcHouseEntity>().lambda()
.in(IcHouseEntity::getNeighborHoodId, neighborHoodIdList);
List<IcHouseEntity> buildingHouseCount = icHouseDao.selectList(icHouseEntityWrapper);
Map<String, Long> buildingHouseCountMap = buildingHouseCount.stream().collect(Collectors.groupingBy(IcHouseEntity::getBuildingId, Collectors.counting()));
//组合封装
List<BuildingTreeLevelDTO> buildingList = icBuildingList.stream().map(item -> {
BuildingTreeLevelDTO buildingTreeLevelDTO = new BuildingTreeLevelDTO();
buildingTreeLevelDTO.setId(item.getId());
@ -246,9 +242,10 @@ public class BuildingServiceImpl implements BuildingService {
//02.11 之前录入的户数概念改为总户数,无需计算直接用就可以了
Integer total = null == item.getTotalHouseNum() ? NumConstant.ZERO : item.getTotalHouseNum();
//已经添加了多少户
LambdaQueryWrapper<IcHouseEntity> icHouseEntityWrapper = new QueryWrapper<IcHouseEntity>().lambda()
.in(IcHouseEntity::getBuildingId, item.getId());
int count= icHouseDao.selectCount(icHouseEntityWrapper);
// LambdaQueryWrapper<IcHouseEntity> icHouseEntityWrapper = new QueryWrapper<IcHouseEntity>().lambda()
// .in(IcHouseEntity::getBuildingId, item.getId());
// int count= icHouseDao.selectCount(icHouseEntityWrapper);
int count = buildingHouseCountMap.getOrDefault(item.getId(), NumConstant.ZERO_L).intValue();
if(NumConstant.ZERO==total){
buildingTreeLevelDTO.setShowNum(String.format("%s/%s",count,count));
}else{

Loading…
Cancel
Save