Commit 15021e7f authored by yff's avatar yff

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

parents dd1e08f5 0841d1cf
package com.gavel.kwell.config;
import org.apache.http.conn.HttpClientConnectionManager;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
@Configuration
public class RestTemplateConfig {
@Bean
public HttpClientConnectionManager poolingConnectionManager() {
PoolingHttpClientConnectionManager poolingConnectionManager = new PoolingHttpClientConnectionManager();
poolingConnectionManager.setMaxTotal(1000); // 连接池最大连接数
poolingConnectionManager.setDefaultMaxPerRoute(500); // 每个主机的并发
return poolingConnectionManager;
}
@Bean
public HttpClientBuilder httpClientBuilder() {
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
//设置HTTP连接管理器
httpClientBuilder.setConnectionManager(poolingConnectionManager());
return httpClientBuilder;
}
@Bean("restTemplate")
public RestTemplate restTemplate(){
HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory();
httpRequestFactory.setHttpClient(httpClientBuilder().build());
httpRequestFactory.setConnectionRequestTimeout(3000);//获取链接超时时间
httpRequestFactory.setConnectTimeout(3000);//指客户端和服务器建立连接的timeout
httpRequestFactory.setReadTimeout(120000);//读取数据的超时时间
RestTemplate restTemplate=new RestTemplate(httpRequestFactory);
return restTemplate;
}
}
......@@ -4,25 +4,26 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gavel.common.base.service.impl.BaseEditServiceImpl;
import com.gavel.common.business.service.CommonService;
import com.gavel.common.utils.*;
import com.gavel.common.utils.CollectionUtils;
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.Gpfkjg;
import com.gavel.kwell.service.KmesBoardService;
import com.gavel.kwell.utils.DateCalculateUtil;
import com.gavel.kwell.utils.KemsHttpUtil;
import com.gavel.kwell.utils.KwellParamEnum;
import com.gavel.kwell.vo.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -43,8 +44,6 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa
@Autowired
private CommonService commonService;
@Autowired
private RestTemplate restTemplate;
@Override
public void initService(){
......@@ -315,20 +314,9 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa
@Override
public KqtjVO queryOA() {
KqtjVO kqtjVO = new KqtjVO();
String time = DateUtils.formatDate(DateUtils.getDateTime(),"yyyyMMddHHmmss");
String url = "http://oa.kewell.com.cn/api/cube/restful/interface/getModeDataPageList/mes_kqtj";
StringBuilder param = new StringBuilder();
param.append("{\"datajson\":{\"operationinfo\":{\"operator\":\"1\"},\"mainTable\":{},\"pageInfo\":{\"pageNo\":\"1\",\"pageSize\":\"10\"},");
param.append("\"header\":{\"systemid\":\"oa\",");
param.append("\"currentDateTime\":").append("\""+time+"\"").append(",\"Md5\":").append("\""+MD5Utils.md5Hex("oa"+"123456"+time)+"\"").append("}}}");
try {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set(HttpHeaders.ACCEPT_CHARSET, StandardCharsets.UTF_8.toString());
HttpEntity httpEntity = new HttpEntity<>(param, headers);
ResponseEntity<String> exchange = restTemplate.exchange(url, HttpMethod.POST, httpEntity, String.class);
String body = exchange.getBody();
String body = KemsHttpUtil.postWithParamsForString(url);
logger.info("返回信息:"+body);
JSONObject jsonObject = JSONObject.parseObject(body);
int ydrs =0;
......
package com.gavel.kwell.utils;
import com.gavel.common.utils.DateUtils;
import com.gavel.common.utils.MD5Utils;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
public class KemsHttpUtil {
public static String postWithParamsForString(String url) throws IOException{
String jsonStr = "";
CloseableHttpClient httpClient = HttpClients.createDefault();
String requestBody = createRequestBody();
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
StringEntity entity = new StringEntity(requestBody);
httpPost.setEntity(entity);
CloseableHttpResponse response = httpClient.execute(httpPost);
jsonStr = EntityUtils.toString(response.getEntity());
return jsonStr;
}
private static String createRequestBody() {
String time = DateUtils.formatDate(DateUtils.getDateTime(),"yyyyMMddHHmmss");
StringBuilder param = new StringBuilder();
param.append("datajson={\"operationinfo\":{\"operator\":\"1\"},\"mainTable\":{},\"pageInfo\":{\"pageNo\":\"1\",\"pageSize\":\"10\"},");
param.append("\"header\":{\"systemid\":\"oa\",");
param.append("\"currentDateTime\":").append("\""+time+"\"").append(",\"Md5\":").append("\""+ MD5Utils.md5Hex("oa"+"123456"+time)+"\"").append("}}");
return param.toString();
}
}
......@@ -9,6 +9,10 @@ public class KqtjVO extends BaseEntity {
private Integer sdrs;//实到人数
private Integer xjrs;//休假人数
private Double zscl;
public Integer getYdrs() {
return ydrs;
}
......@@ -24,4 +28,20 @@ public class KqtjVO extends BaseEntity {
public void setSdrs(Integer sdrs) {
this.sdrs = sdrs;
}
public Integer getXjrs() {
return xjrs;
}
public void setXjrs(Integer xjrs) {
this.xjrs = xjrs;
}
public Double getZscl() {
return zscl;
}
public void setZscl(Double zscl) {
this.zscl = zscl;
}
}
......@@ -19,7 +19,7 @@
HTTP.post("querySafeDays", {}, function(result) {
if (result['success']) {
let data=result.data.records
dom.html("安全生产天数: "+"<span>"+data+"</span>"+"天")
dom.html("安全生产天数: "+"<span style='font-size:20px;color:red';>&nbsp;"+data+"</span>"+"&nbsp;&nbsp;天")
} else {
console.log("请求失败")
}
......@@ -259,9 +259,9 @@
function apiqueryOA(){
HTTP.post("queryOA", {}, function(result) {
if (result['success']) {
let data=result.data.records||{}
$("#ydrs").text(data.ydrs||0)
$("#sdrs").text(data.ydrs||0)
let data=result.data.records||{};
$("#ydrs").text(data.ydrs||0);
$("#sdrs").text(data.sdrs||0)
} else {
console.log("请求失败")
}
......
......@@ -7,7 +7,14 @@
<link rel="stylesheet" href="../../css/dashboard/index.css">
<link rel="stylesheet" href="../../css/dashboard/public.css">
<style type="text/css">
img{
image-rendering: -moz-crisp-edges; /* Firefox */
image-rendering: -o-crisp-edges; /* Opera */
image-rendering: -webkit-optimize-contrast; /*Webkit (non-standard naming) */ image-rendering: crisp-edges; \
-ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */
}
#aqscts{
color: red!important;
box-sizing: border-box;
cursor: url(../../images/dashboard/pointer.png) 8 3,auto;
font-family: 微软雅黑;
......@@ -69,6 +76,7 @@
<div class="left-top rightTop border" style="height: 3.175rem;margin-bottom: .2rem;">
<div class="title">工艺流程图</div>
<div class="chat" style="margin-top: 20px;height: 2.5rem;">
<!-- <img src="http://localhost:9080/mes/images/dashboard/gylct.png" style="height: 100%;width: 100%;border: 0px solid;"> -->
<canvas id="gylct" style="width: 100%;height: 100%"></canvas>
</div>
</div>
......
......@@ -144,7 +144,7 @@
that.gd = res.data.records.woDjid;
that.cpsn = res.data.records.wosnCode;
that.ph = res.data.records.wlxxCode;
let woid = res.data.records.woid;
let woid = res.data.records.woDjid;
that.fkid=res.data.records.id||""
that.okOrng=res.data.records.zpbz||""
if(res.data.records.sntype=="WOSNID")
......
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