Commit 5e6e7019 authored by yff's avatar yff

Merge branch 'master' of gitlab.gavelinfo.com:gavelinfo/kwell-mes

parents 9acf4fc4 781cdc12
......@@ -2,13 +2,11 @@ package com.gavel.kwell.controller;
import com.alibaba.fastjson.JSONObject;
import com.gavel.common.base.controller.BaseController;
import com.gavel.common.utils.ThreadContext;
import com.gavel.kwell.service.KmesBoardService;
import com.gavel.kwell.vo.GpfkHgVO;
import com.gavel.kwell.vo.PcslVO;
import com.gavel.kwell.vo.SdclVO;
import com.gavel.kwell.vo.UWoVO;
import com.gavel.wo.persistent.Pcjhmx;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -16,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.util.List;
@Controller
......@@ -127,25 +127,24 @@ public class KmesBoardController extends BaseController {
/**
* 视频路径api
* pdf路径api
*/
@RequestMapping(value ="getPdf", method = RequestMethod.POST)
@ResponseBody
public Object getPdf(@RequestBody JSONObject param) {
returnData().add("pdf", kmesBoardService.getPdf());
return ThreadContext.getReturnData();
@RequestMapping(value ="getPdf")
public void getPdf(HttpServletResponse response) {
FileInputStream fileInputStream = kmesBoardService.getPdf();
kmesBoardService.doAttachmentPreview(response, fileInputStream);
}
/**
* 视频路径api
*/
@RequestMapping(value ="getVideo", method = RequestMethod.POST)
@ResponseBody
public Object getVideo(@RequestBody JSONObject param) {
returnData().add("video", kmesBoardService.getVideo());
return ThreadContext.getReturnData();
@RequestMapping(value ="getVideo")
public void getVideo(HttpServletResponse response) {
FileInputStream fileInputStream = kmesBoardService.getVideo();
kmesBoardService.doAttachmentPreview(response, fileInputStream);
}
}
......@@ -7,6 +7,8 @@ import com.gavel.kwell.vo.SdclVO;
import com.gavel.kwell.vo.UWoVO;
import com.gavel.wo.persistent.Pcjhmx;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.util.List;
......@@ -26,7 +28,11 @@ public interface KmesBoardService extends BaseEditService {
public List<GpfkHgVO> queryGpfkHgl();
public String getPdf();
public FileInputStream getPdf();
public String getVideo();
public FileInputStream getVideo();
public FileInputStream downloadFile(String path);
public void doAttachmentPreview(HttpServletResponse response, FileInputStream fileInputStream);
}
......@@ -4,6 +4,7 @@ import com.gavel.common.base.service.impl.BaseEditServiceImpl;
import com.gavel.common.business.service.CommonService;
import com.gavel.common.utils.DateUtils;
import com.gavel.common.utils.NumberUtils;
import com.gavel.common.utils.StringUtils;
import com.gavel.kwell.dao.GpfkcxDao;
import com.gavel.kwell.dao.KmesBoardDao;
import com.gavel.kwell.persistent.Gpfk;
......@@ -15,10 +16,14 @@ import com.gavel.kwell.vo.PcslVO;
import com.gavel.kwell.vo.SdclVO;
import com.gavel.kwell.vo.UWoVO;
import com.gavel.wo.persistent.Pcjhmx;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
......@@ -29,6 +34,9 @@ import java.util.List;
@Transactional
public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoardService {
private Logger logger = LoggerFactory.getLogger(KmesBoardServiceImpl.class);
@Autowired
private KmesBoardDao kmesBoardDao;
......@@ -135,12 +143,64 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa
}
@Override
public String getPdf() {
return commonService.getStringOptionValue(KwellParamEnum.DASHBORAD_PDF.getId());
public FileInputStream getPdf() {
String path = commonService.getStringOptionValue(KwellParamEnum.DASHBORAD_PDF.getId());
if(StringUtils.isEmpty(path)) {
logger.error("文件路径参数为空,请检查!");
return null;
}
return downloadFile(path);
}
@Override
public FileInputStream getVideo() {
String path = commonService.getStringOptionValue(KwellParamEnum.DASHBORAD_VIDEO.getId());
if(StringUtils.isEmpty(path)) {
logger.error("文件路径参数为空,请检查!");
return null;
}
return downloadFile(path);
}
@Override
public void doAttachmentPreview(HttpServletResponse response, FileInputStream fileInputStream) {
try {
BufferedInputStream bis = new BufferedInputStream(fileInputStream);
try {
BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream());
try {
byte[] buff = new byte[2048];
int bytesRead;
while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
} finally {
bos.close();
}
} finally {
bis.close();
}
} catch (Exception var23) {
this.logger.error("", var23);
}
}
@Override
public String getVideo() {
return commonService.getStringOptionValue(KwellParamEnum.DASHBORAD_VIDEO.getId());
public FileInputStream downloadFile(String path) {
File dataFile = new File(path);
if (dataFile.exists()) {
//获取输入流
FileInputStream inStream = null;
try {
inStream = new FileInputStream(dataFile);
} catch (FileNotFoundException e) {
logger.error(e.getMessage());
}
return inStream;
}
return null;
}
}
package com.gavel.kwell.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.gavel.common.base.entity.BaseEntity;
import com.gavel.common.base.service.impl.BaseEditServiceImpl;
import com.gavel.common.utils.NumberUtils;
import com.gavel.common.utils.RedisConnection;
import com.gavel.common.utils.StringUtils;
import com.gavel.kwell.dao.UpointDao;
......@@ -18,9 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@Service("upointService")
......@@ -75,7 +76,7 @@ public class UpointServiceImpl extends BaseEditServiceImpl implements UpointServ
@Override
public List<DataPointItem> queryringpoint() {
/* try {
try {
List<Upoint> ponitList = upointDao.queryList(PointTypeEnum.RIGN.getId());
if(ponitList==null || ponitList.size()==0){
logger.error("点位信息未配置,请检查!");
......@@ -118,9 +119,9 @@ public class UpointServiceImpl extends BaseEditServiceImpl implements UpointServ
} catch (Exception e) {
logger.error("数据点采集出错!", e);
}
return Collections.EMPTY_LIST;*/
return Collections.EMPTY_LIST;
List<DataPointItem> dataPointItems = new ArrayList<DataPointItem>();
/* List<DataPointItem> dataPointItems = new ArrayList<DataPointItem>();
dataPointItems.add(new DataPointItem("R1",new Date().getTime(),1,"R1",0));
dataPointItems.add(new DataPointItem("R2",new Date().getTime(),1,"R2",0));
dataPointItems.add(new DataPointItem("R3",new Date().getTime(),1,"R3",0));
......@@ -129,7 +130,7 @@ public class UpointServiceImpl extends BaseEditServiceImpl implements UpointServ
dataPointItems.add(new DataPointItem("R6",new Date().getTime(),1,"R6",1));
dataPointItems.add(new DataPointItem("R7",new Date().getTime(),1,"R7",-1));
dataPointItems.add(new DataPointItem("R8",new Date().getTime(),1,"R8",-1));
return dataPointItems;
return dataPointItems;*/
}
}
......@@ -40,8 +40,10 @@ ul,ol{
.allnav{
height: 100%;
}
#chartJdshCirle{
height: 1.6rem!important;
width: 1.6rem!important;
}
/*第三栏头部*/
.rightTop{
width: 100%;
......
......@@ -141,23 +141,30 @@
});
}
/* 静电手环 */
function apiqueryringpoint(){
function apiqueryringpoint(chartJdshCirle){
let $point=$(".allnav-right ul li").children()
let $point1=$(".allnav-right ul li>div").children()
console.log($point)
let shdata={}
shdata.g=0
shdata.r=0
shdata.s=0
HTTP.post("/mes/kmes/point/queryringpoint", {}, function(result) {
if (result['success']) {
let data=result.data.records
data.forEach(function(e,index){
if(e.value==0){
shdata.g++
$($point[index]).css("background-color","greenyellow");
}else if(e.value==1){
$($point[index]).css("background-color","red");
$($point[index]).css("background-color","red");
shdata.r++
}else{
$($point[index]).css("background-color","skyblue");
shdata.s++
}
$($point1[index]).html(e.itemId)
})
setchartJdshCirle(chartJdshCirle,shdata)
} else {
console.log("请求失败")
}
......@@ -219,23 +226,9 @@
}
/* pdf */
function getPdf(time){
HTTP.post("getPdf", {}, function(result) {
if (result['success']) {
let data=result.data.pdf
pdfshow(data,"gylct",time||20000)
} else {
console.log("请求失败")
}
});
pdfshow("getPdf","gylct",time||20000)
}
/* video */
function getVideo(){
HTTP.post("getVideo", {}, function(result) {
if (result['success']) {
let data=result.data.video
$("video").attr('src',data)
} else {
console.log("请求失败")
}
});
$("video").attr('src','getVideo')
}
\ No newline at end of file
......@@ -2206,7 +2206,51 @@ function setDailyDataEchart(chart,apidata) {
chart.setOption(ops,true);
}
/* 手环展示 */
function setchartJdshCirle(chartJdshCirle,apidata){
var option = {
color:['greenyellow','red','skyblue'],
tooltip: {
trigger: 'item'
},
legend: {
top: '5%',
left: 'center'
},
series: [
{
type: 'pie',
radius: ['40%', '70%'],
avoidLabelOverlap: false,
itemStyle: {
borderRadius: 10,
borderColor: '#fff',
borderWidth: 2
},
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: '40',
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: [
{ value: apidata.g||0},
{ value: apidata.r||0},
{ value: apidata.s||0},
]
}
]
};
chartJdshCirle.setOption(option);
}
/*合格率*/
function setHglEchart(chart,apidata) {
......
......@@ -57,7 +57,7 @@
<div class="bottom-b">
<div id="chartJdsh" class="allnav">
<div class="allnav-left">
<div class="circle circle-normal" id="chartJdshCirle" ></div>
<div class="circle " id="chartJdshCirle" ></div>
<ul class="allnav-circle">
<li>
<span class="circle circle-small circle-normal"></span>
......@@ -320,7 +320,7 @@
var chartHgl=echarts.init(document.getElementById("chartHgl"));
var chartRjh=echarts.init(document.getElementById("chartRjh"));
var chartYjh=echarts.init(document.getElementById("chartYjh"));
var chartJdshCirle=$("#chartJdshCirle");
var chartJdshCirle=echarts.init(document.getElementById("chartJdshCirle"));
setTimeProductionEchart(myChartSdcl); /*时段产量*/
setDailyDataEchart(chartRpcdcsj); /*日排产达成数据*/
// setHglEchart(chartHgl);/*合格率*/
......@@ -330,6 +330,7 @@
speed: 60, //数值越大,速度越慢
rowHeight: 46 //li的高度
});
/* 调用 */
function getAlldata(){
apisetTimeProductionEchart(myChartSdcl)
......@@ -338,7 +339,7 @@
apisetPieDailyCharty(chartYjh)
apisetHglEchart(chartHgl)
apiqueryWo()
apiqueryringpoint()
apiqueryringpoint(chartJdshCirle)
}
getAlldata()
getVideo()
......
......@@ -74,7 +74,7 @@
<div class="bottom-b">
<div id="chartJdsh" class="allnav">
<div class="allnav-left">
<div class="circle circle-normal" id="chartJdshCirle" ></div>
<div class="circle" id="chartJdshCirle" ></div>
<ul class="allnav-circle">
<li>
<span class="circle circle-small circle-normal"></span>
......@@ -85,8 +85,8 @@
<span>关闭</span>
</li>
<li>
<span class="circle circle-small circle-offine"></span>
<span>离线</span>
<span class="circle circle-small circle-info"></span>
<span>警告</span>
</li>
</ul>
</div>
......@@ -347,7 +347,7 @@
var chartHgl=echarts.init(document.getElementById("chartHgl"));
var chartRjh=echarts.init(document.getElementById("chartRjh"));
var chartYjh=echarts.init(document.getElementById("chartYjh"));
var chartJdshCirle=$("#chartJdshCirle");
var chartJdshCirle=echarts.init(document.getElementById("chartJdshCirle"));
setTimeProductionEchart(myChartSdcl); /*时段产量*/
setDailyDataEchart(chartRpcdcsj); /*日排产达成数据*/
setHglEchart(chartHgl);/*合格率*/
......@@ -368,7 +368,7 @@
apisetPieDailyCharty(chartYjh)
apisetHglEchart(chartHgl)
apiqueryWo()
apiqueryringpoint()
apiqueryringpoint(chartJdshCirle)
apiqueryWorkingWO()
}
apiqueryWorkingWO()
......
......@@ -256,7 +256,6 @@
var chartHgl=echarts.init(document.getElementById("chartHgl"));
var chartRjh=echarts.init(document.getElementById("chartRjh"));
var chartYjh=echarts.init(document.getElementById("chartYjh"));
var chartJdshCirle=$("#chartJdshCirle");
setTimeProductionEchart(myChartSdcl); /*时段产量*/
setDailyDataEchart(chartRpcdcsj); /*日排产达成数据*/
setHglEchart(chartHgl);/*合格率*/
......
......@@ -193,7 +193,7 @@
<div class="bottom-b">
<div id="chartJdsh" class="allnav">
<div class="allnav-left">
<div class="circle circle-normal" id="chartJdshCirle" ></div>
<div class="circle" id="chartJdshCirle" ></div>
<ul class="allnav-circle">
<li>
<span class="circle circle-small circle-normal"></span>
......@@ -296,7 +296,7 @@
var chartRjh=echarts.init(document.getElementById("chartRjh"));
var chartYjh=echarts.init(document.getElementById("chartYjh"));
var chartHgl=echarts.init(document.getElementById("chartRpcHgl"));
var chartJdshCirle=$("#chartJdshCirle");
var chartJdshCirle=echarts.init(document.getElementById("chartJdshCirle"));
setTimeProductionEchart(myChartSdcl); /*时段产量*/
setRpcHglEchart(chartHgl);/*日排产&合格率*/
setPieDailyChart(chartRjh,80);/*日计划*/
......@@ -312,7 +312,7 @@
apisetPieDailyCharty(chartYjh)
apisetRpcHglEchart(chartHgl)
apiqueryWo()
apiqueryringpoint()
apiqueryringpoint(chartJdshCirle)
}
getAlldata()
getVideo()
......
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