Commit d783f8ed280f584cf09099e77a410e13a851efe2

Authored by youxiw2000
1 parent 3da21a93

m

sql/act_ru_event_subscr.sql 0 → 100644
  1 +/*
  2 + Navicat MySQL Data Transfer
  3 +
  4 + Source Server : mari
  5 + Source Server Type : MariaDB
  6 + Source Server Version : 100508
  7 + Source Host : localhost:3306
  8 + Source Schema : trash
  9 +
  10 + Target Server Type : MariaDB
  11 + Target Server Version : 100508
  12 + File Encoding : 65001
  13 +
  14 + Date: 19/05/2023 12:29:12
  15 +*/
  16 +
  17 +SET NAMES utf8mb4;
  18 +SET FOREIGN_KEY_CHECKS = 0;
  19 +
  20 +-- ----------------------------
  21 +-- Table structure for act_ru_event_subscr
  22 +-- ----------------------------
  23 +DROP TABLE IF EXISTS `act_ru_event_subscr`;
  24 +CREATE TABLE `act_ru_event_subscr` (
  25 + `ID_` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  26 + `REV_` int(11) NULL DEFAULT NULL,
  27 + `EVENT_TYPE_` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  28 + `EVENT_NAME_` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  29 + `EXECUTION_ID_` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  30 + `PROC_INST_ID_` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  31 + `ACTIVITY_ID_` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  32 + `CONFIGURATION_` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  33 + `CREATED_` timestamp(3) NOT NULL DEFAULT current_timestamp,
  34 + `PROC_DEF_ID_` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  35 + `TENANT_ID_` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '',
  36 + PRIMARY KEY (`ID_`) USING BTREE,
  37 + INDEX `ACT_IDX_EVENT_SUBSCR_CONFIG_`(`CONFIGURATION_`) USING BTREE,
  38 + INDEX `ACT_FK_EVENT_EXEC`(`EXECUTION_ID_`) USING BTREE,
  39 + CONSTRAINT `ACT_FK_EVENT_EXEC` FOREIGN KEY (`EXECUTION_ID_`) REFERENCES `act_ru_execution` (`ID_`) ON DELETE RESTRICT ON UPDATE RESTRICT
  40 +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Dynamic;
  41 +
  42 +SET FOREIGN_KEY_CHECKS = 1;
... ...
trash-admin/src/main/resources/application-dev.yml
... ... @@ -16,10 +16,12 @@ trash:
16 16 # 验证码类型 math 数组计算 char 字符验证
17 17 captchaType: math
18 18 # 远程服务器地址
19   - remotePath: http://183.66.242.6:6001
20   - #remotePath: http://183.66.242.6:14601
  19 + remotePath: http://183.66.242.6:6001
21 20 token: durable:auth:token:eyJhbGciOiJIUzUxMiJ9.eyJ5ZWEiOiJjc3poIiwiZXhwIjo0MTAyNDE1OTk5LCJjcmVhdGVkIjoxNjg0MzI3NzQ1ODkyfQ.4BrpgD9i_1TwjLRGqa3wo4Ikx8t8Gcl3FzHfjL_uolPnNMm2rd7fCvrUoBBN4Qp4cMGzg9h2Nt4NNx8PYThTaQ
22   -
  21 + #remotePath: http://183.66.242.6:14601
  22 + #token: durable:auth:token:eyJhbGciOiJIUzUxMiJ9.eyJ5ZWEiOiJjc3poIiwiZXhwIjo0MTAyNDE1OTk5LCJjcmVhdGVkIjoxNjg0NDU5MjEzNzQ2fQ.85oIrOnU7cz7L_-IGt4Bt1LXDTkFtyrdqNt05K0v9-4nsrrzzpbjbemK-yMlbnUpe4Fx2FFES-Wbw8Yr8ML69w
  23 +
  24 +
23 25 # 数据源配置
24 26 spring:
25 27 datasource:
... ...
trash-common/pom.xml
... ... @@ -125,13 +125,6 @@
125 125 <version>[3.20.6.1,)</version>
126 126 </dependency>
127 127  
128   - <!-- kafka -->
129   - <dependency>
130   - <groupId>org.springframework.kafka</groupId>
131   - <artifactId>spring-kafka</artifactId>
132   - <version>1.1.1.RELEASE</version>
133   - </dependency>
134   -
135 128 </dependencies>
136 129  
137 130 </project>
138 131 \ No newline at end of file
... ...
trash-common/src/main/java/com/trash/common/utils/LoginUtils.java 0 → 100644
  1 +package com.trash.common.utils;
  2 +
  3 +public class LoginUtils {
  4 +
  5 +}
... ...
trash-common/src/main/java/com/trash/common/utils/SecurityUtils.java
1 1 package com.trash.common.utils;
2 2  
  3 +import java.util.Collection;
  4 +
  5 +import javax.annotation.Resource;
  6 +
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.security.authentication.AuthenticationManager;
  9 +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
3 10 import org.springframework.security.core.Authentication;
  11 +import org.springframework.security.core.GrantedAuthority;
  12 +import org.springframework.security.core.context.SecurityContext;
4 13 import org.springframework.security.core.context.SecurityContextHolder;
  14 +import org.springframework.security.core.userdetails.UserDetails;
  15 +import org.springframework.security.core.userdetails.UserDetailsService;
5 16 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
6 17  
7 18 import com.trash.common.constant.HttpStatus;
... ... @@ -15,6 +26,14 @@ import com.trash.common.exception.CustomException;
15 26 */
16 27 public class SecurityUtils
17 28 {
  29 +
  30 + @Autowired
  31 + UserDetailsService userDetailsService;
  32 +
  33 + @Resource
  34 + private AuthenticationManager authenticationManager;
  35 +
  36 +
18 37 /**
19 38 * 获取用户账户
20 39 **/
... ... @@ -102,4 +121,10 @@ public class SecurityUtils
102 121 {
103 122 return userId != null && "1".equals(userId);
104 123 }
  124 +
  125 +
  126 +
  127 +
  128 +
  129 +
105 130 }
... ...
trash-common/src/main/java/com/trash/common/utils/file/MimeTypeUtils.java
... ... @@ -26,7 +26,7 @@ public class MimeTypeUtils
26 26  
27 27 public static final String[] DEFAULT_ALLOWED_EXTENSION = {
28 28 // 图片
29   - "bmp", "gif", "jpg", "jpeg", "png",
  29 + "bmp", "gif", "jpg", "jpeg", "png","pdf",
30 30 // word excel powerpoint
31 31 "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt",
32 32 // 压缩文件
... ...
trash-framework/src/main/java/com/trash/framework/web/service/SysLoginService.java
... ... @@ -33,6 +33,7 @@ import com.trash.common.exception.user.CaptchaExpireException;
33 33 import com.trash.common.exception.user.UserPasswordNotMatchException;
34 34 import com.trash.common.utils.MessageUtils;
35 35 import com.trash.common.utils.RemoteServerUtils;
  36 +import com.trash.common.utils.SecurityUtils;
36 37 import com.trash.framework.manager.AsyncManager;
37 38 import com.trash.framework.manager.factory.AsyncFactory;
38 39  
... ...
trash-quartz/src/main/java/com/trash/quartz/task/DriverTask.java
... ... @@ -29,6 +29,7 @@ import com.trash.business.service.ICompanyCreditService;
29 29 import com.trash.business.service.ISupervisionThreestepService;
30 30 import com.trash.business.service.ITruckActivateService;
31 31 import com.trash.business.service.ITruckCreditService;
  32 +import com.trash.casefile.domain.ViolationWarningInformation;
32 33 import com.trash.common.annotation.Log;
33 34 import com.trash.common.config.trashConfig;
34 35 import com.trash.common.utils.LogUtils;
... ... @@ -52,45 +53,49 @@ public class DriverTask
52 53 @Autowired
53 54 private trashConfig trashConfig;
54 55  
55   - public void checkCredit()
56   - {
  56 + public void checkCredit(){
  57 + ViolationWarningInformation violationWarningInformation = new ViolationWarningInformation();
  58 + violationWarningInformation.setSendObject("区管理部门(治)");
  59 + violationWarningInformation.setNumber("123123");
  60 + violationWarningInformation.setId(44444L);
  61 + SpringUtils.getBean(IWorkflowService.class).createCaseFile1(violationWarningInformation,1,1);
57 62  
58   - if(RemoteServerUtils.remote == null){
59   - RemoteServerUtils.remote = trashConfig.getRemotePath();
60   - }
61   - if(TOKEN == null){
62   - TOKEN = trashConfig.getToken();
63   - }
64   -
65   - LogUtils.getBlock("=================== checkCredit 定时器执行 当前时间: " + simpleDateFormat.format(new Date()));
66   -
67   -
68   - try {
69   - checkTruckCredit();
70   - } catch (Exception e) {
71   - e.printStackTrace();
72   - }
73   - try {
74   - checkCompanyCredit();
75   - } catch (Exception e) {
76   - e.printStackTrace();
77   - }
78   - try {
79   -
80   - checkTruckByCompany();
81   - } catch (Exception e) {
82   - e.printStackTrace();
83   - }
84   - try {
85   - checkDriverCredit(); //检查驾驶员信用
86   - } catch (Exception e) {
87   - e.printStackTrace();
88   - }
89   - try {
90   - checkTruckActive();
91   - } catch (Exception e) {
92   - e.printStackTrace();
93   - }
  63 +// if(RemoteServerUtils.remote == null){
  64 +// RemoteServerUtils.remote = trashConfig.getRemotePath();
  65 +// }
  66 +// if(TOKEN == null){
  67 +// TOKEN = trashConfig.getToken();
  68 +// }
  69 +//
  70 +// LogUtils.getBlock("=================== checkCredit 定时器执行 当前时间: " + simpleDateFormat.format(new Date()));
  71 +//
  72 +//
  73 +// try {
  74 +// checkTruckCredit();
  75 +// } catch (Exception e) {
  76 +// e.printStackTrace();
  77 +// }
  78 +// try {
  79 +// checkCompanyCredit();
  80 +// } catch (Exception e) {
  81 +// e.printStackTrace();
  82 +// }
  83 +// try {
  84 +//
  85 +// checkTruckByCompany();
  86 +// } catch (Exception e) {
  87 +// e.printStackTrace();
  88 +// }
  89 +// try {
  90 +// checkDriverCredit(); //检查驾驶员信用
  91 +// } catch (Exception e) {
  92 +// e.printStackTrace();
  93 +// }
  94 +// try {
  95 +// checkTruckActive();
  96 +// } catch (Exception e) {
  97 +// e.printStackTrace();
  98 +// }
94 99  
95 100 }
96 101  
... ...
trash-ui/src/layout/index5.vue renamed to trash-ui/src/layout/index4.vue
trash-ui/src/views/activiti/task/index.vue
... ... @@ -512,6 +512,10 @@ export default {
512 512 this.form[target].splice(this.form[target].indexOf(img), 1);
513 513 },
514 514 uploadSuccess(res, file, fileList) {
  515 + if(res.code){
  516 + this.$message(res.message);
  517 + return;
  518 + }
515 519 let target = "sub_img" + this.picIndex;
516 520 if (!this.form[target]) {
517 521 this.form[target] = [];
... ...
trash-ui/src/views/business/TruckCredit/index.vue
... ... @@ -100,7 +100,7 @@
100 100 </el-form-item>
101 101 <el-form-item label="车牌号码" prop="licensePlate">
102 102 <el-select v-model="form.licensePlate" filterable reserve-keyword placeholder="车牌号码">
103   - <el-option @click.native="getObjId(item)" v-for="item in truckList" :key="item.id" :label="item.licenseplateNo" :value="item.licenseplateNo" v-if="form.companyId==item.companyName">
  103 + <el-option @click.native="getObjId(item)" v-for="item in truckList" :key="item.id" :label="item.licenseplateNo" :value="item.licenseplateNo" v-if="!form.companyId || form.companyId==item.companyName">
104 104 </el-option>
105 105 </el-select>
106 106 </el-form-item>
... ... @@ -309,6 +309,7 @@
309 309 }
310 310 },
311 311 getObjId(a) {
  312 + this.form.companyId = a.companyName;
312 313 this.form.objectId = a.id;
313 314 },
314 315 getList() {
... ...
trash-ui/src/views/business/dayWorkReport/index.vue
... ... @@ -11,8 +11,7 @@
11 11 </el-col>
12 12 </el-row>
13 13  
14   -
15   - <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  14 + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
16 15 <el-form-item label="工地名称" prop="name">
17 16 <el-input v-model="queryParams.name" placeholder="请输入项目名称" size="small"
18 17 />
... ... @@ -49,6 +48,10 @@
49 48 </el-form-item>
50 49 </el-form>
51 50  
  51 +
  52 + <p> {{dayWorkCount}}</p>
  53 +
  54 +
52 55 <el-row :gutter="10" class="mb8">
53 56 <el-col :span="1.5">
54 57 <el-button size="mini" @click="handleExport" v-hasPermi="['business:threestep:export']">导出</el-button>
... ... @@ -160,7 +163,7 @@
160 163 bindname:null,
161 164 projectTypes:null,
162 165 earthsitesTypes:null,
163   -
  166 + dayWorkCount:null,
164 167 outside:["长沙县","望城区","浏阳市","宁乡市","株洲市","湘潭市","汩罗市","湘阴县"],
165 168 };
166 169 },
... ... @@ -239,7 +242,18 @@
239 242  
240 243 constructionsitesList(this.remoteQueryData).then(res => {
241 244 this.constructionsitesList = res.result.list;
  245 +
  246 + let count = 0;
  247 + let count1 = 0;
  248 +
242 249 for(let i =0;i< this.threestepList.length;i++){
  250 +
  251 + if(this.threestepList[i].status == "开工"){
  252 + count += 1;
  253 + }
  254 + if(this.threestepList[i].estatus == "开工"){
  255 + count1 += 1;
  256 + }
243 257 for(let j =0;j<this.constructionsitesList.length;j++){
244 258 if(this.threestepList[i].objectId == this.constructionsitesList[j].id){
245 259 for(let x in this.projectTypes){
... ... @@ -250,6 +264,14 @@
250 264 }
251 265 }
252 266 }
  267 +
  268 +
  269 + let str = "今日";
  270 + if(this.queryParams.his){
  271 + str = "";
  272 + }
  273 +
  274 + this.dayWorkCount = str + "长沙市工地开工数量:" + count + " " + str +"长沙市消纳场开工数量:" + count1;
253 275 this.loading = false;
254 276 });
255 277  
... ...
trash-ui/src/views/business/threestep/index.vue
... ... @@ -125,7 +125,7 @@
125 125 <el-form-item :label="labelName" prop="name">
126 126 <el-select v-model="form.name" filterable reserve-keyword>
127 127 <el-option @click.native="getObjId(item)" v-for="item in remoteData" :label="item.name"
128   - :value="item.name" :key="item.id" v-if="areaCode == null || item.areaCode == areaCode">
  128 + :value="item.name" :key="item.id" v-if="!form.place || item.areaCode == form.place">
129 129 </el-option>
130 130 </el-select>
131 131 </el-form-item>
... ... @@ -501,7 +501,7 @@
501 501 ]
502 502 },
503 503 SiteWorkAreaCodeType: [],
504   - remoteData: [{name:"a",id:"id"}],
  504 + remoteData: [],
505 505 remoteQueryData: {
506 506 "page": 1,
507 507 "size": 9999,
... ... @@ -510,7 +510,7 @@
510 510 },
511 511 areas: [],
512 512 areaCode: null,
513   - bindData: [{name:"a",id:"id"}],
  513 + bindData: [],
514 514 bindname:null,
515 515 transportCompanyId:null,
516 516 };
... ... @@ -697,7 +697,10 @@
697 697 },
698 698  
699 699 uploadSuccess(res, file, fileList) {
700   -
  700 + if(res.code){
  701 + this.$message(res.message);
  702 + return;
  703 + }
701 704 if(this.picIndex > 90){
702 705 let target = "attchItem" + (this.picIndex-90);
703 706 if (!this.form[target]) {
... ... @@ -741,6 +744,7 @@
741 744 handleClose() {
742 745 this.uploadImageDialog = false;
743 746 this.fileList = [];
  747 + this.reset();
744 748 },
745 749 selectType(value) {
746 750 if (value == "0") {
... ...
trash-ui/src/views/caseOffline/caseOffline/index.vue
... ... @@ -442,6 +442,10 @@ export default {
442 442 this.$forceUpdate();
443 443 },
444 444 uploadSuccess(res, file, fileList) {
  445 + if(res.code){
  446 + this.$message(res.message);
  447 + return;
  448 + }
445 449 if(!this.form.attach){
446 450 this.form.attach = [];
447 451 }
... ...
trash-ui/src/views/daily/information_sharing/index.vue
... ... @@ -244,6 +244,10 @@ export default {
244 244 this.resetForm("form");
245 245 },
246 246 uploadSuccess(res, file, fileList) {
  247 + if(res.code){
  248 + this.$message(res.message);
  249 + return;
  250 + }
247 251 this.fileList = [];
248 252  
249 253 this.fileList.push(file);
... ...
trash-ui/src/views/daily/report/index.vue
... ... @@ -253,6 +253,11 @@ export default {
253 253 });
254 254 },
255 255 uploadSuccess(res, file, fileList) {
  256 +
  257 + if(res.code){
  258 + this.$message(res.message);
  259 + return;
  260 + }
256 261 this.fileList = [];
257 262  
258 263 this.fileList.push(file);
... ...
trash-ui/src/views/h5/task/index.vue
... ... @@ -375,6 +375,10 @@ import { getSignByObjId, addSign, updateSign } from &quot;@/api/sign/sign&quot;;
375 375 this.form[target].splice(this.form[target].indexOf(img), 1);
376 376 },
377 377 uploadSuccess(res, file, fileList) {
  378 + if(res.code){
  379 + this.$message(res.message);
  380 + return;
  381 + }
378 382 let target = "sub_img" + this.picIndex;
379 383 if (!this.form[target]) {
380 384 this.form[target] = [];
... ...
trash-ui/src/views/otherData/otherData/index.vue
... ... @@ -367,6 +367,10 @@ export default {
367 367 this.$forceUpdate();
368 368 },
369 369 uploadSuccess(res, file, fileList) {
  370 + if(res.code){
  371 + this.$message(res.message);
  372 + return;
  373 + }
370 374 if(!this.form.attach){
371 375 this.form.attach = [];
372 376 }
... ...
trash-workFlow/pom.xml
... ... @@ -26,5 +26,14 @@
26 26 <artifactId>gson</artifactId>
27 27 <version>2.3.1</version>
28 28 </dependency>
  29 +
  30 + <!-- kafka -->
  31 + <dependency>
  32 + <groupId>org.springframework.kafka</groupId>
  33 + <artifactId>spring-kafka</artifactId>
  34 + <version>1.1.1.RELEASE</version>
  35 + </dependency>
  36 +
  37 +
29 38 </dependencies>
30 39 </project>
31 40 \ No newline at end of file
... ...
trash-workFlow/src/main/java/com/trash/casefile/kafka/Consumer.java
... ... @@ -29,20 +29,20 @@ import java.util.Map;
29 29 public class Consumer {
30 30 private static final Logger log = LoggerFactory.getLogger(Consumer.class);
31 31  
32   - @Autowired
33   - private IViolationWarningInformationService violationWarningInformationService;
34   -
35   - @KafkaListener(topics="record_process_alarm")
36   - public void consume(@Payload String data) {
37   - log.info("kafka消费数据成功,data:" + data);
38   - autoViolationWarning(data);
39   - }
40   -
41   - @Autowired
42   - trashConfig trashConfig;
43   -
44   - @Autowired
45   - SysLoginService loginService;
  32 +// @Autowired
  33 +// private IViolationWarningInformationService violationWarningInformationService;
  34 +//
  35 +// @KafkaListener(topics="record_process_alarm")
  36 +// public void consume(@Payload String data) {
  37 +// log.info("kafka消费数据成功,data:" + data);
  38 +// autoViolationWarning(data);
  39 +// }
  40 +//
  41 +// @Autowired
  42 +// trashConfig trashConfig;
  43 +//
  44 +// @Autowired
  45 +// SysLoginService loginService;
46 46  
47 47 public void autoViolationWarning(String data) {
48 48 // String[] code = {"44030020=工地预警-未报开工作业","44030021=工地预警-视频设备离线超时报警","44030022=工地预警-三无车辆进入工地","44030023=工地预警未按时间作业",
... ...
trash-workFlow/src/main/java/com/trash/workflow/service/impl/WorkflowServiceImpl.java
... ... @@ -5,11 +5,15 @@ import java.util.List;
5 5 import java.util.Map;
6 6 import java.util.stream.Collectors;
7 7  
  8 +import javax.annotation.Resource;
  9 +
8 10 import com.trash.casefile.domain.ViolationWarningInformation;
9 11 import com.trash.common.config.trashConfig;
  12 +import com.trash.common.core.domain.model.LoginUser;
10 13 import com.trash.framework.web.service.SysLoginService;
11 14 import org.activiti.api.process.model.ProcessInstance;
12 15 import org.activiti.api.process.model.builders.ProcessPayloadBuilder;
  16 +import org.activiti.api.process.model.payloads.StartProcessPayload;
13 17 import org.activiti.api.process.runtime.ProcessRuntime;
14 18 import org.activiti.api.task.runtime.TaskRuntime;
15 19 import org.activiti.engine.RuntimeService;
... ... @@ -19,6 +23,9 @@ import org.activiti.engine.task.IdentityLinkType;
19 23 import org.activiti.engine.task.Task;
20 24 import org.apache.commons.collections4.map.HashedMap;
21 25 import org.springframework.beans.factory.annotation.Autowired;
  26 +import org.springframework.security.authentication.AuthenticationManager;
  27 +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
  28 +import org.springframework.security.core.Authentication;
22 29 import org.springframework.stereotype.Service;
23 30 import org.springframework.transaction.annotation.Transactional;
24 31  
... ... @@ -259,7 +266,13 @@ public class WorkflowServiceImpl implements IWorkflowService {
259 266 return 0;
260 267  
261 268 }
262   -
  269 +
  270 + @Resource
  271 + private AuthenticationManager authenticationManager;
  272 +
  273 + @Autowired
  274 + RuntimeService runtimeService;
  275 +
263 276 @Override
264 277 @Transactional
265 278 public int createCaseFile1(ViolationWarningInformation caseFile, int index,int isAuto){ //违规预警案卷
... ... @@ -267,30 +280,34 @@ public class WorkflowServiceImpl implements IWorkflowService {
267 280 if(StringUtils.isEmpty(RemoteServerUtils.remote)){
268 281 RemoteServerUtils.remote = trashConfig.getRemotePath();
269 282 }
270   - loginService.loginByRemote(trashConfig.getToken());
  283 + LoginUser user = loginService.loginByRemote(trashConfig.getToken());
  284 + org.activiti.engine.impl.identity.Authentication.setAuthenticatedUserId(user.getUsername());
271 285 }
272   - ProcessInstance processInstance = null;
  286 +
  287 +
  288 + org.activiti.engine.runtime.ProcessInstance instance = null;
273 289 String title = "案卷号:" + caseFile.getNumber();
274 290 String flowType = "violation_warning";
275 291 try {
276   -
277   - processInstance = processRuntime.start(ProcessPayloadBuilder
278   - .start()
279   - .withProcessDefinitionKey(flowType)
280   - .withName(title)
281   - .withBusinessKey(flowType + ":" + caseFile.getId())
282   - .withVariable("route", index)
283   - .build());
284   -
  292 +
  293 + instance = runtimeService.createProcessInstanceBuilder().businessKey(flowType + ":" + caseFile.getId()).variable("route", index).processDefinitionKey(flowType).start();
  294 +
  295 +
  296 + Map map = new HashedMap<>();
  297 +
  298 + map.put("route", index);
  299 +
  300 + runtimeService.startProcessInstanceById(instance.getProcessDefinitionId(),map);
  301 +
285 302  
286 303 if(index == 0){
287   - Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
  304 + Task task = taskService.createTaskQuery().processInstanceId(instance.getId()).singleResult();
288 305  
289 306 task.setAssignee(caseFile.getCompanyName());
290 307  
291 308 taskService.saveTask(task);
292 309 }else{
293   - updateProcess(processInstance,caseFile.getOwningRegion());
  310 + updateProcess(instance,caseFile.getOwningRegion());
294 311 }
295 312  
296 313  
... ... @@ -302,12 +319,12 @@ public class WorkflowServiceImpl implements IWorkflowService {
302 319 workflow.setStartTime(sdf.format(caseFile.getCreateTime()));
303 320 workflow.setEndTime(sdf.format(caseFile.getCreateTime()));
304 321 workflow.setType("违规预警信息案卷");
305   - workflow.setInstanceId(processInstance.getId());
  322 + workflow.setInstanceId(instance.getId());
306 323 workflow.setState("0");
307 324  
308 325 return workflowMapper.insertWorkflow(workflow);
309 326 } catch (Exception e) {
310   - processRuntime.delete(ProcessPayloadBuilder.delete(processInstance));
  327 + runtimeService.deleteProcessInstance(instance.getId(), "创建失败");
311 328 throw new RuntimeException(e);
312 329 }
313 330  
... ... @@ -376,6 +393,51 @@ public class WorkflowServiceImpl implements IWorkflowService {
376 393  
377 394 }
378 395  
  396 + void updateProcess(org.activiti.engine.runtime.ProcessInstance processInstance,String placeName){
  397 + Map map = new HashedMap<>();
  398 +
  399 + map.put("type", "CSUserDepartmentType");
  400 +
  401 + JSONArray array2 = RemoteServerUtils.getDict(map);
  402 +
  403 + String placeCode = null;
  404 + String code = null;
  405 +
  406 + for(Object obj:array2){
  407 + if(((JSONObject)obj).getString("name").equals("渣土办")){
  408 + code = ((JSONObject)(obj)).getString("code");
  409 + }
  410 + if(((JSONObject)obj).getString("name").replace("渣土办", "").equals(placeName)){
  411 + placeCode = ((JSONObject)(obj)).getString("code");
  412 +
  413 + if(code != null){
  414 + break;
  415 + }
  416 + }
  417 +
  418 + }
  419 +
  420 + if(placeCode != null){
  421 + Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
  422 +
  423 +
  424 + List<IdentityLink> list = taskService.getIdentityLinksForTask(task.getId());
  425 +
  426 + for(IdentityLink identityLink:list){
  427 +// if(identityLink.getGroupId() != null)
  428 +// taskService.deleteGroupIdentityLink(task.getId(), identityLink.getGroupId(), identityLink.getType());
  429 + if(identityLink.getUserId() != null)
  430 + taskService.deleteUserIdentityLink(task.getId(), identityLink.getUserId(), identityLink.getType());
  431 + }
  432 +
  433 + taskService.addCandidateUser(task.getId(), placeCode);
  434 +
  435 + task.setDescription(placeCode);
  436 +
  437 + taskService.saveTask(task);
  438 + }
  439 + }
  440 +
379 441 void updateProcess(ProcessInstance processInstance,String placeName){
380 442 Map map = new HashedMap<>();
381 443  
... ...