forked from rongchao/epmet-cloud-rizhao
22 changed files with 401 additions and 174 deletions
@ -1,7 +1,20 @@ |
|||||
package com.epmet.exception; |
package com.epmet.exception; |
||||
|
|
||||
|
import com.epmet.commons.tools.exception.ErrorCode; |
||||
|
|
||||
/** |
/** |
||||
* Created by 11 on 2020/3/19. |
* 模块错误编码,由9位数字组成,前6位为模块编码,后3位为业务编码 |
||||
|
* <p> |
||||
|
* 如:100001001(100001代表模块,001代表业务代码) |
||||
|
* </p> |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
*/ |
*/ |
||||
public interface ModuleErrorCode { |
public interface ModuleErrorCode extends ErrorCode { |
||||
|
|
||||
|
int ARGS_NOT_ALLOW_NULL_ERROR = 100019001; |
||||
|
|
||||
|
int NOT_STANDARD_AREA_CODE_ERROR = 100019002; |
||||
|
|
||||
} |
} |
||||
|
@ -1,48 +0,0 @@ |
|||||
package com.epmet.controller;/** |
|
||||
* Created by 11 on 2020/3/17. |
|
||||
*/ |
|
||||
|
|
||||
import com.epmet.commons.tools.page.PageData; |
|
||||
import com.epmet.commons.tools.utils.Result; |
|
||||
import com.epmet.dto.CustomerGridListQueryDTO; |
|
||||
import com.epmet.dto.result.CustomerGridListResultDTO; |
|
||||
import com.epmet.service.ResiGuideService; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.web.bind.annotation.PostMapping; |
|
||||
import org.springframework.web.bind.annotation.RequestBody; |
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||
import org.springframework.web.bind.annotation.RestController; |
|
||||
|
|
||||
/** |
|
||||
* @Description |
|
||||
* @ClassName ResiGuideController |
|
||||
* @Author wangc |
|
||||
* @date 2020.03.17 11:33 |
|
||||
*/ |
|
||||
@RestController |
|
||||
@RequestMapping("stranger") |
|
||||
public class ResiGuideController { |
|
||||
|
|
||||
@Autowired |
|
||||
private ResiGuideService resiGuideService; |
|
||||
|
|
||||
|
|
||||
@PostMapping("getlocationcustomergridlist") |
|
||||
Result<PageData<CustomerGridListResultDTO>> getlocationcustomergridlist(@RequestBody CustomerGridListQueryDTO queryParam){ |
|
||||
Result<PageData<CustomerGridListResultDTO>> result = new Result<>(); |
|
||||
|
|
||||
//TODO..捕获异常
|
|
||||
|
|
||||
return result.ok(resiGuideService.ListCustomerGrid(queryParam)); |
|
||||
|
|
||||
} |
|
||||
|
|
||||
@PostMapping("getlelectcdcustomergridlist") |
|
||||
Result<PageData<CustomerGridListResultDTO>> getlelectcdcustomergridlist(@RequestBody CustomerGridListQueryDTO queryParam){ |
|
||||
Result<PageData<CustomerGridListResultDTO>> result = new Result<>(); |
|
||||
|
|
||||
//TODO..捕获异常
|
|
||||
|
|
||||
return result.ok(resiGuideService.ListCustomerGrid(queryParam)); |
|
||||
} |
|
||||
} |
|
@ -0,0 +1,53 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.dto.CustomerGridListQueryDTO; |
||||
|
import com.epmet.dto.result.CustomerGridForStangerResultDTO; |
||||
|
import com.epmet.service.StrangerAccessRecordService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @ClassName StrangerAccessRecordController |
||||
|
* @Author wangc |
||||
|
* @date 2020.03.17 11:33 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("stranger") |
||||
|
public class StrangerAccessRecordController { |
||||
|
|
||||
|
@Autowired |
||||
|
private StrangerAccessRecordService strangerAccessRecordService; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 陌生访客授权位置获取附近网格数据 |
||||
|
* |
||||
|
* */ |
||||
|
@PostMapping("getlocationcustomergridlist") |
||||
|
Result<List<CustomerGridForStangerResultDTO>> getLocationCustomerGridList(@RequestBody CustomerGridListQueryDTO customerGridListQueryDTO){ |
||||
|
|
||||
|
ValidatorUtils.validateEntity(customerGridListQueryDTO); |
||||
|
|
||||
|
return new Result<List<CustomerGridForStangerResultDTO>>().ok(strangerAccessRecordService.ListCustomerGrid(customerGridListQueryDTO)); |
||||
|
|
||||
|
} |
||||
|
/** |
||||
|
* 陌生访客自动选定位置获取附近网格数据 |
||||
|
* |
||||
|
* */ |
||||
|
@PostMapping("getselectcdcustomergridlist") |
||||
|
Result<List<CustomerGridForStangerResultDTO>> getSelectcdCustomerGridList(@RequestBody CustomerGridListQueryDTO customerGridListQueryDTO){ |
||||
|
|
||||
|
ValidatorUtils.validateEntity(customerGridListQueryDTO); |
||||
|
|
||||
|
return new Result<List<CustomerGridForStangerResultDTO>>().ok(strangerAccessRecordService.ListCustomerGrid(customerGridListQueryDTO)); |
||||
|
} |
||||
|
} |
@ -1,18 +0,0 @@ |
|||||
package com.epmet.service; |
|
||||
|
|
||||
import com.epmet.commons.mybatis.service.BaseService; |
|
||||
import com.epmet.commons.tools.page.PageData; |
|
||||
import com.epmet.dto.CustomerGridListQueryDTO; |
|
||||
import com.epmet.dto.result.CustomerGridListResultDTO; |
|
||||
import com.epmet.entity.StrangerAccessRecordEntity; |
|
||||
|
|
||||
/** |
|
||||
* Created by 11 on 2020/3/17. |
|
||||
*/ |
|
||||
|
|
||||
public interface ResiGuideService extends BaseService<StrangerAccessRecordEntity> { |
|
||||
|
|
||||
PageData<CustomerGridListResultDTO> ListCustomerGrid(CustomerGridListQueryDTO customerGridListQueryDTO); |
|
||||
|
|
||||
void save(StrangerAccessRecordEntity strangerAccessRecordEntity); |
|
||||
} |
|
@ -0,0 +1,21 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.dto.CustomerGridListQueryDTO; |
||||
|
import com.epmet.dto.result.CustomerGridForStangerResultDTO; |
||||
|
import com.epmet.entity.StrangerAccessRecordEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Created by 11 on 2020/3/17. |
||||
|
*/ |
||||
|
|
||||
|
public interface StrangerAccessRecordService extends BaseService<StrangerAccessRecordEntity> { |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* 陌生人根据位置码获取附近网格数据,并且插入陌生人访客记录 |
||||
|
* */ |
||||
|
List<CustomerGridForStangerResultDTO> ListCustomerGrid(CustomerGridListQueryDTO customerGridListQueryDTO); |
||||
|
} |
@ -1,70 +0,0 @@ |
|||||
package com.epmet.service.impl;/** |
|
||||
* Created by 11 on 2020/3/17. |
|
||||
*/ |
|
||||
|
|
||||
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 |
|
||||
* @ClassName ResiGuideServiceImpl |
|
||||
* @Author wangc |
|
||||
* @date 2020.03.17 13:01 |
|
||||
*/ |
|
||||
@Service |
|
||||
public class ResiGuideServiceImpl extends BaseServiceImpl<StrangerAccessRecordDao, StrangerAccessRecordEntity> implements ResiGuideService { |
|
||||
|
|
||||
@Autowired |
|
||||
private GovOrgFeignClient govOrgFeignClient; |
|
||||
|
|
||||
@Override |
|
||||
public PageData<CustomerGridListResultDTO> ListCustomerGrid(CustomerGridListQueryDTO customerGridListQueryDTO) { |
|
||||
|
|
||||
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); |
|
||||
} |
|
||||
} |
|
@ -0,0 +1,80 @@ |
|||||
|
package com.epmet.service.impl;/** |
||||
|
* Created by 11 on 2020/3/17. |
||||
|
*/ |
||||
|
|
||||
|
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.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.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @ClassName ResiGuideServiceImpl |
||||
|
* @Author wangc |
||||
|
* @date 2020.03.17 13:01 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAccessRecordDao, StrangerAccessRecordEntity> implements StrangerAccessRecordService { |
||||
|
|
||||
|
@Autowired |
||||
|
private GovOrgFeignClient govOrgFeignClient; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* 陌生人根据位置码获取附近网格数据,并且插入陌生人访客记录 |
||||
|
* */ |
||||
|
@Override |
||||
|
public List<CustomerGridForStangerResultDTO> ListCustomerGrid(CustomerGridListQueryDTO customerGridListQueryDTO) { |
||||
|
|
||||
|
Result<List<CustomerGridForStangerResultDTO>> queryResult = |
||||
|
govOrgFeignClient |
||||
|
.getPageForStrangerGuideInterface(customerGridListQueryDTO.getAreaCode(),customerGridListQueryDTO.getPageNo(),customerGridListQueryDTO.getPageSize()); |
||||
|
if(0 == queryResult.getCode()) { |
||||
|
|
||||
|
|
||||
|
List<CustomerGridForStangerResultDTO> 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()); |
||||
|
} |
||||
|
strangerTrance.setIsAuthorized(customerGridListQueryDTO.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()); |
||||
|
insert(strangerTrance); |
||||
|
|
||||
|
return queryList; |
||||
|
} else { |
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
}else{ |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
Loading…
Reference in new issue