From a7669966370c51e883203c69e5ef4d0216224bcc Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Wed, 1 Apr 2020 23:35:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/check/impl/CheckServiceImpl.java | 52 ++++++++++---- .../service/process/IProcessService.java | 72 ++++++++++++++++++- .../process/impl/ProcessServiceImpl.java | 58 ++++++++++++++- src/main/resources/banner.txt | 13 +++- src/main/resources/bpmn/check-self.bpmn | 64 ++++++++--------- .../gridpersonnel/gridpersonnel-mapper.xml | 2 +- .../static/route/check/list-check.html | 21 ++++-- .../static/route/check/save-check.html | 9 ++- ...eck-mine.html => update-recheck-mine.html} | 9 ++- 9 files changed, 238 insertions(+), 62 deletions(-) rename src/main/resources/static/route/check/{update-check-mine.html => update-recheck-mine.html} (97%) diff --git a/src/main/java/com/cm/inspection/service/check/impl/CheckServiceImpl.java b/src/main/java/com/cm/inspection/service/check/impl/CheckServiceImpl.java index 81e26f5..6a4ef06 100644 --- a/src/main/java/com/cm/inspection/service/check/impl/CheckServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/check/impl/CheckServiceImpl.java @@ -94,7 +94,7 @@ public class CheckServiceImpl extends BaseService implements ICheckService { params.put("reporter", userId); processService.startProcess(IProcessService.CHECK_SELF_PROCESS, businessKey, params); Task task = processService.getTaskByAssigneeAndBusinessKey(userId, businessKey); - completeCheck(token, checkVO, checkId, userId, task, isCoordination); + completeCheck(token, checkVO, checkId, null, userId, task, isCoordination); } /** @@ -115,7 +115,7 @@ public class CheckServiceImpl extends BaseService implements ICheckService { Map params = HashMapUtil.beanToMap(checkVO); saveCheckWithId(newCheckId, token, params); LOG.debug("复查流程处理"); - completeCheck(token, checkVO, checkId, userId, task, isCoordination); + completeCheck(token, checkVO, newCheckId, checkId, userId, task, isCoordination); } /** @@ -123,18 +123,19 @@ public class CheckServiceImpl extends BaseService implements ICheckService { * * @param checkVO * @param checkId + * @param oldCheckId * @param task * @param userId * @param isCoordination * @throws Exception */ - private void completeCheck(String token, CheckVO checkVO, String checkId, String userId, Task task, int isCoordination) throws Exception { + private void completeCheck(String token, CheckVO checkVO, String checkId, String oldCheckId, String userId, Task task, int isCoordination) throws Exception { Map params = getHashMap(2); params.put("isCoordination", isCoordination); if (isCoordination == 1) { - saveHiddenDangerReport(token, checkVO, checkId, userId, task, params); + saveHiddenDangerReport(token, checkVO, checkId, oldCheckId, userId, task, params); } else { - setLeaderCheck(userId, checkId, task, params); + setLeaderCheck(userId, checkId, oldCheckId, task, params); } processService.saveTaskCompleteByTaskId(task.getId(), params); } @@ -144,11 +145,12 @@ public class CheckServiceImpl extends BaseService implements ICheckService { * * @param checkVO * @param checkId + * @param oldCheckId * @param task * @param params * @throws Exception */ - private void saveHiddenDangerReport(String token, CheckVO checkVO, String checkId, String userId, Task task, Map params) throws Exception { + private void saveHiddenDangerReport(String token, CheckVO checkVO, String checkId, String oldCheckId, String userId, Task task, Map params) throws Exception { LOG.debug("1.isCoordination:1,配合处理"); List hiddenDangerReports = checkVO.getHiddenDangerReports(); int isAllPass = 1; @@ -161,20 +163,23 @@ public class CheckServiceImpl extends BaseService implements ICheckService { } LOG.debug("2.isAllPass: {}", isAllPass); params.put("isAllPass", isAllPass); + // 业务ID + String businessCheckId = task.getBusinessKey().split(":")[1]; if (isAllPass == 0) { LOG.debug("3.检查项没有完全通过,需要复查"); params.put("reReporter", userId); processService.setTaskVariableByTaskId(task.getId(), "isReport", 1); LOG.debug("4.标记上一次的检查项"); processService.setTaskVariableByTaskId(task.getId(), "lastCheckId", checkId); + if (oldCheckId != null && !StringUtils.equals(businessCheckId, oldCheckId)) { + LOG.debug("5.标记复查为完成状态"); + updateCheckIsCompleteInfo(token, oldCheckId, 1); + } } else { LOG.debug("3.全部通过,更新当前检查业务状态和流程业务状态"); - CheckVO updateCheckVO = new CheckVO(); - updateCheckVO.setIsComplete(1); - updateCheck(checkId, updateCheckVO); - String businessCheckId = task.getBusinessKey().split(":")[1]; - if (!StringUtils.equals(checkId, businessCheckId)) { - updateCheck(businessCheckId, updateCheckVO); + updateCheckIsCompleteInfo(token, checkId, 1); + if (!StringUtils.equals(businessCheckId, checkId)) { + updateCheckIsCompleteInfo(token, businessCheckId, 1); } } } @@ -184,10 +189,11 @@ public class CheckServiceImpl extends BaseService implements ICheckService { * * @param userId * @param checkId + * @param newCheckId * @param task * @param params */ - private void setLeaderCheck(String userId, String checkId, Task task, Map params) { + private void setLeaderCheck(String userId, String checkId, String newCheckId, Task task, Map params) { LOG.debug("1.isCoordination:2, 不配合"); // 查询上级领导,如果上级领导为空,指向自己,如果有多个网格员角色取最高level的上级领导 List gridPersonnelDTOs = gridPersonnelService.listGridPersonnelByUserIdAndIsGridOperator(userId, 1); @@ -199,7 +205,6 @@ public class CheckServiceImpl extends BaseService implements ICheckService { processService.setTaskVariableByTaskId(task.getId(), "isLeader", 1); // 删除之上报相关属性 processService.removeTaskVariableByTaskId(task.getId(), "isReport"); - processService.removeTaskVariableByTaskId(task.getId(), "reReporter"); LOG.debug("2.标记上一次的检查项"); processService.setTaskVariableByTaskId(task.getId(), "lastCheckId", checkId); } @@ -280,6 +285,25 @@ public class CheckServiceImpl extends BaseService implements ICheckService { checkDao.updateCheck(params); } + /** + * 修改完成状态 + * + * @param token + * @param checkId + * @param isComplete + */ + private void updateCheckIsCompleteInfo(String token, String checkId, int isComplete) { + Map params = getHashMap(6); + params.put("isComplete", isComplete); + params.put("checkId", checkId); + if (token != null) { + setUpdateInfo(token, params); + } else { + setUpdateInfo(params); + } + checkDao.updateCheck(params); + } + @Override public CheckDTO getCheckById(String checkId) throws SearchException { Map params = super.getHashMap(1); diff --git a/src/main/java/com/cm/inspection/service/process/IProcessService.java b/src/main/java/com/cm/inspection/service/process/IProcessService.java index e359f74..9ca34e9 100644 --- a/src/main/java/com/cm/inspection/service/process/IProcessService.java +++ b/src/main/java/com/cm/inspection/service/process/IProcessService.java @@ -58,7 +58,16 @@ public interface IProcessService { * @param key * @return */ - List listTaskByAssigneeAndVariablesKey(String assignee, String key); + List listTaskByAssigneeAndVariableKey(String assignee, String key); + + /** + * 任务列表(通过执行人和流程变量Key) + * + * @param assignee + * @param key + * @return + */ + List listTaskByAssigneeAndRuntimeVariableKey(String assignee, String key); /** * 获取任务(通过业务主键) @@ -114,6 +123,16 @@ public interface IProcessService { */ Task getTaskByAssigneeAndVariableKeyAndValue(String assignee, String key, Object value); + /** + * 获取任务(通过执行人和流程变量名和流程变量值) + * + * @param assignee + * @param key + * @param value + * @return + */ + Task getTaskByAssigneeAndRuntimeVariableKeyAndRuntimeVariableValue(String assignee, String key, Object value); + /** * 设置任务变量 * @@ -122,6 +141,14 @@ public interface IProcessService { */ void setTaskVariablesByTaskId(String taskId, Map variables); + /** + * 设置流程变量 + * + * @param executionId + * @param variables + */ + void setRuntimeVariablesByExecutionId(String executionId, Map variables); + /** * 设置任务变量 * @@ -131,6 +158,15 @@ public interface IProcessService { */ void setTaskVariableByTaskId(String taskId, String key, Object value); + /** + * 设置流程变量 + * + * @param executionId + * @param key + * @param value + */ + void setRuntimeVariableByExecutionId(String executionId, String key, Object value); + /** * 获取任务变量 * @@ -139,16 +175,32 @@ public interface IProcessService { */ Map getTaskVariablesByTaskId(String taskId); + /** + * 获取流程变量 + * + * @param executionId + * @return + */ + Map getRuntimeVariablesByExecutionId(String executionId); + /** * 获取任务变量(通过键、值) * * @param taskId * @param key - * @param value * @return */ Object getTaskVariableByTaskId(String taskId, String key); + /** + * 获取流程变量(通过键、值) + * + * @param executionId + * @param key + * @return + */ + Object getRuntimeVariableByExecutionId(String executionId, String key); + /** * 删除任务变量 * @@ -157,6 +209,14 @@ public interface IProcessService { */ void removeTaskVariablesByTaskId(String taskId, List keys); + /** + * 删除流程变量 + * + * @param executionId + * @param keys + */ + void removeRuntimeVariablesByExecutionId(String executionId, List keys); + /** * 删除任务变量 * @@ -165,6 +225,14 @@ public interface IProcessService { */ void removeTaskVariableByTaskId(String taskId, String key); + /** + * 删除流程变量 + * + * @param executionId + * @param key + */ + void removeRuntimeVariableByExecutionId(String executionId, String key); + /** * 完成案件(通过taskId) * diff --git a/src/main/java/com/cm/inspection/service/process/impl/ProcessServiceImpl.java b/src/main/java/com/cm/inspection/service/process/impl/ProcessServiceImpl.java index 5a0f930..ae76c9f 100644 --- a/src/main/java/com/cm/inspection/service/process/impl/ProcessServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/process/impl/ProcessServiceImpl.java @@ -59,7 +59,7 @@ public class ProcessServiceImpl implements IProcessService { } @Override - public List listTaskByAssigneeAndVariablesKey(String assignee, String key) { + public List listTaskByAssigneeAndVariableKey(String assignee, String key) { List taskList = listTaskByAssignee(assignee); for (int i = 0; i < taskList.size(); i++) { Task task = taskList.get(i); @@ -72,6 +72,20 @@ public class ProcessServiceImpl implements IProcessService { return taskList; } + @Override + public List listTaskByAssigneeAndRuntimeVariableKey(String assignee, String key) { + List taskList = listTaskByAssignee(assignee); + for (int i = 0; i < taskList.size(); i++) { + Task task = taskList.get(i); + Object value = runtimeService.getVariable(task.getExecutionId(), key); + if (value == null) { + taskList.remove(i); + i--; + } + } + return taskList; + } + @Override public Task getTaskByBusinessKey(List listTask, String businessKey) { if (listTask == null) { @@ -128,36 +142,78 @@ public class ProcessServiceImpl implements IProcessService { return null; } + @Override + public Task getTaskByAssigneeAndRuntimeVariableKeyAndRuntimeVariableValue(String assignee, String key, Object value) { + List taskList = listTaskByAssignee(assignee); + for (Task task : taskList) { + Object valueObj = runtimeService.getVariable(task.getExecutionId(), key); + if (!ObjectUtils.notEqual(value, valueObj)) { + return task; + } + } + return null; + } + @Override public void setTaskVariablesByTaskId(String taskId, Map variables) { taskService.setVariables(taskId, variables); } + @Override + public void setRuntimeVariablesByExecutionId(String executionId, Map variables) { + runtimeService.setVariables(executionId, variables); + } + @Override public void setTaskVariableByTaskId(String taskId, String key, Object value) { taskService.setVariable(taskId, key, value); } + @Override + public void setRuntimeVariableByExecutionId(String executionId, String key, Object value) { + runtimeService.setVariable(executionId, key, value); + } + @Override public Map getTaskVariablesByTaskId(String taskId) { return taskService.getVariables(taskId); } + @Override + public Map getRuntimeVariablesByExecutionId(String executionId) { + return runtimeService.getVariables(executionId); + } + @Override public Object getTaskVariableByTaskId(String taskId, String key) { return taskService.getVariable(taskId, key); } + @Override + public Object getRuntimeVariableByExecutionId(String executionId, String key) { + return runtimeService.getVariable(executionId, key); + } + @Override public void removeTaskVariablesByTaskId(String taskId, List keys) { taskService.removeVariables(taskId, keys); } + @Override + public void removeRuntimeVariablesByExecutionId(String executionId, List keys) { + + } + @Override public void removeTaskVariableByTaskId(String taskId, String key) { taskService.removeVariable(taskId, key); } + @Override + public void removeRuntimeVariableByExecutionId(String executionId, String key) { + + } + @Override public void saveTaskCompleteByTaskId(String taskId, Map params) { taskService.complete(taskId, params); diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt index 1257727..214a24e 100644 --- a/src/main/resources/banner.txt +++ b/src/main/resources/banner.txt @@ -1 +1,12 @@ -banner \ No newline at end of file + + /$$$$$$ /$$ /$$ +|_ $$_/ | $$ |__/ + | $$ /$$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$ /$$$$$$ /$$$$$$$ + | $$ | $$__ $$ /$$_____/ /$$__ $$ /$$__ $$ /$$_____/|_ $$_/ | $$ /$$__ $$| $$__ $$ + | $$ | $$ \ $$| $$$$$$ | $$ \ $$| $$$$$$$$| $$ | $$ | $$| $$ \ $$| $$ \ $$ + | $$ | $$ | $$ \____ $$| $$ | $$| $$_____/| $$ | $$ /$$| $$| $$ | $$| $$ | $$ + /$$$$$$| $$ | $$ /$$$$$$$/| $$$$$$$/| $$$$$$$| $$$$$$$ | $$$$/| $$| $$$$$$/| $$ | $$ +|______/|__/ |__/|_______/ | $$____/ \_______/ \_______/ \___/ |__/ \______/ |__/ |__/ + | $$ + | $$ + |__/ diff --git a/src/main/resources/bpmn/check-self.bpmn b/src/main/resources/bpmn/check-self.bpmn index 55ca8e5..e0e2306 100644 --- a/src/main/resources/bpmn/check-self.bpmn +++ b/src/main/resources/bpmn/check-self.bpmn @@ -17,7 +17,7 @@ - + @@ -51,122 +51,122 @@ - + - + - + - + - + - + - + - + - - + + - - + + - - - + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - - + + + diff --git a/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml b/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml index 594e42b..69350a9 100644 --- a/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml +++ b/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml @@ -216,7 +216,7 @@ AND - t1.user_id LIKE CONCAT(#{keywords}, '%') + t1.user_id LIKE CONCAT(#{userId}, '%') AND diff --git a/src/main/resources/static/route/check/list-check.html b/src/main/resources/static/route/check/list-check.html index b7db35d..cb7fac9 100644 --- a/src/main/resources/static/route/check/list-check.html +++ b/src/main/resources/static/route/check/list-check.html @@ -150,25 +150,36 @@ if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { return '-'; } - return rowData; + if(rowData == 1) { + return '检查'; + } else if(rowData == 2) { + return '复查'; + } + return '无'; } }, {field: 'isCoordination', width: 100, title: '是否配合', align:'center', templet: function(row) { var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + if(typeof(rowData) === 'undefined' || rowData == null) { return '-'; } - return rowData; + if(rowData == 1) { + return '配合' + } + return '不配合'; } }, {field: 'isComplete', width: 100, title: '是否完成', align:'center', templet: function(row) { var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + if(typeof(rowData) === 'undefined' || rowData == null) { return '-'; } - return rowData; + if(rowData == 1) { + return '完成' + } + return '未完成'; } }, ]], diff --git a/src/main/resources/static/route/check/save-check.html b/src/main/resources/static/route/check/save-check.html index 53f1bff..9c4a890 100644 --- a/src/main/resources/static/route/check/save-check.html +++ b/src/main/resources/static/route/check/save-check.html @@ -73,14 +73,17 @@
- +
- - +
diff --git a/src/main/resources/static/route/check/update-check-mine.html b/src/main/resources/static/route/check/update-recheck-mine.html similarity index 97% rename from src/main/resources/static/route/check/update-check-mine.html rename to src/main/resources/static/route/check/update-recheck-mine.html index 2324bd7..4bab815 100644 --- a/src/main/resources/static/route/check/update-check-mine.html +++ b/src/main/resources/static/route/check/update-recheck-mine.html @@ -25,14 +25,17 @@
- +
- - +