Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sso
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
曲欣亮
sso
Commits
5b35d508
Commit
5b35d508
authored
Jul 10, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
9834809f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
14 deletions
+76
-14
ProFormaInvoiceServiceImpl.java
...om/egolm/sso/service/impl/ProFormaInvoiceServiceImpl.java
+64
-7
XMLUtil.java
src/main/java/com/egolm/sso/util/XMLUtil.java
+12
-7
No files found.
src/main/java/com/egolm/sso/service/impl/ProFormaInvoiceServiceImpl.java
View file @
5b35d508
package
com
.
egolm
.
sso
.
service
.
impl
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.jws.WebService
;
import
javax.xml.bind.JAXBException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
com.egolm.sso.bean.Z_MT_SD_005_PERFORM_INVOICE
;
import
com.egolm.sso.bean.Z_MT_SD_005_PERFORM_INVOICE.HEADER_BANK_DATA
;
import
com.egolm.sso.bean.Z_MT_SD_005_PERFORM_INVOICE.HEADER_DOCU_DATE
;
import
com.egolm.sso.bean.Z_MT_SD_005_PERFORM_INVOICE.HEADER_GENERAL_DATA
;
import
com.egolm.sso.bean.Z_MT_SD_005_PERFORM_INVOICE.HEADER_ORGANIZATIONAL_DATA
;
import
com.egolm.sso.bean.Z_MT_SD_005_PERFORM_INVOICE.HEADER_PARTNER_DATA
;
import
com.egolm.sso.bean.Z_MT_SD_005_PERFORM_INVOICE.HEADER_REFERENCE_DATA
;
import
com.egolm.sso.bean.Z_MT_SD_005_PERFORM_INVOICE.SUMMARY_GENERAL
;
import
com.egolm.sso.bean.Z_MT_SD_005_PERFORM_INVOICE.Z_DT_SD_005_PERFORM_INVOICE
;
import
com.egolm.sso.service.CommonService
;
import
com.egolm.sso.service.ProFormaInvoiceService
;
import
com.egolm.sso.util.FileUtil
;
...
...
@@ -28,13 +40,58 @@ public class ProFormaInvoiceServiceImpl implements ProFormaInvoiceService {
@Override
public
void
execute
(
String
xml
)
{
try
{
Date
now
=
new
Date
();
Z_MT_SD_005_PERFORM_INVOICE
bean
=
XMLUtil
.
toBeanByJxab
(
xml
,
Z_MT_SD_005_PERFORM_INVOICE
.
class
);
System
.
out
.
println
(
new
Gson
().
toJson
(
bean
));
}
catch
(
JAXBException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
Map
<
String
,
Object
>
headMap
=
new
HashMap
<
String
,
Object
>();
Z_DT_SD_005_PERFORM_INVOICE
Z_DT_SD_005_PERFORM_INVOICE
=
bean
.
getZ_DT_SD_005_PERFORM_INVOICE
();
HEADER_GENERAL_DATA
HEADER_GENERAL_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_GENERAL_DATA
();
List
<
HEADER_PARTNER_DATA
>
partnerList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_PARTNER_DATA
();
HEADER_DOCU_DATE
HEADER_DOCU_DATE
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_DOCU_DATE
();
HEADER_REFERENCE_DATA
HEADER_REFERENCE_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_REFERENCE_DATA
();
HEADER_BANK_DATA
HEADER_BANK_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_BANK_DATA
();
HEADER_ORGANIZATIONAL_DATA
HEADER_ORGANIZATIONAL_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_ORGANIZATIONAL_DATA
();
List
<
SUMMARY_GENERAL
>
summaryList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getSUMMARY_GENERAL
();
headMap
.
put
(
"GENERAL_BELNR"
,
HEADER_GENERAL_DATA
.
getBELNR
());
headMap
.
put
(
"GENERAL_ZTERM"
,
HEADER_GENERAL_DATA
.
getZTERM
());
for
(
HEADER_PARTNER_DATA
HEADER_PARTNER_DATA
:
partnerList
)
{
if
(
"AG"
.
equals
(
HEADER_PARTNER_DATA
.
getPARVW
()))
{
headMap
.
put
(
"PARTNER_PARVW1"
,
HEADER_PARTNER_DATA
.
getPARVW
());
headMap
.
put
(
"PARTNER_PARTN1"
,
HEADER_PARTNER_DATA
.
getPARTN
());
}
else
if
(
"WE"
.
equals
(
HEADER_PARTNER_DATA
.
getPARVW
()))
{
headMap
.
put
(
"PARTNER_PARVW2"
,
HEADER_PARTNER_DATA
.
getPARVW
());
headMap
.
put
(
"PARTNER_PARTN2"
,
HEADER_PARTNER_DATA
.
getPARTN
());
}
}
headMap
.
put
(
"DOCU_IDDAT"
,
HEADER_DOCU_DATE
.
getIDDAT
());
headMap
.
put
(
"DOCU_DATUM"
,
HEADER_DOCU_DATE
.
getDATUM
());
headMap
.
put
(
"EFERENCE_QUALF"
,
HEADER_REFERENCE_DATA
.
getQUALF
());
headMap
.
put
(
"EFERENCE_BELNR"
,
HEADER_REFERENCE_DATA
.
getBELNR
());
headMap
.
put
(
"EFERENCE_DATUM"
,
HEADER_REFERENCE_DATA
.
getDATUM
());
headMap
.
put
(
"BANK_ACNUM"
,
HEADER_BANK_DATA
.
getACNUM
());
headMap
.
put
(
"ORGANIZATIONAL_QUALF"
,
HEADER_ORGANIZATIONAL_DATA
.
getQUALF
());
headMap
.
put
(
"ORGANIZATIONAL_ORGID"
,
HEADER_ORGANIZATIONAL_DATA
.
getORGID
());
for
(
int
i
=
0
;
i
<
summaryList
.
size
();
i
++)
{
SUMMARY_GENERAL
SUMMARY_GENERAL
=
summaryList
.
get
(
i
);
headMap
.
put
(
"SUMMARY_SUMID"
+
i
,
SUMMARY_GENERAL
.
getSUMID
());
headMap
.
put
(
"SUMMARY_SUMME"
+
i
,
SUMMARY_GENERAL
.
getSUMME
());
headMap
.
put
(
"SUMMARY_WAERQ"
+
i
,
SUMMARY_GENERAL
.
getWAERQ
());
}
String
dateString
=
new
SimpleDateFormat
(
"yyyyMMdd"
).
format
(
now
);
headMap
.
put
(
"BATCH"
,
dateString
+
"-"
+
common
.
getNextval
(
"T_PERFORM_INVOICE_HEADER_BATCH_"
+
dateString
));
headMap
.
put
(
"SEND_STATUS"
,
'N'
);
headMap
.
put
(
"SEND_TIME"
,
now
);
headMap
.
put
(
"TRACE_NO"
,
null
);
headMap
.
put
(
"CREATED"
,
null
);
headMap
.
put
(
"CREATEDBY"
,
null
);
headMap
.
put
(
"UPDATED"
,
null
);
headMap
.
put
(
"UPDATEDBY"
,
null
);
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
...
...
src/main/java/com/egolm/sso/util/XMLUtil.java
View file @
5b35d508
...
...
@@ -7,6 +7,7 @@ import javax.xml.bind.JAXBContext;
import
javax.xml.bind.JAXBException
;
import
javax.xml.bind.Unmarshaller
;
import
com.egolm.sso.config.XRException
;
import
com.thoughtworks.xstream.XStream
;
public
class
XMLUtil
{
...
...
@@ -22,13 +23,17 @@ public class XMLUtil {
return
bean
;
}
public
static
<
T
>
T
toBeanByJxab
(
String
XML
,
Class
<
T
>
requireType
)
throws
JAXBException
{
public
static
<
T
>
T
toBeanByJxab
(
String
XML
,
Class
<
T
>
requireType
)
{
try
{
JAXBContext
jc
=
JAXBContext
.
newInstance
(
requireType
);
Unmarshaller
uma
=
jc
.
createUnmarshaller
();
InputStream
inputStream
=
new
ByteArrayInputStream
(
XML
.
getBytes
());
@SuppressWarnings
(
"unchecked"
)
T
bean
=
(
T
)
uma
.
unmarshal
(
inputStream
);
return
bean
;
}
catch
(
JAXBException
e
)
{
throw
new
XRException
(
"XML转换错误"
,
e
);
}
}
...
...
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