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
2d3d5753
Commit
2d3d5753
authored
Jul 22, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
93a4b99d
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
454 additions
and
349 deletions
+454
-349
ConfirmQuotationServiceImpl.java
...rvices/confirm_quotation/ConfirmQuotationServiceImpl.java
+114
-94
DNDeletionServiceImpl.java
...egolm/sso/services/dn_deletion/DNDeletionServiceImpl.java
+39
-17
MaterialMasterServiceImpl.java
...o/services/material_master/MaterialMasterServiceImpl.java
+1
-1
PrformaInvoiceServiceImpl.java
...o/services/prforma_invoice/PrformaInvoiceServiceImpl.java
+131
-109
PriceListServiceImpl.java
...m/egolm/sso/services/price_list/PriceListServiceImpl.java
+64
-43
ShippingNotificationServiceImpl.java
...hipping_notfirmation/ShippingNotificationServiceImpl.java
+105
-85
No files found.
src/main/java/com/egolm/sso/services/confirm_quotation/ConfirmQuotationServiceImpl.java
View file @
2d3d5753
...
...
@@ -10,18 +10,22 @@ import java.util.Map.Entry;
import
javax.jws.WebService
;
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.alibaba.fastjson.JSON
;
import
com.egolm.sso.config.XRException
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.HEADER
;
import
com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.ITEM_DATA
;
import
com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.ITEM_PRICING
;
import
com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.RESPONSE
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.XMLUtil
;
@Component
@WebService
(
serviceName
=
"ConfirmQuotationService"
,
targetNamespace
=
"http://confirm_quotation.sso.egolm.com"
,
endpointInterface
=
"com.egolm.sso.services.confirm_quotation.ConfirmQuotationService"
)
...
...
@@ -33,15 +37,18 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
@Autowired
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Transactional
public
void
execute
(
Z_MT_SD_008_SO_CONFIRM_QUOTATION
Z_MT_SD_008_SO_CONFIRM_QUOTATION
)
{
boolean
isSuccess
=
true
;
Date
now
=
new
Date
();
String
today
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
Long
time
=
now
.
getTime
();
System
.
out
.
println
(
JSON
.
toJSONString
(
Z_MT_SD_008_SO_CONFIRM_QUOTATION
));
try
{
Map
<
String
,
Object
>
header
=
new
HashMap
<>();
RESPONSE
res
=
Z_MT_SD_008_SO_CONFIRM_QUOTATION
.
getRESPONSE
();
HEADER
h
=
res
.
getHEADER
();
...
...
@@ -70,10 +77,10 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
header
.
put
(
"WAERK"
,
h
.
getWAERK
());
header
.
put
(
"DPFLAG"
,
h
.
getDPFLAG
());
header
.
put
(
"SEND_STATUS"
,
"N"
);
header
.
put
(
"BATCH"
,
today
+
common
.
getNextval
(
"T_SO_CONFIRMACTION_HEADER_BATCH_"
)+
today
);
header
.
put
(
"BATCH"
,
dateString
+
common
.
getNextval
(
"T_SO_CONFIRMACTION_HEADER_BATCH_"
)+
dateString
);
header
.
put
(
"CREATED"
,
now
);
header
.
put
(
"CREATEDBY"
,
"system"
);
String
idIndex
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_HEADER_ID_"
+
today
),
"00000"
);
String
idIndex
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_HEADER_ID_"
+
dateString
),
"00000"
);
Long
hID
=
Long
.
valueOf
(
time
+
idIndex
);
header
.
put
(
"ID"
,
hID
);
header
.
put
(
"TRACE_NO"
,
"sapsoconfirmquotation"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
...
...
@@ -108,7 +115,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
itemData
.
put
(
"CITY1_I"
,
id
.
getCITY1_I
());
itemData
.
put
(
"CREATED"
,
now
);
itemData
.
put
(
"CREATEDBY"
,
"system"
);
String
iidIndex
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_ITEM_DATA_ID_"
+
today
),
"00000"
);
String
iidIndex
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_ITEM_DATA_ID_"
+
dateString
),
"00000"
);
Long
iID
=
Long
.
valueOf
(
time
+
iidIndex
);
itemData
.
put
(
"ID"
,
iID
);
itemDatas
.
put
(
id
.
getPOSNR
(),
itemData
);
...
...
@@ -130,10 +137,23 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
itemPricing
.
put
(
"KWERT"
,
StringUtil
.
toDouble
(
ip
.
getKWERT
()));
itemPricing
.
put
(
"CREATED"
,
now
);
itemPricing
.
put
(
"CREATEDBY"
,
"system"
);
String
itemPricingID
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_ITEM_PRICING_ID_"
+
today
),
"00000"
);
String
itemPricingID
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_ITEM_PRICING_ID_"
+
dateString
),
"00000"
);
itemPricing
.
put
(
"ID"
,
Long
.
valueOf
(
time
+
itemPricingID
));
insertTo
(
itemPricing
,
"t_so_confirmation_item_pricing"
);
}
}
catch
(
Exception
e
)
{
isSuccess
=
false
;
throw
new
XRException
(
"数据保存失败"
,
e
);
}
finally
{
String
xmlName
=
Z_MT_SD_008_SO_CONFIRM_QUOTATION
.
getClass
().
getSimpleName
();
try
{
String
xml
=
XMLUtil
.
toXml
(
Z_MT_SD_008_SO_CONFIRM_QUOTATION
);
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
common
.
getNextval
(
xmlName
+
"_"
+
dateString
)
+
".XML"
;
FileUtil
.
writeText
(
xmlFullName
,
xml
);
}
catch
(
Exception
e
)
{
throw
new
XRException
(
"报文保存失败"
,
e
);
}
}
}
private
void
insertTo
(
Map
<
String
,
Object
>
obj
,
String
table
)
{
...
...
src/main/java/com/egolm/sso/services/dn_deletion/DNDeletionServiceImpl.java
View file @
2d3d5753
...
...
@@ -7,14 +7,18 @@ import java.util.Map;
import
javax.jws.WebService
;
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.util.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.SqlUtil
;
import
com.egolm.sso.util.SqlUtil.Sql
;
import
com.egolm.sso.util.XMLUtil
;
@Component
@WebService
(
serviceName
=
"DNDeletionService"
,
targetNamespace
=
"http://dn_deletion.sso.egolm.com"
,
endpointInterface
=
"com.egolm.sso.services.dn_deletion.DNDeletionService"
)
...
...
@@ -27,11 +31,16 @@ public class DNDeletionServiceImpl implements DNDeletionService {
@Autowired
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Transactional
public
void
execute
(
DELETED_DOCUMENTS
DELETED_DOCUMENTS
)
{
boolean
isSuccess
=
true
;
Date
now
=
new
Date
();
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
try
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"MSGID"
,
DELETED_DOCUMENTS
.
getMSGID
());
map
.
put
(
"TARGET_SYSTEM"
,
DELETED_DOCUMENTS
.
getTARGET_SYSTEM
());
...
...
@@ -49,6 +58,19 @@ public class DNDeletionServiceImpl implements DNDeletionService {
map
.
put
(
"UPDATEDBY"
,
"system"
);
Sql
headerSql
=
SqlUtil
.
insertSql
(
"t_so_dn_deletion"
,
map
);
jdbcTemplate
.
update
(
headerSql
.
getSql
(),
headerSql
.
getArgs
());
}
catch
(
Exception
e
)
{
isSuccess
=
false
;
throw
new
XRException
(
"数据保存失败"
,
e
);
}
finally
{
String
xmlName
=
DELETED_DOCUMENTS
.
getClass
().
getSimpleName
();
try
{
String
xml
=
XMLUtil
.
toXml
(
DELETED_DOCUMENTS
);
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
common
.
getNextval
(
xmlName
+
"_"
+
dateString
)
+
".XML"
;
FileUtil
.
writeText
(
xmlFullName
,
xml
);
}
catch
(
Exception
e
)
{
throw
new
XRException
(
"报文保存失败"
,
e
);
}
}
}
}
src/main/java/com/egolm/sso/services/material_master/MaterialMasterServiceImpl.java
View file @
2d3d5753
...
...
@@ -124,7 +124,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
String
xmlName
=
Z_MT_SD_001_MATERIAL_MASTER
.
getClass
().
getSimpleName
();
try
{
String
xml
=
XMLUtil
.
toXml
(
Z_MT_SD_001_MATERIAL_MASTER
);
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
common
.
getNextval
(
dateString
+
"MATERIAL_MASTER_FILE_NAME
"
+
dateString
)
+
".XML"
;
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
common
.
getNextval
(
xmlName
+
"_
"
+
dateString
)
+
".XML"
;
FileUtil
.
writeText
(
xmlFullName
,
xml
);
}
catch
(
Exception
e
)
{
throw
new
XRException
(
"报文保存失败"
,
e
);
...
...
src/main/java/com/egolm/sso/services/prforma_invoice/PrformaInvoiceServiceImpl.java
View file @
2d3d5753
...
...
@@ -9,10 +9,12 @@ import java.util.Map;
import
javax.jws.WebService
;
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.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.HEADER_BANK_DATA
;
import
com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.HEADER_DOCU_DATE
;
...
...
@@ -29,9 +31,11 @@ import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.ITEM_V
import
com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.SUMMARY_GENERAL
;
import
com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.Z_DT_SD_005_PERFORM_INVOICE
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.SqlUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.SqlUtil.Sql
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.XMLUtil
;
@Component
@WebService
(
serviceName
=
"PrformaInvoiceService"
,
targetNamespace
=
"http://prforma_invoice.sso.egolm.com"
,
endpointInterface
=
"com.egolm.sso.services.prforma_invoice.PrformaInvoiceService"
)
...
...
@@ -43,11 +47,16 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
@Autowired
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Transactional
public
void
execute
(
Z_MT_SD_005_PERFORM_INVOICE
Z_MT_SD_005_PERFORM_INVOICE
)
{
boolean
isSuccess
=
true
;
Date
now
=
new
Date
();
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
try
{
Map
<
String
,
Object
>
headMap
=
new
HashMap
<
String
,
Object
>();
Z_DT_SD_005_PERFORM_INVOICE
Z_DT_SD_005_PERFORM_INVOICE
=
Z_MT_SD_005_PERFORM_INVOICE
.
getZ_DT_SD_005_PERFORM_INVOICE
();
HEADER_GENERAL_DATA
HEADER_GENERAL_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_GENERAL_DATA
();
...
...
@@ -165,6 +174,19 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
jdbcTemplate
.
update
(
headerSql
.
getSql
(),
headerSql
.
getArgs
());
Sql
itemDataSql
=
SqlUtil
.
insertSqlBatch
(
"t_perform_invoice_item"
,
itemDatas
);
jdbcTemplate
.
batchUpdate
(
itemDataSql
.
getSql
(),
itemDataSql
.
getBachArgs
());
}
catch
(
Exception
e
)
{
isSuccess
=
false
;
throw
new
XRException
(
"数据保存失败"
,
e
);
}
finally
{
String
xmlName
=
Z_MT_SD_005_PERFORM_INVOICE
.
getClass
().
getSimpleName
();
try
{
String
xml
=
XMLUtil
.
toXml
(
Z_MT_SD_005_PERFORM_INVOICE
);
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
common
.
getNextval
(
xmlName
+
"_"
+
dateString
)
+
".XML"
;
FileUtil
.
writeText
(
xmlFullName
,
xml
);
}
catch
(
Exception
e
)
{
throw
new
XRException
(
"报文保存失败"
,
e
);
}
}
}
}
src/main/java/com/egolm/sso/services/price_list/PriceListServiceImpl.java
View file @
2d3d5753
...
...
@@ -10,16 +10,20 @@ import java.util.Map.Entry;
import
javax.jws.WebService
;
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.price_list.Z_MT_SD_002_PRICE_LIST.HEADER_SENDING
;
import
com.egolm.sso.services.price_list.Z_MT_SD_002_PRICE_LIST.ITEM
;
import
com.egolm.sso.services.price_list.Z_MT_SD_002_PRICE_LIST.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
...
...
@@ -32,13 +36,17 @@ public class PriceListServiceImpl implements PriceListService {
@Autowired
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Transactional
public
void
execute
(
Z_MT_SD_002_PRICE_LIST
Z_MT_SD_002_PRICE_LIST
)
{
boolean
isSuccess
=
true
;
Date
now
=
new
Date
();
String
today
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
System
.
out
.
println
(
new
Gson
().
toJson
(
Z_MT_SD_002_PRICE_LIST
));
try
{
RECORD
r
=
Z_MT_SD_002_PRICE_LIST
.
getRECORD
();
HEADER_SENDING
h
=
r
.
getHEADER_SENDING
();
List
<
ITEM
>
items
=
r
.
getITEM
();
...
...
@@ -73,8 +81,8 @@ public class PriceListServiceImpl implements PriceListService {
priceObj.put("SEND_DATE", new Date(0));// 发送时间
*/
priceObj
.
put
(
"SEND_STATUS"
,
"N"
);
Long
BATCHID
=
common
.
getNextval
(
"T_PRICE_LIST_BATCH_"
+
today
);
String
BATCH
=
today
+
"-"
+
BATCHID
;
Long
BATCHID
=
common
.
getNextval
(
"T_PRICE_LIST_BATCH_"
+
dateString
);
String
BATCH
=
dateString
+
"-"
+
BATCHID
;
priceObj
.
put
(
"TRACE_NO"
,
"sappricelist"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
priceObj
.
put
(
"BATCH"
,
BATCH
);
...
...
@@ -84,6 +92,19 @@ public class PriceListServiceImpl implements PriceListService {
insertPriceObj
(
priceObj
);
}
}
}
catch
(
Exception
e
)
{
isSuccess
=
false
;
throw
new
XRException
(
"数据保存失败"
,
e
);
}
finally
{
String
xmlName
=
Z_MT_SD_002_PRICE_LIST
.
getClass
().
getSimpleName
();
try
{
String
xml
=
XMLUtil
.
toXml
(
Z_MT_SD_002_PRICE_LIST
);
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
common
.
getNextval
(
xmlName
+
"_"
+
dateString
)
+
".XML"
;
FileUtil
.
writeText
(
xmlFullName
,
xml
);
}
catch
(
Exception
e
)
{
throw
new
XRException
(
"报文保存失败"
,
e
);
}
}
}
private
void
updatePriceObj
(
Map
<
String
,
Object
>
priceObj
)
{
...
...
src/main/java/com/egolm/sso/services/shipping_notfirmation/ShippingNotificationServiceImpl.java
View file @
2d3d5753
...
...
@@ -10,11 +10,13 @@ import java.util.Map.Entry;
import
javax.jws.WebService
;
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.alibaba.fastjson.JSON
;
import
com.egolm.sso.config.XRException
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.HEADER_DATE
;
import
com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.HEADER_DELIVERY
;
...
...
@@ -25,7 +27,9 @@ import com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRM
import
com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.ITEM_REFERENCE_SO
;
import
com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.XMLUtil
;
@Component
@WebService
(
serviceName
=
"ShippingNotificationService"
,
targetNamespace
=
"http://shipping_notfirmation.sso.egolm.com"
,
endpointInterface
=
"com.egolm.sso.services.shipping_notfirmation.ShippingNotificationService"
)
...
...
@@ -38,15 +42,18 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
@Autowired
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Transactional
public
void
execute
(
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
)
{
boolean
isSuccess
=
true
;
System
.
out
.
println
(
JSON
.
toJSONString
(
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
));
Date
now
=
new
Date
();
String
today
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
Long
time
=
now
.
getTime
();
try
{
Map
<
String
,
Object
>
header
=
new
HashMap
<>();
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE
=
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
.
getZ_DT_SD_007_SHIPPING_NOTIFICATION_FILE
();
HEADER_DELIVERY
HEADER_DELIVERY
=
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE
.
getHEADER_DELIVERY
();
...
...
@@ -92,19 +99,19 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
header
.
put
(
"QUALF"
,
HEADER_DATE
.
getQUALF
());
header
.
put
(
"NTEND"
,
HEADER_DATE
.
getNTEND
());
}
header
.
put
(
"BATCH"
,
today
+
"-"
+
common
.
getNextval
(
"T_SHIPPING_NOTIFICATION_HEADER_BATCH_"
+
today
));
header
.
put
(
"BATCH"
,
dateString
+
"-"
+
common
.
getNextval
(
"T_SHIPPING_NOTIFICATION_HEADER_BATCH_"
+
dateString
));
header
.
put
(
"SEND_STATUS"
,
"N"
);
header
.
put
(
"TRACE_NO"
,
"sapshippingnotification"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
header
.
put
(
"CREATED"
,
now
);
header
.
put
(
"CREATEDBY"
,
"system"
);
Long
hID
=
Long
.
valueOf
(
time
+
StringUtil
.
format
(
common
.
getNextval
(
"T_SHIPPING_NOTIFICATION_HEADER_ID_"
+
today
),
"00000"
));
Long
hID
=
Long
.
valueOf
(
time
+
StringUtil
.
format
(
common
.
getNextval
(
"T_SHIPPING_NOTIFICATION_HEADER_ID_"
+
dateString
),
"00000"
));
header
.
put
(
"ID"
,
hID
);
insertTo
(
header
,
"t_shipping_notification_header"
);
List
<
ITEM
>
ITEMs
=
HEADER_DELIVERY
.
getITEM
();
for
(
ITEM
ITEM
:
ITEMs
)
{
Map
<
String
,
Object
>
item
=
new
HashMap
<>();
Long
iID
=
Long
.
valueOf
(
time
+
StringUtil
.
format
(
common
.
getNextval
(
"T_SHIPPING_NOTIFICATION_ITEM_ID_"
+
today
),
"00000"
));
Long
iID
=
Long
.
valueOf
(
time
+
StringUtil
.
format
(
common
.
getNextval
(
"T_SHIPPING_NOTIFICATION_ITEM_ID_"
+
dateString
),
"00000"
));
item
.
put
(
"ID"
,
iID
);
item
.
put
(
"HEADER_ID"
,
hID
);
item
.
put
(
"POSNR"
,
ITEM
.
getPOSNR
());
...
...
@@ -134,6 +141,19 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
item
.
put
(
"CREATEDBY"
,
"system"
);
insertTo
(
item
,
"t_shipping_notification_item"
);
}
}
catch
(
Exception
e
)
{
isSuccess
=
false
;
throw
new
XRException
(
"数据保存失败"
,
e
);
}
finally
{
String
xmlName
=
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
.
getClass
().
getSimpleName
();
try
{
String
xml
=
XMLUtil
.
toXml
(
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
);
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
common
.
getNextval
(
xmlName
+
"_"
+
dateString
)
+
".XML"
;
FileUtil
.
writeText
(
xmlFullName
,
xml
);
}
catch
(
Exception
e
)
{
throw
new
XRException
(
"报文保存失败"
,
e
);
}
}
}
private
void
insertTo
(
Map
<
String
,
Object
>
obj
,
String
table
)
{
...
...
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