Browse Source

陌生人导览模块,授权/不授权位置信息时查询网格信息

dev_shibei_match
wangchao 6 years ago
parent
commit
7db67f2594
  1. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  2. 19
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/ResiGuideController.java
  3. 22
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
  4. 29
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/impl/GovOrgFeginFallBack.java
  5. 2
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/ResiGuideService.java
  6. 43
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/ResiGuideServiceImpl.java

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java

@ -91,4 +91,9 @@ public class CustomerGridController {
ExcelUtils.exportExcelToTarget(response, null, list, CustomerGridExcel.class);
}
@GetMapping("{areaCode}")
public Result queryListByOrder(@PathVariable("areaCode")String areaCode){
return new Result();
}
}

19
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/ResiGuideController.java

@ -27,13 +27,22 @@ public class ResiGuideController {
private ResiGuideService resiGuideService;
@PostMapping()
Result<PageData<CustomerGridListResultDTO>> getlocationcustomergridlist(@RequestBody CustomerGridListQueryDTO queryParam){
return null;
@PostMapping("getlocationcustomergridlist")
Result<PageData<CustomerGridListResultDTO>> getlocationcustomergridlist(@RequestBody CustomerGridListQueryDTO queryParam){
Result<PageData<CustomerGridListResultDTO>> result = new Result<>();
//TODO..捕获异常
return result.ok(resiGuideService.ListCustomerGrid(queryParam));
}
@PostMapping()
@PostMapping("getlelectcdcustomergridlist")
Result<PageData<CustomerGridListResultDTO>> getlelectcdcustomergridlist(@RequestBody CustomerGridListQueryDTO queryParam){
return null;
Result<PageData<CustomerGridListResultDTO>> result = new Result<>();
//TODO..捕获异常
return result.ok(resiGuideService.ListCustomerGrid(queryParam));
}
}

22
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java

@ -0,0 +1,22 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.CustomerGridListResultDTO;
import com.epmet.feign.impl.GovOrgFeginFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
/**
* Created by 11 on 2020/3/17.
*/
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeginFallBack.class)
public interface GovOrgFeignClient {
@PostMapping(value = "/gov/org/customergrid/{areaCode}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result<PageData<CustomerGridListResultDTO>> getPageForStrangerGuideInterface(@PathVariable("areaCode")String areaCode);
}

29
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/impl/GovOrgFeginFallBack.java

@ -0,0 +1,29 @@
package com.epmet.feign.impl;/**
* Created by 11 on 2020/3/17.
*/
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridListQueryDTO;
import com.epmet.dto.result.CustomerGridListResultDTO;
import com.epmet.feign.GovOrgFeignClient;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
/**
* @Description
* @ClassName GovOrgFeginFallBack
* @Author wangc
* @date 2020.03.17 14:29
*/
@Component
public class GovOrgFeginFallBack implements GovOrgFeignClient {
@Override
public Result<PageData<CustomerGridListResultDTO>> getPageForStrangerGuideInterface(String areaCode) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryListByAreaCodeOrderBy",areaCode);
}
}

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

@ -13,4 +13,6 @@ import com.epmet.entity.StrangerAccessRecordEntity;
public interface ResiGuideService extends BaseService<StrangerAccessRecordEntity> {
PageData<CustomerGridListResultDTO> ListCustomerGrid(CustomerGridListQueryDTO customerGridListQueryDTO);
void save(StrangerAccessRecordEntity strangerAccessRecordEntity);
}

43
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/ResiGuideServiceImpl.java

@ -4,12 +4,19 @@ package com.epmet.service.impl;/**
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.StrangerAccessRecordDao;
import com.epmet.dto.CustomerGridListQueryDTO;
import com.epmet.dto.result.CustomerGridListResultDTO;
import com.epmet.entity.StrangerAccessRecordEntity;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.service.ResiGuideService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
* @Description
@ -20,10 +27,44 @@ import org.springframework.stereotype.Service;
@Service
public class ResiGuideServiceImpl extends BaseServiceImpl<StrangerAccessRecordDao, StrangerAccessRecordEntity> implements ResiGuideService {
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Override
public PageData<CustomerGridListResultDTO> ListCustomerGrid(CustomerGridListQueryDTO customerGridListQueryDTO) {
return null;
PageData<CustomerGridListResultDTO> queryResult =
govOrgFeignClient.getPageForStrangerGuideInterface(customerGridListQueryDTO);
if(null != queryResult.getList() && queryResult.getList().size() > 0){
for(CustomerGridListResultDTO obj : queryResult.getList()){
StrangerAccessRecordEntity strangerTrance = new StrangerAccessRecordEntity();
//未授权,手动选择 locationAreaCode
if(0 == customerGridListQueryDTO.getIsAuthorized()){
strangerTrance.setLocationAreaCode(customerGridListQueryDTO.getLelectedAreaCode());
}else if( 1 == customerGridListQueryDTO.getIsAuthorized()){
//已授权,自动选择 lelectedAreaCode
strangerTrance.setLocationAreaCode(customerGridListQueryDTO.getAreaCode());
}
strangerTrance.setIsAuthorized(customerGridListQueryDTO.getIsAuthorized());
strangerTrance.setGridNumber(queryResult.getTotal());
strangerTrance.setVisitTime(new Date());
strangerTrance.setDelFlag("1");
strangerTrance.setRevision(0);
strangerTrance.setCreatedBy("陌生人访客");
strangerTrance.setCreatedTime(new Date());
insert(strangerTrance);
}
}
return queryResult;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(StrangerAccessRecordEntity strangerAccessRecordEntity) {
StrangerAccessRecordEntity entity = ConvertUtils.sourceToTarget(strangerAccessRecordEntity, StrangerAccessRecordEntity.class);
insert(entity);
}
}

Loading…
Cancel
Save