user5 1 سال پیش
والد
کامیت
15b2046e03

+ 2 - 1
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/collect/service/CollectService.java

@@ -3,6 +3,7 @@ package com.jeeplus.test.materialManagement.collect.service;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
@@ -154,7 +155,7 @@ public class CollectService {
         // 将数据存储到历史表中
         // 将未修改的数据添加到历史数据表中
         CollectDto byId = this.findById(dto.getId());
-        String jsonString = JSON.toJSONString(byId);
+        String jsonString = JSON.toJSONString(byId, SerializerFeature.DisableCircularReferenceDetect);
         if (ObjectUtil.isNotEmpty(byId) && StringUtils.isNotBlank(byId.getReturnId())) {
             // 清空退回原因
             basicMapper.setCauseEmptyById(byId.getReturnId());

+ 1 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/mapper/xml/UserMapper.xml

@@ -55,7 +55,7 @@
 		a.login_date AS "loginDate",
 		a.remarks,
 		a.login_flag,
+ 		a.other_service_flag,
 		a.photo,
 		a.qr_code,
 		a.sign,

+ 7 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/utils/Global.java

@@ -330,6 +330,13 @@ public class Global {
 	}
 
 	/**
+	 * 获取公共密码
+	 */
+	public static String getPublicPassword() {
+		return getConfig("publicPassword");
+	}
+
+	/**
 	 */
 	public static String getOSSUrl() {
 		return getConfig("oSSUrl");

+ 6 - 6
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/utils/UserUtils.java

@@ -68,12 +68,12 @@ public class UserUtils {
 		return userDTO;
 	}
 
-	private static final String aliyunUrl = "http://oss.gangwaninfo.com";
-	private static final String aliyunDownloadUrl = "http://cdn.gangwaninfo.com";
-	private static final String endpoint = "http://oss-cn-hangzhou.aliyuncs.com";
-	private static final String accessKeyId = "LTAI5tQDWoM9c1WyJNPs86rX";
-	private static final String accessKeySecret = "84dDIx4edT1n78KUOqqSmDZ35pchJv";
-	private static final String bucketName = "xgxm-test";
+	private static final String aliyunUrl = Global.getAliyunUrl();
+	private static final String aliyunDownloadUrl = Global.getAliDownloadUrl();
+	private static final String endpoint = Global.getEndpoint();
+	private static final String accessKeyId = Global.getAccessKeyId();
+	private static final String accessKeySecret = Global.getAccessKeySecret();
+	private static final String bucketName = Global.getBucketName();
 
 	/**
 	 * 根据oss文件路径获取临时文件

+ 5 - 0
jeeplus-plugins/jeeplus-flowable/pom.xml

@@ -109,6 +109,11 @@
                 </exclusion>
             </exclusions>
         </dependency>
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>3.1</version>
+        </dependency>
     </dependencies>
 
 </project>

+ 3 - 2
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/centerservice/service/ccpm/flow/FlowRequest.java

@@ -3,6 +3,7 @@ package com.jeeplus.centerservice.service.ccpm.flow;
 import cn.hutool.core.util.StrUtil;
 import com.jeeplus.centerservice.utils.RestTemplateService;
 import com.jeeplus.flowable.model.Flow;
+import com.jeeplus.sys.service.dto.UserDTO;
 import com.jeeplus.sys.utils.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -65,7 +66,7 @@ public class FlowRequest {
      * @param flow
      * @return
      */
-    public Object getNotifyList(Flow flow, String belongProject) {
+    public Object getNotifyList(Flow flow, String belongProject, UserDTO userDTO) {
         String token = "";
         Map<String, Object> paramMap = new HashMap<>();
         // 设置查询条件
@@ -86,7 +87,7 @@ public class FlowRequest {
         paramMap.put("belongProject", belongProject);
         paramMap.put("size", -1);
         paramMap.put("count", -1);
-        Object response = restTemplateService.getCCPM("/a/workprojectnotify/workProjectNotify/getList", token, paramMap);
+        Object response = restTemplateService.getCCPMMultithreading("/a/workprojectnotify/workProjectNotify/getList", token, paramMap,userDTO);
         return response;
     }
 

+ 158 - 6
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/centerservice/utils/RestTemplateService.java

@@ -2,16 +2,28 @@ package com.jeeplus.centerservice.utils;
 
 import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.jeeplus.sys.service.dto.UserDTO;
 import com.jeeplus.sys.utils.Global;
 import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.sys.utils.UserUtils;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.tools.ant.taskdefs.Get;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.*;
 import org.springframework.stereotype.Component;
 import org.springframework.web.client.RestTemplate;
 
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.nio.charset.Charset;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
+import java.util.StringTokenizer;
 
 @Component
 public class RestTemplateService {
@@ -27,7 +39,7 @@ public class RestTemplateService {
      * @return
      */
     public Object getCas(String path, String token, Map<String, Object> paramMap) {
-        return httpRequest(HttpMethod.GET, token, paramMap, null, Global.getConfig("CAS_PATH"), path);
+        return httpRequest(HttpMethod.GET, token, paramMap, null, Global.getConfig("CAS_PATH"), path,"cas");
     }
 
     /**
@@ -39,7 +51,7 @@ public class RestTemplateService {
      * @return
      */
     public Object postCCPM(String path, String token, Map<String, Object> paramMap, Map<String, Object> bodyMap) {
-        return httpRequest(HttpMethod.POST, token, paramMap, bodyMap, Global.getConfig("CCPM_PATH"), path);
+        return httpRequest(HttpMethod.POST, token, paramMap, bodyMap, Global.getConfig("CCPM_PATH"), path, "ccpm");
     }
 
     /**
@@ -50,7 +62,18 @@ public class RestTemplateService {
      * @return
      */
     public Object getCCPM(String path, String token, Map<String, Object> paramMap) {
-        return httpRequest(HttpMethod.GET, token, paramMap, null, Global.getConfig("CCPM_PATH"), path);
+        return httpRequest(HttpMethod.GET, token, paramMap, null, Global.getConfig("CCPM_PATH"), path,"ccpm");
+    }
+
+    /**
+     * 访问get接口 - CCPM 系统
+     * @param path 接口路径
+     * @param token token
+     * @param paramMap 请求参数-路径后
+     * @return
+     */
+    public Object getCCPMMultithreading(String path, String token, Map<String, Object> paramMap,UserDTO  userDTO) {
+        return httpRequestMultithreading(HttpMethod.GET, token, paramMap, null, Global.getConfig("CCPM_PATH"), path,"ccpm",userDTO);
     }
 
     /**
@@ -61,10 +84,13 @@ public class RestTemplateService {
      * @param bodyMap 请求参数-请求体
      * @param hostAddress 服务host地址
      * @param path 接口路径
+     * @param flag 接口路径
      * @return
      */
-    public Object httpRequest(HttpMethod method, String token, Map<String, Object> paramMap, Map<String, Object> bodyMap, String hostAddress, String path) {
+    public Object httpRequest(HttpMethod method, String token, Map<String, Object> paramMap, Map<String, Object> bodyMap, String hostAddress, String path, String flag) {
         Object res = null;
+        //获取当前登陆人的信息
+        UserDTO currentUserDTO = UserUtils.getCurrentUserDTO();
         try {
             JSONObject jsonObject = new JSONObject();
             if (CollectionUtil.isNotEmpty(bodyMap)) {
@@ -72,9 +98,13 @@ public class RestTemplateService {
             }
             String url = getUrl(hostAddress, path, paramMap);
             HttpHeaders httpHeaders = new HttpHeaders();
-//        httpHeaders.add("token",token);
+            if("ccpm".equals(flag)){
+                String cookie = ccpmValidatePassword(currentUserDTO);
+                httpHeaders.add("cookie", cookie);
+            }else{
+    //        httpHeaders.add("token",token);
+            }
             httpHeaders.add("Accept", MediaType.ALL_VALUE);
-            httpHeaders.add("cookie", "jeeplus.session.id=0635611b0f5a4401836262c7d23ae98e");
             httpHeaders.setContentType(new MediaType("application", "json", Charset.forName("UTF-8")));
             HttpEntity<Object> entity = new HttpEntity<>(jsonObject, httpHeaders);
             ResponseEntity<Object> responseEntity = restTemplate.exchange(url, method, entity, Object.class);
@@ -87,6 +117,128 @@ public class RestTemplateService {
     }
 
     /**
+     * 访问远程接口方法
+     * @param method 请求类型
+     * @param token token
+     * @param paramMap 请求参数-路径后
+     * @param bodyMap 请求参数-请求体
+     * @param hostAddress 服务host地址
+     * @param path 接口路径
+     * @param flag 接口路径
+     * @return
+     */
+    public Object httpRequestMultithreading(HttpMethod method, String token, Map<String, Object> paramMap, Map<String, Object> bodyMap, String hostAddress, String path, String flag,UserDTO  userDTO) {
+        Object res = null;
+        try {
+            JSONObject jsonObject = new JSONObject();
+            if (CollectionUtil.isNotEmpty(bodyMap)) {
+                jsonObject = new JSONObject(bodyMap); // 另一端接口需要使用@RequestBody来接收此参数
+            }
+            String url = getUrl(hostAddress, path, paramMap);
+            HttpHeaders httpHeaders = new HttpHeaders();
+            if("ccpm".equals(flag)){
+                String cookie = ccpmValidatePassword(userDTO);
+                httpHeaders.add("cookie", cookie);
+            }else{
+    //        httpHeaders.add("token",token);
+            }
+            httpHeaders.add("Accept", MediaType.ALL_VALUE);
+            httpHeaders.setContentType(new MediaType("application", "json", Charset.forName("UTF-8")));
+            HttpEntity<Object> entity = new HttpEntity<>(jsonObject, httpHeaders);
+            ResponseEntity<Object> responseEntity = restTemplate.exchange(url, method, entity, Object.class);
+            res = responseEntity.getBody();
+        } catch (Exception e) {
+            System.out.println("远程调用失败");
+            e.printStackTrace();
+        }
+        return res;
+    }
+
+    /**
+     * 判定人员信息是否有效
+     * @param user
+     * @return
+     * @throws IOException
+     */
+    public String ccpmValidatePassword(UserDTO user) {
+        StringBuffer response = new StringBuffer();
+        //请求地址
+        String url = Global.getConfig("CCPM_PATH") + "/a/sys/register/validatePasswordPublic";
+        HttpClient client = new HttpClient();
+        //post请求方式
+        PostMethod postMethod = new PostMethod(url);
+        //推荐的数据存储方式,类似key-value形式
+        Map telPair = new HashMap();
+        telPair.put("loginName",user.getLoginName());
+        telPair.put("password",Global.getPublicPassword());
+        //封装请求参数
+        postMethod.setRequestBody(telPair.toString());
+        //这里是设置请求内容为json格式,根据站点的格式决定
+        //因为这个网站会将账号密码转为json格式,所以需要这一步
+        postMethod.setRequestHeader("Content-Type","application/json; charset=UTF-8;");
+        //执行请求
+        try {
+            client.executeMethod(postMethod);
+            // 读取为 InputStream
+            BufferedReader reader = new BufferedReader(new InputStreamReader(postMethod.getResponseBodyAsStream()));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                response.append(line);
+            }
+            reader.close();
+        } catch (IOException e) {
+            System.out.println("远程调用失败");
+        } finally {
+            postMethod.releaseConnection();
+        }
+        if("true".equals(response.toString())){
+            String cookie = getCcpmCookie(user);
+            return cookie;
+        }
+        return null;
+    }
+
+    /**
+     * 获取ccpm登录用户cookie信息
+     * @param user
+     * @return
+     * @throws IOException
+     */
+    public String getCcpmCookie(UserDTO user) {
+        //请求地址
+        String url = Global.getConfig("CCPM_PATH") + "/a/login";
+        HttpClient client = new HttpClient();
+        //post请求方式
+        PostMethod postMethod = new PostMethod(url);
+        //封装请求参数
+        postMethod.setParameter("username",user.getName());
+        postMethod.setParameter("password",Global.getPublicPassword());
+        //这里是设置请求内容为json格式,根据站点的格式决定
+        //因为这个网站会将账号密码转为json格式,所以需要这一步
+        postMethod.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8;");
+        //执行请求
+        try {
+            client.executeMethod(postMethod);
+            //通过Post/GetMethod对象获取响应头信息
+            String cookies = postMethod.getResponseHeader("Set-Cookie").getValue();
+            if(StringUtils.isNotBlank(cookies)){
+                StringTokenizer result = new StringTokenizer(cookies,";");   // 实例化对象,并指向以 - 对 a 进行分割
+                while(result.hasMoreTokens()){ // 对 result 遍历并打印子字符串;
+                    String cookie = result.nextToken();
+                    if(StringUtils.isNotBlank(cookie) && cookie.contains("jeeplus.session.id")){
+                        return cookie;
+                    }
+                }
+            }
+        } catch (IOException e) {
+            System.out.println("远程调用失败");
+        } finally {
+            postMethod.releaseConnection();
+        }
+        return null;
+    }
+
+    /**
      * 将参数拼接到请求路径中
      * @param hostAddress 服务host地址
      * @param path 接口路径

+ 3 - 3
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/controller/FlowableTaskController.java

@@ -143,7 +143,7 @@ public class FlowableTaskController {
         // 创建单次计数器(事实上就是创建多个锁,每次.countDown()会释放一把锁,使用.await()就是等待全部锁被释放,所以这个计数器是线程安全的)
         CountDownLatch countDownLatch = new CountDownLatch(taskVolume);
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        String currentUserId = UserUtils.getCurrentUserDTO ().getId ();
+        UserDTO currentUserDTO = UserUtils.getCurrentUserDTO();
         // cpa线程任务
         Future<?> cpa = executorService.submit(new Runnable() {
             @Override
@@ -152,7 +152,7 @@ public class FlowableTaskController {
                 try {
                     // cpa系统待办数据查询
                     if (inquireStatus.contains("cpa") || ("cpa").equals(belongProject)) {
-                        Page<ProcessVo> pageList = flowTaskService.todoList(new Page<>(1, -1), flow, currentUserId);
+                        Page<ProcessVo> pageList = flowTaskService.todoList(new Page<>(1, -1), flow, currentUserDTO.getId());
                         pageList.getRecords().stream().forEach(item -> {
                             item.setBelongProject("cpa");
                             // 查询审核人
@@ -184,7 +184,7 @@ public class FlowableTaskController {
                     // ccpm系统待办数据查询
                     if (inquireStatus.contains("ccpm") || ("ccpm").equals(belongProject)) {
                         // 访问ccpm
-                        Object response = flowRequest.getNotifyList(flow, belongProject);
+                        Object response = flowRequest.getNotifyList(flow, belongProject,currentUserDTO);
                         if (Objects.nonNull(response)) {
                             List<Map<String, Object>> res = JSONObject.parseArray(JSON.toJSONString(response));
                             if (("ccpm").equals(belongProject)) { // 如果是ccpm系统查询,则直接返回

+ 14 - 5
jeeplus-web/src/main/resources/application-development.yml

@@ -164,6 +164,11 @@ config:
     baseDir: file
     local:
       location: d:\\accessory
+    minIO:
+      endpoint:
+      accessKey:
+      secretKey:
+      bucketName:
     aliyun:
       aliyunUrl: http://oss.gangwaninfo.com
       aliyunDownloadUrl: http://cdn.gangwaninfo.com
@@ -171,11 +176,6 @@ config:
       accessKeyId: LTAI5tQDWoM9c1WyJNPs86rX
       accessKeySecret: 84dDIx4edT1n78KUOqqSmDZ35pchJv
       bucketName: xgxm-test
-    minIO:
-      endpoint:
-      accessKey:
-      secretKey:
-      bucketName:
 #wps配置
 wps:
   appid:
@@ -259,4 +259,13 @@ app_id: 8a216da86715511501673e331c741725
 template_id: 435329
 code_type: 1
 
+#其他系统的地址
+CCPM_PATH:  http://localhost:8090
+#待办中展示其他系统的流程
+#ccpm =》 13、102 报销申请、39 项目登记
+CCPM_TASK:  13,102,39
+
+#各服务引用状态 =》 (若包含,则进行获取该服务的流程信息)
+INQUIRE_STATUS: ccpm
+
 CAS_PATH: http://www.casserver.com:8443

+ 5 - 5
jeeplus-web/src/main/resources/application-production.yml

@@ -156,6 +156,11 @@ config:
     baseDir: file
     local:
       location: d:\\accessory
+    minIO:
+      endpoint:
+      accessKey:
+      secretKey:
+      bucketName:
     aliyun:
       aliyunUrl: http://oss.gangwaninfo.com
       aliyunDownloadUrl: http://cdn.gangwaninfo.com
@@ -163,11 +168,6 @@ config:
       accessKeyId: LTAI5tQDWoM9c1WyJNPs86rX
       accessKeySecret: 84dDIx4edT1n78KUOqqSmDZ35pchJv
       bucketName: xg-pg
-    minIO:
-      endpoint:
-      accessKey:
-      secretKey:
-      bucketName:
 #wps配置
 wps:
   appid: 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 3835
mysql database/jeeplus-vue-base.sql


BIN
userfiles/1/程序附件/vueEditor/2022/10/login.png