Browse Source

Merge branch 'dev_ic_data' of http://git.elinkit.com.cn:7070/r/epmet-cloud into develop

dev
jianjun 4 years ago
parent
commit
6aba933504
  1. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java
  2. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java
  3. 29
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
  4. 112
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml

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

@ -92,9 +92,7 @@ public class BuildingController {
//效验数据 //效验数据
ValidatorUtils.validateEntity(formDTO, IcBulidingFormDTO.AddShowGroup.class); ValidatorUtils.validateEntity(formDTO, IcBulidingFormDTO.AddShowGroup.class);
String customerId = tokenDTO.getCustomerId(); String customerId = tokenDTO.getCustomerId();
// String customerId = "123123"; buildingService.addBuilding(customerId,formDTO);
buildingService.AddBuilding(customerId,formDTO);
return new Result().ok("保存成功"); return new Result().ok("保存成功");
} }
@ -105,7 +103,7 @@ public class BuildingController {
ValidatorUtils.validateEntity(formDTO, IcBulidingFormDTO.UpdateShowGroup.class); ValidatorUtils.validateEntity(formDTO, IcBulidingFormDTO.UpdateShowGroup.class);
String customerId = tokenDTO.getCustomerId(); String customerId = tokenDTO.getCustomerId();
// String customerId = "123123"; // String customerId = "123123";
buildingService.UpdateBuilding(customerId,formDTO); buildingService.updateBuilding(customerId,formDTO);
return new Result().ok("修改成功"); return new Result().ok("修改成功");
} }
@ -114,7 +112,7 @@ public class BuildingController {
//效验数据 //效验数据
ValidatorUtils.validateEntity(formDTO, IcBulidingFormDTO.DeleteGroup.class); ValidatorUtils.validateEntity(formDTO, IcBulidingFormDTO.DeleteGroup.class);
String buildingId = formDTO.getBuildingId(); String buildingId = formDTO.getBuildingId();
buildingService.DelBuilding(buildingId); buildingService.delBuilding(buildingId);
return new Result(); return new Result();
} }

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

@ -40,16 +40,16 @@ public interface BuildingService {
void UpdateBuilding(String customerId, IcBulidingFormDTO formDTO); void updateBuilding(String customerId, IcBulidingFormDTO formDTO);
/** /**
* 删除小区 * 删除小区
* @param buildingId * @param buildingId
*/ */
void DelBuilding(String buildingId); void delBuilding(String buildingId);
void AddBuilding(String customerId, IcBulidingFormDTO formDTO); void addBuilding(String customerId, IcBulidingFormDTO formDTO);
List<BuildingTreeLevelDTO> treeList(String customerId); List<BuildingTreeLevelDTO> treeList(String customerId);
@ -62,4 +62,4 @@ public interface BuildingService {
List<BuildingResultDTO> buildingListByIds(List<String> buildingIdList); List<BuildingResultDTO> buildingListByIds(List<String> buildingIdList);
BuildingResultPagedDTO buildinglistbyidsPage(List<String> buildingIdList, Integer pageNo, Integer pageSize); BuildingResultPagedDTO buildinglistbyidsPage(List<String> buildingIdList, Integer pageNo, Integer pageSize);
} }

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

@ -1,9 +1,11 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
@ -70,7 +72,7 @@ public class BuildingServiceImpl implements BuildingService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void AddBuilding(String customerId, IcBulidingFormDTO formDTO) { public void addBuilding(String customerId, IcBulidingFormDTO formDTO) {
//同一小区下不能存在楼栋名字一样的 //同一小区下不能存在楼栋名字一样的
Integer count = icBuildingDao.checkBuildName(formDTO.getNeighborHoodId(),formDTO.getBuildingName(),null); Integer count = icBuildingDao.checkBuildName(formDTO.getNeighborHoodId(),formDTO.getBuildingName(),null);
if (null != count && count > 0) { if (null != count && count > 0) {
@ -152,8 +154,10 @@ public class BuildingServiceImpl implements BuildingService {
//3.获取网格下的所有小区 //3.获取网格下的所有小区
List<String> gridIdList = customerGridList.stream().map(a->a.getId()).collect(Collectors.toList()); List<String> gridIdList = customerGridList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList());
List<IcNeighborHoodEntity> icNeighborHoodList = icNeighborHoodDao.selectList(new QueryWrapper<IcNeighborHoodEntity>().lambda().in(IcNeighborHoodEntity::getGridId, gridIdList)); LambdaQueryWrapper<IcNeighborHoodEntity> queryWrapper = new QueryWrapper<IcNeighborHoodEntity>().lambda().in(IcNeighborHoodEntity::getGridId, gridIdList);
queryWrapper.orderByAsc(IcNeighborHoodEntity::getCreatedTime);
List<IcNeighborHoodEntity> icNeighborHoodList = icNeighborHoodDao.selectList(queryWrapper);
if(CollectionUtils.isEmpty(icNeighborHoodList)){ if(CollectionUtils.isEmpty(icNeighborHoodList)){
agencyList.addAll(gridList); agencyList.addAll(gridList);
return covertToTree(customerAgency,agencyList); return covertToTree(customerAgency,agencyList);
@ -171,8 +175,11 @@ public class BuildingServiceImpl implements BuildingService {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
//3.获取小区下的所有楼宇 //3.获取小区下的所有楼宇
List<String> neighborHoodIdList = icNeighborHoodList.stream().map(a->a.getId()).collect(Collectors.toList()); List<String> neighborHoodIdList = icNeighborHoodList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList());
List<IcBuildingEntity> icBuildingList = icBuildingDao.selectList(new QueryWrapper<IcBuildingEntity>().lambda().in(IcBuildingEntity::getNeighborHoodId, neighborHoodIdList)); LambdaQueryWrapper<IcBuildingEntity> buildingQueryWrapper = new QueryWrapper<IcBuildingEntity>().lambda()
.in(IcBuildingEntity::getNeighborHoodId, neighborHoodIdList)
.orderByAsc(IcBuildingEntity::getBuildingName);
List<IcBuildingEntity> icBuildingList = icBuildingDao.selectList(buildingQueryWrapper);
if(CollectionUtils.isEmpty(neighborHoodIdList)){ if(CollectionUtils.isEmpty(neighborHoodIdList)){
agencyList.addAll(gridList); agencyList.addAll(gridList);
@ -193,14 +200,6 @@ public class BuildingServiceImpl implements BuildingService {
return buildingTreeLevelDTO; return buildingTreeLevelDTO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
//组织
// gridList.stream()
// Map<String, List<BuildingTreeLevelDTO>> gridMap = gridList.stream().collect(Collectors.groupingBy(e -> e.getPId()));
// List<BuildingTreeLevelDTO> allList = agencyList.addAll(gridList)
agencyList.addAll(gridList); agencyList.addAll(gridList);
agencyList.addAll(neighbourHoodList); agencyList.addAll(neighbourHoodList);
agencyList.addAll(buildingList); agencyList.addAll(buildingList);
@ -412,7 +411,7 @@ public class BuildingServiceImpl implements BuildingService {
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void UpdateBuilding(String customerId, IcBulidingFormDTO formDTO) { public void updateBuilding(String customerId, IcBulidingFormDTO formDTO) {
//同一小区下不能存在楼栋名字一样的 //同一小区下不能存在楼栋名字一样的
Integer count = icBuildingDao.checkBuildName(formDTO.getNeighborHoodId(),formDTO.getBuildingName(),formDTO.getBuildingId()); Integer count = icBuildingDao.checkBuildName(formDTO.getNeighborHoodId(),formDTO.getBuildingName(),formDTO.getBuildingId());
if (null != count && count > 0) { if (null != count && count > 0) {
@ -468,7 +467,7 @@ public class BuildingServiceImpl implements BuildingService {
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void DelBuilding(String buildingId) { public void delBuilding(String buildingId) {
//如果存在房屋,无法删除 //如果存在房屋,无法删除
List<IcHouseEntity> icHouseEntities = icHouseDao.selectList(new QueryWrapper<IcHouseEntity>().lambda().eq(IcHouseEntity::getBuildingId, buildingId)); List<IcHouseEntity> icHouseEntities = icHouseDao.selectList(new QueryWrapper<IcHouseEntity>().lambda().eq(IcHouseEntity::getBuildingId, buildingId));
if(!CollectionUtils.isEmpty(icHouseEntities)){ if(!CollectionUtils.isEmpty(icHouseEntities)){

112
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml

@ -138,117 +138,6 @@
</select> </select>
<!--<select id="searchBuildingByPage" resultType="map">
select
a.ID as buildingId,
a.BUILDING_NAME as buildingName,
a.TOTAL_HOUSE_NUM as totalHouseNum,
a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum,
a.BUILDING_NAME as buildingType,
b.NEIGHBOR_HOOD_NAME as neighborHoodName
from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID
<if test="neighbor.id != null and neighbor.id.trim() != ''">
AND b.ID = #{neighbor.id}
</if>
<if test="neighbor.agencyId != null and neighbor.agencyId.trim() != ''">
AND b.AGENCY_ID = #{neighbor.agencyId}
</if>
<if test="neighbor.gridId != null and neighbor.gridId.trim() != ''">
AND b.GRID_ID = #{neighbor.gridId}
</if>
<if test="neighbor.neighborHoodName != null and neighbor.neighborHoodName.trim() != ''">
AND b.NEIGHBOR_HOOD_NAME like concat('%',trim(#{neighbor.neighborHoodName}),'%')
</if>
<where>
<if test="building.id != null and building.id.trim() != ''">
AND a.ID = #{building.id}
</if>
<if test="building.buildingName != null and building.buildingName.trim() != ''">
AND a.BUILDING_NAME like concat('%',trim(#{building.buildingName}),'%')
</if>
<if test="building.delFlag != null and building.delFlag.trim() != ''">
AND a.DEL_FLAG = #{building.delFlag}
</if>
</where>
</select>-->
<!--<select id="searchAllBuilding" resultType="com.epmet.excel.IcBuildingExcel">
select
a.BUILDING_NAME as buildingName,
a.TOTAL_HOUSE_NUM as totalHouseNum,
a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum,
b.NEIGHBOR_HOOD_NAME as neighborHoodName,
f.ORGANIZATION_NAME as agencyName,
g.GRID_NAME as gridName
from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID
and b.ID in (
select c.id from ic_neighbor_hood c
INNER JOIN customer_agency d on c.AGENCY_ID = d.ID
INNER JOIN customer_grid e on c.GRID_ID = e.ID
${ew.customSqlSegment}
)
LEFT JOIN customer_agency f on b.AGENCY_ID = f.ID
LEFT JOIN customer_grid g on b.GRID_ID = g.ID
${ew1.customSqlSegment}
</select>-->
<!--<select id="searchAllBuilding" resultType="com.epmet.excel.IcBuildingExcel">
select
a.ID as buildingId,
a.BUILDING_NAME as buildingName,
a.TOTAL_HOUSE_NUM as totalHouseNum,
a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum,
a.BUILDING_NAME as buildingType,
b.NEIGHBOR_HOOD_NAME as neighborHoodName,
c.ORGANIZATION_NAME as agencyName,
d.GRID_NAME as gridName
from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID
LEFT JOIN customer_agency c on b.AGENCY_ID = c.ID
LEFT JOIN customer_grid c on b.GRID_ID = d.ID
<if test="neighbor.id != null and neighbor.id.trim() != ''">
AND b.ID = #{neighbor.id}
</if>
<if test="neighbor.agencyId != null and neighbor.agencyId.trim() != ''">
AND b.AGENCY_ID = #{neighbor.agencyId}
</if>
<if test="neighbor.gridId != null and neighbor.gridId.trim() != ''">
AND b.GRID_ID = #{neighbor.gridId}
</if>
<if test="neighbor.neighborHoodName != null and neighbor.neighborHoodName.trim() != ''">
AND b.NEIGHBOR_HOOD_NAME like concat('%',trim(#{neighbor.neighborHoodName}),'%')
</if>
<where>
<if test="building.id != null and building.id.trim() != ''">
AND a.ID = #{building.id}
</if>
<if test="building.buildingName != null and building.buildingName.trim() != ''">
AND a.BUILDING_NAME like concat('%',trim(#{building.buildingName}),'%')
</if>
<if test="building.delFlag != null and building.delFlag.trim() != ''">
AND a.DEL_FLAG = #{building.delFlag}
</if>
</where>
</select>-->
<select id="selectAgencyChildrenList" resultType="com.epmet.entity.CustomerAgencyEntity"> <select id="selectAgencyChildrenList" resultType="com.epmet.entity.CustomerAgencyEntity">
SELECT SELECT
@ -330,7 +219,6 @@
#{val} #{val}
</foreach> </foreach>
order by gridName,neighborHoodName,buildingName order by gridName,neighborHoodName,buildingName
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save