|
|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.elink.esua.epdc.service.impl; |
|
|
|
|
|
|
|
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|
|
|
import com.elink.esua.epdc.common.token.dto.TokenDto; |
|
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.dto.CompleteDeptDTO; |
|
|
|
@ -39,6 +40,52 @@ public class CustomServiceImpl implements CustomService { |
|
|
|
@Autowired |
|
|
|
private UserFeignClient userFeignClient; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<EpdcSentryPostInfoResultDTO> getDeptInfoByMaCode(String code) { |
|
|
|
String combine = "-"; |
|
|
|
if (StringUtils.isBlank(code) || code.indexOf(combine) == NumConstant.ONE_NEG) { |
|
|
|
return new Result().error("不是规范的哨卡小程序码"); |
|
|
|
} |
|
|
|
|
|
|
|
EpdcSentryPostInfoResultDTO epdcSentryPostInfoResultDTO = new EpdcSentryPostInfoResultDTO(); |
|
|
|
|
|
|
|
String[] grididAndPostId = code.split(combine); |
|
|
|
if (grididAndPostId.length < NumConstant.TWO) { |
|
|
|
return new Result().error("哨卡小程序码信息异常"); |
|
|
|
} |
|
|
|
// 网格id
|
|
|
|
String gridId = grididAndPostId[NumConstant.ZERO]; |
|
|
|
// 哨卡编码
|
|
|
|
String postCode = grididAndPostId[NumConstant.ONE]; |
|
|
|
|
|
|
|
//拿取网格信息
|
|
|
|
CompleteDeptDTO completeDept = getCompleteDeptDTOByGridId(gridId); |
|
|
|
epdcSentryPostInfoResultDTO.setStreetName(completeDept.getStreet()); |
|
|
|
epdcSentryPostInfoResultDTO.setCommunityName(completeDept.getCommunity()); |
|
|
|
epdcSentryPostInfoResultDTO.setGridId(completeDept.getGridId()); |
|
|
|
epdcSentryPostInfoResultDTO.setGridName(completeDept.getGrid()); |
|
|
|
|
|
|
|
//拿取哨卡信息
|
|
|
|
Result<EpidemicSentryPostDTO> epidemicSentryResult = customFeignClient.getEpidemicSentryBySentryPostCode(postCode); |
|
|
|
if (!epidemicSentryResult.success() || null == epidemicSentryResult.getData()) { |
|
|
|
return new Result().error("查询哨卡信息失败"); |
|
|
|
} |
|
|
|
EpidemicSentryPostDTO epidemicSentryPostDTO = epidemicSentryResult.getData(); |
|
|
|
epdcSentryPostInfoResultDTO.setSentryPostName(epidemicSentryPostDTO.getSentryPostName()); |
|
|
|
epdcSentryPostInfoResultDTO.setThirdSentryPostId(epidemicSentryPostDTO.getThirdSentryPostId()); |
|
|
|
|
|
|
|
return new Result().ok(epdcSentryPostInfoResultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
private CompleteDeptDTO getCompleteDeptDTOByGridId(String gridId) { |
|
|
|
Result<CompleteDeptDTO> adminResult = adminFeignClient.getCompleteDept(Long.parseLong(gridId)); |
|
|
|
if (!adminResult.success() || null == adminResult.getData()) { |
|
|
|
throw new RenException("查询网格信息失败"); |
|
|
|
} |
|
|
|
return adminResult.getData(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @param |
|
|
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.DeptOption> |
|
|
|
@ -76,6 +123,7 @@ public class CustomServiceImpl implements CustomService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @param mobile 手机号 |
|
|
|
* @param smsCode 用户输入的验证码 |
|
|
|
@ -92,53 +140,8 @@ public class CustomServiceImpl implements CustomService { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<EpdcSentryPostInfoResultDTO> getDeptInfoByMaCode(String code) { |
|
|
|
String combine = "-"; |
|
|
|
if (StringUtils.isBlank(code) || code.indexOf(combine) == NumConstant.ONE_NEG) { |
|
|
|
return new Result().error("不是规范的哨卡小程序码"); |
|
|
|
} |
|
|
|
|
|
|
|
EpdcSentryPostInfoResultDTO epdcSentryPostInfoResultDTO = new EpdcSentryPostInfoResultDTO(); |
|
|
|
|
|
|
|
String[] grididAndPostId = code.split(combine); |
|
|
|
if (grididAndPostId.length < NumConstant.TWO) { |
|
|
|
return new Result().error("哨卡小程序码信息异常"); |
|
|
|
} |
|
|
|
// 网格id
|
|
|
|
String gridId = grididAndPostId[NumConstant.ZERO]; |
|
|
|
// 哨卡编码
|
|
|
|
String postCode = grididAndPostId[NumConstant.ONE]; |
|
|
|
|
|
|
|
//拿取网格信息
|
|
|
|
CompleteDeptDTO completeDept = getCompleteDeptDTOByGridId(gridId); |
|
|
|
epdcSentryPostInfoResultDTO.setStreetName(completeDept.getStreet()); |
|
|
|
epdcSentryPostInfoResultDTO.setCommunityName(completeDept.getCommunity()); |
|
|
|
epdcSentryPostInfoResultDTO.setGridId(completeDept.getGridId()); |
|
|
|
epdcSentryPostInfoResultDTO.setGridName(completeDept.getGrid()); |
|
|
|
|
|
|
|
//拿取哨卡信息
|
|
|
|
Result<EpidemicSentryPostDTO> epidemicSentryResult = customFeignClient.getEpidemicSentryBySentryPostCode(postCode); |
|
|
|
if (!epidemicSentryResult.success() || null == epidemicSentryResult.getData()) { |
|
|
|
return new Result().error("查询哨卡信息失败"); |
|
|
|
} |
|
|
|
EpidemicSentryPostDTO epidemicSentryPostDTO = epidemicSentryResult.getData(); |
|
|
|
epdcSentryPostInfoResultDTO.setSentryPostName(epidemicSentryPostDTO.getSentryPostName()); |
|
|
|
epdcSentryPostInfoResultDTO.setThirdSentryPostId(epidemicSentryPostDTO.getThirdSentryPostId()); |
|
|
|
|
|
|
|
return new Result().ok(epdcSentryPostInfoResultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
private CompleteDeptDTO getCompleteDeptDTOByGridId(String gridId) { |
|
|
|
Result<CompleteDeptDTO> adminResult = adminFeignClient.getCompleteDept(Long.parseLong(gridId)); |
|
|
|
if (!adminResult.success() || null == adminResult.getData()) { |
|
|
|
throw new RenException("查询网格信息失败"); |
|
|
|
} |
|
|
|
return adminResult.getData(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Result createPidemicInfo(EpdcAppPidemicCompleteInfoFromDTO completeInfoFromDto) { |
|
|
|
public Result createPidemicInfo(EpdcAppPidemicCompleteInfoFromDTO completeInfoFromDto, TokenDto userDetail) { |
|
|
|
completeInfoFromDto.setUserId(userDetail.getUserId()); |
|
|
|
return userFeignClient.createPidemicInfo(completeInfoFromDto); |
|
|
|
} |
|
|
|
} |
|
|
|
|