Commit 7d80695eb27287b49e8de92895745016cb85e5e2

Authored by 273548560@qq.com
2 parents 48597b26 8a95aee1

Merge remote-tracking branch 'origin/dev' into dev

trash-activiti/src/main/java/com/trash/activiti/controller/TaskHistoryController.java
... ... @@ -9,6 +9,7 @@ import com.trash.common.core.page.TableDataInfo;
9 9 import com.trash.common.core.page.TableSupport;
10 10 import com.trash.activiti.domain.dto.ActTaskDTO;
11 11 import com.trash.activiti.domain.dto.ActWorkflowFormDataDTO;
  12 +import com.trash.activiti.mapper.ActReDeploymentMapper;
12 13 import com.trash.activiti.service.IActTaskService;
13 14  
14 15 import org.activiti.api.task.runtime.TaskRuntime;
... ... @@ -28,12 +29,17 @@ public class TaskHistoryController extends BaseController {
28 29 @Autowired
29 30 private IActTaskService actTaskService;
30 31  
  32 + @Autowired
  33 + private ActReDeploymentMapper actReDeploymentMapper;
  34 +
31 35 //获取我的代办任务
32 36 @GetMapping(value = "/list")
33 37 public TableDataInfo getTasks() {
34 38 PageDomain pageDomain = TableSupport.buildPageRequest();
35 39 Page<ActTaskDTO> hashMaps = actTaskService.selectRuntimeTaskHistoryDefinitionList(pageDomain);
36 40  
  41 + List<String> names = actReDeploymentMapper.selectTitles();
  42 +
37 43 List<ActTaskDTO> list = hashMaps.getResult();
38 44  
39 45 TableDataInfo info = getDataTable(hashMaps);
... ... @@ -44,6 +50,7 @@ public class TaskHistoryController extends BaseController {
44 50 list = list.subList((pageDomain.getPageNum()-1), list.size());
45 51 }
46 52 info.setRows(list);
  53 + info.setNames(names);
47 54  
48 55 return info;
49 56 }
... ... @@ -52,6 +59,7 @@ public class TaskHistoryController extends BaseController {
52 59 public TableDataInfo getEndTasks() {
53 60 PageDomain pageDomain = TableSupport.buildPageRequest();
54 61 Page<ActTaskDTO> hashMaps = actTaskService.selectTaskEndHistoryDefinitionList(pageDomain);
  62 + List<String> names = actReDeploymentMapper.selectHistTitles();
55 63  
56 64 List<ActTaskDTO> list = hashMaps.getResult();
57 65 TableDataInfo info = getDataTable(hashMaps);
... ... @@ -61,6 +69,7 @@ public class TaskHistoryController extends BaseController {
61 69 }else{
62 70 list = list.subList((pageDomain.getPageNum()-1), list.size());
63 71 }
  72 + info.setNames(names);
64 73 info.setRows(list);
65 74  
66 75  
... ...
trash-activiti/src/main/java/com/trash/activiti/domain/dto/ActTaskDTO.java
... ... @@ -85,10 +85,14 @@ public class ActTaskDTO
85 85 this.definitionKey=processInstance.getProcessDefinitionKey();
86 86 this.businessKey=processInstance.getBusinessKey();
87 87  
88   -
89   -
  88 + getPrevNext(task, processInstance);
  89 +
  90 + getData(map);
  91 +
  92 + }
90 93  
91   - BpmnModel model = SpringUtils.getBean(RepositoryService.class).getBpmnModel(processInstance.getProcessDefinitionId());
  94 + private void getPrevNext(Task task, ProcessInstance processInstance) {
  95 + BpmnModel model = SpringUtils.getBean(RepositoryService.class).getBpmnModel(processInstance.getProcessDefinitionId());
92 96 org.activiti.engine.task.Task et = SpringUtils.getBean(TaskService.class).createTaskQuery().taskId(this.id).singleResult();
93 97  
94 98  
... ... @@ -200,10 +204,7 @@ public class ActTaskDTO
200 204 }
201 205 }
202 206 }
203   -
204   - getData(map);
205   -
206   - }
  207 + }
