Browse Source

查询附近网格信息接口修改

dev
wangchao 6 years ago
parent
commit
2fe91fed68
  1. 8
      epmet-module/gov-org/gov-org-server/pom.xml
  2. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  3. 28
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  4. 54
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  5. 2
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java

8
epmet-module/gov-org/gov-org-server/pom.xml

@ -54,10 +54,12 @@
<artifactId>feign-httpclient</artifactId>
<version>10.3.0</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.0.1</version>
<groupId>com.epmet</groupId>
<artifactId>gov-org-client</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>

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

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
@ -26,6 +27,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 客户网格表
@ -53,7 +55,7 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @Author wangc
* @Date 2020.03.19 15:53
**/
List<CustomerGridForStrangerResultDTO> selectGridByCityLike(@Param("areaCode")String areaCode);
List<CustomerGridForStrangerResultDTO> selectGridByCityLike(ListCustomerGridFormDTO listCustomerGridFormDTO);
/**
@ -64,7 +66,7 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @Author wangc
* @Date 2020.03.19 15:53
**/
List<CustomerGridForStrangerResultDTO> selectRestGridWithoutGivenAreaCode(@Param("areaCode")String areaCode , @Param("cityCode")String cityCode);
List<CustomerGridForStrangerResultDTO> selectRestGridWithoutGivenAreaCode(Map<String,Object> paramsMap);
CustomerGridDTO getCustomerGridByGridId(CustomerGridFormDTO formDTO);
}

28
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -33,13 +33,13 @@ import com.epmet.entity.CustomerGridEntity;
import com.epmet.redis.CustomerGridRedis;
import com.epmet.service.CustomerGridService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -114,32 +114,32 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
String areaCode = listCustomerGridFormDTO.getAreaCode();
Integer pageNo = listCustomerGridFormDTO.getPageNo();
Integer pageSize = listCustomerGridFormDTO.getPageSize();
listCustomerGridFormDTO.setPageNo((listCustomerGridFormDTO.getPageNo() - 1) * listCustomerGridFormDTO.getPageSize());
if(areaCode.endsWith("00")){
//城市 - 查全部
PageHelper.startPage(pageNo,pageSize);
listCustomerGridFormDTO.setAreaCode(areaCode.substring(0,areaCode.length()-2));
List<CustomerGridForStrangerResultDTO> gridList
= baseDao.selectGridByCityLike(areaCode.substring(0,areaCode.length()-2));
= baseDao.selectGridByCityLike(listCustomerGridFormDTO);
result.setData(gridList);
result.setCode(0);
return result;
}else{
//行政区
List<CustomerGridForStrangerResultDTO> gridListArea
= baseDao.selectGridByAreaCode(areaCode);
List<CustomerGridForStrangerResultDTO> restGridListArea
= baseDao.selectRestGridWithoutGivenAreaCode(areaCode,areaCode.substring(0,areaCode.length()-2));
for(CustomerGridForStrangerResultDTO obj : restGridListArea){
gridListArea.add(obj);
}
//分页操作
Map<String,Object> map = new HashMap<>();
map.put("areaCode",areaCode);
map.put("cityCode",areaCode.substring(0,areaCode.length()-2));
map.put("pageSize",listCustomerGridFormDTO.getPageSize());
map.put("pageNo",listCustomerGridFormDTO.getPageNo());
List<CustomerGridForStrangerResultDTO> gridListArea
= baseDao.selectRestGridWithoutGivenAreaCode(map);
result.setData(gridListArea);
result.setCode(0);
return result;
}

54
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -61,7 +61,7 @@
<!-- 根据城市地区码前四位匹配到城市下所有网格 -->
<select id="selectGridByCityLike" parameterType="java.lang.String" resultType="com.epmet.dto.result.CustomerGridForStrangerResultDTO">
<select id="selectGridByCityLike" parameterType="com.epmet.dto.form.ListCustomerGridFormDTO" resultType="com.epmet.dto.result.CustomerGridForStrangerResultDTO">
SELECT
id AS grid_id,
customer_id,
@ -74,23 +74,55 @@
ORDER BY
customer_id,
CONVERT ( grid_name USING gbk ) ASC
LIMIT #{pageNo}, #{pageSize}
</select>
<!-- 根据区县地区码匹配到所属城市下除该区县以外其余所有网格 -->
<select id="selectRestGridWithoutGivenAreaCode" parameterType="java.lang.String" resultType="com.epmet.dto.result.CustomerGridForStrangerResultDTO">
<!-- 根据区县地区码匹配到该地区置顶其余区域在后这种特定排序的数据集 -->
<select id="selectRestGridWithoutGivenAreaCode" parameterType="map" resultType="com.epmet.dto.result.CustomerGridForStrangerResultDTO">
SELECT c.*
FROM
(
(
SELECT
id AS grid_id,
customer_id,
grid_name
a.id AS grid_id,
a.customer_id,
a.grid_name
FROM
CUSTOMER_GRID
CUSTOMER_GRID a
WHERE
AREA_CODE LIKE CONCAT(#{cityCode},'%')
a.area_code = #{areaCode}
AND <![CDATA[ AREA_CODE <> #{areaCode}
ORDER BY
CONVERT ( a.grid_name USING gbk ) ASC
LIMIT 99999
)
UNION
(
SELECT
b.id AS grid_id,
b.customer_id,
b.grid_name
FROM
CUSTOMER_GRID b
WHERE
b.area_code LIKE CONCAT(#{cityCode},'%')
AND <![CDATA[ b.area_code <> #{areaCode}
]]>
ORDER BY
customer_id,
CONVERT ( grid_name USING gbk ) ASC
CONVERT ( b.grid_name USING gbk ) ASC
LIMIT 999999
)
) AS c
LIMIT #{pageNo}, #{pageSize}
</select>
</mapper>

2
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java

@ -144,9 +144,11 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAcc
//未授权,手动选择
if (0 == customerGridListFormDTO.getIsAuthorized()) {
strangerTrance.setSelectedAreaCode(customerGridListFormDTO.getSelectedAreaCode());
strangerTrance.setLocationAreaCode("");
} else if (1 == customerGridListFormDTO.getIsAuthorized()) {
//已授权,自动选择
strangerTrance.setLocationAreaCode(customerGridListFormDTO.getAreaCode());
strangerTrance.setSelectedAreaCode("");
}
strangerTrance.setIsAuthorized(customerGridListFormDTO.getIsAuthorized());
strangerTrance.setGridNumber(queryList.size());

Loading…
Cancel
Save