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