From a267846b0bd4b3631255022eef50a6f8b64b0d63 Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Mon, 30 Mar 2020 08:23:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EnterpriseOfGridOperatorController.java | 16 ++ .../controller/deploy/DeployController.java | 118 -------------- .../inspection/pojo/dtos/check/CheckDTO.java | 117 +++++++++++--- .../service/check/impl/CheckServiceImpl.java | 3 +- .../service/deploy/IDeployProcessService.java | 43 ----- .../deploy/impl/DeployProcessServiceImpl.java | 152 ------------------ .../IEnterpriseOfGridOperatorService.java | 16 ++ .../EnterpriseOfGridOperatorServiceImpl.java | 31 ++++ .../service/process/IProcessService.java | 29 ++++ .../process/impl/ProcessServiceImpl.java | 51 ++++++ .../{check-self.bpmn.bpmn => check-self.bpmn} | 0 .../mybatis/mapper/check/check-mapper.xml | 66 +++++--- .../enterpriseofgridoperator-mapper.xml | 35 ++-- .../gridpersonnel/gridpersonnel-mapper.xml | 9 +- .../static/route/check/list-check.html | 70 +------- .../static/route/check/save-check.html | 24 +-- 16 files changed, 336 insertions(+), 444 deletions(-) delete mode 100644 src/main/java/com/cm/inspection/controller/deploy/DeployController.java delete mode 100644 src/main/java/com/cm/inspection/service/deploy/IDeployProcessService.java delete mode 100644 src/main/java/com/cm/inspection/service/deploy/impl/DeployProcessServiceImpl.java create mode 100644 src/main/java/com/cm/inspection/service/process/IProcessService.java create mode 100644 src/main/java/com/cm/inspection/service/process/impl/ProcessServiceImpl.java rename src/main/resources/bpmn/{check-self.bpmn.bpmn => check-self.bpmn} (100%) diff --git a/src/main/java/com/cm/inspection/controller/apis/enterpriseofgridoperator/EnterpriseOfGridOperatorController.java b/src/main/java/com/cm/inspection/controller/apis/enterpriseofgridoperator/EnterpriseOfGridOperatorController.java index 1243385..ccf0775 100644 --- a/src/main/java/com/cm/inspection/controller/apis/enterpriseofgridoperator/EnterpriseOfGridOperatorController.java +++ b/src/main/java/com/cm/inspection/controller/apis/enterpriseofgridoperator/EnterpriseOfGridOperatorController.java @@ -112,6 +112,22 @@ public class EnterpriseOfGridOperatorController extends AbstractController { return enterpriseOfGridOperatorService.listPageEnterpriseOfGridOperator(page); } + @ApiOperation(value = "网格员的企业分页列表", notes = "网格员的企业分页列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"), + @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"), + @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"), + @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"), + @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listpageenterpriseofgridoperatorofmine") + public SuccessResultList> listPageEnterpriseOfGridOperatorOfMine(ListPage page) throws SearchException { + Map params = requestParams(); + page.setParams(params); + return enterpriseOfGridOperatorService.listPageEnterpriseOfGridOperatorOfMine(page); + } + @ApiOperation(value = "网格员的企业分页列表(通过用户ID)", notes = "网格员的企业分页列表(通过用户ID)接口") @ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path"), diff --git a/src/main/java/com/cm/inspection/controller/deploy/DeployController.java b/src/main/java/com/cm/inspection/controller/deploy/DeployController.java deleted file mode 100644 index 4a453b5..0000000 --- a/src/main/java/com/cm/inspection/controller/deploy/DeployController.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.cm.inspection.controller.deploy; - -import com.alibaba.fastjson.JSONArray; -import com.cm.common.constants.ISystemConstant; -import com.cm.common.result.SuccessResult; -import com.cm.common.result.SuccessResultData; -import com.cm.inspection.service.deploy.IDeployProcessService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -/** - * When you feel like quitting. Think about why you started - * 当你想要放弃的时候,想想当初你为何开始 - * - * @ClassName: DemoController - * @Description: - * @Author: WangGeng - * @Date: 2020/3/24 9:41 上午 - * @Version: 1.0 - **/ -@RestController -@RequestMapping(ISystemConstant.API_PREFIX + "/deploy") -public class DeployController { - - @Autowired - private IDeployProcessService deployProcessService; - - /** - * 部署流程 - * - * @param processName - * @return - */ - @GetMapping("getdeployprocess/{processName}") - public SuccessResult getDeployProcess(@PathVariable("processName") String processName) { - return deployProcessService.deployProcess(processName); - } - - /** - * 执行流程 - * - * @param processId - * @return - */ - @GetMapping("getstartprocess/{processId}") - public SuccessResult getStartProcess(@PathVariable("processId") String processId) { - return deployProcessService.startProcess(processId); - } - - /** - * 通过代理人查看任务 - * - * @param assignee - * @return - */ - @GetMapping("listtaskbyassignee") - public JSONArray listTaskByAssignee(String assignee) { - return deployProcessService.listTaskByAssignee(assignee); - } - - /** - * 完成任务 - * - * @param taskId - * @return - */ - @GetMapping("gettaskcompletebytaskid/{taskId}") - public SuccessResult getTaskCompleteByTaskId(@PathVariable("taskId") String taskId) { - return deployProcessService.saveTaskCompleteByTaskId(taskId); - } - - @PostMapping("saveleavefulltaskcompletebytaskidanddays/{taskId}") - public SuccessResult saveLeaveFullTaskCompleteByTaskIdAndDays(@PathVariable("taskId") String taskId, @RequestParam("days") Integer days) { - return deployProcessService.saveLeaveFullTaskCompleteByTaskIdAndDays(taskId, days); - } - - /** - * 正在运行的任务 - * - * @return - */ - @GetMapping("listtask") - public JSONArray listTask() { - return deployProcessService.listTask(); - } - - /** - * 实例状态 - * - * @param processId - * @return - */ - @GetMapping("getinstancestatus/{processId}") - public SuccessResultData getInstanceStatus(@PathVariable("processId") String processId) { - return deployProcessService.getInstanceStatus(processId); - } - - /** - * 历史流程 - * - * @return - */ - @GetMapping("listhistoryprocess") - public JSONArray listHistoryProcess() { - return deployProcessService.listHistoryProcess(); - } - - /** - * 历史任务 - * - * @return - */ - @GetMapping("listhistorytask") - public JSONArray listHistoryTask() { - return deployProcessService.listHistoryTask(); - } - -} diff --git a/src/main/java/com/cm/inspection/pojo/dtos/check/CheckDTO.java b/src/main/java/com/cm/inspection/pojo/dtos/check/CheckDTO.java index 4e41432..eda0960 100644 --- a/src/main/java/com/cm/inspection/pojo/dtos/check/CheckDTO.java +++ b/src/main/java/com/cm/inspection/pojo/dtos/check/CheckDTO.java @@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; /** - * * @ClassName: CheckDTO * @Description: 检查表 * @Author: WenG @@ -22,6 +21,8 @@ public class CheckDTO { private String nameJoinByEnterpriseId; @ApiModelProperty(name = "typeJoinByEnterpriseId", value = "企业ID的类型") private String typeJoinByEnterpriseId; + @ApiModelProperty(name = "typeDictionaryName", value = "类型字典名称") + private String typeDictionaryName; @ApiModelProperty(name = "area1JoinByEnterpriseId", value = "企业ID的1级地区") private String area1JoinByEnterpriseId; @ApiModelProperty(name = "area2JoinByEnterpriseId", value = "企业ID的2级区域") @@ -36,10 +37,14 @@ public class CheckDTO { private String addressJoinByEnterpriseId; @ApiModelProperty(name = "industryJoinByEnterpriseId", value = "企业ID的管理行业") private String industryJoinByEnterpriseId; + @ApiModelProperty(name = "industryDictionaryName", value = "管理行业字典名称") + private String industryDictionaryName; @ApiModelProperty(name = "engagedCountJoinByEnterpriseId", value = "企业ID的从业人数") private String engagedCountJoinByEnterpriseId; @ApiModelProperty(name = "riskOperationJoinByEnterpriseId", value = "企业ID的风险作业") private String riskOperationJoinByEnterpriseId; + @ApiModelProperty(name = "riskOperationDictionaryName", value = "风险作业字典名称") + private String riskOperationDictionaryName; @ApiModelProperty(name = "masterJoinByEnterpriseId", value = "企业ID的负责人") private String masterJoinByEnterpriseId; @ApiModelProperty(name = "phoneJoinByEnterpriseId", value = "企业ID的联系电话") @@ -52,14 +57,15 @@ public class CheckDTO { private Integer isComplete; public String getCheckId() { - return checkId == null ? "" : checkId; + return checkId == null ? "" : checkId.trim(); } public void setCheckId(String checkId) { this.checkId = checkId; } + public String getEnterpriseId() { - return enterpriseId == null ? "" : enterpriseId; + return enterpriseId == null ? "" : enterpriseId.trim(); } public void setEnterpriseId(String enterpriseId) { @@ -67,7 +73,7 @@ public class CheckDTO { } public String getNameJoinByEnterpriseId() { - return nameJoinByEnterpriseId == null ? "" : nameJoinByEnterpriseId; + return nameJoinByEnterpriseId == null ? "" : nameJoinByEnterpriseId.trim(); } public void setNameJoinByEnterpriseId(String nameJoinByEnterpriseId) { @@ -75,15 +81,23 @@ public class CheckDTO { } public String getTypeJoinByEnterpriseId() { - return typeJoinByEnterpriseId == null ? "" : typeJoinByEnterpriseId; + return typeJoinByEnterpriseId == null ? "" : typeJoinByEnterpriseId.trim(); } public void setTypeJoinByEnterpriseId(String typeJoinByEnterpriseId) { this.typeJoinByEnterpriseId = typeJoinByEnterpriseId; } + public String getTypeDictionaryName() { + return typeDictionaryName == null ? "" : typeDictionaryName.trim(); + } + + public void setTypeDictionaryName(String typeDictionaryName) { + this.typeDictionaryName = typeDictionaryName; + } + public String getArea1JoinByEnterpriseId() { - return area1JoinByEnterpriseId == null ? "" : area1JoinByEnterpriseId; + return area1JoinByEnterpriseId == null ? "" : area1JoinByEnterpriseId.trim(); } public void setArea1JoinByEnterpriseId(String area1JoinByEnterpriseId) { @@ -91,7 +105,7 @@ public class CheckDTO { } public String getArea2JoinByEnterpriseId() { - return area2JoinByEnterpriseId == null ? "" : area2JoinByEnterpriseId; + return area2JoinByEnterpriseId == null ? "" : area2JoinByEnterpriseId.trim(); } public void setArea2JoinByEnterpriseId(String area2JoinByEnterpriseId) { @@ -99,7 +113,7 @@ public class CheckDTO { } public String getArea3JoinByEnterpriseId() { - return area3JoinByEnterpriseId == null ? "" : area3JoinByEnterpriseId; + return area3JoinByEnterpriseId == null ? "" : area3JoinByEnterpriseId.trim(); } public void setArea3JoinByEnterpriseId(String area3JoinByEnterpriseId) { @@ -107,7 +121,7 @@ public class CheckDTO { } public String getArea4JoinByEnterpriseId() { - return area4JoinByEnterpriseId == null ? "" : area4JoinByEnterpriseId; + return area4JoinByEnterpriseId == null ? "" : area4JoinByEnterpriseId.trim(); } public void setArea4JoinByEnterpriseId(String area4JoinByEnterpriseId) { @@ -115,7 +129,7 @@ public class CheckDTO { } public String getArea5JoinByEnterpriseId() { - return area5JoinByEnterpriseId == null ? "" : area5JoinByEnterpriseId; + return area5JoinByEnterpriseId == null ? "" : area5JoinByEnterpriseId.trim(); } public void setArea5JoinByEnterpriseId(String area5JoinByEnterpriseId) { @@ -123,7 +137,7 @@ public class CheckDTO { } public String getAddressJoinByEnterpriseId() { - return addressJoinByEnterpriseId == null ? "" : addressJoinByEnterpriseId; + return addressJoinByEnterpriseId == null ? "" : addressJoinByEnterpriseId.trim(); } public void setAddressJoinByEnterpriseId(String addressJoinByEnterpriseId) { @@ -131,15 +145,23 @@ public class CheckDTO { } public String getIndustryJoinByEnterpriseId() { - return industryJoinByEnterpriseId == null ? "" : industryJoinByEnterpriseId; + return industryJoinByEnterpriseId == null ? "" : industryJoinByEnterpriseId.trim(); } public void setIndustryJoinByEnterpriseId(String industryJoinByEnterpriseId) { this.industryJoinByEnterpriseId = industryJoinByEnterpriseId; } + public String getIndustryDictionaryName() { + return industryDictionaryName == null ? "" : industryDictionaryName.trim(); + } + + public void setIndustryDictionaryName(String industryDictionaryName) { + this.industryDictionaryName = industryDictionaryName; + } + public String getEngagedCountJoinByEnterpriseId() { - return engagedCountJoinByEnterpriseId == null ? "" : engagedCountJoinByEnterpriseId; + return engagedCountJoinByEnterpriseId == null ? "" : engagedCountJoinByEnterpriseId.trim(); } public void setEngagedCountJoinByEnterpriseId(String engagedCountJoinByEnterpriseId) { @@ -147,15 +169,23 @@ public class CheckDTO { } public String getRiskOperationJoinByEnterpriseId() { - return riskOperationJoinByEnterpriseId == null ? "" : riskOperationJoinByEnterpriseId; + return riskOperationJoinByEnterpriseId == null ? "" : riskOperationJoinByEnterpriseId.trim(); } public void setRiskOperationJoinByEnterpriseId(String riskOperationJoinByEnterpriseId) { this.riskOperationJoinByEnterpriseId = riskOperationJoinByEnterpriseId; } + public String getRiskOperationDictionaryName() { + return riskOperationDictionaryName == null ? "" : riskOperationDictionaryName.trim(); + } + + public void setRiskOperationDictionaryName(String riskOperationDictionaryName) { + this.riskOperationDictionaryName = riskOperationDictionaryName; + } + public String getMasterJoinByEnterpriseId() { - return masterJoinByEnterpriseId == null ? "" : masterJoinByEnterpriseId; + return masterJoinByEnterpriseId == null ? "" : masterJoinByEnterpriseId.trim(); } public void setMasterJoinByEnterpriseId(String masterJoinByEnterpriseId) { @@ -163,7 +193,7 @@ public class CheckDTO { } public String getPhoneJoinByEnterpriseId() { - return phoneJoinByEnterpriseId == null ? "" : phoneJoinByEnterpriseId; + return phoneJoinByEnterpriseId == null ? "" : phoneJoinByEnterpriseId.trim(); } public void setPhoneJoinByEnterpriseId(String phoneJoinByEnterpriseId) { @@ -171,7 +201,7 @@ public class CheckDTO { } public Integer getCheckType() { - return checkType == null ? 0 : checkType; + return checkType; } public void setCheckType(Integer checkType) { @@ -179,7 +209,7 @@ public class CheckDTO { } public Integer getIsCoordination() { - return isCoordination == null ? 0 : isCoordination; + return isCoordination; } public void setIsCoordination(Integer isCoordination) { @@ -187,12 +217,59 @@ public class CheckDTO { } public Integer getIsComplete() { - return isComplete == null ? 0 : isComplete; + return isComplete; } public void setIsComplete(Integer isComplete) { this.isComplete = isComplete; } - + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("{"); + sb.append("\"checkId\":") + .append("\"").append(checkId).append("\""); + sb.append(",\"enterpriseId\":") + .append("\"").append(enterpriseId).append("\""); + sb.append(",\"nameJoinByEnterpriseId\":") + .append("\"").append(nameJoinByEnterpriseId).append("\""); + sb.append(",\"typeJoinByEnterpriseId\":") + .append("\"").append(typeJoinByEnterpriseId).append("\""); + sb.append(",\"typeDictionaryName\":") + .append("\"").append(typeDictionaryName).append("\""); + sb.append(",\"area1JoinByEnterpriseId\":") + .append("\"").append(area1JoinByEnterpriseId).append("\""); + sb.append(",\"area2JoinByEnterpriseId\":") + .append("\"").append(area2JoinByEnterpriseId).append("\""); + sb.append(",\"area3JoinByEnterpriseId\":") + .append("\"").append(area3JoinByEnterpriseId).append("\""); + sb.append(",\"area4JoinByEnterpriseId\":") + .append("\"").append(area4JoinByEnterpriseId).append("\""); + sb.append(",\"area5JoinByEnterpriseId\":") + .append("\"").append(area5JoinByEnterpriseId).append("\""); + sb.append(",\"addressJoinByEnterpriseId\":") + .append("\"").append(addressJoinByEnterpriseId).append("\""); + sb.append(",\"industryJoinByEnterpriseId\":") + .append("\"").append(industryJoinByEnterpriseId).append("\""); + sb.append(",\"industryDictionaryName\":") + .append("\"").append(industryDictionaryName).append("\""); + sb.append(",\"engagedCountJoinByEnterpriseId\":") + .append("\"").append(engagedCountJoinByEnterpriseId).append("\""); + sb.append(",\"riskOperationJoinByEnterpriseId\":") + .append("\"").append(riskOperationJoinByEnterpriseId).append("\""); + sb.append(",\"riskOperationDictionaryName\":") + .append("\"").append(riskOperationDictionaryName).append("\""); + sb.append(",\"masterJoinByEnterpriseId\":") + .append("\"").append(masterJoinByEnterpriseId).append("\""); + sb.append(",\"phoneJoinByEnterpriseId\":") + .append("\"").append(phoneJoinByEnterpriseId).append("\""); + sb.append(",\"checkType\":") + .append(checkType); + sb.append(",\"isCoordination\":") + .append(isCoordination); + sb.append(",\"isComplete\":") + .append(isComplete); + sb.append('}'); + return sb.toString(); + } } 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 5ee8acc..5dc4408 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 @@ -1,7 +1,6 @@ package com.cm.inspection.service.check.impl; import com.cm.common.exception.RemoveException; -import com.cm.common.exception.SaveException; import com.cm.common.exception.SearchException; import com.cm.common.pojo.ListPage; import com.cm.common.result.SuccessResult; @@ -61,6 +60,8 @@ public class CheckServiceImpl extends BaseService implements ICheckService { setSaveInfo(params); } checkDao.saveCheck(params); + // 开启流程 + } @Override diff --git a/src/main/java/com/cm/inspection/service/deploy/IDeployProcessService.java b/src/main/java/com/cm/inspection/service/deploy/IDeployProcessService.java deleted file mode 100644 index 3896f8d..0000000 --- a/src/main/java/com/cm/inspection/service/deploy/IDeployProcessService.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.cm.inspection.service.deploy; - -import com.alibaba.fastjson.JSONArray; -import com.cm.common.result.SuccessResult; -import com.cm.common.result.SuccessResultData; -import org.activiti.engine.task.Task; - -import java.util.List; - -/** - * When you feel like quitting. Think about why you started - * 当你想要放弃的时候,想想当初你为何开始 - * - * @ClassName: IDeployProcessService - * @Description: 部署流程 - * @Author: WangGeng - * @Date: 2020/3/23 18:36 - * @Version: 1.0 - **/ -public interface IDeployProcessService { - - void deployProcess(); - - SuccessResult deployProcess(String processName); - - SuccessResult startProcess(String processId); - - JSONArray listTaskByAssignee(String assignee); - - SuccessResult saveTaskCompleteByTaskId(String taskId); - - SuccessResult saveLeaveFullTaskCompleteByTaskIdAndDays(String taskId, Integer days); - - JSONArray listTask(); - - SuccessResultData getInstanceStatus(String processId); - - JSONArray listHistoryProcess(); - - JSONArray listHistoryTask(); - - -} diff --git a/src/main/java/com/cm/inspection/service/deploy/impl/DeployProcessServiceImpl.java b/src/main/java/com/cm/inspection/service/deploy/impl/DeployProcessServiceImpl.java deleted file mode 100644 index 08f089d..0000000 --- a/src/main/java/com/cm/inspection/service/deploy/impl/DeployProcessServiceImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.cm.inspection.service.deploy.impl; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.cm.common.result.SuccessResult; -import com.cm.common.result.SuccessResultData; -import com.cm.inspection.service.deploy.IDeployProcessService; -import org.activiti.engine.*; -import org.activiti.engine.history.HistoricProcessInstance; -import org.activiti.engine.history.HistoricTaskInstance; -import org.activiti.engine.repository.Deployment; -import org.activiti.engine.runtime.ProcessInstance; -import org.activiti.engine.task.Task; -import org.activiti.engine.task.TaskQuery; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * When you feel like quitting. Think about why you started - * 当你想要放弃的时候,想想当初你为何开始 - * - * @ClassName: DeployProcess - * @Description: - * @Author: WangGeng - * @Date: 2020/3/23 18:35 - * @Version: 1.0 - **/ -@Service -public class DeployProcessServiceImpl implements IDeployProcessService { - - @Autowired - private RuntimeService runtimeService; - @Autowired - private TaskService taskService; - @Autowired - private ProcessEngine processEngine; - @Autowired - private RepositoryService repositoryService; - @Autowired - private HistoryService historyService; - - @Override - public void deployProcess() { - repositoryService.createDeployment().addClasspathResource("bpmn/leave.bpmn").name("test").deploy(); - } - - @Override - public SuccessResult deployProcess(String processName) { - Deployment deployment = repositoryService.createDeployment() - .disableSchemaValidation() - .addClasspathResource("bpmn/" + processName + ".bpmn").name("请假").deploy(); - System.out.println("部署ID:" + deployment.getId()); - System.out.println("部署Name:" + deployment.getName()); - return new SuccessResult(); - } - - @Override - public SuccessResult startProcess(String processId) { - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processId); - System.out.println("流程实例id:" + processInstance.getId()); - System.out.println("流程定义id:" + processInstance.getProcessDefinitionId()); - return new SuccessResult(); - } - - @Override - public JSONArray listTaskByAssignee(String assignee) { - TaskQuery taskQuery = taskService.createTaskQuery(); - List taskList = taskQuery.taskAssignee(assignee).list(); - JSONArray jsonArray = new JSONArray(); - for (Task task : taskList) { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("assignee", task.getAssignee()); - jsonObject.put("id", task.getId()); - jsonObject.put("name", task.getName()); - jsonArray.add(jsonObject); - } - return jsonArray; - } - - @Override - public SuccessResult saveTaskCompleteByTaskId(String taskId) { - taskService.complete(taskId); - return new SuccessResult(); - } - - @Override - public SuccessResult saveLeaveFullTaskCompleteByTaskIdAndDays(String taskId, Integer days) { - Map params = new HashMap<>(1); - params.put("days", days); - taskService.complete(taskId, params); - return new SuccessResult(); - } - - @Override - public JSONArray listTask() { - TaskQuery taskQuery = taskService.createTaskQuery(); - List taskList = taskQuery.list(); - JSONArray jsonArray = new JSONArray(); - for (Task task : taskList) { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("assignee", task.getAssignee()); - jsonObject.put("id", task.getId()); - jsonObject.put("name", task.getName()); - jsonArray.add(jsonObject); - } - return jsonArray; - } - - @Override - public SuccessResultData getInstanceStatus(String processId) { - ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processDefinitionKey(processId).singleResult(); - return new SuccessResultData<>(processInstance == null ? 1 : 0); - } - - @Override - public JSONArray listHistoryProcess() { - List list = historyService.createHistoricProcessInstanceQuery().list(); - JSONArray jsonArray = new JSONArray(); - for (HistoricProcessInstance historicProcessInstance : list) { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("id", historicProcessInstance.getId()); - jsonObject.put("name", historicProcessInstance.getName()); - jsonObject.put("startTime", historicProcessInstance.getStartTime()); - jsonObject.put("endTime", historicProcessInstance.getEndTime()); - jsonArray.add(jsonObject); - } - return jsonArray; - } - - @Override - public JSONArray listHistoryTask() { - List taskInstanceList = historyService.createHistoricTaskInstanceQuery().list(); - JSONArray jsonArray = new JSONArray(); - for (HistoricTaskInstance historicTaskInstance : taskInstanceList) { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("id", historicTaskInstance.getId()); - jsonObject.put("name", historicTaskInstance.getName()); - jsonObject.put("startTime", historicTaskInstance.getStartTime()); - jsonObject.put("endTime", historicTaskInstance.getEndTime()); - jsonObject.put("processId", historicTaskInstance.getProcessDefinitionId()); - jsonObject.put("assignee", historicTaskInstance.getAssignee()); - jsonObject.put("executionId", historicTaskInstance.getExecutionId()); - jsonObject.put("parentTaskId", historicTaskInstance.getParentTaskId()); - jsonArray.add(jsonObject); - } - return jsonArray; - } -} diff --git a/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/IEnterpriseOfGridOperatorService.java b/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/IEnterpriseOfGridOperatorService.java index e602c07..b262713 100644 --- a/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/IEnterpriseOfGridOperatorService.java +++ b/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/IEnterpriseOfGridOperatorService.java @@ -125,4 +125,20 @@ public interface IEnterpriseOfGridOperatorService { */ SuccessResultList> listPageEnterpriseOfGridOperatorByUserId(String userId, ListPage page); + /** + * 网格员的企业分页列表(我的) + * + * @param page + * @return + */ + SuccessResultList> listPageEnterpriseOfGridOperatorOfMine(ListPage page); + + /** + * 网格员的企业分页列表(我的) + * + * @param token + * @param page + * @return + */ + SuccessResultList> listPageEnterpriseOfGridOperatorOfMine(String token, ListPage page); } diff --git a/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/impl/EnterpriseOfGridOperatorServiceImpl.java b/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/impl/EnterpriseOfGridOperatorServiceImpl.java index 07dfd2f..b279063 100644 --- a/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/impl/EnterpriseOfGridOperatorServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/enterpriseofgridoperator/impl/EnterpriseOfGridOperatorServiceImpl.java @@ -1,11 +1,13 @@ package com.cm.inspection.service.enterpriseofgridoperator.impl; +import com.cm.common.component.SecurityComponent; import com.cm.common.exception.RemoveException; import com.cm.common.exception.SaveException; import com.cm.common.exception.SearchException; import com.cm.common.pojo.ListPage; import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultList; +import com.cm.common.token.app.AppTokenManager; import com.cm.common.utils.HashMapUtil; import com.cm.common.utils.UUIDUtil; import com.cm.inspection.dao.enterpriseofgridoperator.IEnterpriseOfGridOperatorDao; @@ -15,6 +17,7 @@ import com.cm.inspection.service.BaseService; import com.cm.inspection.service.enterpriseofgridoperator.IEnterpriseOfGridOperatorService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -32,6 +35,8 @@ public class EnterpriseOfGridOperatorServiceImpl extends BaseService implements @Autowired private IEnterpriseOfGridOperatorDao enterpriseOfGridOperatorDao; + @Autowired + private SecurityComponent securityComponent; @Override public SuccessResult saveEnterpriseOfGridOperator(EnterpriseOfGridOperatorVO enterpriseOfGridOperatorVO) throws Exception { @@ -159,4 +164,30 @@ public class EnterpriseOfGridOperatorServiceImpl extends BaseService implements return new SuccessResultList<>(enterpriseOfGridOperatorDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); } + @Override + public SuccessResultList> listPageEnterpriseOfGridOperatorOfMine(ListPage page) { + return listPageEnterpriseOfGridOperatorOfUser(null, page); + } + + @Override + public SuccessResultList> listPageEnterpriseOfGridOperatorOfMine(String token, ListPage page) { + return listPageEnterpriseOfGridOperatorOfUser(token, page); + } + + /** + * 网格员的企业分页列表(通过用户) + * + * @param token + * @param page + * @return + */ + private SuccessResultList> listPageEnterpriseOfGridOperatorOfUser(String token, ListPage page) { + if (StringUtils.isBlank(token)) { + page.getParams().put("userId", securityComponent.getCurrentUser().getUserId()); + } else { + page.getParams().put("userId", AppTokenManager.getInstance().getToken(token).getAppTokenUser().getId()); + } + return listPageEnterpriseOfGridOperator(page); + } + } diff --git a/src/main/java/com/cm/inspection/service/process/IProcessService.java b/src/main/java/com/cm/inspection/service/process/IProcessService.java new file mode 100644 index 0000000..657a211 --- /dev/null +++ b/src/main/java/com/cm/inspection/service/process/IProcessService.java @@ -0,0 +1,29 @@ +package com.cm.inspection.service.process; + +import com.alibaba.fastjson.JSONArray; +import com.cm.common.result.SuccessResult; +import com.cm.common.result.SuccessResultData; + +/** + * When you feel like quitting. Think about why you started + * 当你想要放弃的时候,想想当初你为何开始 + * + * @ClassName: IDeployProcessService + * @Description: 部署流程 + * @Author: WangGeng + * @Date: 2020/3/23 18:36 + * @Version: 1.0 + **/ +public interface IProcessService { + + /** + * 部署流程 + * + * @param processName 流程名称 + * @param processSummary 流程说明 + */ + void deployProcess(String processName, String processSummary); + + + +} \ No newline at end of file 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 new file mode 100644 index 0000000..2a2415f --- /dev/null +++ b/src/main/java/com/cm/inspection/service/process/impl/ProcessServiceImpl.java @@ -0,0 +1,51 @@ +package com.cm.inspection.service.process.impl; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.cm.common.result.SuccessResult; +import com.cm.common.result.SuccessResultData; +import com.cm.inspection.service.process.IProcessService; +import org.activiti.engine.*; +import org.activiti.engine.history.HistoricProcessInstance; +import org.activiti.engine.history.HistoricTaskInstance; +import org.activiti.engine.repository.Deployment; +import org.activiti.engine.runtime.ProcessInstance; +import org.activiti.engine.task.Task; +import org.activiti.engine.task.TaskQuery; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * When you feel like quitting. Think about why you started + * 当你想要放弃的时候,想想当初你为何开始 + * + * @ClassName: DeployProcess + * @Description: + * @Author: WangGeng + * @Date: 2020/3/23 18:35 + * @Version: 1.0 + **/ +@Service +public class ProcessServiceImpl implements IProcessService { + + @Autowired + private RuntimeService runtimeService; + @Autowired + private TaskService taskService; + @Autowired + private ProcessEngine processEngine; + @Autowired + private RepositoryService repositoryService; + @Autowired + private HistoryService historyService; + + @Override + public void deployProcess(String processName, String processSummary) { + repositoryService.createDeployment().addClasspathResource("bpmn/"+ processName +".bpmn").name(processSummary).deploy(); + } + +} diff --git a/src/main/resources/bpmn/check-self.bpmn.bpmn b/src/main/resources/bpmn/check-self.bpmn similarity index 100% rename from src/main/resources/bpmn/check-self.bpmn.bpmn rename to src/main/resources/bpmn/check-self.bpmn diff --git a/src/main/resources/mybatis/mapper/check/check-mapper.xml b/src/main/resources/mybatis/mapper/check/check-mapper.xml index fbe1b23..30cf521 100644 --- a/src/main/resources/mybatis/mapper/check/check-mapper.xml +++ b/src/main/resources/mybatis/mapper/check/check-mapper.xml @@ -7,6 +7,7 @@ + @@ -14,8 +15,10 @@ + + @@ -112,6 +115,7 @@ t1.enterprise_id, jt1.name name_join_by_enterprise_id, jt1.type type_join_by_enterprise_id, + dt1.dictionary_name type_dictionary_name, jt1.area1 area1_join_by_enterprise_id, jt1.area2 area2_join_by_enterprise_id, jt1.area3 area3_join_by_enterprise_id, @@ -119,8 +123,10 @@ jt1.area5 area5_join_by_enterprise_id, jt1.address address_join_by_enterprise_id, jt1.industry industry_join_by_enterprise_id, + dt2.dictionary_name industry_dictionary_name, jt1.engaged_count engaged_count_join_by_enterprise_id, jt1.risk_operation risk_operation_join_by_enterprise_id, + dt3.dictionary_name risk_operation_dictionary_name, jt1.master master_join_by_enterprise_id, jt1.phone phone_join_by_enterprise_id, t1.check_type, @@ -135,10 +141,29 @@ t1.enterprise_id = jt1.enterprise_id AND jt1.is_delete = 0 + LEFT JOIN + data_dictionary dt1 + ON + dt1.dictionary_id = jt1.type + AND + dt1.is_delete = 0 + LEFT JOIN + data_dictionary dt2 + ON + dt2.dictionary_id = jt1.industry + AND + dt2.is_delete = 0 + LEFT JOIN + data_dictionary dt3 + ON + dt3.dictionary_id = jt1.risk_operation + AND + dt3.is_delete = 0 WHERE t1.is_delete = 0 - + AND + jt1.name LIKE CONCAT('%', #{keywords}, '%') AND @@ -148,6 +173,26 @@ AND LEFT(t1.gmt_create, 10) #{endTime} + + AND + jt1.area1 = #{area1} + + + AND + jt1.area2 = #{area2} + + + AND + jt1.area3 = #{area3} + + + AND + jt1.area4 = #{area4} + + + AND + jt1.area5 = #{area5} + AND t1.check_id IN @@ -155,25 +200,6 @@ #{checkIds[${index}]} - GROUP BY - t1.enterprise_id, - jt1.name, - jt1.type, - jt1.area1, - jt1.area2, - jt1.area3, - jt1.area4, - jt1.area5, - jt1.address, - jt1.industry, - jt1.engaged_count, - jt1.risk_operation, - jt1.master, - jt1.phone, - t1.check_type, - t1.is_coordination, - t1.is_complete, - t1.check_id \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml b/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml index 88e002d..8f943fd 100644 --- a/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml +++ b/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml @@ -118,15 +118,7 @@ t1.enterprise_id, jt1.name name_join_by_enterprise_id, jt1.type type_join_by_enterprise_id, - jt1.area1 area1_join_by_enterprise_id, - jt1.area2 area2_join_by_enterprise_id, - jt1.area3 area3_join_by_enterprise_id, - jt1.area4 area4_join_by_enterprise_id, - jt1.area5 area5_join_by_enterprise_id, jt1.address address_join_by_enterprise_id, - jt1.industry industry_join_by_enterprise_id, - jt1.engaged_count engaged_count_join_by_enterprise_id, - jt1.risk_operation risk_operation_join_by_enterprise_id, jt1.master master_join_by_enterprise_id, jt1.phone phone_join_by_enterprise_id, t1.enterprise_of_grid_operator_id @@ -141,7 +133,8 @@ WHERE t1.is_delete = 0 - + AND + jt1.name LIKE CONCAT('%', #{keywords}, '%') AND @@ -158,6 +151,30 @@ #{enterpriseOfGridOperatorIds[${index}]} + + AND + t1.user_id = #{userId} + + + AND + jt1.area1 = #{area1} + + + AND + jt1.area2 = #{area2} + + + AND + jt1.area3 = #{area3} + + + AND + jt1.area4 = #{area4} + + + AND + jt1.area5 = #{area5} + diff --git a/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml b/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml index 47fe6dc..0199d44 100644 --- a/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml +++ b/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml @@ -193,16 +193,11 @@ dt5.dictionary_id = t1.area5 AND dt5.is_delete = 0 - LEFT JOIN - gen_grid_personnel jt1 - ON - t1.leader_user_id = jt1.user_id - AND - jt1.is_delete = 0 WHERE t1.is_delete = 0 - + AND + SUBSTRING_INDEX(t1.user_id, '|', 3) LIKE CONCAT('%', #{keywords}, '%') AND diff --git a/src/main/resources/static/route/check/list-check.html b/src/main/resources/static/route/check/list-check.html index dc662dd..85b9ee9 100644 --- a/src/main/resources/static/route/check/list-check.html +++ b/src/main/resources/static/route/check/list-check.html @@ -79,7 +79,7 @@ cols: [[ {type:'checkbox', fixed: 'left'}, {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, - {field: 'enterpriseId', width: 200, title: '企业ID', align:'center', + {field: 'nameJoinByEnterpriseId', width: 200, title: '企业名称', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -88,7 +88,7 @@ return rowData; } }, - {field: 'nameJoinByEnterpriseId', width: 200, title: '企业ID的名称', align:'center', + {field: 'typeDictionaryName', width: 200, title: '类型', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -97,7 +97,7 @@ return rowData; } }, - {field: 'typeJoinByEnterpriseId', width: 200, title: '企业ID的类型', align:'center', + {field: 'addressJoinByEnterpriseId', width: 200, title: '详细地址', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -106,7 +106,7 @@ return rowData; } }, - {field: 'area1JoinByEnterpriseId', width: 150, title: '企业ID的1级地区', align:'center', + {field: 'industryDictionaryName', width: 200, title: '管理行业', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -115,7 +115,7 @@ return rowData; } }, - {field: 'area2JoinByEnterpriseId', width: 150, title: '企业ID的2级区域', align:'center', + {field: 'engagedCountJoinByEnterpriseId', width: 100, title: '从业人数', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -124,7 +124,7 @@ return rowData; } }, - {field: 'area3JoinByEnterpriseId', width: 150, title: '企业ID的3级区域', align:'center', + {field: 'riskOperationDictionaryName', width: 200, title: '风险作业', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -133,7 +133,7 @@ return rowData; } }, - {field: 'area4JoinByEnterpriseId', width: 150, title: '企业ID的4级区域', align:'center', + {field: 'masterJoinByEnterpriseId', width: 150, title: '负责人', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -142,61 +142,7 @@ return rowData; } }, - {field: 'area5JoinByEnterpriseId', width: 150, title: '企业ID的5级区域', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, - {field: 'addressJoinByEnterpriseId', width: 200, title: '企业ID的详细地址', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, - {field: 'industryJoinByEnterpriseId', width: 200, title: '企业ID的管理行业', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, - {field: 'engagedCountJoinByEnterpriseId', width: 100, title: '企业ID的从业人数', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, - {field: 'riskOperationJoinByEnterpriseId', width: 200, title: '企业ID的风险作业', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, - {field: 'masterJoinByEnterpriseId', width: 150, title: '企业ID的负责人', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, - {field: 'phoneJoinByEnterpriseId', width: 150, title: '企业ID的联系电话', align:'center', + {field: 'phoneJoinByEnterpriseId', width: 150, title: '联系电话', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { diff --git a/src/main/resources/static/route/check/save-check.html b/src/main/resources/static/route/check/save-check.html index 86b27bb..fe7440c 100644 --- a/src/main/resources/static/route/check/save-check.html +++ b/src/main/resources/static/route/check/save-check.html @@ -214,12 +214,12 @@ searchKey: 'keywords', searchPlaceholder: '关键词搜索', table: { - url: top.restAjax.path('api/enterprise/listpageenterprise?area1={area1}&area2={area2}&area3={area3}&area4={area4}&area5={area5}', [$('#area1').val(), $('#area2').val(), $('#area3').val(), $('#area4').val(), $('#area5').val()]), + url: top.restAjax.path('api/enterpriseofgridoperator/listpageenterpriseofgridoperatorofmine?area1={area1}&area2={area2}&area3={area3}&area4={area4}&area5={area5}', [$('#area1').val(), $('#area2').val(), $('#area3').val(), $('#area4').val(), $('#area5').val()]), limit: 20, limits: [20, 40, 60, 80, 100, 200], cols: [[ {type:'radio', fixed: 'left'}, - {field: 'name', width: 200, title: '名称', align:'center', + {field: 'nameJoinByEnterpriseId', width: 200, title: '名称', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -228,7 +228,7 @@ return rowData; } }, - {field: 'address', width: 200, title: '详细地址', align:'center', + {field: 'addressJoinByEnterpriseId', width: 200, title: '详细地址', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -237,7 +237,7 @@ return rowData; } }, - {field: 'master', width: 80, title: '负责人', align:'center', + {field: 'masterJoinByEnterpriseId', width: 80, title: '负责人', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -246,7 +246,7 @@ return rowData; } }, - {field: 'phone', width: 120, title: '联系电话', align:'center', + {field: 'phoneJoinByEnterpriseId', width: 120, title: '联系电话', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -267,7 +267,7 @@ }, done: function (elem, data) { if(data.data.length > 0) { - elem.val(data.data[0].name); + elem.val(data.data[0].nameJoinByEnterpriseId); $('#enterpriseId').val(data.data[0].enterpriseId); } else { elem.val(''); @@ -328,20 +328,20 @@ // area1 选择事件 form.on('select(area1)', function(data) { initArea2Select(data.value); - initArea3Select(data.value); - initArea4Select(data.value); - initArea5Select(data.value); + initArea3Select(); + initArea4Select(); + initArea5Select(); }); // area2 选择事件 form.on('select(area2)', function(data) { initArea3Select(data.value); - initArea4Select(data.value); - initArea5Select(data.value); + initArea4Select(); + initArea5Select(); }); // area3 选择事件 form.on('select(area3)', function(data) { initArea4Select(data.value); - initArea5Select(data.value); + initArea5Select(); }); // area4 选择事件 form.on('select(area4)', function(data) {