From 560105d2cafff0ba112c04786c1a80caaeb6b735 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Thu, 9 Nov 2023 16:13:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A7=9C=E9=94=85=E8=AF=B4=E4=BC=A0=E6=9D=A5?= =?UTF-8?q?=E7=9A=84code=E6=98=AF=E5=AF=B9=E7=9A=84=EF=BC=8Cname=E4=B8=8D?= =?UTF-8?q?=E4=BF=9D=E8=AF=81=E5=AF=B9=EF=BC=8C=E6=89=80=E4=BB=A5=E6=88=91?= =?UTF-8?q?=E5=BF=BD=E7=95=A5=E4=BC=A0=E6=9D=A5=E7=9A=84name=EF=BC=8C?= =?UTF-8?q?=E7=94=A8code=E8=87=AA=E5=B7=B1=E6=89=BE=E4=B8=80=E4=B8=AAname?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/service/impl/SysUserServiceImpl.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java index b76599d..3dceb0e 100644 --- a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java @@ -126,6 +126,7 @@ public class SysUserServiceImpl implements SysUserService { String countyCode = sysUserQo.getCountyCode(); String countyName = sysUserQo.getCountyName(); + countyName = adapterCountyNameByCountyCode(countyCode); if (TextUtils.isEmpty(countyCode)) { return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "省市区街道编码不能为空!", locale); } @@ -212,6 +213,34 @@ public class SysUserServiceImpl implements SysUserService { return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "注册成功!", locale); } + private String adapterCountyNameByCountyCode(String countyCode) { + if (9 == countyCode.length()) { + List streetCodeList = streetDao.findByStreetCode(countyCode); + if (streetCodeList == null || streetCodeList.isEmpty()) { + return null; + } + return streetCodeList.get(0).getStreetName(); + } else if ("0000".equals(countyCode.substring(2))) { + List proCodeList = streetDao.findByProCode(countyCode); + if (proCodeList == null || proCodeList.size() == 0) { + return null; + } + return proCodeList.get(0).getProName(); + } else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) { + List cityCodeList = streetDao.findByCityCode(countyCode); + if (cityCodeList == null || cityCodeList.size() == 0) { + return null; + } + return cityCodeList.get(0).getCityName(); + } else { + List countyCodeList = streetDao.findByCountyCode(countyCode); + if (countyCodeList == null || countyCodeList.isEmpty()) { + return null; + } + return countyCodeList.get(0).getCountyName(); + } + } + /** * 适配2023-11-09到2023-11-12之间注册的街道用户 */