Commit c99c1738 authored by chenhao's avatar chenhao

重构代码结构

parent 0d13f169
...@@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONArray; ...@@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.workflow.RemoteWorkFlowService; import com.yeejoin.amos.boot.biz.common.workflow.RemoteWorkFlowService;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto; import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
...@@ -112,68 +113,49 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -112,68 +113,49 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
// return CommonResponseUtil.failure("添加失败"); // return CommonResponseUtil.failure("添加失败");
} }
if (ObjectUtils.isNotEmpty(model)) { if (ObjectUtils.isNotEmpty(model)) {
excuteTask(false, model.getSequenceNbr(), instance.getString("id"), userInfo, null); excuteTask( instance.getString("id"), userInfo, null);
} }
return true; return true;
} }
public boolean excuteTask(boolean falg, Long sequenceNbr, String procressId, ReginParams userInfo, public boolean excuteTask( Long sequenceNbr, ReginParams userInfo,
String condition) { String condition) {
Map<String, Object> conditionMap = new HashMap<String, Object>();
FailureDetailsDto failureDetailsDto = this.queryBySeq(sequenceNbr); conditionMap.put("condition", condition);
// 获取送达部门的ID Map<String,Object> map= checkExcuteTaskAuthMap(sequenceNbr,userInfo);
Integer failureEquipmentId = failureDetailsDto.getFailureEquipmentId(); try {
Long seq = userInfo.getDepartment().getSequenceNbr(); if(Boolean.parseBoolean(map.get("checkFlag").toString())) {
Long auditDepartmentId = null; remoteWorkFlowService.excute(map.get("taskId").toString(), conditionMap.toString());
if (falg == true) { }
FailureAudit failureAudit = failureAuditService.findByFaultId(sequenceNbr); } catch (Exception e) {
auditDepartmentId = failureAudit.getAuditDepartmentId(); return false;
} else {
auditDepartmentId = seq;
} }
return true;
}
public boolean excuteTask(String procressId, ReginParams userInfo,
String condition) {
Map<String, Object> conditionMap = new HashMap<String, Object>(); Map<String, Object> conditionMap = new HashMap<String, Object>();
conditionMap.put("condition", condition); conditionMap.put("condition", condition);
JSONObject teskObject = remoteWorkFlowService.getChildNodeDetail(procressId); JSONObject teskObject = remoteWorkFlowService.getChildNodeDetail(procressId);
try {
if (ObjectUtils.isNotEmpty(teskObject)) { if (ObjectUtils.isNotEmpty(teskObject)) {
JSONArray taskDetailArray = teskObject.getJSONArray("data"); JSONArray taskDetailArray = teskObject.getJSONArray("data");
for (Object obj : taskDetailArray) { for (Object obj : taskDetailArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj)); JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
String name = detail.getString("name"); remoteWorkFlowService.excute(detail.getString("id"), conditionMap.toString());
if (name.contains(EMERGENCY_COMMAND) && auditDepartmentId.intValue() == seq.intValue()) {
String taskId = detail.getString("id");
remoteWorkFlowService.excute(taskId, conditionMap.toString());
break;
} else {
if (failureEquipmentId.intValue() == seq.intValue()) {
String taskId = detail.getString("id");
remoteWorkFlowService.excute(taskId, conditionMap.toString());
break;
} }
} }
}
}
} catch (Exception e) {
return false;
}
return true; return true;
} }
public boolean checkExcuteTaskAuth(boolean falg,Long sequenceNbr, ReginParams userInfo) { public boolean checkExcuteTaskAuth(Long sequenceNbr, ReginParams userInfo) {
Long seq = userInfo.getDepartment().getSequenceNbr(); Map<String,Object> map= this.checkExcuteTaskAuthMap(sequenceNbr,userInfo);
Long auditDepartmentId = null; return Boolean.parseBoolean(map.get("checkFlag").toString());
if (falg == true) {
FailureAudit failureAudit = failureAuditService.findByFaultId(sequenceNbr);
auditDepartmentId = failureAudit.getAuditDepartmentId();
} else {
auditDepartmentId = seq;
}
return checkExcuteTaskAuth(auditDepartmentId,sequenceNbr,userInfo);
} }
public boolean checkExcuteTaskAuth(Long auditDepartmentId,Long sequenceNbr, ReginParams userInfo) { public Map<String,Object> checkExcuteTaskAuthMap(Long sequenceNbr, ReginParams userInfo) {
Map<String,Object> map = new HashMap<String,Object>();
FailureDetailsDto failureDetailsDto = this.queryBySeq(sequenceNbr); FailureDetailsDto failureDetailsDto = this.queryBySeq(sequenceNbr);
// 获取送达部门的ID // 获取送达部门的ID
Integer failureEquipmentId = failureDetailsDto.getFailureEquipmentId(); Integer failureEquipmentId = failureDetailsDto.getFailureEquipmentId();
FailureAudit failureAudit = failureAuditService.findByFaultId(sequenceNbr);
//获取上一级操作部门的Id //获取上一级操作部门的Id
FailureDetails details = this.baseMapper.selectById(sequenceNbr); FailureDetails details = this.baseMapper.selectById(sequenceNbr);
String procressId = details.getProcessId(); String procressId = details.getProcessId();
...@@ -184,16 +166,25 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -184,16 +166,25 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
for (Object obj : taskDetailArray) { for (Object obj : taskDetailArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj)); JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
String name = detail.getString("name"); String name = detail.getString("name");
if (name.contains(EMERGENCY_COMMAND) && auditDepartmentId.intValue() == seq.intValue()) { if (name.contains(EMERGENCY_COMMAND) ) {
return true; FailureAudit failureAuditDetail = failureAuditService.findByFaultId(sequenceNbr);
Long auditDepartmentId = failureAuditDetail.getAuditDepartmentId();
if(auditDepartmentId.intValue() == seq.intValue()) {
map.put("taskId", detail.getString("id"));
map.put("checkFlag", true);
return map;
}
} else { } else {
if (failureEquipmentId.intValue() == seq.intValue()) { if (failureEquipmentId.intValue() == seq.intValue()) {
return true; map.put("taskId", detail.getString("id"));
map.put("checkFlag", true);
return map;
} }
} }
} }
} }
return false; map.put("checkFlag", false);
return map;
} }
public Object getCurrentProcessHistoryTask(Long id) { public Object getCurrentProcessHistoryTask(Long id) {
......
...@@ -41,7 +41,7 @@ video.url=https://11.11.16.4:443/ ...@@ -41,7 +41,7 @@ video.url=https://11.11.16.4:443/
params.work.flow.normalProcessDefinitionKey=normalHazardManagement params.work.flow.normalProcessDefinitionKey=normalHazardManagement
params.work.flow.processDefinitionKey=hazardManagement params.work.flow.processDefinitionKey=hazardManagement
#params.work.flow.address=http://172.16.3.4:30040 params.work.flow.address=http://172.16.3.4:30040
params.work.flow.address=http://172.16.10.80:30040 #params.work.flow.address=http://172.16.10.80:30040
params.spc.address=http://172.16.3.89:9001 params.spc.address=http://172.16.3.89:9001
failure.work.flow.processDefinitionKey=malfunction_repair failure.work.flow.processDefinitionKey=malfunction_repair
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment