Browse Source

Merge remote-tracking branch 'origin/yantai_zhengwu_master' into dev

master
yinzuomei 3 years ago
parent
commit
21961b209a
  1. 11
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcPropertyManagementDTO.java
  2. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PropertyManagementController.java
  3. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodPropertyDao.java
  4. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java
  5. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PropertyManagementService.java
  6. 30
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PropertyManagementServiceImpl.java
  7. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodPropertyDao.xml
  8. 9
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml

11
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcPropertyManagementDTO.java

@ -70,6 +70,12 @@ public class IcPropertyManagementDTO implements Serializable {
@ColumnWidth(30) @ColumnWidth(30)
private String contactMobile; private String contactMobile;
/**
* 关联的小区数量
*/
@ExcelIgnore
private Integer totalNeighborHood;
/** /**
* 导出时候用 * 导出时候用
* 该物业关联的小区 * 该物业关联的小区
@ -116,9 +122,4 @@ public class IcPropertyManagementDTO implements Serializable {
*/ */
@ExcelIgnore @ExcelIgnore
private Date updatedTime; private Date updatedTime;
/**
* 关联的小区数量
*/
@ExcelIgnore
private Integer totalNeighborHood;
} }

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PropertyManagementController.java

@ -88,7 +88,7 @@ public class PropertyManagementController implements ResultDataResolver {
@PostMapping("page") @PostMapping("page")
public Result<PageData<IcPropertyManagementDTO>> page(@RequestBody IcPropertyManagementFormDTO formDTO){ public Result<PageData<IcPropertyManagementDTO>> page(@RequestBody IcPropertyManagementFormDTO formDTO){
return new Result<PageData<IcPropertyManagementDTO>>().ok(propertyManagementService.page(formDTO.getPageNo(),formDTO.getPageSize(),formDTO.getName(), return new Result<PageData<IcPropertyManagementDTO>>().ok(propertyManagementService.page(formDTO.getPageNo(),formDTO.getPageSize(),formDTO.getName(),
formDTO.getContactName(),formDTO.getContactMobile(),"page-query")); formDTO.getContactName(),formDTO.getContactMobile()));
} }
/** /**
@ -198,7 +198,7 @@ public class PropertyManagementController implements ResultDataResolver {
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build();
PageData<IcPropertyManagementDTO> data = null; PageData<IcPropertyManagementDTO> data = null;
do { do {
data = propertyManagementService.page(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getName(), formDTO.getContactName(), formDTO.getContactMobile(),"export"); data = propertyManagementService.page(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getName(), formDTO.getContactName(), formDTO.getContactMobile());
formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE);
excelWriter.write(data.getList(), writeSheet); excelWriter.write(data.getList(), writeSheet);
} while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); } while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize());

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodPropertyDao.java

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.entity.IcNeighborHoodPropertyEntity; import com.epmet.entity.IcNeighborHoodPropertyEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -35,7 +36,8 @@ public interface IcNeighborHoodPropertyDao extends BaseDao<IcNeighborHoodPropert
/** /**
* 查询物业下的小区名称 * 查询物业下的小区名称
* @param propertyId 物业id * @param propertyId 物业id
* @return * @param agencyId 组织id
* @return 当前物业在 当前组织及下级范围内管理的小区数量
*/ */
List<IcNeighborHoodDTO> getNeighborHoodList(String propertyId); List<IcNeighborHoodDTO> getNeighborHoodList(@Param("propertyId") String propertyId, @Param("agencyId") String agencyId);
} }

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java

@ -62,5 +62,6 @@ public interface IcPropertyManagementDao extends BaseDao<IcPropertyManagementEnt
List<IcPropertyManagementDTO> queryList(@Param("customerId") String customerId, List<IcPropertyManagementDTO> queryList(@Param("customerId") String customerId,
@Param("name")String name, @Param("name")String name,
@Param("contactName") String contactName, @Param("contactName") String contactName,
@Param("contactMobile") String contactMobile); @Param("contactMobile") String contactMobile,
@Param("agencyId")String agencyId);
} }

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PropertyManagementService.java

