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
e72017b4
Commit
e72017b4
authored
Dec 05, 2023
by
覃振观
👶
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
23-12-5
parent
75ac4ca3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
145 additions
and
62 deletions
+145
-62
productDetail.js
...un-xt/src/main/webapp/biz/topsun/product/productDetail.js
+48
-12
productDetail.jsp
...n-xt/src/main/webapp/biz/topsun/product/productDetail.jsp
+53
-27
ProductApplicationImpl.java
...psun/product/application/impl/ProductApplicationImpl.java
+37
-13
ProductController.java
...m/huigou/topsun/product/controller/ProductController.java
+0
-9
BrandRepository.java
...com/huigou/topsun/product/repository/BrandRepository.java
+3
-0
ProductLossRepository.java
...igou/topsun/product/repository/ProductLossRepository.java
+4
-1
No files found.
topsun-xt/src/main/webapp/biz/topsun/product/productDetail.js
View file @
e72017b4
$
(
document
).
ready
(
function
()
{
$
(
'#pageTab'
).
tab
();
initializateSelectC
();
loadDataTest
();
});
function
initializateSelectC
()
{
...
...
@@ -12,7 +14,6 @@ function initializateSelectC() {
});
}
function
loadDataTest
()
{
console
.
log
(
"loadData"
)
var
params
=
new
URLSearchParams
(
document
.
location
.
search
);
...
...
@@ -21,16 +22,51 @@ function loadDataTest() {
productId
:
paramsData
.
productId
},
function
(
data
)
{
debugger
;
var
selectedCategory
=
data
.
selectedCategory
;
$
(
"#selectedCategory"
).
ligerComboBox
({
textField
:
'productCategoryName'
,
valueField
:
'productCategoryId'
,
columns
:
[
{
header
:
'ID'
,
name
:
'productCategoryId'
,
width
:
20
},
{
header
:
'名字'
,
name
:
'productCategoryName'
}
],
data
:
selectedCategory
,
selectBoxWidth
:
200
});
$
(
'#submitForm'
).
formSet
(
data
);
var
fronData
=
{};
fronData
.
Rows
=
data
.
fronColor
;
faceGrid
(
"#frontFaceDiv"
,
fronData
);
fronData
.
Rows
=
data
.
backColor
;
faceGrid
(
"#backFaceDiv"
,
fronData
);
// var selectedCategory = data.selectedCategory;
// $("#selectedCategory").ligerComboBox({
// textField: 'productCategoryName',
// valueField: 'productCategoryId',
// columns: [
// { header: 'ID', name: 'productCategoryId', width: 20 },
// { header: '名字', name: 'productCategoryName' }
// ],
// data: selectedCategory,
// selectBoxWidth: 200
// });
});
}
function
faceGrid
(
elId
,
data
)
{
var
toolbarOptions
=
UICtrl
.
getDefaultToolbarOptions
({
updateHandler
:
function
(){
updateHandler
();
}
});
gridManager
=
UICtrl
.
grid
(
"#frontFaceDiv"
,
{
columns
:
[
{
display
:
"颜色名称"
,
name
:
"productFaceColorId"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"油墨覆盖率(%)"
,
name
:
"coverageRate"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
}
],
dataAction
:
"local"
,
dataType
:
"local"
,
data
:
data
,
usePager
:
false
,
// 可能无数据时,此参数应设为 false
toolbar
:
toolbarOptions
,
width
:
"100%"
,
height
:
"100%"
,
heightDiff
:
-
8
,
checkbox
:
true
,
fixedCellHeight
:
true
,
selectRowButtonOnly
:
true
,
onDblClickRow
:
function
(
data
,
rowindex
,
rowobj
)
{
updateHandler
(
data
);
}
});
}
\ No newline at end of file
topsun-xt/src/main/webapp/biz/topsun/product/productDetail.jsp
View file @
e72017b4
...
...
@@ -10,39 +10,65 @@
<%@ 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>
<form
class=
"hg-form"
method=
"post"
action=
""
id=
"submitForm"
>
<x:hidden
name=
"productDetailId"
/>
<x:hidden
name=
"productId"
/>
<body>
<div
class=
"container-fluid"
>
<div
class=
"hg-form-cols"
>
<div
labelCol=
"15"
>
</div>
</div>
<div
class=
"hg-form-row"
>
<x:title
title=
"基本属性"
name=
"group"
hideTable=
"#info"
/>
<x:inputC
name=
"productId"
required=
"true"
label=
"产品编码"
labelCol=
"2"
maxLength=
"64"
fieldCol=
"4"
/>
<x:inputC
name=
"productName"
required=
"true"
label=
"产品名称"
labelCol=
"2"
maxLength=
"64"
fieldCol=
"4"
/>
<x:selectC
name=
"productCategoryId"
required=
"false"
label=
"产品类别ID"
id=
"selectedCategory"
labelCol=
"2"
/>
<form
class=
"hg-form"
method=
"post"
action=
""
id=
"submitForm"
>
<x:hidden
name=
"productDetailId"
/>
<x:hidden
name=
"productId"
/>
<%-- <x:inputC name="productCategoryId" required="true" label="产品类别ID" wrapper="select" labelCol="2" maxLength="64"--%>
<%-- fieldCol="4" />--%>
<x:inputC
name=
"productUnit"
required=
"false"
label=
"单位"
labelCol=
"2"
maxLength=
"32"
fieldCol=
"4"
/>
<x:inputC
name=
"productSampleCode"
required=
"false"
label=
"样品编号"
labelCol=
"2"
maxLength=
"32"
fieldCol=
"4"
/>
<x:inputC
name=
"brandName"
required=
"false"
label=
"品牌名称"
labelCol=
"2"
maxLength=
"32"
fieldCol=
"4"
/>
<x:title
title=
""
name=
"group"
hideTable=
"#info"
/>
</div>
<div
class=
"hg-form-cols"
>
<div
labelCol=
"15"
>
</div>
</div>
<div
class=
"hg-form-row"
>
<x:title
title=
"基本属性"
name=
"group"
hideTable=
"#info"
/>
<x:inputC
name=
"productId"
required=
"true"
label=
"产品编码"
labelCol=
"2"
maxLength=
"64"
fieldCol=
"4"
/>
<x:inputC
name=
"productName"
required=
"true"
label=
"产品名称"
labelCol=
"2"
maxLength=
"64"
fieldCol=
"4"
/>
<x:selectC
name=
"productCategoryId"
required=
"false"
label=
"产品类别ID"
id=
"selectedCategory"
labelCol=
"2"
/>
<%-- <x:inputC name="productCategoryId" required="true" label="产品类别ID" wrapper="select" labelCol="2" maxLength="64"--%>
<%-- fieldCol="4" />--%>
<x:inputC
name=
"productUnit"
required=
"false"
label=
"单位"
labelCol=
"2"
maxLength=
"32"
fieldCol=
"4"
/>
<x:inputC
name=
"productSampleCode"
required=
"false"
label=
"样品编号"
labelCol=
"2"
maxLength=
"32"
fieldCol=
"4"
/>
<x:inputC
name=
"brandName"
required=
"false"
label=
"品牌名称"
labelCol=
"2"
maxLength=
"32"
fieldCol=
"4"
/>
</div>
<div
id=
'pageTab'
style=
"margin: 0px;"
>
<div
class=
"ui-tab-links"
>
<ul
id=
"menu_ul"
>
<li
id=
"detailForm"
divid=
"detailFormDiv"
>
可选属性
</li>
<li
id=
"lossForm"
divid=
"lossFormDiv"
>
客户loss
</li>
<li
id=
"materialList"
divid=
"materialListDiv"
>
物料组成
</li>
</ul>
</div>
<div
class=
"ui-tab-content"
style=
"padding: 2px; padding-right: 0;"
>
<div
class=
"layout"
id=
'detailFormDiv'
>
<x:inputC
name=
"factoryName"
required=
"true"
label=
"制造工厂"
labelCol=
"2"
maxLength=
"64"
fieldCol=
"4"
/>
<x:inputC
name=
"customerName"
required=
"true"
label=
"客户名称"
labelCol=
"2"
maxLength=
"64"
fieldCol=
"4"
/>
<x:title
title=
"外观描述"
name=
"group"
hideTable=
"#info"
/>
<x:inputC
name=
"productLength"
required=
"true"
label=
"长度"
labelCol=
"2"
maxLength=
"64"
fieldCol=
"4"
/>
<x:inputC
name=
"productWidth"
required=
"true"
label=
"宽度"
labelCol=
"2"
maxLength=
"64"
fieldCol=
"4"
/>
<x:title
title=
"排版参数"
name=
"group"
hideTable=
"#info"
/>
<x:inputC
name=
"modulus"
required=
"true"
label=
"模数"
labelCol=
"2"
maxLength=
"64"
fieldCol=
"4"
/>
<x:inputC
name=
"row_num"
required=
"true"
label=
"行数"
labelCol=
"2"
maxLength=
"64"
fieldCol=
"4"
/>
<div
id=
"frontFaceGrid"
style=
"margin: 2px;"
></div>
<div
id=
"frontFaceGrid"
style=
"margin: 2px;"
></div>
</div>
<div
class=
"layout"
id=
'frontFaceDiv'
>
</div>
<div
class=
"layout"
id=
'backFaceDiv'
>
</div>
<form2>
</div>
</div>
</form>
</div>
</body>
</html>
</form2>
<form3>
</form3>
<div
class=
"blank_div clearfix"
></div>
<x:title
title=
"工序设置"
name=
"group"
hideTable=
"#info"
/>
<div
id=
"processListGrid"
style=
"margin: 2px;"
></div>
</form>
</html>
topsun/src/main/java/com/huigou/topsun/product/application/impl/ProductApplicationImpl.java
View file @
e72017b4
...
...
@@ -7,8 +7,6 @@ import com.huigou.topsun.product.domain.*;
import
com.huigou.topsun.product.repository.*
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.stereotype.Service
;
import
java.lang.reflect.Field
;
...
...
@@ -24,7 +22,7 @@ import java.util.stream.Collectors;
* @createDate 2023-11-22 10:24:31
*/
@Service
@RequiredArgsConstructor
//通过构造方法注入 ProductApplication(Class a) { this.a = a; }
@RequiredArgsConstructor
//通过构造方法注入 ProductApplication(Class a) { this.a = a; }
public
class
ProductApplicationImpl
implements
ProductApplication
{
private
final
ProductRepository
productRepository
;
...
...
@@ -85,14 +83,14 @@ public class ProductApplicationImpl implements ProductApplication {
// --------------------------------- 详情查询 ---------------------------------
String
strProductId
=
Long
.
toString
(
productId
);
ProductTypesetConf
typesetConf
=
typesetConfRepository
.
findByProductId
(
strProductId
);
ProductLooked
looked
=
lookedRepository
.
findByProductId
(
strProductId
);
ProductPublishedConf
publishedConf
=
publishedConfRepository
.
findByProductId
(
strProductId
);
ProductLoss
loss
=
lossRepository
.
findByProductId
(
strProductId
);
ArrayList
<
ProductMaterial
>
material
=
(
ArrayList
<
ProductMaterial
>)
materialRepository
.
findByProductId
(
strProductId
);
resultMap
.
put
(
"typesetConf"
,
typesetConf
);
resultMap
.
put
(
"looked"
,
looked
);
resultMap
.
put
(
"publishedConf"
,
publishedConf
);
ArrayList
<
ProductLoss
>
loss
=
(
ArrayList
<
ProductLoss
>)
lossRepository
.
findByProductId
(
strProductId
);
Set
<
Object
>
entitys
=
new
HashSet
<>();
entitys
.
add
(
typesetConfRepository
.
findByProductId
(
strProductId
));
entitys
.
add
(
lookedRepository
.
findByProductId
(
strProductId
));
entitys
.
add
(
publishedConfRepository
.
findByProductId
(
strProductId
));
resultMap
.
putAll
(
assembleResultOfForm
(
entitys
));
resultMap
.
put
(
"loss"
,
loss
);
resultMap
.
put
(
"material"
,
material
);
...
...
@@ -102,13 +100,19 @@ public class ProductApplicationImpl implements ProductApplication {
ProductFace
frontFace
=
faceRepository
.
findByProductFaceIdEquals
(
productDetail
.
getBackProductFaceId
());
ProductFaceColor
fronColor
=
faceColorRepository
.
findByProductFaceIdEquals
(
productDetail
.
getBackProductFaceId
());
resultMap
.
put
(
"frontFace"
,
frontFace
);
resultMap
.
put
(
"fronColor"
,
fronColor
);
resultMap
.
put
(
"fronColor"
,
fronColor
==
null
?
new
ProductFaceColor
()
:
fronColor
);
}
else
{
ProductFaceColor
fc
=
new
ProductFaceColor
();
fc
.
setProductFaceColorId
(
"111"
);
resultMap
.
put
(
"fronColor"
,
fc
);
}
if
(
productDetail
.
getBackProductFaceId
()
!=
null
)
{
ProductFace
backFace
=
faceRepository
.
findByProductFaceIdEquals
(
productDetail
.
getBackProductFaceId
());
ProductFaceColor
backColor
=
faceColorRepository
.
findByProductFaceIdEquals
(
productDetail
.
getBackProductFaceId
());
resultMap
.
put
(
"backFace"
,
backFace
);
resultMap
.
put
(
"backColor"
,
backColor
);
resultMap
.
put
(
"backColor"
,
backColor
==
null
?
new
ProductFaceColor
()
:
backColor
);
}
else
{
resultMap
.
put
(
"backColor"
,
new
ProductFaceColor
());
}
}
ObjectMapper
mapper
=
new
ObjectMapper
();
...
...
@@ -124,6 +128,26 @@ public class ProductApplicationImpl implements ProductApplication {
return
resultMap
;
}
/**
* description 返回页面 Form 所需的数据格式
* @param entitys 所有相关的 实体 (如果需要 update,保留这些实体。提交时候用于比较更新值。)
* @return java.util.HashMap<java.lang.String, java.lang.Object>
* @author qinzhenguan
* @create: 2023/12/5 14:09
*/
public
Map
<
String
,
Object
>
assembleResultOfForm
(
Set
<
Object
>
entitys
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
ObjectMapper
mapper
=
new
ObjectMapper
();
map
.
put
(
"entitys"
,
entitys
);
for
(
Object
item
:
entitys
)
{
if
(
item
==
null
)
{
continue
;
}
map
.
putAll
(
mapper
.
convertValue
(
item
,
Map
.
class
));
}
return
map
;
}
/**
* description
* @param clazz Bean
...
...
@@ -136,7 +160,7 @@ public class ProductApplicationImpl implements ProductApplication {
*/
public
Map
<
Object
,
Object
>
convertToMap
(
Class
<?>
clazz
,
String
displayProperty
,
String
valueProperty
,
List
<?>
list
)
{
Set
<
String
>
set
=
new
HashSet
();
Set
<
String
>
set
=
new
HashSet
<>
();
set
.
add
(
displayProperty
);
set
.
add
(
valueProperty
);
if
(
checkClassesAndProperties
(
clazz
,
set
,
list
.
size
()))
{
...
...
topsun/src/main/java/com/huigou/topsun/product/controller/ProductController.java
View file @
e72017b4
...
...
@@ -81,12 +81,6 @@ public class ProductController extends CommonController {
}
catch
(
JsonProcessingException
e
)
{
throw
new
RuntimeException
(
e
);
}
String
productId
=
param
.
get
(
"productId"
)+
""
;
Map
<
String
,
Object
>
resultMap
=
productService
.
queryDetailAll
(
Integer
.
parseInt
(
productId
));
if
(
resultMap
.
get
(
"detail"
)
!=
null
)
{
resultMap
.
putAll
(
mapper
.
convertValue
(
resultMap
.
get
(
"detail"
),
Map
.
class
));
}
return
forward
(
"productDetail"
,
param
);
}
...
...
@@ -95,9 +89,6 @@ public class ProductController extends CommonController {
SDO
sdo
=
this
.
getSDO
();
String
productId
=
sdo
.
getString
(
"productId"
);
Map
<
String
,
Object
>
resultMap
=
productService
.
queryDetailAll
(
Integer
.
parseInt
(
productId
));
if
(
resultMap
.
get
(
"detail"
)
!=
null
)
{
resultMap
.
putAll
(
mapper
.
convertValue
(
resultMap
.
get
(
"detail"
),
Map
.
class
));
}
return
toResult
(
resultMap
);
}
...
...
topsun/src/main/java/com/huigou/topsun/product/repository/BrandRepository.java
View file @
e72017b4
...
...
@@ -3,5 +3,8 @@ package com.huigou.topsun.product.repository;
import
com.huigou.topsun.product.domain.Brand
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
java.util.List
;
public
interface
BrandRepository
extends
JpaRepository
<
Brand
,
String
>
{
List
<
Brand
>
findByBrandName
(
String
brandName
);
}
topsun/src/main/java/com/huigou/topsun/product/repository/ProductLossRepository.java
View file @
e72017b4
...
...
@@ -3,11 +3,14 @@ package com.huigou.topsun.product.repository;
import
com.huigou.topsun.product.domain.ProductLoss
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
java.util.List
;
/**
* @Auther: xin.lu
* @Date: 2023/11/22/10:42
* @Description:
*/
public
interface
ProductLossRepository
extends
JpaRepository
<
ProductLoss
,
String
>
{
ProductLoss
findByProductId
(
String
productId
);
List
<
ProductLoss
>
findByProductId
(
String
productId
);
}
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