Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dataport-api
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
강현수
dataport-api
Commits
a161150f
Commit
a161150f
authored
Jan 09, 2023
by
강현수
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
16584 : modify
parent
e71f3ea3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
17 deletions
+42
-17
.gitignore
.gitignore
+9
-0
src/main/java/net/herit/ami/features/stat/dto/SmpXmlDTO/SmpRoot.java
...va/net/herit/ami/features/stat/dto/SmpXmlDTO/SmpRoot.java
+5
-0
src/main/java/net/herit/ami/features/stat/dto/response_model/HolidaRootResponse.java
.../features/stat/dto/response_model/HolidaRootResponse.java
+11
-0
src/main/java/net/herit/ami/features/stat/service/DefaultConnectService.java
...erit/ami/features/stat/service/DefaultConnectService.java
+11
-6
src/main/java/net/herit/ami/features/stat/service/ResponseService.java
.../net/herit/ami/features/stat/service/ResponseService.java
+1
-1
src/main/java/net/herit/ami/features/stat/service/smp/SmpService.java
...a/net/herit/ami/features/stat/service/smp/SmpService.java
+5
-10
No files found.
.gitignore
0 → 100644
View file @
a161150f
### Example user template template
### Example user template
# IntelliJ project files
.idea
*.iml
out
gen
src/main/java/net/herit/ami/features/stat/dto/SmpXmlDTO/SmpRoot.java
View file @
a161150f
...
@@ -7,6 +7,7 @@ import javax.xml.bind.annotation.XmlAccessType;
...
@@ -7,6 +7,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
java.util.ArrayList
;
@Data
@Data
@XmlRootElement
(
name
=
"response"
)
@XmlRootElement
(
name
=
"response"
)
...
@@ -17,4 +18,8 @@ public class SmpRoot {
...
@@ -17,4 +18,8 @@ public class SmpRoot {
private
XmlHeader
header
;
private
XmlHeader
header
;
@XmlElement
(
name
=
"body"
)
@XmlElement
(
name
=
"body"
)
private
SmpBody
body
;
private
SmpBody
body
;
public
ArrayList
<
SmpDTO
>
getItem
(){
return
body
.
getItems
().
getItem
();
}
}
}
src/main/java/net/herit/ami/features/stat/dto/response_model/HolidaRootResponse.java
View file @
a161150f
...
@@ -3,8 +3,19 @@ package net.herit.ami.features.stat.dto.response_model;
...
@@ -3,8 +3,19 @@ package net.herit.ami.features.stat.dto.response_model;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.List
;
@Data
@Data
public
class
HolidaRootResponse
{
public
class
HolidaRootResponse
{
@JsonProperty
(
"response"
)
@JsonProperty
(
"response"
)
private
HolidayResponse
response
;
private
HolidayResponse
response
;
public
List
<
HolidayDataItem
>
getHolidayData
(){
return
response
.
getResBody
().
getItems
().
getItem
();
}
public
String
getHolidayTotalCount
(){
return
response
.
getResBody
().
getTotalCount
();
}
}
}
src/main/java/net/herit/ami/features/stat/service/DefaultConnectService.java
View file @
a161150f
...
@@ -36,11 +36,16 @@ public class DefaultConnectService implements ConnectionService{
...
@@ -36,11 +36,16 @@ public class DefaultConnectService implements ConnectionService{
// 이 메소드는 CommonExeption을 던지는데, 이 메소드를 호출하는 부분에서는 예외처리를 안해주는것같아요
// 이 메소드는 CommonExeption을 던지는데, 이 메소드를 호출하는 부분에서는 예외처리를 안해주는것같아요
// 그렇다면 던지기보다는 책임을지고 예외처리를 하는게 어떨까 싶습니다
// 그렇다면 던지기보다는 책임을지고 예외처리를 하는게 어떨까 싶습니다
@Override
@Override
public
void
connect
(
Response
connect
)
throws
CommonException
{
public
void
connect
(
Response
connect
)
{
call
.
debug
(
"\n---- Start to Connection And Convert----"
);
call
.
debug
(
"\n---- Start to Connection And Convert----"
);
isnull
(
connect
);
try
{
apiConnectLog
(
connect
);
validateResponse
(
connect
);
commonProcess
(
connect
);
apiConnectLog
(
connect
);
commonProcess
(
connect
);
}
catch
(
Exception
e
){
}
}
}
public
void
commonProcess
(
Response
connect
)
throws
CommonException
{
public
void
commonProcess
(
Response
connect
)
throws
CommonException
{
try
{
try
{
...
@@ -50,7 +55,7 @@ public class DefaultConnectService implements ConnectionService{
...
@@ -50,7 +55,7 @@ public class DefaultConnectService implements ConnectionService{
if
(
totalCount
>
1
){
if
(
totalCount
>
1
){
HolidaRootResponse
resBody
=
mapper
.
readValue
(
map
.
get
(
"anotherDaybody"
),
HolidaRootResponse
.
class
);
HolidaRootResponse
resBody
=
mapper
.
readValue
(
map
.
get
(
"anotherDaybody"
),
HolidaRootResponse
.
class
);
// 메시지 체인2
// 메시지 체인2
anotherDayProcess
(
resBody
.
get
Response
().
getResBody
().
getItems
().
getItem
(),
resBody
.
getResponse
().
getResBody
().
get
TotalCount
());
anotherDayProcess
(
resBody
.
get
HolidayData
(),
resBody
.
getHoliday
TotalCount
());
}
else
if
(
totalCount
==
1
){
}
else
if
(
totalCount
==
1
){
onlyDayProcess
(
map
.
get
(
"oneDayBody"
));
onlyDayProcess
(
map
.
get
(
"oneDayBody"
));
}
else
{
}
else
{
...
@@ -108,7 +113,7 @@ public class DefaultConnectService implements ConnectionService{
...
@@ -108,7 +113,7 @@ public class DefaultConnectService implements ConnectionService{
}
}
}
}
// is 접두사는 boolean 리턴 메소드에 주로 쓰이는것으로 압니다. validateResponse 정도가 적당할것같습니다.
// is 접두사는 boolean 리턴 메소드에 주로 쓰이는것으로 압니다. validateResponse 정도가 적당할것같습니다.
private
void
isnull
(
Response
connect
)
{
private
void
validateResponse
(
Response
connect
)
{
if
(
JsonUtil
.
isNull
(
connect
)){
if
(
JsonUtil
.
isNull
(
connect
)){
call
.
info
(
"Failed Connect to External Server."
);
call
.
info
(
"Failed Connect to External Server."
);
throw
new
CommonException
(
ExceptionType
.
RESPONSE_CANNOT_BE_NULL
);
throw
new
CommonException
(
ExceptionType
.
RESPONSE_CANNOT_BE_NULL
);
...
...
src/main/java/net/herit/ami/features/stat/service/ResponseService.java
View file @
a161150f
...
@@ -18,7 +18,7 @@ public class ResponseService {
...
@@ -18,7 +18,7 @@ public class ResponseService {
private
final
String
JOB_NAME
=
this
.
getClass
().
getSimpleName
();
private
final
String
JOB_NAME
=
this
.
getClass
().
getSimpleName
();
private
final
DefaultConnectService
defaultconnectService
;
private
final
DefaultConnectService
defaultconnectService
;
// 접근제어자가 없음
// 접근제어자가 없음
String
line
=
null
;
private
String
line
=
null
;
public
String
responseXmlToString
(
Response
response
)
{
public
String
responseXmlToString
(
Response
response
)
{
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
builder
=
new
StringBuilder
();
logStamp
(
response
);
logStamp
(
response
);
...
...
src/main/java/net/herit/ami/features/stat/service/smp/SmpService.java
View file @
a161150f
...
@@ -29,13 +29,11 @@ public class SmpService {
...
@@ -29,13 +29,11 @@ public class SmpService {
// 메소드명의 접두사가 여러개이고(to,Do,Get), Get과 Insert 두가지의 동작을 명시하고있어서 역할을 명확히 알기가 힘듭니다
// 메소드명의 접두사가 여러개이고(to,Do,Get), Get과 Insert 두가지의 동작을 명시하고있어서 역할을 명확히 알기가 힘듭니다
public
int
toDoGetSmpDataAndInsert
(
int
i
,
String
serviceKey
)
{
public
int
toDoGetSmpDataAndInsert
(
int
i
,
String
serviceKey
)
{
;
// ???
;
// ???
ArrayList
<
SmpDTO
>
smpList
=
getR
r
esponseItme
(
i
,
serviceKey
);
ArrayList
<
SmpDTO
>
smpList
=
getResponseItme
(
i
,
serviceKey
);
return
sendSmp
(
smpList
,
i
);
return
sendSmp
(
smpList
,
i
);
}
}
//관심사 분리 실패 ....
private
ArrayList
<
SmpDTO
>
getResponseItme
(
int
area
,
String
serviceKeys
)
{
// 메소드명 오타 있음
private
ArrayList
<
SmpDTO
>
getRresponseItme
(
int
area
,
String
serviceKeys
)
{
try
{
try
{
JAXBContext
jaxbContext
=
JAXBContext
.
newInstance
(
SmpRoot
.
class
);
JAXBContext
jaxbContext
=
JAXBContext
.
newInstance
(
SmpRoot
.
class
);
Unmarshaller
unmarshaller
=
jaxbContext
.
createUnmarshaller
();
Unmarshaller
unmarshaller
=
jaxbContext
.
createUnmarshaller
();
...
@@ -43,9 +41,7 @@ public class SmpService {
...
@@ -43,9 +41,7 @@ public class SmpService {
SmpRoot
smpResponse
=
(
SmpRoot
)
unmarshaller
.
unmarshal
(
new
StringReader
(
SmpRoot
smpResponse
=
(
SmpRoot
)
unmarshaller
.
unmarshal
(
new
StringReader
(
responseService
.
responseXmlToString
(
smpEnterFeignClient
.
requestConsumeDataByAll
(
area
,
serviceKeys
))));
responseService
.
responseXmlToString
(
smpEnterFeignClient
.
requestConsumeDataByAll
(
area
,
serviceKeys
))));
// 메시지 체인에 해당되는 부분인것 같습니다.
return
smpResponse
.
getItem
();
// 해결방법으로 Hide Delegate를 참고하면 좋을것 같습니다.
return
smpResponse
.
getBody
().
getItems
().
getItem
();
}
catch
(
JAXBException
e
)
{
}
catch
(
JAXBException
e
)
{
call
.
error
(
"ResponseService class in method explorerSnd JAXBException : {}"
,
e
.
getMessage
());
call
.
error
(
"ResponseService class in method explorerSnd JAXBException : {}"
,
e
.
getMessage
());
throw
new
CommonException
(
e
.
getMessage
());
throw
new
CommonException
(
e
.
getMessage
());
...
@@ -55,9 +51,8 @@ public class SmpService {
...
@@ -55,9 +51,8 @@ public class SmpService {
private
int
sendSmp
(
ArrayList
<
SmpDTO
>
smpList
,
int
areaCd
)
{
private
int
sendSmp
(
ArrayList
<
SmpDTO
>
smpList
,
int
areaCd
)
{
int
insertCount
=
0
;
int
insertCount
=
0
;
// forEach 문으로 바꾸면 좀더 보기 좋을것같습니다
for
(
SmpDTO
value
:
smpList
){
for
(
int
i
=
0
;
i
<
smpList
.
size
();
++
i
){
insertCount
+=
insertCall
(
buildSmpDto
(
value
));
insertCount
+=
insertCall
(
buildSmpDto
(
smpList
.
get
(
i
)));
}
}
call
.
debug
(
"smpList insert SUCCESS point : {}, areaCd : {}"
,
insertCount
,
areaCd
);
call
.
debug
(
"smpList insert SUCCESS point : {}, areaCd : {}"
,
insertCount
,
areaCd
);
return
insertCount
;
return
insertCount
;
...
...
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