diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java index e230b87f3b..adabeb3a69 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java @@ -141,15 +141,19 @@ public class CodeServiceImpl implements CodeService { if(CodeConstant.RESI.equals(formDTO.getClientType())) { resiName = getNickName(authInfo.getAuthorizerAppid()); AuthorizationInfoDTO workAuthInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), CodeConstant.WORK); - workName = getNickName(workAuthInfo.getAuthorizerAppid()); + if (null != workAuthInfo) { + workName = getNickName(workAuthInfo.getAuthorizerAppid()); + miniInfoDao.updateNickName(formDTO.getCustomerId(), CodeConstant.WORK, workName); + } miniInfoDao.updateNickName(formDTO.getCustomerId(), formDTO.getClientType(), resiName); - miniInfoDao.updateNickName(formDTO.getCustomerId(), CodeConstant.WORK, workName); } else { workName = getNickName(authInfo.getAuthorizerAppid()); AuthorizationInfoDTO resiAuthInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), CodeConstant.RESI); - resiName = getNickName(resiAuthInfo.getAuthorizerAppid()); + if (null != resiAuthInfo) { + resiName = getNickName(resiAuthInfo.getAuthorizerAppid()); + miniInfoDao.updateNickName(formDTO.getCustomerId(), CodeConstant.RESI, resiName); + } miniInfoDao.updateNickName(formDTO.getCustomerId(), formDTO.getClientType(), workName); - miniInfoDao.updateNickName(formDTO.getCustomerId(), CodeConstant.RESI, resiName); } //获取小程序居民端与工作端名称 @@ -828,6 +832,7 @@ public class CodeServiceImpl implements CodeService { } private String getNickName(String appId) { + String nickName = ""; JSONObject jsonObject = new JSONObject(); jsonObject.put(ModuleConstant.COMPONENT_APP_ID,componentAppId); jsonObject.put(ModuleConstant.AUTHORIZER_APP_ID,appId); @@ -835,8 +840,10 @@ public class CodeServiceImpl implements CodeService { String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_GET_AUTHORIZER_INFO + componentAccessToken , JSON.toJSONString(jsonObject)).getData(); Map map = JSON.parseObject(data, Map.class); Map authInfo = (Map) map.get(ModuleConstant.AUTHORIZER_INFO); - ConvertUtils.mapToEntity(authInfo, MiniInfoFormDTO.class).getNick_name(); - return ConvertUtils.mapToEntity(authInfo, MiniInfoFormDTO.class).getNick_name(); + if (StringUtils.isNotEmpty(ConvertUtils.mapToEntity(authInfo, MiniInfoFormDTO.class).getNick_name())) { + nickName = ConvertUtils.mapToEntity(authInfo, MiniInfoFormDTO.class).getNick_name(); + } + return nickName; } }