Browse Source

sso陌生人导览网格列表 增加customerId校验 从token中获取客户Id

dev
wangchao 5 years ago
parent
commit
a4a8034c54
  1. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListCustomerGridFormDTO.java
  2. 99
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  3. 7
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java
  4. 2
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java
  5. 4
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java

2
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 Integer pageSize = 20;
private String customerId;
} }

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

@ -59,6 +59,9 @@
grid.del_flag = 0 grid.del_flag = 0
AND AND
grid.area_code LIKE CONCAT(#{areaCode},'%') grid.area_code LIKE CONCAT(#{areaCode},'%')
<if test='null != customerId and "" != customerId'>
AND grid.customer_id = #{customerId}
</if>
ORDER BY ORDER BY
grid.customer_id, grid.customer_id,
CONVERT ( gridName USING gbk ) ASC CONVERT ( gridName USING gbk ) ASC
@ -74,36 +77,72 @@
( (
SELECT (
a.id AS grid_id, SELECT
a.customer_id, a.id AS grid_id,
concat( agency.fullname, '-', a.grid_name ) AS gridName a.customer_id,
FROM concat( agency.fullname, '-', a.grid_name ) AS gridName
CUSTOMER_GRID a FROM
CUSTOMER_GRID a
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
a1.id, a1.id,
CASE CASE
WHEN a2.ORGANIZATION_NAME IS NULL THEN
WHEN a2.ORGANIZATION_NAME IS NULL THEN a1.ORGANIZATION_NAME ELSE concat( a2.ORGANIZATION_NAME, '-', a1.ORGANIZATION_NAME )
a1.ORGANIZATION_NAME ELSE concat( a2.ORGANIZATION_NAME, '-', a1.ORGANIZATION_NAME ) END AS fullname
END AS fullname FROM
FROM customer_agency a1
customer_agency a1 LEFT JOIN customer_agency a2 ON a1.PID = a2.ID
LEFT JOIN customer_agency a2 ON a1.PID = a2.ID AND a1.del_flag = '0'
AND a1.del_flag = '0' WHERE
WHERE a1.del_flag = '0'
a1.del_flag = '0' AND a1.customer_id = #{customerId}
) agency ON a.PID = agency.ID ) agency ON a.PID = agency.ID
WHERE
a.del_flag = 0
WHERE AND a.area_code = #{areaCode}
a.del_flag = 0 <if test='null != customerId and "" != customerId'>
AND AND a.customer_id = #{customerId}
a.area_code = #{areaCode} </if>
ORDER BY ORDER BY
CONVERT ( gridName USING gbk ) ASC 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
<if test='null != customerId and "" != customerId'>
AND b.customer_id = #{customerId}
</if>
AND b.area_code LIKE CONCAT(#{cityCode},'%')
AND <![CDATA[ b.area_code <> #{areaCode}]]>
ORDER BY
b.area_code DESC ,CONVERT ( gridName USING gbk ) ASC
LIMIT 0,999999999999
)
) c ) c

7
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java

@ -18,6 +18,7 @@
package com.epmet.controller; package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser; 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.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; 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.dto.result.PublicCustomerGridForStrangerResultDTO;
import com.epmet.service.StrangerAccessRecordService; import com.epmet.service.StrangerAccessRecordService;
import org.springframework.beans.factory.annotation.Autowired; 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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -87,9 +89,10 @@ public class StrangerResiGuideController {
* @date 2021.01.18 16:39 * @date 2021.01.18 16:39
*/ */
@PostMapping("sso/publiclocationgridlist") @PostMapping("sso/publiclocationgridlist")
Result<List<CustomerGridForStrangerResultDTO>> locationGridList(@RequestBody CustomerGridListFormDTO customerGridListFormDTO){ Result<List<CustomerGridForStrangerResultDTO>> locationGridList(@LoginUser TokenDto dto,@RequestBody CustomerGridListFormDTO customerGridListFormDTO){
ValidatorUtils.validateEntity(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());
} }
/** /**

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

@ -128,6 +128,6 @@ public interface StrangerAccessRecordService extends BaseService<StrangerAccessR
* @author wangc * @author wangc
* @date 2021.01.18 16:39 * @date 2021.01.18 16:39
*/ */
Result<List<CustomerGridForStrangerResultDTO>> listCustomerGridH5(CustomerGridListFormDTO customerGridListFormDTO); Result<List<CustomerGridForStrangerResultDTO>> listCustomerGridH5(CustomerGridListFormDTO customerGridListFormDTO,String customerId);
} }

4
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<StrangerAcc
* @date 2021.01.18 16:39 * @date 2021.01.18 16:39
*/ */
@Override @Override
public Result<List<CustomerGridForStrangerResultDTO>> listCustomerGridH5(CustomerGridListFormDTO customerGridListFormDTO) { public Result<List<CustomerGridForStrangerResultDTO>> listCustomerGridH5(CustomerGridListFormDTO customerGridListFormDTO,String customerId) {
ListCustomerGridFormDTO listCustomerGridFormDTO = new ListCustomerGridFormDTO(); ListCustomerGridFormDTO listCustomerGridFormDTO = new ListCustomerGridFormDTO();
listCustomerGridFormDTO.setAreaCode(StringUtils.isBlank(customerGridListFormDTO.getSelectedAreaCode()) ? listCustomerGridFormDTO.setAreaCode(StringUtils.isBlank(customerGridListFormDTO.getSelectedAreaCode()) ?
@ -320,7 +320,7 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAcc
listCustomerGridFormDTO.setPageNo(null == customerGridListFormDTO.getPageNo() ? ModuleConstant.MIN_CURRENT_PAGE_NO : customerGridListFormDTO.getPageNo()); listCustomerGridFormDTO.setPageNo(null == customerGridListFormDTO.getPageNo() ? ModuleConstant.MIN_CURRENT_PAGE_NO : customerGridListFormDTO.getPageNo());
listCustomerGridFormDTO.setPageSize(customerGridListFormDTO.getPageSize()); listCustomerGridFormDTO.setPageSize(customerGridListFormDTO.getPageSize());
listCustomerGridFormDTO.setCustomerId(customerId);
Result<List<CustomerGridForStrangerResultDTO>> queryResult = Result<List<CustomerGridForStrangerResultDTO>> queryResult =
govOrgFeignClient govOrgFeignClient

Loading…
Cancel
Save