@ -47,15 +47,13 @@ public interface PropertyManagementService {
* @param name 物业名称 * @param name 物业名称
* @param contactName 物业联系人 * @param contactName 物业联系人
* @param contactMobile 联系电话 * @param contactMobile 联系电话
* @param queryType 列表查询page-query导出export
* @return * @return
*/ */
PageData<IcPropertyManagementDTO> page(Integer pageNo, PageData<IcPropertyManagementDTO> page(Integer pageNo,
Integer pageSize, Integer pageSize,
String name, String name,
String contactName, String contactName,
String contactMobile, String contactMobile);
String queryType);
/** /**
* 查看物业详情 * 查看物业详情

30
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PropertyManagementServiceImpl.java

@ -5,10 +5,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; 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.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.*; import com.epmet.commons.tools.utils.*;
import com.epmet.constants.ImportTaskConstants; import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.IcNeighborHoodPropertyDao; import com.epmet.dao.IcNeighborHoodPropertyDao;
@ -178,25 +180,23 @@ public class PropertyManagementServiceImpl implements PropertyManagementService
* @param name 物业名称 * @param name 物业名称
* @param contactName 物业联系人 * @param contactName 物业联系人
* @param contactMobile 联系电话 * @param contactMobile 联系电话
* @param queryType 列表查询page-query导出export
* @return * @return
*/ */
@Override @Override
public PageData<IcPropertyManagementDTO> page(Integer pageNo, Integer pageSize, String name, String contactName, String contactMobile, String queryType) { public PageData<IcPropertyManagementDTO> page(Integer pageNo, Integer pageSize, String name, String contactName, String contactMobile) {
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId());
PageHelper.startPage(pageNo, pageSize); PageHelper.startPage(pageNo, pageSize);
List<IcPropertyManagementDTO> list = icPropertyManagementDao.queryList(EpmetRequestHolder.getLoginUserCustomerId(), name, contactName, contactMobile); List<IcPropertyManagementDTO> list = icPropertyManagementDao.queryList(EpmetRequestHolder.getLoginUserCustomerId(), name, contactName, contactMobile, staffInfoCacheResult.getAgencyId());
PageInfo<IcPropertyManagementDTO> pageInfo = new PageInfo<>(list); PageInfo<IcPropertyManagementDTO> pageInfo = new PageInfo<>(list);
// 导出时需要导出关联的小区名称 // 导出时需要导出关联的小区名称
if ("export".equals(queryType)) { pageInfo.getList().forEach(result -> {
pageInfo.getList().forEach(result -> { List<IcNeighborHoodDTO> neighborHoodList = icNeighborHoodPropertyDao.getNeighborHoodList(result.getId(), staffInfoCacheResult.getAgencyId());
List<IcNeighborHoodDTO> neighborHoodList = icNeighborHoodPropertyDao.getNeighborHoodList(result.getId()); List<String> neighborHoodNames = neighborHoodList.stream()
List<String> neighborHoodNames = neighborHoodList.stream() .map(IcNeighborHoodDTO::getNeighborHoodName)
.map(IcNeighborHoodDTO::getNeighborHoodName) .distinct().collect(Collectors.toList());
.distinct().collect(Collectors.toList()); result.setNeighborHoodNames(CollectionUtils.isNotEmpty(neighborHoodList) ? StringUtils.join(neighborHoodNames, StrConstant.COMMA_ZH) : StrConstant.EPMETY_STR);
result.setNeighborHoodNames(CollectionUtils.isNotEmpty(neighborHoodList) ? StringUtils.join(neighborHoodNames, StrConstant.COMMA_ZH) : StrConstant.EPMETY_STR); result.setNeighborHoodList(neighborHoodList);
result.setNeighborHoodList(neighborHoodList); });
});
}
return new PageData<>(list, pageInfo.getTotal(), pageSize); return new PageData<>(list, pageInfo.getTotal(), pageSize);
} }
@ -208,17 +208,19 @@ public class PropertyManagementServiceImpl implements PropertyManagementService
*/ */
@Override @Override
public IcPropertyManagementDTO getDetail(String id) { public IcPropertyManagementDTO getDetail(String id) {
CustomerStaffInfoCacheResult staffInfoCacheResult= CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(),EpmetRequestHolder.getLoginUserId());
IcPropertyManagementEntity icPropertyManagementEntity = icPropertyManagementDao.selectById(id); IcPropertyManagementEntity icPropertyManagementEntity = icPropertyManagementDao.selectById(id);
if (null == icPropertyManagementEntity) { if (null == icPropertyManagementEntity) {
return null; return null;
} }
IcPropertyManagementDTO resultDto = ConvertUtils.sourceToTarget(icPropertyManagementEntity, IcPropertyManagementDTO.class); IcPropertyManagementDTO resultDto = ConvertUtils.sourceToTarget(icPropertyManagementEntity, IcPropertyManagementDTO.class);
List<IcNeighborHoodDTO> neighborHoodList = icNeighborHoodPropertyDao.getNeighborHoodList(id); List<IcNeighborHoodDTO> neighborHoodList = icNeighborHoodPropertyDao.getNeighborHoodList(id,staffInfoCacheResult.getAgencyId());
List<String> neighborHoodNames = neighborHoodList.stream() List<String> neighborHoodNames = neighborHoodList.stream()
.map(IcNeighborHoodDTO::getNeighborHoodName) .map(IcNeighborHoodDTO::getNeighborHoodName)
.distinct().collect(Collectors.toList()); .distinct().collect(Collectors.toList());
resultDto.setNeighborHoodNames(CollectionUtils.isNotEmpty(neighborHoodList) ? StringUtils.join(neighborHoodNames, StrConstant.COMMA_ZH) : StrConstant.EPMETY_STR); resultDto.setNeighborHoodNames(CollectionUtils.isNotEmpty(neighborHoodList) ? StringUtils.join(neighborHoodNames, StrConstant.COMMA_ZH) : StrConstant.EPMETY_STR);
resultDto.setNeighborHoodList(neighborHoodList); resultDto.setNeighborHoodList(neighborHoodList);
resultDto.setTotalNeighborHood(CollectionUtils.isNotEmpty(neighborHoodList)?neighborHoodList.size():NumConstant.ZERO);
return resultDto; return resultDto;
} }

