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
b2db1ecd
Commit
b2db1ecd
authored
Jul 10, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
dbe62962
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
39 deletions
+119
-39
ProFormaInvoiceServiceImpl.java
...om/egolm/sso/service/impl/ProFormaInvoiceServiceImpl.java
+105
-34
SqlUtil.java
src/main/java/com/egolm/sso/util/SqlUtil.java
+7
-5
StringUtil.java
src/main/java/com/egolm/sso/util/StringUtil.java
+7
-0
No files found.
src/main/java/com/egolm/sso/service/impl/ProFormaInvoiceServiceImpl.java
View file @
b2db1ecd
...
...
@@ -2,6 +2,7 @@ package com.egolm.sso.service.impl;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -21,7 +22,12 @@ 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.ITEM_AMOUNT_DATA
;
import
com.egolm.sso.bean.Z_MT_SD_005_PERFORM_INVOICE.ITEM_DATA
;
import
com.egolm.sso.bean.Z_MT_SD_005_PERFORM_INVOICE.ITEM_MATERIAL_DATA
;
import
com.egolm.sso.bean.Z_MT_SD_005_PERFORM_INVOICE.ITEM_REFERENCE_DATA
;
import
com.egolm.sso.bean.Z_MT_SD_005_PERFORM_INVOICE.ITEM_REFERENCE_PO_TYPE
;
import
com.egolm.sso.bean.Z_MT_SD_005_PERFORM_INVOICE.ITEM_VAT_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
;
...
...
@@ -29,8 +35,8 @@ import com.egolm.sso.service.ProFormaInvoiceService;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.SqlUtil
;
import
com.egolm.sso.util.SqlUtil.Sql
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.XMLUtil
;
import
com.google.gson.Gson
;
@Component
@WebService
(
serviceName
=
"ProFormaInvoiceService"
,
targetNamespace
=
"http://pro_forma_invoice.sso.egolm.com"
,
endpointInterface
=
"com.egolm.sso.service.ProFormaInvoiceService"
)
...
...
@@ -46,9 +52,8 @@ public class ProFormaInvoiceServiceImpl implements ProFormaInvoiceService {
@Transactional
public
void
execute
(
String
xml
)
{
Date
now
=
new
Date
();
String
dateString
=
new
SimpleDateFormat
(
"yyyyMMdd"
).
format
(
now
);
Z_MT_SD_005_PERFORM_INVOICE
bean
=
XMLUtil
.
toBeanByJxab
(
xml
,
Z_MT_SD_005_PERFORM_INVOICE
.
class
);
System
.
out
.
println
(
new
Gson
().
toJson
(
bean
));
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
();
...
...
@@ -60,33 +65,47 @@ public class ProFormaInvoiceServiceImpl implements ProFormaInvoiceService {
List
<
SUMMARY_GENERAL
>
summaryList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getSUMMARY_GENERAL
();
List
<
ITEM_DATA
>
itemList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getITEM_DATA
();
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
());
Long
headerId
=
common
.
getNextval
(
"T_PERFORM_INVOICE_HEADER_ID"
);
headMap
.
put
(
"ID"
,
headerId
);
if
(
HEADER_GENERAL_DATA
!=
null
)
{
headMap
.
put
(
"GENERAL_BELNR"
,
HEADER_GENERAL_DATA
.
getBELNR
());
headMap
.
put
(
"GENERAL_ZTERM"
,
HEADER_GENERAL_DATA
.
getZTERM
());
}
if
(
partnerList
!=
null
)
{
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
());
if
(
HEADER_DOCU_DATE
!=
null
)
{
headMap
.
put
(
"DOCU_IDDAT"
,
HEADER_DOCU_DATE
.
getIDDAT
());
headMap
.
put
(
"DOCU_DATUM"
,
HEADER_DOCU_DATE
.
getDATUM
());
}
if
(
HEADER_REFERENCE_DATA
!=
null
)
{
headMap
.
put
(
"EFERENCE_QUALF"
,
HEADER_REFERENCE_DATA
.
getQUALF
());
headMap
.
put
(
"EFERENCE_BELNR"
,
HEADER_REFERENCE_DATA
.
getBELNR
());
headMap
.
put
(
"EFERENCE_DATUM"
,
HEADER_REFERENCE_DATA
.
getDATUM
());
}
if
(
HEADER_BANK_DATA
!=
null
)
{
headMap
.
put
(
"BANK_ACNUM"
,
HEADER_BANK_DATA
.
getACNUM
());
}
if
(
HEADER_ORGANIZATIONAL_DATA
!=
null
)
{
headMap
.
put
(
"ORGANIZATIONAL_QUALF"
,
HEADER_ORGANIZATIONAL_DATA
.
getQUALF
());
headMap
.
put
(
"ORGANIZATIONAL_ORGID"
,
HEADER_ORGANIZATIONAL_DATA
.
getORGID
());
}
if
(
summaryList
!=
null
)
{
for
(
int
i
=
0
;
i
<
summaryList
.
size
();
i
++)
{
SUMMARY_GENERAL
SUMMARY_GENERAL
=
summaryList
.
get
(
i
);
headMap
.
put
(
"SUMMARY_SUMID"
+
(
i
+
1
),
SUMMARY_GENERAL
.
getSUMID
());
headMap
.
put
(
"SUMMARY_SUMME"
+
(
i
+
1
),
SUMMARY_GENERAL
.
getSUMME
());
headMap
.
put
(
"SUMMARY_WAERQ"
+
(
i
+
1
),
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
);
...
...
@@ -97,14 +116,66 @@ public class ProFormaInvoiceServiceImpl implements ProFormaInvoiceService {
headMap
.
put
(
"UPDATEDBY"
,
null
);
for
(
ITEM_DATA
ITEM_DATA
:
itemList
)
{
List
<
Map
<
String
,
Object
>>
itemDatas
=
new
ArrayList
<
Map
<
String
,
Object
>>();
if
(
itemList
!=
null
)
{
for
(
ITEM_DATA
ITEM_DATA
:
itemList
)
{
Map
<
String
,
Object
>
itemDataMap
=
new
HashMap
<
String
,
Object
>();
Long
itemId
=
Long
.
valueOf
(
""
+
System
.
currentTimeMillis
()
+
StringUtil
.
format
(
common
.
getNextval
(
"T_PERFORM_INVOICE_HEADER_ID_"
+
dateString
),
"00000"
));
ITEM_REFERENCE_DATA
ITEM_REFERENCE_DATA
=
ITEM_DATA
.
getITEM_REFERENCE_DATA
();
ITEM_MATERIAL_DATA
ITEM_MATERIAL_DATA
=
ITEM_DATA
.
getITEM_MATERIAL_DATA
();
List
<
ITEM_AMOUNT_DATA
>
itemAmountList
=
ITEM_DATA
.
getITEM_AMOUNT_DATA
();
ITEM_VAT_DATA
ITEM_VAT_DATA
=
ITEM_DATA
.
getITEM_VAT_DATA
();
List
<
ITEM_REFERENCE_PO_TYPE
>
poTypeList
=
ITEM_DATA
.
getITEM_REFERENCE_PO_TYPE
();
itemDataMap
.
put
(
"ID"
,
itemId
);
itemDataMap
.
put
(
"HEADER_ID"
,
headerId
);
if
(
ITEM_DATA
!=
null
)
{
itemDataMap
.
put
(
"POSEX"
,
ITEM_DATA
.
getPOSEX
());
itemDataMap
.
put
(
"MENGE"
,
ITEM_DATA
.
getMENGE
());
itemDataMap
.
put
(
"MENEE"
,
ITEM_DATA
.
getMENEE
());
itemDataMap
.
put
(
"WERKS"
,
ITEM_DATA
.
getWERKS
());
}
if
(
ITEM_REFERENCE_DATA
!=
null
)
{
itemDataMap
.
put
(
"REFERENCE_QUALF"
,
ITEM_REFERENCE_DATA
.
getQUALF
());
itemDataMap
.
put
(
"REFERENCE_BELNR"
,
ITEM_REFERENCE_DATA
.
getBELNR
());
itemDataMap
.
put
(
"REFERENCE_ZEILE"
,
ITEM_REFERENCE_DATA
.
getZEILE
());
itemDataMap
.
put
(
"REFERENCE_QUALF_DN"
,
ITEM_REFERENCE_DATA
.
getQUALF_DN
());
itemDataMap
.
put
(
"REFERENCE_BELNR_DN"
,
ITEM_REFERENCE_DATA
.
getBELNR_DN
());
itemDataMap
.
put
(
"REFERENCE_ZEILE_DN"
,
ITEM_REFERENCE_DATA
.
getZEILE_DN
());
}
if
(
ITEM_MATERIAL_DATA
!=
null
)
{
itemDataMap
.
put
(
"MATERIAL_QUALF"
,
ITEM_MATERIAL_DATA
.
getQUALF
());
itemDataMap
.
put
(
"MATERIAL_IDTNR"
,
ITEM_MATERIAL_DATA
.
getIDTNR
());
itemDataMap
.
put
(
"MATERIAL_DIDTNR"
,
null
);
}
if
(
itemAmountList
!=
null
)
{
for
(
int
i
=
0
;
i
<
itemAmountList
.
size
();
i
++)
{
ITEM_AMOUNT_DATA
ITEM_AMOUNT_DATA
=
itemAmountList
.
get
(
i
);
headMap
.
put
(
"AMOUNT_QUALF"
+
(
i
+
1
),
ITEM_AMOUNT_DATA
.
getQUALF
());
headMap
.
put
(
"AMOUNT_BETRG"
+
(
i
+
1
),
ITEM_AMOUNT_DATA
.
getBETRG
());
}
}
if
(
ITEM_VAT_DATA
!=
null
)
{
itemDataMap
.
put
(
"VAT_MWSKZ"
,
ITEM_VAT_DATA
.
getMWSKZ
());
itemDataMap
.
put
(
"VAT_MWSBT"
,
ITEM_VAT_DATA
.
getMWSBT
());
}
if
(
poTypeList
!=
null
)
{
for
(
int
i
=
0
;
i
<
poTypeList
.
size
();
i
++)
{
ITEM_REFERENCE_PO_TYPE
ITEM_REFERENCE_PO_TYPE
=
poTypeList
.
get
(
i
);
headMap
.
put
(
"REFERENCE_PO_TYPE_TDID"
+
(
i
+
1
),
ITEM_REFERENCE_PO_TYPE
.
getTDID
());
headMap
.
put
(
"REFERENCE_PO_DATA_TDLINE"
+
(
i
+
1
),
ITEM_REFERENCE_PO_TYPE
.
getITEM_REFERENCE_PO_DATA
().
getTDLINE
());
}
}
itemDataMap
.
put
(
"CREATED"
,
now
);
itemDataMap
.
put
(
"CREATEDBY"
,
"system"
);
itemDataMap
.
put
(
"UPDATED"
,
headerId
);
itemDataMap
.
put
(
"UPDATEDBY"
,
headerId
);
itemDatas
.
add
(
itemDataMap
);
}
}
Sql
sql
=
SqlUtil
.
insertSql
(
"t_perform_invoice_header"
,
headMap
);
jdbcTemplate
.
update
(
sql
.
getSql
(),
sql
.
get
Args
());
Sql
headerSql
=
SqlUtil
.
insertSql
(
"t_perform_invoice_header"
,
headMap
);
jdbcTemplate
.
update
(
headerSql
.
getSql
(),
headerSql
.
getArgs
());
Sql
itemDataSql
=
SqlUtil
.
insertSqlBatch
(
"t_perform_invoice_item"
,
itemDatas
);
jdbcTemplate
.
batchUpdate
(
itemDataSql
.
getSql
(),
itemDataSql
.
getBach
Args
());
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
...
...
src/main/java/com/egolm/sso/util/SqlUtil.java
View file @
b2db1ecd
...
...
@@ -55,11 +55,13 @@ public class SqlUtil {
public
static
class
Sql
{
private
String
sql
;
private
Object
[][]
args
;
private
List
<
Object
[]>
args
=
new
ArrayList
<
Object
[]>()
;
public
Sql
(
String
sql
,
Object
[]...
args
)
{
public
Sql
(
String
sql
,
Object
[]...
args
Ary
)
{
this
.
sql
=
sql
;
this
.
args
=
args
;
for
(
Object
[]
ary
:
argsAry
)
{
this
.
args
.
add
(
ary
);
}
}
public
String
getSql
()
{
...
...
@@ -67,10 +69,10 @@ public class SqlUtil {
}
public
Object
[]
getArgs
()
{
return
(
args
!=
null
&&
args
.
length
>
0
)
?
args
[
0
]
:
new
Object
[]{};
return
(
args
!=
null
&&
args
.
size
()
>
0
)
?
args
.
get
(
0
)
:
new
Object
[]{};
}
public
Object
[][]
getBachArgs
()
{
public
List
<
Object
[]>
getBachArgs
()
{
return
args
;
}
...
...
src/main/java/com/egolm/sso/util/StringUtil.java
View file @
b2db1ecd
...
...
@@ -72,4 +72,11 @@ public class StringUtil {
return
String
.
valueOf
(
sb
);
}
}
public
static
String
format
(
Object
no
,
String
format
)
{
String
strno
=
String
.
valueOf
(
no
);
Integer
index
=
format
.
length
()
-
strno
.
length
();
return
format
.
substring
(
0
,
index
)
+
strno
;
}
}
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