Commit ef2804da authored by 胡斌's avatar 胡斌

智能分析平台备份提交

parent c5255ca4
......@@ -26,6 +26,7 @@ public class APPEWarningDetail {
private String warn2Val;
private String warn3Val;
private String fileAddress;
private String attr4;
private List<EWarningCalcResult> eWarningCalcResult;
......@@ -165,6 +166,14 @@ public class APPEWarningDetail {
this.fileAddress = fileAddress;
}
public String getAttr4() {
return attr4;
}
public void setAttr4(String attr4) {
this.attr4 = attr4;
}
@Transient
public List<EWarningCalcResult> geteWarningCalcResult() {
return eWarningCalcResult;
......
......@@ -78,7 +78,7 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs
" ON " +
" D.PROVINCE_ID=E.PROVINCE_ID " +
" AND D.KPI_ID =E.KPI_ID " +
" WHERE " +
" AND " +
" OCCUR_TIME >=TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') " +
" AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') " +
" GROUP BY " +
......@@ -144,7 +144,52 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs
" ON " +
" D.PROVINCE_ID=E.PROVINCE_ID " +
" AND D.KPI_ID =E.KPI_ID " +
" WHERE " +
" AND " +
" OCCUR_TIME >=TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') " +
" AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') " +
" GROUP BY " +
" ASSOCIATION_ID, " +
" D.PROVINCE_ID, " +
" ASSOCIATION_TYPE , " +
" ASSOCIATION_DESC, " +
" d.PROVINCE_NAME, " +
" WARNING_BEGIN_TIME, " +
" WARNING_END_TIME "
,nativeQuery = true)
public List<Object[]> findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(String warnBeginTime, String warnEndTime, String dimension, List<Long> provincelist);
@Query(value = "SELECT" +
" ASSOCIATION_ID AS associationId , " +
" D.PROVINCE_ID AS provinceId, " +
" ASSOCIATION_TYPE AS associationType , " +
" ASSOCIATION_DESC AS associationDesc, " +
" d.PROVINCE_NAME AS provinceName, " +
" WARNING_BEGIN_TIME AS warningBeginTime ," +
" WARNING_END_TIME AS warningEndTime ," +
" COUNT(E.KPI_ID) AS warningNum " +
" FROM " +
" ( " +
" SELECT " +
" A.ASSOCIATION_ID, " +
" C.PROVINCE_ID, " +
" A.ASSOCIATION_DESC, " +
" A.ASSOCIATION_TYPE, " +
" B.KPI_ID, " +
" C.PROVINCE_NAME, " +
" TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AS WARNING_BEGIN_TIME, " +
" TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME " +
" FROM " +
" CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A, CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T B , " +
" CCOLAP.DIM_PROVINCE_INFO_T C " +
"WHERE " +
" A.ASSOCIATION_ID=B.ASSOCIATION_ID and C.PROVINCE_ID in(?3)) D " +
" LEFT JOIN " +
" CCOLAP.xcd_warning_detail_info_v E " +
" ON " +
" D.PROVINCE_ID=E.PROVINCE_ID " +
" AND D.KPI_ID =E.KPI_ID " +
" AND " +
" OCCUR_TIME >=TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') " +
" AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') " +
" GROUP BY " +
......@@ -156,7 +201,9 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs
" WARNING_BEGIN_TIME, " +
" WARNING_END_TIME "
,nativeQuery = true)
public List<Object[]> findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(String warnBeginTime, String warnEndTime, char dimension, List<Long> provincelist);
public List<Object[]> findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndProvinceList(String warnBeginTime, String warnEndTime,List<Long> provincelist);
@Query(value = "SELECT ASSOCIATION_ID, D.PROVINCE_ID, ASSOCIATION_TYPE ,ASSOCIATION_DESC, PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME," +
......@@ -248,7 +295,7 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs
" ON " +
" D.PROVINCE_ID=E.PROVINCE_ID " +
" AND D.KPI_ID =E.KPI_ID " +
" WHERE " +
" AND " +
" OCCUR_TIME >=TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') " +
" AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') " +
" AND ASSOCIATION_ID= ?3" +
......@@ -301,7 +348,7 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs
" ON " +
" D.PROVINCE_ID=E.PROVINCE_ID " +
" AND D.KPI_ID =E.KPI_ID " +
" WHERE " +
" AND " +
" OCCUR_TIME >=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') " +
" AND OCCUR_TIME <=TO_TIMESTAMP(?3,'YYYY-MM-DD HH24:MI:SS') " +
" GROUP BY " +
......
......@@ -6,6 +6,7 @@ import com.hp.cmsz.entity.AssociateDiagosisWarningDetail;
import com.hp.cmsz.entity.XcdWarningInfoView;
import com.hp.cmsz.repository.DimAssociationAnaInfoDao;
import com.hp.cmsz.repository.XcdWarningInfoViewDao;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Service;
......@@ -88,10 +89,16 @@ public class AssociateDiagosisDetailService {
// return dimAssociationAnaInfoDao.findAssociateDiagosisDetailByWarnTimeBeginAndEnd(warnBeginTime, warnEndTime);
}
public List<AssociateDiagosisDetail> findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(String warnBeginTime, String warnEndTime, char dimension, List<Long> provincelist){
public List<AssociateDiagosisDetail> findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(String warnBeginTime, String warnEndTime, String dimension, List<Long> provincelist){
List<Object[]> list=dimAssociationAnaInfoDao.findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(warnBeginTime, warnEndTime,dimension,provincelist);
List<AssociateDiagosisDetail>diagosisDetails=new ArrayList<AssociateDiagosisDetail>();
List<Object[]> list = null;
if(StringUtils.isNotEmpty(dimension)){
list =dimAssociationAnaInfoDao.findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(warnBeginTime, warnEndTime,dimension,provincelist);
}else{
list=dimAssociationAnaInfoDao.findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndProvinceList(warnBeginTime, warnEndTime,provincelist);
}
List<AssociateDiagosisDetail>diagosisDetails=new ArrayList<AssociateDiagosisDetail>();
if(null!=list){
for (Object[] objects : list) {
AssociateDiagosisDetail detail=new AssociateDiagosisDetail();
......
......@@ -343,46 +343,45 @@ public class TaskManageController {
RunTask rt = runTaskService.getRunTask(Long.parseLong(id));
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));
//
// 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"));
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());
}
app.seteWarningCalcResult(eWarningCalcResultDao.findByEwarningDetailId(app.getEwarningDetailId()));
// app = aPPEWarningDetailDao.findByEwarningDetailId(Long.parseLong("13500001"));
//
// app.seteWarningCalcResult(eWarningCalcResultDao.findByEwarningDetailId(app.getEwarningDetailId()));
return app;
......@@ -419,18 +418,20 @@ public class TaskManageController {
public String ImgDisplay(Map model) throws ParseException {
return PageURLController.RunTaskImgDisplay;
}
//根据任务id获取模型参数
@RequestMapping(value = "/getParameterByTaskId*", method = RequestMethod.GET)
@ResponseBody
public List<ModelParameter> getParameter(String taskId ,Map model) throws ParseException {
List<ModelParameter> mpl = modelParameterDao.findByTaskIdAndIfSystemDefault(Long.parseLong(taskId),1L);
return mpl;
}
//更改模型预览的临时参数
@RequestMapping(value = "/updateParameter*", method = RequestMethod.GET)
@ResponseBody
public String updateParameter(String parameterId,String parameterVal ,Map model) throws ParseException {
String [] paramIdArr = null;
String [] paramValArr = null;
if(",".contains(parameterId)){
if(parameterId.contains(",")){
paramIdArr = parameterId.split(",");
paramValArr = parameterVal.split(",");
}else{
......@@ -439,8 +440,10 @@ public class TaskManageController {
paramValArr = new String[]{parameterVal};
}
}
List<Long> paramIdList = new ArrayList<Long>();
for (String aParamIdArr : paramIdArr) {
System.out.println(aParamIdArr);
paramIdList.add(Long.parseLong(aParamIdArr));
}
......@@ -455,13 +458,10 @@ public class TaskManageController {
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;
}
......@@ -469,4 +469,5 @@ public class TaskManageController {
}
\ No newline at end of file
......@@ -17,6 +17,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.crypto.Data;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
......@@ -208,9 +209,9 @@ public class ModelMaintainController {
if(!modelExeScriptName.trim().equals("")){
dataModel.setModelScriptName(modelExeScriptName);
File file = new File(modelSavePath,modelExeScriptName);
/* if(!file.exists()){
if(!file.exists()){
fm.write(file);
}*/
}
}
}
}
......@@ -318,4 +319,43 @@ public class ModelMaintainController {
e.printStackTrace();
}
}
//下载模型
@RequestMapping(value = "/modelDownload*", method = RequestMethod.POST)
public void modelDownload(@RequestParam("modelId") String modelId, HttpServletRequest request,
HttpServletResponse response) throws Exception {
response.setContentType("application/octet-stream");
DataModel dm = dataModelDao.findByDataModelId(Long.parseLong(modelId));
String fileName = dm.getModelScriptName();
response.setHeader("Content-Disposition","attachment;filename="+fileName );
String modelSavePath = systemParameterDao.findByParameterName("MODEL_SCRIPT_FILE_DIR").get(0).getParameterValue();
fileName = modelSavePath+"/"+fileName;
// fileName = "D:\\Untitled-3.txt";
File file = new File(fileName);
response.setContentLength((int) file.length());
FileInputStream fis = null;
try {
fis = new FileInputStream(file);
byte[] buffer = new byte[128];
int count = 0;
while ((count = fis.read(buffer)) > 0) {
response.getOutputStream().write(buffer, 0, count);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
response.getOutputStream().flush();
response.getOutputStream().close();
fis.close();
}
}
}
......@@ -116,7 +116,7 @@ public class AssociateDiagosisDetailController {
@RequestParam(value = "detailProvince", defaultValue = "") String detailProvince) {
String str = "";
if (detailtime.equalsIgnoreCase("")
|| dimension.equalsIgnoreCase("") || detailProvince.equalsIgnoreCase("")) {
|| detailProvince.equalsIgnoreCase("")) {
return str;
}
String[] provinceStr = detailProvince.split(",");
......@@ -128,12 +128,10 @@ public class AssociateDiagosisDetailController {
warnBeginTime.replaceAll("%", " ");
warnEndTime = times[1];
warnEndTime.replaceAll("%", " ");
char dimensionc = 'd';
try {
for (String s : provinceStr) {
provinceList.add(Long.parseLong(s));
}
dimensionc = dimension.charAt(0);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
format.parse(warnBeginTime);
format.parse(warnEndTime);
......@@ -143,7 +141,7 @@ public class AssociateDiagosisDetailController {
return str;
}
List<AssociateDiagosisDetail> diagosisDetails = associateDiagosisDetailService.
findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(warnBeginTime, warnEndTime, dimensionc, provinceList);
findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(warnBeginTime, warnEndTime, dimension, provinceList);
Gson gson = new Gson();
return gson.toJson(diagosisDetails);
......
......@@ -23,8 +23,9 @@
<div class="slide-select">
<label for="">关联维度:</label>
<select name="xcdStatus" id="xcdStatusSelect" class="slide-menu-select" onChange="judge=false;">
<option value="c">业务</option>
<option value="y" selected>渠道</option>
<option value="" selected>全部</option>
<option value="y">业务</option>
<option value="c" >渠道</option>
<%--<c:forEach var="workingOrderStatus" items="${workingOrderStatusList}">
<option value="${workingOrderStatus}" id="xcdStatus">
${workingOrderStatus}
......
......@@ -45,8 +45,6 @@
<tags:FXJM_Status/>
<tags:ModelDataType/>
<tags:FXJM_TitleSearch/>
<!-- <tags:FXJM_modelResult_DeployedServerTag/> -->
<button id="submit" class="btn btn-primary" onclick="modelResultSubmit()">提交</button>
<button id="disable" class="btn btn-warning" onclick="modelResultReset()">重置</button>
......@@ -80,6 +78,7 @@
模型查询结果
<shiro:hasAnyRoles name="admin,dataAnalysis,businessAnalysis">
<div id="time_div" style="top: -6px;float: right;height: 0px;position: relative;">
<button class="btn-sm btn btn-info btn-sm btn-group btn-group-cog" id="ModelDownload" onclick="modelDownload()" disabled>模型下载</button>
<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" id="updateModel" disabled>修改模型</button>
<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" id="createModel">新建模型</button>
</div>
......@@ -103,8 +102,9 @@
<script type="text/javascript" src="${ctx}/static/js/modelResultDetailTable.js"></script>
<script type="text/javascript">
initDate();
var receiveModelPageNum = "${modelPageNum}";
modelResultDetailTable();
if(receiveModelPageNum!=1){
......@@ -182,6 +182,7 @@
modelResultDetailTable();
modelId="";
$("#updateModel").attr("disabled", true);
$("#ModelDownload").attr("disabled", true);
toggleMenu('slidePushMenus2');//隐藏筛选项
updateTag(true);
}
......@@ -207,6 +208,7 @@
modelResultDetailTable();
modelId="";
$("#updateModel").attr("disabled", true);
$("#ModelDownload").attr("disabled", true);
toggleMenu('slidePushMenus2');//隐藏筛选项
updateTag(true);
}
......@@ -238,7 +240,14 @@
}
}
}
function modelDownload() {
var url = "${ctx}/ModelManage/ModelMaintain/modelDownload";
var form = $("<form></form>").attr("action", url).attr("method", "POST");
form.append($("<input/>").attr("type", "hidden").attr("name", "modelId").attr("value", modelId));
form.appendTo('body').submit().remove();
}
//更新按钮点击
$("#updateModel").click(function(){
var pageNum = $("#goPageNo").val();
......
......@@ -154,7 +154,7 @@
</div>
</div>
</div>
${diagosisDetails}
</div>
<script type="text/javascript">
......
......@@ -150,7 +150,7 @@
" </tr>" +
" <tr>" +
" <td>模型评价</td>" +
" <td colspan='6' align='center'>"+data.evaluationResult+"</td>" +
" <td colspan='6' align='center'>"+removeNull(data.attr4)+"</td>" +
" </tr>" +
" <tr>" +
" <td colspan='8' align='center'>图表展示</td>" +
......
......@@ -153,7 +153,6 @@ taskName = "自定义任务";
}
})
}
function changeParameter() {
var paramId = "";
var paramVal = "";
......@@ -200,9 +199,13 @@ taskName = "自定义任务";
function choseTask(){
$("#ModelPreview").attr("disabled", false);
$("#parameterChange").attr("disabled", false);
$("#ModelDownload").attr("disabled", false);
}
$(document).ready(function(){
queryResult(1);
});
......
......@@ -7,13 +7,13 @@
<div id="time_div" style="top: -6px;float: right;height: 0px;position: relative;">
<button class="btn-sm btn btn-success btn-sm btn-group btn-group-cog" onclick="changeTaskStatus('1')">运行</button>
<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" onclick="changeTaskStatus('2')">暂停</button>
<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" onclick="editTask();">修改</button>
<button class="btn-sm btn btn-warning btn-sm btn-group btn-group-cog" onclick="deleteTask();">删除</button>
<button class="btn-sm btn btn-info btn-sm btn-group btn-group-cog" onclick="changeTaskStatus('2')">暂停</button>
<button class="btn-sm btn btn-warning btn-sm btn-group btn-group-cog" onclick="editTask();">修改</button>
<button class="btn-sm btn btn-danger 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--%>
<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-success btn-sm btn-group btn-group-cog" id="ModelPreview" onclick="preview()" disabled>模型预览</button>
</c:if>
</div>
</div>
......
......@@ -186,10 +186,10 @@ table_pagging.prototype={
}else if(k == 2){
tdContext=this.getData(this.objectlist[i],this.header[k][1]);
if(tdContext == 'c'){
tdContext="业务";
tdContext="渠道";
}
if(tdContext == 'y'){
tdContext="渠道";
tdContext="业务";
}
}
else if(k == 7){
......
......@@ -577,6 +577,7 @@ function radioChoose(clickObj){
//alert(clickObj);
//alert(clickObj.nextSibling.innerHTML);
$("#updateModel").attr("disabled", false);
$("#ModelDownload").attr("disabled", false);
modelId=parseInt(obj[parseInt(clickObj.nextSibling.innerHTML)].dataModelId);
}
......
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