2
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodPropertyDao.xml

@ -15,6 +15,7 @@
<result property="updatedTime" column="UPDATED_TIME"/> <result property="updatedTime" column="UPDATED_TIME"/>
</resultMap> </resultMap>
<!-- 当前物业在 当前组织及下级范围内,管理的小区数量 -->
<select id="getNeighborHoodList" parameterType="java.lang.String" resultType="com.epmet.dto.IcNeighborHoodDTO"> <select id="getNeighborHoodList" parameterType="java.lang.String" resultType="com.epmet.dto.IcNeighborHoodDTO">
SELECT SELECT
p.NEIGHBOR_HOOD_ID, p.NEIGHBOR_HOOD_ID,
@ -24,6 +25,7 @@
INNER JOIN ic_neighbor_hood h ON ( p.NEIGHBOR_HOOD_ID = h.ID ) INNER JOIN ic_neighbor_hood h ON ( p.NEIGHBOR_HOOD_ID = h.ID )
WHERE WHERE
p.PROPERTY_ID = #{propertyId} p.PROPERTY_ID = #{propertyId}
AND (h.AGENCY_ID = #{agencyId} or h.AGENCY_PIDS like concat('%',#{agencyId},'%') )
AND p.DEL_FLAG = '0' AND p.DEL_FLAG = '0'
AND h.DEL_FLAG = '0' AND h.DEL_FLAG = '0'
order by h.CREATED_TIME asc order by h.CREATED_TIME asc

9
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml

@ -71,14 +71,7 @@
</select> </select>
<select id="queryList" parameterType="map" resultType="com.epmet.dto.IcPropertyManagementDTO"> <select id="queryList" parameterType="map" resultType="com.epmet.dto.IcPropertyManagementDTO">
select m.*,( select m.*
select count(pr.NEIGHBOR_HOOD_ID)
from ic_neighbor_hood_property pr
INNER JOIN ic_neighbor_hood h ON ( pr.NEIGHBOR_HOOD_ID = h.ID )
where pr.PROPERTY_ID=m.id
and pr.del_flag='0'
and h.del_flag='0'
)as totalNeighborHood
from ic_property_management m from ic_property_management m
where m.del_flag='0' where m.del_flag='0'
and m.customer_id=#{customerId} and m.customer_id=#{customerId}

Loading…
Cancel
Save