Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sso
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
曲欣亮
sso
Commits
02af6f48
Commit
02af6f48
authored
Jul 10, 2019
by
曲欣红
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
1e9c7630
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
131 deletions
+126
-131
MaterialMasterServiceImpl.java
...com/egolm/sso/service/impl/MaterialMasterServiceImpl.java
+66
-69
PriceListServiceImpl.java
...java/com/egolm/sso/service/impl/PriceListServiceImpl.java
+51
-59
SoConfirmQuotationServiceImpl.java
...egolm/sso/service/impl/SoConfirmQuotationServiceImpl.java
+9
-3
No files found.
src/main/java/com/egolm/sso/service/impl/MaterialMasterServiceImpl.java
View file @
02af6f48
...
...
@@ -25,39 +25,43 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
@Autowired
JdbcTemplate
jdbcTemplate
;
@Autowired
CommonService
common
;
@Override
public
void
execute
(
String
xml
)
{
Date
now
=
new
Date
();
String
today
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
Long
time
=
now
.
getTime
();
Element
record
=
StringUtil
.
getDataElement
(
xml
,
"RECORD"
);
Element
headerSending
=
record
.
element
(
"HEADER_SENDING"
);
String
DIS_CODE
=
headerSending
.
elementText
(
"KUNNR"
);
String
DATUM
=
headerSending
.
elementText
(
"DATUM"
);
String
UZEIT
=
headerSending
.
elementText
(
"UZEIT"
);
List
<
Element
>
itemList
=
record
.
elements
(
"ITEM"
);
try
{
for
(
Element
element
:
itemList
)
{
String
GOODS_CODE
=
element
.
elementText
(
"MATNR"
);
Map
<
String
,
Object
>
goods
=
getGoods
(
DIS_CODE
,
GOODS_CODE
);
if
(
goods
==
null
)
{
if
(
goods
==
null
)
{
goods
=
new
HashMap
<>();
}
/***************
header
**************/
/***************
header
**************/
goods
.
put
(
"DIS_CODE"
,
DIS_CODE
);
goods
.
put
(
"DATUM"
,
DateUtil
.
parseDate
(
DATUM
,
DateUtil
.
FMT_DATE
));
goods
.
put
(
"UZEIT"
,
DateUtil
.
parseDate
(
UZEIT
,
DateUtil
.
FMT_TIME
)
/*
timef.parse(UZEIT)
*/
);
/***************
header
**************/
/***************
item
**************/
goods
.
put
(
"UZEIT"
,
DateUtil
.
parseDate
(
UZEIT
,
DateUtil
.
FMT_TIME
)
/*
timef.parse(UZEIT)
*/
);
/***************
header
**************/
/***************
item
**************/
goods
.
put
(
"GOODS_CODE"
,
GOODS_CODE
);
goods
.
put
(
"ROUGH_WEIGHT"
,
Double
.
valueOf
(
element
.
elementText
(
"BRGEW"
)));
goods
.
put
(
"NET_WEIGHT"
,
Double
.
valueOf
(
element
.
elementText
(
"NTGEW"
)));
...
...
@@ -69,13 +73,13 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
goods
.
put
(
"VMSTA"
,
element
.
elementText
(
"VMSTA"
));
goods
.
put
(
"STKTYP"
,
element
.
elementText
(
"STKTYP"
));
goods
.
put
(
"SPEC"
,
element
.
elementText
(
"UMREZ"
));
/*******************
新增字段,样例中没有
******************/
/*******************
新增字段,样例中没有
******************/
goods
.
put
(
"GOODS_NAME_EN"
,
element
.
elementText
(
"NORMT_EN"
));
goods
.
put
(
"AUMNG"
,
element
.
elementText
(
"AUMNG"
));
goods
.
put
(
"VRKME"
,
element
.
elementText
(
"VRKME"
));
goods
.
put
(
"BASE_UNIT"
,
element
.
elementText
(
"MEINS"
));
goods
.
put
(
"STATISTICS_UNIT"
,
element
.
elementText
(
"SCHME"
));
//(统计单位--》发货单位)
goods
.
put
(
"STATISTICS_UNIT"
,
element
.
elementText
(
"SCHME"
));
//
(统计单位--》发货单位)
goods
.
put
(
"LAENG"
,
element
.
elementText
(
"LAENG"
));
goods
.
put
(
"BREIT"
,
element
.
elementText
(
"BREIT"
));
goods
.
put
(
"HOEHE"
,
element
.
elementText
(
"HOEHE"
));
...
...
@@ -86,101 +90,94 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
goods
.
put
(
"MEABM_B"
,
element
.
elementText
(
"MEABM_B"
));
goods
.
put
(
"PUBLIC"
,
element
.
elementText
(
"PUBLIC"
));
goods
.
put
(
"INTERNET"
,
element
.
elementText
(
"INTERNET"
));
/*******************
新增字段,样例中没有
******************/
/*********************
缺
*********************/
goods
.
put
(
"CATEGORY_NAME"
,
""
);
//品类名称
goods
.
put
(
"PRODUCTION_LINE_CODE"
,
""
);
//产线(产地)编码
goods
.
put
(
"PRODUCTION_LINE_NAME"
,
""
);
//产线(产地)名称
goods
.
put
(
"MSTAV"
,
""
);
//停产标志2
goods
.
put
(
"BARCODE"
,
""
);
//物料条码
goods
.
put
(
"TAX_RATE"
,
0
);
//税率
goods
.
put
(
"GOODS_KEY"
,
""
);
//物料唯一码
goods
.
put
(
"SEND_TIME"
,
n
ew
Date
());
//
发送时间
goods
.
put
(
"DIS_UPDATE_STATUS"
,
"N"
);
//分销商更新结果(Y成功,N失败)
/*********************
缺
*********************/
/***************
item
**************/
/*******************
新增字段,样例中没有
******************/
/*********************
缺
*********************/
goods
.
put
(
"CATEGORY_NAME"
,
""
);
//
品类名称
goods
.
put
(
"PRODUCTION_LINE_CODE"
,
""
);
//
产线(产地)编码
goods
.
put
(
"PRODUCTION_LINE_NAME"
,
""
);
//
产线(产地)名称
goods
.
put
(
"MSTAV"
,
""
);
//
停产标志2
goods
.
put
(
"BARCODE"
,
""
);
//
物料条码
goods
.
put
(
"TAX_RATE"
,
0
);
//
税率
goods
.
put
(
"GOODS_KEY"
,
""
);
//
物料唯一码
goods
.
put
(
"SEND_TIME"
,
n
ow
);
//
发送时间
goods
.
put
(
"DIS_UPDATE_STATUS"
,
"N"
);
//
分销商更新结果(Y成功,N失败)
/*********************
缺
*********************/
/***************
item
**************/
/**
* 数据库没有数据追踪号对应字段TRACE_NO
*/
String
BATCH
=
(
String
)
goods
.
get
(
"BATCH"
);
if
(
BATCH
==
null
||
""
.
equals
(
BATCH
.
trim
()))
{
BATCH
=
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)+
"-1"
/*datef.format(new Date())+"-1"*/
;
}
else
{
String
[]
ss
=
BATCH
.
split
(
"-"
);
String
newDate
=
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
);
int
v
=
1
;
if
(
ss
[
0
].
equals
(
newDate
))
{
v
=
Integer
.
valueOf
(
ss
[
1
])+
1
;
}
BATCH
=
newDate
+
"-"
+
v
;
}
goods
.
put
(
"TRACE_NO"
,
"sapmaterialmaster"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATETIME
));
Long
BATCHID
=
common
.
getNextval
(
today
+
"_t_ven_goods_BATCH_"
+
DIS_CODE
+
""
+
GOODS_CODE
);
String
BATCH
=
today
+
"-"
+
BATCHID
;
goods
.
put
(
"TRACE_NO"
,
"sapmaterialmaster"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
goods
.
put
(
"BATCH"
,
BATCH
);
goods
.
put
(
"SEND_STATUS"
,
"N"
);
goods
.
put
(
"UPDATED"
,
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE_TIME
)
/*datetimef.format(new Date())*/
);
if
(
goods
.
get
(
"ID"
)!=
null
)
{
goods
.
put
(
"UPDATED"
,
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE_TIME
)
/* datetimef.format(new Date()) */
);
if
(
goods
.
get
(
"ID"
)
!=
null
)
{
updateGoods
(
goods
);
}
else
{
}
else
{
insertGoods
(
goods
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
private
void
updateGoods
(
Map
<
String
,
Object
>
goods
)
{
goods
.
put
(
"UPDATEDBY"
,
"system"
);
String
sql
=
"update t_ven_goods set "
;
List
<
Object
>
args
=
new
ArrayList
<>();
for
(
Entry
<
String
,
Object
>
entry
:
goods
.
entrySet
())
{
String
key
=
entry
.
getKey
();
Object
value
=
entry
.
getValue
();
if
(!
key
.
equals
(
"ID"
))
{
if
(!
key
.
equals
(
"ID"
))
{
sql
=
sql
+
key
+
" = ?, "
;
args
.
add
(
value
);
}
}
sql
=
sql
.
substring
(
0
,
sql
.
length
()
-
2
);
sql
=
sql
.
substring
(
0
,
sql
.
length
()
-
2
);
sql
=
sql
+
" where ID = ?"
;
args
.
add
(
goods
.
get
(
"ID"
));
jdbcTemplate
.
update
(
sql
,
args
.
toArray
());
}
private
void
insertGoods
(
Map
<
String
,
Object
>
goods
)
{
String
countSql
=
"select count(1) from t_ven_goods"
;
Integer
count
=
jdbcTemplate
.
queryForObject
(
countSql
,
Integer
.
class
);
String
ID
=
System
.
currentTimeMillis
()
+
StringUtil
.
prependZero
(
count
+
1
,
5
);
Date
now
=
new
Date
();
String
today
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
Long
time
=
now
.
getTime
();
Long
idIndex
=
common
.
getNextval
(
today
+
"_t_ven_goods"
);
String
ID
=
time
+
""
+
idIndex
;
goods
.
put
(
"ID"
,
ID
);
goods
.
put
(
"CREATED"
,
DateUtil
.
formatDate
(
n
ew
Date
(),
DateUtil
.
FMT_DATE_TIME
)
/*datetimef.format(new Date())
*/
);
goods
.
put
(
"CREATED"
,
DateUtil
.
formatDate
(
n
ow
,
DateUtil
.
FMT_DATE_TIME
)
/* datetimef.format(new Date())
*/
);
goods
.
put
(
"CREATEDBY"
,
"system"
);
goods
.
put
(
"UPDATEDBY"
,
""
);
String
insertSql
=
"insert into t_ven_goods "
;
String
fieldSql
=
"("
;
String
valuesSql
=
"("
;
List
<
Object
>
values
=
new
ArrayList
<>();
for
(
Entry
<
String
,
Object
>
entry
:
goods
.
entrySet
())
{
for
(
Entry
<
String
,
Object
>
entry
:
goods
.
entrySet
())
{
fieldSql
=
fieldSql
+
entry
.
getKey
()
+
", "
;
valuesSql
=
valuesSql
+
"?, "
;
values
.
add
(
entry
.
getValue
());
}
fieldSql
=
fieldSql
.
substring
(
0
,
fieldSql
.
length
()
-
2
);
valuesSql
=
valuesSql
.
substring
(
0
,
valuesSql
.
length
()
-
2
);
fieldSql
=
fieldSql
.
substring
(
0
,
fieldSql
.
length
()
-
2
);
valuesSql
=
valuesSql
.
substring
(
0
,
valuesSql
.
length
()
-
2
);
insertSql
=
insertSql
+
fieldSql
+
") values "
+
valuesSql
+
")"
;
jdbcTemplate
.
update
(
insertSql
,
values
.
toArray
());
}
private
Map
<
String
,
Object
>
getGoods
(
String
DIS_CODE
,
String
GOODS_CODE
){
private
Map
<
String
,
Object
>
getGoods
(
String
DIS_CODE
,
String
GOODS_CODE
)
{
String
sql
=
"select * from t_ven_goods where DIS_CODE = ? and GOODS_CODE = ?"
;
List
<
Map
<
String
,
Object
>>
list
=
jdbcTemplate
.
queryForList
(
sql
,
DIS_CODE
,
GOODS_CODE
);
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
return
list
.
get
(
0
);
}
return
null
;
...
...
src/main/java/com/egolm/sso/service/impl/PriceListServiceImpl.java
View file @
02af6f48
...
...
@@ -25,36 +25,41 @@ public class PriceListServiceImpl implements PriceListService {
@Autowired
JdbcTemplate
jdbcTemplate
;
@Autowired
CommonService
common
;
@Override
public
void
execute
(
String
xml
)
{
Date
now
=
new
Date
();
String
today
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
Long
time
=
now
.
getTime
();
Element
record
=
StringUtil
.
getDataElement
(
xml
,
"RECORD"
);
Element
headerSending
=
record
.
element
(
"HEADER_SENDING"
);
String
KUNNR
=
headerSending
.
elementText
(
"KUNNR"
);
String
DATUM
=
headerSending
.
elementText
(
"DATUM"
);
String
UZEIT
=
headerSending
.
elementText
(
"UZEIT"
);
List
<
Element
>
itemList
=
record
.
elements
(
"ITEM"
);
try
{
for
(
Element
element
:
itemList
)
{
String
MATNR
=
element
.
elementText
(
"MATNR"
);
Map
<
String
,
Object
>
priceObj
=
getPriceObj
(
KUNNR
,
MATNR
);
if
(
priceObj
==
null
)
{
if
(
priceObj
==
null
)
{
priceObj
=
new
HashMap
<>();
}
/**********
header
***********/
/**********
header
***********/
priceObj
.
put
(
"KUNNR"
,
KUNNR
);
priceObj
.
put
(
"DATUM"
,
DATUM
);
priceObj
.
put
(
"UZEIT"
,
UZEIT
);
/**********
header
***********/
/**********
item
***********/
/**********
header
***********/
/**********
item
***********/
priceObj
.
put
(
"MATNR"
,
MATNR
);
priceObj
.
put
(
"KBETR"
,
StringUtil
.
toDouble
(
element
.
elementText
(
"KBETR"
)));
priceObj
.
put
(
"KONWA"
,
element
.
elementText
(
"KONWA"
));
...
...
@@ -64,97 +69,84 @@ public class PriceListServiceImpl implements PriceListService {
priceObj
.
put
(
"MAKTX"
,
element
.
elementText
(
"MAKTX"
));
priceObj
.
put
(
"PRSCH"
,
StringUtil
.
toDouble
(
element
.
elementText
(
"PRSCH"
)));
priceObj
.
put
(
"DATAM"
,
element
.
elementText
(
"DATAM"
));
Date
DATBI
;
String
DATBIStr
=
element
.
elementText
(
"DATBI"
);
if
(
DATBIStr
==
null
||
DATBIStr
.
equals
(
""
))
{
DATBI
=
new
Date
();
}
else
{
DATBI
=
DateUtil
.
parseDate
(
DATBIStr
,
DateUtil
.
FMT_DATE
);
}
priceObj
.
put
(
"DATBI"
,
DATBI
);
priceObj
.
put
(
"DATBI"
,
DateUtil
.
parseDateNoEmpty
(
element
.
elementText
(
"DATBI"
),
DateUtil
.
FMT_DATE
));
priceObj
.
put
(
"PLINE"
,
element
.
elementText
(
"PLINE"
));
priceObj
.
put
(
"PRSCH_1"
,
StringUtil
.
toDouble
(
element
.
elementText
(
"PRSCH_1"
)));
/**********
item
***********/
/***********
缺
**************/
priceObj
.
put
(
"SEND_DATE"
,
new
Date
(
));
//
发送时间
/***********
缺
**************/
/**********
item
***********/
/***********
缺
**************/
priceObj
.
put
(
"SEND_DATE"
,
new
Date
(
0
));
//
发送时间
/***********
缺
**************/
priceObj
.
put
(
"SEND_STATUS"
,
"N"
);
String
BATCH
=
(
String
)
priceObj
.
get
(
"BATCH"
);
if
(
BATCH
==
null
||
""
.
equals
(
BATCH
.
trim
()))
{
BATCH
=
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)+
"-1"
/*datef.format(new Date())+"-1"*/
;
}
else
{
String
[]
ss
=
BATCH
.
split
(
"-"
);
String
newDate
=
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
);
int
v
=
1
;
if
(
ss
[
0
].
equals
(
newDate
))
{
v
=
Integer
.
valueOf
(
ss
[
1
])+
1
;
}
BATCH
=
newDate
+
"-"
+
v
;
}
priceObj
.
put
(
"TRACE_NO"
,
"sappricelist"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATETIME
));
Long
BATCHID
=
common
.
getNextval
(
today
+
"_t_price_list_BATCH_"
+
KUNNR
+
""
+
MATNR
);
String
BATCH
=
today
+
"-"
+
BATCHID
;
priceObj
.
put
(
"TRACE_NO"
,
"sappricelist"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
priceObj
.
put
(
"BATCH"
,
BATCH
);
priceObj
.
put
(
"UPDATED"
,
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE_TIME
)
);
if
(
priceObj
.
get
(
"ID"
)!=
null
)
{
priceObj
.
put
(
"UPDATED"
,
now
);
if
(
priceObj
.
get
(
"ID"
)
!=
null
)
{
updatePriceObj
(
priceObj
);
}
else
{
}
else
{
insertPriceObj
(
priceObj
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
private
void
updatePriceObj
(
Map
<
String
,
Object
>
priceObj
)
{
priceObj
.
put
(
"UPDATEDBY"
,
"system"
);
String
sql
=
"update t_price_list set "
;
List
<
Object
>
args
=
new
ArrayList
<>();
for
(
Entry
<
String
,
Object
>
entry
:
priceObj
.
entrySet
())
{
String
key
=
entry
.
getKey
();
Object
value
=
entry
.
getValue
();
if
(!
key
.
equals
(
"ID"
))
{
if
(!
key
.
equals
(
"ID"
))
{
sql
=
sql
+
key
+
" = ?, "
;
args
.
add
(
value
);
}
}
sql
=
sql
.
substring
(
0
,
sql
.
length
()
-
2
);
sql
=
sql
.
substring
(
0
,
sql
.
length
()
-
2
);
sql
=
sql
+
" where ID = ?"
;
args
.
add
(
priceObj
.
get
(
"ID"
));
jdbcTemplate
.
update
(
sql
,
args
.
toArray
());
}
private
void
insertPriceObj
(
Map
<
String
,
Object
>
priceObj
)
{
String
countSql
=
"select count(1) from t_price_list"
;
Integer
count
=
jdbcTemplate
.
queryForObject
(
countSql
,
Integer
.
class
);
String
ID
=
System
.
currentTimeMillis
()
+
StringUtil
.
prependZero
(
count
+
1
,
5
);
Date
now
=
new
Date
();
String
today
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
Long
time
=
now
.
getTime
();
Long
idIndex
=
common
.
getNextval
(
today
+
"_t_ven_goods"
);
Long
ID
=
Long
.
valueOf
(
time
+
""
+
idIndex
);
priceObj
.
put
(
"ID"
,
ID
);
priceObj
.
put
(
"CREATED"
,
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE_TIME
)
/*datetimef.format(new Date())*/
);
priceObj
.
put
(
"CREATED"
,
now
);
priceObj
.
put
(
"CREATEDBY"
,
"system"
);
priceObj
.
put
(
"UPDATEDBY"
,
""
);
String
insertSql
=
"insert into t_price_list "
;
String
fieldSql
=
"("
;
String
valuesSql
=
"("
;
List
<
Object
>
values
=
new
ArrayList
<>();
for
(
Entry
<
String
,
Object
>
entry
:
priceObj
.
entrySet
())
{
for
(
Entry
<
String
,
Object
>
entry
:
priceObj
.
entrySet
())
{
fieldSql
=
fieldSql
+
entry
.
getKey
()
+
", "
;
valuesSql
=
valuesSql
+
"?, "
;
values
.
add
(
entry
.
getValue
());
}
fieldSql
=
fieldSql
.
substring
(
0
,
fieldSql
.
length
()
-
2
);
valuesSql
=
valuesSql
.
substring
(
0
,
valuesSql
.
length
()
-
2
);
fieldSql
=
fieldSql
.
substring
(
0
,
fieldSql
.
length
()
-
2
);
valuesSql
=
valuesSql
.
substring
(
0
,
valuesSql
.
length
()
-
2
);
insertSql
=
insertSql
+
fieldSql
+
") values "
+
valuesSql
+
")"
;
jdbcTemplate
.
update
(
insertSql
,
values
.
toArray
());
}
private
Map
<
String
,
Object
>
getPriceObj
(
String
KUNNR
,
String
MATNR
){
private
Map
<
String
,
Object
>
getPriceObj
(
String
KUNNR
,
String
MATNR
)
{
String
sql
=
"select * from t_price_list where KUNNR = ? and MATNR = ?"
;
List
<
Map
<
String
,
Object
>>
list
=
jdbcTemplate
.
queryForList
(
sql
,
KUNNR
,
MATNR
);
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
return
list
.
get
(
0
);
}
return
null
;
...
...
src/main/java/com/egolm/sso/service/impl/SoConfirmQuotationServiceImpl.java
View file @
02af6f48
...
...
@@ -85,6 +85,8 @@ public class SoConfirmQuotationServiceImpl implements SoConfirmQuotationService{
}
Long
hID
=
Long
.
valueOf
(
time
+
idIndex
);
header
.
put
(
"ID"
,
hID
);
header
.
put
(
"TRACE_NO"
,
"sapsoconfirmquotation"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
insertTo
(
header
,
"t_so_confirmation_header"
);
...
...
@@ -160,13 +162,17 @@ public class SoConfirmQuotationServiceImpl implements SoConfirmQuotationService{
String
valuesSql
=
"("
;
List
<
Object
>
values
=
new
ArrayList
<>();
for
(
Entry
<
String
,
Object
>
entry
:
obj
.
entrySet
())
{
fieldSql
=
fieldSql
+
entry
.
getKey
()
+
", "
;
valuesSql
=
valuesSql
+
"?, "
;
values
.
add
(
entry
.
getValue
());
Object
value
=
entry
.
getValue
();
if
(
value
!=
null
)
{
fieldSql
=
fieldSql
+
entry
.
getKey
()
+
", "
;
valuesSql
=
valuesSql
+
"?, "
;
values
.
add
(
entry
.
getValue
());
}
}
fieldSql
=
fieldSql
.
substring
(
0
,
fieldSql
.
length
()-
2
);
valuesSql
=
valuesSql
.
substring
(
0
,
valuesSql
.
length
()-
2
);
insertSql
=
insertSql
+
fieldSql
+
") values "
+
valuesSql
+
")"
;
System
.
out
.
println
(
JSON
.
toJSONString
(
values
));
jdbcTemplate
.
update
(
insertSql
,
values
.
toArray
());
}
...
...
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