Commit 05639847 authored by 李成龙's avatar 李成龙

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

# Conflicts: # amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/controller/PlanTaskController.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/core/framework/Permission.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/core/framework/PermissionAspect.java
parents ca2f365d c99c1738
......@@ -10,18 +10,61 @@ import java.io.Serializable;
* @author Dell
* **/
public class ReginParams implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private CompanyBo company;
private RoleBo role;
private DepartmentBo department;
//用户基本信息
private AgencyUserModel userModel;
private PersonIdentity personIdentity;
public static class PersonIdentity {
private String identityType;
private String personName;
private String companyId;
public PersonIdentity(String identityType,String personName,String companyId){
this.identityType = identityType;
this.personName = personName;
this.companyId = companyId;
}
public String getIdentityType() {
return identityType;
}
public void setIdentityType(String identityType) {
this.identityType = identityType;
}
public String getPersonName() {
return personName;
}
public void setPersonName(String personName) {
this.personName = personName;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
}
public PersonIdentity getPersonIdentity() {
return personIdentity;
}
public void setPersonIdentity(PersonIdentity personIdentity) {
this.personIdentity = personIdentity;
}
@Deprecated
private String token;
public CompanyBo getCompany() {
return company;
}
......@@ -46,19 +89,21 @@ public class ReginParams implements Serializable {
this.department = department;
}
public AgencyUserModel getUserModel() {
return userModel;
}
public AgencyUserModel getUserModel() {
return userModel;
}
public void setUserModel(AgencyUserModel userModel) {
this.userModel = userModel;
}
public void setUserModel(AgencyUserModel userModel) {
this.userModel = userModel;
}
@Deprecated
public String getToken() {
return token;
}
public String getToken() {
return token;
}
@Deprecated
public void setToken(String token) {
this.token = token;
}
public void setToken(String token) {
this.token = token;
}
}
package com.yeejoin.amos.boot.biz.common.workflow;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.workflow.business.util.HttpUtil;
import com.yeejoin.amos.boot.biz.common.workflow.constants.XJConstant;
import com.yeejoin.amos.boot.biz.common.workflow.enums.WorkFlowUriEnum;
import com.yeejoin.amos.boot.biz.common.workflow.enums.YesOrNoEnum;
@Service("remoteWorkFlowService")
public class RemoteWorkFlowService {
private final Logger logger = LoggerFactory.getLogger(RemoteWorkFlowService.class);
@Value("${params.work.flow.address}")
private String address;
@Value("${params.work.flow.processDefinitionKey}")
private String processDefinitionKey;
private String buildUrl(String address, WorkFlowUriEnum workFlowUriEnum, Map<String, String> map) {
String uri = workFlowUriEnum.getUri();
String params = workFlowUriEnum.getParams();
if (!StringUtils.isEmpty(params) && map != null) {
String[] paramsArr = params.split(",");
for (String param : paramsArr) {
uri = uri.replace("{" + param + "}", map.get(param));
}
}
return address + uri;
}
private JSONObject handleResult(String resultStr) {
if (resultStr == null) {
return null;
}
JSONObject json = JSON.parseObject(resultStr);
if ("200".equals(json.getString("code"))) {
return json;
}
return null;
}
public JSONObject start(String businessKey, String processDefinitionKey) {
String url = buildUrl(address, WorkFlowUriEnum.启动流程, null);
JSONObject body = new JSONObject();
body.put("businessKey", businessKey);
body.put("processDefinitionKey", processDefinitionKey);
String resultStr = HttpUtil.sendHttpPostJson(url, body.toJSONString());
return handleResult(resultStr);
}
public JSONObject getChildNodeDetail(String instanceId) {
Map<String, String> map = Maps.newHashMap();
map.put("instanceId", instanceId);
String url = buildUrl(address, WorkFlowUriEnum.子节点信息, map);
Map<String, String> headerMap = Maps.newHashMap();
headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + instanceId + "\r\n返回参数=======================>" + resultStr);
return handleResult(resultStr);
}
public JSONObject start(Long dangerId, String businessKey, String processDefinitionKey) {
String url = buildUrl(address, WorkFlowUriEnum.启动流程, null);
Map<String, String> headerMap = Maps.newHashMap();
headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
JSONObject body = new JSONObject();
body.put("businessKey", businessKey);
body.put("processDefinitionKey", processDefinitionKey);
JSONArray variables = new JSONArray();
// JSONObject companyJson = new JSONObject();
// companyJson.put("name", "companyId");
// companyJson.put("value", companyId);
// JSONObject departmentJson = new JSONObject();
// departmentJson.put("name", "departmentId");
// departmentJson.put("value", departmentId);
JSONObject dangerIdJson = new JSONObject();
// dangerIdJson.put("name", "dangerId");
dangerIdJson.put("dangerId", dangerId);
// variables.add(companyJson);
// variables.add(departmentJson);
// variables.add(dangerIdJson);
// body.put("variables", variables);
// String requestBody = body.toJSONString();
body.put("variables", dangerIdJson);
String resultStr = HttpUtil.sendHttpPostJsonWithHeader(url, body.toJSONString(), headerMap);
logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + body + "\r\n返回参数=======================>" + resultStr);
return JSON.parseObject(resultStr);
}
public JSONObject startWithAppKey(JSONObject body) {
Map<String, String> map = Maps.newHashMap();
map.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
map.put(XJConstant.PRODUCT, RequestContext.getProduct());
map.put(XJConstant.APPKEY, RequestContext.getAppKey());
String url = buildUrl(address, WorkFlowUriEnum.启动免登录流程, map);
String requestBody = body.toJSONString();
String resultStr = HttpUtil.sendHttpPostJson(url, requestBody);
logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + requestBody + "\r\n返回参数=======================>" + resultStr);
return handleResult(resultStr);
}
public JSONObject startNew(Long dangerId, String businessKey, String processDefinitionKey) {
String url = buildUrl(address, WorkFlowUriEnum.合并启动流程, null);
Map<String, String> headerMap = Maps.newHashMap();
headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
JSONObject body = new JSONObject();
body.put("businessKey", businessKey);
body.put("processDefinitionKey", processDefinitionKey);
JSONObject dangerIdJson = new JSONObject();
dangerIdJson.put("dangerId", dangerId);
body.put("variables", dangerIdJson);
String resultStr = HttpUtil.sendHttpPostJsonWithHeader(url, body.toJSONString(), headerMap);
logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + body + "\r\n返回参数=======================>" + resultStr);
return JSON.parseObject(resultStr);
}
// public JSONObject stop(String processInstanceId, String deleteReason) {
// Map<String, String> map = Maps.newHashMap();
// map.put("deleteReason", deleteReason);
// map.put("processInstanceId", processInstanceId);
// String url = buildUrl(address, WorkFlowUriEnum.终止流程, map);
// String resultStr = HttpUtil.sendHttpDelete(url);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n终止流程请求路径=======================>" + url + "\r\n终止流程返回参数=======================>" + resultStr);
// return json;
// }
public JSONObject stop(String processInstanceId) {
Map<String, String> map = Maps.newHashMap();
// map.put("deleteReason", deleteReason);
map.put("processInstanceId", processInstanceId);
Map<String, String> headerMap = Maps.newHashMap();
headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
String url = buildUrl(address, WorkFlowUriEnum.终止流程, map);
String resultStr = HttpUtil.sendHttpDeleteWithHeader(url, headerMap);
JSONObject json = handleResult(resultStr);
logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
return json;
}
// public JSONObject excute(String taskId, String requestBody) {
// Map<String, String> map = Maps.newHashMap();
// map.put("taskId", taskId);
// String url = buildUrl(address, WorkFlowUriEnum.执行流程, map);
// String resultStr = HttpUtil.sendHttpPostJson(url, requestBody);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n执行任务请求路径=======================>" + url + "\r\n执行任务请求参数=======================>" + requestBody + "\r\n执行任务返回参数=======================>" + resultStr);
// return json;
// }
public JSONObject excute(String taskId, String requestBody) {
Map<String, String> map = Maps.newHashMap();
map.put("taskId", taskId);
Map<String, String> headerMap = Maps.newHashMap();
headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
String url = buildUrl(address, WorkFlowUriEnum.执行流程, map);
String resultStr = HttpUtil.sendHttpPostJsonWithHeader(url, requestBody, headerMap);
JSONObject json = handleResult(resultStr);
logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + requestBody + "\r\n返回参数=======================>" + resultStr);
return json;
}
public JSONObject currentTask(String instanceId) {
Map<String, String> map = Maps.newHashMap();
map.put("processInstanceId", instanceId);
String url = buildUrl(address, WorkFlowUriEnum.当前节点, map);
String resultStr = HttpUtil.sendHttpGet(url);
JSONObject json = handleResult(resultStr);
logger.info("\r\n当前任务请求路径=======================>" + url + "\r\n当前任务返回参数=======================>" + resultStr);
if (json == null) {
return null;
}
JSONArray reviewContent = json.getJSONObject("dataList").getJSONArray("content");
if (reviewContent != null && reviewContent.size() > 0) {
return reviewContent.getJSONObject(0);
}
return null;
}
public JSONObject allTasksInProcessInstanceId(String instanceId) {
Map<String, String> map = Maps.newHashMap();
map.put("processInstanceId", instanceId);
String url = buildUrl(address, WorkFlowUriEnum.工作流流水, map);
Map<String, String> headerMap = Maps.newHashMap();
headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
JSONObject json = handleResult(resultStr);
logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
if (json == null) {
return null;
}
JSONArray allContent = json.getJSONArray("dataList");
if (allContent != null && allContent.size() > 0) {
return allContent.getJSONObject(allContent.size() - 1);
}
return null;
}
public JSONObject pageTask(String userId,Integer BelongType) {
Map<String, String> map = Maps.newHashMap();
String url = "";
map.put("processDefinitionKey", processDefinitionKey);
if(Integer.parseInt(YesOrNoEnum.YES.getCode())==BelongType){
map.put("userId", userId);
url = buildUrl(address, WorkFlowUriEnum.我的代办有ID, map);
}else{
url = buildUrl(address, WorkFlowUriEnum.我的代办, map);
}
Map<String, String> headerMap = Maps.newHashMap();
headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
JSONObject json = handleResult(resultStr);
logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
return json;
}
public JSONObject completedPageTask(String userId,Integer BelongType) {
Map<String, String> map = Maps.newHashMap();
String url = "";
map.put("processDefinitionKey", processDefinitionKey);
if(Integer.parseInt(YesOrNoEnum.YES.getCode())==BelongType){
map.put("userId", userId);
url = buildUrl(address, WorkFlowUriEnum.已执行任务有ID, map);
}else{
url = buildUrl(address, WorkFlowUriEnum.已执行任务, map);
}
Map<String, String> headerMap = Maps.newHashMap();
headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
JSONObject json = handleResult(resultStr);
logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
return json;
}
public JSONObject queryTask(String id) {
Map<String, String> map = Maps.newHashMap();
map.put("processInstanceId", id);
String url = buildUrl(address, WorkFlowUriEnum.流程任务, map);
Map<String, String> headerMap = Maps.newHashMap();
headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
JSONObject json = handleResult(resultStr);
logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
return json;
}
public JSONObject queryTaskDetail(String taskId) {
Map<String, String> map = Maps.newHashMap();
map.put("taskId", taskId);
String url = buildUrl(address, WorkFlowUriEnum.流程详情, map);
Map<String, String> headerMap = Maps.newHashMap();
headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
JSONObject json = handleResult(resultStr);
logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
return json;
}
public JSONObject queryFinishTaskDetail(String taskId) {
Map<String, String> map = Maps.newHashMap();
map.put("taskId", taskId);
String url = buildUrl(address, WorkFlowUriEnum.所有已执行任务详情, map);
Map<String, String> headerMap = Maps.newHashMap();
headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
JSONObject json = handleResult(resultStr);
logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
return json;
}
public JSONObject queryFinishTaskDetailByInstanceId(String InstanceId) {
Map<String, String> map = Maps.newHashMap();
map.put("processInstanceId", InstanceId);
String url = buildUrl(address, WorkFlowUriEnum.所有已执行任务集合, map);
Map<String, String> headerMap = Maps.newHashMap();
headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
JSONObject json = handleResult(resultStr);
logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
return json;
}
}
package com.yeejoin.amos.boot.biz.common.workflow.business.util;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.util.EntityUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Iterator;
import java.util.Map;
public class HttpUtil {
// utf-8字符编码
private static final String CHARSET_UTF_8 = "utf-8";
// HTTP内容类型。
private static final String CONTENT_TYPE_TEXT_HTML = "text/xml";
// HTTP内容类型。相当于form表单的形式,提交数据
private static final String CONTENT_TYPE_FORM_URL = "application/x-www-form-urlencoded";
// HTTP内容类型。相当于form表单的形式,提交数据
private static final String CONTENT_TYPE_JSON_URL = "application/json;charset=utf-8";
// 连接管理器
private static PoolingHttpClientConnectionManager pool;
// 请求配置
private static RequestConfig requestConfig;
static {
try {
//System.out.println("初始化HttpClientTest~~~开始");
SSLContextBuilder builder = new SSLContextBuilder();
builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
builder.build());
// 配置同时支持 HTTP 和 HTPPS
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register(
"http", PlainConnectionSocketFactory.getSocketFactory()).register(
"https", sslsf).build();
// 初始化连接管理器
pool = new PoolingHttpClientConnectionManager(
socketFactoryRegistry);
// 将最大连接数增加到200,实际项目最好从配置文件中读取这个值
pool.setMaxTotal(200);
// 设置最大路由
pool.setDefaultMaxPerRoute(2);
// 根据默认超时限制初始化requestConfig
int socketTimeout = 10000;
int connectTimeout = 10000;
int connectionRequestTimeout = 10000;
requestConfig = RequestConfig.custom().setConnectionRequestTimeout(
connectionRequestTimeout).setSocketTimeout(socketTimeout).setConnectTimeout(
connectTimeout).build();
//System.out.println("初始化HttpClientTest~~~结束");
} catch (Exception e) {
e.printStackTrace();
}
// 设置请求超时时间
requestConfig = RequestConfig.custom().setSocketTimeout(50000).setConnectTimeout(50000)
.setConnectionRequestTimeout(50000).build();
}
private static CloseableHttpClient getHttpClient() {
return HttpClients.custom()
// 设置连接池管理
.setConnectionManager(pool)
// 设置请求配置
.setDefaultRequestConfig(requestConfig)
// 设置重试次数
.setRetryHandler(new DefaultHttpRequestRetryHandler(0, false))
.build();
}
/**
* 发送Post请求
*/
private static String sendHttpPost(HttpPost httpPost) {
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
// 响应内容
String responseContent = null;
try {
// 创建默认的httpClient实例.
httpClient = getHttpClient();
// 配置请求信息
httpPost.setConfig(requestConfig);
// 执行请求
response = httpClient.execute(httpPost);
// 得到响应实例
HttpEntity entity = response.getEntity();
// 可以获得响应头
// Header[] headers = response.getHeaders(HttpHeaders.CONTENT_TYPE);
// for (Header header : headers) {
// System.out.println(header.getName());
// }
// 得到响应类型
// System.out.println(ContentType.getOrDefault(response.getEntity()).getMimeType());
// 判断响应状态
if (response.getStatusLine().getStatusCode() >= 300) {
throw new Exception(
"HTTP Request is not success, Response code is " + response.getStatusLine().getStatusCode());
}
if (HttpStatus.SC_OK == response.getStatusLine().getStatusCode() || HttpStatus.SC_CREATED == response.getStatusLine().getStatusCode()) {
responseContent = EntityUtils.toString(entity, CHARSET_UTF_8);
EntityUtils.consume(entity);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
// 释放资源
if (response != null) {
response.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return responseContent;
}
/**
* 发送Post请求
*
* @param httpPut
* @return
*/
private static String sendHttpPut(HttpPut httpPut) {
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
// 响应内容
String responseContent = null;
try {
// 创建默认的httpClient实例.
httpClient = getHttpClient();
// 配置请求信息
httpPut.setConfig(requestConfig);
// 执行请求
response = httpClient.execute(httpPut);
// 得到响应实例
HttpEntity entity = response.getEntity();
// 可以获得响应头
// Header[] headers = response.getHeaders(HttpHeaders.CONTENT_TYPE);
// for (Header header : headers) {
// System.out.println(header.getName());
// }
// 得到响应类型
// System.out.println(ContentType.getOrDefault(response.getEntity()).getMimeType());
// 判断响应状态
if (response.getStatusLine().getStatusCode() >= 300) {
throw new Exception(
"HTTP Request is not success, Response code is " + response.getStatusLine().getStatusCode());
}
if (HttpStatus.SC_OK == response.getStatusLine().getStatusCode() || HttpStatus.SC_CREATED == response.getStatusLine().getStatusCode()) {
responseContent = EntityUtils.toString(entity, CHARSET_UTF_8);
EntityUtils.consume(entity);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
// 释放资源
if (response != null) {
response.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return responseContent;
}
/**
* 发送Post请求
*
* @param httpDelete
* @return
*/
private static String sendHttpDelete(HttpDelete httpDelete) {
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
// 响应内容
String responseContent = null;
try {
// 创建默认的httpClient实例.
httpClient = getHttpClient();
// 配置请求信息
httpDelete.setConfig(requestConfig);
// 执行请求
response = httpClient.execute(httpDelete);
// 得到响应实例
HttpEntity entity = response.getEntity();
// 可以获得响应头
// Header[] headers = response.getHeaders(HttpHeaders.CONTENT_TYPE);
// for (Header header : headers) {
// System.out.println(header.getName());
// }
// 得到响应类型
// System.out.println(ContentType.getOrDefault(response.getEntity()).getMimeType());
// 判断响应状态
if (response.getStatusLine().getStatusCode() >= 300) {
throw new Exception(
"HTTP Request is not success, Response code is " + response.getStatusLine().getStatusCode());
}
if (HttpStatus.SC_OK == response.getStatusLine().getStatusCode() || HttpStatus.SC_CREATED == response.getStatusLine().getStatusCode()) {
responseContent = EntityUtils.toString(entity, CHARSET_UTF_8);
EntityUtils.consume(entity);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
// 释放资源
if (response != null) {
response.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return responseContent;
}
/**
* 发送Get请求
*
* @param httpGet
* @return
*/
private static String sendHttpGet(HttpGet httpGet) {
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
// 响应内容
String responseContent = null;
try {
// 创建默认的httpClient实例.
httpClient = getHttpClient();
// 配置请求信息
httpGet.setConfig(requestConfig);
// 执行请求
response = httpClient.execute(httpGet);
// 得到响应实例
HttpEntity entity = response.getEntity();
// 可以获得响应头
// Header[] headers = response.getHeaders(HttpHeaders.CONTENT_TYPE);
// for (Header header : headers) {
// System.out.println(header.getName());
// }
// 得到响应类型
// System.out.println(ContentType.getOrDefault(response.getEntity()).getMimeType());
// 判断响应状态
if (response.getStatusLine().getStatusCode() >= 300) {
throw new Exception(
"HTTP Request is not success, Response code is " + response.getStatusLine().getStatusCode());
}
if (HttpStatus.SC_OK == response.getStatusLine().getStatusCode()) {
responseContent = EntityUtils.toString(entity, CHARSET_UTF_8);
EntityUtils.consume(entity);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
// 释放资源
if (response != null) {
response.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return responseContent;
}
/**
* 发送 post请求
*
* @param httpUrl 地址
*/
public static String sendHttpPost(String httpUrl) {
// 创建httpPost
HttpPost httpPost = new HttpPost(httpUrl);
return sendHttpPost(httpPost);
}
/**
* 发送 delete请求
*
* @param httpUrl 地址
*/
public static String sendHttpDelete(String httpUrl) {
// 创建httpPost
HttpDelete httpDelete = new HttpDelete(httpUrl);
return sendHttpDelete(httpDelete);
}
/**
* 发送 post请求
*
* @param httpUrl 地址
*/
public static String sendHttpPostWithHeader(String httpUrl, Map<String, String> headerMap) {
// 创建httpPost
HttpPost httpPost = new HttpPost(httpUrl);
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
httpPost.setHeader(entry.getKey(), entry.getValue());
}
return sendHttpPost(httpPost);
}
/**
* 发送 get请求
*
* @param httpUrl
*/
public static String sendHttpGet(String httpUrl) {
// 创建get请求
HttpGet httpGet = new HttpGet(httpUrl);
return sendHttpGet(httpGet);
}
/**
* 发送 delete请求带请求头
*/
public static String sendHttpDeleteWithHeader(String httpUrl, Map<String, String> headerMap) {
// 创建get请求
HttpDelete httpDelete = new HttpDelete(httpUrl);
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
httpDelete.setHeader(entry.getKey(), entry.getValue());
}
return sendHttpDelete(httpDelete);
}
/**
* 发送 get请求带请求头
*/
public static String sendHttpGetWithHeader(String httpUrl, Map<String, String> headerMap) {
// 创建get请求
HttpGet httpGet = new HttpGet(httpUrl);
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
httpGet.setHeader(entry.getKey(), entry.getValue());
}
return sendHttpGet(httpGet);
}
/**
* 发送 delete请求带请求头
*/
public static String sendHttpDeleteJsonWithHeader(String httpUrl, String paramsJson, Map<String, String> headerMap) {
StringBuffer content = new StringBuffer();
try {
URL url = new URL(httpUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("DELETE");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
connection.setRequestProperty(entry.getKey(), entry.getValue());
}
PrintWriter printWriter = new PrintWriter(connection.getOutputStream());
printWriter.write(paramsJson);
printWriter.flush();
BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
content.append(line);
}
br.close();
connection.disconnect();
} catch (Exception e) {
}
return content.toString();
}
/**
* 发送 post请求
*
* @param httpUrl 地址
* @param params 参数(格式:key1=value1&key2=value2)
*/
public static String sendHttpPost(String httpUrl, String params) {
HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost
try {
// 设置参数
if (params != null && params.trim().length() > 0) {
StringEntity stringEntity = new StringEntity(params, "UTF-8");
stringEntity.setContentType(CONTENT_TYPE_FORM_URL);
httpPost.setEntity(stringEntity);
}
} catch (Exception e) {
e.printStackTrace();
}
return sendHttpPost(httpPost);
}
/**
* 发送 post请求
*
* @param maps 参数
*/
public static String sendHttpPost(String httpUrl, Map<String, String> maps) {
String parem = convertStringParamter(maps);
return sendHttpPost(httpUrl, parem);
}
/**
* 发送 post请求 发送json数据
*
* @param httpUrl 地址
* @param paramsJson 参数(格式 json)
*/
public static String sendHttpPostJsonWithHeader(String httpUrl, String paramsJson, Map<String, String> headerMap) {
HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost
try {
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
httpPost.setHeader(entry.getKey(), entry.getValue());
}
// 设置参数
if (paramsJson != null && paramsJson.trim().length() > 0) {
StringEntity stringEntity = new StringEntity(paramsJson, "UTF-8");
stringEntity.setContentType(CONTENT_TYPE_JSON_URL);
httpPost.setEntity(stringEntity);
}
} catch (Exception e) {
e.printStackTrace();
}
return sendHttpPost(httpPost);
}
/**
* 发送 put请求 发送json数据
*
* @param httpUrl 地址
* @param paramsJson 参数(格式 json)
*/
public static String sendHttpPutJsonWithHeader(String httpUrl, String paramsJson, Map<String, String> headerMap) {
HttpPut httpPost = new HttpPut(httpUrl);// 创建HttpPut
try {
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
httpPost.setHeader(entry.getKey(), entry.getValue());
}
// 设置参数
if (paramsJson != null && paramsJson.trim().length() > 0) {
StringEntity stringEntity = new StringEntity(paramsJson, "UTF-8");
stringEntity.setContentType(CONTENT_TYPE_JSON_URL);
httpPost.setEntity(stringEntity);
}
} catch (Exception e) {
e.printStackTrace();
}
return sendHttpPut(httpPost);
}
/**
* 发送 post请求 发送json数据
*
* @param httpUrl 地址
* @param paramsJson 参数(格式 json)
*/
public static String sendHttpPostJson(String httpUrl, String paramsJson) {
HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost
try {
// 设置参数
if (paramsJson != null && paramsJson.trim().length() > 0) {
StringEntity stringEntity = new StringEntity(paramsJson, "UTF-8");
stringEntity.setContentType(CONTENT_TYPE_JSON_URL);
httpPost.setEntity(stringEntity);
}
} catch (Exception e) {
e.printStackTrace();
}
return sendHttpPost(httpPost);
}
/**
* 发送 post请求 发送xml数据
*
* @param httpUrl 地址
* @param paramsXml 参数(格式 Xml)
*/
public static String sendHttpPostXml(String httpUrl, String paramsXml) {
HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost
try {
// 设置参数
if (paramsXml != null && paramsXml.trim().length() > 0) {
StringEntity stringEntity = new StringEntity(paramsXml, "UTF-8");
stringEntity.setContentType(CONTENT_TYPE_TEXT_HTML);
httpPost.setEntity(stringEntity);
}
} catch (Exception e) {
e.printStackTrace();
}
return sendHttpPost(httpPost);
}
/**
* 将map集合的键值对转化成:key1=value1&key2=value2 的形式
*
* @param parameterMap 需要转化的键值对集合
* @return 字符串
*/
private static String convertStringParamter(Map parameterMap) {
StringBuffer parameterBuffer = new StringBuffer();
if (parameterMap != null) {
Iterator iterator = parameterMap.keySet().iterator();
String key = null;
String value = null;
while (iterator.hasNext()) {
key = (String) iterator.next();
if (parameterMap.get(key) != null) {
value = (String) parameterMap.get(key);
} else {
value = "";
}
parameterBuffer.append(key).append("=").append(value);
if (iterator.hasNext()) {
parameterBuffer.append("&");
}
}
}
return parameterBuffer.toString();
}
}
\ No newline at end of file
/**
*
*/
package com.yeejoin.amos.boot.biz.common.workflow.constants;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat;
/**
* 常量
*/
public class XJConstant {
public static final String ROOT_PATH = "F:/software/nginx-1.14.2/html/";
public static final String NGINX_ADDRESS = "172.16.3.77:8081/";
public static final String DEFAULT_RISKDESC = "默认";
public static final String JPUSH_USER_KEY ="BANK88";
public static final String CHECK_TYPE = "CHECK_TYPE";
public static final String DEPT_WF_MAP_DIC_CODE = "DEPT_WF_MAP";
/**
* 构造方法
*/
private XJConstant() {
LoggerFactory.getLogger(this.getClass()).debug(XJConstant.CONSTRUCTOR);
}
/**
* 网络服务ip
*/
public static final String NET_SERVER_HOST = "0.0.0.0";
/**
* 请求头key
*/
public static final String TOKEN_KEY = "token";
/**
* 请求头key
*/
public static final String PRODUCT = "product";
/**
* 请求头key
*/
public static final String APPKEY = "appKey";
/**
* 时间格式(yyyy-MM-dd HH:mm:ss)
*/
public static final SimpleDateFormat SIMPLEDATAFORMAT_YMDHMS = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
/**
* 构造方法字符串
*/
public static final String CONSTRUCTOR = "constructor...";
/**
* 轮询job最大线程数
*/
public static final int POLLING_JOB_THREAD_MAX_NUM = 20;
/**
* amos线程池数量
*/
public static final int AMOS_THREAD_NUM = 20;
/**
* 设备测试最大线程数
*/
public static final int TEST_EQUIPMENT_THREAD_MAX_NUM = 5;
/**
* 时间格式字符串:yyyy-MM-dd HH:mm:ss
*/
public static final String DATE_TIME_STR_YMDHMS = "yyyy-MM-dd HH:mm:ss";
/**
* bar
*/
public static final String BAR = "-";
/**
* Underline
*/
public static final String UNDERLINE = "_";
/**
* user
*/
public static final String USER = "user";
/**
* token
*/
public static final String TOKEN = "token";
/**
* loginType
*/
public static final String LOGIN_TYPE = "loginType";
/**
* subGraphId
*/
public static final String SUB_GRAPH_ID = "subGraphId";
public static final String ADMIN_ID = "1";
/**
* 帧报文异常
*/
public static final String FRAME_EXECPTION = "FRAME";
/**
* 性能指标
*/
public static final String METRIC = "METRIC";
/**
* 报文通道
*/
public static final String CHANNEL = "CHANNEL";
/**
* 设备状态(掉线)告警
*/
public static final String EQUIPMENT_STATUS = "EQUIPMENT_STATUS";
/**
* 设备连通性告警告警
*/
public static final String EQUIPMENT_CONNECTION = "EQUIPMENT_CONNECTION";
/**
* 通道注册
*/
public static final String REGISTER = "REGISTER";
/**
* 通道注销
*/
public static final String UNREGISTER = "UNREGISTER";
/**
* 报文正常
*/
public static final String NORMAL = "NORMAL";
/**
* 报文异常
*/
public static final String UNNORMAL = "UNNORMAL";
/**
* 告警socket类型
*/
public static final String ALARM_SOCKET = "ALARM_SOCKET";
/**
* 数据socket类型
*/
public static final String METRIC_SOCKET = "METRIC_SOCKET";
/**
* 数据socket类型
*/
public static final String MORPHIC_SOCKET = "MORPHIC_SOCKET";
/**
* false
*/
public static final Boolean FAIL_BOOLEAN_VALUE = Boolean.FALSE;
/**
* 0
*/
public static final Integer ZERO_INT_VALUE = Integer.parseInt("0");
/**
* -1
*/
public static final Integer FAIL_INT_VALUE = Integer.parseInt("-1");
/**
* -1
*/
public static final Long FAIL_LONG_VALUE = Long.parseLong("-1");
/**
* -1
*/
public static final Short FAIL_SHORT_VALUE = Short.parseShort("-1");
/**
*
*/
public static final Float FAIL_FLOAT_VALUE = Float.parseFloat("-1");
/**
* -1
*/
public static final Double FAIL_DOUBLE_VALUE = Double.parseDouble("-1");
/**
* 空格
*/
public static final Character FAIL_CHARACTER_VALUE = Character.valueOf(' ');
/**
* 失败
*/
public static final int FAILURE = 0;
/**
* 成功
*/
public static final int SUCCESS = 1;
/**
* 在线
*/
public static final String ONLINE = "在线";
/**
* 掉线
*/
public static final String OFFLINE = "掉线";
/**
* 通
*/
public static final String OPEN = "通";
/**
* 不通
*/
public static final String OFF = "不通";
/**
* ip
*/
public static final String IP = "ip";
/**
* #
*/
public static final String SHARP = "#";
/**
* TCP
*/
public static final String TCP = "TCP";
public static final String PIE_CHAR = "pieChar";
public static final String BAR_CHAR = "barChar";
public static final String HBAR_CHAR = "hbarChar";
public static final String LINE_CHAR = "lineChar";
public static final String DOUGHUNT_CHAR = "doughuntChar";
public static final String ROSE_CHAR = "roseChar";
public static final String AREA_CHAR = "areaChar";
public static final String DIMENSION = "dimension";
public static final String MEASURE = "measure";
/**
* xunjian
*/
public static final String TABLE_USERS = "Users";
public static final String EDIT_PWD = "editPassword";
public static final String EDIT_NOT_PWD = "editUsersInfo";
public static final String SAVE_USERS = "saveTableById";
public static final String SAVE_COM_USER = "saveComUserInfo";
public static final String EDIT_COM_USER = "editComUserInfo";
public static final String TABLE_CHECK = "Check";
public static final String TABLE_COM_USER = "companyUser";
public static final int FINISH_YES = 2;
public static final int FINISH_ING = 1;
public static final int FINISH_NO = 0;
public static final String SAVE_DEPART = "saveDepartMent";
public static final String EDIT_DEPART = "editsDepartMent";
public static final String TABLE_DEPART = "Group";
public static final String TABLE_ERROR = "Error";//隐患表
public static final String SAVE_ERROR = "saveErrorByID";//更新隐患表
public static final int XJ_ADMIN_ROLE = 9;//巡检管理员角色ID
public static final int XJ_USER_ROLE = 0;//巡检普通用户角色ID
public static final int TASK_STATUS_TIMEOUT = 3;//已超时
public static final int TASK_STATUS_FINISH = 2;//已结束
public static final int TASK_STATUS_DEAL = 1;//进行中
public static final int TASK_STATUS_NO_START = 0;//未开始
public static final String PLAN_TASK_DET_FINISH_NO = "0";//任务明细状态:未完成
public static final String PLAN_TASK_DET_FINISH_YES = "1";//任务明细状态:完成
public static final String PLAN_TASK_DET_FINISH_OUT = "2";//任务明细状态:超时漏检
public static final String USER_DATA_ADMIN = "全部可见"; //用户数据可见范围
public static final String USER_DATA_DEPART = "部门可见"; //用户数据可见范围
public static final String USER_DATA_PERSON = "个人可见"; //用户数据可见范围
public static final String USER_ROLE_SUPERADMIN = "1"; //权限id-超级管理员
public static final String USER_ROLE_ADMIN = "2"; //权限id-管理员
public static final String USER_ROLE_DEPART = "3"; //权限id-部门管理
public static final String USER_ROLE_PERSON = "4"; //权限id-普通用户
public static final String ROLE_NAME_SUPERADMIN = "SUPERADMIN"; //数据权限-超级管理员
public static final String ROLE_NAME_ADMIN = "ADMIN"; //数据权限-超级管理员
public static final String ROLE_NAME_DEPTADMIN = "DEPTADMIN"; //数据权限-部门
public static final String ROLE_NAME_PERSON = "PERSONAL"; //数据权限-个人
public static final String ADMIN_FLAG = "2"; //权限标记
public static final String DEPART_FLAG = "1"; //权限标记
public static final String PERSON_FLAG = "0";//权限标记
public static final String ADMIN_FLAG_NO = "0"; //标记 0-无关
public static final String ADMIN_FLAG_UP = "1"; //1-上级admin
public static final String ADMIN_FLAG_THIS = "2"; //2-本级admin
public static final String UNCLASSIFIED = "Unclassifed"; //巡检点未分类
public static final String ADMIN_ORG_CODE = "2";
public static final String CHECK_CHANGE_NO = "0";//是否记为合格:否
public static final String CHECK_CHANGE_YES = "1";//是否记为合格:是
public static final String SCHED_FLAG = "99";//自动任务标记
public static final String REGEN_FLAG = "98";//重做任务标记
public static final String FIX_DATE_NO = "0";//不固定日期(区间)
public static final String FIX_DATE_YES = "1";//固定日期
//计划类型
public static final String PLAN_TYPE_DAY = "1";//日计划
public static final String PLAN_TYPE_WEEK = "2";//周计划
public static final String PLAN_TYPE_MONTH = "3";//月计划
public static final String PLAN_TYPE_YEAR = "4";//年计划
//月类型
public static final String MONTH_TYPE_DAY = "1";//第几天
public static final String MONTH_TYPE_AT = "2";//在第几周的第几天
public static final String INTERVAL_UNIT_HOUR = "1";//执行间隔小时
public static final String INTERVAL_UNIT_MINUTE = "2";//执行间隔分钟
public static final String INTERVAL_UNIT_SECOND = "3";//执行间隔秒
public static final String ZERO_TIME = "00:00:00";//time
public static final String PLAN_STATUS_START = "0";//计划状态:正常
public static final String PLAN_STATUS_STOP = "1";//计划状态:已停用
public static final int PLAN_FIRST_STATUS_YES = 0;//计划:初始状态
public static final int PLAN_FIRST_STATUS_NO = 1;//计划:非初始状态
public static final String UPD_PLAN_GEN_DATE = "1";//更新plan表日期
public static final String UPD_PLAN_STATUS = "2";//更新plan表next_gen_status
public static final int DAY_RATE_ONE = 0;//0-1次
public static final int DAY_RATE_MANY = 1;//1-多次
public static final int IS_DETETE_NO = 0;//未删除
public static final int IS_DETETE_YES = 1;//删除
public static final String UPLOAD_ROOT_PATH = "upload";
public static final String INPUT_ITEM_TEXT = "文本";
public static final String INPUT_ITEM_NUMBER = "数字";
public static final String INPUT_ITEM_SELECT = "选择";
public static final String CHECK_TYPE_ALWAYS_OK = "始终合格";
public static final String CHECK_TYPE_ALWAYS_NO = "始终不合格";
public static final String CHECK_TYPE_NO_CONTEXT_OK = "无内容合格";
public static final String CHECK_TYPE_CONTEXT_OK = "有内容合格";
public static final String OK = "合格";
public static final String NO = "不合格";
public static final String YES = "是";
public static final String NOT = "否";
public static final String INPUT_ITEM_OK_SCORE = "OkScore";
public static final String INPUT_ITEM_NOT_SCORE = "NoScore";
public static final String POINT_OK_SCORE = "1";
public static final String POINT_NOT_SCORE = "0";
/**
* 任务是否发送消息状态
*/
public static final String TASK_WARN = "是";
public static final String TASK_NOT_WARN = "否";
/**
* 系统定时任务类型
*/
public static final String STATUS_MONITOR_START = "statusMonitorStart"; //状态监控是否开始
public static final String STATUS_MONITOR_END = "statusMonitorEnd"; //状态监控是否结束
public static final String PLAN_TASK_WARN_MSG_PUSH = "planTaskWarnMsgPush"; //计划即将开始消息提醒推送
public static final String PLAN_TASK_BEGIN_MSG_PUSH = "planTaskBeginMsgPush"; //计划已经开始消息提醒推送
public static final String PLAN_TASK_END_MSG_PUSH = "planTaskEndMsgPush"; //计划已经开始消息提醒推送
public static final String MESSAGE_PUSH = "messagePush"; //消息推送
public static final int IS_SENT = 1; //已发送
public static final int NOT_SENT = 0; //未发送
public static final String IS_FIXED_YES = "1"; //固定点
}
package com.yeejoin.amos.boot.biz.common.workflow.enums;
public enum WorkFlowUriEnum {
启动流程("启动流程", "/workflow/task/startTask", ""),
流程详情("流程详情", "/workflow/task/{taskId}", "taskId"),
合并启动流程("合并启动流程", "/workflow/task/startProcess", ""),
所有已执行任务详情("所有已执行任务详情","/workflow/activitiHistory/task/detail/{taskId}","taskId"),
流程任务("流程任务", "/workflow/task?processInstanceId={processInstanceId}", "processInstanceId"),
我的代办("我的代办", "/workflow/task/all-list?processDefinitionKey={processDefinitionKey}", "processDefinitionKey"),
我的代办有ID("我的代办有ID", "/workflow/task/all-list?processDefinitionKey={processDefinitionKey}&userId={userId}", "processDefinitionKey,userId"),
已执行任务("已执行任务", "/workflow/activitiHistory/all-historytasks?processDefinitionKey={processDefinitionKey}", "processDefinitionKey"),
已执行任务有ID("已执行任务有ID", "/workflow/activitiHistory/all-historytasks?processDefinitionKey={processDefinitionKey}&userId={userId}", "processDefinitionKey,userId"),
启动免登录流程("启动免登录流程", "/processes/{appKey}", "appKey"),
当前节点("当前节点", "/wf/taskstodo?processInstanceId={processInstanceId}", "processInstanceId"),
执行流程("执行流程", "/workflow/task/pickupAndCompleteTask/{taskId}", "taskId"),
终止流程("终止流程", "/wf/processes/{processInstanceId}?deleteReason={deleteReason}", "processInstanceId,deleteReason"),
当前子节点("当前子节点", "/wf/processes/{processInstanceId}/tasks?taskDefinitionKey={taskDefinitionKey}", "processInstanceId,taskDefinitionKey"),
工作流流水("工作流流水","/wf/processes/{processInstanceId}/tasks", "processInstanceId"),
子节点信息("子节点信息","/workflow/task/list/all/{instanceId}", "instanceId"),
所有已执行任务集合("所有已执行任务集合","/workflow/activitiHistory/tasks/{processInstanceId}", "processInstanceId");
private String desc;
private String uri;
private String params;
WorkFlowUriEnum(String desc, String uri, String params) {
this.desc = desc;
this.uri = uri;
this.params = params;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params;
}
}
package com.yeejoin.amos.boot.biz.common.workflow.enums;
/**
* 是否枚举
* @author WJK
*
*/
public enum YesOrNoEnum {
NO("否","0"),
YES("是","1" );
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
private YesOrNoEnum(String name, String code){
this.name = name;
this.code = code;
}
public static YesOrNoEnum getEnum(String code) {
YesOrNoEnum jPushTypeEnum = null;
for(YesOrNoEnum type: YesOrNoEnum.values()) {
if (type.getCode().equals(code)) {
jPushTypeEnum = type;
break;
}
}
return jPushTypeEnum;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
......@@ -25,6 +25,9 @@ public class FailureAuditDto extends BaseDto {
@ApiModelProperty(value = "审核部门")
private String auditDepartment;
@ApiModelProperty(value = "审核部门")
private Long auditDepartmentId;
@ApiModelProperty(value = "审核时间")
private Date auditTime;
......@@ -37,5 +40,10 @@ public class FailureAuditDto extends BaseDto {
@ApiModelProperty(value = "设备故障报修单id")
private Long faultId;
@ApiModelProperty(value = "审核结果条件判断,0同意,1拒绝,2驳回")
private String condition;
}
......@@ -51,5 +51,8 @@ public class FailureMaintainDto extends BaseDto {
@ApiModelProperty(value = "附件")
private List<SourceFile> attachment;
@ApiModelProperty(value = "审核结果条件判断,0同意,1拒绝,2驳回")
private String condition;
}
......@@ -34,6 +34,9 @@ public class FailureAudit extends BaseEntity {
*/
@TableField("audit_department")
private String auditDepartment;
@TableField("audit_department_id")
private Long auditDepartmentId;
/**
* 审核时间
......@@ -52,5 +55,7 @@ public class FailureAudit extends BaseEntity {
*/
@TableField("fault_id")
private Long faultId;
}
package com.yeejoin.amos.boot.module.common.api.service;
import com.yeejoin.amos.boot.module.common.api.entity.FailureAudit;
/**
* 接口类
......@@ -8,5 +9,5 @@ package com.yeejoin.amos.boot.module.common.api.service;
* @date 2021-08-04
*/
public interface IFailureAuditService {
public FailureAudit findByFaultId(Long faultId) ;
}
package com.yeejoin.amos.maintenance.common.enums;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author DELL
* 维保任务排序
*/
public enum OrderByEnum {
/**
* 维保任务排序
*/
TIME_DESC("时间倒序", "1", "beginTime desc"),
TIME_ASC("时间正序", "2", "beginTime asc"),
PLAN_TASK_NUM_ASC("计划维保设施数正序", "3", "taskPlanNum asc"),
PLAN_TASK_NUM_DESC("计划维保设施数倒序", "4", "taskPlanNum desc"),
FINISH_NUM_DESC("完成数倒序", "5", "finishNum desc"),
FINISH_NUM_ASC("完成数正序", "6", "finishNum asc");
/**
* 名字
*/
private String name;
/**
* 编号
*/
private String code;
/**
* 条件
*/
private String oderBy;
public String getOderBy() {
return oderBy;
}
public void setOderBy(String oderBy) {
this.oderBy = oderBy;
}
OrderByEnum(String name, String code, String oderBy) {
this.code = code;
this.name = name;
this.oderBy = oderBy;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public static List<Map<String, Object>> getEnumList() {
return Arrays.stream(OrderByEnum.values()).map(e -> {
Map<String, Object> map = new HashMap<>();
map.put(e.getCode(), e.getName());
return map;
}).collect(Collectors.toList());
}
public static OrderByEnum getEumByCode(String code) throws Exception {
Optional<OrderByEnum> op = Arrays.stream(OrderByEnum.values()).filter(e->e.getCode().equals(code)).findFirst();
return op.orElseThrow(()->new Exception("非法的条件"));
}
}
......@@ -86,4 +86,7 @@ public class FailureAuditController extends BaseController {
public ResponseModel<List<FailureAuditDto>> selectForList() {
return ResponseHelper.buildResponse(failureAuditServiceImpl.queryForFailureAuditList());
}
}
package com.yeejoin.amos.boot.module.common.biz.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
import com.yeejoin.amos.boot.module.common.api.entity.FailureDetails;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FailureDetailsServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
/*import com.yeejoin.amos.patrol.business.util.CommonResponse;
import com.yeejoin.amos.patrol.business.util.CommonResponseUtil;*/
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
*
......@@ -44,29 +53,29 @@ public class FailureDetailsController extends BaseController {
*
* @return
*/
/*
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public CommonResponse save(@RequestBody FailureDetailsDto model) {
*/
/* model = failureDetailsServiceImpl.savemodel(model);
return ResponseHelper.buildResponse(model);*//*
CommonResponse commonResponse = new CommonResponse();
try {
AgencyUserModel user = getUserInfo();
if (ObjectUtils.isEmpty(user)) {
return CommonResponseUtil.failure("用户session过期");
}
return failureDetailsServiceImpl.savemodel(model);
} catch (Exception e) {
logger.error("", e.getMessage());
return CommonResponseUtil.failure("系统繁忙,请稍后再试");
}
public ResponseModel<Object> save(@RequestBody FailureDetailsDto model) {
Object result = failureDetailsServiceImpl.savemodel(model,getSelectedOrgInfo());
return ResponseHelper.buildResponse(result);
// CommonResponse commonResponse = new CommonResponse();
// try {
// AgencyUserModel user = getUserInfo();
// if (ObjectUtils.isEmpty(user)) {
// return CommonResponseUtil.failure("用户session过期");
// }
// return failureDetailsServiceImpl.savemodel(model);
// } catch (Exception e) {
// logger.error("", e.getMessage());
// return CommonResponseUtil.failure("系统繁忙,请稍后再试");
// }
}
*/
/**
* 根据sequenceNbr更新
......
......@@ -118,5 +118,18 @@ public class FailureMaintainController extends BaseController {
return ResponseHelper.buildResponse(failureMaintainServiceImpl.queryForFailureMaintainList());
}
/**
* 查询历史流程审核信息记录
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "设备故障报修单详情-报修日志", notes = "设备故障报修单详情-报修日志")
@GetMapping(value = "/getProcessHistory/{sequenceNbr}")
public ResponseModel<List<Object>> getProcessHistory(@PathVariable Long sequenceNbr ) {
if(sequenceNbr==null) {
return ResponseHelper.buildResponse(null);
}
return ResponseHelper.buildResponse(failureMaintainServiceImpl.getProcessHistoryList(sequenceNbr));
}
}
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.FailureAuditDto;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
......@@ -9,13 +17,6 @@ import com.yeejoin.amos.boot.module.common.api.enums.FailureStatuEnum;
import com.yeejoin.amos.boot.module.common.api.mapper.FailureAuditMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFailureAuditService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
/**
* 服务实现类
*
......@@ -23,53 +24,64 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
* @date 2021-08-04
*/
@Service
public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, FailureAudit, FailureAuditMapper> implements IFailureAuditService {
@Autowired
FailureDetailsServiceImpl failureDetailsService;
/* @Autowired
RemoteWorkFlowService remoteWorkFlowService;*/
public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, FailureAudit, FailureAuditMapper>
implements IFailureAuditService {
@Autowired
FailureDetailsServiceImpl failureDetailsService;
// @Autowired
// RemoteWorkFlowService remoteWorkFlowService;
/**
* 分页查询
*/
public Page<FailureAuditDto> queryForFailureAuditPage(Page<FailureAuditDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 分页查询
*/
public Page<FailureAuditDto> queryForFailureAuditPage(Page<FailureAuditDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<FailureAuditDto> queryForFailureAuditList() {
return this.queryForList("", false);
}
/**
* 列表查询 示例
*/
public List<FailureAuditDto> queryForFailureAuditList() {
return this.queryForList("", false);
}
/**
* 发起审核
*/
public FailureAuditDto savemodel(FailureAuditDto model) {
/**
* 发起审核
*/
public FailureAuditDto savemodel(FailureAuditDto model) {
// remoteWorkFlowService.currentTask();
// remoteWorkFlowService.currentTask();
this.createWithModel(model);
Integer auditResult = model.getAuditResult();
if (auditResult.equals(AuditResultEnum.AGREE.getCode())) {
updateStatus(model, FailureStatuEnum.WAITING_MAINTAIN.getCode());
} else if (auditResult.equals( AuditResultEnum.REFUSE.getCode())) {
updateStatus(model, FailureStatuEnum.REFUSE.getCode());
}else if (auditResult.equals(AuditResultEnum.SEND_BACK.getCode())){
updateStatus(model, FailureStatuEnum.WAITING_SUBMIT.getCode());
}
return model;
}
this.createWithModel(model);
Integer auditResult = model.getAuditResult();
if (auditResult.equals(AuditResultEnum.AGREE.getCode())) {
updateStatus(model, FailureStatuEnum.WAITING_MAINTAIN.getCode());
} else if (auditResult.equals(AuditResultEnum.REFUSE.getCode())) {
updateStatus(model, FailureStatuEnum.REFUSE.getCode());
} else if (auditResult.equals(AuditResultEnum.SEND_BACK.getCode())) {
updateStatus(model, FailureStatuEnum.WAITING_SUBMIT.getCode());
}
return model;
}
/**
* 修改故障保修单任务状态
*/
FailureDetailsDto updateStatus(FailureAuditDto model, Integer status) {
FailureDetailsDto failureDetailsDto = failureDetailsService.queryBySeq(model.getFaultId());
failureDetailsDto.setCurrentStatus(status);
failureDetailsDto.setSequenceNbr(model.getFaultId());
return failureDetailsService.updateWithModel(failureDetailsDto);
/**
* 修改故障保修单任务状态
*/
FailureDetailsDto updateStatus(FailureAuditDto model, Integer status) {
FailureDetailsDto failureDetailsDto = failureDetailsService.queryBySeq(model.getFaultId());
failureDetailsDto.setCurrentStatus(status);
failureDetailsDto.setSequenceNbr(model.getFaultId());
return failureDetailsService.updateWithModel(failureDetailsDto);
}
}
public FailureAudit findByFaultId(Long faultId) {
LambdaQueryWrapper<FailureAudit> wrapper = new LambdaQueryWrapper<FailureAudit>();
wrapper.eq(FailureAudit::getIsDelete, false);
wrapper.eq(FailureAudit::getFaultId, faultId);
wrapper.orderByAsc(FailureAudit::getAuditTime);
wrapper.last("LIMIT 1");
return this.baseMapper.selectOne(wrapper);
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.workflow.RemoteWorkFlowService;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
import com.yeejoin.amos.boot.module.common.api.entity.FailureAudit;
import com.yeejoin.amos.boot.module.common.api.entity.FailureDetails;
import com.yeejoin.amos.boot.module.common.api.enums.FailureStatuEnum;
import com.yeejoin.amos.boot.module.common.api.mapper.FailureDetailsMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFailureAuditService;
import com.yeejoin.amos.boot.module.common.api.service.IFailureDetailsService;
/**
......@@ -23,88 +39,170 @@ import com.yeejoin.amos.boot.module.common.api.service.IFailureDetailsService;
* @date 2021-08-04
*/
@Service
public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, FailureDetails, FailureDetailsMapper> implements IFailureDetailsService {
@Autowired
SourceFileServiceImpl sourceFileServiceImpl;
// @Autowired
// RemoteWorkFlowService remoteWorkFlowService;
//
// @Value("${failure.work.flow.processDefinitionKey}")
// private String processDefinitionKey;
private final Logger logger = LoggerFactory.getLogger(FailureDetailsServiceImpl.class);
/**
* 分页查询
*/
public Page<FailureDetailsDto> queryForFailureDetailsPage(Page<FailureDetailsDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<FailureDetailsDto> queryForFailureDetailsList() {
return this.queryForList("", false);
}
/**
* 根据状态查询
*/
public List<FailureDetails> queryForFailureDetailsList(Long currentStatus) {
QueryWrapper<FailureDetails> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("current_status",currentStatus).orderByDesc("submission_time");
return baseMapper.selectList(queryWrapper);
}
/**
* 发起故障保修单
*/
// public Object savemodel(FailureDetailsDto failureDetailsDto) {
// String businessKey = buildOrderNo();
// JSONObject jsonObject = remoteWorkFlowService.start( businessKey, processDefinitionKey);
// if (jsonObject == null) {
// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
// // return CommonResponseUtil.failure("启动流程失败");
// }
// JSONObject instance = jsonObject.getJSONObject("data");
// if(instance==null){
// //return CommonResponseUtil.failure("无提交隐患权限");
// }
// failureDetailsDto.setCurrentStatus(FailureStatuEnum.WAITING_AUDIT.getCode());
// //拿到流程id
// failureDetailsDto.setProcessId(instance.getString("processInstanceId"));
// FailureDetailsDto model =null;
// try {
// sourceFileServiceImpl.saveSourceFile(failureDetailsDto.getSequenceNbr(), failureDetailsDto.getAttachment());
// model = this.createWithModel(failureDetailsDto);
// } catch (Exception e) {
// logger.info("添加故障维修信息到数据库失败");
// // return CommonResponseUtil.failure("添加失败");
// }
// if(ObjectUtils.isNotEmpty(model)) {
// JSONObject teskObject = remoteWorkFlowService.currentTask(instance.getString("processInstanceId"));
// if(ObjectUtils.isNotEmpty(teskObject)) {
// JSONObject taskDetail = teskObject.getJSONObject("data");
// String taskId = taskDetail.getString("id");
// remoteWorkFlowService.excute(taskId, null);
// }
// }
// return model;
// }
// public static String buildOrderNo() {
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
// String newDate = sdf.format(new Date());
// String result = "";
// Random random = new Random();
// for (int i = 0; i < 3; i++) {
// result += random.nextInt(10);
// }
// return newDate + result;
// }
public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, FailureDetails, FailureDetailsMapper>
implements IFailureDetailsService {
@Autowired
SourceFileServiceImpl sourceFileServiceImpl;
@Autowired
RemoteWorkFlowService remoteWorkFlowService;
@Value("${failure.work.flow.processDefinitionKey}")
private String processDefinitionKey;
@Autowired
IFailureAuditService failureAuditService;
public static String EMERGENCY_COMMAND = "应急指挥科";
private final Logger logger = LoggerFactory.getLogger(FailureDetailsServiceImpl.class);
/**
* 分页查询
*/
public Page<FailureDetailsDto> queryForFailureDetailsPage(Page<FailureDetailsDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<FailureDetailsDto> queryForFailureDetailsList() {
return this.queryForList("", false);
}
/**
* 根据状态查询
*/
public List<FailureDetails> queryForFailureDetailsList(Long currentStatus) {
QueryWrapper<FailureDetails> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("current_status", currentStatus).orderByDesc("submission_time");
return baseMapper.selectList(queryWrapper);
}
/**
* 发起故障保修单
*/
@Transactional
public Object savemodel(FailureDetailsDto failureDetailsDto, ReginParams userInfo) {
String businessKey = buildOrderNo();
JSONObject jsonObject = remoteWorkFlowService.startNew(null, businessKey, processDefinitionKey);
if (jsonObject == null) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
// return CommonResponseUtil.failure("启动流程失败");
}
JSONObject instance = jsonObject.getJSONObject("data");
if (instance == null) {
// return CommonResponseUtil.failure("无提交隐患权限");
}
failureDetailsDto.setCurrentStatus(FailureStatuEnum.WAITING_AUDIT.getCode());
// 拿到流程processId
failureDetailsDto.setProcessId(instance.getString("id"));
FailureDetailsDto model = null;
try {
if (ObjectUtils.isNotEmpty(failureDetailsDto.getAttachment())) {
sourceFileServiceImpl.saveSourceFile(failureDetailsDto.getSequenceNbr(),
failureDetailsDto.getAttachment());
}
model = this.createWithModel(failureDetailsDto);
} catch (Exception e) {
logger.info("添加故障维修信息到数据库失败");
return false;
// return CommonResponseUtil.failure("添加失败");
}
if (ObjectUtils.isNotEmpty(model)) {
excuteTask( instance.getString("id"), userInfo, null);
}
return true;
}
public boolean excuteTask( Long sequenceNbr, ReginParams userInfo,
String condition) {
Map<String, Object> conditionMap = new HashMap<String, Object>();
conditionMap.put("condition", condition);
Map<String,Object> map= checkExcuteTaskAuthMap(sequenceNbr,userInfo);
try {
if(Boolean.parseBoolean(map.get("checkFlag").toString())) {
remoteWorkFlowService.excute(map.get("taskId").toString(), conditionMap.toString());
}
} catch (Exception e) {
return false;
}
return true;
}
public boolean excuteTask(String procressId, ReginParams userInfo,
String condition) {
Map<String, Object> conditionMap = new HashMap<String, Object>();
conditionMap.put("condition", condition);
JSONObject teskObject = remoteWorkFlowService.getChildNodeDetail(procressId);
if (ObjectUtils.isNotEmpty(teskObject)) {
JSONArray taskDetailArray = teskObject.getJSONArray("data");
for (Object obj : taskDetailArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
remoteWorkFlowService.excute(detail.getString("id"), conditionMap.toString());
}
}
return true;
}
public boolean checkExcuteTaskAuth(Long sequenceNbr, ReginParams userInfo) {
Map<String,Object> map= this.checkExcuteTaskAuthMap(sequenceNbr,userInfo);
return Boolean.parseBoolean(map.get("checkFlag").toString());
}
public Map<String,Object> checkExcuteTaskAuthMap(Long sequenceNbr, ReginParams userInfo) {
Map<String,Object> map = new HashMap<String,Object>();
FailureDetailsDto failureDetailsDto = this.queryBySeq(sequenceNbr);
// 获取送达部门的ID
Integer failureEquipmentId = failureDetailsDto.getFailureEquipmentId();
//获取上一级操作部门的Id
FailureDetails details = this.baseMapper.selectById(sequenceNbr);
String procressId = details.getProcessId();
Long seq = userInfo.getDepartment().getSequenceNbr();
JSONObject teskObject = remoteWorkFlowService.getChildNodeDetail(procressId);
if (ObjectUtils.isNotEmpty(teskObject)) {
JSONArray taskDetailArray = teskObject.getJSONArray("data");
for (Object obj : taskDetailArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
String name = detail.getString("name");
if (name.contains(EMERGENCY_COMMAND) ) {
FailureAudit failureAuditDetail = failureAuditService.findByFaultId(sequenceNbr);
Long auditDepartmentId = failureAuditDetail.getAuditDepartmentId();
if(auditDepartmentId.intValue() == seq.intValue()) {
map.put("taskId", detail.getString("id"));
map.put("checkFlag", true);
return map;
}
} else {
if (failureEquipmentId.intValue() == seq.intValue()) {
map.put("taskId", detail.getString("id"));
map.put("checkFlag", true);
return map;
}
}
}
}
map.put("checkFlag", false);
return map;
}
public Object getCurrentProcessHistoryTask(Long id) {
FailureDetailsDto failureDetailsDto = this.queryBySeq(id);
String processId = failureDetailsDto.getProcessId();
JSONObject historyObject = remoteWorkFlowService.queryFinishTaskDetailByInstanceId(processId);
return logger;
}
public static String buildOrderNo() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String newDate = sdf.format(new Date());
String result = "";
Random random = new Random();
for (int i = 0; i < 3; i++) {
result += random.nextInt(10);
}
return newDate + result;
}
}
\ No newline at end of file
......@@ -73,4 +73,13 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto,F
}
return failureMaintainDto;
}
/**
* 查询当前故障报修单的流程的审批历史节点
* @param sequenceNbr
* @return
*/
public List<Object> getProcessHistoryList(Long sequenceNbr) {
// TODO Auto-generated method stub
return null;
}
}
\ No newline at end of file
......@@ -2,7 +2,6 @@ package com.yeejoin.amos.maintenance.business.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
......@@ -15,7 +14,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -24,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.alibaba.fastjson.JSONObject;
......@@ -42,6 +41,7 @@ import com.yeejoin.amos.maintenance.business.util.Toke;
import com.yeejoin.amos.maintenance.business.vo.CodeOrderVo;
import com.yeejoin.amos.maintenance.business.vo.PlanTaskVo;
import com.yeejoin.amos.maintenance.business.vo.PointInputItemVo;
import com.yeejoin.amos.maintenance.common.enums.OrderByEnum;
import com.yeejoin.amos.maintenance.common.enums.PlanTaskDetailStatusEnum;
import com.yeejoin.amos.maintenance.common.enums.PlanTaskFinishStatusEnum;
import com.yeejoin.amos.maintenance.common.enums.TaskIsOrderEnum;
......@@ -74,6 +74,7 @@ public class PlanTaskController extends AbstractBaseController {
@Autowired
private RemoteSecurityService remoteSecurityService;
private String loginOrgCode;
/**
* 计划执行查询
......@@ -484,54 +485,39 @@ public class PlanTaskController extends AbstractBaseController {
/**
* 查询任务列表
*
* @param queryRequests
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)", notes = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)")
@RequestMapping(value = "/queryPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
@ApiOperation(value = "维保任务查询-mobile", notes = "根据用户条件查询所有计划任务")
@RequestMapping(value = "/queryPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse qryLoginUserPlanTask(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = false, defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
@ApiParam(value = "人员") @RequestParam(value = "userId", required = false) Long userId,
@ApiParam(value = "开始日期") @RequestParam(value = "startTime") String startTime,
@ApiParam(value = "结束日期") @RequestParam(value = "endTime") String endTime,
@ApiParam(value = "维保状态") @RequestParam(value = "finishStatus", required = false) Integer finishStatus,
@ApiParam(value = "排序条件") @RequestParam(value = "orderBy") String orderBy,
@ApiParam(value = "业主单位") @RequestParam(value = "companyId", required = false) String companyId,
@ApiParam(value = "当前页") @RequestParam(value = "pageNumber") int current,
@ApiParam(value = "页大小") @RequestParam(value = "pageSize") int size) throws Exception {
HashMap<String, Object> params = new HashMap<String, Object>();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getLoginOrgCode(reginParams);
params = PlanTaskPageParamUtil.fillPlanTask(queryRequests, params);
Map<String, Object> authMap = Bean.BeantoMap(reginParams.getPersonIdentity());
params.putAll(authMap);
params.put("companyId", companyId);
params.put("orgCode", loginOrgCode);
params.put("pageSize", pageable.getPageSize());
params.put("offset", pageable.getPageNumber() * pageable.getPageSize());
if (ObjectUtils.isEmpty(params.get("orderBy"))) {
params.put("orderBy", "beginTime desc");
}
if (params.get("orderBy").toString().contains("taskPlanNum")) {
params.put("orderBy", params.get("orderBy") + ",beginTime asc");
}
params.put("userId", userId);
params.put("startTime", startTime);
params.put("endTime", endTime);
params.put("finishStatus", finishStatus);
params.put("orderBy", OrderByEnum.getEumByCode(orderBy).getOderBy());
CommonPageable pageable = new CommonPageable(current, size);
try {
Page page = planTaskService.getPlanTasks(getToken(), getProduct(), getAppKey(), params);
List<Map<String, Object>> li = page.getContent();
List<Map<String, Object>> li1 = new ArrayList<>();
if (li != null && li.size() > 0) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (Map<String, Object> msg : li) {
String[] userIds = msg.get("userId").toString().split(",");
for (String userId : userIds) {
msg.put("userId", userId);
}
if (msg.get("checkDate") != null)
msg.put("checkDate", sdf.format(sdf.parse(msg.get("checkDate").toString())));
li1.add(msg);
}
}
Page<Map<String, Object>> pd = new PageImpl<>(li1, page.getPageable(), page.getTotalElements());
return CommonResponseUtil.success(pd);
return CommonResponseUtil.success(planTaskService.getPlanTasks(params, pageable));
} catch (Exception e) {
e.printStackTrace();
return CommonResponseUtil.failure(e.getMessage());
}
}
......
......@@ -566,50 +566,14 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
@Override
public Page<HashMap<String, Object>> getPlanTasks(String toke, String product, String appKey, HashMap<String, Object> params) {
CommonPageable pageParam = new CommonPageable();
public Page<HashMap<String, Object>> getPlanTasks(HashMap<String, Object> params, CommonPageable pageParam) {
List<HashMap<String, Object>> content = Lists.newArrayList();
long total = planTaskMapper.getPlanTasksCount(params);
if (total == 0) {
return new PageImpl<>(content, pageParam, total);
}
content = planTaskMapper.getPlanTasks(params);
if (!CollectionUtils.isEmpty(content)) {
Set<String> userIds = Sets.newHashSet();
content.forEach(e -> {
String userId = e.get("userId").toString();
if (StringUtil.isNotEmpty(userId)) {
userIds.add(userId);
}
});
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
List<String> userNames = new ArrayList<>();
content.forEach(e -> {
userNames.clear();
List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(","));
for (String userId : userIds1) {
userNames.add(userModelMap.get(userId));
}
userNames.remove(null);
if (userNames != null && userNames.size() > 0) {
e.put("executiveName", Joiner.on(",").join(userNames));
} else {
e.put("executiveName", " ");
}
/*e.put("beginTime",new Date().getTime());
e.put("endTime",new Date().getTime());*/
});
return new PageImpl<>(content, pageParam, total);
}
return null;
return new PageImpl<>(content, pageParam, total);
}
@Override
......
......@@ -9,6 +9,7 @@ import com.yeejoin.amos.maintenance.business.entity.mybatis.CheckChkExListBo;
import com.yeejoin.amos.maintenance.business.vo.CodeOrderVo;
import com.yeejoin.amos.maintenance.business.vo.LeavePlanTaskVo;
import com.yeejoin.amos.maintenance.business.vo.PlanTaskVo;
import com.yeejoin.amos.maintenance.core.common.request.CommonPageable;
import org.springframework.data.domain.Page;
import com.yeejoin.amos.maintenance.business.param.CheckPtListPageParam;
......@@ -76,9 +77,10 @@ public interface IPlanTaskService {
/**
* 天剑查询假话任务信息
* @param params
* @param page
* @return
*/
Page<HashMap<String, Object>> getPlanTasks(String toke,String product,String appKey,HashMap<String, Object> params);
Page<HashMap<String, Object>> getPlanTasks(HashMap<String, Object> params, CommonPageable page);
/**
* 根据计划任务Id获取计划任务信息
......
......@@ -59,7 +59,7 @@ public class PlanTaskPageParamUtil {
for(int i=0;i<queryRequests.size();i++){
String name = queryRequests.get(i).getName();
String type = queryRequests.get(i).getType();
if(type!=null && type!=""){
if(type!=null && !"".equals(type)){
if (!QueryOperatorEnum.ORDER_BY.getName().equals(type)) {
params.put(name, queryRequests.get(i).getValue());
} else if (QueryOperatorEnum.ORDER_BY.getName().equals(type)) {
......
......@@ -6,9 +6,23 @@
//import java.lang.annotation.RetentionPolicy;
//import java.lang.annotation.Target;
//
///**
// * @author DELL
// */
//@Target(ElementType.METHOD)
//@Retention(RetentionPolicy.RUNTIME)
//@Documented
//public @interface Permission {
// /**
// * value
// * @return
// */
// String value() default "";
//
// /**
// * 是否进行人员校验
// * @return
// */
// boolean isPersonIdentity() default false;
//}
//
//package com.yeejoin.amos.maintenance.core.framework;
//
//
//import java.util.List;
//import java.util.Map;
//
//import javax.servlet.http.HttpServletRequest;
//
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Before;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.stereotype.Component;
//import org.springframework.util.ObjectUtils;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//import org.typroject.tyboot.core.foundation.context.RequestContext;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
......@@ -37,140 +17,157 @@
//import com.yeejoin.amos.feign.privilege.model.RoleModel;
//import com.yeejoin.amos.maintenance.exception.PermissionException;
//import com.yeejoin.amos.maintenance.feign.RemoteSecurityService;
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Before;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.stereotype.Component;
//import org.springframework.util.ObjectUtils;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//import org.typroject.tyboot.core.foundation.context.RequestContext;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.List;
//import java.util.Map;
//
//@Aspect
//@Component
//@ResponseBody
//public class PermissionAspect {
// private static final Logger logger = LoggerFactory.getLogger(PermissionAspect.class);
//
// @Autowired
// private RedisTemplate<String, String> redisTemplate;
//
// @Autowired
// private RemoteSecurityService remoteSecurityService;
//
// // 前置通知,在方法执行之前
// @Before(value = "@annotation(com.yeejoin.amos.maintenance.core.framework.Permission)")
// public void PermissionCheck(JoinPoint joinPoint) throws PermissionException {
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder
// .getRequestAttributes()).getRequest();
//
// logger.info("======开始权限校验======");
// // 用户token
// String token = request.getHeader("token");
// token = ObjectUtils.isEmpty(token) ? request.getHeader("X-Access-Token") : token;
// String product = request.getHeader("product");
// String appKey = request.getHeader("appKey");
// logger.info("用户token:" + token);
// RequestContext.setToken(token);
// RequestContext.setProduct(product);
// RequestContext.setAppKey(appKey);
// if (!TokenOperation.refresh(token)) {
// throw new PermissionException("登录信息失效,请重新登录");
// }
//
// if (joinPoint.getSignature().getName().equals("saveCurCompany")) {
// return;
// }
// FeignClientResult feignClientResult;
// AgencyUserModel userModel=null;
// try {
// feignClientResult = Privilege.agencyUserClient.getme();
// userModel = (AgencyUserModel) feignClientResult.getResult();
//
// } catch (InnerInvokException e) {
// e.printStackTrace();
// }
// String userId = null;
// ReginParams regionParam = new ReginParams();
// if(userModel != null){
// userId = userModel.getUserId();
// Map<Long, List<RoleModel>> orgRoles = userModel.getOrgRoles();
// List<RoleModel> roleModels = null;
// if(!ObjectUtils.isEmpty(orgRoles)) {
// for (Map.Entry<Long, List<RoleModel>> entry : orgRoles.entrySet()) {
// roleModels = entry.getValue();
// break;
// }
// }
// ReginParams reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userModel.getUserId(), token)), ReginParams.class);
// if(reginParams == null && userModel.getCompanys().size() > 0){
// CompanyModel companyModel = userModel.getCompanys().get(0);
//
// List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(token, product, appKey, companyModel.getSequenceNbr().toString());
// if(deptList.size() > 0){
// CompanyBo companyBo = convertCompanyModelToBo(companyModel);
// DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
// regionParam.setCompany(companyBo);
// regionParam.setDepartment(departmentBo);
// if(!ObjectUtils.isEmpty(roleModels)){
// regionParam.setRole(convertRoleModelToBo(roleModels.get(0)));
// }
// }else{
// if(!ObjectUtils.isEmpty(userModel.getOrgRoles()) && !ObjectUtils.isEmpty(companyModel) && userModel.getOrgRoles().get(companyModel.getSequenceNbr()).size() > 0){
// RoleModel role = userModel.getOrgRoles().get(companyModel.getSequenceNbr()).get(0);
// RoleBo roleBo = new RoleBo();
// BeanUtils.copyProperties(role, roleBo);
// regionParam.setRole(roleBo);
// }
// }
// redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(regionParam));
// }
// }
// }
//
//
// private DepartmentBo convertDepartmentModelToBo(DepartmentModel departmentModel){
// DepartmentBo departmentBo = new DepartmentBo();
// if(departmentModel != null) {
// departmentBo.setCompanySeq(departmentModel.getCompanySeq());
// departmentBo.setDepartmentDesc(departmentModel.getDepartmentDesc());
// departmentBo.setDepartmentName(departmentModel.getDepartmentName());
// departmentBo.setLevel(departmentModel.getLevel());
// departmentBo.setOrgCode(departmentModel.getOrgCode());
// departmentBo.setParentId(departmentModel.getParentId());
// departmentBo.setDeptOrgCode(departmentModel.getDeptOrgCode());
// departmentBo.setSequenceNbr(departmentModel.getSequenceNbr());
// }
// return departmentBo;
// }
//
// /**
// * Model 转 Bo
// */
// private CompanyBo convertCompanyModelToBo(CompanyModel companyModel){
//
// CompanyBo companyBo = new CompanyBo();
// if(companyModel != null) {
// companyBo.setAddress(companyModel.getAddress());
// companyBo.setCompanyName(companyModel.getCompanyName());
// companyBo.setCompanyOrgCode(Integer.parseInt(companyModel.getCompanyOrgCode().toString()));
// companyBo.setEmail(companyModel.getEmail());
// companyBo.setLandlinePhone(companyModel.getLandlinePhone());
// companyBo.setLongitude(companyModel.getLongitude());
// companyBo.setLatitude(companyModel.getLatitude());
// companyBo.setLevel(companyModel.getLevel());
// companyBo.setOrgCode(companyModel.getOrgCode());
// companyBo.setSequenceNbr(companyModel.getSequenceNbr());
// companyBo.setParentId(companyModel.getParentId());
// }
// return companyBo;
// }
//
// private RoleBo convertRoleModelToBo(RoleModel roleModel) {
// RoleBo roleBo = new RoleBo();
// if(roleModel != null){
// roleBo.setRoleName(roleModel.getRoleName());
// roleBo.setRoleType(roleModel.getRoleType());
// roleBo.setSequenceNbr(roleModel.getSequenceNbr());
// }
// return roleBo;
// }
//
// //redi缓存选择的用户信息
// private String buildKey(String userId, String token) {
// return "region_" + userId + "_" + token;
//
// }
// private static final Logger logger = LoggerFactory.getLogger(PermissionAspect.class);
//
// @Autowired
// private RedisTemplate<String, String> redisTemplate;
//
// @Autowired
// private RemoteSecurityService remoteSecurityService;
//
// @Before(value = "@annotation(Permission) && @annotation(permission)")
// public void PermissionCheck(JoinPoint joinPoint, Permission permission) throws PermissionException {
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
// logger.info("======开始权限校验======");
// String token = request.getHeader("token");
// token = ObjectUtils.isEmpty(token) ? request.getHeader("X-Access-Token") : token;
// String product = request.getHeader("product");
// String appKey = request.getHeader("appKey");
// RequestContext.setToken(token);
// RequestContext.setProduct(product);
// RequestContext.setAppKey(appKey);
// if (!TokenOperation.refresh(token)) {
// throw new PermissionException("登录信息失效,请重新登录");
// }
// FeignClientResult feignClientResult;
// AgencyUserModel userModel = null;
// try {
// feignClientResult = Privilege.agencyUserClient.getme();
// userModel = (AgencyUserModel) feignClientResult.getResult();
// } catch (InnerInvokException e) {
// throw new PermissionException("用户信息校验失败");
// }
// if (userModel == null) {
// throw new PermissionException("用户信息校验失败");
// }
// String name = "";
// String companyId = "";
// String type = "";
// if (permission.isPersonIdentity()) {
// //调用jcs,进行人员身份判断,是维保公司人员还是业主单位人员
// JSONObject result = new JSONObject();
// name = result.get("name").toString();
// companyId = result.get("companyId").toString();
// type = result.get("type").toString();
// }
// ReginParams regionParam = new ReginParams();
// String userId = userModel.getUserId();
// Map<Long, List<RoleModel>> orgRoles = userModel.getOrgRoles();
// ReginParams reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userModel.getUserId(), token)), ReginParams.class);
// if (reginParams == null && userModel.getCompanys().size() > 0) {
// CompanyModel companyModel = userModel.getCompanys().get(0);
// List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(token, product, appKey, companyModel.getSequenceNbr().toString());
// regionParam.setPersonIdentity(new ReginParams.PersonIdentity(type, name, companyId));
// if (deptList.size() > 0) {
// CompanyBo companyBo = convertCompanyModelToBo(companyModel);
// DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
// regionParam.setCompany(companyBo);
// regionParam.setDepartment(departmentBo);
// if (!ObjectUtils.isEmpty(orgRoles) && !orgRoles.get(departmentBo.getSequenceNbr()).isEmpty()) {
// regionParam.setRole(convertRoleModelToBo(orgRoles.get(departmentBo.getSequenceNbr()).get(0)));
// }
// } else {
// if (!ObjectUtils.isEmpty(userModel.getOrgRoles()) && !ObjectUtils.isEmpty(companyModel) && userModel.getOrgRoles().get(companyModel.getSequenceNbr()).size() > 0) {
// RoleModel role = userModel.getOrgRoles().get(companyModel.getSequenceNbr()).get(0);
// RoleBo roleBo = new RoleBo();
// BeanUtils.copyProperties(role, roleBo);
// regionParam.setRole(roleBo);
// }
// }
// redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(regionParam));
// }
// }
//
//
// private DepartmentBo convertDepartmentModelToBo(DepartmentModel departmentModel) {
// DepartmentBo departmentBo = new DepartmentBo();
// if (departmentModel != null) {
// departmentBo.setCompanySeq(departmentModel.getCompanySeq());
// departmentBo.setDepartmentDesc(departmentModel.getDepartmentDesc());
// departmentBo.setDepartmentName(departmentModel.getDepartmentName());
// departmentBo.setLevel(departmentModel.getLevel());
// departmentBo.setOrgCode(departmentModel.getOrgCode());
// departmentBo.setParentId(departmentModel.getParentId());
// departmentBo.setDeptOrgCode(departmentModel.getDeptOrgCode());
// departmentBo.setSequenceNbr(departmentModel.getSequenceNbr());
// }
// return departmentBo;
// }
//
// /**
// * Model 转 Bo
// */
// private CompanyBo convertCompanyModelToBo(CompanyModel companyModel) {
//
// CompanyBo companyBo = new CompanyBo();
// if (companyModel != null) {
// companyBo.setAddress(companyModel.getAddress());
// companyBo.setCompanyName(companyModel.getCompanyName());
// companyBo.setCompanyOrgCode(companyModel.getCompanyOrgCode());
// companyBo.setEmail(companyModel.getEmail());
// companyBo.setLandlinePhone(companyModel.getLandlinePhone());
// companyBo.setLongitude(companyModel.getLongitude());
// companyBo.setLatitude(companyModel.getLatitude());
// companyBo.setLevel(companyModel.getLevel());
// companyBo.setOrgCode(companyModel.getOrgCode());
// companyBo.setSequenceNbr(companyModel.getSequenceNbr());
// companyBo.setParentId(companyModel.getParentId());
// }
// return companyBo;
// }
//
// private RoleBo convertRoleModelToBo(RoleModel roleModel) {
// RoleBo roleBo = new RoleBo();
// if (roleModel != null) {
// roleBo.setRoleName(roleModel.getRoleName());
// roleBo.setRoleType(roleModel.getRoleType());
// roleBo.setSequenceNbr(roleModel.getSequenceNbr());
// }
// return roleBo;
// }
//
// /**
// * redis缓存选择的用户信息
// *
// * @param userId userId
// * @param token token
// * @return String
// */
// private String buildKey(String userId, String token) {
// return "region_" + userId + "_" + token;
//
// }
//}
......@@ -38,3 +38,10 @@ spring.data.mongodb.uri=mongodb://172.16.3.41:27017/command_db
file.url=http://39.98.45.134:9000/
video.url=https://11.11.16.4:443/
params.work.flow.normalProcessDefinitionKey=normalHazardManagement
params.work.flow.processDefinitionKey=hazardManagement
params.work.flow.address=http://172.16.3.4:30040
#params.work.flow.address=http://172.16.10.80:30040
params.spc.address=http://172.16.3.89:9001
failure.work.flow.processDefinitionKey=malfunction_repair
\ No newline at end of file
......@@ -179,14 +179,13 @@
a.beginTime,
a.endTime,
a.checkDate,
a.finshNum,
a.finishNum,
a.taskPlanNum,
a.finishStatus,
a.batchNo,
a.userId executiveName,
a.userName,
a.userDept
<!-- (SELECT GROUP_CONCAT(`name`) FROM s_user where find_in_set(id,a.userId)>0 ORDER BY `id`) AS executiveName -->
FROM
(
SELECT
......@@ -213,7 +212,6 @@
pt.id batchNo,
pt.route_id,
pt.point_num taskPlanNum,
pt.finish_num finshNum,
pt.user_name userName,
pt.user_dept userDept
FROM
......@@ -222,20 +220,10 @@
) a
<where>
<if test="userId != null and userId > 0 "> and find_in_set(#{userId},a.userId)>0</if>
<if test="routeId != null and userId > 0 "> and a.route_id = #{routeId} </if>
<if test="checkDate != null and checkDate != '' "> and a.beginTime <![CDATA[<=]]> #{checkDate} and a.endTime <![CDATA[>=]]> #{checkDate} </if>
<if test="finishStatus != null"> and a.finishStatus = #{finishStatus}</if>
<if test="orgCode != null and orgCode !=''" >
and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} )
</if>
<choose>
<when test="departmentId != null and departmentId != 0 ">and a.userDept like concat('%', #{departmentId}, '%')</when>
<!-- <when test="departmentId == -1 and ids != null">and a.userId in-->
<!-- <foreach item="item" collection="ids" separator="," open="(" close=")" index="index">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </when>-->
</choose>
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
AND (
......@@ -256,36 +244,6 @@
AND a.endTime <![CDATA[>=]]> #{endTime}
)
)
</if>
<if test="query != null and query != '' ">
<if test="queryType != null and queryType != 'executiveName' and queryType != 'plan' ">
AND EXISTS (
SELECT
1
FROM
p_point pp
LEFT JOIN p_route_point rp ON rp.point_id = pp.id
LEFT JOIN p_route r ON r.id = rp.route_id
where a.route_id = r.id
<if test="queryType == null or queryType == '' or queryType == 'all' ">
AND CONCAT(pp.name, ',',r.name, ',', pp.point_no,a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'route' ">
AND r.name LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'point' ">
AND CONCAT(pp.name, ',', pp.point_no) LIKE concat('%', #{query}, '%')
</if>
)
</if>
<if test="queryType != null and queryType == 'executiveName' ">
AND a.userName LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'plan' ">
AND CONCAT(a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
</if>
</where>
<if test="orderBy != null and orderBy != '' "> order by ${orderBy} </if>
......@@ -299,50 +257,17 @@
FROM
(
SELECT
pt.id planTaskId,
pt.org_code OrgCode,
p. NAME taskName,
pt. STATUS,
pt.user_id userId,
date_format(
pt.begin_time,
'%Y-%m-%d %H:%i:%s'
) beginTime,
date_format(
pt.end_time,
'%Y-%m-%d %H:%i:%s'
) endTime,
date_format( pt.check_date, '%Y-%m-%d %H:%i:%s' ) checkDate,
pt.finish_num finishNum,
pt.finish_status finishStatus,
pt.id batchNo,
pt.route_id,
pt.point_num taskPlanNum,
pt.finish_num finshNum,
pt.user_name userName,
pt.user_dept userDept
pt.id
FROM
p_plan_task pt
INNER JOIN p_plan p ON pt.plan_id = p.id
) a
<where>
<if test="userId != null and userId > 0 "> and find_in_set(#{userId},a.userId)>0 </if>
<if test="routeId != null and userId > 0 "> and a.route_id = #{routeId} </if>
<if test="checkDate != null and checkDate != '' "> and a.beginTime <![CDATA[<=]]> #{checkDate} and a.endTime <![CDATA[>=]]> #{checkDate} </if>
<if test="finishStatus != null"> and a.finishStatus = #{finishStatus}</if>
<if test="orgCode != null and orgCode !=''" >
and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} )
</if>
<choose>
<when test="departmentId != null and departmentId!= 0 ">and a.userDept like concat('%', #{departmentId}, '%') </when>
<!-- <when test="departmentId == -1 and ids != null">and a.userId in-->
<!-- <foreach item="item" collection="ids" separator="," open="(" close=")" index="index">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </when>-->
</choose>
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
AND (
(
......@@ -362,43 +287,9 @@
AND a.endTime <![CDATA[>=]]> #{endTime}
)
)
</if>
<if test="query != null and query != '' ">
<if test="queryType != null and queryType != 'executiveName' and queryType != 'plan' ">
AND EXISTS (
SELECT
1
FROM
p_point pp
LEFT JOIN p_route_point rp ON rp.point_id = pp.id
LEFT JOIN p_route r ON r.id = rp.route_id
where a.route_id = r.id
<if test="queryType == null or queryType == '' or queryType == 'all' ">
AND CONCAT(pp.name, ',',r.name, ',', pp.point_no,a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'route' ">
AND r.name LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'point' ">
AND CONCAT(pp.name, ',', pp.point_no) LIKE concat('%', #{query}, '%')
</if>
)
</if>
<if test="queryType != null and queryType == 'executiveName' ">
AND a.userName LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'plan' ">
AND CONCAT(a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
</if>
</where>
</select>
<select id="queryPlanTaskById" resultType="Map">
SELECT
a.planTaskId,
......
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