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
dd12d377
Commit
dd12d377
authored
Aug 08, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
a806f714
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
61 deletions
+119
-61
SI004INVENTORYSyncOutServiceTask.java
...TORY_SyncOutService/SI004INVENTORYSyncOutServiceTask.java
+56
-27
SI011ACTUALSALESSyncOutServiceTask.java
...ES_SyncOutService/SI011ACTUALSALESSyncOutServiceTask.java
+63
-34
No files found.
src/main/java/com/egolm/sso/distributors/SI_004_INVENTORY_SyncOutService/SI004INVENTORYSyncOutServiceTask.java
View file @
dd12d377
...
...
@@ -3,6 +3,7 @@ package com.egolm.sso.distributors.SI_004_INVENTORY_SyncOutService;
import
java.io.File
;
import
java.math.BigInteger
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -16,11 +17,17 @@ import org.springframework.stereotype.Component;
import
org.springframework.transaction.annotation.Transactional
;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.sso.config.XRException
;
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.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.ThrowableUtil
;
import
com.egolm.sso.util.XMLUtil
;
import
com.google.gson.Gson
;
@Component
public
class
SI004INVENTORYSyncOutServiceTask
{
...
...
@@ -42,6 +49,9 @@ public class SI004INVENTORYSyncOutServiceTask {
@Value
(
"${WSDLPATH}"
)
private
String
WSDLPATH
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Transactional
//@Scheduled(cron="${cronSi004}")
public
void
execute
()
{
...
...
@@ -59,6 +69,8 @@ public class SI004INVENTORYSyncOutServiceTask {
}
private
void
sendData
(
SI004INVENTORYSyncOut
SI004INVENTORYSyncOut
)
{
Date
now
=
new
Date
();
String
timeString
=
DateUtil
.
formatDate
(
now
,
"yyyyMMddHHmmssSSS"
);
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
>>();
...
...
@@ -71,8 +83,10 @@ public class SI004INVENTORYSyncOutServiceTask {
}
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
))
;
boolean
isSuccess
=
true
;
ZDTSD004INVENTORYSENDING
mt004INVENTORY
=
new
ZDTSD004INVENTORYSENDING
();
try
{
JSONObject
headerObject
=
new
JSONObject
(
vList
.
get
(
0
));
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
();
...
...
@@ -100,6 +114,21 @@ public class SI004INVENTORYSyncOutServiceTask {
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
());
}
catch
(
Throwable
e
)
{
isSuccess
=
false
;
throw
new
XRException
(
ThrowableUtil
.
getCaused
(
e
).
getMessage
()
+
" -- "
+
timeString
,
e
);
}
finally
{
String
xmlName
=
"004_INVENTORY"
;
try
{
String
xml
=
XMLUtil
.
toXml
(
mt004INVENTORY
);
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
timeString
+
".XML"
;
FileUtil
.
writeText
(
xmlFullName
,
xml
);
String
json
=
new
Gson
().
toJson
(
mt004INVENTORY
);
FileUtil
.
writeText
(
xmlFullName
+
".JSON"
,
json
);
}
catch
(
Exception
e
)
{
throw
new
XRException
(
ThrowableUtil
.
getCaused
(
e
).
getMessage
(),
e
);
}
}
}
}
...
...
src/main/java/com/egolm/sso/distributors/SI_011_ACTUAL_SALES_SyncOutService/SI011ACTUALSALESSyncOutServiceTask.java
View file @
dd12d377
...
...
@@ -3,6 +3,7 @@ package com.egolm.sso.distributors.SI_011_ACTUAL_SALES_SyncOutService;
import
java.io.File
;
import
java.math.BigInteger
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -16,11 +17,17 @@ import org.springframework.stereotype.Component;
import
org.springframework.transaction.annotation.Transactional
;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.sso.config.XRException
;
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.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.ThrowableUtil
;
import
com.egolm.sso.util.XMLUtil
;
import
com.google.gson.Gson
;
@Component
public
class
SI011ACTUALSALESSyncOutServiceTask
{
...
...
@@ -42,6 +49,9 @@ public class SI011ACTUALSALESSyncOutServiceTask {
@Value
(
"${WSDLPATH}"
)
private
String
WSDLPATH
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Transactional
//@Scheduled(cron="${cronSi011}")
public
void
execute
()
{
...
...
@@ -59,6 +69,8 @@ public class SI011ACTUALSALESSyncOutServiceTask {
}
private
void
sendData
(
SI011ACTUALSALESSyncOut
SI011ACTUALSALESSyncOut
)
{
Date
now
=
new
Date
();
String
timeString
=
DateUtil
.
formatDate
(
now
,
"yyyyMMddHHmmssSSS"
);
Page
page
=
new
Page
(
1L
,
1000L
,
new
String
[]
{
"DIS_CODE"
,
"SALES_NO"
});
String
sql
=
"SELECT * FROM t_dis_sales WHERE SEND_STATUS = 'N'"
;
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<
Map
<
String
,
Object
>>();
...
...
@@ -71,7 +83,9 @@ public class SI011ACTUALSALESSyncOutServiceTask {
}
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
())
{
boolean
isSuccess
=
true
;
ZDTSD011ACTUALSALESSENDING
mt011ACTUALSALES
=
new
ZDTSD011ACTUALSALESSENDING
();
try
{
ZDTSD011ACTUALSALESSENDING
.
RECORD
RECORD
=
new
ZDTSD011ACTUALSALESSENDING
.
RECORD
();
mt011ACTUALSALES
.
setRECORD
(
RECORD
);
ZDTSD011ACTUALSALESSENDING
.
RECORD
.
HEADER
header
=
new
ZDTSD011ACTUALSALESSENDING
.
RECORD
.
HEADER
();
...
...
@@ -107,6 +121,21 @@ public class SI011ACTUALSALESSyncOutServiceTask {
SI011ACTUALSALESSyncOut
.
si011ACTUALSALESSyncOut
(
mt011ACTUALSALES
);
String
updateSql
=
"UPDATE t_dis_sales SET SEND_STATUS = 'Y', SEND_TIME = NOW() WHERE ID IN ("
+
StringUtil
.
join
(
"?"
,
", "
,
idList
.
size
(),
""
,
""
)
+
")"
;
jdbcTemplate
.
update
(
updateSql
,
idList
.
toArray
());
}
catch
(
Throwable
e
)
{
isSuccess
=
false
;
e
.
printStackTrace
();
}
finally
{
String
xmlName
=
"011_ACTUAL_SALES"
;
try
{
String
xml
=
XMLUtil
.
toXml
(
mt011ACTUALSALES
);
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
timeString
+
".XML"
;
FileUtil
.
writeText
(
xmlFullName
,
xml
);
String
json
=
new
Gson
().
toJson
(
mt011ACTUALSALES
);
FileUtil
.
writeText
(
xmlFullName
+
".JSON"
,
json
);
}
catch
(
Exception
e
)
{
throw
new
XRException
(
ThrowableUtil
.
getCaused
(
e
).
getMessage
(),
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