Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
shop
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
曲欣亮
shop
Commits
ad5e2b8b
Commit
ad5e2b8b
authored
Dec 12, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
9371178b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1840 additions
and
0 deletions
+1840
-0
OrderController.java
src/main/java/com/egolm/shop/controller/OrderController.java
+327
-0
TSalesOrder.java
src/main/java/com/egolm/shop/pojo/model/TSalesOrder.java
+341
-0
TSalesOrderDtl.java
src/main/java/com/egolm/shop/pojo/model/TSalesOrderDtl.java
+193
-0
OrderService.java
src/main/java/com/egolm/shop/service/OrderService.java
+39
-0
OrderServiceImpl.java
...in/java/com/egolm/shop/service/impl/OrderServiceImpl.java
+848
-0
XmlUtil.java
src/main/java/com/egolm/shop/util/XmlUtil.java
+92
-0
No files found.
src/main/java/com/egolm/shop/controller/OrderController.java
0 → 100644
View file @
ad5e2b8b
This diff is collapsed.
Click to expand it.
src/main/java/com/egolm/shop/pojo/model/TSalesOrder.java
0 → 100644
View file @
ad5e2b8b
package
com
.
egolm
.
shop
.
pojo
.
model
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
javax.persistence.Entity
;
@Entity
(
name
=
"tSalesOrder"
)
public
class
TSalesOrder
{
private
String
sSalesOrderID
;
private
String
sOrgNO
;
private
String
sCustNO
;
private
String
sShopNO
;
private
String
sSalesOrderPayTypeID
;
private
String
sSalesOrderPayType
;
private
Date
dOrderDate
;
private
Date
dOrderTime
;
private
BigDecimal
nTotalSaleQty
;
private
BigDecimal
nTotalSaleAmount
;
private
BigDecimal
nTotalDisAmount
;
private
String
sTerminalTypeID
;
private
String
sTerminalType
;
private
Date
dOrderCancelTime
;
private
String
sOrderCancelRemark
;
private
String
sOrderCancelUser
;
private
String
sAddrID
;
private
String
sContacts
;
private
String
sMobile
;
private
String
sTel
;
private
String
sAddress
;
private
String
sPostalcode
;
private
String
sEmail
;
private
String
sOrderMemo
;
private
String
sThirdPartyPaperNO
;
private
String
sThirdPartyID
;
private
String
sThirdPartyName
;
private
Integer
nOrderStatus
;
private
String
sOrderStatusName
;
private
Date
dUpdate
;
private
Integer
nTag
;
private
Date
dLastUpdateTime
;
private
String
sSubOrderID
;
private
String
sSalesmanNO
;
private
BigDecimal
nExpressFee
;
private
String
sDeliveryTypeID
;
private
String
sDeliveryType
;
private
String
sBankType
;
private
String
sBankAccount
;
private
String
sBankAccountName
;
private
String
sRevBankType
;
private
String
sRevBankAccount
;
private
String
sRevBankAccountNO
;
private
String
sFormID
;
private
String
sB2BOrderTypeID
;
private
String
sB2BOrderType
;
private
Integer
nPlanID
;
public
Integer
getnPlanID
()
{
return
nPlanID
;
}
public
void
setnPlanID
(
Integer
nPlanID
)
{
this
.
nPlanID
=
nPlanID
;
}
public
String
getsSalesOrderID
()
{
return
sSalesOrderID
;
}
public
void
setsSalesOrderID
(
String
sSalesOrderID
)
{
this
.
sSalesOrderID
=
sSalesOrderID
;
}
public
String
getsOrgNO
()
{
return
sOrgNO
;
}
public
void
setsOrgNO
(
String
sOrgNO
)
{
this
.
sOrgNO
=
sOrgNO
;
}
public
String
getsCustNO
()
{
return
sCustNO
;
}
public
void
setsCustNO
(
String
sCustNO
)
{
this
.
sCustNO
=
sCustNO
;
}
public
String
getsShopNO
()
{
return
sShopNO
;
}
public
void
setsShopNO
(
String
sShopNO
)
{
this
.
sShopNO
=
sShopNO
;
}
public
String
getsSalesOrderPayTypeID
()
{
return
sSalesOrderPayTypeID
;
}
public
void
setsSalesOrderPayTypeID
(
String
sSalesOrderPayTypeID
)
{
this
.
sSalesOrderPayTypeID
=
sSalesOrderPayTypeID
;
}
public
String
getsSalesOrderPayType
()
{
return
sSalesOrderPayType
;
}
public
void
setsSalesOrderPayType
(
String
sSalesOrderPayType
)
{
this
.
sSalesOrderPayType
=
sSalesOrderPayType
;
}
public
Date
getdOrderDate
()
{
return
dOrderDate
;
}
public
void
setdOrderDate
(
Date
dOrderDate
)
{
this
.
dOrderDate
=
dOrderDate
;
}
public
Date
getdOrderTime
()
{
return
dOrderTime
;
}
public
void
setdOrderTime
(
Date
dOrderTime
)
{
this
.
dOrderTime
=
dOrderTime
;
}
public
BigDecimal
getnTotalSaleQty
()
{
return
nTotalSaleQty
;
}
public
void
setnTotalSaleQty
(
BigDecimal
nTotalSaleQty
)
{
this
.
nTotalSaleQty
=
nTotalSaleQty
;
}
public
BigDecimal
getnTotalSaleAmount
()
{
return
nTotalSaleAmount
;
}
public
void
setnTotalSaleAmount
(
BigDecimal
nTotalSaleAmount
)
{
this
.
nTotalSaleAmount
=
nTotalSaleAmount
;
}
public
BigDecimal
getnTotalDisAmount
()
{
return
nTotalDisAmount
;
}
public
void
setnTotalDisAmount
(
BigDecimal
nTotalDisAmount
)
{
this
.
nTotalDisAmount
=
nTotalDisAmount
;
}
public
String
getsTerminalTypeID
()
{
return
sTerminalTypeID
;
}
public
void
setsTerminalTypeID
(
String
sTerminalTypeID
)
{
this
.
sTerminalTypeID
=
sTerminalTypeID
;
}
public
String
getsTerminalType
()
{
return
sTerminalType
;
}
public
void
setsTerminalType
(
String
sTerminalType
)
{
this
.
sTerminalType
=
sTerminalType
;
}
public
Date
getdOrderCancelTime
()
{
return
dOrderCancelTime
;
}
public
void
setdOrderCancelTime
(
Date
dOrderCancelTime
)
{
this
.
dOrderCancelTime
=
dOrderCancelTime
;
}
public
String
getsOrderCancelRemark
()
{
return
sOrderCancelRemark
;
}
public
void
setsOrderCancelRemark
(
String
sOrderCancelRemark
)
{
this
.
sOrderCancelRemark
=
sOrderCancelRemark
;
}
public
String
getsOrderCancelUser
()
{
return
sOrderCancelUser
;
}
public
void
setsOrderCancelUser
(
String
sOrderCancelUser
)
{
this
.
sOrderCancelUser
=
sOrderCancelUser
;
}
public
String
getsAddrID
()
{
return
sAddrID
;
}
public
void
setsAddrID
(
String
sAddrID
)
{
this
.
sAddrID
=
sAddrID
;
}
public
String
getsContacts
()
{
return
sContacts
;
}
public
void
setsContacts
(
String
sContacts
)
{
this
.
sContacts
=
sContacts
;
}
public
String
getsMobile
()
{
return
sMobile
;
}
public
void
setsMobile
(
String
sMobile
)
{
this
.
sMobile
=
sMobile
;
}
public
String
getsTel
()
{
return
sTel
;
}
public
void
setsTel
(
String
sTel
)
{
this
.
sTel
=
sTel
;
}
public
String
getsAddress
()
{
return
sAddress
;
}
public
void
setsAddress
(
String
sAddress
)
{
this
.
sAddress
=
sAddress
;
}
public
String
getsPostalcode
()
{
return
sPostalcode
;
}
public
void
setsPostalcode
(
String
sPostalcode
)
{
this
.
sPostalcode
=
sPostalcode
;
}
public
String
getsEmail
()
{
return
sEmail
;
}
public
void
setsEmail
(
String
sEmail
)
{
this
.
sEmail
=
sEmail
;
}
public
String
getsOrderMemo
()
{
return
sOrderMemo
;
}
public
void
setsOrderMemo
(
String
sOrderMemo
)
{
this
.
sOrderMemo
=
sOrderMemo
;
}
public
String
getsThirdPartyPaperNO
()
{
return
sThirdPartyPaperNO
;
}
public
void
setsThirdPartyPaperNO
(
String
sThirdPartyPaperNO
)
{
this
.
sThirdPartyPaperNO
=
sThirdPartyPaperNO
;
}
public
String
getsThirdPartyID
()
{
return
sThirdPartyID
;
}
public
void
setsThirdPartyID
(
String
sThirdPartyID
)
{
this
.
sThirdPartyID
=
sThirdPartyID
;
}
public
String
getsThirdPartyName
()
{
return
sThirdPartyName
;
}
public
void
setsThirdPartyName
(
String
sThirdPartyName
)
{
this
.
sThirdPartyName
=
sThirdPartyName
;
}
public
Integer
getnOrderStatus
()
{
return
nOrderStatus
;
}
public
void
setnOrderStatus
(
Integer
nOrderStatus
)
{
this
.
nOrderStatus
=
nOrderStatus
;
}
public
String
getsOrderStatusName
()
{
return
sOrderStatusName
;
}
public
void
setsOrderStatusName
(
String
sOrderStatusName
)
{
this
.
sOrderStatusName
=
sOrderStatusName
;
}
public
Date
getdUpdate
()
{
return
dUpdate
;
}
public
void
setdUpdate
(
Date
dUpdate
)
{
this
.
dUpdate
=
dUpdate
;
}
public
Integer
getnTag
()
{
return
nTag
;
}
public
void
setnTag
(
Integer
nTag
)
{
this
.
nTag
=
nTag
;
}
public
Date
getdLastUpdateTime
()
{
return
dLastUpdateTime
;
}
public
void
setdLastUpdateTime
(
Date
dLastUpdateTime
)
{
this
.
dLastUpdateTime
=
dLastUpdateTime
;
}
public
String
getsSubOrderID
()
{
return
sSubOrderID
;
}
public
void
setsSubOrderID
(
String
sSubOrderID
)
{
this
.
sSubOrderID
=
sSubOrderID
;
}
public
String
getsSalesmanNO
()
{
return
sSalesmanNO
;
}
public
void
setsSalesmanNO
(
String
sSalesmanNO
)
{
this
.
sSalesmanNO
=
sSalesmanNO
;
}
public
BigDecimal
getnExpressFee
()
{
return
nExpressFee
;
}
public
void
setnExpressFee
(
BigDecimal
nExpressFee
)
{
this
.
nExpressFee
=
nExpressFee
;
}
public
String
getsDeliveryTypeID
()
{
return
sDeliveryTypeID
;
}
public
void
setsDeliveryTypeID
(
String
sDeliveryTypeID
)
{
this
.
sDeliveryTypeID
=
sDeliveryTypeID
;
}
public
String
getsDeliveryType
()
{
return
sDeliveryType
;
}
public
void
setsDeliveryType
(
String
sDeliveryType
)
{
this
.
sDeliveryType
=
sDeliveryType
;
}
public
String
getsBankType
()
{
return
sBankType
;
}
public
void
setsBankType
(
String
sBankType
)
{
this
.
sBankType
=
sBankType
;
}
public
String
getsBankAccount
()
{
return
sBankAccount
;
}
public
void
setsBankAccount
(
String
sBankAccount
)
{
this
.
sBankAccount
=
sBankAccount
;
}
public
String
getsFormID
()
{
return
sFormID
;
}
public
void
setsFormID
(
String
sFormID
)
{
this
.
sFormID
=
sFormID
;
}
public
String
getsB2BOrderTypeID
()
{
return
sB2BOrderTypeID
;
}
public
void
setsB2BOrderTypeID
(
String
sB2BOrderTypeID
)
{
this
.
sB2BOrderTypeID
=
sB2BOrderTypeID
;
}
public
String
getsB2BOrderType
()
{
return
sB2BOrderType
;
}
public
void
setsB2BOrderType
(
String
sB2BOrderType
)
{
this
.
sB2BOrderType
=
sB2BOrderType
;
}
public
String
getsBankAccountName
()
{
return
sBankAccountName
;
}
public
void
setsBankAccountName
(
String
sBankAccountName
)
{
this
.
sBankAccountName
=
sBankAccountName
;
}
public
String
getsRevBankType
()
{
return
sRevBankType
;
}
public
void
setsRevBankType
(
String
sRevBankType
)
{
this
.
sRevBankType
=
sRevBankType
;
}
public
String
getsRevBankAccount
()
{
return
sRevBankAccount
;
}
public
void
setsRevBankAccount
(
String
sRevBankAccount
)
{
this
.
sRevBankAccount
=
sRevBankAccount
;
}
public
String
getsRevBankAccountNO
()
{
return
sRevBankAccountNO
;
}
public
void
setsRevBankAccountNO
(
String
sRevBankAccountNO
)
{
this
.
sRevBankAccountNO
=
sRevBankAccountNO
;
}
}
src/main/java/com/egolm/shop/pojo/model/TSalesOrderDtl.java
0 → 100644
View file @
ad5e2b8b
package
com
.
egolm
.
shop
.
pojo
.
model
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
javax.persistence.Entity
;
@Entity
(
name
=
"tSalesOrderDtl"
)
public
class
TSalesOrderDtl
{
private
String
sSalesOrderID
;
private
Integer
nIdx
;
private
String
sAgentContractNO
;
private
Integer
nAgentID
;
private
String
sWarehouseNO
;
private
String
sBarcode
;
private
Integer
nGoodsID
;
private
String
sGoodsDesc
;
private
BigDecimal
nSaleQty
;
private
BigDecimal
nSalePrice
;
private
BigDecimal
nSaleAmount
;
private
BigDecimal
nDisAmount
;
private
String
sMemo
;
private
Date
dUpdate
;
private
Integer
nTag
;
private
Date
dLastUpdateTime
;
private
String
sPromoActionTypeID
;
private
String
sPromoActionType
;
private
String
sPromoPaperNO
;
private
BigDecimal
nExpressFee
;
public
String
getsSalesOrderID
()
{
return
sSalesOrderID
;
}
public
void
setsSalesOrderID
(
String
sSalesOrderID
)
{
this
.
sSalesOrderID
=
sSalesOrderID
;
}
public
Integer
getnIdx
()
{
return
nIdx
;
}
public
void
setnIdx
(
Integer
nIdx
)
{
this
.
nIdx
=
nIdx
;
}
public
String
getsAgentContractNO
()
{
return
sAgentContractNO
;
}
public
void
setsAgentContractNO
(
String
sAgentContractNO
)
{
this
.
sAgentContractNO
=
sAgentContractNO
;
}
public
Integer
getnAgentID
()
{
return
nAgentID
;
}
public
void
setnAgentID
(
Integer
nAgentID
)
{
this
.
nAgentID
=
nAgentID
;
}
public
String
getsWarehouseNO
()
{
return
sWarehouseNO
;
}
public
void
setsWarehouseNO
(
String
sWarehouseNO
)
{
this
.
sWarehouseNO
=
sWarehouseNO
;
}
public
String
getsBarcode
()
{
return
sBarcode
;
}
public
void
setsBarcode
(
String
sBarcode
)
{
this
.
sBarcode
=
sBarcode
;
}
public
Integer
getnGoodsID
()
{
return
nGoodsID
;
}
public
void
setnGoodsID
(
Integer
nGoodsID
)
{
this
.
nGoodsID
=
nGoodsID
;
}
public
String
getsGoodsDesc
()
{
return
sGoodsDesc
;
}
public
void
setsGoodsDesc
(
String
sGoodsDesc
)
{
this
.
sGoodsDesc
=
sGoodsDesc
;
}
public
BigDecimal
getnSaleQty
()
{
return
nSaleQty
;
}
public
void
setnSaleQty
(
BigDecimal
nSaleQty
)
{
this
.
nSaleQty
=
nSaleQty
;
}
public
BigDecimal
getnSalePrice
()
{
return
nSalePrice
;
}
public
void
setnSalePrice
(
BigDecimal
nSalePrice
)
{
this
.
nSalePrice
=
nSalePrice
;
}
public
BigDecimal
getnSaleAmount
()
{
return
nSaleAmount
;
}
public
void
setnSaleAmount
(
BigDecimal
nSaleAmount
)
{
this
.
nSaleAmount
=
nSaleAmount
;
}
public
BigDecimal
getnDisAmount
()
{
return
nDisAmount
;
}
public
void
setnDisAmount
(
BigDecimal
nDisAmount
)
{
this
.
nDisAmount
=
nDisAmount
;
}
public
String
getsMemo
()
{
return
sMemo
;
}
public
void
setsMemo
(
String
sMemo
)
{
this
.
sMemo
=
sMemo
;
}
public
Date
getdUpdate
()
{
return
dUpdate
;
}
public
void
setdUpdate
(
Date
dUpdate
)
{
this
.
dUpdate
=
dUpdate
;
}
public
Integer
getnTag
()
{
return
nTag
;
}
public
void
setnTag
(
Integer
nTag
)
{
this
.
nTag
=
nTag
;
}
public
Date
getdLastUpdateTime
()
{
return
dLastUpdateTime
;
}
public
void
setdLastUpdateTime
(
Date
dLastUpdateTime
)
{
this
.
dLastUpdateTime
=
dLastUpdateTime
;
}
public
String
getsPromoActionTypeID
()
{
return
sPromoActionTypeID
;
}
public
void
setsPromoActionTypeID
(
String
sPromoActionTypeID
)
{
this
.
sPromoActionTypeID
=
sPromoActionTypeID
;
}
public
String
getsPromoActionType
()
{
return
sPromoActionType
;
}
public
void
setsPromoActionType
(
String
sPromoActionType
)
{
this
.
sPromoActionType
=
sPromoActionType
;
}
public
String
getsPromoPaperNO
()
{
return
sPromoPaperNO
;
}
public
void
setsPromoPaperNO
(
String
sPromoPaperNO
)
{
this
.
sPromoPaperNO
=
sPromoPaperNO
;
}
public
BigDecimal
getnExpressFee
()
{
return
nExpressFee
;
}
public
void
setnExpressFee
(
BigDecimal
nExpressFee
)
{
this
.
nExpressFee
=
nExpressFee
;
}
}
src/main/java/com/egolm/shop/service/OrderService.java
0 → 100644
View file @
ad5e2b8b
package
com
.
egolm
.
shop
.
service
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.common.jdbc.Page
;
public
interface
OrderService
{
public
String
orderCheck
(
Map
<
String
,
Object
>
params
);
public
String
submit
(
JSONObject
submitObj
);
public
String
queryOrderList
(
String
orgNo
,
String
shopNo
,
Integer
status
,
String
[]
orderType
,
String
langID
,
Page
page
);
public
String
queryOrderDetailList
(
String
salesOrderId
);
public
String
getOrderDetail
(
String
salesOrderId
);
public
void
paySuccess
(
String
sSalesOrderID
,
BigDecimal
nPayAmount
,
String
sOpenID
,
String
sTransTraceNO
,
String
sOutTradeNO
,
Date
dPayDateTime
);
public
String
getSubOrderDetail
(
String
subOrderID
);
public
void
cancelOrder
(
String
sSalesOrderID
);
public
String
submitByGroup
(
String
orgNo
,
String
shopNo
,
String
prompPaperNO
,
String
promoGroupNO
,
Integer
saleQty
,
String
addrId
,
String
payTypeId
,
String
terminal
,
String
salesmanNo
,
String
formId
,
String
bankType
,
String
bankAccount
,
String
bankAccountName
,
String
revBankType
,
String
revBankAccount
,
String
revBankAccountNo
,
String
memo
);
public
String
submitByZhc
(
String
orgNo
,
String
shopNo
,
Integer
planId
,
Integer
saleQty
,
String
addrId
,
String
payTypeId
,
String
terminal
,
String
salesmanNo
,
String
formId
,
String
bankType
,
String
bankAccount
,
String
bankAccountName
,
String
revBankType
,
String
revBankAccount
,
String
revBankAccountNo
,
String
memo
);
public
String
submitByMdzs
(
String
orgNo
,
String
shopNo
,
String
contractNo
,
Integer
goodsId
,
Integer
saleQty
,
String
addrId
,
String
email
,
String
payTypeId
,
String
terminal
,
String
salesmanNo
,
String
formId
,
String
bankType
,
String
bankAccount
,
String
bankAccountName
,
String
revBankType
,
String
revBankAccount
,
String
revBankAccountNo
,
String
memo
);
public
void
confirmReceipt
(
String
custNo
,
String
subOrderID
);
public
List
<
Map
<
String
,
Object
>>
getDeliverSubDetail
(
String
aocOrderID
);
}
src/main/java/com/egolm/shop/service/impl/OrderServiceImpl.java
0 → 100644
View file @
ad5e2b8b
This diff is collapsed.
Click to expand it.
src/main/java/com/egolm/shop/util/XmlUtil.java
0 → 100644
View file @
ad5e2b8b
package
com
.
egolm
.
shop
.
util
;
import
java.io.ByteArrayInputStream
;
import
java.io.InputStream
;
import
java.io.StringWriter
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.xml.parsers.DocumentBuilder
;
import
javax.xml.parsers.DocumentBuilderFactory
;
import
javax.xml.transform.OutputKeys
;
import
javax.xml.transform.Transformer
;
import
javax.xml.transform.TransformerFactory
;
import
javax.xml.transform.dom.DOMSource
;
import
javax.xml.transform.stream.StreamResult
;
import
org.w3c.dom.CDATASection
;
import
org.w3c.dom.Node
;
import
org.w3c.dom.NodeList
;
import
com.alibaba.fastjson.JSON
;
public
class
XmlUtil
{
public
static
Map
<
String
,
String
>
toMap
(
String
xml
)
{
try
{
Map
<
String
,
String
>
data
=
new
HashMap
<>();
DocumentBuilderFactory
documentBuilderFactory
=
DocumentBuilderFactory
.
newInstance
();
DocumentBuilder
documentBuilder
=
documentBuilderFactory
.
newDocumentBuilder
();
InputStream
stream
=
new
ByteArrayInputStream
(
xml
.
getBytes
(
"UTF-8"
));
org
.
w3c
.
dom
.
Document
doc
=
documentBuilder
.
parse
(
stream
);
doc
.
getDocumentElement
().
normalize
();
NodeList
nodeList
=
doc
.
getDocumentElement
().
getChildNodes
();
for
(
int
idx
=
0
;
idx
<
nodeList
.
getLength
();
++
idx
)
{
Node
node
=
nodeList
.
item
(
idx
);
if
(
node
.
getNodeType
()
==
Node
.
ELEMENT_NODE
)
{
org
.
w3c
.
dom
.
Element
element
=
(
org
.
w3c
.
dom
.
Element
)
node
;
data
.
put
(
element
.
getNodeName
(),
element
.
getTextContent
());
}
}
stream
.
close
();
return
data
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
public
static
String
toXml
(
Map
<
String
,
String
>
data
){
try
{
DocumentBuilderFactory
documentBuilderFactory
=
DocumentBuilderFactory
.
newInstance
();
DocumentBuilder
documentBuilder
=
documentBuilderFactory
.
newDocumentBuilder
();
org
.
w3c
.
dom
.
Document
document
=
documentBuilder
.
newDocument
();
org
.
w3c
.
dom
.
Element
root
=
document
.
createElement
(
"xml"
);
document
.
appendChild
(
root
);
for
(
String
key
:
data
.
keySet
())
{
String
value
=
data
.
get
(
key
);
value
=
value
==
null
?
""
:
value
;
org
.
w3c
.
dom
.
Element
filed
=
document
.
createElement
(
key
);
CDATASection
cdata
=
document
.
createCDATASection
(
value
);
filed
.
appendChild
(
cdata
);
root
.
appendChild
(
filed
);
}
TransformerFactory
tf
=
TransformerFactory
.
newInstance
();
Transformer
transformer
=
tf
.
newTransformer
();
DOMSource
source
=
new
DOMSource
(
document
);
transformer
.
setOutputProperty
(
OutputKeys
.
ENCODING
,
"UTF-8"
);
transformer
.
setOutputProperty
(
OutputKeys
.
INDENT
,
"yes"
);
StringWriter
writer
=
new
StringWriter
();
StreamResult
result
=
new
StreamResult
(
writer
);
transformer
.
transform
(
source
,
result
);
String
output
=
writer
.
getBuffer
().
toString
();
writer
.
close
();
return
output
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
public
static
void
main
(
String
[]
args
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"AA"
,
"G\nGG"
);
String
xml
=
toXml
(
map
);
System
.
out
.
println
(
xml
);
map
=
toMap
(
xml
);
System
.
out
.
println
(
JSON
.
toJSONString
(
map
));
}
}
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