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. 62
      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> <artifactId>feign-httpclient</artifactId>
<version>10.3.0</version> <version>10.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.pagehelper</groupId> <groupId>com.epmet</groupId>
<artifactId>pagehelper</artifactId> <artifactId>gov-org-client</artifactId>
<version>5.0.1</version> <version>2.0.0</version>
</dependency> </dependency>
</dependencies> </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; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerGridFormDTO;
@ -26,6 +27,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 客户网格表 * 客户网格表
@ -53,7 +55,7 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @Author wangc * @Author wangc
* @Date 2020.03.19 15:53 * @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 * @Author wangc
* @Date 2020.03.19 15:53 * @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); 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.redis.CustomerGridRedis;
import com.epmet.service.CustomerGridService; import com.epmet.service.CustomerGridService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -114,32 +114,32 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
String areaCode = listCustomerGridFormDTO.getAreaCode(); String areaCode = listCustomerGridFormDTO.getAreaCode();
Integer pageNo = listCustomerGridFormDTO.getPageNo(); listCustomerGridFormDTO.setPageNo((listCustomerGridFormDTO.getPageNo() - 1) * listCustomerGridFormDTO.getPageSize());
Integer pageSize = listCustomerGridFormDTO.getPageSize();
if(areaCode.endsWith("00")){ if(areaCode.endsWith("00")){
//城市 - 查全部 //城市 - 查全部
PageHelper.startPage(pageNo,pageSize); listCustomerGridFormDTO.setAreaCode(areaCode.substring(0,areaCode.length()-2));
List<CustomerGridForStrangerResultDTO> gridList List<CustomerGridForStrangerResultDTO> gridList
= baseDao.selectGridByCityLike(areaCode.substring(0,areaCode.length()-2)); = baseDao.selectGridByCityLike(listCustomerGridFormDTO);
result.setData(gridList); result.setData(gridList);
result.setCode(0); result.setCode(0);
return result; return result;
}else{ }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.setData(gridListArea);
result.setCode(0);
return result; return result;
} }

62
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 SELECT
id AS grid_id, id AS grid_id,
customer_id, customer_id,
@ -74,23 +74,55 @@
ORDER BY ORDER BY
customer_id, customer_id,
CONVERT ( grid_name USING gbk ) ASC CONVERT ( grid_name USING gbk ) ASC
LIMIT #{pageNo}, #{pageSize}
</select> </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
id AS grid_id,
customer_id, SELECT c.*
grid_name
FROM FROM
CUSTOMER_GRID (
WHERE
AREA_CODE LIKE CONCAT(#{cityCode},'%') (
SELECT
a.id AS grid_id,
a.customer_id,
a.grid_name
FROM
CUSTOMER_GRID a
WHERE
a.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
CONVERT ( b.grid_name USING gbk ) ASC
LIMIT 999999
)
) AS c
LIMIT #{pageNo}, #{pageSize}
AND <![CDATA[ AREA_CODE <> #{areaCode}
]]>
ORDER BY
customer_id,
CONVERT ( grid_name USING gbk ) ASC
</select> </select>
</mapper> </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()) { if (0 == customerGridListFormDTO.getIsAuthorized()) {
strangerTrance.setSelectedAreaCode(customerGridListFormDTO.getSelectedAreaCode()); strangerTrance.setSelectedAreaCode(customerGridListFormDTO.getSelectedAreaCode());
strangerTrance.setLocationAreaCode("");
} else if (1 == customerGridListFormDTO.getIsAuthorized()) { } else if (1 == customerGridListFormDTO.getIsAuthorized()) {
//已授权,自动选择 //已授权,自动选择
strangerTrance.setLocationAreaCode(customerGridListFormDTO.getAreaCode()); strangerTrance.setLocationAreaCode(customerGridListFormDTO.getAreaCode());
strangerTrance.setSelectedAreaCode("");
} }
strangerTrance.setIsAuthorized(customerGridListFormDTO.getIsAuthorized()); strangerTrance.setIsAuthorized(customerGridListFormDTO.getIsAuthorized());
strangerTrance.setGridNumber(queryList.size()); strangerTrance.setGridNumber(queryList.size());

Loading…
Cancel
Save