Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cmszMonitorAnalysis
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
liuna
cmszMonitorAnalysis
Commits
bc1b51e5
Commit
bc1b51e5
authored
Dec 23, 2017
by
胡斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
智能分析平台备份提交
parent
42306cb2
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
171 additions
and
58 deletions
+171
-58
PreviewParameter.java
src/main/java/com/hp/cmsz/entity/PreviewParameter.java
+57
-0
ModelParameterDao.java
src/main/java/com/hp/cmsz/repository/ModelParameterDao.java
+5
-0
PreviewParameterDao.java
...main/java/com/hp/cmsz/repository/PreviewParameterDao.java
+9
-0
TaskManageController.java
...va/com/hp/cmsz/web/commonmanage/TaskManageController.java
+66
-36
ModelMonitorHome.jsp
...main/webapp/WEB-INF/views/TaskManage/ModelMonitorHome.jsp
+1
-1
RunTaskList.jsp
src/main/webapp/WEB-INF/views/TaskManage/RunTaskList.jsp
+32
-19
RunTaskListTable.jsp
...main/webapp/WEB-INF/views/TaskManage/RunTaskListTable.jsp
+0
-1
ruleResultDetailTable.js
src/main/webapp/static/js/ruleResultDetailTable.js
+1
-1
No files found.
src/main/java/com/hp/cmsz/entity/PreviewParameter.java
0 → 100644
View file @
bc1b51e5
package
com
.
hp
.
cmsz
.
entity
;
import
javax.persistence.*
;
@Entity
@Table
(
name
=
"FXJM_MODEL_PREVIEW_INFO_T"
)
public
class
PreviewParameter
{
private
Long
previewId
;
private
String
parameterName
;
private
String
parameterValue
;
private
String
parameterCode
;
private
String
parameterSourceId
;
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
SEQUENCE
,
generator
=
"PreviewParameterSequence"
)
@SequenceGenerator
(
name
=
"PreviewParameterSequence"
,
sequenceName
=
"PARAMETER_SOURCE_SEQ"
,
allocationSize
=
1
)
public
Long
getPreviewId
()
{
return
previewId
;
}
public
void
setPreviewId
(
Long
previewId
)
{
this
.
previewId
=
previewId
;
}
public
String
getParameterName
()
{
return
parameterName
;
}
public
void
setParameterName
(
String
parameterName
)
{
this
.
parameterName
=
parameterName
;
}
public
String
getParameterValue
()
{
return
parameterValue
;
}
public
void
setParameterValue
(
String
parameterValue
)
{
this
.
parameterValue
=
parameterValue
;
}
public
String
getParameterCode
()
{
return
parameterCode
;
}
public
void
setParameterCode
(
String
parameterCode
)
{
this
.
parameterCode
=
parameterCode
;
}
public
String
getParameterSourceId
()
{
return
parameterSourceId
;
}
public
void
setParameterSourceId
(
String
parameterSourceId
)
{
this
.
parameterSourceId
=
parameterSourceId
;
}
}
src/main/java/com/hp/cmsz/repository/ModelParameterDao.java
View file @
bc1b51e5
...
...
@@ -18,6 +18,10 @@ import com.hp.cmsz.entity.ModelParameter;
public
interface
ModelParameterDao
extends
JpaSpecificationExecutor
<
ModelParameter
>,
PagingAndSortingRepository
<
ModelParameter
,
Long
>
{
List
<
ModelParameter
>
findAllByParameterIdIn
(
List
<
Long
>
id
);
//根据参数ID更新数据模型ID
@Modifying
@Query
(
"update ModelParameter mp set mp.dataModelId=:dataModelId where mp.parameterId in (:parameterIds)"
)
...
...
@@ -39,6 +43,7 @@ public interface ModelParameterDao extends JpaSpecificationExecutor<ModelParamet
//根据数据模型ID查找系统默认的参数d
List
<
ModelParameter
>
findByDataModelIdAndIfSystemDefault
(
Long
dataModelId
,
Long
ifSystemDefault
);
//根据任务ID查找系统默认的参数d
List
<
ModelParameter
>
findByTaskIdAndIfSystemDefault
(
Long
taskId
,
Long
ifSystemDefault
);
...
...
src/main/java/com/hp/cmsz/repository/PreviewParameterDao.java
0 → 100644
View file @
bc1b51e5
package
com
.
hp
.
cmsz
.
repository
;
import
com.hp.cmsz.entity.PreviewParameter
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.repository.PagingAndSortingRepository
;
public
interface
PreviewParameterDao
extends
JpaSpecificationExecutor
<
PreviewParameter
>,
PagingAndSortingRepository
<
PreviewParameter
,
Long
>
{
}
src/main/java/com/hp/cmsz/web/commonmanage/TaskManageController.java
View file @
bc1b51e5
...
...
@@ -21,9 +21,7 @@ import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.text.ParseException
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
com.hp.cmsz.entity.commonmanage.RunTaskDetail
;
import
com.hp.cmsz.entity.*
;
...
...
@@ -79,6 +77,9 @@ public class TaskManageController {
@Autowired
private
SystemParameterDao
systemParameterDao
;
@Autowired
private
PreviewParameterDao
previewParameterDao
;
@RequestMapping
(
value
=
"/taskHome"
)
public
ModelAndView
taskHome
(
String
selectTab
)
{
...
...
@@ -335,48 +336,55 @@ public class TaskManageController {
@RequestMapping
(
value
=
"/modelPreview"
)
@ResponseBody
public
APPEWarningDetail
ModelPreview
(
String
id
){
public
APPEWarningDetail
ModelPreview
(
String
id
,
String
previewId
){
// APPEWarningDetail app = null;
APPEWarningDetail
app
=
new
APPEWarningDetail
();
String
modelSavePath
=
systemParameterDao
.
findByParameterName
(
"MODEL_SCRIPT_FILE_DIR"
).
get
(
0
).
getParameterValue
();
RunTask
rt
=
runTaskService
.
getRunTask
(
Long
.
parseLong
(
id
));
String
path
=
modelSavePath
+
"/"
+
rt
.
getDataModelView
().
getModelScriptName
()+
" "
+
id
+
" 1
"
;
String
path
=
modelSavePath
+
"/"
+
rt
.
getDataModelView
().
getModelScriptName
()+
" "
+
id
+
" 1
"
+
previewId
;
// String path ="d:\\rscript\\a.r";
try
{
Runtime
run
=
Runtime
.
getRuntime
();
// 返回与当前 Java 应用程序相关的运行时对象
try
{
String
cmds
=
"Rscript "
+
path
;
// 注意:对字符串中路径\进行转义
Process
p
=
run
.
exec
(
cmds
);
// 启动另一个进程来执行命令
InputStream
is
=
p
.
getInputStream
();
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
is
));
String
line
=
null
;
//[1] "13500001"
StringBuffer
context
=
new
StringBuffer
();
while
((
line
=
reader
.
readLine
())
!=
null
){
System
.
out
.
println
(
line
);
context
.
append
(
line
);
}
System
.
out
.
println
(
"context:"
+
context
);
int
i
=
context
.
indexOf
(
"EWARNING_DETAIL_ID:"
);
String
k
=
context
.
substring
(
i
+
19
,
context
.
length
()-
1
);
p
.
waitFor
();
is
.
close
();
reader
.
close
();
p
.
destroy
();
app
=
aPPEWarningDetailDao
.
findByEwarningDetailId
(
Long
.
parseLong
(
k
));
// try {
// Runtime run = Runtime.getRuntime();// 返回与当前 Java 应用程序相关的运行时对象
// try {
// String cmds = "Rscript "+path; // 注意:对字符串中路径\进行转义
// Process p = run.exec(cmds);// 启动另一个进程来执行命令
// InputStream is = p.getInputStream();
// BufferedReader reader = new BufferedReader(new InputStreamReader(is));
// String line = null;
// //[1] "13500001"
// StringBuffer context = new StringBuffer();
// while ((line = reader.readLine()) != null){
// System.out.println(line);
// context.append(line);
// }
//
// System.out.println("context:"+context);
// int i = context.indexOf("EWARNING_DETAIL_ID:");
// String k = context.substring(i+19,context.length()-1);
//
// p.waitFor();
// is.close();
// reader.close();
// p.destroy();
// app = aPPEWarningDetailDao.findByEwarningDetailId(Long.parseLong(k));
//
// app.seteWarningCalcResult(eWarningCalcResultDao.findByEwarningDetailId(app.getEwarningDetailId()));
//
//
// } catch (Exception e) {
// e.printStackTrace();
// }
// }catch (Exception e){
// System.out.println("错误:"+e.toString());
// }
System
.
out
.
println
(
path
);
app
=
aPPEWarningDetailDao
.
findByEwarningDetailId
(
Long
.
parseLong
(
"13500001"
));
app
.
seteWarningCalcResult
(
eWarningCalcResultDao
.
findByEwarningDetailId
(
app
.
getEwarningDetailId
()));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
catch
(
Exception
e
){
System
.
out
.
println
(
"错误:"
+
e
.
toString
());
}
return
app
;
};
...
...
@@ -431,8 +439,30 @@ public class TaskManageController {
paramValArr
=
new
String
[]{
parameterVal
};
}
}
List
<
Long
>
paramIdList
=
new
ArrayList
<
Long
>();
for
(
String
aParamIdArr
:
paramIdArr
)
{
paramIdList
.
add
(
Long
.
parseLong
(
aParamIdArr
));
}
return
"success"
;
List
<
ModelParameter
>
mpL
=
modelParameterDao
.
findAllByParameterIdIn
(
paramIdList
);
String
t
=
new
Date
().
getTime
()+
""
;
for
(
int
i
=
0
;
i
<
mpL
.
size
();
i
++)
{
for
(
Long
aLong
:
paramIdList
)
{
if
(
aLong
.
equals
(
mpL
.
get
(
i
).
getParameterId
())){
PreviewParameter
pp
=
new
PreviewParameter
();
pp
.
setParameterName
(
mpL
.
get
(
i
).
getParameterName
());
assert
paramValArr
!=
null
;
pp
.
setParameterValue
(
paramValArr
[
i
]);
pp
.
setParameterCode
(
mpL
.
get
(
i
).
getParameterCode
());
pp
.
setParameterSourceId
(
t
);
// assert paramValArr != null;
// mpL.get(i).setParameterValue();
previewParameterDao
.
save
(
pp
);
}
}
}
// modelParameterDao.save(mpL);
return
"success?"
+
t
;
}
...
...
src/main/webapp/WEB-INF/views/TaskManage/ModelMonitorHome.jsp
View file @
bc1b51e5
...
...
@@ -105,7 +105,7 @@
var
content
=
"<div class='dialog-p' style='max-height: 560px; overflow-y: scroll; overflow-x: auto;'>"
+
" <div class='col-xs-12'>"
+
" <div class='panel panel-default'>"
+
" <div class='panel-heading'>模型预览<
input onclick='editTask(this)' id='"
+
taskType
+
"_"
+
id
+
"' style='float:right' type='button' class='btn btn-primary' value='参数修改'><
/div>"
+
" <div class='panel-heading'>模型预览</div>"
+
" <div class='panel-body'>"
+
" <table class='table table-vertical'>"
+
" <tr><td>"
+
...
...
src/main/webapp/WEB-INF/views/TaskManage/RunTaskList.jsp
View file @
bc1b51e5
...
...
@@ -14,6 +14,7 @@
<script
src=
"${ctx}/static/js/slideCommon.js"
></script>
<
%
--
<
script
src=
"${ctx}/static/js/mlpushmenu.js"
></script>
--%>
<script
language=
"javascript"
>
var
paraDialog
=
null
;
var
taskName
=
""
;
<
c
:
if
test
=
"${queryCondition.defaultTaskType == 1}"
>
...
...
@@ -112,25 +113,14 @@ taskName = "自定义任务";
});
}
function
preview
(){
var
id
=
$
(
'input[name="taskId"]:checked'
).
val
();
var
taskType
=
'${queryCondition.defaultTaskType}'
;
<%--
$
{
ctx
}
/static/im
ages
/
loading
.
gif
--%>
$
(
"#loading"
).
show
();
$
.
ajax
({
type
:
'GET'
,
'url'
:
'${ctx}/BaseManage/TaskManage/modelPreview?id='
+
id
,
data
:
""
,
success
:
function
(
data
)
{
$
(
"#loading"
).
hide
();
parent
.
OpenDialog
(
data
,
id
,
taskType
);
}
});
parameterChange
()
}
function
parameterChange
()
{
var
id
=
$
(
'input[name="taskId"]:checked'
).
val
();
$
.
ajax
({
...
...
@@ -151,10 +141,11 @@ taskName = "自定义任务";
"</tbody>"
+
"</table>"
+
"<div><button class='btn-sm btn btn-success btn-sm btn-group btn-group-cog' onclick='changeParameter();'>确认</button></div>"
+
"<div><button class='btn-sm btn btn-warning btn-sm btn-group btn-group-cog' onclick='cancel();'>取消预览</button></div>"
+
"</div>"
;
$
.
dialog
({
title
:
'参数修改'
,
paraDialog
=
$
.
dialog
({
title
:
'
预览
参数修改'
,
content
:
context
,
lock
:
true
});
...
...
@@ -166,22 +157,44 @@ taskName = "自定义任务";
function
changeParameter
()
{
var
paramId
=
""
;
var
paramVal
=
""
;
var
trL
=
$
(
'tr[class="parameterTr"]'
).
each
(
function
(){
var
id
=
$
(
'input[name="taskId"]:checked'
).
val
();
var
taskType
=
'${queryCondition.defaultTaskType}'
;
$
(
'tr[class="parameterTr"]'
).
each
(
function
(){
paramId
+=
$
(
this
).
context
.
id
+
","
;
paramVal
+=
$
(
this
).
find
(
"input"
).
val
()
+
","
;
});
paramId
=
paramId
.
substring
(
0
,
paramId
.
length
-
1
)
paramVal
=
paramVal
.
substring
(
0
,
paramVal
.
length
-
1
)
paramId
=
paramId
.
substring
(
0
,
paramId
.
length
-
1
)
;
paramVal
=
paramVal
.
substring
(
0
,
paramVal
.
length
-
1
)
;
$
.
ajax
({
url
:
'${ctx}/BaseManage/TaskManage/updateParameter?parameterId='
+
paramId
+
"¶meterVal="
+
paramVal
,
type
:
'get'
,
success
:
function
(
data
)
{
var
state
=
data
.
split
(
"?"
)[
0
];
var
t
=
data
.
split
(
"?"
)[
1
];
if
(
state
===
"success"
){
paraDialog
.
close
();
$
(
"#loading"
).
show
();
$
.
ajax
({
type
:
'GET'
,
'url'
:
'${ctx}/BaseManage/TaskManage/modelPreview?id='
+
id
+
"&previewId="
+
t
,
data
:
""
,
success
:
function
(
data
)
{
$
(
"#loading"
).
hide
();
parent
.
OpenDialog
(
data
,
id
,
taskType
);
}
});
}
}
})
}
function
cancel
()
{
paraDialog
.
close
()
}
...
...
src/main/webapp/WEB-INF/views/TaskManage/RunTaskListTable.jsp
View file @
bc1b51e5
...
...
@@ -14,7 +14,6 @@
<%--create by afe 2017-10-26--%>
<c:if test="${runTask.defaultTaskType == '1' || runTask.defaultTaskType == '5' }">
<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" id="ModelPreview" onclick="preview()" disabled>模型预览</button>
<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" id="parameterChange" onclick="parameterChange()" disabled>参数修改</button>
</c:if>
</div>
</div>
...
...
src/main/webapp/static/js/ruleResultDetailTable.js
View file @
bc1b51e5
...
...
@@ -555,7 +555,7 @@ function selectRule(qualityRuleId){
$
.
ajax
({
type
:
'GET'
,
contentType
:
'application/json'
,
url
:
"
${ctx}
/AnalysisSupport/QualityRuleResult/findAccuracy?qualityRuleId="
+
qualityRuleId
,
url
:
"/AnalysisSupport/QualityRuleResult/findAccuracy?qualityRuleId="
+
qualityRuleId
,
dataType
:
'text'
,
beforeSend
:
function
(
data
)
{
},
...
...
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