Browse Source

#工作任务单

zhongwei
yang_shj 11 months ago
parent
commit
5c1f794731
  1. 66
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java
  2. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/controller/WorkTaskController.java
  3. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/IWorkTaskService.java
  4. 47
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java

66
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java

@ -3,10 +3,13 @@ package com.hnac.hzims.ticket.repair.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tenant.mp.TenantEntity;
import java.util.Date;
/** /**
* @author ysj * @author ysj
*/ */
@ -18,6 +21,69 @@ public class WorkTaskEntity extends TenantEntity {
private static final long serialVersionUID = -3122149146340663132L; private static final long serialVersionUID = -3122149146340663132L;
@ApiModelProperty(value = "工作任务单编号")
private String code;
@ApiModelProperty(value = "工作负责人")
private Long head;
@ApiModelProperty(value = "工作负责人名称")
private String headName;
@ApiModelProperty(value = "工作负责人名称")
private Date headHandlTime;
@ApiModelProperty(value = "班组ID")
private Long groupId;
@ApiModelProperty(value = "班组成员ID : 按 “,”分割")
private String member;
@ApiModelProperty(value = "班组成员名称 : 按 “,”分割")
private String memberName;
@ApiModelProperty(value = "签名班组人员ID : 按 “,”分割")
private String signatureMember;
@ApiModelProperty(value = "签名班组成员名称 : 按 “,”分割")
private String signatureMemberName;
@ApiModelProperty(value = "工作计划开始时间")
private Date planStartTime;
@ApiModelProperty(value = "工作计划结束时间")
private Date endStartTime;
@ApiModelProperty(value = "工作任务")
private String workTask;
@ApiModelProperty(value = "现场安全措施")
private String securityMeasures;
@ApiModelProperty(value = "安全风险及预控措施")
private String riskPreControl;
@ApiModelProperty(value = "许可人")
private Long licensor;
@ApiModelProperty(value = "许可人名称")
private String licensorName;
@ApiModelProperty(value = "许可时间")
private Date licensorTime;
@ApiModelProperty(value = "工作结束时间")
private Date workEndTime;
@ApiModelProperty(value = "备注")
private String memo;
@ApiModelProperty(value = "工作流实例")
private String processInstanceId;
@ApiModelProperty(value = "流程环节名称")
private String taskName;
@ApiModelProperty(value = "流程环节处理人")
private String nextStepOperator;
} }

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/controller/WorkTaskController.java

@ -48,6 +48,6 @@ public class WorkTaskController extends BladeController {
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "工作任务单") @ApiOperation(value = "工作任务单")
public R startV4(@RequestBody WorkTaskVO workTask) { public R startV4(@RequestBody WorkTaskVO workTask) {
return R.status(workTaskService.startProcess(workTask)); return R.status(workTaskService.start(workTask));
} }
} }

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/IWorkTaskService.java

@ -10,7 +10,7 @@ import org.springblade.core.mp.base.BaseService;
*/ */
public interface IWorkTaskService extends BaseService<WorkTaskEntity> { public interface IWorkTaskService extends BaseService<WorkTaskEntity> {
boolean startProcess(WorkTaskVO workTask); boolean start(WorkTaskVO workTask);
boolean listener(ProcessWorkFlowResponse processWorkFlowResponse); boolean listener(ProcessWorkFlowResponse processWorkFlowResponse);

47
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java

@ -1,32 +1,65 @@
package com.hnac.hzims.ticket.repair.service.impl; package com.hnac.hzims.ticket.repair.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.repair.entity.WorkTaskEntity; import com.hnac.hzims.ticket.repair.entity.WorkTaskEntity;
import com.hnac.hzims.ticket.repair.mapper.WorkTaskMapper; import com.hnac.hzims.ticket.repair.mapper.WorkTaskMapper;
import com.hnac.hzims.ticket.repair.service.IWorkTaskService; import com.hnac.hzims.ticket.repair.service.IWorkTaskService;
import com.hnac.hzims.ticket.repair.vo.WorkTaskVO; import com.hnac.hzims.ticket.repair.vo.WorkTaskVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.flow.core.entity.BladeFlow;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.utils.FlowUtil;
import org.springblade.flow.core.utils.TaskUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Map;
/** /**
* @author ysj * @author ysj
*/ */
@Slf4j
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class WorkTaskServiceImpl extends BaseServiceImpl<WorkTaskMapper, WorkTaskEntity> implements IWorkTaskService { public class WorkTaskServiceImpl extends BaseServiceImpl<WorkTaskMapper, WorkTaskEntity> implements IWorkTaskService {
private final IFlowClient flowClient;
/** /**
* 工作任务单-开启流程 * 工作任务单-开启流程
* @param workTask * @param workTask
* @return * @return
*/ */
@Override @Override
public boolean startProcess(WorkTaskVO workTask) { public boolean start(WorkTaskVO workTask) {
// 步骤1.保存工作任务单 // 步骤1.保存工作任务单
this.saveWorkTask(workTask); this.saveWorkTask(workTask);
return false; // 步骤2.开启检修计划流程
this.startProcess(workTask);
return true;
}
private void startProcess(WorkTaskVO workTask) {
Map<String, Object> variables = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(workTask, DateUtil.PATTERN_DATETIME), Map.class);
variables.put("creator", TaskUtil.getTaskUser(String.valueOf(AuthUtil.getUserId())));
R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey("work_task", FlowUtil.getBusinessKey("work_task_v4",String.valueOf(workTask.getId())), workTask.getCode(), variables);
log.error("work_task_start_process_result :{}",result);
// 更新任务流程Id
if (result.isSuccess()) {
BladeFlow flow = result.getData();
workTask.setProcessInstanceId(flow.getProcessInstanceId());
this.updateById(workTask);
} else {
throw new ServiceException("开启检修计划流程失败,code=" + result.getCode());
}
} }
/** /**
@ -34,6 +67,7 @@ public class WorkTaskServiceImpl extends BaseServiceImpl<WorkTaskMapper, WorkTas
* @param workTask * @param workTask
*/ */
private void saveWorkTask(WorkTaskVO workTask) { private void saveWorkTask(WorkTaskVO workTask) {
this.save(workTask);
} }
/** /**
@ -43,6 +77,15 @@ public class WorkTaskServiceImpl extends BaseServiceImpl<WorkTaskMapper, WorkTas
*/ */
@Override @Override
public boolean listener(ProcessWorkFlowResponse processWorkFlowResponse) { public boolean listener(ProcessWorkFlowResponse processWorkFlowResponse) {
Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables();
WorkTaskVO entity = JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference<WorkTaskVO>(){});
// 当前流程名称
entity.setTaskName(processWorkFlowResponse.getTaskName());
// 流程阶段执行人员名称
entity.setNextStepOperator(processWorkFlowResponse.getNextStepOperator());
// 更新工作任务单信息
this.updateById(entity);
return false; return false;
} }
} }
Loading…
Cancel
Save