diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListCustomerGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListCustomerGridFormDTO.java index 21a790fe39..3724abbf02 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListCustomerGridFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListCustomerGridFormDTO.java @@ -35,4 +35,6 @@ public class ListCustomerGridFormDTO implements Serializable{ * 每页显示数量 * */ private Integer pageSize = 20; + + private String customerId; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index df3a9fc938..ec5c6143ac 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -59,6 +59,9 @@ grid.del_flag = 0 AND grid.area_code LIKE CONCAT(#{areaCode},'%') + + AND grid.customer_id = #{customerId} + ORDER BY grid.customer_id, CONVERT ( gridName USING gbk ) ASC @@ -74,36 +77,72 @@ ( - SELECT - a.id AS grid_id, - a.customer_id, - concat( agency.fullname, '-', a.grid_name ) AS gridName - FROM - CUSTOMER_GRID a - - LEFT JOIN ( - SELECT - a1.id, - CASE - - WHEN a2.ORGANIZATION_NAME IS NULL THEN - a1.ORGANIZATION_NAME ELSE concat( a2.ORGANIZATION_NAME, '-', a1.ORGANIZATION_NAME ) - END AS fullname - FROM - customer_agency a1 - LEFT JOIN customer_agency a2 ON a1.PID = a2.ID - AND a1.del_flag = '0' - WHERE - a1.del_flag = '0' - ) agency ON a.PID = agency.ID - - - WHERE - a.del_flag = 0 - AND - a.area_code = #{areaCode} - ORDER BY - CONVERT ( gridName USING gbk ) ASC + ( + SELECT + a.id AS grid_id, + a.customer_id, + concat( agency.fullname, '-', a.grid_name ) AS gridName + FROM + CUSTOMER_GRID a + LEFT JOIN ( + SELECT + a1.id, + CASE + WHEN a2.ORGANIZATION_NAME IS NULL THEN + a1.ORGANIZATION_NAME ELSE concat( a2.ORGANIZATION_NAME, '-', a1.ORGANIZATION_NAME ) + END AS fullname + FROM + customer_agency a1 + LEFT JOIN customer_agency a2 ON a1.PID = a2.ID + AND a1.del_flag = '0' + WHERE + a1.del_flag = '0' + AND a1.customer_id = #{customerId} + ) agency ON a.PID = agency.ID + WHERE + a.del_flag = 0 + AND a.area_code = #{areaCode} + + AND a.customer_id = #{customerId} + + ORDER BY + CONVERT ( gridName USING gbk ) ASC + LIMIT 0,999999999999 + ) + UNION + ( + SELECT + b.id AS grid_id, + b.customer_id, + concat(agency.fullname , '-' ,b.grid_name) as gridName + FROM + CUSTOMER_GRID b + LEFT JOIN ( + SELECT + a1.id, + CASE + WHEN a2.ORGANIZATION_NAME IS NULL THEN + a1.ORGANIZATION_NAME ELSE concat( a2.ORGANIZATION_NAME, '-', a1.ORGANIZATION_NAME ) + END AS fullname + FROM + customer_agency a1 + LEFT JOIN customer_agency a2 ON a1.PID = a2.ID + AND a1.del_flag = '0' + WHERE + a1.del_flag = '0' + AND a1.customer_id = #{customerId} + ) agency ON b.PID = agency.ID + WHERE + b.del_flag = 0 + + AND b.customer_id = #{customerId} + + AND b.area_code LIKE CONCAT(#{cityCode},'%') + AND #{areaCode}]]> + ORDER BY + b.area_code DESC ,CONVERT ( gridName USING gbk ) ASC + LIMIT 0,999999999999 + ) ) c diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java index 47660b3ea2..c50414fdb6 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java @@ -18,6 +18,7 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -30,6 +31,7 @@ import com.epmet.dto.result.MarketContactInfoResultDTO; import com.epmet.dto.result.PublicCustomerGridForStrangerResultDTO; import com.epmet.service.StrangerAccessRecordService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -87,9 +89,10 @@ public class StrangerResiGuideController { * @date 2021.01.18 16:39 */ @PostMapping("sso/publiclocationgridlist") - Result> locationGridList(@RequestBody CustomerGridListFormDTO customerGridListFormDTO){ + Result> locationGridList(@LoginUser TokenDto dto,@RequestBody CustomerGridListFormDTO customerGridListFormDTO){ ValidatorUtils.validateEntity(customerGridListFormDTO); - return strangerAccessRecordService.listCustomerGridH5(customerGridListFormDTO); + if(null == dto || StringUtils.isEmpty(dto.getCustomerId())) throw new ValidateException("无法获取客户Id"); + return strangerAccessRecordService.listCustomerGridH5(customerGridListFormDTO,dto.getCustomerId()); } /** diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java index ffbd90e0e1..f357cb3440 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java @@ -128,6 +128,6 @@ public interface StrangerAccessRecordService extends BaseService> listCustomerGridH5(CustomerGridListFormDTO customerGridListFormDTO); + Result> listCustomerGridH5(CustomerGridListFormDTO customerGridListFormDTO,String customerId); } diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java index e7e5c6cca9..a8aa3569c0 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java @@ -312,7 +312,7 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl> listCustomerGridH5(CustomerGridListFormDTO customerGridListFormDTO) { + public Result> listCustomerGridH5(CustomerGridListFormDTO customerGridListFormDTO,String customerId) { ListCustomerGridFormDTO listCustomerGridFormDTO = new ListCustomerGridFormDTO(); listCustomerGridFormDTO.setAreaCode(StringUtils.isBlank(customerGridListFormDTO.getSelectedAreaCode()) ? @@ -320,7 +320,7 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl> queryResult = govOrgFeignClient