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
34c8ef14
Commit
34c8ef14
authored
Apr 19, 2024
by
刘学辉
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
fca1c9db
ab983894
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
244 additions
and
3359 deletions
+244
-3359
job.jsp
huigou-xt/src/main/webapp/WEB-INF/decorators/job.jsp
+4
-4
job.js
huigou-xt/src/main/webapp/system/bpm/job.js
+24
-23
codeRuleList.jsp
...src/main/webapp/biz/topsun/base/codeRule/codeRuleList.jsp
+0
-1
purchaseCommon.js
...un-xt/src/main/webapp/biz/topsun/common/purchaseCommon.js
+0
-55
salesOrderList.jsp
.../main/webapp/biz/topsun/sap/salesOrder/salesOrderList.jsp
+0
-1
wasteSaleDetail.js
...c/main/webapp/biz/topsun/sap/wasteSale/wasteSaleDetail.js
+16
-0
wasteSaleList.js
...src/main/webapp/biz/topsun/sap/wasteSale/wasteSaleList.js
+2
-2
sapWorkCenter.js
...rc/main/webapp/biz/topsun/sap/workCenter/sapWorkCenter.js
+0
-77
sapWorkCenter.jsp
...c/main/webapp/biz/topsun/sap/workCenter/sapWorkCenter.jsp
+0
-26
sapWorkCenterDetail.js
...n/webapp/biz/topsun/sap/workCenter/sapWorkCenterDetail.js
+0
-38
sapWorkCenterDetail.jsp
.../webapp/biz/topsun/sap/workCenter/sapWorkCenterDetail.jsp
+0
-169
AppConfig.java
topsun/src/main/java/com/huigou/topsun/config/AppConfig.java
+0
-1
SapAcceptanceFormAckApplicationImpl.java
...application/impl/SapAcceptanceFormAckApplicationImpl.java
+0
-1
SapPermitApplication.java
...u/topsun/sap/permit/application/SapPermitApplication.java
+3
-0
SapPermitApplicationImpl.java
...sap/permit/application/impl/SapPermitApplicationImpl.java
+75
-12
SapPermitItem.java
...va/com/huigou/topsun/sap/permit/domain/SapPermitItem.java
+1
-1
SapPermitItemVo.java
...java/com/huigou/topsun/sap/permit/vo/SapPermitItemVo.java
+37
-0
SapPermitVo.java
...ain/java/com/huigou/topsun/sap/permit/vo/SapPermitVo.java
+45
-0
WasteSaleApplicationImpl.java
.../wasteSale/application/impl/WasteSaleApplicationImpl.java
+37
-1
SapWorkCenterApplication.java
.../sap/workcenter/application/SapWorkCenterApplication.java
+0
-23
SapWorkCenterLogApplication.java
...p/workcenter/application/SapWorkCenterLogApplication.java
+0
-11
SysChangeRecordApplication.java
...ap/workcenter/application/SysChangeRecordApplication.java
+0
-11
SapWorkCenterApplicationImpl.java
...center/application/impl/SapWorkCenterApplicationImpl.java
+0
-122
SapWorkCenterLogApplicationImpl.java
...ter/application/impl/SapWorkCenterLogApplicationImpl.java
+0
-20
SysChangeRecordApplicationImpl.java
...nter/application/impl/SysChangeRecordApplicationImpl.java
+0
-20
SapWorkCenterLogController.java
...sap/workcenter/controller/SapWorkCenterLogController.java
+0
-101
SapWorkCenter.java
...om/huigou/topsun/sap/workcenter/domain/SapWorkCenter.java
+0
-916
SapWorkCenterLog.java
...huigou/topsun/sap/workcenter/domain/SapWorkCenterLog.java
+0
-939
SysChangeRecord.java
.../huigou/topsun/sap/workcenter/domain/SysChangeRecord.java
+0
-195
SapWorkCenterLogRepository.java
...sap/workcenter/repository/SapWorkCenterLogRepository.java
+0
-12
SapWorkCenterRepository.java
...un/sap/workcenter/repository/SapWorkCenterRepository.java
+0
-11
SysChangeRecordRepository.java
.../sap/workcenter/repository/SysChangeRecordRepository.java
+0
-12
EntityConvertUtil.java
...c/main/java/com/huigou/topsun/util/EntityConvertUtil.java
+0
-202
PersistTool.java
topsun/src/main/java/com/huigou/topsun/util/PersistTool.java
+0
-125
Snowflake.java
topsun/src/main/java/com/huigou/topsun/util/Snowflake.java
+0
-71
TestClientHttp.java
.../src/main/java/com/huigou/topsun/util/TestClientHttp.java
+0
-68
TestSnowflake.java
...n/src/main/java/com/huigou/topsun/util/TestSnowflake.java
+0
-88
No files found.
huigou-xt/src/main/webapp/WEB-INF/decorators/job.jsp
View file @
34c8ef14
...
...
@@ -68,10 +68,10 @@
</c:if>
</div>
<c:if
test=
"
${
useRightHandlerPage
!=
false
}
"
>
<%-- <div position="right" id="jobPageRight">--%
>
<%-- <x:title title="job.task.relations" name="group"/>--%
>
<%-- <div id="showHiTaskinstRelations" class="dom-overflow-auto"></div>--%
>
<%-- </div>--%
>
<div
position=
"right"
id=
"jobPageRight"
>
<x:title
title=
"job.task.relations"
name=
"group"
/
>
<div
id=
"showHiTaskinstRelations"
class=
"dom-overflow-auto"
></div
>
</div
>
</c:if>
</div>
</div>
...
...
huigou-xt/src/main/webapp/system/bpm/job.js
View file @
34c8ef14
...
...
@@ -11,7 +11,7 @@ $(document).ready(function () {
refreshBtnStatus
();
bindJobPageEvent
();
//绑定事件
initFloatHandleDialog
();
//初始化快捷处理对话框
//
initHiTaskinstRelations(); //初始化关联任务显示
initHiTaskinstRelations
();
//初始化关联任务显示
function
initTaskDetailParameters
()
{
/**
...
...
@@ -1393,26 +1393,27 @@ function doRelate() {
* 初始化关联任务显示
* **/
function
initHiTaskinstRelations
()
{
$
(
"#jobPageRight"
).
hide
();
if
(
!
$
(
'#jobPageRight'
).
length
)
return
;
queryHiTaskinstRelations
(
function
(
data
)
{
showHiTaskinstRelations
(
data
[
'Rows'
]
||
data
);
});
//绑定关联任务点击事件
$
(
'#showHiTaskinstRelations'
).
on
(
'click'
,
function
(
e
)
{
var
$clicked
=
$
(
e
.
target
||
e
.
srcElement
);
if
(
$clicked
.
is
(
'a'
))
{
var
id
=
$clicked
.
attr
(
'id'
),
task
=
pageHiTaskinstRelations
[
id
];
if
(
task
)
{
browseTask
(
task
);
}
else
{
var
url
=
$clicked
.
data
(
'url'
);
if
(
Public
.
isNotBlank
(
url
))
{
UICtrl
.
addTabItem
({
tabid
:
$clicked
.
attr
(
'id'
),
text
:
$clicked
.
data
(
'name'
),
url
:
web_app
.
name
+
url
});
}
}
}
});
setHiTaskinstRelationsHeight
();
//
queryHiTaskinstRelations(function (data) {
//
showHiTaskinstRelations(data['Rows']||data);
//
});
//
//
绑定关联任务点击事件
//
$('#showHiTaskinstRelations').on('click', function (e) {
//
var $clicked = $(e.target || e.srcElement);
//
if ($clicked.is('a')) {
//
var id = $clicked.attr('id'), task = pageHiTaskinstRelations[id];
//
if (task) {
//
browseTask(task);
//
}else{
//
var url=$clicked.data('url');
//
if (Public.isNotBlank(url)) {
//
UICtrl.addTabItem({tabid: $clicked.attr('id'),text:$clicked.data('name'),url:web_app.name+url});
//
}
//
}
//
}
//
});
//
setHiTaskinstRelationsHeight();
checkRightCollapse
();
}
...
...
@@ -1428,9 +1429,9 @@ function checkRightCollapse(){
_isHideRight
=
false
;
}
//正在审批中需要显示
if
(
$
(
'#handleOpinion'
).
length
>
0
){
_isHideRight
=
false
;
}
//
if($('#handleOpinion').length > 0){
//
_isHideRight=false;
//
}
$
(
"#jobPageLayout"
).
layout
(
'setRightCollapse'
,
_isHideRight
);
}
...
...
topsun-xt/src/main/webapp/biz/topsun/base/codeRule/codeRuleList.jsp
View file @
34c8ef14
...
...
@@ -5,7 +5,6 @@
<head>
<x:base
include=
"layout,dialog,grid,tree,combox,commonTree"
/>
<x:script
src=
'/system/opm/js/OpmUtil.js'
/>
<x:script
src=
'/biz/topsun/common/purchaseCommon.js'
/>
<x:script
src=
'/biz/topsun/base/codeRule/codeRuleList.js'
/>
</head>
<body>
...
...
topsun-xt/src/main/webapp/biz/topsun/common/purchaseCommon.js
deleted
100644 → 0
View file @
fca1c9db
var
ssrfOrgRootId
=
'SSRFProject'
;
function
bindQueryEvent
(){
$
(
'#budgetCode'
).
searchbox
({
type
:
"hx"
,
name
:
"budgetCodeChoose"
,
onChange
:
function
(
value
,
data
){
$
(
'#budgetCode'
).
val
(
data
.
code
);
}
});
/*$('#responsiblePersonName').orgTree({
searchType: 'tech', searchName: 'techOrgSearch',
filter: "psm", excludePos: 1, param: {orgKindId: "ogn,dpt,pos,psm"},
onChange: function (value,data) {
$('#responsiblePersonId').val(data.personId);
$('#responsiblePersonName').val(data.name);
}
});*/
//所属系统选择
$
(
'#chooseSystemName'
).
orgTree
({
searchType
:
'tech'
,
searchName
:
'techOrgSearch'
,
filter
:
"dpt"
,
excludePos
:
1
,
param
:
{
orgKindId
:
"ogn,dpt"
,
orgRoot
:
ssrfOrgRootId
,
showVirtualOrg
:
'1'
},
onChange
:
function
(
value
,
data
)
{
$
(
'#systemId'
).
val
(
data
.
id
);
$
(
'#systemFullId'
).
val
(
data
.
fullId
);
$
(
'#chooseSystemName'
).
val
(
data
.
name
);
}
});
}
function
bindChooseSystemName
(){
//所属系统选择
$
(
'#chooseSystemName'
).
orgTree
({
searchType
:
'tech'
,
searchName
:
'techOrgSearch'
,
filter
:
"dpt"
,
excludePos
:
1
,
param
:
{
orgKindId
:
"ogn,dpt"
,
orgRoot
:
ssrfOrgRootId
,
showVirtualOrg
:
'1'
},
onChange
:
function
(
value
,
data
)
{
$
(
'#systemId'
).
val
(
data
.
id
);
$
(
'#systemFullId'
).
val
(
data
.
fullId
);
$
(
'#chooseSystemName'
).
val
(
data
.
name
);
if
(
!
data
.
id
)
{
$
(
'#collectivityId'
).
val
(
''
);
$
(
'#collectivityName'
).
val
(
''
);
$
(
'#subCollectivityId'
).
val
(
''
);
$
(
'#subCollectivityName'
).
val
(
''
);
return
;
}
Public
.
ajax
(
web_app
.
name
+
"/hxPurchaseApproval/queryBudgetOrgInfo.ajax"
,
{
fullId
:
data
.
fullId
},
function
(
v
)
{
$
(
'#collectivityId'
).
val
(
v
.
collectivityId
);
$
(
'#collectivityName'
).
val
(
v
.
collectivityName
);
$
(
'#subCollectivityId'
).
val
(
v
.
subCollectivityId
);
$
(
'#subCollectivityName'
).
val
(
v
.
subCollectivityName
);
});
}
});
}
\ No newline at end of file
topsun-xt/src/main/webapp/biz/topsun/sap/salesOrder/salesOrderList.jsp
View file @
34c8ef14
...
...
@@ -5,7 +5,6 @@
<head>
<x:base
include=
"layout,dialog,grid,tree,dateTime,combox,commonTree"
/>
<x:script
src=
'/system/opm/js/OpmUtil.js'
/>
<x:script
src=
'/biz/topsun/common/purchaseCommon.js'
/>
<x:script
src=
'/biz/topsun/sap/salesOrder/salesOrderList.js'
/>
</head>
<body>
...
...
topsun-xt/src/main/webapp/biz/topsun/sap/wasteSale/wasteSaleDetail.js
View file @
34c8ef14
...
...
@@ -205,6 +205,22 @@ function getExtendedData(processAction) {
return
extendedData
;
}
//提交前校验
function
checkConstraints
()
{
var
_grid
=
UICtrl
.
getGridManager
(
'#maingrid'
);
if
(
_grid
)
{
var
datas
=
DataUtil
.
getGridData
({
gridManager
:
_grid
,
isAllData
:
true
});
if
(
datas
.
length
<
1
)
{
Public
.
tip
(
"请添加出售物品"
);
return
false
;
}
}
return
true
;
}
//UICtrl中校验是否允许编辑
function
businessJudgmentUnit
()
{
var
isApply
=
''
;
...
...
topsun-xt/src/main/webapp/biz/topsun/sap/wasteSale/wasteSaleList.js
View file @
34c8ef14
...
...
@@ -60,7 +60,7 @@ function resetForm(obj) {
function
addHandler
()
{
UICtrl
.
addTabItem
({
tabid
:
'
epSaleOrder
'
,
tabid
:
'
wasteSale
'
,
text
:
"新增废品销售单"
,
url
:
web_app
.
name
+
'/wasteSale/forwardWasteSaleDetail.job'
});
...
...
@@ -68,7 +68,7 @@ function addHandler() {
function
doView
(
id
)
{
UICtrl
.
addTabItem
({
tabid
:
'
epSaleOrder
'
+
id
,
tabid
:
'
wasteSale
'
+
id
,
text
:
"查看废品销售单"
,
url
:
web_app
.
name
+
'/wasteSale/showWasteSaleDetail.job?bizId='
+
id
+
"&isReadOnly=true"
});
...
...
topsun-xt/src/main/webapp/biz/topsun/sap/workCenter/sapWorkCenter.js
deleted
100644 → 0
View file @
fca1c9db
var
workCenterGridManager
=
null
;
$
(
document
).
ready
(
function
()
{
loadSapWorkCenterGrid
();
});
function
loadSapWorkCenterGrid
()
{
let
toolbarOptions
=
UICtrl
.
getDefaultToolbarOptions
({
addHandler
:
function
(){
addHandler
();
},
updateHandler
:
function
(){
updateHandler
();
}
});
workCenterGridManager
=
UICtrl
.
grid
(
"#sapWorkCenterGrid"
,
{
columns
:
[
{
display
:
"填写说明"
,
name
:
"productName"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"维护标识"
,
name
:
"productCategoryId"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"工厂"
,
name
:
"werks"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"工作中心"
,
name
:
"apbpl"
,
width
:
100
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"工作中心描述"
,
name
:
"stext"
,
width
:
150
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"工作中心类别"
,
name
:
"verwe"
,
width
:
100
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"工作中心负责人"
,
name
:
"veran"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"用途a"
,
name
:
"a"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"反冲"
,
name
:
"rgekz"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"标准值码"
,
name
:
"vorgschl"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"控制码"
,
name
:
"steus"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"成本控制范围b"
,
name
:
"b"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"成本中心"
,
name
:
"kostl"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"成本中心描述c"
,
name
:
"c"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"定员d"
,
name
:
"d"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"生产速度e"
,
name
:
"e"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"速度单位f"
,
name
:
"f"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"消息类型"
,
name
:
"type"
,
width
:
100
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"消息文本"
,
name
:
"message"
,
width
:
200
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
],
dataType
:
"server"
,
url
:
web_app
.
name
+
'/sapWorkCenter/findWorkCenter.ajax'
,
pageSize
:
20
,
usePager
:
true
,
toolbar
:
toolbarOptions
,
enabledEdit
:
true
,
width
:
"80%"
,
height
:
"100%"
,
heightDiff
:
-
8
,
checkbox
:
true
,
fixedCellHeight
:
true
,
selectRowButtonOnly
:
true
,
onDblClickRow
:
function
(
data
,
rowindex
,
rowobj
)
{
updateHandler
(
data
);
}
});
UICtrl
.
setSearchAreaToggle
(
workCenterGridManager
);
}
function
updateHandler
(
data
)
{
if
(
!
data
)
{
data
=
DataUtil
.
getSelectedRow
(
workCenterGridManager
);
}
if
(
!
data
)
{
Public
.
tip
(
'请勾选需要修改的数据!'
);
return
;
}
// 更新标识: I 插入; U 修改; D 删除
data
.
updkz
=
'U'
;
let
url
=
DataUtil
.
composeURLByParam
(
'/sapWorkCenter/forwardWorkCenterDetail.do'
,
data
);
UICtrl
.
addTabItem
({
tabid
:
'workCenterEdit'
+
new
Date
().
getTime
(),
text
:
"AAAA"
,
url
:
url
});
}
function
addHandler
()
{
let
data
=
{};
// 更新标识: I 插入; U 修改; D 删除
data
.
updkz
=
'I'
;
let
url
=
DataUtil
.
composeURLByParam
(
'/sapWorkCenter/forwardWorkCenterDetail.do'
,
data
);
UICtrl
.
addTabItem
({
tabid
:
'workCenterAdd'
+
new
Date
().
getTime
(),
text
:
"AAAA"
,
url
:
url
});
}
\ No newline at end of file
topsun-xt/src/main/webapp/biz/topsun/sap/workCenter/sapWorkCenter.jsp
deleted
100644 → 0
View file @
fca1c9db
<%--
Created by IntelliJ IDEA.
User: qinzhenguan
Date: 2024/1/16
Time: 14:33
To change this template use File | Settings | File Templates.
--%>
<%@ 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"
%>
<html>
<head>
<title>
Title
</title>
<x:base
include=
"layout,dialog,grid,tree,combox,commonTree"
/>
<x:script
src=
'/system/opm/js/OpmUtil.js'
/>
<x:script
src=
'/biz/topsun/common/purchaseCommon.js'
/>
<x:script
src=
'/biz/topsun/sap/workCenter/sapWorkCenter.js'
/>
</head>
<body>
<div
position=
"center"
title=
"工作中心"
>
<div
id=
"sapWorkCenterGrid"
style=
"margin: 2px;"
></div>
</div>
</body>
</html>
topsun-xt/src/main/webapp/biz/topsun/sap/workCenter/sapWorkCenterDetail.js
deleted
100644 → 0
View file @
fca1c9db
$
(
document
).
ready
(
function
()
{
initializeToobarContainer
();
});
function
save
()
{
let
process
=
$
(
'#submitForm'
).
formToJSON
({
check
:
true
});
if
(
!
process
)
{
return
false
;
}
let
_self
=
this
;
$
(
'#submitForm'
).
ajaxSubmit
({
url
:
web_app
.
name
+
'/sapWorkCenter/saveWorkCenterDetail.ajax'
,
success
:
function
(
data
)
{
$
(
"#id"
).
val
(
data
)
Public
.
successTip
(
"保存成功!"
);
_self
.
close
();
}
});
}
function
initializeToobarContainer
(){
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'
);
}
\ No newline at end of file
topsun-xt/src/main/webapp/biz/topsun/sap/workCenter/sapWorkCenterDetail.jsp
deleted
100644 → 0
View file @
fca1c9db
<%--
Created by IntelliJ IDEA.
User: qinzhenguan
Date: 2024/1/17
Time: 16:33
To change this template use File | Settings | File Templates.
--%>
<%@ 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"
%>
<html>
<head>
<title>
Title
</title>
<x:base
include=
"layout,dialog,grid,tree,combox,commonTree,date"
/>
<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/common/listeningFromData.js'
/>
<x:script
src=
'/biz/topsun/sap/workCenter/sapWorkCenterDetail.js'
/>
<%-- <x:script src='/biz/topsun/product/product.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
;
}
.ui-layout-content
{
height
:
319px
;
}
.checkBoxDiv
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
padding-top
:
5px
;
}
</style>
</head>
<body>
<div
class=
"panelX"
id=
"panelContainer"
>
<%-- <div class="hg-form-cols">--%>
<%-- <div labelCol="15"> </div>--%>
<%-- </div>--%>
<form
class=
"hg-form"
method=
"post"
action=
""
id=
"submitForm"
>
<x:hidden
name=
"id"
/>
<x:hidden
name=
"type"
/>
<x:hidden
name=
"message"
/>
<x:title
title=
"基本属性"
name=
"group"
hideTable=
"#info"
/>
<div
class=
"hg-form-cols"
>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"werks"
required=
"true"
label=
"工厂"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"64"
/>
<x:inputC
name=
"apbpl"
required=
"true"
label=
"工作中心"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"64"
/>
<x:inputC
name=
"verwe"
wrapper=
"select"
label=
"工作中心类型"
id=
"selectedCategory"
labelCol=
"1"
fieldCol=
"3"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"stext"
label=
"工作中心描述"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
wrapper=
"date"
/>
<x:inputC
name=
"planv"
label=
"任务清单使用码"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"veran"
label=
"工作中心负责人"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"rgekz"
label=
"标志:倒冲"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"vorgschl"
label=
"标准值码"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"steus"
label=
"控制码"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"ktext"
label=
"产能短文本"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"kapart"
label=
"能力类别"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"planr"
label=
"产能负责计划员组"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"kalid"
label=
"工厂日历标识"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"meins"
label=
"产能基本计量单位"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"begzt"
label=
"开始时间"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"endzt"
label=
"结束时间"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"ngrad"
label=
"产能利用率"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"aznor"
label=
"单个产能数"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"kapeh"
label=
"产能计量单位"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"kapter"
label=
"标识"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"ueberlast"
label=
"过载"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"fork2"
label=
"产能需求公式"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"kapartJh"
label=
"计划能力类别"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"fort2"
label=
"加工时间的时间期限公式"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"begda"
label=
"开始日期"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"endda"
label=
"结束日期"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"kostl"
label=
"成本中心"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"lstar1"
label=
"活动类型1"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"leinh1"
label=
"作业单位1"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"forml1"
label=
"公式码1"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"lstar2"
label=
"活动类型2"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"leinh2"
label=
"作业单位2"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"forml2"
label=
"公式码2"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"lstar3"
label=
"活动类型3"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"leinh3"
label=
"作业单位3"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"forml3"
label=
"公式码3"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"lstar4"
label=
"活动类型4"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"leinh4"
label=
"作业单位4"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"forml4"
label=
"公式码4"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"lstar5"
label=
"活动类型5"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"leinh5"
label=
"作业单位5"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"forml5"
label=
"公式码5"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"lstar6"
label=
"活动类型6"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"leinh6"
label=
"作业单位6"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"forml6"
label=
"公式码6"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<div
class=
"col-xs-12 col-sm-2 checkBoxDiv"
>
<%-- 白色 col-white-bg--%>
<div><x:checkbox
name=
"isFreeInspection"
label=
"是否免检"
/></div>
</div>
</div>
</div>
</form>
<div
id=
"toolBarCenter"
class=
"panel-footerX"
>
<div
id=
"toolBar"
></div>
</div>
</div>
</body>
</html>
topsun/src/main/java/com/huigou/topsun/config/AppConfig.java
View file @
34c8ef14
package
com
.
huigou
.
topsun
.
config
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.huigou.topsun.util.Snowflake
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
topsun/src/main/java/com/huigou/topsun/sap/acceptanceFormAck/application/impl/SapAcceptanceFormAckApplicationImpl.java
View file @
34c8ef14
...
...
@@ -12,7 +12,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import
com.huigou.topsun.sap.acceptanceFormAck.application.SapAcceptanceFormAckApplication
;
import
com.huigou.topsun.sap.acceptanceFormAck.domain.SapAcceptanceFormAck
;
import
com.huigou.topsun.sap.common.HttpClient
;
import
com.huigou.topsun.util.TestClientHttp
;
import
com.huigou.util.JSONUtil
;
import
com.huigou.util.SDO
;
import
lombok.RequiredArgsConstructor
;
...
...
topsun/src/main/java/com/huigou/topsun/sap/permit/application/SapPermitApplication.java
View file @
34c8ef14
...
...
@@ -5,6 +5,7 @@ import com.huigou.topsun.sap.fixedAssets.domain.TmpFixedRetirementData;
import
com.huigou.topsun.sap.fixedAssets.domain.query.SapFixedRetirementQueryRequest
;
import
com.huigou.topsun.sap.permit.domain.SapPermit
;
import
com.huigou.topsun.sap.permit.domain.query.SapPermitQueryRequest
;
import
com.huigou.topsun.sap.permit.vo.SapPermitVo
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -26,4 +27,6 @@ public interface SapPermitApplication {
void
deleteByIds
(
List
<
String
>
ids
);
// List<TmpPermitData> importExcelData(String batchNumber) ;
void
saveSapPermitVo
(
SapPermitVo
sapPermitVo
);
}
topsun/src/main/java/com/huigou/topsun/sap/permit/application/impl/SapPermitApplicationImpl.java
View file @
34c8ef14
package
com
.
huigou
.
topsun
.
sap
.
permit
.
application
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.huigou.cache.DictUtil
;
import
com.huigou.context.Operator
;
import
com.huigou.context.OrgUnit
;
import
com.huigou.context.ThreadLocalUtil
;
import
com.huigou.data.query.model.QueryDescriptor
;
import
com.huigou.data.query.model.QueryModel
;
import
com.huigou.topsun.base.coderule.application.CodeRuleApplication
;
import
com.huigou.topsun.sap.fixedAssets.domain.SapRetirement
;
import
com.huigou.topsun.sap.fixedAssets.domain.SapRetirementItem
;
import
com.huigou.topsun.sap.permit.application.SapPermitApplication
;
import
com.huigou.topsun.sap.permit.application.SapPermitItemApplication
;
import
com.huigou.topsun.sap.permit.domain.SapPermit
;
...
...
@@ -15,18 +15,30 @@ import com.huigou.topsun.sap.permit.domain.SapPermitItem;
import
com.huigou.topsun.sap.permit.domain.query.SapPermitQueryRequest
;
import
com.huigou.topsun.sap.permit.repository.SapPermitItemRepository
;
import
com.huigou.topsun.sap.permit.repository.SapPermitRepository
;
import
com.huigou.topsun.sap.suppliers.domain.SuppliersInfo
;
import
com.huigou.topsun.sap.permit.vo.SapPermitItemVo
;
import
com.huigou.topsun.sap.permit.vo.SapPermitVo
;
import
com.huigou.uasp.bmp.common.BizBillStatus
;
import
com.huigou.uasp.bmp.
doc.attachment.application.Attachment
Application
;
import
com.huigou.uasp.bmp.
operator.Operator
Application
;
import
com.huigou.uasp.bpm.FlowBroker
;
import
com.huigou.uasp.bpm.ProcessAction
;
import
com.huigou.uasp.bpm.ProcessStartModel
;
import
com.huigou.uasp.bpm.engine.application.WorkflowApplication
;
import
com.huigou.util.ClassHelper
;
import
com.huigou.util.Constants
;
import
com.huigou.util.JSONUtil
;
import
com.huigou.util.SDO
;
import
org.activiti.engine.delegate.DelegateExecution
;
import
org.activiti.engine.delegate.DelegateTask
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @Auther: Lxh
...
...
@@ -41,13 +53,10 @@ public class SapPermitApplicationImpl extends FlowBroker implements SapPermitApp
private
SapPermitItemRepository
sapPermitItemRepository
;
@Autowired
private
SapPermitItemApplication
sapPermitItemApplication
;
// @Autowired
// private SapPermitItemRepository sapPermitItemRepository;
@Autowired
private
AttachmentApplication
attachment
Application
;
private
WorkflowApplication
workflow
Application
;
@Autowired
private
CodeRuleApplication
codeRule
Application
;
private
OperatorApplication
operator
Application
;
@Override
public
Map
<
String
,
Object
>
getPermitList
(
SapPermitQueryRequest
queryRequest
)
{
QueryDescriptor
queryDescriptor
=
this
.
sqlExecutorDao
.
getQuery
(
QUERY_XML_FILE_PATH
,
"sapPermit"
);
...
...
@@ -158,6 +167,60 @@ public class SapPermitApplicationImpl extends FlowBroker implements SapPermitApp
return
permit
.
getId
();
}
@Override
public
void
saveSapPermitVo
(
SapPermitVo
sapPermitVo
){
SapPermit
sapPermit
=
new
SapPermit
();
BeanUtil
.
copyProperties
(
sapPermitVo
,
sapPermit
);
//初始化用户信息
Operator
operator
=
operatorApplication
.
createOperatorByPersonMemberId
(
sapPermitVo
.
getApplyPerson
());
sapPermit
.
setDefaultValues
(
new
OrgUnit
(
operator
.
getFullId
(),
operator
.
getFullName
()));
Map
<
String
,
Object
>
formData
=
BeanUtil
.
beanToMap
(
sapPermit
);
//保存明细
List
<
SapPermitItemVo
>
itemVos
=
sapPermitVo
.
getItemVos
();
List
<
SapPermitItem
>
sapPermitItems
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
itemVos
)){
sapPermitItems
=
itemVos
.
stream
()
.
map
(
itemVo
->
{
SapPermitItem
sapPermitItem
=
new
SapPermitItem
();
BeanUtil
.
copyProperties
(
itemVo
,
sapPermitItem
);
return
sapPermitItem
;
}).
collect
(
Collectors
.
toList
());
formData
.
put
(
"items"
,
JSONUtil
.
toString
(
sapPermitItems
));
//启动流程实例
this
.
startProcessInstance
(
SapPermitApplication
.
PROCESS_DEFINITION_KEY
,
formData
);
//sapPermit.setId(bizId);
//this.sapPermitRepository.save(sapPermit);
}
}
public
String
startProcessInstance
(
String
processDefinitionKey
,
Map
<
String
,
Object
>
formData
){
Map
<
String
,
Object
>
variables
=
new
HashMap
();
SDO
localSdo
=
this
.
buildSDO
(
formData
);
ThreadLocalUtil
.
putVariable
(
Constants
.
SDO
,
localSdo
);
variables
.
put
(
"startModel"
,
ProcessStartModel
.
MANUAL
.
getId
());
Operator
operator
=
localSdo
.
getOperator
();
variables
.
put
(
"executorFullId"
,
operator
.
getFullId
());
variables
.
put
(
"executorFullName"
,
operator
.
getFullName
());
ThreadLocalUtil
.
putOperator
(
operator
);
ThreadLocalUtil
.
putVariable
(
"client.ip"
,
"127.0.0.1"
);
ProcessInstance
processInstance
=
this
.
workflowApplication
.
startProcessInstanceByKey
(
processDefinitionKey
,
variables
);
String
businessKey
=
processInstance
.
getBusinessKey
();
return
businessKey
;
}
private
SDO
buildSDO
(
Map
<
String
,
Object
>
formData
)
{
String
createdById
=
(
String
)
formData
.
get
(
"applyPerson"
);
Operator
operator
=
operatorApplication
.
createOperatorByPersonMemberId
(
createdById
);
SDO
localSdo
=
new
SDO
();
// 将业务数据传递给工作流
formData
.
forEach
(
localSdo:
:
putProperty
);
// 将业务流程信息传递给工作流
localSdo
.
putProperty
(
"processAction"
,
ProcessAction
.
SAVE
);
localSdo
.
putProperty
(
"procUnitId"
,
"Apply"
);
localSdo
.
setOperator
(
operator
);
return
localSdo
;
}
}
topsun/src/main/java/com/huigou/topsun/sap/permit/domain/SapPermitItem.java
View file @
34c8ef14
...
...
@@ -34,7 +34,7 @@ public class SapPermitItem extends AbstractEntity {
* 数量
*/
@Column
(
name
=
"quantity"
)
private
Integer
quantity
;
private
BigDecimal
quantity
;
/**
* 单位
...
...
topsun/src/main/java/com/huigou/topsun/sap/permit/vo/SapPermitItemVo.java
0 → 100644
View file @
34c8ef14
package
com
.
huigou
.
topsun
.
sap
.
permit
.
vo
;
import
lombok.Data
;
import
java.math.BigDecimal
;
/**
* SAP放行条
*
* @TableName sap_permit_item
*/
@Data
public
class
SapPermitItemVo
{
/**
* 携带物名称
*/
private
String
belongings
;
/**
* 数量
*/
private
BigDecimal
quantity
;
/**
* 单位
*/
private
String
unit
;
/**
* 备注
*/
private
String
remark
;
}
\ No newline at end of file
topsun/src/main/java/com/huigou/topsun/sap/permit/vo/SapPermitVo.java
0 → 100644
View file @
34c8ef14
package
com
.
huigou
.
topsun
.
sap
.
permit
.
vo
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.List
;
/**
* @Auther: xin.lu
* @Date: 2024/04/17/17:08
* @Description:
*/
@Data
public
class
SapPermitVo
{
/**
* 公司
*/
private
String
company
;
/**
* 责任部门
*/
private
String
dutyDepart
;
private
String
dutyDepartName
;
/**
* 申请人
*/
private
String
applyPerson
;
private
String
applyPersonName
;
/**
* 携出人
*/
private
String
belongPerson
;
/**
* 日期
*/
private
Date
permitDate
;
List
<
SapPermitItemVo
>
itemVos
;
}
topsun/src/main/java/com/huigou/topsun/sap/wasteSale/application/impl/WasteSaleApplicationImpl.java
View file @
34c8ef14
...
...
@@ -8,6 +8,9 @@ import com.huigou.data.query.model.QueryModel;
import
com.huigou.topsun.sap.common.HttpClient
;
import
com.huigou.topsun.sap.common.domain.SapResult
;
import
com.huigou.topsun.sap.costReimbursement.domain.SapCostReimbursement
;
import
com.huigou.topsun.sap.permit.application.SapPermitApplication
;
import
com.huigou.topsun.sap.permit.vo.SapPermitItemVo
;
import
com.huigou.topsun.sap.permit.vo.SapPermitVo
;
import
com.huigou.topsun.sap.wasteSale.domain.WasteSale
;
import
com.huigou.topsun.sap.wasteSale.domain.WasteSaleItem
;
import
com.huigou.topsun.sap.wasteSale.application.WasteSaleApplication
;
...
...
@@ -23,6 +26,7 @@ import com.huigou.util.DateUtil;
import
org.activiti.engine.delegate.DelegateExecution
;
import
org.activiti.engine.delegate.DelegateTask
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.task.TaskExecutor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
...
...
@@ -46,6 +50,10 @@ public class WasteSaleApplicationImpl extends FlowBroker implements WasteSaleApp
private
WasteSaleItemApplication
wasteSaleItemApplication
;
@Autowired
private
HttpClient
httpClient
;
@Autowired
private
SapPermitApplication
sapPermitApplication
;
@Autowired
private
TaskExecutor
asyncWriteExecutor
;
@Override
public
WasteSale
findWasteSaleById
(
String
id
)
{
return
wasteSaleRepository
.
findOne
(
id
);
...
...
@@ -124,6 +132,32 @@ public class WasteSaleApplicationImpl extends FlowBroker implements WasteSaleApp
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
asyncWriteExecutor
.
execute
(()->
//创建放行条
this
.
startSapPermit
(
wasteSale
,
saleItemList
)
);
}
public
void
startSapPermit
(
WasteSale
wasteSale
,
List
<
WasteSaleItem
>
saleItemList
){
SapPermitVo
sapPermitVo
=
new
SapPermitVo
();
sapPermitVo
.
setCompany
(
wasteSale
.
getBktxt
());
sapPermitVo
.
setApplyPerson
(
wasteSale
.
getPersonMemberId
());
sapPermitVo
.
setApplyPersonName
(
wasteSale
.
getPersonMemberName
());
sapPermitVo
.
setDutyDepart
(
wasteSale
.
getDeptId
());
sapPermitVo
.
setDutyDepartName
(
wasteSale
.
getDeptName
());
sapPermitVo
.
setPermitDate
(
new
Date
());
List
<
SapPermitItemVo
>
sapPermitItemVos
=
new
ArrayList
<>();
for
(
WasteSaleItem
wasteSaleItem
:
saleItemList
)
{
SapPermitItemVo
sapPermitItemVo
=
new
SapPermitItemVo
();
sapPermitItemVo
.
setBelongings
(
wasteSaleItem
.
getSaleGoods
());
sapPermitItemVo
.
setUnit
(
wasteSaleItem
.
getUnit
());
sapPermitItemVo
.
setQuantity
(
wasteSaleItem
.
getQuantity
());
sapPermitItemVos
.
add
(
sapPermitItemVo
);
}
sapPermitVo
.
setItemVos
(
sapPermitItemVos
);
//创建放行条
sapPermitApplication
.
saveSapPermitVo
(
sapPermitVo
);
}
@Override
...
...
@@ -195,8 +229,10 @@ public class WasteSaleApplicationImpl extends FlowBroker implements WasteSaleApp
WasteSale
wasteSale
=
wasteSaleRepository
.
findOne
(
bizId
);
wasteSale
.
setStatusId
(
status
.
getId
());
wasteSaleRepository
.
save
(
wasteSale
);
if
(
status
==
BizBillStatus
.
COMPLETED
){
this
.
sendWasteSaleData
(
wasteSale
);
}
}
@Override
protected
void
onAbortProcessInstance
(
DelegateExecution
delegateExecution
)
{
...
...
topsun/src/main/java/com/huigou/topsun/sap/workcenter/application/SapWorkCenterApplication.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
sap
.
workcenter
.
application
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.huigou.topsun.sap.workcenter.domain.SapWorkCenter
;
import
com.huigou.util.SDO
;
import
java.util.ArrayList
;
import
java.util.Map
;
/**
@author YourUserName
*/
public
interface
SapWorkCenterApplication
{
ArrayList
<
Map
<
String
,
Object
>>
findWorkCenter
();
String
queryWorkCenter
()
throws
JsonProcessingException
;
String
saveWorkCenterDetail
(
SDO
sdo
);
boolean
saveWorkCenter
(
SapWorkCenter
workCenter
);
}
topsun/src/main/java/com/huigou/topsun/sap/workcenter/application/SapWorkCenterLogApplication.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
sap
.
workcenter
.
application
;
import
com.huigou.topsun.sap.workcenter.domain.SapWorkCenterLog
;
/**
@author YourUserName
*/
public
interface
SapWorkCenterLogApplication
{
}
topsun/src/main/java/com/huigou/topsun/sap/workcenter/application/SysChangeRecordApplication.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
sap
.
workcenter
.
application
;
import
com.huigou.topsun.sap.workcenter.domain.SysChangeRecord
;
/**
@author YourUserName
*/
public
interface
SysChangeRecordApplication
{
}
topsun/src/main/java/com/huigou/topsun/sap/workcenter/application/impl/SapWorkCenterApplicationImpl.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
sap
.
workcenter
.
application
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.huigou.topsun.sap.common.HttpClient
;
import
com.huigou.topsun.sap.workcenter.repository.SapWorkCenterRepository
;
import
com.huigou.topsun.sap.workcenter.application.SapWorkCenterApplication
;
import
com.huigou.topsun.sap.workcenter.domain.SapWorkCenter
;
import
com.huigou.topsun.util.PersistTool
;
import
com.huigou.topsun.util.TestClientHttp
;
import
com.huigou.util.JSONUtil
;
import
com.huigou.util.SDO
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.persistence.EntityManager
;
import
javax.persistence.PersistenceContext
;
import
java.util.*
;
/**
* @author YourUserName
*/
@Service
@RequiredArgsConstructor
public
class
SapWorkCenterApplicationImpl
implements
SapWorkCenterApplication
{
private
final
ObjectMapper
objectMapper
;
@PersistenceContext
(
unitName
=
"system"
)
private
EntityManager
entityManager
;
private
final
PersistTool
persist
;
private
final
SapWorkCenterRepository
rep
;
private
final
HttpClient
httpClient
;
private
final
SapWorkCenterRepository
sapWorkCenterRepository
;
/***
* @description 发送请求到 SAP 系统,获取工作中心数据
* @return java.util.ArrayList<java.util.Map < java.lang.String, java.lang.Object>>
* @author qinzhenguan
* @createDate 2024/1/17 15:44
*/
@Override
public
ArrayList
<
Map
<
String
,
Object
>>
findWorkCenter
()
{
String
execute
;
HashMap
<
String
,
Object
>
param
=
new
HashMap
<>(
12
);
List
<
SapWorkCenter
>
workCenters
;
try
{
execute
=
TestClientHttp
.
execute
(
param
,
"http://192.168.3.91:8081/topsun-xt/sapWorkCenter/queryWorkCenter.ajax"
);
String
resultStr
=
JSONObject
.
parseObject
(
execute
).
get
(
"data"
).
toString
();
workCenters
=
objectMapper
.
readValue
(
resultStr
,
new
TypeReference
<
List
<
SapWorkCenter
>>()
{});
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
if
(
workCenters
.
size
()
==
0
)
{
return
null
;
}
return
objectMapper
.
convertValue
(
workCenters
,
new
TypeReference
<
ArrayList
<
Map
<
String
,
Object
>>>()
{
});
}
/***
* @description 发送请求到 SAP 系统,保存工作中心数据
* @param sdo 提交的数据集
* @return java.util.Map<java.lang.String, java.lang.Object>
* @author qinzhenguan
* @createDate 2024/1/18 11:20
*/
@Override
public
String
saveWorkCenterDetail
(
SDO
sdo
)
{
String
execute
;
HashMap
<
String
,
Object
>
param
=
new
HashMap
<>(
12
);
SapWorkCenter
sapWorkCenter
=
sdo
.
toObject
(
SapWorkCenter
.
class
);
param
.
put
(
"data"
,
sdo
.
getProperties
());
try
{
execute
=
httpClient
.
execute
(
param
,
"http://192.168.3.109:8000/sap/bc/erp_ep/cud_arbpl/arbpl_data?sap-client=300"
);
List
<
Map
>
maps
=
JSONObject
.
parseArray
(
execute
,
Map
.
class
);
String
message
=
(
String
)
maps
.
get
(
0
).
get
(
"MESSAGE"
);
String
type
=
(
String
)
maps
.
get
(
0
).
get
(
"TYPE"
);
sapWorkCenter
.
setType
(
type
);
sapWorkCenter
.
setMessage
(
message
);
sapWorkCenterRepository
.
save
(
sapWorkCenter
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
return
sapWorkCenter
.
getId
();
}
@Override
@Transactional
(
transactionManager
=
"transactionManager"
,
rollbackFor
=
{
Exception
.
class
})
public
boolean
saveWorkCenter
(
SapWorkCenter
workCenter
)
{
Set
<
Object
>
set
=
new
HashSet
<>();
set
.
add
(
workCenter
);
persist
.
persistEntitys
(
set
);
entityManager
.
flush
();
entityManager
.
clear
();
// String str = null;
// str.length();
System
.
out
.
println
(
"GG"
);
return
false
;
}
/**
* description 模拟 SAP 接口 (临时)
* @return java.lang.String
* @author qinzhenguan
* @createDate 2024/1/17 14:57
*/
@Override
public
String
queryWorkCenter
()
throws
JsonProcessingException
{
List
<
SapWorkCenter
>
list
=
rep
.
findAll
();
return
list
.
size
()
>
0
?
objectMapper
.
writeValueAsString
(
list
)
:
""
;
}
}
topsun/src/main/java/com/huigou/topsun/sap/workcenter/application/impl/SapWorkCenterLogApplicationImpl.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
sap
.
workcenter
.
application
.
impl
;
import
com.huigou.topsun.sap.workcenter.repository.SapWorkCenterLogRepository
;
import
com.huigou.topsun.sap.workcenter.application.SapWorkCenterLogApplication
;
import
com.huigou.topsun.sap.workcenter.domain.SapWorkCenterLog
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
/**
@author YourUserName
*/
@Service
public
class
SapWorkCenterLogApplicationImpl
implements
SapWorkCenterLogApplication
{
@Resource
private
SapWorkCenterLogRepository
rep
;
}
topsun/src/main/java/com/huigou/topsun/sap/workcenter/application/impl/SysChangeRecordApplicationImpl.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
sap
.
workcenter
.
application
.
impl
;
import
com.huigou.topsun.sap.workcenter.repository.SysChangeRecordRepository
;
import
com.huigou.topsun.sap.workcenter.application.SysChangeRecordApplication
;
import
com.huigou.topsun.sap.workcenter.domain.SysChangeRecord
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
/**
@author YourUserName
*/
@Service
public
class
SysChangeRecordApplicationImpl
implements
SysChangeRecordApplication
{
@Resource
private
SysChangeRecordRepository
rep
;
}
topsun/src/main/java/com/huigou/topsun/sap/workcenter/controller/SapWorkCenterLogController.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
sap
.
workcenter
.
controller
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.huigou.topsun.sap.workcenter.application.SapWorkCenterApplication
;
import
com.huigou.topsun.sap.workcenter.domain.SapWorkCenter
;
import
com.huigou.uasp.annotation.ControllerMapping
;
import
com.huigou.uasp.annotation.SkipAuth
;
import
com.huigou.uasp.client.CommonController
;
import
com.huigou.util.SDO
;
import
com.huigou.util.StringUtil
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.http.client.ClientHttpResponse
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* SapWorkCenterLogController SAP工作中心控制类
*
* @author qinzhenguan
* @createDate 2024/01/16 14:27
**/
@RequiredArgsConstructor
@Controller
@ControllerMapping
(
"/sapWorkCenter"
)
public
class
SapWorkCenterLogController
extends
CommonController
{
private
final
SapWorkCenterApplication
centerServer
;
@Override
protected
String
getPagePath
()
{
return
"/biz/topsun/sap/workCenter/"
;
}
public
String
forwardWorkCenter
()
{
return
forward
(
"sapWorkCenter"
);
}
public
String
findWorkCenter
()
{
ArrayList
<
Map
<
String
,
Object
>>
list
=
centerServer
.
findWorkCenter
();
HashMap
<
Object
,
Object
>
map
=
new
HashMap
<>(
3
);
map
.
put
(
"Rows"
,
list
);
return
toResult
(
map
);
}
public
String
forwardWorkCenterDetail
()
{
SDO
sdo
=
this
.
getSDO
();
return
forward
(
"sapWorkCenterDetail"
);
}
public
String
saveWorkCenterDetail
()
{
SDO
sdo
=
this
.
getSDO
();
String
id
=
centerServer
.
saveWorkCenterDetail
(
sdo
);
return
toResult
(
id
);
}
/**
* description 模拟 SAP 接口 (临时) 能否提供条件查询及分页?
* @return java.lang.String
* @author qinzhenguan
* @createDate 2024/1/17 14:57
*/
@SkipAuth
public
String
queryWorkCenter
()
throws
JsonProcessingException
{
String
workCenter
=
centerServer
.
queryWorkCenter
();
return
success
(
workCenter
);
}
@SkipAuth
public
String
saveWorkCenter
()
{
HttpServletRequest
request
=
this
.
getRequest
();
SapWorkCenter
workCenter
;
try
(
InputStream
ist
=
request
.
getInputStream
();
InputStreamReader
istr
=
new
InputStreamReader
(
ist
,
StandardCharsets
.
UTF_8
);)
{
String
requestBody
=
new
BufferedReader
(
istr
).
lines
().
collect
(
Collectors
.
joining
(
"\n"
));
ObjectMapper
objectMapper
=
new
ObjectMapper
();
workCenter
=
objectMapper
.
readValue
(
requestBody
,
SapWorkCenter
.
class
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
boolean
isSuccess
=
centerServer
.
saveWorkCenter
(
workCenter
);
return
success
();
}
}
\ No newline at end of file
topsun/src/main/java/com/huigou/topsun/sap/workcenter/domain/SapWorkCenter.java
deleted
100644 → 0
View file @
fca1c9db
This diff is collapsed.
Click to expand it.
topsun/src/main/java/com/huigou/topsun/sap/workcenter/domain/SapWorkCenterLog.java
deleted
100644 → 0
View file @
fca1c9db
This diff is collapsed.
Click to expand it.
topsun/src/main/java/com/huigou/topsun/sap/workcenter/domain/SysChangeRecord.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
sap
.
workcenter
.
domain
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
javax.persistence.*
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.huigou.topsun.common.NumberToStringSerializer
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
org.apache.commons.lang3.builder.EqualsBuilder
;
import
org.apache.commons.lang3.builder.HashCodeBuilder
;
/**
* @author qinzhenguan
* null
*/
@JsonInclude
(
JsonInclude
.
Include
.
ALWAYS
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@Entity
@Table
(
name
=
"sys_change_record"
)
public
class
SysChangeRecord
implements
Serializable
{
/**
* null
*/
@Id
@JsonSerialize
(
using
=
NumberToStringSerializer
.
class
)
@Column
(
name
=
"id"
,
nullable
=
false
)
private
BigDecimal
id
;
/**
* 关联数据ID
*/
@Column
(
name
=
"correlation_id"
,
nullable
=
true
,
length
=
32
)
private
String
correlationId
;
/**
* 关联系统
*/
@Column
(
name
=
"correlation_system"
,
nullable
=
true
,
length
=
32
)
private
String
correlationSystem
;
/**
* 业务ID
*/
@Column
(
name
=
"business_id"
,
nullable
=
true
,
length
=
32
)
private
String
businessId
;
/**
* 业务名称
*/
@Column
(
name
=
"business_name"
,
nullable
=
true
,
length
=
100
)
private
String
businessName
;
/**
* 归属部门
*/
@Column
(
name
=
"depart"
,
nullable
=
true
,
length
=
64
)
private
String
depart
;
/**
* 录入人
*/
@Column
(
name
=
"enter_user"
,
nullable
=
true
,
length
=
120
)
private
String
enterUser
;
/**
* 录入时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Column
(
name
=
"enter_time"
,
nullable
=
true
)
private
java
.
util
.
Date
enterTime
;
/**
* 最后修改人
*/
@Column
(
name
=
"last_reviser"
,
nullable
=
true
,
length
=
120
)
private
String
lastReviser
;
/**
* 最后修改时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Column
(
name
=
"last_reviser_time"
,
nullable
=
true
)
private
java
.
util
.
Date
lastReviserTime
;
/**
* 有效标志: 0:false;1:true
*/
@Column
(
name
=
"yxbz"
,
nullable
=
true
)
private
Integer
yxbz
;
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
SysChangeRecord
that
=
(
SysChangeRecord
)
o
;
return
new
EqualsBuilder
().
append
(
id
,
that
.
id
).
append
(
correlationId
,
that
.
correlationId
).
append
(
correlationSystem
,
that
.
correlationSystem
).
append
(
businessId
,
that
.
businessId
).
append
(
businessName
,
that
.
businessName
).
append
(
depart
,
that
.
depart
).
append
(
enterUser
,
that
.
enterUser
).
append
(
enterTime
,
that
.
enterTime
).
append
(
lastReviser
,
that
.
lastReviser
).
append
(
lastReviserTime
,
that
.
lastReviserTime
).
append
(
yxbz
,
that
.
yxbz
).
isEquals
();
}
@Override
public
int
hashCode
()
{
return
new
HashCodeBuilder
(
17
,
37
).
append
(
id
).
append
(
correlationId
).
append
(
correlationSystem
).
append
(
businessId
).
append
(
businessName
).
append
(
depart
).
append
(
enterUser
).
append
(
enterTime
).
append
(
lastReviser
).
append
(
lastReviserTime
).
append
(
yxbz
).
toHashCode
();
}
public
BigDecimal
getId
()
{
return
this
.
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
(
id
==
null
)
||
id
.
isEmpty
()
?
null
:
new
BigDecimal
(
id
);
}
public
String
getCorrelationId
()
{
return
this
.
correlationId
;
}
public
void
setCorrelationId
(
String
correlationId
)
{
this
.
correlationId
=
correlationId
;
}
public
String
getCorrelationSystem
()
{
return
this
.
correlationSystem
;
}
public
void
setCorrelationSystem
(
String
correlationSystem
)
{
this
.
correlationSystem
=
correlationSystem
;
}
public
String
getBusinessId
()
{
return
this
.
businessId
;
}
public
void
setBusinessId
(
String
businessId
)
{
this
.
businessId
=
businessId
;
}
public
String
getBusinessName
()
{
return
this
.
businessName
;
}
public
void
setBusinessName
(
String
businessName
)
{
this
.
businessName
=
businessName
;
}
public
String
getDepart
()
{
return
this
.
depart
;
}
public
void
setDepart
(
String
depart
)
{
this
.
depart
=
depart
;
}
public
String
getEnterUser
()
{
return
this
.
enterUser
;
}
public
void
setEnterUser
(
String
enterUser
)
{
this
.
enterUser
=
enterUser
;
}
public
java
.
util
.
Date
getEnterTime
()
{
return
this
.
enterTime
;
}
public
void
setEnterTime
(
java
.
util
.
Date
enterTime
)
{
this
.
enterTime
=
enterTime
;
}
public
String
getLastReviser
()
{
return
this
.
lastReviser
;
}
public
void
setLastReviser
(
String
lastReviser
)
{
this
.
lastReviser
=
lastReviser
;
}
public
java
.
util
.
Date
getLastReviserTime
()
{
return
this
.
lastReviserTime
;
}
public
void
setLastReviserTime
(
java
.
util
.
Date
lastReviserTime
)
{
this
.
lastReviserTime
=
lastReviserTime
;
}
public
Integer
getYxbz
()
{
return
this
.
yxbz
;
}
public
void
setYxbz
(
Integer
yxbz
)
{
this
.
yxbz
=
yxbz
;
}
}
topsun/src/main/java/com/huigou/topsun/sap/workcenter/repository/SapWorkCenterLogRepository.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
sap
.
workcenter
.
repository
;
import
java.math.BigDecimal
;
import
com.huigou.topsun.sap.workcenter.domain.SapWorkCenterLog
;
import
org.springframework.data.jpa.repository.JpaRepository
;
/**
@author YourUserName
*/
public
interface
SapWorkCenterLogRepository
extends
JpaRepository
<
SapWorkCenterLog
,
BigDecimal
>
{
}
topsun/src/main/java/com/huigou/topsun/sap/workcenter/repository/SapWorkCenterRepository.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
sap
.
workcenter
.
repository
;
import
com.huigou.topsun.sap.workcenter.domain.SapWorkCenter
;
import
org.springframework.data.jpa.repository.JpaRepository
;
/**
@author YourUserName
*/
public
interface
SapWorkCenterRepository
extends
JpaRepository
<
SapWorkCenter
,
String
>
{
}
topsun/src/main/java/com/huigou/topsun/sap/workcenter/repository/SysChangeRecordRepository.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
sap
.
workcenter
.
repository
;
import
java.math.BigDecimal
;
import
com.huigou.topsun.sap.workcenter.domain.SysChangeRecord
;
import
org.springframework.data.jpa.repository.JpaRepository
;
/**
@author YourUserName
*/
public
interface
SysChangeRecordRepository
extends
JpaRepository
<
SysChangeRecord
,
BigDecimal
>
{
}
topsun/src/main/java/com/huigou/topsun/util/EntityConvertUtil.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
util
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.apache.commons.beanutils.BeanUtils
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* EntityConvertUtil 数据类型转换工具
*
* @author qinzhenguan
* @createDate 2023/12/30 10:56
**/
public
class
EntityConvertUtil
{
private
static
final
ObjectMapper
OBJECT_MAPPER
=
new
ObjectMapper
();
/**
* description 返回页面 Form 所需的数据格式
* @param entitys 所有相关的 实体。 必须为 JavaBean 调用了 .getClass().getSimpleName()
* @return java.util.HashMap<java.lang.String, java.lang.Object>
* @author qinzhenguan
* @createDate 2023/12/5 14:09
*/
public
static
Map
<
String
,
Object
>
assembleResultOfForm
(
Set
<
Object
>
entitys
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
256
);
for
(
Object
item
:
entitys
)
{
if
(
item
==
null
)
{
continue
;
}
if
(
item
instanceof
List
)
{
if
(((
List
<?>)
item
).
size
()
>
0
)
{
map
.
put
((((
List
<?>)
item
).
get
(
0
)).
getClass
().
getSimpleName
(),
OBJECT_MAPPER
.
convertValue
(
item
,
List
.
class
));
}
}
else
{
map
.
put
(
item
.
getClass
().
getSimpleName
(),
OBJECT_MAPPER
.
convertValue
(
item
,
new
TypeReference
<
Map
<?
extends
String
,
?>>()
{})
);
}
// 这里要获取所有的属性名, 保存对应关系, 属性: 所属实体类;
//map.putAll(mapper.convertValue(item, new TypeReference<Map<? extends String, ?>>() {}));
}
return
map
;
}
/**
* description
* @param clazz Bean
* @param displayProperty 需要显示的属性
* @param valueProperty 连接的属性
* @param list 需要转换的 List
* @return java.util.Map<java.lang.Object, java.lang.Object>
* @author qinzhenguan
* @createDate 2023/12/1 16:09
*/
public
static
Map
<
Object
,
Object
>
convertToMap
(
Class
<?>
clazz
,
String
displayProperty
,
String
valueProperty
,
List
<?>
list
)
{
Set
<
String
>
set
=
new
HashSet
<>();
set
.
add
(
displayProperty
);
set
.
add
(
valueProperty
);
if
(
checkClassesAndProperties
(
clazz
,
set
,
list
.
size
()))
{
LinkedList
<
Map
<
String
,
Object
>>
mapList
=
OBJECT_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
));
}
return
null
;
}
/**
* description 只检查传入属性是否合法
* @param clazz Bean
* @param set 需要检查的 Propertys
* @param listSize 需要检查的 ListSize
* @return java.lang.Boolean true of false
* @author qinzhenguan
* @createDate 2023/12/1 15:58
*/
public
static
Boolean
checkClassesAndProperties
(
Class
<?>
clazz
,
Set
<
String
>
set
,
int
listSize
)
{
if
(
listSize
==
0
)
{
System
.
err
.
println
(
"[checkClassesAndProperties] : List< "
+
clazz
.
getName
()+
" > 需要转换的列表没有元素。请检查~!"
);
return
false
;
}
Field
[]
fields
=
clazz
.
getDeclaredFields
();
Method
[]
methods
=
clazz
.
getDeclaredMethods
();
for
(
String
item
:
set
)
{
Field
field
=
Arrays
.
stream
(
fields
).
filter
(
f
->
item
.
equals
(
f
.
getName
())).
findFirst
().
orElse
(
null
);
if
(
field
==
null
)
{
System
.
err
.
println
(
"[checkClassesAndProperties] : "
+
clazz
.
getName
()
+
" 无法找到 : "
+
item
+
" "
+
"该属性。请检查~!"
);
return
false
;
}
Method
method
=
Arrays
.
stream
(
methods
)
.
filter
(
m
->
m
.
getName
().
toLowerCase
().
contains
(
"get"
+
item
.
toLowerCase
())).
findFirst
().
orElse
(
null
);
if
(
method
==
null
)
{
System
.
err
.
println
(
"[checkClassesAndProperties] : "
+
item
+
" 该属性无法找到构造方法。请检查~!"
);
return
false
;
}
}
return
true
;
}
/**
* description 转换成 Map 不需要转换为实体
* @param clazz Bean
* @param propertyName 连接的 property
* @param list 需要转换的 List
* @return java.util.Map<java.lang.Object, java.lang.Object>
* @author qinzhenguan
* @createDate 2023/11/29 11:36
*/
public
static
Map
<
Object
,
Object
>
convertToMap
(
Class
<?>
clazz
,
String
propertyName
,
List
<?>
list
)
{
return
convertToMap
(
clazz
,
propertyName
,
list
,
false
);
}
/**
* description 转换成 Map 保留映射
* @param clazz Bean
* @param propertyName 连接的 property
* @param list 需要转换的 List
* @param isBean 是否需要转换为实体 (当前应用不需要返回实体)
* @return java.util.Map<java.lang.Object, java.lang.Object>
* @author qinzhenguan
* @createDate 2023/11/29 11:34
*/
public
static
Map
<
Object
,
Object
>
convertToMap
(
Class
<?>
clazz
,
String
propertyName
,
List
<?>
list
,
boolean
isBean
)
{
Map
<
String
,
Object
>
checkMap
=
checkClassesAndProperties
(
clazz
,
propertyName
,
list
.
size
());
String
ok
=
"isOk"
;
if
(!(
Boolean
)
checkMap
.
get
(
ok
))
{
return
null
;
}
Method
method
=
(
Method
)
checkMap
.
get
(
"method"
);
LinkedList
<
Map
<
String
,
Object
>>
mapList
=
OBJECT_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
{
for
(
int
i
=
0
;
i
<
mapList
.
size
();
i
++)
{
Object
o
=
clazz
.
newInstance
();
BeanUtils
.
populate
(
o
,
mapList
.
get
(
i
));
Object
key
=
method
.
invoke
(
o
);
convert
.
put
(
key
,
o
);
}
}
catch
(
InstantiationException
|
IllegalAccessException
|
InvocationTargetException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
else
{
// --------------------------------- 非实体 ---------------------------------
convert
=
mapList
.
stream
().
collect
(
Collectors
.
toMap
(
map
->
map
.
get
(
propertyName
),
Function
.
identity
(),
(
oldV
,
newV
)
->
oldV
));
//此处仍需处理 Key == null;
}
resultMap
.
put
(
"map"
,
convert
);
resultMap
.
put
(
"list"
,
list
);
return
resultMap
;
}
/**
* description 检查传入参数是否合法 并返回构造方法
*
* @param clazz javaBean
* @param propertyName property
* @return java.util.HashMap<java.lang.String, java.lang.Object> { "isOk" : 是否通过检查, "method":获取得到的 method }
* @author qinzhenguan
* @createDate 2023/11/29 11:05
*/
public
static
HashMap
<
String
,
Object
>
checkClassesAndProperties
(
Class
<?>
clazz
,
String
propertyName
,
int
listSize
)
{
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>(
33
);
if
(
listSize
==
0
)
{
System
.
err
.
println
(
"[checkClassesAndProperties] : List< "
+
clazz
.
getName
()+
" > 需要转换的列表没有元素。请检查~!"
);
map
.
put
(
"isOk"
,
false
);
return
map
;
}
Field
[]
fields
=
clazz
.
getDeclaredFields
();
Field
field
=
Arrays
.
stream
(
fields
).
filter
(
f
->
propertyName
.
equals
(
f
.
getName
())).
findFirst
().
orElse
(
null
);
if
(
field
==
null
)
{
System
.
err
.
println
(
"[checkClassesAndProperties] : "
+
clazz
.
getName
()
+
" 无法找到 : "
+
propertyName
+
" "
+
"该属性。请检查~!"
);
map
.
put
(
"isOk"
,
false
);
return
map
;
}
Method
[]
methods
=
clazz
.
getDeclaredMethods
();
Method
method
=
Arrays
.
stream
(
methods
)
.
filter
(
m
->
m
.
getName
().
toLowerCase
().
contains
(
"get"
+
propertyName
.
toLowerCase
())).
findFirst
().
orElse
(
null
);
if
(
method
==
null
)
{
System
.
err
.
println
(
"[checkClassesAndProperties] : "
+
propertyName
+
" 该属性无法找到构造方法。请检查~!"
);
map
.
put
(
"isOk"
,
false
);
return
map
;
}
map
.
put
(
"isOk"
,
true
);
map
.
put
(
"method"
,
method
);
return
map
;
}
}
\ No newline at end of file
topsun/src/main/java/com/huigou/topsun/util/PersistTool.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
util
;
import
com.huigou.util.StringUtil
;
import
org.springframework.stereotype.Component
;
import
javax.persistence.EntityManager
;
import
javax.persistence.Id
;
import
javax.persistence.PersistenceContext
;
import
java.lang.reflect.Field
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* PersistUtil 持久化工具
*
* @author qinzhenguan
* @createDate 2023/12/30 10:49
**/
@Component
public
class
PersistTool
{
@PersistenceContext
(
unitName
=
"system"
)
private
EntityManager
entityManager
;
/**
* @param entitys 持久化数据集合 Set { Entity, HashMap }
* @description 持久化数据. 不执行.flush() 业务代码自行控制提交 <br>
* Entity 时,如果 ID 为空执行 Persist,否则执行 Merge <br>
* List 时,要求数据集格式 : <br>
* HashMap {”add“: List< Entity >,”up“: List< Entity >,”del“: List< Entity >}
* @author qinzhenguan
* @createDate 2023/12/26 16:44
*/
public
void
persistEntitys
(
Set
<
Object
>
entitys
)
{
entitys
=
entitys
.
stream
().
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toSet
());
for
(
Object
item
:
entitys
)
{
if
(
item
instanceof
Map
)
{
persistList
(
uncheckedCast
(((
Map
<?,
?>)
item
).
get
(
"add"
)),
"save"
);
persistList
(
uncheckedCast
(((
Map
<?,
?>)
item
).
get
(
"up"
)),
"save"
);
persistList
(
uncheckedCast
(((
Map
<?,
?>)
item
).
get
(
"del"
)),
"remove"
);
}
else
{
persistEntity
(
item
);
}
}
}
/***
* description 持久化 List
* @param list 操作的 List
* @param type 操作类型 save, remove
* @author qinzhenguan
* @createDate 2023/12/26 16:33
*/
public
void
persistList
(
List
<
Class
<?>>
list
,
String
type
)
{
if
(
list
==
null
||
list
.
isEmpty
())
{
return
;
}
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
if
(
"remove"
.
equals
(
type
))
{
removeEntity
(
list
.
get
(
i
));
}
else
{
persistEntity
(
list
.
get
(
i
));
}
// 这里批量提交, 可能会导致在此之后 无法回滚此提交的更改 (未测试)
if
(
i
%
80
==
0
||
i
==
(
list
.
size
()
-
1
))
{
entityManager
.
flush
();
entityManager
.
clear
();
}
}
}
/***
* description 持久化实体 (无 ID 时执行插入,有 ID 时执行更新)
* @param entity 操作的 Entity
* @author qinzhenguan
* @createDate 2023/12/26 16:32
*/
public
void
persistEntity
(
Object
entity
)
{
Class
<?>
clazz
=
entity
.
getClass
();
for
(
Field
field
:
clazz
.
getDeclaredFields
())
{
boolean
annotationPresent
=
field
.
isAnnotationPresent
(
Id
.
class
);
if
(
annotationPresent
)
{
try
{
field
.
setAccessible
(
true
);
String
id
=
(
String
)
field
.
get
(
entity
);
if
(
StringUtil
.
isBlank
(
id
)){
if
(
field
.
getType
().
equals
(
BigDecimal
.
class
))
{
// js 大数字丢失精度, 故 在代码中使用 String。
field
.
set
(
entity
,
String
.
valueOf
(
Snowflake
.
nextId
()));
}
else
if
(
field
.
getType
().
equals
(
String
.
class
))
{
String
uuid
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
field
.
set
(
entity
,
uuid
);
}
entityManager
.
persist
(
entity
);
}
else
{
entityManager
.
merge
(
entity
);
}
}
catch
(
IllegalAccessException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
}
/***
* description 移除实体
* @param entity 操作的 Entity
* @author qinzhenguan
* @createDate 2023/12/26 16:31
*/
public
void
removeEntity
(
Object
entity
)
{
if
(
entity
==
null
)
{
return
;
}
entityManager
.
remove
(
entity
);
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
T
uncheckedCast
(
Object
obj
)
{
if
(
obj
!=
null
)
{
return
(
T
)
obj
;
}
return
null
;
}
}
\ No newline at end of file
topsun/src/main/java/com/huigou/topsun/util/Snowflake.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
util
;
import
java.util.concurrent.ThreadLocalRandom
;
/**
* |00000000|00000000|00000000|00000000|00000000|00000000|00000000|00000000|
* |--|xxxxxxxxxxxxxx 41bit 时间戳(毫秒) xxxxxxxxxxxxxxx|--|--------|--------|
* |---------------------------------------4bit机器id|xxxx|--------|--------|
* |------------------------------------------16bit自增序列|xxxxxxxx|xxxxxxxx|
*/
public
class
Snowflake
{
// 开始时间
private
static
final
long
OFFSET
=
1686211627000L
;
private
static
long
WORKER_ID
=
1L
;
/** 机器ID位 **/
private
static
final
long
WORKER_ID_BITS
=
4L
;
/** 自增序列位 **/
private
static
final
long
SEQUENCE_ID_BITS
=
16L
;
private
static
final
long
WORKER_SHIFT_BITS
=
SEQUENCE_ID_BITS
;
private
static
final
long
OFFSET_SHIFT_BITS
=
WORKER_ID_BITS
+
WORKER_SHIFT_BITS
;
private
static
long
SEQUENCE_MAX
=
(
1
<<
SEQUENCE_ID_BITS
)
-
1
;
private
static
long
lastTimestamp
=
0L
;
private
static
long
sequence
=
0L
;
// public Snowflake(long workerId) {
// WORKER_ID = workerId;
// }
public
static
synchronized
long
nextId
()
{
long
timestamp
=
timeGen
();
if
(
timestamp
<
lastTimestamp
)
{
System
.
out
.
println
(
"时钟回拨"
);
// 可以加入 ‘时钟序列’ 位,并缓存。
}
if
(
timestamp
==
lastTimestamp
)
{
sequence
=
++
sequence
&
SEQUENCE_MAX
;
// 到达最大序列时等待
if
(
sequence
==
0L
)
{
timestamp
=
tilNexMillis
(
lastTimestamp
);
}
//timestamp = sequence != 0 ? timestamp : tilNexMillis(lastTimestamp);
}
else
{
// 初始序列 随机 1 - 3
sequence
=
ThreadLocalRandom
.
current
().
nextLong
(
1
,
3
);
}
lastTimestamp
=
timestamp
;
// 时间戳 | 机器id | 序列号
return
(
timestamp
-
OFFSET
)
<<
OFFSET_SHIFT_BITS
|
(
WORKER_ID
<<
WORKER_SHIFT_BITS
)
|
sequence
;
}
protected
static
long
tilNexMillis
(
long
lastTimestamp
)
{
long
timestamp
=
timeGen
();
while
(
timestamp
<=
lastTimestamp
)
{
timestamp
=
timeGen
();
}
return
timestamp
;
}
protected
static
long
timeGen
()
{
return
System
.
currentTimeMillis
();
}
}
topsun/src/main/java/com/huigou/topsun/util/TestClientHttp.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
util
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.huigou.topsun.config.CloseableClientHttpRequest
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.client.ClientHttpResponse
;
import
org.springframework.http.client.SimpleClientHttpRequestFactory
;
import
java.io.*
;
import
java.net.URI
;
import
java.nio.charset.StandardCharsets
;
/**
* TestClientHttp 用于测试的 ClientHttp
*
* @author qinzhenguan
* @createDate 2024/01/19 15:43
**/
public
class
TestClientHttp
{
/***
* description 模拟发送请求到 SAP
* @param param 请求体 body
* @param url 请求地址
* @return java.lang.String
* @author qinzhenguan
* @createDate 2024/1/17 17:01
*/
public
static
String
execute
(
Object
param
,
String
url
)
throws
IOException
{
String
str
=
""
;
try
{
SimpleClientHttpRequestFactory
requestFactory
=
new
SimpleClientHttpRequestFactory
();
requestFactory
.
setConnectTimeout
(
5000
);
requestFactory
.
setReadTimeout
(
50000
);
URI
uri
=
URI
.
create
(
url
);
HttpMethod
method
=
HttpMethod
.
POST
;
// ------------------------ header ------------------------
try
(
CloseableClientHttpRequest
request
=
new
CloseableClientHttpRequest
(
requestFactory
.
createRequest
(
uri
,
method
)))
{
request
.
addHeader
(
"Content-type"
,
"application/json;charset=utf-8"
);
// ------------------------ body ------------------------
//JSONObject body = new JSONObject();
if
(
param
!=
null
)
{
String
bodyText
=
new
ObjectMapper
().
writeValueAsString
(
param
);
try
(
OutputStream
requestBody
=
request
.
getBody
())
{
requestBody
.
write
(
bodyText
.
getBytes
());
}
}
// ------------------------ response ------------------------
try
(
ClientHttpResponse
response
=
request
.
execute
();
InputStream
ist
=
response
.
getBody
();
InputStreamReader
istr
=
new
InputStreamReader
(
ist
,
StandardCharsets
.
UTF_8
);
BufferedReader
bfreader
=
new
BufferedReader
(
istr
))
{
str
=
bfreader
.
readLine
();
System
.
out
.
println
(
str
);
}
}
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
str
;
}
}
\ No newline at end of file
topsun/src/main/java/com/huigou/topsun/util/TestSnowflake.java
deleted
100644 → 0
View file @
fca1c9db
package
com
.
huigou
.
topsun
.
util
;
import
org.junit.Test
;
import
java.util.Date
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.CopyOnWriteArrayList
;
import
java.util.stream.Collectors
;
public
class
TestSnowflake
{
public
List
<
Long
>
list
=
new
CopyOnWriteArrayList
<>();
@Test
public
void
run
()
throws
InterruptedException
{
generateTest
();
// new Snowflake(1);
final
Long
id
=
Snowflake
.
nextId
();
Date
date
=
new
Date
();
date
.
setTime
(
(
id
>>
18
)
+
1686211627000L
);
System
.
out
.
println
(
id
);
}
/**
* description 测试当前生成策略极限。
* @author qinzhenguan
* @createDate 2023/12/30 10:42
*/
public
void
generateTest
()
throws
InterruptedException
{
TreadA
t1
=
new
TreadA
();
TreadB
t2
=
new
TreadB
();
t1
.
start
();
t2
.
start
();
while
(
list
.
size
()
<
60000
)
{
Thread
.
sleep
(
500
);
}
System
.
out
.
println
(
list
.
size
());
Map
<
Object
,
Long
>
map
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
l
->
l
,
Collectors
.
counting
()));
Map
<
Object
,
Long
>
sortedByCount
=
map
.
entrySet
().
stream
()
.
sorted
((
e1
,
e2
)
->
e2
.
getValue
().
compareTo
(
e1
.
getValue
()))
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
,
(
e1
,
e2
)
->
e1
,
LinkedHashMap:
:
new
));
List
<
Object
>
countList
=
map
.
entrySet
().
stream
().
filter
(
f
->
f
.
getValue
()
>
1
).
map
(
Map
.
Entry
::
getKey
).
collect
(
Collectors
.
toList
());
if
(
countList
.
size
()
>
0
)
{
System
.
out
.
println
(
"x"
);
}
}
protected
static
long
timeGen
()
{
return
System
.
currentTimeMillis
()
/
1000
;
}
public
class
TreadA
extends
Thread
{
@Override
public
void
run
()
{
super
.
run
();
//long timestamp = timeGen();
for
(
int
i
=
0
;
i
<
30000
;
i
++)
{
// new Snowflake(1);
long
id
=
Snowflake
.
nextId
();
list
.
add
(
id
);
}
}
}
public
class
TreadB
extends
Thread
{
@Override
public
void
run
()
{
super
.
run
();
for
(
int
i
=
0
;
i
<
30000
;
i
++)
{
// new Snowflake(1);
long
id
=
Snowflake
.
nextId
();
list
.
add
(
id
);
}
}
}
}
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