Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sap-service
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
曲欣亮
sap-service
Commits
a806f714
Commit
a806f714
authored
Aug 08, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
921d1dd0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
8 deletions
+120
-8
SI004INVENTORYSyncOutServiceTask.java
...TORY_SyncOutService/SI004INVENTORYSyncOutServiceTask.java
+58
-2
SI011ACTUALSALESSyncOutServiceTask.java
...ES_SyncOutService/SI011ACTUALSALESSyncOutServiceTask.java
+7
-2
ZMISD009SOCREATIONServiceTask.java
..._MI_SD_009_SO_CREATION/ZMISD009SOCREATIONServiceTask.java
+0
-4
CollectionUtil.java
src/main/java/com/egolm/sso/util/CollectionUtil.java
+55
-0
No files found.
src/main/java/com/egolm/sso/distributors/SI_004_INVENTORY_SyncOutService/SI004INVENTORYSyncOutServiceTask.java
View file @
a806f714
package
com
.
egolm
.
sso
.
distributors
.
SI_004_INVENTORY_SyncOutService
;
import
java.io.File
;
import
java.math.BigInteger
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
...
...
@@ -9,9 +13,14 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.boot.system.ApplicationHome
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.sso.distributors.ServiceFactory
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.services.CommonService.Page
;
import
com.egolm.sso.util.CollectionUtil
;
import
com.egolm.sso.util.StringUtil
;
@Component
public
class
SI004INVENTORYSyncOutServiceTask
{
...
...
@@ -33,18 +42,65 @@ public class SI004INVENTORYSyncOutServiceTask {
@Value
(
"${WSDLPATH}"
)
private
String
WSDLPATH
;
@Transactional
//@Scheduled(cron="${cronSi004}")
public
void
execute
()
{
this
.
runTask
();
}
public
void
runTask
()
{
ApplicationHome
home
=
new
ApplicationHome
(
getClass
());
File
jarFile
=
home
.
getSource
();
File
folder
=
jarFile
.
getParentFile
();
String
absolutePath
=
folder
.
getAbsolutePath
();
String
wsdlLocation
=
"file:///"
+
absolutePath
+
"/"
+
WSDLPATH
+
"/SI_0
11_ACTUAL_SALES
_SyncOutService.wsdl"
;
String
wsdlLocation
=
"file:///"
+
absolutePath
+
"/"
+
WSDLPATH
+
"/SI_0
04_INVENTORY
_SyncOutService.wsdl"
;
SI004INVENTORYSyncOut
service
=
ServiceFactory
.
create
(
SI004INVENTORYSyncOut
.
class
,
wsdlLocation
,
"http://distributors.edi.digital.cn.se.com"
,
"SI_004_INVENTORY_SyncOutService"
,
username
,
password
);
this
.
sendData
(
service
);
}
private
void
sendData
(
SI004INVENTORYSyncOut
SI004INVENTORYSyncOut
)
{
Page
page
=
new
Page
(
1L
,
1000L
,
new
String
[]
{
"DIS_CODE"
,
"INVENTORY_DATE"
});
String
sql
=
"SELECT * FROM t_dis_inventory WHERE SEND_STATUS = 'N'"
;
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<
Map
<
String
,
Object
>>();
List
<
Map
<
String
,
Object
>>
tmp
=
null
;
do
{
String
limitSql
=
common
.
limitByMysql
(
sql
,
page
);
tmp
=
jdbcTemplate
.
queryForList
(
limitSql
);
list
.
addAll
(
tmp
);
page
.
toNextPage
();
}
while
(
tmp
!=
null
&&
tmp
.
size
()
>
0
);
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
datas
=
CollectionUtil
.
toGroupList
(
list
,
"DIS_CODE"
,
"INVENTORY_DATE"
);
for
(
List
<
Map
<
String
,
Object
>>
vList
:
datas
.
values
())
{
JSONObject
headerObject
=
new
JSONObject
(
vList
.
get
(
0
));
ZDTSD004INVENTORYSENDING
mt004INVENTORY
=
new
ZDTSD004INVENTORYSENDING
();
ZDTSD004INVENTORYSENDING
.
RECORD
RECORD
=
new
ZDTSD004INVENTORYSENDING
.
RECORD
();
ZDTSD004INVENTORYSENDING
.
RECORD
.
INVENTORYRECORD
INVENTORYRECORD
=
new
ZDTSD004INVENTORYSENDING
.
RECORD
.
INVENTORYRECORD
();
ZDTSD004INVENTORYSENDING
.
RECORD
.
INVENTORYRECORD
.
HEADER
INVENTORYRECORD_HEADER
=
new
ZDTSD004INVENTORYSENDING
.
RECORD
.
INVENTORYRECORD
.
HEADER
();
INVENTORYRECORD_HEADER
.
setKUNNR
(
headerObject
.
getString
(
"DIS_CODE"
));
INVENTORYRECORD_HEADER
.
setNAME1
(
headerObject
.
getString
(
"DIS_NAME"
));
INVENTORYRECORD_HEADER
.
setZDATE
(
headerObject
.
getString
(
"INVENTORY_DATE"
));
INVENTORYRECORD_HEADER
.
setZSPART
(
headerObject
.
getString
(
"MPG"
));
INVENTORYRECORD
.
setHEADER
(
INVENTORYRECORD_HEADER
);
RECORD
.
setINVENTORYRECORD
(
INVENTORYRECORD
);
mt004INVENTORY
.
setRECORD
(
RECORD
);
List
<
ZDTSD004INVENTORYSENDING
.
RECORD
.
INVENTORYRECORD
.
ITEM
>
NVENTORYR_ITEM_LIST
=
INVENTORYRECORD
.
getITEM
();
List
<
BigInteger
>
idList
=
new
ArrayList
<
BigInteger
>();
for
(
Map
<
String
,
Object
>
map
:
vList
)
{
JSONObject
jsonObject
=
new
JSONObject
(
map
);
idList
.
add
(
jsonObject
.
getBigInteger
(
"ID"
));
ZDTSD004INVENTORYSENDING
.
RECORD
.
INVENTORYRECORD
.
ITEM
NVENTORYR_ITEM
=
new
ZDTSD004INVENTORYSENDING
.
RECORD
.
INVENTORYRECORD
.
ITEM
();
NVENTORYR_ITEM
.
setMAKTX
(
jsonObject
.
getString
(
"DIS_SPEC"
));
NVENTORYR_ITEM
.
setMATNR
(
jsonObject
.
getString
(
"DIS_GOODS_CODE"
));
NVENTORYR_ITEM
.
setMENGE
(
jsonObject
.
getString
(
"DIS_QTY"
));
NVENTORYR_ITEM
.
setPOSNR
(
jsonObject
.
getString
(
"INVENTORY_LINE"
));
NVENTORYR_ITEM
.
setZPRIC
(
jsonObject
.
getString
(
"DIS_TAX_PRICE"
));
NVENTORYR_ITEM
.
setZVALU
(
jsonObject
.
getString
(
"DIS_TAX_AMOUNT"
));
NVENTORYR_ITEM_LIST
.
add
(
NVENTORYR_ITEM
);
}
SI004INVENTORYSyncOut
.
si004INVENTORYSyncOut
(
mt004INVENTORY
);
String
updateSql
=
"UPDATE t_dis_inventory SET SEND_STATUS = 'Y', SEND_TIME = NOW() WHERE ID IN ("
+
StringUtil
.
join
(
"?"
,
", "
,
idList
.
size
(),
""
,
""
)
+
")"
;
jdbcTemplate
.
update
(
updateSql
,
idList
.
toArray
());
}
}
}
src/main/java/com/egolm/sso/distributors/SI_011_ACTUAL_SALES_SyncOutService/SI011ACTUALSALESSyncOutServiceTask.java
View file @
a806f714
...
...
@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.boot.system.ApplicationHome
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.sso.distributors.ServiceFactory
;
...
...
@@ -41,6 +42,12 @@ public class SI011ACTUALSALESSyncOutServiceTask {
@Value
(
"${WSDLPATH}"
)
private
String
WSDLPATH
;
@Transactional
//@Scheduled(cron="${cronSi011}")
public
void
execute
()
{
this
.
runTask
();
}
public
void
runTask
()
{
ApplicationHome
home
=
new
ApplicationHome
(
getClass
());
File
jarFile
=
home
.
getSource
();
...
...
@@ -63,8 +70,6 @@ public class SI011ACTUALSALESSyncOutServiceTask {
page
.
toNextPage
();
}
while
(
tmp
!=
null
&&
tmp
.
size
()
>
0
);
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
datas
=
CollectionUtil
.
toGroupList
(
list
,
"DIS_CODE"
,
"SALES_NO"
);
for
(
List
<
Map
<
String
,
Object
>>
vList
:
datas
.
values
())
{
ZDTSD011ACTUALSALESSENDING
mt011ACTUALSALES
=
new
ZDTSD011ACTUALSALESSENDING
();
ZDTSD011ACTUALSALESSENDING
.
RECORD
RECORD
=
new
ZDTSD011ACTUALSALESSENDING
.
RECORD
();
...
...
src/main/java/com/egolm/sso/distributors/Z_MI_SD_009_SO_CREATION/ZMISD009SOCREATIONServiceTask.java
View file @
a806f714
...
...
@@ -48,10 +48,6 @@ public class ZMISD009SOCREATIONServiceTask {
this
.
runTask
();
}
public
static
void
main
(
String
[]
args
)
{
new
ZMISD009SOCREATIONServiceTask
().
execute
();
}
public
void
runTask
()
{
ApplicationHome
home
=
new
ApplicationHome
(
getClass
());
File
jarFile
=
home
.
getSource
();
...
...
src/main/java/com/egolm/sso/util/CollectionUtil.java
0 → 100644
View file @
a806f714
package
com
.
egolm
.
sso
.
util
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
CollectionUtil
{
public
static
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
toGroupList
(
List
<
Map
<
String
,
Object
>>
datas
,
String
...
keyName
)
{
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
mapDatas
=
new
LinkedHashMap
<
String
,
List
<
Map
<
String
,
Object
>>>();
if
(
datas
!=
null
)
{
for
(
Map
<
String
,
Object
>
map
:
datas
)
{
if
(
map
.
size
()
>
0
)
{
List
<
String
>
keys
=
new
ArrayList
<
String
>();
for
(
String
key
:
keyName
)
{
Object
obj
=
map
.
get
(
key
);
if
(
obj
!=
null
)
{
keys
.
add
(
String
.
valueOf
(
obj
));
}
}
String
fullKey
=
StringUtil
.
join
(
","
,
""
,
""
,
""
,
keys
);
List
<
Map
<
String
,
Object
>>
list
=
mapDatas
.
get
(
fullKey
);
if
(
list
==
null
)
{
list
=
new
ArrayList
<
Map
<
String
,
Object
>>();
}
list
.
add
(
map
);
mapDatas
.
put
(
fullKey
,
list
);
}
}
}
return
mapDatas
;
}
public
static
Map
<
String
,
Map
<
String
,
Object
>>
toGroupMap
(
List
<
Map
<
String
,
Object
>>
datas
,
String
...
keyName
)
{
Map
<
String
,
Map
<
String
,
Object
>>
mapDatas
=
new
LinkedHashMap
<
String
,
Map
<
String
,
Object
>>();
if
(
datas
!=
null
)
{
for
(
Map
<
String
,
Object
>
map
:
datas
)
{
if
(
map
.
size
()
>
0
)
{
List
<
String
>
keys
=
new
ArrayList
<
String
>();
for
(
String
key
:
keyName
)
{
Object
obj
=
map
.
get
(
key
);
if
(
obj
!=
null
)
{
keys
.
add
(
String
.
valueOf
(
obj
));
}
}
String
fullKey
=
StringUtil
.
join
(
","
,
""
,
""
,
""
,
keys
);
mapDatas
.
put
(
fullKey
,
map
);
}
}
}
return
mapDatas
;
}
}
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