Commit b62eb65296822f540be065ed566b789bc6388f59

Authored by 273548560@qq.com
1 parent 1cda9357

修复bug

trash-common/src/main/java/com/trash/common/utils/RemoteServerUtils.java
@@ -53,8 +53,9 @@ public class RemoteServerUtils { @@ -53,8 +53,9 @@ public class RemoteServerUtils {
53 public static String UpdateEarthSiteRequestPath = "/api/siteservice/cs/earthsites/status"; 53 public static String UpdateEarthSiteRequestPath = "/api/siteservice/cs/earthsites/status";
54 54
55 public static String UpdateConractRequestPath = "/api/siteservice/cs/sitecontract/audit/status"; 55 public static String UpdateConractRequestPath = "/api/siteservice/cs/sitecontract/audit/status";
56 -  
57 - 56 +
  57 + public static String BasevehicleInfo = "/api/gpsservice/cs/basevehicle/";
  58 +
58 public static JSONArray getEarthSitesList(Map map){ 59 public static JSONArray getEarthSitesList(Map map){
59 JSONArray list=null; 60 JSONArray list=null;
60 Object object = post(EarthSitesList,map); 61 Object object = post(EarthSitesList,map);
@@ -534,7 +535,18 @@ public class RemoteServerUtils { @@ -534,7 +535,18 @@ public class RemoteServerUtils {
534 535
535 return null; 536 return null;
536 } 537 }
  538 + public static JSONObject getBasevehicleInfo(String id,String token) {
  539 + JSONObject turckList=null;
  540 + Object object = get(BasevehicleInfo + id,null,token);
537 541
  542 + if(object != null){
  543 + turckList = JSON.parseObject(object.toString());
  544 + return turckList;
  545 + }
  546 +
  547 + return turckList;
  548 +
  549 + }
538 550
539 551
540 } 552 }
trash-ui/src/views/casefile/violationCaseFile/index.vue
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 <el-input 29 <el-input
30 v-model="queryParams.projectName" 30 v-model="queryParams.projectName"
31 placeholder="请输入项目名称" 31 placeholder="请输入项目名称"
32 - 32 +
33 size="small" 33 size="small"
34 34
35 /> 35 />
@@ -385,16 +385,10 @@ export default { @@ -385,16 +385,10 @@ export default {
385 {code:29,name:"其他5"}], 385 {code:29,name:"其他5"}],
386 386
387 projectNameList:[ 387 projectNameList:[
388 - {name:"项目1"},  
389 - {name:"项目2"},  
390 - {name:"项目3"},  
391 ], 388 ],
392 isLoading: false, 389 isLoading: false,
393 fileEntityList:[], 390 fileEntityList:[],
394 companyList:[ 391 companyList:[
395 - {name:"公司1"},  
396 - {name:"公司2"},  
397 - {name:"公司3"},  
398 ], 392 ],
399 remoteQueryData: { 393 remoteQueryData: {
400 "page": 1, 394 "page": 1,
@@ -415,10 +409,10 @@ export default { @@ -415,10 +409,10 @@ export default {
415 409
416 410
417 constructionsitesList(this.remoteQueryData).then(res => { 411 constructionsitesList(this.remoteQueryData).then(res => {
418 - this.data = res.result.list; 412 + this.projectNameList = res.result.list;
419 earthsitesList(this.remoteQueryData).then(res => { 413 earthsitesList(this.remoteQueryData).then(res => {
420 for(var i in res.result.list){ 414 for(var i in res.result.list){
421 - this.data.push(res.result.list[i]); 415 + this.projectNameList.push(res.result.list[i]);
422 } 416 }
423 }); 417 });
424 }); 418 });
trash-ui/src/views/casefile/violationWarningInformation/index.vue
@@ -91,6 +91,7 @@ @@ -91,6 +91,7 @@
91 <el-table-column label="违规类型" align="center" prop="violationType" /> 91 <el-table-column label="违规类型" align="center" prop="violationType" />
92 <el-table-column label="项目名称" align="center" prop="projectName" /> 92 <el-table-column label="项目名称" align="center" prop="projectName" />
93 <el-table-column label="企业名称" align="center" prop="companyName" /> 93 <el-table-column label="企业名称" align="center" prop="companyName" />
  94 + <el-table-column label="日期" align="center" prop="createTime"/>
94 <el-table-column label="审批状态" align="center" prop="status"> 95 <el-table-column label="审批状态" align="center" prop="status">
95 <template slot-scope="scope"> 96 <template slot-scope="scope">
96 <span>{{parseStatus(scope.row.status) }}</span> 97 <span>{{parseStatus(scope.row.status) }}</span>
@@ -198,7 +199,7 @@ @@ -198,7 +199,7 @@
198 <el-row> 199 <el-row>
199 <el-col :span="22"> 200 <el-col :span="22">
200 <el-form-item label="违规描述" prop="describe"> 201 <el-form-item label="违规描述" prop="describe">
201 - <el-input v-model="form.describe" type="textarea" placeholder="请输入内容" :row="4"/> 202 + <el-input v-model="form.describe" type="textarea" placeholder="请输入内容" :rows="4"/>
202 </el-form-item> 203 </el-form-item>
203 </el-col> 204 </el-col>
204 </el-row> 205 </el-row>
@@ -332,47 +333,26 @@ export default { @@ -332,47 +333,26 @@ export default {
332 { required: true, message: "必填", trigger: "blur" } 333 { required: true, message: "必填", trigger: "blur" }
333 ], 334 ],
334 }, 335 },
335 - caseType:[{code:0,name:"进入非专用车辆"},  
336 - {code:1,name:"无许可手续(工)"},  
337 - {code:2,name:"无许可手续(消)"},  
338 - {code:3,name:"黄土覆盖情况"},  
339 - {code:4,name:"出入口路面污染"},  
340 - {code:5,name:"出入口道路硬化"},  
341 - {code:6,name:"车辆冲洗是否到位"},  
342 - {code:7,name:"雾炮机是否正常开启"},  
343 - {code:8,name:"使用费专用车运输"},  
344 - {code:9,name:"监控点位未对准"},  
345 - {code:10,name:"未报开工作业"},  
346 - {code:11,name:"视频设备离线超时报警"},  
347 - {code:12,name:"三无车辆进入工地"},  
348 - {code:13,name:"未按时间作业"},  
349 - {code:14,name:"未报开工作业"},  
350 - {code:15,name:"视频设备离线超时报警"},  
351 - {code:16,name:"三无车辆进入消纳场"},  
352 - {code:17,name:"未到指定的消纳场作业"},  
353 - {code:18,name:"离线运输报警(工)"},  
354 - {code:19,name:"离线运输报警(消)"},  
355 - {code:20,name:"未激活车辆作业"},  
356 - {code:21,name:"未核准作业车辆作业"},  
357 - {code:22,name:"未按线路行驶"},  
358 - {code:23,name:"闯禁行驶"},  
359 - {code:24,name:"失信车辆作业"},  
360 - {code:25,name:"其他1"},  
361 - {code:26,name:"其他2"},  
362 - {code:27,name:"其他3"},  
363 - {code:28,name:"其他4"},  
364 - {code:29,name:"其他5"}], 336 + caseType:[{code:0,name:"工地预警-未报开工作业"},
  337 + {code:1,name:"工地预警-视频设备离线超时报警"},
  338 + {code:2,name:"工地预警-三无车辆进入工地"},
  339 + {code:3,name:"工地预警未按时间作业"},
  340 + {code:4,name:"消纳场预警-未报开工作业"},
  341 + {code:5,name:"消纳场预警-视频设备离线超时报警"},
  342 + {code:6,name:"消纳场预警-三无车辆进入消纳场"},
  343 + {code:7,name:"消纳场预警-未到指定的消纳场作业"},
  344 + {code:8,name:"离线运输报警(工)"},
  345 + {code:9,name:"离线运输报警(消)"},
  346 + {code:10,name:"未激活车辆作业"},
  347 + {code:11,name:"未核准作业车辆作业"},
  348 + {code:12,name:"未按线路行驶"},
  349 + {code:13,name:"闯禁行驶"},
  350 + {code:14,name:"失信车辆作业"}],
365 projectNameList:[ 351 projectNameList:[
366 - {name:"项目1"},  
367 - {name:"项目2"},  
368 - {name:"项目3"},  
369 ], 352 ],
370 isLoading: false, 353 isLoading: false,
371 fileEntityList:[], 354 fileEntityList:[],
372 companyList:[ 355 companyList:[
373 - {name:"公司1"},  
374 - {name:"公司2"},  
375 - {name:"公司3"},  
376 ], 356 ],
377 remoteQueryData: { 357 remoteQueryData: {
378 "page": 1, 358 "page": 1,
@@ -393,14 +373,15 @@ export default { @@ -393,14 +373,15 @@ export default {
393 373
394 374
395 constructionsitesList(this.remoteQueryData).then(res => { 375 constructionsitesList(this.remoteQueryData).then(res => {
396 - this.data = res.result.list; 376 + this.projectNameList = res.result.list;
397 earthsitesList(this.remoteQueryData).then(res => { 377 earthsitesList(this.remoteQueryData).then(res => {
398 for(var i in res.result.list){ 378 for(var i in res.result.list){
399 - this.data.push(res.result.list[i]); 379 + this.projectNameList.push(res.result.list[i]);
400 } 380 }
401 }); 381 });
402 }); 382 });
403 383
  384 + console.log(this.data);
404 385
405 companyList(this.remoteQueryData).then(res => { 386 companyList(this.remoteQueryData).then(res => {
406 this.companyList = res.result.list; 387 this.companyList = res.result.list;
trash-ui/src/views/casefile/violationWarningInformation/violationWarningInformationInfo.vue
@@ -68,18 +68,13 @@ @@ -68,18 +68,13 @@
68 </el-col> 68 </el-col>
69 <el-col :span="11"> 69 <el-col :span="11">
70 <el-form-item label="接收人" prop="receive"> 70 <el-form-item label="接收人" prop="receive">
71 - <el-input :value="form.receive!=null?form.receive:'' + form.receiveStatus!=null?form.receiveStatus:''" 71 + <el-input :value="form.readBy!=null?form.readBy:''"
72 :disabled="true"/> 72 :disabled="true"/>
73 </el-form-item> 73 </el-form-item>
74 </el-col> 74 </el-col>
75 </el-row> 75 </el-row>
76 <el-row :gutter="2"> 76 <el-row :gutter="2">
77 <el-col :span="11"> 77 <el-col :span="11">
78 - <el-form-item label="阅读人" prop="createBy">  
79 - <el-input :value="form.readBy" :disabled="true"/>  
80 - </el-form-item>  
81 - </el-col>  
82 - <el-col :span="11">  
83 <el-form-item label="阅读时间" prop="createBy"> 78 <el-form-item label="阅读时间" prop="createBy">
84 <el-input :value="form.readTime" :disabled="true"/> 79 <el-input :value="form.readTime" :disabled="true"/>
85 </el-form-item> 80 </el-form-item>
@@ -88,7 +83,7 @@ @@ -88,7 +83,7 @@
88 <el-row> 83 <el-row>
89 <el-col :span="22"> 84 <el-col :span="22">
90 <el-form-item label="违规描述" prop="describe"> 85 <el-form-item label="违规描述" prop="describe">
91 - <el-input v-model="form.describe" type="textarea" placeholder="请输入内容" :row="4" :disabled="true"/> 86 + <el-input v-model="form.describe" type="textarea" placeholder="请输入内容" :rows="5" :disabled="true"/>
92 </el-form-item> 87 </el-form-item>
93 </el-col> 88 </el-col>
94 </el-row> 89 </el-row>
@@ -189,7 +184,7 @@ export default { @@ -189,7 +184,7 @@ export default {
189 let files = JSON.stringify(response.data.uploadFiles); 184 let files = JSON.stringify(response.data.uploadFiles);
190 this.fileEntityList = JSON.parse(files.replaceAll("filePath", "url").replaceAll("fileName", "name")); 185 this.fileEntityList = JSON.parse(files.replaceAll("filePath", "url").replaceAll("fileName", "name"));
191 }); 186 });
192 - listReplyApprovalProcess({tableName:"workflow_casefile" + ":" + this.idInfo}).then(response => { 187 + listReplyApprovalProcess({tableName:"violation_warning" + ":" + this.idInfo}).then(response => {
193 this.replyApprovalProcessList = response.rows; 188 this.replyApprovalProcessList = response.rows;
194 }); 189 });
195 }, 190 },
trash-workFlow/src/main/java/com/trash/casefile/domain/ViolationWarningInformation.java
@@ -106,6 +106,15 @@ public class ViolationWarningInformation extends BaseEntity { @@ -106,6 +106,15 @@ public class ViolationWarningInformation extends BaseEntity {
106 @Excel(name = "阅览时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") 106 @Excel(name = "阅览时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
107 private Date readTime; 107 private Date readTime;
108 108
  109 + private String abbreviation;
  110 +
  111 + public String getAbbreviation() {
  112 + return abbreviation;
  113 + }
  114 +
  115 + public void setAbbreviation(String abbreviation) {
  116 + this.abbreviation = abbreviation;
  117 + }
109 118
110 public void setId(Long id) { 119 public void setId(Long id) {
111 this.id = id; 120 this.id = id;
trash-workFlow/src/main/java/com/trash/casefile/kafka/Consumer.java
@@ -3,11 +3,14 @@ package com.trash.casefile.kafka; @@ -3,11 +3,14 @@ package com.trash.casefile.kafka;
3 import com.alibaba.fastjson.JSONArray; 3 import com.alibaba.fastjson.JSONArray;
4 import com.alibaba.fastjson.JSONObject; 4 import com.alibaba.fastjson.JSONObject;
5 import com.trash.casefile.domain.ViolationWarningInformation; 5 import com.trash.casefile.domain.ViolationWarningInformation;
  6 +import com.trash.casefile.mapper.ViolationWarningInformationMapper;
6 import com.trash.casefile.service.IViolationWarningInformationService; 7 import com.trash.casefile.service.IViolationWarningInformationService;
7 import com.trash.common.config.trashConfig; 8 import com.trash.common.config.trashConfig;
  9 +import com.trash.common.core.redis.RedisCache;
8 import com.trash.common.utils.DateUtils; 10 import com.trash.common.utils.DateUtils;
9 import com.trash.common.utils.RemoteServerUtils; 11 import com.trash.common.utils.RemoteServerUtils;
10 import com.trash.common.utils.StringUtils; 12 import com.trash.common.utils.StringUtils;
  13 +import com.trash.common.utils.spring.SpringUtils;
11 import com.trash.framework.web.service.SysLoginService; 14 import com.trash.framework.web.service.SysLoginService;
12 import org.apache.commons.lang3.time.DateFormatUtils; 15 import org.apache.commons.lang3.time.DateFormatUtils;
13 import org.slf4j.Logger; 16 import org.slf4j.Logger;
@@ -20,10 +23,8 @@ import org.springframework.messaging.handler.annotation.Payload; @@ -20,10 +23,8 @@ import org.springframework.messaging.handler.annotation.Payload;
20 import org.springframework.stereotype.Component; 23 import org.springframework.stereotype.Component;
21 24
22 import java.io.IOException; 25 import java.io.IOException;
23 -import java.util.ArrayList;  
24 -import java.util.Date;  
25 -import java.util.List;  
26 -import java.util.Map; 26 +import java.util.*;
  27 +import java.util.concurrent.TimeUnit;
27 28
28 @Component 29 @Component
29 public class Consumer { 30 public class Consumer {
@@ -32,7 +33,7 @@ public class Consumer { @@ -32,7 +33,7 @@ public class Consumer {
32 @Autowired 33 @Autowired
33 private IViolationWarningInformationService violationWarningInformationService; 34 private IViolationWarningInformationService violationWarningInformationService;
34 35
35 - @KafkaListener(topics="record_process_alarm") 36 + @KafkaListener(topics = "record_process_alarm")
36 public void consume(@Payload String data) { 37 public void consume(@Payload String data) {
37 log.info("kafka消费数据成功,data:" + data); 38 log.info("kafka消费数据成功,data:" + data);
38 autoViolationWarning(data); 39 autoViolationWarning(data);
@@ -44,92 +45,120 @@ public class Consumer { @@ -44,92 +45,120 @@ public class Consumer {
44 @Autowired 45 @Autowired
45 SysLoginService loginService; 46 SysLoginService loginService;
46 47
  48 + @Autowired
  49 + RedisCache redisCache;
  50 +
47 public void autoViolationWarning(String data) { 51 public void autoViolationWarning(String data) {
48 -// String[] code = {"44030020=工地预警-未报开工作业","44030021=工地预警-视频设备离线超时报警","44030022=工地预警-三无车辆进入工地","44030023=工地预警未按时间作业",  
49 -// "44030024=消纳场预警-未报开工作业","44030025=消纳场预警-视频设备离线超时报警","44030026=消纳场预警-三无车辆进入消纳场","44030027=消纳场预警-未到指定的消纳场作业",  
50 -// "44030028=离线运输报警(工)","44030029=离线运输报警(消)","44030030=未激活车辆作业","44030031=未核准作业车辆作业","44030032=未按线路行驶",  
51 -// "44030033=闯禁行驶","44030034=失信车辆作业"};  
52 -// JSONObject jsonObject = JSONObject.parseObject(data);  
53 -// ViolationWarningInformation violationWarningInformation = new ViolationWarningInformation();  
54 -// String siteType = jsonObject.getString("siteType");  
55 -//  
56 -//  
57 -// if(StringUtils.isEmpty(RemoteServerUtils.remote)){  
58 -// RemoteServerUtils.remote = trashConfig.getRemotePath();  
59 -// }  
60 -// loginService.loginByRemote(trashConfig.getToken());  
61 -// JSONArray jsonArray = RemoteServerUtils.getAreas(trashConfig.getToken());  
62 -// if("1".equals(siteType)){//工地  
63 -// violationWarningInformation.setViolationObjectType("0");  
64 -// JSONObject object = RemoteServerUtils.getConstructionInfo(jsonObject.getString("siteId"),trashConfig.getToken());  
65 -// String areaCode = object.get("areaCode").toString();  
66 -// for(Object areasObject:jsonArray){  
67 -// JSONObject areas = (JSONObject) areasObject;  
68 -// if(areaCode.equals(areas.getString("code"))){  
69 -// violationWarningInformation.setOwningRegion(areas.getString("name"));  
70 -// break;  
71 -// }  
72 -// }  
73 -// }else if("2".equals(siteType)){//消纳场  
74 -// violationWarningInformation.setViolationObjectType("1");  
75 -// JSONObject object = RemoteServerUtils.getEarthSitesInfo(jsonObject.getString("siteId"),trashConfig.getToken());  
76 -// String areaCode = object.get("areaCode").toString();  
77 -// for(Object areasObject:jsonArray){  
78 -// JSONObject areas = (JSONObject) areasObject;  
79 -// if(areaCode.equals(areas.getString("code"))){  
80 -// violationWarningInformation.setOwningRegion(areas.getString("name"));  
81 -// break;  
82 -// }  
83 -// }  
84 -// }  
85 -// String number = DateFormatUtils.format(new Date(), "yyyyMMddHHmmssSSS");  
86 -// violationWarningInformation.setNumber(number.substring(2, number.length()));  
87 -// violationWarningInformation.setCompanyName(jsonObject.getString("enterpriseName"));  
88 -// String violationTypeCode = jsonObject.getString("alarmType");  
89 -// for (int i = 0; i < code.length; i++) {  
90 -// if (violationTypeCode.equals(code[i].split("=")[0])) {  
91 -// violationWarningInformation.setViolationType(code[i].split("=")[1]);  
92 -// break;  
93 -// }  
94 -// }  
95 -// //发送人  
96 -// violationWarningInformation.setCreateBy("长沙市建筑垃圾智慧监管平台");  
97 -// //推送对象  
98 -// violationWarningInformation.setViolationGrade("一般类");  
99 -// switch (violationWarningInformation.getViolationType()){  
100 -// case "工地预警-未报开工作业":  
101 -// case "消纳场预警-未到指定的消纳场作业":  
102 -// case "消纳场预警-三无车辆进入消纳场":  
103 -// case "消纳场预警-未报开工作业":  
104 -// case "工地预警未按时间作业":  
105 -// case "工地预警-三无车辆进入工地":  
106 -// case "工地预警-视频设备离线超时报警":  
107 -// case "离线运输报警(消)":  
108 -// case "离线运输报警(工)":  
109 -// case "未激活车辆作业":  
110 -// case "未核准作业车辆作业":  
111 -// violationWarningInformation.setSendObject("区管理部门(治)");  
112 -// break;  
113 -// case "消纳场预警-视频设备离线超时报警":  
114 -// violationWarningInformation.setSendObject("区管理部门(消)");  
115 -// break;  
116 -// case "未按线路行驶":  
117 -// violationWarningInformation.setViolationGrade("重点类");  
118 -// violationWarningInformation.setSendObject("区管理部门(治)");  
119 -// break;  
120 -// case "闯禁行驶":  
121 -// case "失信车辆作业":  
122 -// violationWarningInformation.setSendObject("运输企业");  
123 -// violationWarningInformation.setCompanyName(jsonObject.getString("enterpriseName"));  
124 -// break;  
125 -// }  
126 -//  
127 -// // 业务逻辑  
128 -// try {  
129 -// violationWarningInformationService.insertViolationWarningInformation(null,violationWarningInformation);  
130 -// } catch (IOException e) {  
131 -// e.printStackTrace();  
132 -// } 52 + String[] code = {"44030020=工地预警-未报开工作业", "44030021=工地预警-视频设备离线超时报警", "44030022=工地预警-三无车辆进入工地", "44030023=工地预警未按时间作业",
  53 + "44030024=消纳场预警-未报开工作业", "44030025=消纳场预警-视频设备离线超时报警", "44030026=消纳场预警-三无车辆进入消纳场", "44030027=消纳场预警-未到指定的消纳场作业",
  54 + "44030028=离线运输报警(工)", "44030029=离线运输报警(消)", "44030030=未激活车辆作业", "44030031=未核准作业车辆作业", "44030032=未按线路行驶",
  55 + "44030033=闯禁行驶", "44030034=失信车辆作业"};
  56 + JSONObject jsonObject = JSONObject.parseObject(data);
  57 + String nowDate = DateFormatUtils.format(new Date(), "yyyy-MM-dd");
  58 + String tomorrowDate = DateFormatUtils.format(DateUtils.addDays(new Date(), 1), "yyyy-MM-dd");
  59 + String violationType = jsonObject.getString("alarmName");
  60 + if(RemoteServerUtils.remote==null){
  61 + //登录
  62 + RemoteServerUtils.remote = trashConfig.getRemotePath();
  63 + loginService.loginByRemote(trashConfig.getToken());
  64 + }
  65 + ViolationWarningInformation violationWarningInformation1 = null;
  66 + JSONArray company1 = redisCache.getCacheObject("company");
  67 + JSONObject basevehicleInfo = RemoteServerUtils.getBasevehicleInfo(jsonObject.getString("vehicleId"),trashConfig.getToken());
  68 + if(company1==null){
  69 + Map map = new HashMap<>();
  70 + map.put("size",9999);
  71 + map.put("page",1);
  72 + company1 = RemoteServerUtils.getCompanyList(map, trashConfig.getToken());
  73 + redisCache.setCacheObject("company",company1,1, TimeUnit.HOURS);
  74 + }
  75 +
  76 + //这两种类型无需累加
  77 + if(violationType.equals("工地预警-视频设备离线超时报警") || violationType.equals("消纳场预警-视频设备离线超时报警")){
  78 + violationWarningInformation1 = null;
  79 + }else if(violationType.equals("闯禁行驶")||violationType.equals("失信车辆作业")){//这两种类型根据公司累加
  80 + String company = jsonObject.getString("enterpriseName");
  81 + violationWarningInformation1 = SpringUtils.getBean(ViolationWarningInformationMapper.class).selectViolationWarningInformation(company,null, violationType, nowDate, tomorrowDate);
  82 + }else{//其他都是根据工地/消纳站累加
  83 + String project = jsonObject.getString("siteName");
  84 + violationWarningInformation1 = SpringUtils.getBean(ViolationWarningInformationMapper.class).selectViolationWarningInformation(null,project, violationType, nowDate, tomorrowDate);
  85 + }
  86 + //判断该类型,该工地,该时间段是否已经存在报警信息,如果存在则不再新增,如果不存在则新增
  87 + if (violationWarningInformation1 == null) {
  88 + ViolationWarningInformation violationWarningInformation = new ViolationWarningInformation();
  89 + String siteType = jsonObject.getString("siteType");
  90 + if ("1".equals(siteType)) {//工地
  91 + violationWarningInformation.setViolationObjectType("0");
  92 + } else if ("2".equals(siteType)) {//消纳场
  93 + violationWarningInformation.setViolationObjectType("1");
  94 + }
  95 + //所属区域
  96 + violationWarningInformation.setOwningRegion(jsonObject.getString("areaName"));
  97 + //案卷编码
  98 + String number = DateFormatUtils.format(new Date(), "yyyyMMddHHmmssSSS");
  99 + violationWarningInformation.setNumber(number.substring(2));
  100 + //公司名称
  101 + violationWarningInformation.setCompanyName(jsonObject.getString("enterpriseName"));
  102 + //违规类型
  103 + violationWarningInformation.setViolationType(jsonObject.getString("alarmName"));
  104 + //发送人
  105 + violationWarningInformation.setCreateBy("长沙市建筑垃圾智慧监管平台");
  106 + //推送对象
  107 + violationWarningInformation.setViolationGrade("一般类");
  108 + //项目名称(工地名称,消纳场名称)
  109 + violationWarningInformation.setProjectName(jsonObject.getString("siteName"));
  110 + violationWarningInformation.setSendObject("区管理部门(治)");
  111 + switch (violationWarningInformation.getViolationType()) {
  112 + case "工地预警-未报开工作业":
  113 + case "消纳场预警-未到指定的消纳场作业":
  114 + case "消纳场预警-三无车辆进入消纳场":
  115 + case "消纳场预警-未报开工作业":
  116 + case "工地预警-未按时间作业":
  117 + case "工地预警-三无车辆进入工地":
  118 + case "工地预警-视频设备离线超时报警":
  119 + case "离线运输报警(消)":
  120 + case "离线运输报警(工)":
  121 + case "未激活车辆作业":
  122 + case "未核准作业车辆作业":
  123 + violationWarningInformation.setSendObject("区管理部门(治)");
  124 + break;
  125 + case "消纳场预警-视频设备离线超时报警":
  126 + violationWarningInformation.setSendObject("区管理部门(消)");
  127 + break;
  128 + case "未按线路行驶":
  129 + violationWarningInformation.setViolationGrade("重点类");
  130 + violationWarningInformation.setSendObject("区管理部门(治)");
  131 + break;
  132 + case "闯禁行驶":
  133 + case "失信车辆作业":
  134 + violationWarningInformation.setSendObject("运输企业");
  135 + break;
  136 + }
  137 +
  138 + String describe = DateFormatUtils.format(new Date(), "yyyy/MM/dd HH:mm:ss") + " "
  139 + + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" +
  140 + jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType();
  141 + //设置公司简称
  142 + for(Object o:company1){
  143 + JSONObject jo = (JSONObject) o;
  144 + if(basevehicleInfo.getString("companyID").equals(jo.getString("id"))){
  145 + violationWarningInformation.setAbbreviation(jo.getString("abbreviation"));
  146 + }
  147 + }
  148 + violationWarningInformation.setDescribe(describe);
  149 + // 业务逻辑
  150 + try {
  151 + violationWarningInformationService.insertViolationWarningInformation(null, violationWarningInformation);
  152 + } catch (IOException e) {
  153 + e.printStackTrace();
  154 + }
  155 + } else {
  156 + String describe = violationWarningInformation1.getDescribe() + ";" + DateFormatUtils.format(new Date(), "yyyy/MM/dd HH:mm:ss") + " "
  157 + + jsonObject.getString("enterpriseName") + " " + jsonObject.get("licenseplateNo") + "在" +
  158 + jsonObject.get("siteName") + "出现" + jsonObject.getString("alarmName");
  159 + violationWarningInformation1.setDescribe(describe);
  160 + SpringUtils.getBean(ViolationWarningInformationMapper.class).updateViolationWarningInformation(violationWarningInformation1);
  161 + }
133 162
134 163
135 } 164 }
trash-workFlow/src/main/java/com/trash/casefile/mapper/ViolationWarningInformationMapper.java
@@ -2,6 +2,8 @@ package com.trash.casefile.mapper; @@ -2,6 +2,8 @@ package com.trash.casefile.mapper;
2 2
3 import java.util.List; 3 import java.util.List;
4 import com.trash.casefile.domain.ViolationWarningInformation; 4 import com.trash.casefile.domain.ViolationWarningInformation;
  5 +import org.apache.ibatis.annotations.Param;
  6 +import org.springframework.security.core.parameters.P;
5 7
6 /** 8 /**
7 * 违规预警信息Mapper接口 9 * 违规预警信息Mapper接口
@@ -20,6 +22,15 @@ public interface ViolationWarningInformationMapper @@ -20,6 +22,15 @@ public interface ViolationWarningInformationMapper
20 ViolationWarningInformation selectViolationWarningInformationById(Long id); 22 ViolationWarningInformation selectViolationWarningInformationById(Long id);
21 23
22 /** 24 /**
  25 + * 根据项目名称、类型、创建时间查询违规预警信息
  26 + * @param projectName
  27 + * @param type
  28 + * @param createDate
  29 + * @return
  30 + */
  31 + ViolationWarningInformation selectViolationWarningInformation(@Param("companyName") String companyName, @Param("projectName")String projectName, @Param("type")String type, @Param("nowDate") String nowDate, @Param("tomorrowDate")String tomorrowDate);
  32 +
  33 + /**
23 * 查询违规预警信息列表 34 * 查询违规预警信息列表
24 * 35 *
25 * @param violationWarningInformation 违规预警信息 36 * @param violationWarningInformation 违规预警信息
trash-workFlow/src/main/java/com/trash/casefile/service/IViolationWarningInformationService.java
@@ -23,6 +23,7 @@ public interface IViolationWarningInformationService { @@ -23,6 +23,7 @@ public interface IViolationWarningInformationService {
23 */ 23 */
24 ViolationWarningInformationVo selectViolationWarningInformationById(Long id); 24 ViolationWarningInformationVo selectViolationWarningInformationById(Long id);
25 25
  26 +
26 /** 27 /**
27 * 查询违规预警信息列表 28 * 查询违规预警信息列表
28 * 29 *
trash-workFlow/src/main/java/com/trash/workflow/service/impl/WorkflowServiceImpl.java
@@ -3,10 +3,12 @@ package com.trash.workflow.service.impl; @@ -3,10 +3,12 @@ package com.trash.workflow.service.impl;
3 import java.text.SimpleDateFormat; 3 import java.text.SimpleDateFormat;
4 import java.util.List; 4 import java.util.List;
5 import java.util.Map; 5 import java.util.Map;
  6 +import java.util.concurrent.TimeUnit;
6 import java.util.stream.Collectors; 7 import java.util.stream.Collectors;
7 8
8 import com.trash.casefile.domain.ViolationWarningInformation; 9 import com.trash.casefile.domain.ViolationWarningInformation;
9 import com.trash.common.config.trashConfig; 10 import com.trash.common.config.trashConfig;
  11 +import com.trash.common.core.redis.RedisCache;
10 import com.trash.framework.web.service.SysLoginService; 12 import com.trash.framework.web.service.SysLoginService;
11 import org.activiti.api.process.model.ProcessInstance; 13 import org.activiti.api.process.model.ProcessInstance;
12 import org.activiti.api.process.model.builders.ProcessPayloadBuilder; 14 import org.activiti.api.process.model.builders.ProcessPayloadBuilder;
@@ -19,6 +21,9 @@ import org.activiti.engine.task.IdentityLinkType; @@ -19,6 +21,9 @@ import org.activiti.engine.task.IdentityLinkType;
19 import org.activiti.engine.task.Task; 21 import org.activiti.engine.task.Task;
20 import org.apache.commons.collections4.map.HashedMap; 22 import org.apache.commons.collections4.map.HashedMap;
21 import org.springframework.beans.factory.annotation.Autowired; 23 import org.springframework.beans.factory.annotation.Autowired;
  24 +import org.springframework.security.core.context.SecurityContext;
  25 +import org.springframework.security.core.context.SecurityContextHolder;
  26 +import org.springframework.security.core.context.SecurityContextImpl;
22 import org.springframework.stereotype.Service; 27 import org.springframework.stereotype.Service;
23 import org.springframework.transaction.annotation.Transactional; 28 import org.springframework.transaction.annotation.Transactional;
24 29
@@ -71,11 +76,14 @@ public class WorkflowServiceImpl implements IWorkflowService { @@ -71,11 +76,14 @@ public class WorkflowServiceImpl implements IWorkflowService {
71 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 76 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
72 77
73 @Autowired 78 @Autowired
74 - RuntimeService runTImeService; 79 + RuntimeService runtimeService;
75 80
76 @Autowired 81 @Autowired
77 ISupervisionThreestepService server; 82 ISupervisionThreestepService server;
78 83
  84 + @Autowired
  85 + RedisCache redisCache;
  86 +
79 @Override 87 @Override
80 @Transactional 88 @Transactional
81 public int createWorkFlow(Map<String, Object> data) { //第三方通用接收接口 89 public int createWorkFlow(Map<String, Object> data) { //第三方通用接收接口
@@ -269,32 +277,39 @@ public class WorkflowServiceImpl implements IWorkflowService { @@ -269,32 +277,39 @@ public class WorkflowServiceImpl implements IWorkflowService {
269 } 277 }
270 loginService.loginByRemote(trashConfig.getToken()); 278 loginService.loginByRemote(trashConfig.getToken());
271 } 279 }
272 - ProcessInstance processInstance = null; 280 + SecurityContextImpl securityContextImpl = new SecurityContextImpl();
  281 +
  282 + securityContextImpl.setAuthentication(SecurityContextHolder.getContext().getAuthentication());
  283 + org.activiti.engine.runtime.ProcessInstance instance = null;
273 String title = "案卷号:" + caseFile.getNumber(); 284 String title = "案卷号:" + caseFile.getNumber();
274 String flowType = "violation_warning"; 285 String flowType = "violation_warning";
275 try { 286 try {
  287 + Map map = new HashedMap<>();
  288 +
  289 + map.put("route", index);
  290 + instance = runtimeService.createProcessInstanceBuilder()
  291 + .businessKey(flowType + ":" + caseFile.getId())
  292 + .variable("route", index)
  293 + .processDefinitionKey(flowType)
  294 + .variables(map)
  295 + .start();
  296 +
276 297
277 - processInstance = processRuntime.start(ProcessPayloadBuilder  
278 - .start()  
279 - .withProcessDefinitionKey(flowType)  
280 - .withName(title)  
281 - .withBusinessKey(flowType + ":" + caseFile.getId())  
282 - .withVariable("route", index)  
283 - .build()); 298 +
  299 +
  300 + //runtimeService.startProcessInstanceById(instance.getProcessDefinitionId(),map);
284 301
285 302
286 if(index == 0){ 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 - task.setAssignee(caseFile.getCompanyName()); 306 + task.setAssignee(caseFile.getAbbreviation());
290 307
291 taskService.saveTask(task); 308 taskService.saveTask(task);
292 }else{ 309 }else{
293 - updateProcess(processInstance,caseFile.getOwningRegion()); 310 + updateProcessKafka(instance,caseFile.getOwningRegion(), trashConfig.getToken());
294 } 311 }
295 312
296 -  
297 -  
298 Workflow workflow = new Workflow(); 313 Workflow workflow = new Workflow();
299 workflow.setId(flowType + ":" + caseFile.getId()); 314 workflow.setId(flowType + ":" + caseFile.getId());
300 workflow.setTitle(title); 315 workflow.setTitle(title);
@@ -302,12 +317,12 @@ public class WorkflowServiceImpl implements IWorkflowService { @@ -302,12 +317,12 @@ public class WorkflowServiceImpl implements IWorkflowService {
302 workflow.setStartTime(sdf.format(caseFile.getCreateTime())); 317 workflow.setStartTime(sdf.format(caseFile.getCreateTime()));
303 workflow.setEndTime(sdf.format(caseFile.getCreateTime())); 318 workflow.setEndTime(sdf.format(caseFile.getCreateTime()));
304 workflow.setType("违规预警信息案卷"); 319 workflow.setType("违规预警信息案卷");
305 - workflow.setInstanceId(processInstance.getId()); 320 + workflow.setInstanceId(instance.getId());
306 workflow.setState("0"); 321 workflow.setState("0");
307 322
308 return workflowMapper.insertWorkflow(workflow); 323 return workflowMapper.insertWorkflow(workflow);
309 } catch (Exception e) { 324 } catch (Exception e) {
310 - processRuntime.delete(ProcessPayloadBuilder.delete(processInstance)); 325 + runtimeService.deleteProcessInstance(instance.getId(), "创建失败");
311 throw new RuntimeException(e); 326 throw new RuntimeException(e);
312 } 327 }
313 328
@@ -375,15 +390,64 @@ public class WorkflowServiceImpl implements IWorkflowService { @@ -375,15 +390,64 @@ public class WorkflowServiceImpl implements IWorkflowService {
375 } 390 }
376 391
377 } 392 }
378 - 393 +
379 void updateProcess(ProcessInstance processInstance,String placeName){ 394 void updateProcess(ProcessInstance processInstance,String placeName){
  395 + Map map = new HashedMap<>();
  396 +
  397 + map.put("type", "CSUserDepartmentType");
  398 +
  399 + JSONArray array2 = RemoteServerUtils.getDict(map);
  400 +
  401 +
  402 + String placeCode = null;
  403 + String code = null;
  404 +
  405 + for(Object obj:array2){
  406 + if(((JSONObject)obj).getString("name").equals("渣土办")){
  407 + code = ((JSONObject)(obj)).getString("code");
  408 + }
  409 + if(((JSONObject)obj).getString("name").replace("渣土办", "").equals(placeName)){
  410 + placeCode = ((JSONObject)(obj)).getString("code");
  411 +
  412 + if(code != null){
  413 + break;
  414 + }
  415 + }
  416 +
  417 + }
  418 +
  419 + if(placeCode != null){
  420 + Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
  421 +
  422 +
  423 + List<IdentityLink> list = taskService.getIdentityLinksForTask(task.getId());
  424 +
  425 + for(IdentityLink identityLink:list){
  426 +// if(identityLink.getGroupId() != null)
  427 +// taskService.deleteGroupIdentityLink(task.getId(), identityLink.getGroupId(), identityLink.getType());
  428 + if(identityLink.getUserId() != null)
  429 + taskService.deleteUserIdentityLink(task.getId(), identityLink.getUserId(), identityLink.getType());
  430 + }
  431 +
  432 + taskService.addCandidateUser(task.getId(), placeCode);
  433 +
  434 + task.setDescription(placeCode);
  435 +
  436 + taskService.saveTask(task);
  437 + }
  438 + };
  439 +
  440 + void updateProcessKafka(org.activiti.engine.runtime.ProcessInstance processInstance,String placeName,String token){
380 Map map = new HashedMap<>(); 441 Map map = new HashedMap<>();
381 442
382 map.put("type", "CSUserDepartmentType"); 443 map.put("type", "CSUserDepartmentType");
383 444
384 - JSONArray array2 = RemoteServerUtils.getDict(map);  
385 -  
386 - 445 +
  446 + JSONArray array2 = redisCache.getCacheObject("dict");
  447 + if(array2==null||array2.size()==0){
  448 + array2 = RemoteServerUtils.getDict(map,token);
  449 + redisCache.setCacheObject("dict",array2,24, TimeUnit.HOURS);
  450 + }
387 String placeCode = null; 451 String placeCode = null;
388 String code = null; 452 String code = null;
389 453
trash-workFlow/src/main/resources/mapper/casefile/ViolationWarningInformationMapper.xml
@@ -27,7 +27,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -27,7 +27,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
27 </resultMap> 27 </resultMap>
28 28
29 <sql id="selectViolationWarningInformationVo"> 29 <sql id="selectViolationWarningInformationVo">
30 - select id, `number`, violation_object_type, owning_region, violation_type, violation_grade, project_name, company_name, `describe`, send_object, create_time, create_by, update_time, update_by, status, receive, receive_status, read_by, read_time from casefile_violation_warning_information 30 + select id, `number`, violation_object_type, owning_region, violation_type, violation_grade, project_name, company_name, `describe`, send_object, create_time, create_by, update_time, update_by, status, receive, receive_status, read_by, read_time,abbreviation from casefile_violation_warning_information
31 </sql> 31 </sql>
32 32
33 <select id="selectViolationWarningInformationList" parameterType="ViolationWarningInformation" resultMap="ViolationWarningInformationResult"> 33 <select id="selectViolationWarningInformationList" parameterType="ViolationWarningInformation" resultMap="ViolationWarningInformationResult">
@@ -47,7 +47,16 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -47,7 +47,16 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
47 <include refid="selectViolationWarningInformationVo"/> 47 <include refid="selectViolationWarningInformationVo"/>
48 where id = #{id} 48 where id = #{id}
49 </select> 49 </select>
50 - 50 + <select id="selectViolationWarningInformation"
  51 + resultType="com.trash.casefile.domain.ViolationWarningInformation">
  52 + <include refid="selectViolationWarningInformationVo"/>
  53 + <where>
  54 + <if test="projectName!=null">project_name = #{projectName}</if>
  55 + <if test="companyName!=null">company_name = #{companyName}</if>
  56 + and violation_type = #{type} and create_time between CONCAT(#{nowDate},' 08:00:00') and CONCAT(#{tomorrowDate},' 07:59:59')
  57 + </where>
  58 + </select>
  59 +
51 <insert id="insertViolationWarningInformation" parameterType="ViolationWarningInformation" useGeneratedKeys="true" keyProperty="id"> 60 <insert id="insertViolationWarningInformation" parameterType="ViolationWarningInformation" useGeneratedKeys="true" keyProperty="id">
52 insert into casefile_violation_warning_information 61 insert into casefile_violation_warning_information
53 <trim prefix="(" suffix=")" suffixOverrides=","> 62 <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -63,6 +72,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -63,6 +72,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
63 <if test="sendObject != null">send_object,</if> 72 <if test="sendObject != null">send_object,</if>
64 <if test="createBy != null">create_by,</if> 73 <if test="createBy != null">create_by,</if>
65 <if test="status != null">status,</if> 74 <if test="status != null">status,</if>
  75 + <if test="abbreviation!=null">abbreviation,</if>
66 </trim> 76 </trim>
67 <trim prefix="values (" suffix=")" suffixOverrides=","> 77 <trim prefix="values (" suffix=")" suffixOverrides=",">
68 now(), 78 now(),
@@ -77,6 +87,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -77,6 +87,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
77 <if test="sendObject != null">#{sendObject},</if> 87 <if test="sendObject != null">#{sendObject},</if>
78 <if test="createBy != null">#{createBy},</if> 88 <if test="createBy != null">#{createBy},</if>
79 <if test="status != null">#{status},</if> 89 <if test="status != null">#{status},</if>
  90 + <if test="abbreviation!=null">#{abbreviation},</if>
80 </trim> 91 </trim>
81 </insert> 92 </insert>
82 93
@@ -99,6 +110,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -99,6 +110,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
99 <if test="receiveStatus != null">receive_status = #{receiveStatus},</if> 110 <if test="receiveStatus != null">receive_status = #{receiveStatus},</if>
100 <if test="readBy != null">read_by = #{readBy},</if> 111 <if test="readBy != null">read_by = #{readBy},</if>
101 <if test="readTime != null">read_time = #{readTime},</if> 112 <if test="readTime != null">read_time = #{readTime},</if>
  113 + <if test="abbreviation!=null">abbreviation=#{abbreviation},</if>
102 </trim> 114 </trim>
103 where id = #{id} 115 where id = #{id}
104 </update> 116 </update>