Commit c99c1738 authored by chenhao's avatar chenhao

重构代码结构

parent 0d13f169
......@@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.workflow.RemoteWorkFlowService;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
......@@ -112,68 +113,49 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
// return CommonResponseUtil.failure("添加失败");
}
if (ObjectUtils.isNotEmpty(model)) {
excuteTask(false, model.getSequenceNbr(), instance.getString("id"), userInfo, null);
excuteTask( instance.getString("id"), userInfo, null);
}
return true;
}
public boolean excuteTask(boolean falg, Long sequenceNbr, String procressId, ReginParams userInfo,
public boolean excuteTask( Long sequenceNbr, ReginParams userInfo,
String condition) {
FailureDetailsDto failureDetailsDto = this.queryBySeq(sequenceNbr);
// 获取送达部门的ID
Integer failureEquipmentId = failureDetailsDto.getFailureEquipmentId();
Long seq = userInfo.getDepartment().getSequenceNbr();
Long auditDepartmentId = null;
if (falg == true) {
FailureAudit failureAudit = failureAuditService.findByFaultId(sequenceNbr);
auditDepartmentId = failureAudit.getAuditDepartmentId();
} else {
auditDepartmentId = seq;
}
Map<String, Object> conditionMap = new HashMap<String, Object>();
conditionMap.put("condition", condition);
JSONObject teskObject = remoteWorkFlowService.getChildNodeDetail(procressId);
try {
if (ObjectUtils.isNotEmpty(teskObject)) {
JSONArray taskDetailArray = teskObject.getJSONArray("data");
for (Object obj : taskDetailArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
String name = detail.getString("name");
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;
}
}
}
}
Map<String,Object> map= checkExcuteTaskAuthMap(sequenceNbr,userInfo);
try {
if(Boolean.parseBoolean(map.get("checkFlag").toString())) {
remoteWorkFlowService.excute(map.get("taskId").toString(), conditionMap.toString());
}
} catch (Exception e) {
return false;
}
return true;
}
public boolean checkExcuteTaskAuth(boolean falg,Long sequenceNbr, ReginParams userInfo) {
Long seq = userInfo.getDepartment().getSequenceNbr();
Long auditDepartmentId = null;
if (falg == true) {
FailureAudit failureAudit = failureAuditService.findByFaultId(sequenceNbr);
auditDepartmentId = failureAudit.getAuditDepartmentId();
} else {
auditDepartmentId = seq;
public boolean excuteTask(String procressId, ReginParams userInfo,
String condition) {
Map<String, Object> conditionMap = new HashMap<String, Object>();
conditionMap.put("condition", condition);
JSONObject teskObject = remoteWorkFlowService.getChildNodeDetail(procressId);
if (ObjectUtils.isNotEmpty(teskObject)) {
JSONArray taskDetailArray = teskObject.getJSONArray("data");
for (Object obj : taskDetailArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
remoteWorkFlowService.excute(detail.getString("id"), conditionMap.toString());
}
}
return checkExcuteTaskAuth(auditDepartmentId,sequenceNbr,userInfo);
return true;
}
public boolean checkExcuteTaskAuth(Long sequenceNbr, ReginParams userInfo) {
Map<String,Object> map= this.checkExcuteTaskAuthMap(sequenceNbr,userInfo);
return Boolean.parseBoolean(map.get("checkFlag").toString());
}
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);
// 获取送达部门的ID
Integer failureEquipmentId = failureDetailsDto.getFailureEquipmentId();
FailureAudit failureAudit = failureAuditService.findByFaultId(sequenceNbr);
//获取上一级操作部门的Id
FailureDetails details = this.baseMapper.selectById(sequenceNbr);
String procressId = details.getProcessId();
......@@ -184,16 +166,25 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
for (Object obj : taskDetailArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
String name = detail.getString("name");
if (name.contains(EMERGENCY_COMMAND) && auditDepartmentId.intValue() == seq.intValue()) {
return true;
if (name.contains(EMERGENCY_COMMAND) ) {
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 {
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) {
......
......@@ -41,7 +41,7 @@ video.url=https://11.11.16.4:443/
params.work.flow.normalProcessDefinitionKey=normalHazardManagement
params.work.flow.processDefinitionKey=hazardManagement
#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.3.4:30040
#params.work.flow.address=http://172.16.10.80:30040
params.spc.address=http://172.16.3.89:9001
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