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
7d8fe411
Commit
7d8fe411
authored
Dec 25, 2023
by
wanghang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工具类
parent
0c590a68
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
88 additions
and
8 deletions
+88
-8
technologyAndBom.js
.../biz/topsun/proofing/technologyAndBom/technologyAndBom.js
+3
-3
statsIndicators.js
.../webapp/biz/topsun/sap/statsIndicators/statsIndicators.js
+6
-0
SapStatsIndicatorsApplicationImpl.java
...s/application/impl/SapStatsIndicatorsApplicationImpl.java
+2
-0
SapStatsIndicatorsController.java
...tsIndicators/controller/SapStatsIndicatorsController.java
+1
-1
MyBaseUtil.java
topsun/src/main/java/com/huigou/topsun/util/MyBaseUtil.java
+76
-4
No files found.
topsun-xt/src/main/webapp/biz/topsun/proofing/technologyAndBom/technologyAndBom.js
View file @
7d8fe411
...
@@ -293,13 +293,13 @@ function getTableResult(){
...
@@ -293,13 +293,13 @@ function getTableResult(){
let
processMaterialResult
=
processBomObj
.
gridManager
.
getSelectedRows
();
let
processMaterialResult
=
processBomObj
.
gridManager
.
getSelectedRows
();
if
(
!
technologyResult
){
if
(
!
technologyResult
){
alert
(
"请选择工艺!"
)
Public
.
tip
(
"请选择工艺!"
)
return
false
;
return
false
;
}
else
if
(
processResult
.
length
<
1
){
}
else
if
(
processResult
.
length
<
1
){
alert
(
"请选择工序!"
)
Public
.
tip
(
"请选择工序!"
)
return
false
;
return
false
;
}
else
if
(
processMaterialResult
.
length
<
1
){
}
else
if
(
processMaterialResult
.
length
<
1
){
alert
(
"请选择工序物料!"
)
Public
.
tip
(
"请选择工序物料!"
)
return
false
;
return
false
;
}
}
var
extendedData
=
{};
var
extendedData
=
{};
...
...
topsun-xt/src/main/webapp/biz/topsun/sap/statsIndicators/statsIndicators.js
View file @
7d8fe411
...
@@ -126,6 +126,7 @@ function getExtendedData(processAction) {
...
@@ -126,6 +126,7 @@ function getExtendedData(processAction) {
//不验证
//不验证
$
(
'#submitForm'
).
attr
(
'check'
,
false
);
$
(
'#submitForm'
).
attr
(
'check'
,
false
);
}
}
debugger
const
isAllData
=
$
(
'#oldId'
)
||
!
getId
();
const
isAllData
=
$
(
'#oldId'
)
||
!
getId
();
var
extendedData
=
{};
var
extendedData
=
{};
var
_grid
=
UICtrl
.
getGridManager
(
'#statsIndicatorsDetailGrid'
);
var
_grid
=
UICtrl
.
getGridManager
(
'#statsIndicatorsDetailGrid'
);
...
@@ -136,7 +137,12 @@ function getExtendedData(processAction) {
...
@@ -136,7 +137,12 @@ function getExtendedData(processAction) {
});
});
if
(
!
datas
)
{
if
(
!
datas
)
{
return
false
;
return
false
;
}
else
if
(
datas
.
some
(
item
=>
item
.
ekostl
===
""
&&
item
.
eaufnr
===
""
)){
const
nullItems
=
datas
.
filter
(
item
=>
item
.
ekostl
===
""
&&
item
.
eaufnr
===
""
).
map
(
item
=>
item
.
zlenr
);
Public
.
tip
(
"行号["
+
nullItems
.
join
(
","
)
+
"]成本中心or订单选择一栏填写"
);
return
false
;
}
}
extendedData
.
statsIndicatorsDetail
=
Public
.
encodeJSONURI
(
datas
);
extendedData
.
statsIndicatorsDetail
=
Public
.
encodeJSONURI
(
datas
);
}
}
return
extendedData
;
return
extendedData
;
...
...
topsun/src/main/java/com/huigou/topsun/sap/statsIndicators/application/impl/SapStatsIndicatorsApplicationImpl.java
View file @
7d8fe411
...
@@ -86,6 +86,8 @@ public class SapStatsIndicatorsApplicationImpl extends FlowBroker implements Sa
...
@@ -86,6 +86,8 @@ public class SapStatsIndicatorsApplicationImpl extends FlowBroker implements Sa
sapStatsIndicatorsRepository
.
save
(
sapStatsIndicators
);
sapStatsIndicatorsRepository
.
save
(
sapStatsIndicators
);
//远程调用sap接口
//远程调用sap接口
List
<
SapStatsIndicatorsDetail
>
all
=
sapStatsIndicatorsDetailRepository
.
findAllByStatsIndicatorsId
(
bizId
);
}
}
...
...
topsun/src/main/java/com/huigou/topsun/sap/statsIndicators/controller/SapStatsIndicatorsController.java
View file @
7d8fe411
...
@@ -47,7 +47,7 @@ public class SapStatsIndicatorsController extends CommonController {
...
@@ -47,7 +47,7 @@ public class SapStatsIndicatorsController extends CommonController {
sapStatsIndicators
.
setStatusId
(
BizBillStatus
.
APPLYING
.
getId
());
sapStatsIndicators
.
setStatusId
(
BizBillStatus
.
APPLYING
.
getId
());
Operator
operator
=
getOperator
();
//获取当前操作员的详情信息
Operator
operator
=
getOperator
();
//获取当前操作员的详情信息
sapStatsIndicators
.
setDefaultValues
(
new
OrgUnit
(
operator
.
getFullId
(),
operator
.
getFullName
()));
sapStatsIndicators
.
setDefaultValues
(
new
OrgUnit
(
operator
.
getFullId
(),
operator
.
getFullName
()));
return
forward
(
"statsIndicators"
);
return
forward
(
"statsIndicators"
,
sapStatsIndicators
);
}
}
...
...
topsun/src/main/java/com/huigou/topsun/util/MyBaseUtil.java
View file @
7d8fe411
...
@@ -6,9 +6,11 @@ import com.huigou.topsun.proofing.domain.workInstruction.model.WorkInstructionMa
...
@@ -6,9 +6,11 @@ import com.huigou.topsun.proofing.domain.workInstruction.model.WorkInstructionMa
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.FatalBeanException
;
import
org.springframework.beans.FatalBeanException
;
import
java.beans.Introspector
;
import
java.beans.PropertyDescriptor
;
import
java.beans.PropertyDescriptor
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
public
class
MyBaseUtil
{
public
class
MyBaseUtil
{
...
@@ -29,6 +31,7 @@ public class MyBaseUtil {
...
@@ -29,6 +31,7 @@ public class MyBaseUtil {
/**
/**
* 获取源对象中为空的属性名数组。
* 获取源对象中为空的属性名数组。
*
* @param source 源对象,用于获取属性名和属性值
* @param source 源对象,用于获取属性名和属性值
* @return 空属性名数组
* @return 空属性名数组
*/
*/
...
@@ -46,12 +49,79 @@ public class MyBaseUtil {
...
@@ -46,12 +49,79 @@ public class MyBaseUtil {
}
}
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
FatalBeanException
(
"
Could not copy properties from source to target
"
,
ex
);
throw
new
FatalBeanException
(
"
无法将属性从源对象复制到目标对象
"
,
ex
);
}
}
}
}
return
nullAndEmptyPropertyNames
;
return
nullAndEmptyPropertyNames
;
}
}
/**
* 将多个Bean对象转换为Map<String, Object>类型。
*
* @param beans 要转换的Bean对象数组
* @return 包含Bean属性名和属性值的Map
*/
public
static
Map
<
String
,
Object
>
convertBeansToMap
(
Object
...
beans
)
{
int
estimatedSize
=
0
;
for
(
Object
bean
:
beans
)
{
if
(
bean
!=
null
)
{
estimatedSize
+=
getNonNullPropertiesCount
(
bean
);
}
}
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>(
estimatedSize
);
for
(
Object
bean
:
beans
)
{
if
(
bean
!=
null
)
{
processNonNullProperties
(
bean
,
map
);
}
}
return
map
;
}
/**
* 获取Bean的非空属性数量。
*
* @param bean 要检查的Bean对象
* @return 非空属性的数量
*/
private
static
int
getNonNullPropertiesCount
(
Object
bean
)
{
int
count
=
0
;
try
{
for
(
java
.
beans
.
PropertyDescriptor
propertyDescriptor
:
java
.
beans
.
Introspector
.
getBeanInfo
(
bean
.
getClass
()).
getPropertyDescriptors
())
{
Object
propertyValue
=
propertyDescriptor
.
getReadMethod
().
invoke
(
bean
);
if
(
propertyValue
!=
null
&&
!
propertyValue
.
toString
().
isEmpty
())
{
count
++;
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
count
;
}
/**
* 处理Bean的非空属性,并将其添加到Map中。
* 排除class属性。
*
* @param bean 要处理的Bean对象
* @param map 存储属性名和属性值的Map
*/
private
static
void
processNonNullProperties
(
Object
bean
,
Map
<
String
,
Object
>
map
)
{
try
{
for
(
PropertyDescriptor
propertyDescriptor
:
Introspector
.
getBeanInfo
(
bean
.
getClass
()).
getPropertyDescriptors
())
{
String
propertyName
=
propertyDescriptor
.
getName
();
if
(!
propertyName
.
equals
(
"class"
))
{
// 排除class属性
Object
propertyValue
=
propertyDescriptor
.
getReadMethod
().
invoke
(
bean
);
if
(
propertyValue
!=
null
&&
!
propertyValue
.
toString
().
isEmpty
())
{
map
.
put
(
propertyName
,
propertyValue
);
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
@@ -61,10 +131,12 @@ public class MyBaseUtil {
...
@@ -61,10 +131,12 @@ public class MyBaseUtil {
workInstructionMaterialInfo
.
setBomNo
(
"hhhh"
);
workInstructionMaterialInfo
.
setBomNo
(
"hhhh"
);
WorkInstructionBaseInfo
workInstructionBaseInfo
=
new
WorkInstructionBaseInfo
();
WorkInstructionBaseInfo
workInstructionBaseInfo
=
new
WorkInstructionBaseInfo
();
workInstructionBaseInfo
.
setBrand
(
"wwwwww"
);
workInstructionBaseInfo
.
setBrand
(
"wwwwww"
);
MyBaseUtil
.
mergeObjects
(
workInstructionVo
,
workInstructionMaterialInfo
,
workInstructionBaseInfo
,
null
);
M
yBaseUtil
.
mergeObjects
(
workInstructionVo
,
workInstructionMaterialInfo
,
workInstructionBaseInfo
,
null
);
M
ap
<
String
,
Object
>
map
=
MyBaseUtil
.
convertBeansToMap
(
workInstructionMaterialInfo
);
System
.
out
.
println
(
""
);
MyBaseUtil
.
processNonNullProperties
(
workInstructionBaseInfo
,
map
);
System
.
out
.
println
(
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