Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
topsun-bpm
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
鲁鑫
topsun-bpm
Commits
b868d9de
Commit
b868d9de
authored
Dec 08, 2023
by
覃振观
👶
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
23-12-8: Class 调整。 调整传输数据格式。
parent
28ea8694
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
134 additions
and
76 deletions
+134
-76
productDetail.js
...un-xt/src/main/webapp/biz/topsun/product/productDetail.js
+25
-6
productDetail.jsp
...n-xt/src/main/webapp/biz/topsun/product/productDetail.jsp
+39
-21
ProductApplication.java
...huigou/topsun/product/application/ProductApplication.java
+13
-2
ProductApplicationImpl.java
...psun/product/application/impl/ProductApplicationImpl.java
+38
-32
ProductController.java
...m/huigou/topsun/product/controller/ProductController.java
+19
-15
No files found.
topsun-xt/src/main/webapp/biz/topsun/product/productDetail.js
View file @
b868d9de
var
rawData
=
{};
$
(
document
).
ready
(
function
()
{
initializeUI
();
initializeToobarContainer
();
...
...
@@ -25,7 +25,6 @@ function initializeUI() {
});
}
function
loadDataTest
()
{
console
.
log
(
"loadData"
)
var
params
=
new
URLSearchParams
(
document
.
location
.
search
);
...
...
@@ -33,6 +32,7 @@ function loadDataTest() {
Public
.
ajax
(
web_app
.
name
+
"/product/loadProductDetail.ajax"
,
{
productId
:
paramsData
.
productId
},
function
(
data
)
{
rawData
=
data
;
$
(
'#submitForm'
).
formSet
(
data
);
var
fronData
=
{};
fronData
.
Rows
=
data
.
fronColors
;
...
...
@@ -53,7 +53,6 @@ function faceGrid(elId, data) {
}
}
});
debugger
;
var
gridManager
=
UICtrl
.
grid
(
elId
,
{
columns
:
[
{
display
:
"颜色名称"
,
name
:
"productFaceColorId"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
...
...
@@ -71,12 +70,32 @@ function faceGrid(elId, data) {
});
}
function
save
()
{
$
(
'#submitForm'
).
ajaxSubmit
({
url
:
web_app
.
name
+
'/product/saveProductAndDetail.ajax'
,
param
:{
rawData
:
JSON
.
stringify
(
rawData
)
},
success
:
function
(
data
)
{
debugger
;
}
});
}
function
initializeToobarContainer
(){
$
(
'#toolBarCenter'
).
attr
(
'position'
,
'bottom'
);
var
toolBarOptions
=
{
dropup
:
$
(
'#toolBar'
).
data
(
'dropup'
)
===
true
,
//显示更多按钮时 是否向上打开菜单
items
:
[{
id
:
'save'
,
remark
:
'保存'
,
name
:
'common.button.save'
,
icon
:
'fa-save'
,
delay
:
true
,
relation
:
'advance'
,
event
:
save
}]
};
$
(
'#toolBar'
).
toolBar
(
toolBarOptions
);
//dropup==true 更多按钮向上展示
$
(
'#toolBar'
).
data
(
'dropup'
,
true
).
removeClass
(
'job-button-fixed-top'
).
addClass
(
'job-button-fixed-bottom'
);
UICtrl
.
layout
(
$
(
"#jobPageLayout"
),
{
heightDiff
:
-
2
,
topHeight
:
40
,
bottomHeight
:
40
,
onSizeChanged
:
function
(){
}});
}
// checkbox: true,
// enabledSort: false,
...
...
topsun-xt/src/main/webapp/biz/topsun/product/productDetail.jsp
View file @
b868d9de
...
...
@@ -8,24 +8,13 @@
<%@ page
language=
"java"
contentType=
"text/html; charset=utf-8"
%>
<%@taglib
uri=
"/WEB-INF/taglib.tld"
prefix=
"x"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<head>
<x:base
include=
"layout,dialog,grid,tree,combox,commonTree"
/>
<x:script
src=
'/javaScript/common.js'
/>
<x:script
src=
'/lib/jquery/jquery.contextmenu.js'
/>
<x:script
src=
'/system/bpm/BpmUtil.js'
/>
<x:script
src=
'/biz/topsun/product/productDetail.js'
/>
</head>
<html>
<body>
<div
class=
"container-fluid"
style=
"position: relative; display: inline-flex; flex-direction: column; height: 97%;
background-color: #f3f3f4 !important;"
>
<%-- style="position: relative; display: inline-flex; flex-direction: column;"--%>
<%-- <x:hidden name="productDetailId" />--%>
<%-- <x:hidden name="productId"/>--%>
<div
class=
"panelX"
id=
"panelContainer"
>
<x:hidden
name=
"productDetailId"
/>
<%-- <div class="hg-form-cols">--%>
<%-- <div labelCol="15"> </div>--%>
<%-- </div>--%>
<%-- style="overflow: 98vh;"--%>
<form
class=
"hg-form"
method=
"post"
action=
""
id=
"submitForm"
>
<div
class=
"hg-form-row"
>
<x:title
title=
"基本属性"
name=
"group"
hideTable=
"#info"
/>
...
...
@@ -79,17 +68,46 @@
</div>
</form>
<div
id=
"toolBarCenter"
class=
"footer"
style=
"background: none repeat scroll 0 0 #fff; border-top: 1px solid #e7eaec;
position: absolute; bottom: 0; width: 100%; display:flex; justify-content:center;"
>
<%-- style=""--%>
<div
id=
'toolBar'
checkAccess=
"false"
>
<a>
aaa
</a>
</div>
<div
id=
"toolBarCenter"
class=
"panel-footerX"
>
<div
id=
"toolBar"
></div>
</div>
</div>
</body>
<head>
<x:base
include=
"layout,dialog,grid,tree,combox,commonTree"
/>
<x:script
src=
'/javaScript/common.js'
/>
<x:script
src=
'/lib/jquery/jquery.contextmenu.js'
/>
<x:script
src=
'/system/bpm/BpmUtil.js'
/>
<x:script
src=
'/biz/topsun/product/productDetail.js'
/>
<style>
.panelX
{
height
:
98%
;
width
:
100%
;
padding
:
5px
;
position
:
relative
;
display
:
inline-flex
;
flex-direction
:
column
;
/*background-color: #f3f3f4 !important;*/
}
.panelX
>
div
:first-child
{
margin-bottom
:
38px
;
}
.panelX
>
form
{
margin-bottom
:
38px
;
}
.panel-footerX
{
width
:
100%
;
left
:
-1px
;
bottom
:
0
;
padding
:
1px
99px
;
position
:
fixed
;
display
:
flex
;
justify-content
:
center
;
background
:
none
repeat
scroll
0
0
#fff0
;
/*border-top: 1px solid #e7eaec;*/
/*background: none repeat scroll 0 0 #fff;*/
}
.panel-footerX
>
div
{
margin
:
2px
;
}
</style>
</head>
</html>
topsun/src/main/java/com/huigou/topsun/product/application/ProductApplication.java
View file @
b868d9de
...
...
@@ -4,6 +4,7 @@ import com.huigou.topsun.product.domain.Product;
import
org.springframework.data.domain.Page
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -20,7 +21,7 @@ public interface ProductApplication {
* @param size 页大小
* @return org.springframework.data.domain.Page<com.huigou.topsun.product.domain.Product>
* @author qinzhenguan
* @create
:
2023/11/29 9:34
* @create
Date
2023/11/29 9:34
*/
ArrayList
<
Map
<
String
,
Object
>>
findProductPage
(
int
page
,
int
size
);
...
...
@@ -29,7 +30,17 @@ public interface ProductApplication {
* @param productId 产品ID
* @return java.util.Map<java.lang.String, java.lang.Object>
* @author qinzhenguan
* @create
:
2023/11/29 9:33
* @create
Date
2023/11/29 9:33
*/
Map
<
String
,
Object
>
queryDetailAll
(
int
productId
);
/**
* description 对比所有对象,并保存更改的数据。
* @param rawMap 原数据
* @param updateMap 提交的数据
* @return java.util.HashMap<java.lang.String, java.lang.Object>
* @author qinzhenguan
* @createDate 2023/12/8 17:19
*/
HashMap
<
String
,
Object
>
saveProductAndDetail
(
HashMap
<
String
,
Object
>
rawMap
,
HashMap
<
String
,
Object
>
updateMap
);
}
topsun/src/main/java/com/huigou/topsun/product/application/impl/ProductApplicationImpl.java
View file @
b868d9de
package
com
.
huigou
.
topsun
.
product
.
application
.
impl
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.huigou.topsun.product.application.BrandApplication
;
import
com.huigou.topsun.product.application.ProductApplication
;
import
com.huigou.topsun.product.domain.*
;
import
com.huigou.topsun.product.repository.*
;
...
...
@@ -29,7 +29,6 @@ public class ProductApplicationImpl implements ProductApplication {
private
final
ProductDetailRepository
detailRepository
;
// 类型
private
final
BrandRepository
brandRepository
;
private
final
BrandApplication
brandService
;
private
final
FactoryRepository
factoryRepository
;
private
final
ColorRepository
colorRepository
;
private
final
ProductCategoryRepository
categoryRepository
;
...
...
@@ -50,12 +49,10 @@ public class ProductApplicationImpl implements ProductApplication {
// mapList.getContent().stream().map(Product::toString).forEach(System.out::println);
ArrayList
<
Product
>
productPage
=
(
ArrayList
<
Product
>)
productRepository
.
findAll
();
ObjectMapper
mapper
=
new
ObjectMapper
();
ArrayList
<
Map
<
String
,
Object
>>
mapList
=
(
ArrayList
<
Map
<
String
,
Object
>>)
mapper
.
convertValue
(
productPage
,
List
.
class
);
// convert = mapList.stream().collect(Collectors.toMap(index -> index, Function.identity(),
// (oldV, newV) -> oldV));
return
mapList
;
return
mapper
.
convertValue
(
productPage
,
new
TypeReference
<
ArrayList
<
Map
<
String
,
Object
>>>()
{});
}
/**
...
...
@@ -63,13 +60,12 @@ public class ProductApplicationImpl implements ProductApplication {
* @param productId 产品ID
* @return java.util.Map<java.lang.String, java.lang.Object>
* @author qinzhenguan
*
@create:
2023/11/29 13:19
*
createDate
2023/11/29 13:19
*/
@Override
public
Map
<
String
,
Object
>
queryDetailAll
(
int
productId
)
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>(
200
);
ProductDetail
productDetail
=
detailRepository
.
findByProductIdEquals
((
long
)
productId
);
resultMap
.
put
(
"detail"
,
productDetail
);
// EntityManager manager = JPAUtils.getEntityManger();
// manager.getTransaction().begin();
// manager.flush();
...
...
@@ -89,10 +85,12 @@ public class ProductApplicationImpl implements ProductApplication {
entitys
.
add
(
typesetConfRepository
.
findByProductId
(
strProductId
));
entitys
.
add
(
lookedRepository
.
findByProductId
(
strProductId
));
entitys
.
add
(
publishedConfRepository
.
findByProductId
(
strProductId
));
entitys
.
add
(
productDetail
);
HashMap
<
String
,
Object
>
listMaps
=
new
HashMap
<>(
100
);
resultMap
.
putAll
(
assembleResultOfForm
(
entitys
));
resultMap
.
put
(
"loss"
,
loss
);
resultMap
.
put
(
"material"
,
material
);
listMaps
.
put
(
"loss"
,
loss
);
listMaps
.
put
(
"material"
,
material
);
// --------------------------------- 版面查询 ---------------------------------
if
(
productDetail
!=
null
)
{
...
...
@@ -101,27 +99,28 @@ public class ProductApplicationImpl implements ProductApplication {
ArrayList
<
ProductFaceColor
>
fronColors
=
(
ArrayList
<
ProductFaceColor
>)
faceColorRepository
.
findByProductFaceId
(
productDetail
.
getBackProductFaceId
());
resultMap
.
put
(
"frontFace"
,
frontFace
);
resultMap
.
put
(
"fronColors"
,
fronColors
==
null
?
new
ArrayList
<>()
:
fronColors
);
listMaps
.
put
(
"fronColors"
,
fronColors
==
null
?
new
ArrayList
<>()
:
fronColors
);
}
else
{
ProductFaceColor
fc
=
new
ProductFaceColor
();
fc
.
setProductFaceColorId
(
"111"
);
ArrayList
fronColors
=
new
ArrayList
<>();
ArrayList
<
ProductFaceColor
>
fronColors
=
new
ArrayList
<>();
fronColors
.
add
(
fc
);
resultMap
.
put
(
"fronColors"
,
fronColors
);
listMaps
.
put
(
"fronColors"
,
fronColors
);
}
if
(
productDetail
.
getBackProductFaceId
()
!=
null
)
{
ProductFace
backFace
=
faceRepository
.
findByProductFaceIdEquals
(
productDetail
.
getBackProductFaceId
());
ArrayList
<
ProductFaceColor
>
backColors
=
(
ArrayList
<
ProductFaceColor
>)
faceColorRepository
.
findByProductFaceId
(
productDetail
.
getBackProductFaceId
());
resultMap
.
put
(
"backFace"
,
backFace
);
resultMap
.
put
(
"backColors"
,
backColors
==
null
?
new
ArrayList
<>()
:
backColors
);
listMaps
.
put
(
"backColors"
,
backColors
==
null
?
new
ArrayList
<>()
:
backColors
);
}
}
ObjectMapper
mapper
=
new
ObjectMapper
();
resultMap
.
put
(
"selectedBrand"
,
mapper
.
convertValue
(
brands
,
List
.
class
));
resultMap
.
put
(
"selectedFactory"
,
mapper
.
convertValue
(
factorys
,
List
.
class
));
resultMap
.
put
(
"selectedColor"
,
mapper
.
convertValue
(
colors
,
List
.
class
));
resultMap
.
put
(
"selectedCategory"
,
mapper
.
convertValue
(
categorys
,
List
.
class
));
listMaps
.
put
(
"selectedBrand"
,
mapper
.
convertValue
(
brands
,
List
.
class
));
listMaps
.
put
(
"selectedFactory"
,
mapper
.
convertValue
(
factorys
,
List
.
class
));
listMaps
.
put
(
"selectedColor"
,
mapper
.
convertValue
(
colors
,
List
.
class
));
listMaps
.
put
(
"selectedCategory"
,
mapper
.
convertValue
(
categorys
,
List
.
class
));
resultMap
.
put
(
"listMaps"
,
listMaps
);
// resultMap.put("selectedBrand", convertToMap(Brand.class, "brandName", "brandId", brands));
// resultMap.put("selectedFactory", convertToMap(Factory.class, "factoryName", "factoryId", factorys));
// resultMap.put("selectedColor", convertToMap(Color.class, "colorName", "colorId", colors));
...
...
@@ -130,22 +129,28 @@ public class ProductApplicationImpl implements ProductApplication {
return
resultMap
;
}
@Override
public
HashMap
<
String
,
Object
>
saveProductAndDetail
(
HashMap
<
String
,
Object
>
rawMap
,
HashMap
<
String
,
Object
>
updateMap
)
{
return
null
;
}
/**
* description 返回页面 Form 所需的数据格式
* @param entitys 所有相关的 实体 (如果需要 update,保留这些实体。提交时候用于比较更新值。)
* @return java.util.HashMap<java.lang.String, java.lang.Object>
* @author qinzhenguan
*
@create:
2023/12/5 14:09
*
createDate
2023/12/5 14:09
*/
public
Map
<
String
,
Object
>
assembleResultOfForm
(
Set
<
Object
>
entitys
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
1024
);
ObjectMapper
mapper
=
new
ObjectMapper
();
map
.
put
(
"entitys"
,
entitys
);
for
(
Object
item
:
entitys
)
{
if
(
item
==
null
)
{
continue
;
}
map
.
putAll
(
mapper
.
convertValue
(
item
,
Map
.
class
));
map
.
putAll
(
mapper
.
convertValue
(
item
,
new
TypeReference
<
Map
<?
extends
String
,
?>>()
{}
));
}
return
map
;
}
...
...
@@ -158,7 +163,7 @@ public class ProductApplicationImpl implements ProductApplication {
* @param list 需要转换的 List
* @return java.util.Map<java.lang.Object, java.lang.Object>
* @author qinzhenguan
*
@create:
2023/12/1 16:09
*
createDate
2023/12/1 16:09
*/
public
Map
<
Object
,
Object
>
convertToMap
(
Class
<?>
clazz
,
String
displayProperty
,
String
valueProperty
,
List
<?>
list
)
{
...
...
@@ -167,7 +172,7 @@ public class ProductApplicationImpl implements ProductApplication {
set
.
add
(
valueProperty
);
if
(
checkClassesAndProperties
(
clazz
,
set
,
list
.
size
()))
{
ObjectMapper
mapper
=
new
ObjectMapper
();
Li
st
<
Map
<
String
,
Object
>>
mapList
=
mapper
.
convertValue
(
list
,
List
.
class
);
Li
nkedList
<
Map
<
String
,
Object
>>
mapList
=
mapper
.
convertValue
(
list
,
new
TypeReference
<
LinkedList
<
Map
<
String
,
Object
>>>()
{}
);
return
mapList
.
stream
().
collect
(
Collectors
.
toMap
(
map
->
map
.
get
(
displayProperty
),
map
->
map
.
get
(
valueProperty
),
(
oldV
,
newV
)
->
oldV
));
}
...
...
@@ -181,7 +186,7 @@ public class ProductApplicationImpl implements ProductApplication {
* @param listSize 需要检查的 ListSize
* @return java.lang.Boolean true of false
* @author qinzhenguan
*
@create:
2023/12/1 15:58
*
createDate
2023/12/1 15:58
*/
public
Boolean
checkClassesAndProperties
(
Class
<?>
clazz
,
Set
<
String
>
set
,
int
listSize
)
{
if
(
listSize
==
0
)
{
...
...
@@ -214,7 +219,7 @@ public class ProductApplicationImpl implements ProductApplication {
* @param list 需要转换的 List
* @return java.util.Map<java.lang.Object, java.lang.Object>
* @author qinzhenguan
*
@create:
2023/11/29 11:36
*
createDate
2023/11/29 11:36
*/
public
Map
<
Object
,
Object
>
convertToMap
(
Class
<?>
clazz
,
String
propertyName
,
List
<?>
list
)
{
return
convertToMap
(
clazz
,
propertyName
,
list
,
false
);
...
...
@@ -228,18 +233,19 @@ public class ProductApplicationImpl implements ProductApplication {
* @param isBean 是否需要转换为实体 (当前应用不需要返回实体)
* @return java.util.Map<java.lang.Object, java.lang.Object>
* @author qinzhenguan
*
@create:
2023/11/29 11:34
*
createDate
2023/11/29 11:34
*/
public
Map
<
Object
,
Object
>
convertToMap
(
Class
<?>
clazz
,
String
propertyName
,
List
<?>
list
,
boolean
isBean
)
{
Map
<
String
,
Object
>
checkMap
=
checkClassesAndProperties
(
clazz
,
propertyName
,
list
.
size
());
if
(!(
Boolean
)
checkMap
.
get
(
"isOk"
))
{
String
ok
=
"isOk"
;
if
(!(
Boolean
)
checkMap
.
get
(
ok
))
{
return
null
;
}
Method
method
=
(
Method
)
checkMap
.
get
(
"method"
);
ObjectMapper
mapper
=
new
ObjectMapper
();
Li
st
<
Map
<
String
,
Object
>>
mapList
=
mapper
.
convertValue
(
list
,
List
.
class
);
Map
<
Object
,
Object
>
resultMap
=
new
HashMap
<>();
Map
<
Object
,
Object
>
convert
=
new
HashMap
<>();
Li
nkedList
<
Map
<
String
,
Object
>>
mapList
=
mapper
.
convertValue
(
list
,
new
TypeReference
<
LinkedList
<
Map
<
String
,
Object
>>>()
{}
);
Map
<
Object
,
Object
>
resultMap
=
new
HashMap
<>(
10
);
Map
<
Object
,
Object
>
convert
=
new
HashMap
<>(
1024
);
if
(
isBean
)
{
// --------------------------------- 实体 ---------------------------------
try
{
...
...
@@ -270,10 +276,10 @@ public class ProductApplicationImpl implements ProductApplication {
* @param propertyName property
* @return java.util.HashMap<java.lang.String, java.lang.Object> { "isOk" : 是否通过检查, "method":获取得到的 method }
* @author qinzhenguan
*
@create:
2023/11/29 11:05
*
createDate
2023/11/29 11:05
*/
public
HashMap
<
String
,
Object
>
checkClassesAndProperties
(
Class
<?>
clazz
,
String
propertyName
,
int
listSize
)
{
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>(
33
);
if
(
listSize
==
0
)
{
System
.
err
.
println
(
"[checkClassesAndProperties] : List< "
+
clazz
.
getName
()+
" > 需要转换的列表没有元素。请检查~!"
);
map
.
put
(
"isOk"
,
false
);
...
...
topsun/src/main/java/com/huigou/topsun/product/controller/ProductController.java
View file @
b868d9de
package
com
.
huigou
.
topsun
.
product
.
controller
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.huigou.cache.DictUtil
;
import
com.huigou.topsun.base.coderule.domain.model.CodeRuleKind
;
import
com.huigou.topsun.product.domain.Product
;
import
com.huigou.topsun.product.application.ProductApplication
;
import
com.huigou.topsun.resource.vo.ResourceFiledVo
;
import
org.springframework.data.domain.Page
;
import
com.huigou.uasp.annotation.ControllerMapping
;
import
com.huigou.uasp.client.CommonController
;
import
com.huigou.util.SDO
;
...
...
@@ -16,14 +13,13 @@ import org.springframework.stereotype.Controller;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* ProductController
*
* @author qinzhenguan
* @
d
ate 2023/11/27 11:19
* @
createD
ate 2023/11/27 11:19
**/
@Controller
@ControllerMapping
(
"/product"
)
...
...
@@ -40,15 +36,12 @@ public class ProductController extends CommonController {
/**
* description
* @author qinzhenguan
* @
d
ate 2023/11/27 11:49
* @
createD
ate 2023/11/27 11:49
* @return null
*/
public
String
findProduct
()
{
//需要特定类型返回值
SDO
sdo
=
this
.
getSDO
();
// int page = sdo.getInteger("page");
// int size = sdo.getInteger("size");
ArrayList
<
Map
<
String
,
Object
>>
productPage
=
productService
.
findProductPage
(
0
,
30
);
HashMap
<
Object
,
Object
>
map
=
new
HashMap
<>();
HashMap
<
Object
,
Object
>
map
=
new
HashMap
<>(
3
);
map
.
put
(
"Rows"
,
productPage
);
return
toResult
(
map
);
}
...
...
@@ -63,7 +56,7 @@ public class ProductController extends CommonController {
public
String
forwardProduct
()
{
// 通过此方法可以查看系统配置的 字典 的数据结构
DictUtil
.
getDictionaryList
(
"technologyType"
);
Map
<
String
,
Object
>
map4
=
new
HashMap
<>();
Map
<
String
,
Object
>
map4
=
new
HashMap
<>(
10
);
map4
.
put
(
"六六六"
,
"666"
);
map4
.
put
(
"七七七"
,
"777"
);
map4
.
put
(
"八八八"
,
"888"
);
...
...
@@ -74,9 +67,9 @@ public class ProductController extends CommonController {
public
String
forwardProductDetail
()
{
ObjectMapper
mapper
=
new
ObjectMapper
();
SDO
sdo
=
this
.
getSDO
();
Map
param
=
null
;
HashMap
<
String
,
Object
>
param
;
try
{
param
=
mapper
.
readValue
(
sdo
.
getString
(
"data"
),
Map
.
class
);
param
=
mapper
.
readValue
(
sdo
.
getString
(
"data"
),
new
TypeReference
<
HashMap
<
String
,
Object
>>()
{}
);
}
catch
(
JsonProcessingException
e
)
{
throw
new
RuntimeException
(
e
);
}
...
...
@@ -84,13 +77,24 @@ public class ProductController extends CommonController {
}
public
String
loadProductDetail
()
{
ObjectMapper
mapper
=
new
ObjectMapper
();
SDO
sdo
=
this
.
getSDO
();
String
productId
=
sdo
.
getString
(
"productId"
);
Map
<
String
,
Object
>
resultMap
=
productService
.
queryDetailAll
(
Integer
.
parseInt
(
productId
));
return
toResult
(
resultMap
);
}
public
String
saveProductAndDetail
()
throws
JsonProcessingException
{
ObjectMapper
mapper
=
new
ObjectMapper
();
SDO
sdo
=
this
.
getSDO
();
String
updateJson
=
sdo
.
toString
();
HashMap
<
String
,
Object
>
updateMap
=
mapper
.
readValue
(
updateJson
,
new
TypeReference
<
HashMap
<
String
,
Object
>>()
{});
HashMap
<
String
,
Object
>
rawMap
=
mapper
.
readValue
(
updateMap
.
get
(
"rawData"
)
+
""
,
new
TypeReference
<
HashMap
<
String
,
Object
>>()
{});
updateMap
.
remove
(
"rawData"
);
HashMap
<
String
,
Object
>
resultMap
=
productService
.
saveProductAndDetail
(
rawMap
,
updateMap
);
return
success
(
resultMap
);
}
}
\ No newline at end of file
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