Browse Source

优化代码

matianxiang 2 weeks ago
parent
commit
7e6002b79e

+ 2 - 2
eitc-admin/src/main/java/com/eitc/common/aspect/DataFilterAspect.java

@@ -39,7 +39,7 @@ public class DataFilterAspect {
39
     @Before("dataFilterCut()")
39
     @Before("dataFilterCut()")
40
     public void dataFilter(JoinPoint point) {
40
     public void dataFilter(JoinPoint point) {
41
         Object params = point.getArgs()[0];
41
         Object params = point.getArgs()[0];
42
-        if(params != null && params instanceof Map){
42
+        if(params instanceof Map){
43
             UserDetail user = SecurityUser.getUser();
43
             UserDetail user = SecurityUser.getUser();
44
 
44
 
45
             //如果是超级管理员或超级租户,则不进行数据过滤
45
             //如果是超级管理员或超级租户,则不进行数据过滤
@@ -53,7 +53,7 @@ public class DataFilterAspect {
53
                 Map map = (Map)params;
53
                 Map map = (Map)params;
54
                 String sqlFilter = getSqlFilter(user, point);
54
                 String sqlFilter = getSqlFilter(user, point);
55
                 map.put(Constant.SQL_FILTER, new DataScope(sqlFilter));
55
                 map.put(Constant.SQL_FILTER, new DataScope(sqlFilter));
56
-            }catch (Exception e){
56
+            }catch (Exception ignored){
57
 
57
 
58
             }
58
             }
59
 
59
 

+ 6 - 6
eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActModelService.java

@@ -18,9 +18,9 @@ import org.activiti.engine.repository.ModelQuery;
18
 import org.activiti.engine.repository.ProcessDefinition;
18
 import org.activiti.engine.repository.ProcessDefinition;
19
 import org.apache.commons.io.IOUtils;
19
 import org.apache.commons.io.IOUtils;
20
 import org.apache.commons.lang3.StringUtils;
20
 import org.apache.commons.lang3.StringUtils;
21
-import org.springframework.beans.factory.annotation.Autowired;
22
 import org.springframework.stereotype.Service;
21
 import org.springframework.stereotype.Service;
23
 
22
 
23
+import javax.annotation.Resource;
24
 import javax.imageio.ImageIO;
24
 import javax.imageio.ImageIO;
25
 import javax.servlet.http.HttpServletResponse;
25
 import javax.servlet.http.HttpServletResponse;
26
 import java.awt.image.BufferedImage;
26
 import java.awt.image.BufferedImage;
@@ -29,6 +29,7 @@ import java.io.IOException;
29
 import java.io.InputStream;
29
 import java.io.InputStream;
30
 import java.io.UnsupportedEncodingException;
30
 import java.io.UnsupportedEncodingException;
31
 import java.net.URLEncoder;
31
 import java.net.URLEncoder;
32
+import java.nio.charset.StandardCharsets;
32
 import java.util.List;
33
 import java.util.List;
33
 import java.util.Map;
34
 import java.util.Map;
34
 
35
 
@@ -39,9 +40,9 @@ import java.util.Map;
39
  */
40
  */
40
 @Service
41
 @Service
41
 public class ActModelService {
42
 public class ActModelService {
42
-    @Autowired
43
+    @Resource
43
     protected RepositoryService repositoryService;
44
     protected RepositoryService repositoryService;
44
-    @Autowired
45
+    @Resource
45
     private ObjectMapper objectMapper;
46
     private ObjectMapper objectMapper;
46
 
47
 
47
     public PageData<Model> page(Map<String, Object> params) {
48
     public PageData<Model> page(Map<String, Object> params) {
@@ -93,7 +94,7 @@ public class ActModelService {
93
         ObjectNode stencilset = objectMapper.createObjectNode();
94
         ObjectNode stencilset = objectMapper.createObjectNode();
94
         stencilset.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
95
         stencilset.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
95
         editorNode.set("stencilset", stencilset);
96
         editorNode.set("stencilset", stencilset);
96
-        repositoryService.addModelEditorSource(model.getId(), editorNode.toString().getBytes("utf-8"));
97
+        repositoryService.addModelEditorSource(model.getId(), editorNode.toString().getBytes(StandardCharsets.UTF_8));
97
     }
98
     }
98
 
99
 
99
     public void deploy(String id) {
100
     public void deploy(String id) {
@@ -158,13 +159,12 @@ public class ActModelService {
158
         List <String> names = repositoryService.getDeploymentResourceNames(deploymentId);
159
         List <String> names = repositoryService.getDeploymentResourceNames(deploymentId);
159
         String imageName = null;
160
         String imageName = null;
160
         for(String name: names){
161
         for(String name: names){
161
-            if(name.indexOf(".png")>=0){
162
+            if(name.contains(".png")){
162
                 imageName = name;
163
                 imageName = name;
163
                 break;
164
                 break;
164
             }
165
             }
165
         }
166
         }
166
         InputStream in = null;
167
         InputStream in = null;
167
-        InputStream in1 = null;
168
         try {
168
         try {
169
             if(StringUtils.isNotEmpty(imageName)){
169
             if(StringUtils.isNotEmpty(imageName)){
170
                 in = repositoryService.getResourceAsStream(deploymentId,imageName);
170
                 in = repositoryService.getResourceAsStream(deploymentId,imageName);

+ 44 - 45
eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActProcessService.java

@@ -1,17 +1,15 @@
1
 package com.eitc.modules.activiti.service;
1
 package com.eitc.modules.activiti.service;
2
 
2
 
3
-import com.fasterxml.jackson.databind.ObjectMapper;
4
-import com.fasterxml.jackson.databind.node.ObjectNode;
5
 import com.eitc.common.constant.Constant;
3
 import com.eitc.common.constant.Constant;
6
-import com.eitc.common.exception.ErrorCode;
7
 import com.eitc.common.exception.EitcException;
4
 import com.eitc.common.exception.EitcException;
5
+import com.eitc.common.exception.ErrorCode;
8
 import com.eitc.common.page.PageData;
6
 import com.eitc.common.page.PageData;
7
+import com.fasterxml.jackson.databind.ObjectMapper;
8
+import com.fasterxml.jackson.databind.node.ObjectNode;
9
 import org.activiti.bpmn.converter.BpmnXMLConverter;
9
 import org.activiti.bpmn.converter.BpmnXMLConverter;
10
 import org.activiti.bpmn.model.BpmnModel;
10
 import org.activiti.bpmn.model.BpmnModel;
11
 import org.activiti.editor.constants.ModelDataJsonConstants;
11
 import org.activiti.editor.constants.ModelDataJsonConstants;
12
 import org.activiti.editor.language.json.converter.BpmnJsonConverter;
12
 import org.activiti.editor.language.json.converter.BpmnJsonConverter;
13
-import org.activiti.engine.HistoryService;
14
-import org.activiti.engine.ProcessEngineConfiguration;
15
 import org.activiti.engine.RepositoryService;
13
 import org.activiti.engine.RepositoryService;
16
 import org.activiti.engine.repository.Deployment;
14
 import org.activiti.engine.repository.Deployment;
17
 import org.activiti.engine.repository.Model;
15
 import org.activiti.engine.repository.Model;
@@ -19,17 +17,17 @@ import org.activiti.engine.repository.ProcessDefinition;
19
 import org.activiti.engine.repository.ProcessDefinitionQuery;
17
 import org.activiti.engine.repository.ProcessDefinitionQuery;
20
 import org.apache.commons.io.FilenameUtils;
18
 import org.apache.commons.io.FilenameUtils;
21
 import org.apache.commons.lang3.StringUtils;
19
 import org.apache.commons.lang3.StringUtils;
22
-import org.springframework.beans.factory.annotation.Autowired;
23
 import org.springframework.stereotype.Service;
20
 import org.springframework.stereotype.Service;
24
 import org.springframework.web.multipart.MultipartFile;
21
 import org.springframework.web.multipart.MultipartFile;
25
 
22
 
23
+import javax.annotation.Resource;
26
 import javax.xml.stream.XMLInputFactory;
24
 import javax.xml.stream.XMLInputFactory;
27
 import javax.xml.stream.XMLStreamException;
25
 import javax.xml.stream.XMLStreamException;
28
 import javax.xml.stream.XMLStreamReader;
26
 import javax.xml.stream.XMLStreamReader;
29
 import java.io.IOException;
27
 import java.io.IOException;
30
 import java.io.InputStream;
28
 import java.io.InputStream;
31
 import java.io.InputStreamReader;
29
 import java.io.InputStreamReader;
32
-import java.io.UnsupportedEncodingException;
30
+import java.nio.charset.StandardCharsets;
33
 import java.util.ArrayList;
31
 import java.util.ArrayList;
34
 import java.util.HashMap;
32
 import java.util.HashMap;
35
 import java.util.List;
33
 import java.util.List;
@@ -43,42 +41,36 @@ import java.util.zip.ZipInputStream;
43
  */
41
  */
44
 @Service
42
 @Service
45
 public class ActProcessService {
43
 public class ActProcessService {
46
-    @Autowired
44
+    @Resource
47
     protected RepositoryService repositoryService;
45
     protected RepositoryService repositoryService;
48
 
46
 
49
-    @Autowired
50
-    protected HistoryService historyService;
51
-
52
-    @Autowired
53
-    protected ProcessEngineConfiguration processEngineConfiguration;
54
-
55
     /**
47
     /**
56
      * 流程列表
48
      * 流程列表
57
      */
49
      */
58
     public PageData<Map<String, Object>> page(Map<String, Object> params) {
50
     public PageData<Map<String, Object>> page(Map<String, Object> params) {
59
-        String key = (String)params.get("key");
60
-        String processName = (String)params.get("processName");
61
-        boolean isLatestVersion = params.get("isLatestVersion")== null? false : (boolean)params.get("isLatestVersion");
51
+        String key = (String) params.get("key");
52
+        String processName = (String) params.get("processName");
53
+        boolean isLatestVersion = params.get("isLatestVersion") != null && (boolean) params.get("isLatestVersion");
62
 
54
 
63
         //分页参数
55
         //分页参数
64
         int curPage = 1;
56
         int curPage = 1;
65
         int limit = 10;
57
         int limit = 10;
66
-        if(params.get(Constant.PAGE) != null){
67
-            curPage = Integer.parseInt((String)params.get(Constant.PAGE));
58
+        if (params.get(Constant.PAGE) != null) {
59
+            curPage = Integer.parseInt((String) params.get(Constant.PAGE));
68
         }
60
         }
69
-        if(params.get(Constant.LIMIT) != null){
70
-            limit = Integer.parseInt((String)params.get(Constant.LIMIT));
61
+        if (params.get(Constant.LIMIT) != null) {
62
+            limit = Integer.parseInt((String) params.get(Constant.LIMIT));
71
         }
63
         }
72
 
64
 
73
         ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
65
         ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
74
-            .orderByProcessDefinitionId().desc().orderByProcessDefinitionKey().desc();
75
-        if(isLatestVersion){
66
+                .orderByProcessDefinitionId().desc().orderByProcessDefinitionKey().desc();
67
+        if (isLatestVersion) {
76
             processDefinitionQuery.latestVersion();
68
             processDefinitionQuery.latestVersion();
77
         }
69
         }
78
-        if(StringUtils.isNotEmpty(key)){
70
+        if (StringUtils.isNotEmpty(key)) {
79
             processDefinitionQuery.processDefinitionKeyLike(key);
71
             processDefinitionQuery.processDefinitionKeyLike(key);
80
         }
72
         }
81
-        if(StringUtils.isNotEmpty(processName)){
73
+        if (StringUtils.isNotEmpty(processName)) {
82
             processDefinitionQuery.processDefinitionNameLike(processName);
74
             processDefinitionQuery.processDefinitionNameLike(processName);
83
         }
75
         }
84
 
76
 
@@ -89,7 +81,7 @@ public class ActProcessService {
89
             objectList.add(processDefinitionConvert(processDefinition));
81
             objectList.add(processDefinitionConvert(processDefinition));
90
         }
82
         }
91
 
83
 
92
-        return new PageData<>(objectList, (int)processDefinitionQuery.count());
84
+        return new PageData<>(objectList, (int) processDefinitionQuery.count());
93
     }
85
     }
94
 
86
 
95
 
87
 
@@ -116,49 +108,56 @@ public class ActProcessService {
116
 
108
 
117
     /**
109
     /**
118
      * 部署
110
      * 部署
111
+     *
119
      * @param file 文件
112
      * @param file 文件
120
      */
113
      */
121
     public void deploy(MultipartFile file) throws IOException {
114
     public void deploy(MultipartFile file) throws IOException {
122
         String fileName = file.getOriginalFilename();
115
         String fileName = file.getOriginalFilename();
123
         String extension = FilenameUtils.getExtension(fileName);
116
         String extension = FilenameUtils.getExtension(fileName);
124
-        if("zip".equalsIgnoreCase(extension) || "bar".equalsIgnoreCase(extension)) {
117
+        if ("zip".equalsIgnoreCase(extension) || "bar".equalsIgnoreCase(extension)) {
125
             ZipInputStream zip = new ZipInputStream(file.getInputStream());
118
             ZipInputStream zip = new ZipInputStream(file.getInputStream());
126
             repositoryService.createDeployment().addZipInputStream(zip).deploy();
119
             repositoryService.createDeployment().addZipInputStream(zip).deploy();
127
-        }else if(fileName.indexOf("bpmn20.xml") != -1){
128
-            repositoryService.createDeployment().addInputStream(fileName, file.getInputStream()).deploy();
129
-        }else if("bpmn".equalsIgnoreCase(extension)){
130
-            repositoryService.createDeployment().addInputStream(fileName, file.getInputStream()).deploy();
131
-        }else{
132
-            throw new EitcException(ErrorCode.ACT_DEPLOY_FORMAT_ERROR);
120
+        } else {
121
+            assert fileName != null;
122
+            if (fileName.contains("bpmn20.xml")) {
123
+                repositoryService.createDeployment().addInputStream(fileName, file.getInputStream()).deploy();
124
+            } else if ("bpmn".equalsIgnoreCase(extension)) {
125
+                repositoryService.createDeployment().addInputStream(fileName, file.getInputStream()).deploy();
126
+            } else {
127
+                throw new EitcException(ErrorCode.ACT_DEPLOY_FORMAT_ERROR);
128
+            }
133
         }
129
         }
134
     }
130
     }
135
 
131
 
136
     /**
132
     /**
137
      * 激活流程
133
      * 激活流程
134
+     *
138
      * @param id 流程ID
135
      * @param id 流程ID
139
      */
136
      */
140
-    public void active(String id){
137
+    public void active(String id) {
141
         repositoryService.activateProcessDefinitionById(id, true, null);
138
         repositoryService.activateProcessDefinitionById(id, true, null);
142
     }
139
     }
143
 
140
 
144
     /**
141
     /**
145
      * 挂起流程
142
      * 挂起流程
143
+     *
146
      * @param id 流程ID
144
      * @param id 流程ID
147
      */
145
      */
148
-    public void suspend(String id){
146
+    public void suspend(String id) {
149
         repositoryService.suspendProcessDefinitionById(id, true, null);
147
         repositoryService.suspendProcessDefinitionById(id, true, null);
150
     }
148
     }
151
 
149
 
152
     /**
150
     /**
153
      * 将部署的流程转换为模型
151
      * 将部署的流程转换为模型
152
+     *
154
      * @param id 流程ID
153
      * @param id 流程ID
155
      */
154
      */
156
-    public Model convertToModel(String id) throws UnsupportedEncodingException, XMLStreamException {
155
+    public Model convertToModel(String id) throws XMLStreamException {
157
         ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult();
156
         ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult();
158
         InputStream bpmnStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(),
157
         InputStream bpmnStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(),
159
                 processDefinition.getResourceName());
158
                 processDefinition.getResourceName());
160
         XMLInputFactory xif = XMLInputFactory.newInstance();
159
         XMLInputFactory xif = XMLInputFactory.newInstance();
161
-        InputStreamReader in = new InputStreamReader(bpmnStream, "UTF-8");
160
+        InputStreamReader in = new InputStreamReader(bpmnStream, StandardCharsets.UTF_8);
162
         XMLStreamReader xtr = xif.createXMLStreamReader(in);
161
         XMLStreamReader xtr = xif.createXMLStreamReader(in);
163
         BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);
162
         BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);
164
 
163
 
@@ -169,7 +168,7 @@ public class ActProcessService {
169
         modelData.setName(processDefinition.getResourceName());
168
         modelData.setName(processDefinition.getResourceName());
170
         modelData.setCategory(processDefinition.getCategory());
169
         modelData.setCategory(processDefinition.getCategory());
171
         modelData.setDeploymentId(processDefinition.getDeploymentId());
170
         modelData.setDeploymentId(processDefinition.getDeploymentId());
172
-        modelData.setVersion(Integer.parseInt(String.valueOf(repositoryService.createModelQuery().modelKey(modelData.getKey()).count()+1)));
171
+        modelData.setVersion(Integer.parseInt(String.valueOf(repositoryService.createModelQuery().modelKey(modelData.getKey()).count() + 1)));
173
 
172
 
174
         ObjectNode modelObjectNode = new ObjectMapper().createObjectNode();
173
         ObjectNode modelObjectNode = new ObjectMapper().createObjectNode();
175
         modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, processDefinition.getName());
174
         modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, processDefinition.getName());
@@ -179,28 +178,28 @@ public class ActProcessService {
179
 
178
 
180
         repositoryService.saveModel(modelData);
179
         repositoryService.saveModel(modelData);
181
 
180
 
182
-        repositoryService.addModelEditorSource(modelData.getId(), modelNode.toString().getBytes("utf-8"));
181
+        repositoryService.addModelEditorSource(modelData.getId(), modelNode.toString().getBytes(StandardCharsets.UTF_8));
183
 
182
 
184
         return modelData;
183
         return modelData;
185
     }
184
     }
186
 
185
 
187
     /**
186
     /**
188
      * 删除部署
187
      * 删除部署
189
-     * @param deploymentId  部署ID
188
+     *
189
+     * @param deploymentId 部署ID
190
      */
190
      */
191
-    public void deleteDeployment(String deploymentId){
191
+    public void deleteDeployment(String deploymentId) {
192
         repositoryService.deleteDeployment(deploymentId, true);
192
         repositoryService.deleteDeployment(deploymentId, true);
193
     }
193
     }
194
 
194
 
195
     /**
195
     /**
196
      * 获取资源文件
196
      * 获取资源文件
197
-     * @param deploymentId  部署ID
197
+     *
198
+     * @param deploymentId 部署ID
198
      * @param resourceName 资源名称
199
      * @param resourceName 资源名称
199
      */
200
      */
200
     public InputStream getResourceAsStream(String deploymentId, String resourceName) {
201
     public InputStream getResourceAsStream(String deploymentId, String resourceName) {
201
-        InputStream resourceAsStream = repositoryService.getResourceAsStream(deploymentId, resourceName);
202
-
203
-        return resourceAsStream;
202
+        return repositoryService.getResourceAsStream(deploymentId, resourceName);
204
     }
203
     }
205
 
204
 
206
 }
205
 }

+ 4 - 4
eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActRunningService.java

@@ -16,9 +16,9 @@ import org.activiti.engine.impl.pvm.process.ActivityImpl;
16
 import org.activiti.engine.runtime.ProcessInstance;
16
 import org.activiti.engine.runtime.ProcessInstance;
17
 import org.activiti.engine.runtime.ProcessInstanceQuery;
17
 import org.activiti.engine.runtime.ProcessInstanceQuery;
18
 import org.apache.commons.lang3.StringUtils;
18
 import org.apache.commons.lang3.StringUtils;
19
-import org.springframework.beans.factory.annotation.Autowired;
20
 import org.springframework.stereotype.Service;
19
 import org.springframework.stereotype.Service;
21
 
20
 
21
+import javax.annotation.Resource;
22
 import java.util.ArrayList;
22
 import java.util.ArrayList;
23
 import java.util.HashMap;
23
 import java.util.HashMap;
24
 import java.util.List;
24
 import java.util.List;
@@ -31,13 +31,13 @@ import java.util.Map;
31
  */
31
  */
32
 @Service
32
 @Service
33
 public class ActRunningService {
33
 public class ActRunningService {
34
-    @Autowired
34
+    @Resource
35
     private RuntimeService runtimeService;
35
     private RuntimeService runtimeService;
36
 
36
 
37
-    @Autowired
37
+    @Resource
38
     private IdentityService identityService;
38
     private IdentityService identityService;
39
 
39
 
40
-    @Autowired
40
+    @Resource
41
     protected RepositoryService repositoryService;
41
     protected RepositoryService repositoryService;
42
 
42
 
43
     /**
43
     /**

+ 27 - 46
eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActTaskService.java

@@ -33,10 +33,10 @@ import org.activiti.engine.task.Task;
33
 import org.activiti.engine.task.TaskInfo;
33
 import org.activiti.engine.task.TaskInfo;
34
 import org.activiti.engine.task.TaskQuery;
34
 import org.activiti.engine.task.TaskQuery;
35
 import org.apache.commons.lang3.StringUtils;
35
 import org.apache.commons.lang3.StringUtils;
36
-import org.springframework.beans.factory.annotation.Autowired;
37
 import org.springframework.stereotype.Service;
36
 import org.springframework.stereotype.Service;
38
 import org.springframework.transaction.annotation.Transactional;
37
 import org.springframework.transaction.annotation.Transactional;
39
 
38
 
39
+import javax.annotation.Resource;
40
 import java.util.*;
40
 import java.util.*;
41
 
41
 
42
 /**
42
 /**
@@ -46,15 +46,15 @@ import java.util.*;
46
  */
46
  */
47
 @Service
47
 @Service
48
 public class ActTaskService extends BaseServiceImpl {
48
 public class ActTaskService extends BaseServiceImpl {
49
-    @Autowired
49
+    @Resource
50
     protected TaskService taskService;
50
     protected TaskService taskService;
51
-    @Autowired
51
+    @Resource
52
     protected HistoryService historyService;
52
     protected HistoryService historyService;
53
-    @Autowired
53
+    @Resource
54
     protected RepositoryService repositoryService;
54
     protected RepositoryService repositoryService;
55
-    @Autowired
55
+    @Resource
56
     protected RuntimeService runtimeService;
56
     protected RuntimeService runtimeService;
57
-    @Autowired
57
+    @Resource
58
     private SysRoleUserService sysRoleUserService;
58
     private SysRoleUserService sysRoleUserService;
59
 
59
 
60
     /**
60
     /**
@@ -65,8 +65,8 @@ public class ActTaskService extends BaseServiceImpl {
65
      */
65
      */
66
     public PageData<TaskDTO> page(Map<String, Object> params) {
66
     public PageData<TaskDTO> page(Map<String, Object> params) {
67
         String userId = (String) params.get("userId");
67
         String userId = (String) params.get("userId");
68
-        Integer curPage = 1;
69
-        Integer limit = 10;
68
+        int curPage = 1;
69
+        int limit = 10;
70
         if (params.get(Constant.PAGE) != null) {
70
         if (params.get(Constant.PAGE) != null) {
71
             curPage = Integer.parseInt((String) params.get(Constant.PAGE));
71
             curPage = Integer.parseInt((String) params.get(Constant.PAGE));
72
         }
72
         }
@@ -78,7 +78,7 @@ public class ActTaskService extends BaseServiceImpl {
78
             taskQuery.taskAssignee(userId);
78
             taskQuery.taskAssignee(userId);
79
         }
79
         }
80
         if (StringUtils.isNotEmpty((String)params.get("taskName"))){
80
         if (StringUtils.isNotEmpty((String)params.get("taskName"))){
81
-            taskQuery.taskNameLike("%"+(String)params.get("taskName")+"%");
81
+            taskQuery.taskNameLike("%"+ params.get("taskName") +"%");
82
         }
82
         }
83
         if(StringUtils.isNotEmpty((String)params.get("isRoleGroup"))&&"1".equals(params.get("isRoleGroup"))){
83
         if(StringUtils.isNotEmpty((String)params.get("isRoleGroup"))&&"1".equals(params.get("isRoleGroup"))){
84
             List<Long> listRoles = sysRoleUserService.getRoleIdList(SecurityUser.getUserId());
84
             List<Long> listRoles = sysRoleUserService.getRoleIdList(SecurityUser.getUserId());
@@ -87,11 +87,7 @@ public class ActTaskService extends BaseServiceImpl {
87
                 listStr.add(role.toString());
87
                 listStr.add(role.toString());
88
             }
88
             }
89
             listStr.add(SecurityUser.getUserId().toString());
89
             listStr.add(SecurityUser.getUserId().toString());
90
-            if(!listStr.isEmpty()){
91
-                taskQuery.taskCandidateGroupIn(listStr);
92
-            } else {
93
-                return new PageData<>(new ArrayList<>(), 0);
94
-            }
90
+            taskQuery.taskCandidateGroupIn(listStr);
95
         }
91
         }
96
         taskQuery.orderByTaskCreateTime().desc();
92
         taskQuery.orderByTaskCreateTime().desc();
97
         List<Task> list = taskQuery.listPage((curPage - 1) * limit, limit);
93
         List<Task> list = taskQuery.listPage((curPage - 1) * limit, limit);
@@ -259,10 +255,10 @@ public class ActTaskService extends BaseServiceImpl {
259
 
255
 
260
     public void deleteTaskVariable(String taskId, String variableName, String scope) {
256
     public void deleteTaskVariable(String taskId, String variableName, String scope) {
261
         if (StringUtils.isNotEmpty(scope)) {
257
         if (StringUtils.isNotEmpty(scope)) {
262
-            if ("global".equals(scope.toLowerCase())) {
258
+            if ("global".equalsIgnoreCase(scope)) {
263
                 Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
259
                 Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
264
                 runtimeService.removeVariable(task.getExecutionId(), variableName);
260
                 runtimeService.removeVariable(task.getExecutionId(), variableName);
265
-            } else if ("local".equals(scope.toLowerCase())) {
261
+            } else if ("local".equalsIgnoreCase(scope)) {
266
                 taskService.removeVariable(taskId, variableName);
262
                 taskService.removeVariable(taskId, variableName);
267
             }
263
             }
268
         } else {
264
         } else {
@@ -277,7 +273,7 @@ public class ActTaskService extends BaseServiceImpl {
277
      */
273
      */
278
     @Transactional(rollbackFor = Exception.class)
274
     @Transactional(rollbackFor = Exception.class)
279
     public void doBackPreviousTask(String taskId, String comment) {
275
     public void doBackPreviousTask(String taskId, String comment) {
280
-        Map<String, Object> variables = null;
276
+        Map<String, Object> variables;
281
         HistoricTaskInstance currTask = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();
277
         HistoricTaskInstance currTask = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();
282
         if(this.isMultiInstance(taskId)){
278
         if(this.isMultiInstance(taskId)){
283
             throw new EitcException(ErrorCode.BACK_PROCESS_PARALLEL_ERROR);
279
             throw new EitcException(ErrorCode.BACK_PROCESS_PARALLEL_ERROR);
@@ -291,11 +287,8 @@ public class ActTaskService extends BaseServiceImpl {
291
         if(canBackActivitys.isEmpty()) {
287
         if(canBackActivitys.isEmpty()) {
292
             throw new EitcException(ErrorCode.SUPERIOR_NOT_EXIST);
288
             throw new EitcException(ErrorCode.SUPERIOR_NOT_EXIST);
293
         }
289
         }
294
-        List<PvmTransition> originPvmTransitionList = new ArrayList<PvmTransition>();
295
         List<PvmTransition> pvmTransitionList = currActivity.getOutgoingTransitions();
290
         List<PvmTransition> pvmTransitionList = currActivity.getOutgoingTransitions();
296
-        for (PvmTransition pvmTransition : pvmTransitionList) {
297
-            originPvmTransitionList.add(pvmTransition);
298
-        }
291
+        List<PvmTransition> originPvmTransitionList = new ArrayList<>(pvmTransitionList);
299
         pvmTransitionList.clear();
292
         pvmTransitionList.clear();
300
         List<HistoricActivityInstance> historicActivityInstances = historyService
293
         List<HistoricActivityInstance> historicActivityInstances = historyService
301
                 .createHistoricActivityInstanceQuery().activityType("userTask")
294
                 .createHistoricActivityInstanceQuery().activityType("userTask")
@@ -408,12 +401,9 @@ public class ActTaskService extends BaseServiceImpl {
408
             taskService.complete(taskId);
401
             taskService.complete(taskId);
409
         } else {
402
         } else {
410
             ActivityImpl currActivity = findActivitiImpl(taskId, null);
403
             ActivityImpl currActivity = findActivitiImpl(taskId, null);
411
-            List<PvmTransition> oriPvmTransitionList = new ArrayList<PvmTransition>();
412
-            List<PvmTransition> pvmTransitionList = currActivity
413
-                    .getOutgoingTransitions();
414
-            for (PvmTransition pvmTransition : pvmTransitionList) {
415
-                oriPvmTransitionList.add(pvmTransition);
416
-            }
404
+            assert currActivity != null;
405
+            List<PvmTransition> pvmTransitionList = currActivity.getOutgoingTransitions();
406
+            List<PvmTransition> oriPvmTransitionList = new ArrayList<>(pvmTransitionList);
417
             pvmTransitionList.clear();
407
             pvmTransitionList.clear();
418
             TransitionImpl newTransition = currActivity.createOutgoingTransition();
408
             TransitionImpl newTransition = currActivity.createOutgoingTransition();
419
             ActivityImpl pointActivity = findActivitiImpl(taskId, endActivity.getId());
409
             ActivityImpl pointActivity = findActivitiImpl(taskId, endActivity.getId());
@@ -425,12 +415,11 @@ public class ActTaskService extends BaseServiceImpl {
425
             comment = message + "["+ comment+ "]";
415
             comment = message + "["+ comment+ "]";
426
             taskService.addComment(task.getId(), task.getProcessInstanceId(), comment);
416
             taskService.addComment(task.getId(), task.getProcessInstanceId(), comment);
427
             taskService.complete(taskId);
417
             taskService.complete(taskId);
418
+            assert pointActivity != null;
428
             pointActivity.getIncomingTransitions().remove(newTransition);
419
             pointActivity.getIncomingTransitions().remove(newTransition);
429
             List<PvmTransition> pvmTransitionListC = currActivity.getOutgoingTransitions();
420
             List<PvmTransition> pvmTransitionListC = currActivity.getOutgoingTransitions();
430
             pvmTransitionListC.clear();
421
             pvmTransitionListC.clear();
431
-            for (PvmTransition pvmTransition : oriPvmTransitionList) {
432
-                pvmTransitionListC.add(pvmTransition);
433
-            }
422
+            pvmTransitionListC.addAll(oriPvmTransitionList);
434
         }
423
         }
435
 
424
 
436
     }
425
     }
@@ -447,7 +436,7 @@ public class ActTaskService extends BaseServiceImpl {
447
         if (StringUtils.isEmpty(activityId)) {
436
         if (StringUtils.isEmpty(activityId)) {
448
             activityId = task.getTaskDefinitionKey();
437
             activityId = task.getTaskDefinitionKey();
449
         }
438
         }
450
-        if ("END".equals(activityId.toUpperCase())) {
439
+        if ("END".equalsIgnoreCase(activityId)) {
451
             for (ActivityImpl activityImpl : processDefinition.getActivities()) {
440
             for (ActivityImpl activityImpl : processDefinition.getActivities()) {
452
                 String type = (String)activityImpl.getProperty("type");
441
                 String type = (String)activityImpl.getProperty("type");
453
                 if("endEvent".equals(type)){
442
                 if("endEvent".equals(type)){
@@ -455,8 +444,7 @@ public class ActTaskService extends BaseServiceImpl {
455
                 }
444
                 }
456
             }
445
             }
457
         }
446
         }
458
-        ActivityImpl activityImpl = processDefinition.findActivity(activityId);
459
-        return activityImpl;
447
+        return processDefinition.findActivity(activityId);
460
     }
448
     }
461
 
449
 
462
     /**
450
     /**
@@ -505,17 +493,14 @@ public class ActTaskService extends BaseServiceImpl {
505
             throw new EitcException(ErrorCode.REJECT_PROCESS_HANDLEING_ERROR);
493
             throw new EitcException(ErrorCode.REJECT_PROCESS_HANDLEING_ERROR);
506
         }
494
         }
507
         ActivityImpl currActivity = processDefinitionEntity.findActivity(currTask.getTaskDefinitionKey());
495
         ActivityImpl currActivity = processDefinitionEntity.findActivity(currTask.getTaskDefinitionKey());
508
-        List<PvmTransition> originPvmTransitionList = new ArrayList<>();
509
         List<PvmTransition> pvmTransitionList = currActivity.getOutgoingTransitions();
496
         List<PvmTransition> pvmTransitionList = currActivity.getOutgoingTransitions();
510
-        for (PvmTransition pvmTransition : pvmTransitionList) {
511
-            originPvmTransitionList.add(pvmTransition);
512
-        }
497
+        List<PvmTransition> originPvmTransitionList = new ArrayList<>(pvmTransitionList);
513
         pvmTransitionList.clear();
498
         pvmTransitionList.clear();
514
         List<HistoricActivityInstance> historicActivityInstances = historyService
499
         List<HistoricActivityInstance> historicActivityInstances = historyService
515
                 .createHistoricActivityInstanceQuery().activityType("userTask")
500
                 .createHistoricActivityInstanceQuery().activityType("userTask")
516
                 .processInstanceId(processInstance.getId())
501
                 .processInstanceId(processInstance.getId())
517
                 .finished().orderByHistoricActivityInstanceEndTime().asc().list();
502
                 .finished().orderByHistoricActivityInstanceEndTime().asc().list();
518
-        TransitionImpl transitionImpl = null;
503
+        TransitionImpl transitionImpl;
519
         if (historicActivityInstances.size() > 0) {
504
         if (historicActivityInstances.size() > 0) {
520
             ActivityImpl lastActivity = processDefinitionEntity.findActivity(historicActivityInstances.get(0).getActivityId());
505
             ActivityImpl lastActivity = processDefinitionEntity.findActivity(historicActivityInstances.get(0).getActivityId());
521
             transitionImpl = currActivity.createOutgoingTransition();
506
             transitionImpl = currActivity.createOutgoingTransition();
@@ -534,18 +519,14 @@ public class ActTaskService extends BaseServiceImpl {
534
         }
519
         }
535
         currActivity.getOutgoingTransitions().remove(transitionImpl);
520
         currActivity.getOutgoingTransitions().remove(transitionImpl);
536
 
521
 
537
-        for (PvmTransition pvmTransition : originPvmTransitionList) {
538
-            pvmTransitionList.add(pvmTransition);
539
-        }
522
+        pvmTransitionList.addAll(originPvmTransitionList);
540
     }
523
     }
541
 
524
 
542
     public void completeTaskByVariables(TaskDTO taskDTO) {
525
     public void completeTaskByVariables(TaskDTO taskDTO) {
543
         if(null != taskDTO.getParams()){
526
         if(null != taskDTO.getParams()){
544
-            Set keySet = taskDTO.getParams().keySet();
545
-            Iterator iterator = keySet.iterator();
546
-            while(iterator.hasNext()){
547
-                String key = (String)iterator.next();
548
-                this.setTaskVariable(taskDTO.getTaskId(),key , taskDTO.getParams().get(key));
527
+            Set<String> keySet = taskDTO.getParams().keySet();
528
+            for (String key : keySet) {
529
+                this.setTaskVariable(taskDTO.getTaskId(), key, taskDTO.getParams().get(key));
549
             }
530
             }
550
         }
531
         }
551
         this.completeTask(taskDTO.getTaskId(), taskDTO.getComment());
532
         this.completeTask(taskDTO.getTaskId(), taskDTO.getComment());

+ 1 - 1
eitc-admin/src/main/java/com/eitc/modules/devtools/service/impl/GeneratorServiceImpl.java

@@ -196,7 +196,7 @@ public class GeneratorServiceImpl implements GeneratorService {
196
         //导入的包列表
196
         //导入的包列表
197
         Set<String> imports = fieldTypeService.getPackageListByTableId(tableInfo.getId());
197
         Set<String> imports = fieldTypeService.getPackageListByTableId(tableInfo.getId());
198
         //过滤为空的数据
198
         //过滤为空的数据
199
-        imports = imports.stream().filter(i -> StringUtils.isNotBlank(i)).collect(Collectors.toSet());
199
+        imports = imports.stream().filter(StringUtils::isNotBlank).collect(Collectors.toSet());
200
         dataModel.put("imports", imports);
200
         dataModel.put("imports", imports);
201
 
201
 
202
         //基类
202
         //基类

+ 7 - 7
eitc-admin/src/main/java/com/eitc/modules/message/email/EmailUtils.java

@@ -12,11 +12,11 @@ import com.eitc.modules.sys.service.SysParamsService;
12
 import org.apache.commons.io.IOUtils;
12
 import org.apache.commons.io.IOUtils;
13
 import org.slf4j.Logger;
13
 import org.slf4j.Logger;
14
 import org.slf4j.LoggerFactory;
14
 import org.slf4j.LoggerFactory;
15
-import org.springframework.beans.factory.annotation.Autowired;
16
 import org.springframework.mail.javamail.JavaMailSenderImpl;
15
 import org.springframework.mail.javamail.JavaMailSenderImpl;
17
 import org.springframework.mail.javamail.MimeMessageHelper;
16
 import org.springframework.mail.javamail.MimeMessageHelper;
18
 import org.springframework.stereotype.Component;
17
 import org.springframework.stereotype.Component;
19
 
18
 
19
+import javax.annotation.Resource;
20
 import javax.mail.internet.MimeMessage;
20
 import javax.mail.internet.MimeMessage;
21
 import java.io.StringReader;
21
 import java.io.StringReader;
22
 import java.io.StringWriter;
22
 import java.io.StringWriter;
@@ -31,12 +31,12 @@ import java.util.Properties;
31
 @Component
31
 @Component
32
 public class EmailUtils {
32
 public class EmailUtils {
33
 
33
 
34
-    private Logger logger = LoggerFactory.getLogger(getClass());
35
-    @Autowired
34
+    private final Logger logger = LoggerFactory.getLogger(getClass());
35
+    @Resource
36
     private SysParamsService sysParamsService;
36
     private SysParamsService sysParamsService;
37
-    @Autowired
37
+    @Resource
38
     private SysMailTemplateService sysMailTemplateService;
38
     private SysMailTemplateService sysMailTemplateService;
39
-    @Autowired
39
+    @Resource
40
     private SysMailLogService sysMailLogService;
40
     private SysMailLogService sysMailLogService;
41
 
41
 
42
     private final static String KEY = Constant.MAIL_CONFIG_KEY;
42
     private final static String KEY = Constant.MAIL_CONFIG_KEY;
@@ -101,7 +101,7 @@ public class EmailUtils {
101
 
101
 
102
         sysMailLogService.save(templateId, config.getUsername(), to, cc, template.getSubject(), content, status);
102
         sysMailLogService.save(templateId, config.getUsername(), to, cc, template.getSubject(), content, status);
103
 
103
 
104
-        return status == Constant.SUCCESS ? true : false;
104
+        return status == Constant.SUCCESS;
105
     }
105
     }
106
 
106
 
107
     /**
107
     /**
@@ -166,7 +166,7 @@ public class EmailUtils {
166
 
166
 
167
         sysMailLogService.save(null, config.getUsername(), to, cc, subject, content, status);
167
         sysMailLogService.save(null, config.getUsername(), to, cc, subject, content, status);
168
 
168
 
169
-        return status == Constant.SUCCESS ? true : false;
169
+        return status == Constant.SUCCESS;
170
     }
170
     }
171
 
171
 
172
 }
172
 }

+ 1 - 3
eitc-admin/src/main/java/com/eitc/modules/message/sms/QcloudSmsService.java

@@ -34,9 +34,7 @@ public class QcloudSmsService extends AbstractSmsService {
34
         //短信参数
34
         //短信参数
35
         ArrayList<String> paramsList = new ArrayList<>();
35
         ArrayList<String> paramsList = new ArrayList<>();
36
         if(MapUtil.isNotEmpty(params)){
36
         if(MapUtil.isNotEmpty(params)){
37
-            for(String value : params.values()){
38
-                paramsList.add(value);
39
-            }
37
+            paramsList.addAll(params.values());
40
         }
38
         }
41
         SmsSingleSenderResult result;
39
         SmsSingleSenderResult result;
42
         try {
40
         try {

+ 1 - 3
eitc-admin/src/main/java/com/eitc/modules/oss/cloud/MinioCloudStorageService.java

@@ -26,9 +26,7 @@ public class MinioCloudStorageService extends AbstractCloudStorageService {
26
     private void init(){
26
     private void init(){
27
         try {
27
         try {
28
             minioClient = new MinioClient(config.getMinioEndPoint(), config.getMinioAccessKey(), config.getMinioSecretKey());
28
             minioClient = new MinioClient(config.getMinioEndPoint(), config.getMinioAccessKey(), config.getMinioSecretKey());
29
-        } catch (InvalidEndpointException e) {
30
-            e.printStackTrace();
31
-        } catch (InvalidPortException e) {
29
+        } catch (InvalidEndpointException | InvalidPortException e) {
32
             e.printStackTrace();
30
             e.printStackTrace();
33
         }
31
         }
34
     }
32
     }

+ 1 - 1
eitc-admin/src/main/java/com/eitc/modules/sys/service/impl/SysDeptServiceImpl.java

@@ -127,7 +127,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
127
 	private String getPidList(Long pid){
127
 	private String getPidList(Long pid){
128
 		//顶级部门,无上级部门
128
 		//顶级部门,无上级部门
129
 		if(Constant.DEPT_ROOT.equals(pid)){
129
 		if(Constant.DEPT_ROOT.equals(pid)){
130
-			return Constant.DEPT_ROOT + "";
130
+			return String.valueOf(Constant.DEPT_ROOT);
131
 		}
131
 		}
132
 
132
 
133
 		//所有部门的id、pid列表
133
 		//所有部门的id、pid列表

+ 4 - 7
eitc-admin/src/main/java/com/eitc/modules/sys/service/impl/SysMenuServiceImpl.java

@@ -15,26 +15,23 @@ import com.eitc.modules.sys.enums.SuperAdminEnum;
15
 import com.eitc.modules.sys.service.SysLanguageService;
15
 import com.eitc.modules.sys.service.SysLanguageService;
16
 import com.eitc.modules.sys.service.SysMenuService;
16
 import com.eitc.modules.sys.service.SysMenuService;
17
 import com.eitc.modules.sys.service.SysRoleMenuService;
17
 import com.eitc.modules.sys.service.SysRoleMenuService;
18
-import org.springframework.beans.factory.annotation.Autowired;
19
 import org.springframework.stereotype.Service;
18
 import org.springframework.stereotype.Service;
20
 import org.springframework.transaction.annotation.Transactional;
19
 import org.springframework.transaction.annotation.Transactional;
21
 
20
 
21
+import javax.annotation.Resource;
22
 import java.util.List;
22
 import java.util.List;
23
 
23
 
24
 @Service
24
 @Service
25
 public class SysMenuServiceImpl extends BaseServiceImpl<SysMenuDao, SysMenuEntity> implements SysMenuService {
25
 public class SysMenuServiceImpl extends BaseServiceImpl<SysMenuDao, SysMenuEntity> implements SysMenuService {
26
-	@Autowired
26
+	@Resource
27
 	private SysRoleMenuService sysRoleMenuService;
27
 	private SysRoleMenuService sysRoleMenuService;
28
-	@Autowired
28
+	@Resource
29
 	private SysLanguageService sysLanguageService;
29
 	private SysLanguageService sysLanguageService;
30
 
30
 
31
 	@Override
31
 	@Override
32
 	public SysMenuDTO get(Long id) {
32
 	public SysMenuDTO get(Long id) {
33
 		SysMenuEntity entity = baseDao.getById(id, HttpContextUtils.getLanguage());
33
 		SysMenuEntity entity = baseDao.getById(id, HttpContextUtils.getLanguage());
34
-
35
-		SysMenuDTO dto = ConvertUtils.sourceToTarget(entity, SysMenuDTO.class);
36
-
37
-		return dto;
34
+		return ConvertUtils.sourceToTarget(entity, SysMenuDTO.class);
38
 	}
35
 	}
39
 
36
 
40
 	@Override
37
 	@Override

+ 1 - 1
eitc-common/src/main/java/com/eitc/common/aspect/RedisAspect.java

@@ -18,7 +18,7 @@ import org.springframework.stereotype.Component;
18
 @Aspect
18
 @Aspect
19
 @Component
19
 @Component
20
 public class RedisAspect {
20
 public class RedisAspect {
21
-    private Logger logger = LoggerFactory.getLogger(getClass());
21
+    private final Logger logger = LoggerFactory.getLogger(getClass());
22
     /**
22
     /**
23
      * 是否开启redis缓存  true开启   false关闭
23
      * 是否开启redis缓存  true开启   false关闭
24
      */
24
      */

+ 1 - 1
eitc-common/src/main/java/com/eitc/common/xss/SqlFilter.java

@@ -32,7 +32,7 @@ public class SqlFilter {
32
 
32
 
33
         //判断是否包含非法字符
33
         //判断是否包含非法字符
34
         for(String keyword : keywords){
34
         for(String keyword : keywords){
35
-            if(str.indexOf(keyword) != -1){
35
+            if(str.contains(keyword)){
36
                 throw new EitcException(ErrorCode.INVALID_SYMBOL);
36
                 throw new EitcException(ErrorCode.INVALID_SYMBOL);
37
             }
37
             }
38
         }
38
         }

+ 1 - 7
eitc-dynamic-datasource/src/main/java/com/eitc/commons/dynamic/datasource/config/DynamicContextHolder.java

@@ -9,13 +9,7 @@ import java.util.Deque;
9
  * @author Mark eitc@163.com
9
  * @author Mark eitc@163.com
10
  */
10
  */
11
 public class DynamicContextHolder {
11
 public class DynamicContextHolder {
12
-    @SuppressWarnings("unchecked")
13
-    private static final ThreadLocal<Deque<String>> CONTEXT_HOLDER = new ThreadLocal() {
14
-        @Override
15
-        protected Object initialValue() {
16
-            return new ArrayDeque();
17
-        }
18
-    };
12
+    private static final ThreadLocal<Deque<String>> CONTEXT_HOLDER = ThreadLocal.withInitial(ArrayDeque::new);
19
 
13
 
20
     /**
14
     /**
21
      * 获得当前线程数据源
15
      * 获得当前线程数据源