Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
5917d835
Commit
5917d835
authored
Jul 26, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.ntq要求修改接口
parent
aa3d5210
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
7 deletions
+44
-7
StCommonController.java
...t/module/statistcs/biz/controller/StCommonController.java
+3
-2
DataInitAfterRuning.java
...s/boot/module/statistcs/biz/init/DataInitAfterRuning.java
+6
-1
StCommonServiceImpl.java
...odule/statistcs/biz/service/impl/StCommonServiceImpl.java
+35
-4
No files found.
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/controller/StCommonController.java
View file @
5917d835
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.statistcs.biz.controller;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.statistcs.biz.service.impl.StCommonServiceImpl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -31,8 +32,8 @@ public class StCommonController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/getUserRegincode"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取用户regionCode"
,
notes
=
"获取用户regionCode"
)
public
ResponseModel
<
List
<
String
>>
getUserReginCode
()
{
List
<
String
>
regionList
=
commonService
.
getUserRegionCode
(
getSelectedOrgInfo
());
public
ResponseModel
<
List
<
RegionModel
>>
getUserReginCode
()
{
List
<
RegionModel
>
regionList
=
commonService
.
getUserRegionCode
(
getSelectedOrgInfo
());
return
ResponseHelper
.
buildResponse
(
regionList
);
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/init/DataInitAfterRuning.java
View file @
5917d835
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
biz
.
init
;
import
com.yeejoin.amos.boot.module.statistcs.biz.service.impl.JGDPStatisticsServiceImpl
;
import
com.yeejoin.amos.boot.module.statistcs.biz.service.impl.StCommonServiceImpl
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationRunner
;
...
...
@@ -15,10 +16,13 @@ public class DataInitAfterRuning implements ApplicationRunner {
private
JGDPStatisticsServiceImpl
jgdpStatisticsService
;
private
StCommonServiceImpl
stCommonService
;
private
AmosRequestContext
amosRequestContext
;
public
DataInitAfterRuning
(
JGDPStatisticsServiceImpl
jgdpStatisticsService
,
AmosRequestContext
amosRequestContext
)
{
public
DataInitAfterRuning
(
JGDPStatisticsServiceImpl
jgdpStatisticsService
,
StCommonServiceImpl
stCommonService
,
AmosRequestContext
amosRequestContext
)
{
this
.
jgdpStatisticsService
=
jgdpStatisticsService
;
this
.
stCommonService
=
stCommonService
;
this
.
amosRequestContext
=
amosRequestContext
;
}
...
...
@@ -29,5 +33,6 @@ public class DataInitAfterRuning implements ApplicationRunner {
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
());
RequestContext
.
setToken
(
amosRequestContext
.
getToken
());
jgdpStatisticsService
.
init
();
stCommonService
.
init
();
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/service/impl/StCommonServiceImpl.java
View file @
5917d835
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
org.springframework.stereotype.Service
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.*
;
/**
* @author Administrator
...
...
@@ -12,7 +13,37 @@ import java.util.List;
@Service
public
class
StCommonServiceImpl
{
public
List
<
String
>
getUserRegionCode
(
ReginParams
selectedOrgInfo
)
{
return
Collections
.
singletonList
(
selectedOrgInfo
.
getCompany
().
getCompanyCode
());
private
static
List
<
RegionModel
>
regionModels
=
new
ArrayList
<>();
public
void
init
()
{
initReginCode
();
}
private
void
initReginCode
()
{
Collection
<
RegionModel
>
result
=
Systemctl
.
regionClient
.
queryForTree
(
null
).
getResult
();
result
.
forEach
(
r
->
{
regionModels
.
add
(
r
);
this
.
loopSetChildRegin
(
regionModels
,
r
.
getChildren
());
});
}
private
void
loopSetChildRegin
(
List
<
RegionModel
>
regionModels
,
Collection
<
RegionModel
>
children
)
{
if
(
children
!=
null
&&
children
.
size
()
>
0
)
{
children
.
forEach
(
c
->
{
regionModels
.
add
(
c
);
this
.
loopSetChildRegin
(
regionModels
,
c
.
getChildren
());
});
}
}
public
List
<
RegionModel
>
getUserRegionCode
(
ReginParams
selectedOrgInfo
)
{
String
regionCode
=
selectedOrgInfo
.
getCompany
().
getCompanyCode
();
Optional
<
RegionModel
>
op
=
regionModels
.
stream
().
filter
(
e
->
e
.
getRegionCode
().
toString
().
equals
(
regionCode
)).
findFirst
();
RegionModel
model
=
op
.
orElse
(
new
RegionModel
());
RegionModel
result
=
new
RegionModel
();
result
.
setRegionName
(
model
.
getRegionName
());
result
.
setRegionCode
(
Integer
.
parseInt
(
regionCode
));
return
Collections
.
singletonList
(
result
);
}
}
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