Commit 25f2cdf0 authored by afe's avatar afe

模型监控增加字段,增加添加修改模型参数

模型预览完成
parent 009b18e1
......@@ -3,7 +3,7 @@
### Example user template
# IntelliJ project files
.idea
*.iml
out
gen
......
......@@ -3,6 +3,13 @@
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES5" />
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" default="false" project-jdk-name="1.6" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
......
This diff is collapsed.
No preview for this file type
//package com.hp.cmsz.entity;
//
//import javax.persistence.Entity;
//import javax.persistence.Table;
//
//@Entity
//@Table(name="etl.APP_EWARNING_DETAIL_T")
//public class APPEWarningDetail {
// private Long EwarningDetailId;
//// private Long EwarningDetailId;
//
//
//
//}
package com.hp.cmsz.entity;
import com.hp.cmsz.entity.commonmanage.EWarningCalcResult;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;
@Entity
@Table(name="Model_Preview_v",schema = "ccolap")
public class APPEWarningDetail {
private Long ewarningDetailId;
private String provinceName;
private String datasourceName;
private String busname;
private String channelName;
private String kpiName;
private String kpiCode;
private Timestamp busdatabegTime;
private Timestamp busdataendTime;
private String threshold1Val;
private String threshold2Val;
private String threshold3Val;
private String warn1Val;
private String warn2Val;
private String warn3Val;
private String fileAddress;
private List<EWarningCalcResult> eWarningCalcResult;
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
public Long getEwarningDetailId() {
return ewarningDetailId;
}
public void setEwarningDetailId(Long ewarningDetailId) {
this.ewarningDetailId = ewarningDetailId;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
public String getDatasourceName() {
return datasourceName;
}
public void setDatasourceName(String datasourceName) {
this.datasourceName = datasourceName;
}
public String getBusname() {
return busname;
}
public void setBusname(String busname) {
this.busname = busname;
}
public String getChannelName() {
return channelName;
}
public void setChannelName(String channelName) {
this.channelName = channelName;
}
public String getKpiName() {
return kpiName;
}
public void setKpiName(String kpiName) {
this.kpiName = kpiName;
}
public String getKpiCode() {
return kpiCode;
}
public void setKpiCode(String kpiCode) {
this.kpiCode = kpiCode;
}
public Timestamp getBusdatabegTime() {
return busdatabegTime;
}
public void setBusdatabegTime(Timestamp busdatabegTime) {
this.busdatabegTime = busdatabegTime;
}
public Timestamp getBusdataendTime() {
return busdataendTime;
}
public void setBusdataendTime(Timestamp busdataendTime) {
this.busdataendTime = busdataendTime;
}
@Column(name = "threshold1_val")
public String getThreshold1Val() {
return threshold1Val;
}
public void setThreshold1Val(String threshold1Val) {
this.threshold1Val = threshold1Val;
}
@Column(name = "threshold2_val")
public String getThreshold2Val() {
return threshold2Val;
}
public void setThreshold2Val(String threshold2Val) {
this.threshold2Val = threshold2Val;
}
@Column(name = "threshold3_val")
public String getThreshold3Val() {
return threshold3Val;
}
public void setThreshold3Val(String threshold3Val) {
this.threshold3Val = threshold3Val;
}
@Column(name = "warn1_val")
public String getWarn1Val() {
return warn1Val;
}
public void setWarn1Val(String warn1Val) {
this.warn1Val = warn1Val;
}
@Column(name = "warn2_Val")
public String getWarn2Val() {
return warn2Val;
}
public void setWarn2Val(String warn2Val) {
this.warn2Val = warn2Val;
}
@Column(name = "warn3_Val")
public String getWarn3Val() {
return warn3Val;
}
public void setWarn3Val(String warn3Val) {
this.warn3Val = warn3Val;
}
public String getFileAddress() {
return fileAddress;
}
public void setFileAddress(String fileAddress) {
this.fileAddress = fileAddress;
}
@Transient
public List<EWarningCalcResult> geteWarningCalcResult() {
return eWarningCalcResult;
}
public void seteWarningCalcResult(List<EWarningCalcResult> eWarningCalcResult) {
this.eWarningCalcResult = eWarningCalcResult;
}
}
......@@ -34,6 +34,7 @@ public class Business implements Serializable{
public Long getBusinessId() {
return businessId;
}
public void setBusinessId(Long businessId) {
this.businessId = businessId;
}
......
......@@ -27,13 +27,13 @@ public class Channel implements Serializable{
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="ChannelSequence")
@SequenceGenerator(name = "ChannelSequence", sequenceName = "dim_channel_info_t_seq", allocationSize=20)
public Long getChannelId() {
return channelId;
}
public String getChannelName() {
return channelName;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
......
......@@ -26,12 +26,14 @@ public class DataSource implements Serializable{
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="DataSourceSequence")
@SequenceGenerator(name = "DataSourceSequence", sequenceName = "dim_data_source_info_t_seq", allocationSize=20)
public String getDataSourceName() {
return dataSourceName;
}
public Long getDataSourceId() {
return dataSourceId;
}
public String getDataSourceName() {
return dataSourceName;
}
public void setDataSourceId(Long dataSourceId) {
this.dataSourceId = dataSourceId;
}
......
......@@ -18,7 +18,7 @@ import javax.persistence.Table;
*/
@Entity
@Table(name = "etl.dim_kpi_t")
@Table(name = "dim_kpi_t",schema = "etl")
public class DimKpi implements Serializable{
/**
......
package com.hp.cmsz.entity.commonmanage;
import javax.persistence.*;
import java.sql.Timestamp;
@Entity
@Table(name = "APP_EWARNING_CALC_RESULT_T", schema = "ETL")
public class EWarningCalcResult {
private Long ewarningDataresultId;
private Timestamp resultDate;
private Long dim1Val;
private Long dim2Val;
private Long ewarningDetailId;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EWarningCalcResultSequence")
@SequenceGenerator(name = "EWarningCalcResultSequence", sequenceName = "SEQ_APP_EWARNING_CALC_RESULT", allocationSize = 1)
public Long getEwarningDataresultId() {
return ewarningDataresultId;
}
public void setEwarningDataresultId(Long ewarningDataresultId) {
this.ewarningDataresultId = ewarningDataresultId;
}
public Timestamp getResultDate() {
return resultDate;
}
public void setResultDate(Timestamp resultDate) {
this.resultDate = resultDate;
}
@Column(name = "dim1_val")
public Long getDim1Val() {
return dim1Val;
}
public void setDim1Val(Long dim1Val) {
this.dim1Val = dim1Val;
}
@Column(name = "dim2_val")
public Long getDim2Val() {
return dim2Val;
}
public void setDim2Val(Long dim2Val) {
this.dim2Val = dim2Val;
}
public Long getEwarningDetailId() {
return ewarningDetailId;
}
public void setEwarningDetailId(Long ewarningDetailId) {
this.ewarningDetailId = ewarningDetailId;
}
}
......@@ -53,21 +53,21 @@ public class RunTask {
@JoinColumn(name = "province_id")
private Province provinceView;
private Long kpiId;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "kpi_id")
private DimKpi dimKpiView;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "channel_id")
private Channel channelView;
// @ManyToOne(fetch = FetchType.EAGER)
// @JoinColumn(name = "channel_id")
// private Channel channelView;
//
// @ManyToOne(fetch = FetchType.EAGER)
// @JoinColumn(name = "dataSource_id")
// private DataSource dataSourceView;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "data_source_id")
private DataSource dataSourceView;
// @ManyToOne(fetch = FetchType.EAGER)
// @JoinColumn(name = "business_id")
// private Business businessView;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "business_id")
private Business businessView;
@Temporal(TemporalType.TIMESTAMP)
......@@ -204,37 +204,38 @@ public class RunTask {
this.provinceView = provinceView;
}
public Long getKpiId() {
return kpiId;
}
public void setKpiId(Long kpiId) {
this.kpiId = kpiId;
}
// public Channel getChannelView() {
// return channelView;
// }
//
// public void setChannelView(Channel channelView) {
// this.channelView = channelView;
// }
//
// public DataSource getDataSourceView() {
// return dataSourceView;
// }
//
// public void setDataSourceView(DataSource dataSourceView) {
// this.dataSourceView = dataSourceView;
// }
//
// public Business getBusinessView() {
// return businessView;
// }
//
// public void setBusinessView(Business businessView) {
// this.businessView = businessView;
// }
public DimKpi getDimKpiView() {
return dimKpiView;
}
public void setDimKpiView(DimKpi dimKpiView) {
this.dimKpiView = dimKpiView;
}
public Channel getChannelView() {
return channelView;
}
public void setChannelView(Channel channelView) {
this.channelView = channelView;
}
public DataSource getDataSourceView() {
return dataSourceView;
}
public void setDataSourceView(DataSource dataSourceView) {
this.dataSourceView = dataSourceView;
}
public Business getBusinessView() {
return businessView;
}
public void setBusinessView(Business businessView) {
this.businessView = businessView;
}
/*public String getParallelFlg() {
return parallelFlg;
}
......
......@@ -11,10 +11,13 @@ import org.springframework.data.repository.query.Param;
import com.hp.cmsz.entity.DimKpi;
public interface DimKpiDao extends JpaSpecificationExecutor<DimKpi>,
PagingAndSortingRepository<DimKpi, Long>{
PagingAndSortingRepository<DimKpi, Long>{
List<DimKpi> findAllByIsActiveAndBusnameId(String active,Long businessId);
//通过kpiTypeId查找数据采集频率
@Query("select dk.calCycle from DimKpi dk where dk.kpiTypeId = ?1")
@Query("select dk.calCycle from DimKpi dk where dk.kpiTypeId = :kpiTypeId")
List<String> findCayCycleByKpiTypeIdIn(@Param("kpiTypeId")Long kpiTypeId);
//通过kpiTypeId修改数据采集频率
......
......@@ -34,6 +34,11 @@ public interface ModelParameterDao extends JpaSpecificationExecutor<ModelParamet
//根据数据模型ID查找系统默认的参数d
List<ModelParameter> findByDataModelIdAndIfSystemDefault(Long dataModelId, Long ifSystemDefault);
//根据任务ID查找系统默认的参数d
List<ModelParameter> findByTaskIdAndIfSystemDefault(Long taskId, Long ifSystemDefault);
//根据数据模型ID查找参数d
List<ModelParameter> findByDataModelIdIn(List<Long> dataModelId);
......
package com.hp.cmsz.repository.commonmanage;
import com.hp.cmsz.entity.APPEWarningDetail;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface APPEWarningDetailDao extends PagingAndSortingRepository<APPEWarningDetail,
Long>, JpaSpecificationExecutor<APPEWarningDetail> {
APPEWarningDetail findByEwarningDetailId(Long id);
}
package com.hp.cmsz.repository.commonmanage;
import com.hp.cmsz.entity.commonmanage.EWarningCalcResult;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface EWarningCalcResultDao extends PagingAndSortingRepository<EWarningCalcResult, Long>,
JpaSpecificationExecutor<EWarningCalcResult> {
List<EWarningCalcResult> findByEwarningDetailId(Long id);
}
package com.hp.cmsz.service.analysissupport;
import com.hp.cmsz.entity.DimKpi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.hp.cmsz.repository.DimKpiDao;
import java.util.List;
@Service
@Transactional
public class DimKpiService {
......@@ -18,4 +21,9 @@ public class DimKpiService {
private void updateByKpiTypeId(String calCycle,Long kpiTypeId){
dimKpiDao.updateDimKpiByKpiTypeId(calCycle, kpiTypeId);
}
//查出active为Y的所以KPI指标
public List<DimKpi> findAllByIsActiveAAndBusnameId(Long businessId){
return dimKpiDao.findAllByIsActiveAndBusnameId("Y",businessId);
}
}
......@@ -74,37 +74,66 @@
</div>
</div>
<script type="">
function OpenDialog(data) {
// var data = JSON.parse(data);
var dilog;
function editTask(e){
// var id = $('input[name="taskId"]:checked').val();
var id = e.id.split("_")[1];
var taskType=e.id.split("_")[0];
dilog.close();
document.getElementById("taskManageFrame").src='${ctx}'+"/BaseManage/TaskManage/taskFormFrame?defaultTaskType="+taskType+"&taskId=" + id+"&type=modify";
}
function OpenDialog(data,id,taskType) {
var df=new SimpleDateFormat();
df.applyPattern("yyyy-MM-dd HH:mm:ss");
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='createWorkingDetail()' id='createWorkingDetail' style='float:right' type='button' class='btn btn-primary' value='参数修改'></div>" +
" <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-body'>"+
" <table class='table table-vertical'>"+
" <tr><td>"+
" <table class='table table-vertical'>" +
" <tr>" +
" <td width='10%'>省份</td>" +
" <td>自定义</td>" +
" <td>"+data.provinceName+"</td>" +
" <td width='10%'>数据来源</td>" +
" <td>自定义</td>" +
" <td>"+data.datasourceName+"</td>" +
" <td width='10%'>业务</td>" +
" <td>自定义</td>" +
" <td width='10%'>渠道</td>" +
" <td>自定义</td>" +
" <td>"+data.busname+"</td>" +
" </tr>" +
" <tr>" +
" <td width='10%'>渠道</td>" +
" <td>"+data.channelName+"</td>" +
" <td>指标编码</td>" +
" <td>自定义</td>" +
" <td>"+data.kpiCode+"</td>" +
" <td>指标名称</td>" +
" <td>自定义</td>" +
" <td>"+data.kpiName+"</td>" +
" </tr>" +
" <tr>" +
" <td>预测开始时间</td>" +
" <td>自定义</td>" +
" <td>"+df.format(new Date(data.busdatabegTime))+"</td>" +
" <td>预测结束时间</td>" +
" <td>自定义</td>" +
" <td>"+df.format(new Date(data.busdataendTime))+"</td>" +
" <td>阈值1</td>" +
" <td>"+removeNull(data.threshold1Val)+"</td>" +
" </tr>" +
" <tr>" +
" <td>阈值2</td>" +
" <td>"+removeNull(data.threshold2Val)+"</td>" +
" <td>阈值3</td>" +
" <td>"+removeNull(data.threshold3Val)+"</td>" +
" <td>阈值告警1</td>" +
" <td>"+removeNull(data.warn1Val)+"</td>" +
" </tr>" +
" <tr>" +
" <td>阈值告警2</td>" +
" <td>"+removeNull(data.warn2Val)+"</td>" +
" <td>阈值告警3</td>" +
" <td>"+removeNull(data.warn3Val)+"</td>" +
" </tr>" +
" <tr>" +
" <td colspan='8' align='center'>图表展示</td>" +
......@@ -112,20 +141,46 @@
" <tr>" +
" <td colspan='8'>" +
" <div class=''>" +
<%--" <iframe id='ewarningIf' style='height:560px;padding: 7px;' scrolling='no' src='${biserver_config}&path=MonitorOperation/WarnAnalysis&action=GJFX_DETAIL_RELATED_EWARN.xaction&wrapper=false&height=534&WarningID="+getCol(t1, 'warningId')+ "&WarningSourceTag="+getCol(t1, 'warningSourceId')+ "&ctx=${ctx}" +"'></iframe>" +--%>
" <img src='${ctx}/BaseManage/TaskManage/modelPreviewImg?path="+data.fileAddress+"'/>" +
" </div>" +
" </td>" +
" </tr>" +
" <tr>" +
" <td colspan='8' align='center'>模型数据明细展示</td>" +
" </tr>" +
" <tr>" +
" <td colspan='8'>" +
" <div class='panel-body'>" +
" <table class='table '>" +
" <thead>" +
" <tr><th colspan='2'>时间</th><th colspan='2'>真实值</th><th colspan='2'>预测值</th></tr>" +
" </thead>" +
" <tbody>" ;
data.eWarningCalcResult = data.eWarningCalcResult.sort(function (a,b) {
return a.resultDate-b.resultDate
});
data.eWarningCalcResult.forEach(function (t) {
content = content+"<tr><td colspan='2'>"+df.format(new Date(t.resultDate))+"<td><td colspan='2'>"+t.dim1Val+"</td><td colspan='2'>"+t.dim2Val+"</td></tr>"
});
content = content+
" </tbody>" +
" </table>"+
" </div>" +
" </td>" +
" </tr>" +
"</table>";
$.dialog({
dilog= $.dialog({
title:'模型预览结果',
content:content,
lock: true
});
}
function preview() {
OpenDialog();
function removeNull(val) {
return val==null?"":val
}
</script>
</body>
......
......@@ -29,7 +29,7 @@ taskName = "自定义任务";
$.dialog({
title: "提醒",
content:"确定新增" + taskName + "?",
ok: function(){window.location.href='${ctx}/BaseManage/TaskManage/taskFormFrame?defaultTaskType=${queryCondition.defaultTaskType}'},
ok: function(){window.location.href='${ctx}/BaseManage/TaskManage/taskFormFrame?defaultTaskType=${queryCondition.defaultTaskType}'+"&type=new"},
okValue:"确定",
cancel: function(){},
cancelValue:"取消",
......@@ -46,7 +46,7 @@ taskName = "自定义任务";
$.dialog({
title: "提醒",
content:"确定修改" + taskName + "?",
ok: function(){window.location.href = '${ctx}/BaseManage/TaskManage/taskFormFrame?defaultTaskType=${queryCondition.defaultTaskType}&taskId=' + id;},
ok: function(){window.location.href = '${ctx}/BaseManage/TaskManage/taskFormFrame?defaultTaskType=${queryCondition.defaultTaskType}&taskId=' + id+"&type=modify";},
okValue:"确定",
cancel: function(){},
cancelValue:"取消",
......@@ -134,10 +134,31 @@ taskName = "自定义任务";
}
});
}
function preview(){
function preview(e){
var id = $('input[name="taskId"]:checked').val();
parent.preview();
var taskType = '${queryCondition.defaultTaskType}';
$.ajax({
type : 'GET',
'url' : '${ctx}/BaseManage/TaskManage/modelPreview?id='+id,
data : "",
success : function(data) {
parent.OpenDialog(data,id,taskType);
}
});
}
function choseTask(){
$("#ModelPreview").attr("disabled", false);
}
$(document).ready(function(){
......
......@@ -12,7 +12,9 @@
<button class="btn-sm btn btn-warning btn-sm btn-group btn-group-cog" onclick="deleteTask();">删除</button>
<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" onclick="addTask();">新建</button>
<%--create by afe 2017-10-26--%>
<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" id="ModelPreview" onclick="preview()">模型预览</button>
<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>
</c:if>
</div>
</div>
......@@ -20,14 +22,12 @@
<thead>
<tr>
<th>选择</th>
<%--2017-10-26 create by afe--%>
<%--<th>任务代码</th>--%>
<c:if test="${runTask.defaultTaskType == '1' || runTask.defaultTaskType == '5' }">
<th>省份</th>
<th>渠道</th>
<th>业务名称</th>
<th>数据类型</th>
<th>指标名称</th>
</c:if>
<th>任务名称</th>
<th>任务类型</th>
<th>任务绑定信息</th>
......@@ -43,8 +43,13 @@
<c:forEach items="${taskList.content}" var="runTask">
<tr>
<td><input type="radio" name="taskId" id="taskId" value="${runTask.taskId}" /></td>
<td>${runTask.code}</td>
<td><input type="radio" name="taskId" id="taskId" value="${runTask.taskId}" onclick="choseTask()" /></td>
<c:if test="${runTask.taskType.tasktypeId == '1' || runTask.taskType.tasktypeId == '5' }">
<td>${runTask.provinceView.provinceName}</td>
<td>${runTask.channelView.channelName}</td>
<td>${runTask.businessView.businessName}</td>
<td>${runTask.dimKpiView.name}</td>
</c:if>
<td>${runTask.name}</td>
<td>
<c:forEach items="${taskTypeList}" var="taskType">
......
......@@ -9,16 +9,12 @@
ex = exception;
if (request.getAttribute("javax.servlet.error.exception") != null)
ex = (Throwable) request.getAttribute("javax.servlet.error.exception");
if(ex.getMessage().substring(0, 6).equals("R_HOME")){%>--%>
<c:set value="服务器上的R语言环境没配置正确或者Rserve服务没有启动!" var="msg" scope="page" />
<%}else{ %>
<c:set value="<%=ex.getMessage() %>" var="msg" scope="page" />
<%}
%>
<c:set value="<%=ex.toString() %>" var="msg" scope="page" />
<%
//记录日志
Logger logger = LoggerFactory.getLogger("500.jsp");
logger.error(ex.getMessage(), ex);
logger.error(ex.toString(), ex);
%>
<!DOCTYPE html>
......
......@@ -173,6 +173,10 @@
<location>/WEB-INF/views/error/500.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/WEB-INF/views/error/500.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/WEB-INF/views/error/500.jsp</location>
</error-page>
......
......@@ -110,7 +110,7 @@ function checkAndSubmit(url, data) {
function saveForm(id) {
var message = "";
if($("#"+id).val()) {
if($("#useType").val()!="new") {
message = "确定修改吗?";
} else {
message = "确定增加吗?";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment