|  |  | @ -5,20 +5,21 @@ package com.epmet.service.impl;/** | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.Result; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.StrangerAccessRecordDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.CustomerGridListQueryDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.CustomerGridForStangerResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.CustomerGridListFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.ListCustomerGridFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.CustomerGridForStrangerResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.entity.StrangerAccessRecordEntity; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.feign.GovOrgFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.StrangerAccessRecordService; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import java.util.ArrayList; | 
			
		
	
		
			
				
					|  |  |  | import java.util.Date; | 
			
		
	
		
			
				
					|  |  |  | import java.util.List; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | /** | 
			
		
	
		
			
				
					|  |  |  |  * @Description | 
			
		
	
		
			
				
					|  |  |  |  * @Description 陌生人记录访问表 | 
			
		
	
		
			
				
					|  |  |  |  * @ClassName ResiGuideServiceImpl | 
			
		
	
		
			
				
					|  |  |  |  * @Author wangc | 
			
		
	
		
			
				
					|  |  |  |  * @date 2020.03.17 13:01 | 
			
		
	
	
		
			
				
					|  |  | @ -29,48 +30,61 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAcc | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private GovOrgFeignClient govOrgFeignClient; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * 陌生人根据位置码获取附近网格数据,并且插入陌生人访客记录 | 
			
		
	
		
			
				
					|  |  |  |      * */ | 
			
		
	
		
			
				
					|  |  |  |      * @Description 陌生人根据地区编码查询附近网格数据具体实现 | 
			
		
	
		
			
				
					|  |  |  |      * @Param CustomerGridListFormDTO | 
			
		
	
		
			
				
					|  |  |  |      * @return Result<List<CustomerGridForStrangerResultDTO>> | 
			
		
	
		
			
				
					|  |  |  |      * @Author wangc | 
			
		
	
		
			
				
					|  |  |  |      * @Date 2020.03.19 14:28 | 
			
		
	
		
			
				
					|  |  |  |      **/ | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public List<CustomerGridForStangerResultDTO> ListCustomerGrid(CustomerGridListQueryDTO customerGridListQueryDTO) { | 
			
		
	
		
			
				
					|  |  |  |     public Result<List<CustomerGridForStrangerResultDTO>> listCustomerGrid(CustomerGridListFormDTO customerGridListFormDTO) { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         ListCustomerGridFormDTO listCustomerGridFormDTO = new ListCustomerGridFormDTO(); | 
			
		
	
		
			
				
					|  |  |  |         listCustomerGridFormDTO.setAreaCode(0 == customerGridListFormDTO.getIsAuthorized() ? | 
			
		
	
		
			
				
					|  |  |  |                 customerGridListFormDTO.getSelectedAreaCode() : customerGridListFormDTO.getAreaCode()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         Result<List<CustomerGridForStangerResultDTO>> queryResult = | 
			
		
	
		
			
				
					|  |  |  |         listCustomerGridFormDTO.setPageNo(null == customerGridListFormDTO.getPageNo() ? 1 : customerGridListFormDTO.getPageNo()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         listCustomerGridFormDTO.setPageSize(customerGridListFormDTO.getPageSize()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         Result<List<CustomerGridForStrangerResultDTO>> queryResult = | 
			
		
	
		
			
				
					|  |  |  |             govOrgFeignClient | 
			
		
	
		
			
				
					|  |  |  |                     .getPageForStrangerGuideInterface(customerGridListQueryDTO.getAreaCode(),customerGridListQueryDTO.getPageNo(),customerGridListQueryDTO.getPageSize()); | 
			
		
	
		
			
				
					|  |  |  |         if(0 == queryResult.getCode()) { | 
			
		
	
		
			
				
					|  |  |  |                     .getPageForStrangerGuideInterface(listCustomerGridFormDTO); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //Feign调用成功
 | 
			
		
	
		
			
				
					|  |  |  |         if(queryResult.success()) { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             List<CustomerGridForStangerResultDTO> queryList = queryResult.getData(); | 
			
		
	
		
			
				
					|  |  |  |             List<CustomerGridForStrangerResultDTO> queryList = queryResult.getData(); | 
			
		
	
		
			
				
					|  |  |  |             if (null != queryResult && queryList.size() > 0) { | 
			
		
	
		
			
				
					|  |  |  |                 StrangerAccessRecordEntity strangerTrance = new StrangerAccessRecordEntity(); | 
			
		
	
		
			
				
					|  |  |  |                 //未授权,手动选择 locationAreaCode
 | 
			
		
	
		
			
				
					|  |  |  |                 if (0 == customerGridListQueryDTO.getIsAuthorized()) { | 
			
		
	
		
			
				
					|  |  |  |                     strangerTrance.setLocationAreaCode(customerGridListQueryDTO.getSelectedAreaCode()); | 
			
		
	
		
			
				
					|  |  |  |                 } else if (1 == customerGridListQueryDTO.getIsAuthorized()) { | 
			
		
	
		
			
				
					|  |  |  |                     //已授权,自动选择 selectedAreaCode
 | 
			
		
	
		
			
				
					|  |  |  |                     strangerTrance.setLocationAreaCode(customerGridListQueryDTO.getAreaCode()); | 
			
		
	
		
			
				
					|  |  |  |                 //未授权,手动选择
 | 
			
		
	
		
			
				
					|  |  |  |                 if (0 == customerGridListFormDTO.getIsAuthorized()) { | 
			
		
	
		
			
				
					|  |  |  |                     strangerTrance.setSelectedAreaCode(customerGridListFormDTO.getSelectedAreaCode()); | 
			
		
	
		
			
				
					|  |  |  |                 } else if (1 == customerGridListFormDTO.getIsAuthorized()) { | 
			
		
	
		
			
				
					|  |  |  |                     //已授权,自动选择
 | 
			
		
	
		
			
				
					|  |  |  |                     strangerTrance.setLocationAreaCode(customerGridListFormDTO.getAreaCode()); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |                 strangerTrance.setIsAuthorized(customerGridListQueryDTO.getIsAuthorized()); | 
			
		
	
		
			
				
					|  |  |  |                 strangerTrance.setIsAuthorized(customerGridListFormDTO.getIsAuthorized()); | 
			
		
	
		
			
				
					|  |  |  |                 strangerTrance.setGridNumber(queryList.size()); | 
			
		
	
		
			
				
					|  |  |  |                 strangerTrance.setVisitTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |                 strangerTrance.setDelFlag("1"); | 
			
		
	
		
			
				
					|  |  |  |                 strangerTrance.setRevision(0); | 
			
		
	
		
			
				
					|  |  |  |                 strangerTrance.setCreatedBy("陌生人访客"); | 
			
		
	
		
			
				
					|  |  |  |                 strangerTrance.setCreatedTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |                 strangerTrance.setProvince(customerGridListQueryDTO.getProvince()); | 
			
		
	
		
			
				
					|  |  |  |                 strangerTrance.setCity(customerGridListQueryDTO.getCity()); | 
			
		
	
		
			
				
					|  |  |  |                 strangerTrance.setArea(customerGridListQueryDTO.getArea()); | 
			
		
	
		
			
				
					|  |  |  |                 strangerTrance.setProvince(customerGridListFormDTO.getProvince()); | 
			
		
	
		
			
				
					|  |  |  |                 strangerTrance.setCity(customerGridListFormDTO.getCity()); | 
			
		
	
		
			
				
					|  |  |  |                 strangerTrance.setArea(customerGridListFormDTO.getArea()); | 
			
		
	
		
			
				
					|  |  |  |                 insert(strangerTrance); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                 return queryList; | 
			
		
	
		
			
				
					|  |  |  |                 return new Result<List<CustomerGridForStrangerResultDTO>>().ok(queryList); | 
			
		
	
		
			
				
					|  |  |  |             } else { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                 return null; | 
			
		
	
		
			
				
					|  |  |  |                 //没有查询出结果
 | 
			
		
	
		
			
				
					|  |  |  |                 return new Result<List<CustomerGridForStrangerResultDTO>>().ok(new ArrayList<>()); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         }else{ | 
			
		
	
		
			
				
					|  |  |  |             return null; | 
			
		
	
		
			
				
					|  |  |  |             //Feign调用失败
 | 
			
		
	
		
			
				
					|  |  |  |             return new Result<List<CustomerGridForStrangerResultDTO>>().error(queryResult.getCode(),queryResult.getMsg()); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | 
 |