Commit 967fe382 authored by yff's avatar yff

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

parents c0ecc236 3791ee7c
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;
}
}
package com.gavel.kwell.service.impl;
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.http.HttpUtils;
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.common.utils.*;
import com.gavel.kwell.dao.GpfkcxDao;
import com.gavel.kwell.dao.KmesBoardDao;
import com.gavel.kwell.persistent.Gpfkjg;
......@@ -19,11 +16,14 @@ import com.gavel.wo.persistent.Pcjhmx;
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.*;
......@@ -44,6 +44,9 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa
@Autowired
private CommonService commonService;
@Autowired
private RestTemplate restTemplate;
@Override
public void initService(){
}
......@@ -316,15 +319,40 @@ 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";
String param = "{\"datajson\":{\"operationinfo\":{\"operator\":\"1\"},\"mainTable\":{},\"pageInfo\":{\"pageNo\":\"1\",\"pageSize\":\"10\"}," +
"\"header\":{\"systemid\":\"CRM_System\",\"currentDateTime\":\"20200101010101\",\"Md5\":\"c4ca4238a0b923820dcc509a6f75849b\"}}}";
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 {
String response = HttpUtils.doPost(url, param);
if(StringUtils.isNotEmpty(response)){
JSONObject jsonObject = JSONObject.parseObject(response);
logger.info("返回信息:"+response);
}
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();
logger.info("返回信息:"+body);
JSONObject jsonObject = JSONObject.parseObject(body);
int ydrs =0;
int sdrs = 0;
if(StringUtils.isNotEmpty(body) && !StringUtils.equals(jsonObject.getString("status"),"0")){
JSONArray jsonArray = jsonObject.getJSONArray("result");
for (int j= 0;j<jsonArray.size();j++){
JSONObject jsonObjectOne=jsonArray.getJSONObject(j);
Integer ydrs1 = jsonObjectOne.getJSONObject("mainTable").getInteger("ydrs");
Integer sdrs1 = jsonObjectOne.getJSONObject("mainTable").getInteger("sdrs");
if(ydrs1 != null ){
ydrs = ydrs1 ;
}
if(sdrs1 != null ){
sdrs = sdrs1 ;
}
}
}
kqtjVO.setYdrs(ydrs);
kqtjVO.setSdrs(sdrs);
} catch (Exception e) {
logger.error("错误信息:",e);
}
......
......@@ -255,6 +255,18 @@
}
});
}
/* OA */
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)
} else {
console.log("请求失败")
}
});
}
/* pdf */
function getPdf(time){
pdfshow("getPdf","gylct",time||20000)
......
......@@ -71,7 +71,7 @@
<div class="list clearfix">
<div class="listTxt">
<p><label for="">应到人数:</label><span id="ydrs">20</span></p>
<p><label for="">实际人数:</label><span id="sjrs">20</span></p>
<p><label for="">实际人数:</label><span id="sdrs">20</span></p>
<p><label for="">休假人数:</label><span id="xjrs">0</span> </p>
<p><label for="">总生产量:</label><span id="zscl">0</span></p>
</div>
......@@ -394,6 +394,7 @@
}
/* 调用 */
function getAlldata(){
apiqueryOA()
apigetscts($("#aqscts"))
apiCurProZtsl(chartTzzp)
apisetRpcHglEchart(chartRpcdcsj,'rcl')
......
......@@ -36,7 +36,8 @@
var tabIndex={
"ZP":0,
"JY":1,
"WX":2
"WX":2,
"JG":3,
};
var columns = [
......@@ -80,6 +81,7 @@
if(rowData.bzgxGxlx){
var index=tabIndex[rowData.bzgxGxlx];
$tab.tabs("select",index);
console.log(index)
if(index==0){
$zpContainer.html("");
$zpContainer.append("<div id=\"zpList\" style=\"width: 100%;height: 100%\"></div>");
......@@ -136,6 +138,36 @@
$wxListContainer.append(element);
wx(rowData)
}
else if(index==3){
$("#zpListContainer").html("");
$("#zpListContainer").append(" <div style=\"width: 70%;display: inline-block;height: 100%\">" +
" <div style=\"width: 0%;height: 100%\" id=\"jyList\"></div>" +
" </div>" +
" <div style=\"width: 100%;float:right;height: 100%;\">" +
" <div style=\"width: 100%;height: 0%\" id=\"jybhgList\"></div>" +
// " <div style=\"width: 100%;height: 100%;border: 1px solid #D3D3D3;position: relative\" >" +
" <div class=\"\" style=\"width: 50%;height: 50%;border: 1px solid #D3D3D3;;display: inline-block;position: absolute; top:50%;left:50%;transform:translate(-50%,-50%);\">" +
" <label style=\"text-align: left;font-weight: 700;\">反馈结果</label>" +
" <div id=\"ishgs\" class=\"mx-dataTable hb-text\" style=\"margin-top: 60px;bottom: 0;border: none;text-align: center\">" +
" 合格" +
" </div>" +
" <div>" +
// " </div>" +
" </div>" +
" <div class=\"\" style=\"width: 50%;height: 100%;float: right;position: relative\">" +
" <label style=\"text-align: left;font-weight: 700;\">备注</label>" +
" <div class=\"mx-dataTable bz-text\" style=\"margin-top: 60px;bottom: 0;border: none;text-align: center\">" +
" </div>" +
" <div>" +
" </div>" +
" </div>" +
" </div>" +
" </div>");
console.log(rowData)
if(rowData.hgbz=="N"){
$("#ishgs").text("不合格")
}
}
}
}
......@@ -190,6 +222,7 @@
}
})
}
/*加工反馈*/
/*检验反馈*/
function jy(rowData) {
var $zpList=$("#jyList");var $topList=$("#jybhgList");
......
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