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
d8bd91f5
Commit
d8bd91f5
authored
Jul 19, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
0b5f4281
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
107 additions
and
69 deletions
+107
-69
MaterialMasterServiceImpl.java
...o/services/material_master/MaterialMasterServiceImpl.java
+92
-68
XMLUtil.java
src/main/java/com/egolm/sso/util/XMLUtil.java
+12
-1
application-dev.yml
src/main/resources/application-dev.yml
+1
-0
application-pro.yml
src/main/resources/application-pro.yml
+1
-0
application-uat.yml
src/main/resources/application-uat.yml
+1
-0
No files found.
src/main/java/com/egolm/sso/services/material_master/MaterialMasterServiceImpl.java
View file @
d8bd91f5
...
...
@@ -9,36 +9,48 @@ import java.util.Map.Entry;
import
javax.jws.WebService
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.egolm.sso.config.XRException
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.services.material_master.Z_MT_SD_001_MATERIAL_MASTER.HEADER_SENDING
;
import
com.egolm.sso.services.material_master.Z_MT_SD_001_MATERIAL_MASTER.ITEM
;
import
com.egolm.sso.services.material_master.Z_MT_SD_001_MATERIAL_MASTER.RECORD
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.XMLUtil
;
import
com.google.gson.Gson
;
@Component
@WebService
(
serviceName
=
"MaterialMasterService"
,
targetNamespace
=
"http://material_master.sso.egolm.com"
,
endpointInterface
=
"com.egolm.sso.services.material_master.MaterialMasterService"
)
public
class
MaterialMasterServiceImpl
implements
MaterialMasterService
{
private
static
Log
logger
=
LogFactory
.
getLog
(
MaterialMasterService
.
class
);
@Autowired
JdbcTemplate
jdbcTemplate
;
@Autowired
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Transactional
public
void
execute
(
Z_MT_SD_001_MATERIAL_MASTER
Z_MT_SD_001_MATERIAL_MASTER
)
{
System
.
out
.
println
(
new
Gson
().
toJson
(
Z_MT_SD_001_MATERIAL_MASTER
));
Date
now
=
new
Date
();
String
today
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
boolean
isSuccess
=
true
;
System
.
out
.
println
(
new
Gson
().
toJson
(
Z_MT_SD_001_MATERIAL_MASTER
));
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
try
{
RECORD
RECORD
=
Z_MT_SD_001_MATERIAL_MASTER
.
getRECORD
();
HEADER_SENDING
h
=
RECORD
.
getHEADER_SENDING
();
String
DIS_CODE
=
h
.
getKUNNR
();
...
...
@@ -97,8 +109,8 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
goods.put("DIS_UPDATE_STATUS", "N");// 分销商更新结果(Y成功,N失败)
*/
Long
BATCHID
=
common
.
getNextval
(
today
+
"T_VEN_GOODS_BATCH_"
+
today
);
String
BATCH
=
today
+
"-"
+
BATCHID
;
Long
BATCHID
=
common
.
getNextval
(
dateString
+
"T_VEN_GOODS_BATCH_"
+
dateString
);
String
BATCH
=
dateString
+
"-"
+
BATCHID
;
goods
.
put
(
"TRACE_NO"
,
"sapmaterialmaster"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
goods
.
put
(
"BATCH"
,
BATCH
);
goods
.
put
(
"SEND_STATUS"
,
"N"
);
...
...
@@ -109,6 +121,18 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
insertGoods
(
goods
);
}
}
}
catch
(
Exception
e
)
{
isSuccess
=
false
;
throw
new
XRException
(
"数据保存失败"
,
e
);
}
finally
{
String
xmlName
=
Z_MT_SD_001_MATERIAL_MASTER
.
getClass
().
getSimpleName
()
+
".xml"
;
try
{
String
xml
=
XMLUtil
.
toXml
(
Z_MT_SD_001_MATERIAL_MASTER
);
FileUtil
.
writeText
(
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
common
.
getNextval
(
dateString
+
"T_VEN_GOODS_BATCH_"
+
dateString
)
+
".XML"
,
xml
);
}
catch
(
Exception
e
)
{
throw
new
XRException
(
"报文保存失败"
,
e
);
}
}
}
private
void
updateGoods
(
Map
<
String
,
Object
>
goods
)
{
...
...
src/main/java/com/egolm/sso/util/XMLUtil.java
View file @
d8bd91f5
...
...
@@ -2,9 +2,11 @@ package com.egolm.sso.util;
import
java.io.ByteArrayInputStream
;
import
java.io.InputStream
;
import
java.io.StringWriter
;
import
javax.xml.bind.JAXBContext
;
import
javax.xml.bind.JAXBException
;
import
javax.xml.bind.Marshaller
;
import
javax.xml.bind.Unmarshaller
;
import
com.egolm.sso.config.XRException
;
...
...
@@ -36,4 +38,13 @@ public class XMLUtil {
}
}
public
static
String
toXml
(
Object
obj
)
throws
JAXBException
{
StringWriter
sw
=
new
StringWriter
();
JAXBContext
context
=
JAXBContext
.
newInstance
(
obj
.
getClass
());
Marshaller
marshaller
=
context
.
createMarshaller
();
marshaller
.
setProperty
(
Marshaller
.
JAXB_FORMATTED_OUTPUT
,
Boolean
.
TRUE
);
marshaller
.
marshal
(
obj
,
sw
);
return
sw
.
toString
();
}
}
src/main/resources/application-dev.yml
View file @
d8bd91f5
wsUsername
:
test
wsPassword
:
78258c537d6e4d5fb210a57d05619fb6
xmlRoot
:
xmlHistory
SAP
:
NO009
:
CRON
:
0 0 0 * * ?
...
...
src/main/resources/application-pro.yml
View file @
d8bd91f5
wsUsername
:
schneider
wsPassword
:
f14d4a80f823438a875b1924384c944c
xmlRoot
:
xmlHistory
SAP
:
NO009
:
CRON
:
0 0 0 * * ?
...
...
src/main/resources/application-uat.yml
View file @
d8bd91f5
wsUsername
:
test
wsPassword
:
78258c537d6e4d5fb210a57d05619fb6
xmlRoot
:
xmlHistory
SAP
:
NO009
:
CRON
:
0 0 0 * * ?
...
...
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