207 208  
208 209 private void getData(Map<String, String> map) {
209 210 try {
... ...
trash-activiti/src/main/java/com/trash/activiti/mapper/ActReDeploymentMapper.java
... ... @@ -16,24 +16,20 @@ import java.util.Set;
16 16 */
17 17 public interface ActReDeploymentMapper {
18 18  
19   -
20 19 public List<ActReDeploymentVO> selectActReDeploymentByIds(@Param("ids") Set<String> ids);
21 20  
22   -
23 21 public List<Map<String, String>> selectWorkByIds(@Param("ids") Set<String> idString);
24 22  
25 23 public List<Map<String, String>> selectHistoryWorkByPIds(@Param("ids") Set<String> id);
26 24  
27   -
28   -
29 25 public Set<String> selectUnCompleteWorkByUsername(@Param("username") String username);
30 26  
31 27 public List<String> selectCompleteWorkByUsername(@Param("username") String username);
32 28  
33   -
34 29 public Map<String, String> selectHistoryWorkByPId(String id);
35 30  
36   -
37 31 public List<String> selectTitles();
  32 +
  33 + public List<String> selectHistTitles();
38 34  
39 35 }
... ...
trash-activiti/src/main/java/com/trash/activiti/service/impl/ActTaskServiceImpl.java
... ... @@ -3,6 +3,7 @@ package com.trash.activiti.service.impl;
3 3 import java.text.ParseException;
4 4 import java.text.SimpleDateFormat;
5 5 import java.util.ArrayList;
  6 +import java.util.Comparator;
6 7 import java.util.Date;
7 8 import java.util.HashMap;
8 9 import java.util.HashSet;
... ... @@ -121,11 +122,33 @@ public class ActTaskServiceImpl implements IActTaskService {
121 122 }
122 123  
123 124 List<Map<String, String>> maps = actMapper.selectWorkByIds(idString);
124   -
125   - List<ActTaskDTO> actTaskDTOS = tasks.stream().map(t -> new ActTaskDTO(t,
126   - processInstanceList.parallelStream().filter(pi -> t.getProcessInstanceId().equals(pi.getId())).findAny().get(),
127   - maps.parallelStream().filter(pi -> t.getProcessInstanceId().equals(pi.get("instance_id"))).findAny().get())).collect(Collectors.toList());
128   -
  125 + List<ActTaskDTO> actTaskDTOS = new ArrayList<>();
  126 + try {
  127 +
  128 +
  129 + for(Task t:tasks){
  130 + for(ProcessInstance pInstance : processInstanceList){
  131 + if(pInstance.getId().equals(t.getProcessInstanceId())){
  132 + for(Map map:maps){
  133 + if(pInstance.getId().equals(map.get("instance_id"))){
  134 + ActTaskDTO atc = new ActTaskDTO(t, pInstance, map);
  135 +
  136 + actTaskDTOS.add(atc);
  137 + break;
  138 + }
  139 + }
  140 +
  141 + }
  142 + }
  143 + }
  144 +// actTaskDTOS = tasks.stream().map(t -> new ActTaskDTO(t,
  145 +// processInstanceList.parallelStream().filter(pi -> t.getProcessInstanceId().equals(pi.getId())).findAny().get(),
  146 +// maps.parallelStream().filter(pi -> t.getProcessInstanceId().equals(pi.)).findAny().get())).collect(Collectors.toList());
  147 +
  148 +
  149 + } catch (Exception e) {
  150 + e.printStackTrace();
  151 + }
129 152  
130 153  
131 154  
... ... @@ -160,6 +183,10 @@ public class ActTaskServiceImpl implements IActTaskService {
160 183  
161 184 List<String> collect = actMapper.selectCompleteWorkByUsername(username);
162 185  
  186 + String type = ServletUtils.getParameter("type");
  187 + String prev = ServletUtils.getParameter("prev");
  188 + String name = ServletUtils.getParameter("name");
  189 +
163 190 if (collect.size() > 0) {
164 191 Set<String> set = new HashSet(collect);
165 192  
... ... @@ -178,10 +205,20 @@ public class ActTaskServiceImpl implements IActTaskService {
178 205 if (processInstanceList.size() > 0) {
179 206 for (HistoricProcessInstance p : processInstanceList) {
180 207 try {
181   - ActTaskDTO actTaskDTOS = new ActTaskDTO(p, maps.parallelStream().filter(pi -> p.getId().equals(pi.get("instance_id"))).findAny().get());
182   - getCheckData(actTaskDTOS);
183   -
184   - list.add(actTaskDTOS);}
  208 + ActTaskDTO dto = new ActTaskDTO(p, maps.parallelStream().filter(pi -> p.getId().equals(pi.get("instance_id"))).findAny().get());
  209 + getCheckData(dto);
  210 +
  211 + if(name != null && !name.isEmpty() && !name.equals(dto.getInstanceName())){
  212 + continue;
  213 + }
  214 + if(type != null && !type.isEmpty() && !type.contains(dto.getDefinitionKey())){
  215 + continue;
  216 + }
  217 +
  218 + list.add(dto);
  219 +
  220 +
  221 + list.add(dto);}
185 222 catch (Exception e) {
186 223 // TODO: handle exception
187 224 }
... ... @@ -190,6 +227,16 @@ public class ActTaskServiceImpl implements IActTaskService {
190 227 }
191 228 }
192 229  
  230 + list.sort(new Comparator<ActTaskDTO>() {
  231 +
  232 + @Override
  233 + public int compare(ActTaskDTO o1, ActTaskDTO o2) {
  234 + // TODO Auto-generated method stub
  235 + return (int) (o2.getCreatedDate().getTime() - o1.getCreatedDate().getTime());
  236 + }
  237 + });
  238 +
  239 +
193 240 list.setPageNum(pageDomain.getPageNum());
194 241 list.setPageSize(pageDomain.getPageSize());
195 242  
... ... @@ -203,11 +250,13 @@ public class ActTaskServiceImpl implements IActTaskService {
203 250 Page<ActTaskDTO> list = new Page<ActTaskDTO>();
204 251  
205 252 Set<String> collect = actMapper.selectUnCompleteWorkByUsername(securityManager.getAuthenticatedUserId());
206   -
  253 +
  254 + String type = ServletUtils.getParameter("type");
  255 + String name = ServletUtils.getParameter("name");
  256 +
207 257 if (collect.size() > 0) {
208 258  
209   - List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery()
210   - .processInstanceIds(collect).list();
  259 + List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery().processInstanceIds(collect).list();
211 260  
212 261 list.setTotal(processInstanceList.size());
213 262  
... ... @@ -221,14 +270,19 @@ public class ActTaskServiceImpl implements IActTaskService {
221 270 if (processInstanceList.size() > 0) {
222 271 for (ProcessInstance p : processInstanceList) {
223 272 try {
224   -
225   -
226   - ActTaskDTO actTaskDTOS = new ActTaskDTO(p, maps.parallelStream()
227   - .filter(pi -> p.getProcessInstanceId().equals(pi.get("instance_id"))).findAny().get());
228   -
229   - getCheckData(actTaskDTOS);
  273 + ActTaskDTO dto = new ActTaskDTO(p, maps.parallelStream().filter(pi -> p.getProcessInstanceId().equals(pi.get("instance_id"))).findAny().get());
230 274  
231   - list.add(actTaskDTOS);
  275 + getCheckData(dto);
  276 +
  277 + if(name != null && !name.isEmpty() && !name.equals(dto.getInstanceName())){
  278 + continue;
  279 + }
  280 +
  281 + if(type != null && !type.isEmpty() && !type.contains(dto.getDefinitionKey())){
  282 + continue;
  283 + }
  284 +
  285 + list.add(dto);
232 286 } catch (Exception e) {
233 287 // TODO: handle exception
234 288 }
... ... @@ -236,7 +290,15 @@ public class ActTaskServiceImpl implements IActTaskService {
236 290  
237 291 }
238 292 }
  293 + list.sort(new Comparator<ActTaskDTO>() {
239 294  
  295 + @Override
  296 + public int compare(ActTaskDTO o1, ActTaskDTO o2) {
  297 + // TODO Auto-generated method stub
  298 + return (int) (o2.getCreatedDate().getTime() - o1.getCreatedDate().getTime());
  299 + }
  300 + });
  301 +
240 302 list.setPageNum(pageDomain.getPageNum());
241 303 list.setPageSize(pageDomain.getPageSize());
242 304  
... ... @@ -249,9 +311,12 @@ public class ActTaskServiceImpl implements IActTaskService {
249 311 ActWorkflowFormData.setBusinessKey(actTaskDTOS.getBusinessKey());
250 312 ActWorkflowFormData.setCreateBy(securityManager.getAuthenticatedUserId());
251 313 ActWorkflowFormData.setControlName("审批");
  314 +
  315 + ActWorkflowFormData = actWorkflowFormDataService.selectActWorkflowFormDataList(ActWorkflowFormData).get(0);
252 316  
253   - actTaskDTOS.setCheckStatus(actWorkflowFormDataService.selectActWorkflowFormDataList(ActWorkflowFormData).get(0)
254   - .getControlValue().equals("通过") ? "0" : "1");
  317 + actTaskDTOS.setCheckStatus(ActWorkflowFormData.getControlValue().equals("通过") ? "0" : "1");
  318 + actTaskDTOS.setCreatedDate(ActWorkflowFormData.getCreateTime());
  319 +
255 320 }
256 321  
257 322 SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:SS");
... ...
trash-activiti/src/main/resources/mapper/activiti/ActReDeploymentMapper.xml
... ... @@ -41,6 +41,9 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
41 41 <select id="selectTitles" parameterType="String" resultType="java.lang.String">
42 42 select DISTINCT title from workflow
43 43 </select>
  44 + <select id="selectHistTitles" parameterType="String" resultType="java.lang.String">
  45 + select DISTINCT title from workflow_hi
  46 + </select>
44 47  
45 48  
46 49  
... ...
trash-ui/src/views/activiti/task/taskCard.vue
... ... @@ -20,8 +20,8 @@
20 20 </el-col>
21 21 </el-row>
22 22 <el-row class="card_row">
23   - <el-col :span="24" class="card_grid">
24   - <div>当前节点: {{task.name}}</div>
  23 + <el-col :span="24" class="card_grid" v-if="task.name">
  24 + <div >当前节点: {{task.name}}</div>
25 25 </el-col>
26 26 </el-row>
27 27  
... ...
trash-ui/src/views/activiti/taskhistory/index.vue
1 1 <template>
2 2 <div class="app-container">
  3 + <el-select v-model="queryParams.name" filterable reserve-keyword @change="getList" placeholder="名称">
  4 + <el-option label="全部" value="" />
  5 + <el-option v-for="item in names" :label="item" :value="item" >
  6 + </el-option>
  7 + </el-select>
  8 +
  9 + <!-- <el-select v-model="queryParams.prev" filterable reserve-keyword @change="getList" placeholder="上一节点">
  10 + <el-option label="全部" value="" />
  11 + <el-option v-for="item in depts" :label="item.name" :value="item.name" >
  12 + </el-option>
  13 + </el-select> -->
  14 + <el-select v-model="queryParams.type" filterable reserve-keyword @change="getList">
  15 + <el-option label="全部" value="" />
  16 + <el-option label="建筑垃圾许可证审批" value="workflow_constructsite" />
  17 + <el-option label="消纳合同申报备案" value="workflow_conract" />
  18 + <el-option label="处理场所备案" value="workflow_earthsites" />
  19 + <el-option label="运输企业准入流程" value="workflow_company" />
  20 + <el-option label="运输车辆准入流程" value="workflow_vehicle" />
  21 + <el-option label="驾驶员信息审批" value="workflow_driver" />
  22 + <el-option label="交办案卷" value="workflow_caseoffline" />
  23 + <el-option label="违规案卷处置流程" value="workflow_casefile" />
  24 + <el-option label="平台预警信息" value="violation_warning" />
  25 + <el-option label="办文办事" value="handleAffairs" />
  26 + <el-option label="后勤管理" value="logistics" />
  27 + <el-option label="会议事务" value="conference" />
  28 + <el-option label="假勤管理" value="workflow_leave" />
  29 + <el-option label="纪检督察" value="supervision-gongdi,supervision_anjuan,supervision_company,supervision_xnc" />
  30 + </el-select>
  31 +
3 32  
4 33 <taskCard :task="task" v-for="task in taskList" @sendToParent="showTask"/>
5 34  
... ... @@ -207,6 +236,7 @@ export default {
207 236 company:false,
208 237 driver:false,
209 238 vehicle:false,
  239 + names:null,
210 240 };
211 241 },
212 242 created() {
... ... @@ -232,12 +262,14 @@ export default {
232 262 this.taskList = response.rows;
233 263 this.total = response.total;
234 264 this.loading = false;
  265 + this.names = response.names;
235 266 });
236 267 } else {
237 268 listTask(this.queryParams).then(response => {
238 269 this.taskList = response.rows;
239 270 this.total = response.total;
240 271 this.loading = false;
  272 + this.names = response.names;
241 273 });
242 274 }
243 275 },
... ...
trash-workFlow/src/main/java/com/trash/workflow/controller/WorkflowController.java
... ... @@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestBody;
9 9 import org.springframework.web.bind.annotation.RequestMapping;
10 10 import org.springframework.web.bind.annotation.RestController;
11 11  
  12 +import com.trash.common.annotation.RepeatSubmit;
12 13 import com.trash.common.core.controller.BaseController;
13 14 import com.trash.common.core.domain.AjaxResult;
14 15 import com.trash.common.core.domain.entity.SysUser;
... ... @@ -37,6 +38,7 @@ public class WorkflowController extends BaseController {
37 38 /**
38 39 * 查询请假列表
39 40 */
  41 + @RepeatSubmit
40 42 @RequestMapping("/add")
41 43 public AjaxResult add(@RequestBody Map<String,Object> map) {
42 44 String username = null;
... ... @@ -56,7 +58,6 @@ public class WorkflowController extends BaseController {
56 58 }else{
57 59 return AjaxResult.error("create work flow error");
58 60 }
59   -
60 61 }
61 62  
62 63 /**
... ...
trash-workFlow/src/main/java/com/trash/workflow/listener/baseDataListener.java
... ... @@ -2,6 +2,7 @@ package com.trash.workflow.listener;
2 2  
3 3 import com.trash.office.domain.Conference;
4 4 import com.trash.office.mapper.ConferenceMapper;
  5 +import com.alibaba.fastjson.JSONObject;
5 6 import com.trash.common.utils.RemoteServerUtils;
6 7 import com.trash.common.utils.spring.SpringUtils;
7 8  
... ... @@ -13,11 +14,15 @@ import java.util.Map;
13 14 import org.activiti.engine.delegate.DelegateExecution;
14 15 import org.activiti.engine.delegate.ExecutionListener;
15 16 import org.activiti.engine.delegate.Expression;
  17 +import org.slf4j.Logger;
  18 +import org.slf4j.LoggerFactory;
16 19  
17 20  
18 21 public class baseDataListener implements ExecutionListener {
19 22 private Expression state;
20 23  
  24 + private static final Logger log = LoggerFactory.getLogger(baseDataListener.class);
  25 +
21 26 @Override
22 27 public void notify(DelegateExecution delegateExecution) {
23 28  
... ... @@ -30,16 +35,48 @@ public class baseDataListener implements ExecutionListener {
30 35  
31 36 list.add(map);
32 37  
33   - if(delegateExecution.getProcessInstanceBusinessKey().contains("company")){
34   - RemoteServerUtils.updateCompanyAudit(list);
35   - }
36   - if(delegateExecution.getProcessInstanceBusinessKey().contains("vehicle")){
37   - RemoteServerUtils.updateTruckAudit(list);
38   - }
39   - if(delegateExecution.getProcessInstanceBusinessKey().contains("driver")){
40   - RemoteServerUtils.updateDriverAudit(list);
41   - }
  38 + new Thread(new Runnable() {
  39 +
  40 + @Override
  41 + public void run() {
  42 + while(true){
  43 +
  44 + Object object = null;
  45 +
  46 + if(delegateExecution.getProcessInstanceBusinessKey().contains("company")){
  47 + object = RemoteServerUtils.updateCompanyAudit(list);
  48 + }
  49 + if(delegateExecution.getProcessInstanceBusinessKey().contains("vehicle")){
  50 + object = RemoteServerUtils.updateTruckAudit(list);
  51 + }
  52 + if(delegateExecution.getProcessInstanceBusinessKey().contains("driver")){
  53 + object = RemoteServerUtils.updateDriverAudit(list);
  54 + }
  55 +
  56 + JSONObject jsonObject = (JSONObject)object;
  57 +
  58 + if(jsonObject.getBoolean("result")){
  59 + break;
  60 + }
  61 +
  62 + try {
  63 + log.info("baseDataListener:" + object.toString());
  64 + Thread.sleep(3000);
  65 + } catch (InterruptedException e) {
  66 + // TODO Auto-generated catch block
  67 + e.printStackTrace();
  68 + }
  69 +
  70 + }
  71 +
  72 + }
  73 + }).start();
  74 +
  75 +
42 76  
43 77 workflowUtils.sendDataToHisTory(delegateExecution, state);
44 78 }
  79 +
  80 +
  81 +
45 82 }
... ...