Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
666748b4
Commit
666748b4
authored
Dec 15, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改子区域站点查询
parent
ceb1b43e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
0 deletions
+46
-0
base-manager/src/main/java/com/mortals/xhx/common/utils/AreaMatchCodeUtil.java
.../java/com/mortals/xhx/common/utils/AreaMatchCodeUtil.java
+23
-0
base-manager/src/main/java/com/mortals/xhx/module/base/service/impl/BaseAreaServiceImpl.java
...als/xhx/module/base/service/impl/BaseAreaServiceImpl.java
+2
-0
base-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteServiceImpl.java
...mortals/xhx/module/site/service/impl/SiteServiceImpl.java
+21
-0
No files found.
base-manager/src/main/java/com/mortals/xhx/common/utils/AreaMatchCodeUtil.java
0 → 100644
View file @
666748b4
package
com.mortals.xhx.common.utils
;
import
cn.hutool.core.util.StrUtil
;
import
com.mortals.xhx.common.code.AreaLevelEnum
;
public
class
AreaMatchCodeUtil
{
public
static
String
getMatchCode
(
String
matchCode
,
Integer
areaLevel
)
{
if
(
AreaLevelEnum
.
地市州
.
getValue
()
==
areaLevel
)
{
return
StrUtil
.
padAfter
(
matchCode
,
4
,
"0"
);
}
else
if
(
AreaLevelEnum
.
区县
.
getValue
()
==
areaLevel
)
{
return
StrUtil
.
padAfter
(
matchCode
,
7
,
"0"
);
}
else
if
(
AreaLevelEnum
.
街道
.
getValue
()
==
areaLevel
)
{
return
StrUtil
.
padAfter
(
matchCode
,
10
,
"0"
);
}
else
if
(
AreaLevelEnum
.
社区
.
getValue
()
==
areaLevel
)
{
return
StrUtil
.
padAfter
(
matchCode
,
12
,
"0"
);
}
else
{
return
matchCode
;
}
}
}
base-manager/src/main/java/com/mortals/xhx/module/base/service/impl/BaseAreaServiceImpl.java
View file @
666748b4
...
@@ -3,6 +3,7 @@ package com.mortals.xhx.module.base.service.impl;
...
@@ -3,6 +3,7 @@ package com.mortals.xhx.module.base.service.impl;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.collection.ListUtil
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.xhx.common.utils.AreaMatchCodeUtil
;
import
com.mortals.xhx.common.utils.BeanUtil
;
import
com.mortals.xhx.common.utils.BeanUtil
;
import
com.mortals.xhx.module.area.model.AreaEntity
;
import
com.mortals.xhx.module.area.model.AreaEntity
;
import
com.mortals.xhx.module.area.model.AreaQuery
;
import
com.mortals.xhx.module.area.model.AreaQuery
;
...
@@ -43,6 +44,7 @@ public class BaseAreaServiceImpl extends AbstractCRUDServiceImpl<BaseAreaDao, Ba
...
@@ -43,6 +44,7 @@ public class BaseAreaServiceImpl extends AbstractCRUDServiceImpl<BaseAreaDao, Ba
String
areaCode
=
baseAreaEntity
.
getAreaCode
();
String
areaCode
=
baseAreaEntity
.
getAreaCode
();
String
matchCode
=
areaCode
.
replaceAll
(
"(0)+$"
,
""
);
String
matchCode
=
areaCode
.
replaceAll
(
"(0)+$"
,
""
);
matchCode
=
AreaMatchCodeUtil
.
getMatchCode
(
matchCode
,
baseAreaEntity
.
getAreaLevel
());
BaseAreaQuery
baseAreaQuery
=
new
BaseAreaQuery
();
BaseAreaQuery
baseAreaQuery
=
new
BaseAreaQuery
();
baseAreaQuery
.
setAreaCode
(
matchCode
+
"%"
);
baseAreaQuery
.
setAreaCode
(
matchCode
+
"%"
);
List
<
BaseAreaEntity
>
baseAreaEntityList
=
this
.
find
(
baseAreaQuery
);
List
<
BaseAreaEntity
>
baseAreaEntityList
=
this
.
find
(
baseAreaQuery
);
...
...
base-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteServiceImpl.java
View file @
666748b4
package
com.mortals.xhx.module.site.service.impl
;
package
com.mortals.xhx.module.site.service.impl
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.URLUtil
;
import
cn.hutool.core.util.URLUtil
;
import
cn.hutool.core.util.ZipUtil
;
import
cn.hutool.core.util.ZipUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
...
@@ -26,6 +27,7 @@ import com.mortals.xhx.common.key.Constant;
...
@@ -26,6 +27,7 @@ import com.mortals.xhx.common.key.Constant;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.device.DevicePdu
;
import
com.mortals.xhx.common.pdu.device.DevicePdu
;
import
com.mortals.xhx.common.pdu.user.UserPdu
;
import
com.mortals.xhx.common.pdu.user.UserPdu
;
import
com.mortals.xhx.common.utils.AreaMatchCodeUtil
;
import
com.mortals.xhx.common.utils.MatterHtmlParseUtil
;
import
com.mortals.xhx.common.utils.MatterHtmlParseUtil
;
import
com.mortals.xhx.common.utils.SyncTreeSiteThread
;
import
com.mortals.xhx.common.utils.SyncTreeSiteThread
;
import
com.mortals.xhx.feign.device.IDeviceFeign
;
import
com.mortals.xhx.feign.device.IDeviceFeign
;
...
@@ -432,6 +434,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
...
@@ -432,6 +434,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
throw
new
AppException
(
String
.
format
(
"区域不存在!区域编码:%s"
,
areaCode
));
throw
new
AppException
(
String
.
format
(
"区域不存在!区域编码:%s"
,
areaCode
));
}
}
String
matchCode
=
areaCode
.
replaceAll
(
"(0)+$"
,
""
);
String
matchCode
=
areaCode
.
replaceAll
(
"(0)+$"
,
""
);
matchCode
=
AreaMatchCodeUtil
.
getMatchCode
(
matchCode
,
areaEntity
.
getAreaLevel
());
SiteQuery
siteQuery
=
new
SiteQuery
();
SiteQuery
siteQuery
=
new
SiteQuery
();
siteQuery
.
setAreaCode
(
matchCode
+
"%"
);
siteQuery
.
setAreaCode
(
matchCode
+
"%"
);
List
<
SiteEntity
>
siteEntities
=
this
.
find
(
siteQuery
);
List
<
SiteEntity
>
siteEntities
=
this
.
find
(
siteQuery
);
...
@@ -464,6 +467,8 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
...
@@ -464,6 +467,8 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
}
}
String
matchCode
=
siteCache
.
getAreaCode
().
replaceAll
(
"(0)+$"
,
""
);
String
matchCode
=
siteCache
.
getAreaCode
().
replaceAll
(
"(0)+$"
,
""
);
matchCode
=
AreaMatchCodeUtil
.
getMatchCode
(
matchCode
,
areaEntity
.
getAreaLevel
());
SiteQuery
siteQuery
=
new
SiteQuery
();
SiteQuery
siteQuery
=
new
SiteQuery
();
siteQuery
.
setAreaCode
(
matchCode
+
"%"
);
siteQuery
.
setAreaCode
(
matchCode
+
"%"
);
List
<
SiteEntity
>
siteEntities
=
this
.
find
(
siteQuery
);
List
<
SiteEntity
>
siteEntities
=
this
.
find
(
siteQuery
);
...
@@ -491,6 +496,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
...
@@ -491,6 +496,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
throw
new
AppException
(
String
.
format
(
"区域不存在!区域编码:%s"
,
query
.
getAreaCode
()));
throw
new
AppException
(
String
.
format
(
"区域不存在!区域编码:%s"
,
query
.
getAreaCode
()));
}
}
String
matchCode
=
query
.
getAreaCode
().
replaceAll
(
"(0)+$"
,
""
);
String
matchCode
=
query
.
getAreaCode
().
replaceAll
(
"(0)+$"
,
""
);
matchCode
=
AreaMatchCodeUtil
.
getMatchCode
(
matchCode
,
areaEntity
.
getAreaLevel
());
SiteQuery
siteQuery
=
new
SiteQuery
();
SiteQuery
siteQuery
=
new
SiteQuery
();
siteQuery
.
setAreaCode
(
matchCode
+
"%"
);
siteQuery
.
setAreaCode
(
matchCode
+
"%"
);
List
<
SiteEntity
>
siteEntities
=
this
.
find
(
siteQuery
);
List
<
SiteEntity
>
siteEntities
=
this
.
find
(
siteQuery
);
...
@@ -531,6 +537,9 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
...
@@ -531,6 +537,9 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
siteAreaVo
.
setAreaCode
(
child
.
getAreaCode
());
siteAreaVo
.
setAreaCode
(
child
.
getAreaCode
());
siteAreaVo
.
setAreaName
(
child
.
getName
());
siteAreaVo
.
setAreaName
(
child
.
getName
());
String
matchCode
=
child
.
getAreaCode
().
replaceAll
(
"(0)+$"
,
""
);
String
matchCode
=
child
.
getAreaCode
().
replaceAll
(
"(0)+$"
,
""
);
//不足位数,补零 5115 020 120 01 市 区 街道 社区
matchCode
=
AreaMatchCodeUtil
.
getMatchCode
(
matchCode
,
child
.
getAreaLevel
());
SiteQuery
siteQuery
=
new
SiteQuery
();
SiteQuery
siteQuery
=
new
SiteQuery
();
siteQuery
.
setAreaCode
(
matchCode
+
"%"
);
siteQuery
.
setAreaCode
(
matchCode
+
"%"
);
if
(!
ObjectUtils
.
isEmpty
(
query
.
getSiteName
()))
{
if
(!
ObjectUtils
.
isEmpty
(
query
.
getSiteName
()))
{
...
@@ -860,4 +869,16 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
...
@@ -860,4 +869,16 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
}
}
public
static
void
main
(
String
[]
args
)
{
String
matchCode
=
"511530000000"
.
replaceAll
(
"(0)+$"
,
""
);
System
.
out
.
println
(
matchCode
);
matchCode
=
StrUtil
.
padAfter
(
matchCode
,
7
,
"0"
);
System
.
out
.
println
(
matchCode
);
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment