From 6c238296528a1cfb6d8b3c56962a9cb63a9c1401 Mon Sep 17 00:00:00 2001 From: yxt_djz <313618925@qq.com> Date: Mon, 4 Jul 2022 08:43:32 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E9=80=80=E5=BA=93=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E5=8A=9E=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yxt/anrui/scm/api/flow/FlowTaskVo.java | 3 +- .../scmvehiclereturn/ScmVehicleReturnDto.java | 15 ++ .../ScmVehicleReturnFeign.java | 24 +- .../ScmVehicleReturnFlowDto.java | 3 +- .../ScmVehicleReturnFlowQuery.java | 13 +- .../ScmVehicleReturnMapper.java | 8 + .../ScmVehicleReturnMapper.xml | 16 ++ .../ScmVehicleReturnRest.java | 35 ++- .../ScmVehicleReturnService.java | 252 ++++++++++++++---- .../src/api/flow/vehicleReturn.js | 31 ++- .../workflow/baseoutsourcingapplication.vue | 1 - .../caigoutuiku/caigoutuikuAdd.vue | 1 - .../workFlow/caigoutuikuFlow/caigoutuiku.vue | 206 +++++++++++--- .../caigoutuikuFlow/caigoutuikuEdit.vue | 44 ++- .../caigoutuikuFlow/caigoutuikuInfo.vue | 47 ++-- anrui-system-ui/src/views/flow/doneList.vue | 1 + anrui-system-ui/src/views/flow/todoList.vue | 13 +- 17 files changed, 561 insertions(+), 152 deletions(-) diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/flow/FlowTaskVo.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/flow/FlowTaskVo.java index ad0de3ab5c..34ec536e71 100644 --- a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/flow/FlowTaskVo.java +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/flow/FlowTaskVo.java @@ -18,7 +18,8 @@ import java.util.Map; @ApiModel("工作流任务相关--请求参数") @Data public class FlowTaskVo { - + @ApiModelProperty("businessSid ") + private String businessSid; @ApiModelProperty("任务Id") private String taskId; diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnDto.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnDto.java index 422dcc380e..1f1ebb2b9c 100644 --- a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnDto.java +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnDto.java @@ -40,4 +40,19 @@ public class ScmVehicleReturnDto implements Dto { private String money; @ApiModelProperty(value = "车辆列表") private List detailsList = new ArrayList<>(); + @ApiModelProperty("流程定义的id") + private String procDefId; + @ApiModelProperty("环节定义的sid") + private String taskDefKey; + @ApiModelProperty("流程实例的sid") + private String instanceId; + + @ApiModelProperty(value = "节点状态") + private String nodeState; + @ApiModelProperty("任务id") + private String taskId; + @ApiModelProperty("业务sid") + private String businessSid; + @ApiModelProperty("comment") + private String comment; } diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnFeign.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnFeign.java index 2ac7eaff42..f90baf3e2e 100644 --- a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnFeign.java +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnFeign.java @@ -1,9 +1,11 @@ package com.yxt.anrui.scm.api.scmvehiclereturn; +import com.yxt.anrui.scm.api.flow.FlowTaskVo; import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.vo.PagerVo; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; @@ -44,24 +46,32 @@ public interface ScmVehicleReturnFeign { @ResponseBody ResultBean submitVehicleReturn(@RequestBody ScmVehicleReturnDto scmVehicleReturnDto); + @ApiOperation(value = "办理(同意)") @PostMapping("/complete") @ResponseBody public ResultBean complete(@RequestBody ScmVehicleReturnFlowQuery scmVehicleReturnFlowQuery); - @ApiOperation(value = "驳回任务") - @PostMapping("/reject") - @ResponseBody - ResultBean reject(@RequestBody ScmVehicleReturnFlowDto dto); - @ApiOperation(value = "终止任务") @PostMapping("/breakProcess") @ResponseBody - ResultBean breakProcess(@RequestBody ScmVehicleReturnFlowDto dto); + ResultBean breakProcess(@RequestBody FlowTaskVo flowTaskVo); @ApiOperation(value = "撤回任务") @PostMapping("/revokeProcess") @ResponseBody - ResultBean revokeProcess(@RequestBody ScmVehicleReturnFlowDto dto); + ResultBean revokeProcess( @ApiParam(value = "工作流任务相关--请求参数") @RequestBody FlowTaskVo flowTaskVo); + @ApiOperation(value = "获取上一个环节") + @PostMapping("/getPreviousNodesForReject") + @ResponseBody + ResultBean getPreviousNodesForReject(@ApiParam(value = "变量集合,json对象") @RequestBody ScmVehicleReturnFlowDto dto); + @ApiOperation("提交") + @PostMapping("/getNextNodesForSubmit") + @ResponseBody + ResultBean getNextNodesForSubmit(@RequestBody ScmVehicleReturnDto scmVehicleReturnDto); + @ApiOperation(value = "驳回任务") + @PostMapping("/reject") + @ResponseBody + ResultBean taskReject(@RequestBody FlowTaskVo flowTaskVo); } diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnFlowDto.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnFlowDto.java index b0dcee3539..fa7e38340b 100644 --- a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnFlowDto.java +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnFlowDto.java @@ -49,5 +49,6 @@ public class ScmVehicleReturnFlowDto implements Serializable { @ApiModelProperty("审批组") private List candidateGroups = new ArrayList<>(); - + @ApiModelProperty("taskDefKey") + private String taskDefKey; } diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnFlowQuery.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnFlowQuery.java index 15eb84185c..f18b210700 100644 --- a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnFlowQuery.java +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehiclereturn/ScmVehicleReturnFlowQuery.java @@ -4,6 +4,8 @@ import com.yxt.common.core.query.Query; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Map; + /** * @Author dimengzhe * @Date 2022/4/12 22:18 @@ -23,6 +25,15 @@ public class ScmVehicleReturnFlowQuery implements Query { private String userSid; @ApiModelProperty(value = "业务sid") private String businessSid; - + @ApiModelProperty(value = "taskDefKey") + private String taskDefKey; + /** + * 当前用户部门的全路径 + */ + private String orgSidPath; + /** + * 业务参数,按需传递 + */ + private Map formVariables; } diff --git a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnMapper.java b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnMapper.java index c2a73d6456..182c60d327 100644 --- a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnMapper.java +++ b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnMapper.java @@ -6,9 +6,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Constants; import com.yxt.anrui.scm.api.scmvehiclereturn.ScmVehicleReturn; import com.yxt.anrui.scm.api.scmvehiclereturn.ScmVehicleReturnDetailsVo; +import com.yxt.anrui.scm.api.scmvehiclereturn.ScmVehicleReturnDto; import com.yxt.anrui.scm.api.scmvehiclereturn.ScmVehicleReturnVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.Map; /** * @Author dimengzhe @@ -31,4 +35,8 @@ public interface ScmVehicleReturnMapper extends BaseMapper { ScmVehicleReturnDetailsVo details(String sid); + @Select("select * from scm_vehicle_return where sid=#{sid} ") + ScmVehicleReturnDto getBySid(@Param("sid")String sid); + + int updateFlowFiled(Map map); } diff --git a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnMapper.xml b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnMapper.xml index d6e72b2a03..de78019a9e 100644 --- a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnMapper.xml +++ b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnMapper.xml @@ -27,4 +27,20 @@ from scm_vehicle_return where sid = #{sid} + + + + UPDATE scm_vehicle_return + SET nodeState=#{nodeState}, taskDefKey=#{taskDefKey} + + , procDefId=#{procDefId} + + + , instanceId=#{procInsId} + + + , taskId=#{taskId} + + WHERE sid=#{sid} + \ No newline at end of file diff --git a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnRest.java b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnRest.java index ffcaebc06a..80b97ceca8 100644 --- a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnRest.java +++ b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnRest.java @@ -1,12 +1,18 @@ package com.yxt.anrui.scm.biz.scmvehiclereturn; +import cn.hutool.core.bean.BeanUtil; +import com.yxt.anrui.flowable.api.utils.ProcDefEnum; +import com.yxt.anrui.flowable.sqloperationsymbol.BusinessVariables; +import com.yxt.anrui.scm.api.flow.FlowTaskVo; import com.yxt.anrui.scm.api.scmvehiclereturn.*; import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.vo.PagerVo; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; /** @@ -50,22 +56,35 @@ public class ScmVehicleReturnRest implements ScmVehicleReturnFeign { } @Override - public ResultBean complete(ScmVehicleReturnFlowQuery scmVehicleReturnFlowQuery) { - return scmVehicleReturnService.complete(scmVehicleReturnFlowQuery); + public ResultBean getNextNodesForSubmit(ScmVehicleReturnDto scmVehicleReturnDto) { + return scmVehicleReturnService.getNextNodesForSubmit(scmVehicleReturnDto); } @Override - public ResultBean reject(ScmVehicleReturnFlowDto dto) { - return scmVehicleReturnService.reject(dto); + public ResultBean taskReject(FlowTaskVo flowTaskVo) { + return scmVehicleReturnService.taskReject(flowTaskVo); } @Override - public ResultBean breakProcess(ScmVehicleReturnFlowDto dto) { - return scmVehicleReturnService.breakProcess(dto); + public ResultBean complete(ScmVehicleReturnFlowQuery bvd) { + BusinessVariables bv=new BusinessVariables(); + BeanUtil.copyProperties(bvd,bv); + bv.setModelId(ProcDefEnum.SCMVEHICLERETURN.getProDefId()); + bv.setFormVariables(BeanUtil.beanToMap(bvd)); + return scmVehicleReturnService.complete(bv); + } + @Override + public ResultBean breakProcess(FlowTaskVo flowTaskVo) { + return scmVehicleReturnService.breakProcess(flowTaskVo); + } + @Override + public ResultBean revokeProcess( FlowTaskVo flowTaskVo) { + + return scmVehicleReturnService.revokeProcess(flowTaskVo); } @Override - public ResultBean revokeProcess(ScmVehicleReturnFlowDto dto) { - return scmVehicleReturnService.revokeProcess(dto); + public ResultBean getPreviousNodesForReject(ScmVehicleReturnFlowDto dto) { + return scmVehicleReturnService.getPreviousNodesForReject(dto); } } diff --git a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnService.java b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnService.java index 2e2e30fe76..1f7425034a 100644 --- a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnService.java +++ b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehiclereturn/ScmVehicleReturnService.java @@ -5,9 +5,12 @@ import cn.hutool.core.convert.Convert; import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.yxt.anrui.base.api.baseoutsourcingapplication.BaseOutsourcingApplicationDto; +import com.yxt.anrui.base.api.baseoutsourcingapplication.SubmitBaseOutSourcingApplicationDto; import com.yxt.anrui.base.api.basevehicle.BaseVehicleFeign; import com.yxt.anrui.base.api.basevehicle.BaseVehicleUpdateQuery; import com.yxt.anrui.flowable.api.flow.FlowableFeign; +import com.yxt.anrui.flowable.api.flow.UpdateFlowFieldVo; import com.yxt.anrui.flowable.api.flowtask.FlowTask; import com.yxt.anrui.flowable.api.flowtask.FlowTaskFeign; import com.yxt.anrui.flowable.api.flowtask.FlowTaskVo; @@ -18,8 +21,10 @@ import com.yxt.anrui.flowable.api.sysformlink.SysFormStateVo; import com.yxt.anrui.flowable.api.utils.ProcDefEnum; import com.yxt.anrui.flowable.api.utils.ProcessStateEnum; import com.yxt.anrui.flowable.sqloperationsymbol.BusinessVariables; +import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrg; import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; import com.yxt.anrui.portal.api.sysuser.SysUserFeign; +import com.yxt.anrui.portal.api.sysuser.SysUserInfoVo; import com.yxt.anrui.scm.api.scmvehiclereturn.*; import com.yxt.anrui.scm.api.scmvehiclereturndetails.ScmVehicleReturnDetails; import com.yxt.anrui.scm.api.scmvehiclereturndetails.ScmVehicleReturnDetailssVo; @@ -101,9 +106,9 @@ public class ScmVehicleReturnService extends MybatisBaseService sysUserInfoVoResultBean = sysUserFeign.selectUserInfoByUserSid(scmVehicleReturnDto.getUserSid()); + //取组织架构的全路径sid + SysStaffOrg sysStaffOrg = sysStaffOrgFeign.getOrgByStaffSid(sysUserInfoVoResultBean.getData().getStaffSid()).getData(); + String orgSidPath = sysStaffOrg.getOrgSidPath(); + Map variables = BeanUtil.beanToMap(scmVehicleReturnDto); ResultBean rb = ResultBean.fireFail(); - String orgSid = checkUserOrg(scmVehicleReturnDto.getUserSid()); if (scmVehicleReturnDto.getDetailsList().size() == 0) { return rb.setMsg("请选择需要退库的车辆"); } - ResultBean resultBean = saveOrUpdateVehicleReturn(scmVehicleReturnDto); + String busSid = scmVehicleReturnDto.getBusinessSid(); + if (org.apache.commons.lang3.StringUtils.isBlank(busSid)) { + ResultBean resultBean = saveOrUpdateVehicleReturn(scmVehicleReturnDto); + // ResultBean resultBean = saveOrUpdateDto(dto);//insert + String businessSid = resultBean.getData().toString(); + BusinessVariables bv = new BusinessVariables(); + BeanUtil.copyProperties(scmVehicleReturnDto, bv); + bv.setOrgSidPath(orgSidPath); + bv.setBusinessSid(businessSid); + bv.setUserSid(scmVehicleReturnDto.getUserSid()); + variables.put("businessSid", businessSid); + bv.setFormVariables(variables); + bv.setModelId(ProcDefEnum.SCMVEHICLERETURN.getProDefId()); + //如果taskid从业务的数据库中查询出来,那这个taskid 和当前的关系是什么 如果数据库中查询出来的taskid是第四个环节的id,但是目前是做的第一次的提交操作。 + // 应该是也不允许走if 也不运行走else 那应该如何验证这个id是否允许走else呢? + // 取出来业务数据的taskid和前端传递的taskid作比较 来判断数据的是否有效 本质上是数据版本一致性的问题 + ResultBean resultBean1 = flowableFeign.startProcess(bv); + UpdateFlowFieldVo uff = resultBean1.getData(); + updateFlowFiled(BeanUtil.beanToMap(uff)); + return resultBean1; + } + Map mm= submitBusinessData(scmVehicleReturnDto, busSid); + int r=(int)mm.get("r"); + ScmVehicleReturnDto booad = (ScmVehicleReturnDto) mm.get("bean"); + if (r == 0) { + return ResultBean.fireFail().setMsg("操作失败,提交的数据不一致!"); + } + + ResultBean resultBean = saveOrUpdateVehicleReturn(scmVehicleReturnDto);//update + String businessSid = resultBean.getData().toString(); + BusinessVariables bv = new BusinessVariables(); + BeanUtil.copyProperties(scmVehicleReturnDto, bv); + bv.setOrgSidPath(orgSidPath); + bv.setBusinessSid(businessSid); + bv.setUserSid(scmVehicleReturnDto.getUserSid()); + variables.put("businessSid", businessSid); + bv.setFormVariables(variables); + bv.setModelId(ProcDefEnum.SCMVEHICLERETURN.getProDefId()); + //如果taskid从业务的数据库中查询出来,那这个taskid 和当前的关系是什么 如果数据库中查询出来的taskid是第四个环节的id,但是目前是做的第一次的提交操作。 + // 应该是也不允许走if 也不运行走else 那应该如何验证这个id是否允许走else呢? + // 取出来业务数据的taskid和前端传递的taskid作比较 来判断数据的是否有效 本质上是数据版本一致性的问题 + + if (r == 1) { + ResultBean resultBean1 = flowableFeign.startProcess(bv); + UpdateFlowFieldVo uff = resultBean1.getData(); + updateFlowFiled(BeanUtil.beanToMap(uff)); + return resultBean1; + } else if (r == 2) { + bv.setTaskDefKey(booad.getTaskDefKey()); + bv.setComment(org.apache.commons.lang3.StringUtils.isNotBlank(scmVehicleReturnDto.getComment()) ? scmVehicleReturnDto.getComment() : "重新提交"); + bv.setInstanceId(booad.getInstanceId()); + return complete(bv); + } + return ResultBean.fireFail();/* if (resultBean.getSuccess()) { String businessSid = resultBean.getData().toString(); //判断车辆的状态是否包含采购退库的状态,如果是的话,返回审核失败 @@ -202,7 +264,6 @@ public class ScmVehicleReturnService extends MybatisBaseService variables = new HashMap<>(); variables.put("businessSid", businessSid); if (Integer.parseInt(scmVehicleReturnDto.getMoney()) > 0) { variables.put("isLoan", true); @@ -210,16 +271,18 @@ public class ScmVehicleReturnService extends MybatisBaseService businessResultBean =flowableFeign.startProcess(bv);//flowableFeign.businessStart(bv); if (businessResultBean.getSuccess() && businessResultBean.getData() != null) { - Map map = (Map) businessResultBean.getData(); - //更新退库业务表中的流程状态 - modifyFlowState(businessSid, - ProcDefEnum.SCMVEHICLERETURN.getProDefId(),//procDefId - map.get("nodeState"),//state - map.get("procInsId"),//procInstSid - map.get("taskDefKey")//nodeSid - ); + UpdateFlowFieldVo uff = businessResultBean.getData(); + updateFlowFiled(BeanUtil.beanToMap(uff)); } else { return rb.setMsg(businessResultBean.getMsg()); } @@ -227,9 +290,25 @@ public class ScmVehicleReturnService extends MybatisBaseService submitBusinessData(ScmVehicleReturnDto dto, + String businessSid ) { + Map map=new HashMap<>(); + int r = 0; + ScmVehicleReturnDto booad = baseMapper.getBySid(businessSid); + String businessTaskid = booad.getTaskId(); + if (org.apache.commons.lang3.StringUtils.isBlank(businessTaskid) && org.apache.commons.lang3.StringUtils.isBlank(dto.getTaskId())) { + // 新提交 taskid都是空的 + r = 1; + } else if (org.apache.commons.lang3.StringUtils.isNotBlank(businessTaskid) && businessTaskid.equals(dto.getTaskId())) {//只有数据一致的时候才能进行下一步 + r = 2; + } + map.put("r",r); + map.put("bean",booad); + return map; + } /** * 查询用户是否设置了部门 * * @@ -247,58 +326,42 @@ public class ScmVehicleReturnService extends MybatisBaseService variables = Convert.toMap(String.class, Object.class, scmVehicleReturnFlowQuery); - BusinessVariables bv = BusinessVariables.builder().build(); - bv.setFormVariables(variables); - boolean isTrue = isTrue(scmVehicleReturnFlowQuery.getBusinessSid()); + boolean isTrue = isTrue(bv.getBusinessSid()); if (isTrue) { return rb.setMsg("该申请中包含车辆状态已是采购退库状态的车辆"); } - ResultBean resultBean = flowTaskFeign.businessComplete(bv); - if (!resultBean.getSuccess()) { - return resultBean; - } - String nodeState = ""; - String taskDefKey = ""; - Map map = new HashMap<>(); - map.put("businessSid", variables.get("businessSid").toString()); - if (resultBean.getData() != null) { - ResultBean> listResultBean = flowTaskFeign.getLatestTasks(resultBean.getData().getProcInsId()); - if (listResultBean.getSuccess() && listResultBean.getData().size() != 0) { - nodeState = listResultBean.getData().get(0).getName_(); - taskDefKey = listResultBean.getData().get(0).getTask_def_key_(); - } else { - nodeState = ProcessStateEnum.FINISHED.getStateName(); - taskDefKey = "Event_end"; - map.put("flowState", SysFormLinkFlowStateEnum.FINISH.getCode()); - updateByVinNo(scmVehicleReturnFlowQuery.getBusinessSid()); - + bv.getFormVariables().put("isLoan",true); + ScmVehicleReturnDto booad = baseMapper.getBySid(bv.getBusinessSid()); + String businessTaskid = booad.getTaskId(); + if (businessTaskid.equals(bv.getTaskId())) { //只有数据一致的时候才能进行下一步 + ResultBean rb1 = flowableFeign.handleProsess(bv); + Map stringObjectMap = BeanUtil.beanToMap(rb1.getData()); + updateFlowFiled(stringObjectMap); + return rb1; + } else { + return ResultBean.fireFail().setMsg("操作失败,提交的数据不一致!"); } } - map.put("nodeState", nodeState); - map.put("taskDefKey", taskDefKey); - sysFormLinkFeign.updateFiled(map); - return rb.success(); + + + /** + * 更新流程相关的状态 + * + * @param map + * @return + */ + private int updateFlowFiled(Map map) { + return baseMapper.updateFlowFiled(map); } public Boolean isTrue(String businessSid) { @@ -363,8 +426,21 @@ public class ScmVehicleReturnService extends MybatisBaseService resultBean = flowableFeign.breakProcess(fl); + updateFlowFiled(BeanUtil.beanToMap(resultBean.getData())); + return resultBean; + }else{ + return ResultBean.fireFail().setMsg("操作失败,提交的数据不一致!"); + } + + /* FlowTaskVo flowTaskVo = new FlowTaskVo(); BeanUtil.copyProperties(dto, flowTaskVo); ResultBean resultBean = flowTaskFeign.breakProcess(flowTaskVo); if (!resultBean.getSuccess()) { @@ -376,10 +452,25 @@ public class ScmVehicleReturnService extends MybatisBaseService resultBean = flowableFeign.revokeProcess(fl); + Map stringObjectMap = BeanUtil.beanToMap(resultBean.getData()); + updateFlowFiled(stringObjectMap); + return resultBean; + }else{ + return ResultBean.fireFail().setMsg("操作失败,提交的数据不一致!"); + } +/* FlowTaskVo flowTaskVo = new FlowTaskVo(); BeanUtil.copyProperties(dto, flowTaskVo); ResultBean> resultBean = flowTaskFeign.revokeProcess(flowTaskVo); @@ -400,7 +491,7 @@ public class ScmVehicleReturnService extends MybatisBaseService details(String sid) { @@ -428,4 +519,49 @@ public class ScmVehicleReturnService extends MybatisBaseService resultBean = flowableFeign.taskReject(fl); + UpdateFlowFieldVo data = resultBean.getData(); + Map stringObjectMap = BeanUtil.beanToMap(resultBean.getData()); + stringObjectMap.put("taskDefKey", data.getTaskDefKey()); + stringObjectMap.put("procInstSid", boad.getInstanceId()); + stringObjectMap.put("procDefId", boad.getProcDefId()); + stringObjectMap.put("nodeState", data.getNodeState()); + updateFlowFiled(stringObjectMap); + return resultBean; + }else{ + return ResultBean.fireFail().setMsg("操作失败,提交的数据不一致!"); + } + } } diff --git a/anrui-scm/anrui-scm-ui/src/api/flow/vehicleReturn.js b/anrui-scm/anrui-scm-ui/src/api/flow/vehicleReturn.js index 6ee6bace35..b234ccdd2b 100644 --- a/anrui-scm/anrui-scm-ui/src/api/flow/vehicleReturn.js +++ b/anrui-scm/anrui-scm-ui/src/api/flow/vehicleReturn.js @@ -1,10 +1,32 @@ import request from '@/utils/request' + +///scm/v1/scmvehiclereturn/listPage' export default { + getPreviousNodesForReject: function(formobj) { + return request({ + url: '/scm/v1/scmvehiclereturn/getPreviousNodesForReject', + method: 'post', + data: formobj, + headers: { + 'Content-Type': 'application/json' + } + }) + }, + getNextNodesForSubmit: function(data) { + return request({ + url: '/scm/v1/scmvehiclereturn/getNextNodesForSubmit', + method: 'post', + data: data, + headers: { + 'Content-Type': 'application/json' + } + }) + }, // 同意任务 agreeTask: function(params) { return request({ - url: '/portal/v1/flow/complete', + url: '/scm/v1/scmvehiclereturn/complete', method: 'post', data: params, headers: { @@ -15,7 +37,7 @@ export default { // 驳回任务 rejectTask: function(params) { return request({ - url: '/portal/v1/flow/reject/' + params.businessSid, + url: '/scm/v1/scmvehiclereturn/reject', method: 'post', data: params, headers: { @@ -26,7 +48,7 @@ export default { // 终止任务 breakTask: function(params) { return request({ - url: '/portal/v1/flow/breakProcess/' + params.businessSid, + url: '/scm/v1/scmvehiclereturn/breakProcess', method: 'post', data: params, headers: { @@ -37,7 +59,7 @@ export default { // 撤回任务 revokeTask: function(params) { return request({ - url: '/portal/v1/flow/revokeProcess/' + params.userSid + '/' + params.businessSid, + url: '/scm/v1/scmvehiclereturn/revokeProcess', method: 'post', data: params, headers: { @@ -45,5 +67,4 @@ export default { } }) } - } diff --git a/anrui-scm/anrui-scm-ui/src/views/baseoutsourcingapplication/workflow/baseoutsourcingapplication.vue b/anrui-scm/anrui-scm-ui/src/views/baseoutsourcingapplication/workflow/baseoutsourcingapplication.vue index b69472e7c5..b04cd8f80e 100644 --- a/anrui-scm/anrui-scm-ui/src/views/baseoutsourcingapplication/workflow/baseoutsourcingapplication.vue +++ b/anrui-scm/anrui-scm-ui/src/views/baseoutsourcingapplication/workflow/baseoutsourcingapplication.vue @@ -285,7 +285,6 @@ export default { this.nextNode=arr[0] this.nodeDialogVisible = true } - this.submitdisabled = false }); }, diff --git a/anrui-scm/anrui-scm-ui/src/views/supplychain/caigoutuiku/caigoutuikuAdd.vue b/anrui-scm/anrui-scm-ui/src/views/supplychain/caigoutuiku/caigoutuikuAdd.vue index 971d0825af..f0e7d20e9c 100644 --- a/anrui-scm/anrui-scm-ui/src/views/supplychain/caigoutuiku/caigoutuikuAdd.vue +++ b/anrui-scm/anrui-scm-ui/src/views/supplychain/caigoutuiku/caigoutuikuAdd.vue @@ -288,7 +288,6 @@ }, handleSubmit() { const _this = this - console.log('111222333',this.formobj) this.$refs['form_obj'].validate(valid => { if (valid) { this.submitdisabled = true diff --git a/anrui-scm/anrui-scm-ui/src/views/workFlow/caigoutuikuFlow/caigoutuiku.vue b/anrui-scm/anrui-scm-ui/src/views/workFlow/caigoutuikuFlow/caigoutuiku.vue index 8e7822fd3f..2949431ba4 100644 --- a/anrui-scm/anrui-scm-ui/src/views/workFlow/caigoutuikuFlow/caigoutuiku.vue +++ b/anrui-scm/anrui-scm-ui/src/views/workFlow/caigoutuikuFlow/caigoutuiku.vue @@ -85,6 +85,49 @@ + + + + + 当前环节 + + {{ formobj.taskName }}->{{ nextNode.name }} + + + + 意见 + + + + +
+ 确 定 + 取 消 +
+
+
+ + + + + + 当前环节 + + {{ formobj.taskName }}->{{ nextNode.name }} + + + + 意见 + + + + +
+ 确 定 + 取 消 +
+
+
@@ -96,19 +139,30 @@ name: 'caigoutuiku', data() { return { + nodeDialogVisibleForReject:false, + nodeDialogVisible:false, isXuanche: false, viewTitle: '', dialogStatus: '', index: 0, list: [], + //下一环节 + nextNode:{}, // 表单数据 formobj: { + orgSidPath: window.sessionStorage.getItem('orgSidPath'), + userSid: window.sessionStorage.getItem('userSid'), sid: '', // 一条数据的sid applicationCode: '', name: window.sessionStorage.getItem('name'), createTime: '', - userSid: window.sessionStorage.getItem('userSid'), // 用户人sid - detailsList: [] + detailsList: [], + businessSid: '', + comment: '', + instanceId: '', + taskId: '', + taskDefKey:'', + taskName:'' }, agreeList: { //同意办理列表 businessSid: '', @@ -131,39 +185,58 @@ taskId: '', userSid: window.sessionStorage.getItem('userSid') }, + obj:{}, rules: {}, disabled: false } }, created() { + var one = window.location.href.indexOf('&data') + 6 + const data = window.location.href.substr(one) // url解码unescape()已从web中移除,尽量不使用 + const obj = JSON.parse(decodeURIComponent(data)) + this.obj=obj; // ===获取sid console.log('iframe页面获取到的url:' + window.location.href) - var a = window.location.href.indexOf('?') + 1 // 第一个?后面的一个字符的位置 - var b = window.location.href.indexOf('#data') // 第一个#data出现的位置 - const info = window.location.href.slice(a, b) - var sid = info.substr(info.indexOf('=') + 1) - this.showInfo(sid) + this.showInfo(obj.businessSid) // ===获取参数 - var one = window.location.href.lastIndexOf('#') + 1 - var two = window.location.href.lastIndexOf('}') + 1 - const data = decodeURI(window.location.href.slice(one, two)) // url解码unescape()已从web中移除,尽量不使用 - var tar = data.substr(data.indexOf('=') + 1) - const obj = JSON.parse(tar) console.log('iframe页面获取的obj:', obj) // 同意列表 - this.agreeList.businessSid = sid + this.agreeList.businessSid = obj.businessSid this.agreeList.instanceId = obj.instanceId this.agreeList.taskId = obj.taskId + this.agreeList.taskDefKey = obj.taskDefKey + this.agreeList.taskName = obj.taskName + // 驳回列表 - this.regectList.businessSid = sid + this.regectList.businessSid = obj.businessSid this.regectList.instanceId = obj.instanceId this.regectList.taskId = obj.taskId // 终止列表 - this.stopList.businessSid = sid + this.stopList.businessSid = obj.businessSid this.stopList.instanceId = obj.instanceId this.stopList.taskId = obj.taskId + window.parent.postMessage({ + cmd: 'returnHeight', + params: { + //告诉父级页面,子页面的弹框高度。 + code: 2, + data: 600 + 'px' + } + }, '*') }, methods: { + reject(){ + if(this.formobj.comment==''){ + alert('请填写审批意见!'); + } + this.handleReject(); + }, + //关闭弹出框 选择待办人弹框 + closeNodeDialog(){ + this.nodeDialogVisible = false + this.nodeDialogVisibleForReject=false + }, + // 返回(===既判断又赋值) handleReturn() { this.formobj.sid = '' @@ -177,7 +250,7 @@ }) this.dialogStatus = 'edit' this.viewTitle = '【编辑】车辆采购退库申请' - req.detailsInfo(sid).then(resp => { + req.detailsInfo({'sid':sid}).then(resp => { const data = resp.data this.formobj = data }).catch(e => { @@ -192,20 +265,52 @@ // 同意 openAgree() { - this.$confirm('是否确认执行同意操作', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }) - .then(() => { - this.handleAgree() - }) - .catch(() => { - this.$message({ - type: 'info', - message: '已取消同意' + //查验下一环节要用到,流程定义的id + this.formobj.businessSid = this.obj.businessSid + this.formobj.instanceId = this.obj.instanceId + this.formobj.taskId = this.obj.taskId + this.formobj.taskDefKey = this.obj.taskDefKey + this.formobj.taskName = this.obj.taskName + this.formobj.userSid = window.sessionStorage.getItem('userSid') + this.formobj.orgSidPath = window.sessionStorage.getItem('orgSidPath') + request.getNextNodesForSubmit(this.formobj).then(resp=>{ + if (resp.success) { + var arr= resp.data; + this.nextNode=arr[0] + this.nodeDialogVisible = true + } + this.submitdisabled = false + }); + }, + //同意任务 + agree() { + if(this.formobj.comment==''){ + alert('请填写审批意见!'); + return; + } + //意见 + //下一环节的用户sid + //调用后台接口流转 + request.agreeTask(this.formobj).then((response) => { + if (response.code === '200') { + this.nodeDialogVisible=false; + //子页面向父级页面传递值 + window.parent.postMessage({ + cmd: 'returnHeight', + params: { + //操作成功,告诉父级页面关闭弹框 + code: 1 + } + }, '*') + } else { + this.$notify({ + title: '提示', + message: '执行失败', + type: 'error', + duration: 2000 }) - }) + } + }) }, /** 同意任务 */ handleAgree() { @@ -231,7 +336,7 @@ }, // 驳回 openReject() { - this.$confirm('是否确认执行驳回操作', '提示', { + /* this.$confirm('是否确认执行驳回操作', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' @@ -244,11 +349,31 @@ type: 'info', message: '已取消驳回' }) - }) + })*/ + this.formobj.businessSid = this.obj.businessSid + this.formobj.instanceId = this.obj.instanceId + this.formobj.taskId = this.obj.taskId + this.formobj.taskDefKey = this.obj.taskDefKey + this.formobj.taskName = this.obj.taskName + this.formobj.userSid = window.sessionStorage.getItem('userSid') + this.formobj.orgSidPath = window.sessionStorage.getItem('orgSidPath') + request.getPreviousNodesForReject(this.formobj).then(resp=>{ + if (resp.success) { + var arr= resp.data; + //循环获取当前环节的下一个环节信息 + var startTask=arr[0].startTask; + if(startTask){ + alert('当前环节不能驳回!'); + return; + } + this.nextNode=arr[0] + this.nodeDialogVisibleForReject = true + } + }); }, /** 驳回任务 */ handleReject() { - this.regectList.comment = this.comment + this.regectList.comment = this.formobj.comment request.rejectTask(this.regectList).then((response) => { if (response.code === '200') { this.$notify({ @@ -258,6 +383,13 @@ duration: 2000 }) // this.refreshIt() + this.nodeDialogVisible=false; + window.parent.postMessage({ + cmd: 'returnHeight', + params: { + code: 1 + } + }, '*') } else { this.$notify({ title: '提示', @@ -290,12 +422,18 @@ this.stopList.comment = this.comment request.breakTask(this.stopList).then((response) => { if (response.code === '200') { - this.$notify({ + /*this.$notify({ title: '提示', message: '执行成功', type: 'success', duration: 2000 - }) + })*/ + window.parent.postMessage({ + cmd: 'returnHeight', + params: { + code: 1 + } + }, '*') // this.refreshIt() } else { this.$notify({ diff --git a/anrui-scm/anrui-scm-ui/src/views/workFlow/caigoutuikuFlow/caigoutuikuEdit.vue b/anrui-scm/anrui-scm-ui/src/views/workFlow/caigoutuikuFlow/caigoutuikuEdit.vue index fd0fa625d7..90750fde37 100644 --- a/anrui-scm/anrui-scm-ui/src/views/workFlow/caigoutuikuFlow/caigoutuikuEdit.vue +++ b/anrui-scm/anrui-scm-ui/src/views/workFlow/caigoutuikuFlow/caigoutuikuEdit.vue @@ -14,7 +14,7 @@ @click="saveEdit()" >保存 - 提交 + 提交 终 止 @@ -133,6 +133,7 @@ dialogStatus: '', index: 0, list: [], + obj: {}, // 表单数据 formobj: { sid: '', // 一条数据的sid @@ -140,7 +141,13 @@ name: '', createTime: '', userSid: '', // 用户人sid - detailsList: [] + detailsList: [], + businessSid: '', + comment: '', + instanceId: '', + taskId: '', + taskDefKey:'', + taskName:'' }, stopList: { // 终止列表 businessSid: '', @@ -155,24 +162,27 @@ } }, created() { + var one = window.location.href.indexOf('&data') + 6 + const data = window.location.href.substr(one) // url解码unescape()已从web中移除,尽量不使用 + const obj = JSON.parse(decodeURIComponent(data)) + this.obj=obj; // ===获取sid console.log('iframe页面获取到的url:' + window.location.href) - var a = window.location.href.indexOf('?') + 1 // 第一个?后面的一个字符的位置 - var b = window.location.href.indexOf('#data') // 第一个#data出现的位置 - const info = window.location.href.slice(a, b) - var sid = info.substr(info.indexOf('=') + 1) - this.showEdit(sid) + this.showEdit(obj.businessSid) // ===获取参数 - var one = window.location.href.lastIndexOf('#') + 1 - var two = window.location.href.lastIndexOf('}') + 1 - const data = decodeURI(window.location.href.slice(one, two)) // url解码unescape()已从web中移除,尽量不使用 - var tar = data.substr(data.indexOf('=') + 1) - const obj = JSON.parse(tar) - console.log('iframe页面获取的obj:', obj) // 终止列表 - this.stopList.businessSid = sid + this.stopList.businessSid = obj.businessSid this.stopList.instanceId = obj.instanceId this.stopList.taskId = obj.taskId + + window.parent.postMessage({ + cmd: 'returnHeight', + params: { + //告诉父级页面,子页面的弹框高度。 + code: 2, + data: 600 + 'px' + } + }, '*') }, methods: { init() { @@ -217,6 +227,7 @@ }).then(resp => { const data = resp.data this.formobj = data + this.formobj.sid=this.obj.businessSid this.list = data.voList // ---修改名称 先把temp对象转化成json字符串做替换字符串操作,再转化成temp对象--- this.formobj = JSON.parse(JSON.stringify(this.formobj).replace(/voList/g, 'detailsList') @@ -289,6 +300,11 @@ }) }, handleSubmit() { + this.submitdisabled = true + this.formobj.userSid = window.sessionStorage.getItem('userSid') + this.formobj.orgSid = this.$store.getters.orgSid + this.formobj.businessSid = this.obj.businessSid + this.formobj.taskId = this.obj.taskId const _this = this this.$refs['form_obj'].validate(valid => { if (valid) { diff --git a/anrui-scm/anrui-scm-ui/src/views/workFlow/caigoutuikuFlow/caigoutuikuInfo.vue b/anrui-scm/anrui-scm-ui/src/views/workFlow/caigoutuikuFlow/caigoutuikuInfo.vue index 902f788ed1..fa0bf92294 100644 --- a/anrui-scm/anrui-scm-ui/src/views/workFlow/caigoutuikuFlow/caigoutuikuInfo.vue +++ b/anrui-scm/anrui-scm-ui/src/views/workFlow/caigoutuikuFlow/caigoutuikuInfo.vue @@ -6,7 +6,7 @@
{{ viewTitle }}
-
+
撤 回
@@ -115,32 +115,37 @@ taskId: '', userSid: window.sessionStorage.getItem('userSid') }, + obj:{}, rules: {}, disabled: false } }, created() { + var one = window.location.href.indexOf('&data') + 6 + const data = window.location.href.substr(one) // url解码unescape()已从web中移除,尽量不使用 + const obj = JSON.parse(decodeURIComponent(data)) + this.obj=obj; // ===获取sid console.log('iframe页面获取到的url:' + window.location.href) - var a = window.location.href.indexOf('?') + 1 // 第一个?后面的一个字符的位置 - var b = window.location.href.indexOf('#data') // 第一个#data出现的位置 - const info = window.location.href.slice(a, b) - var sid = info.substr(info.indexOf('=') + 1) - this.showInfo(sid) + this.showInfo(obj.businessSid) // ===获取参数 - var one = window.location.href.lastIndexOf('#') + 1 - var two = window.location.href.lastIndexOf('}') + 1 - const data = decodeURI(window.location.href.slice(one, two)) // url解码unescape()已从web中移除,尽量不使用 - var tar = data.substr(data.indexOf('=') + 1) - const obj = JSON.parse(tar) console.log('iframe页面获取的obj:', obj) if (obj.taskName == '已完结' || '已终止') { this.isBtnShow = false } // 撤回列表 - this.revokeList.businessSid = sid + this.revokeList.businessSid = obj.businessSid this.revokeList.instanceId = obj.instanceId this.revokeList.taskId = obj.taskId + + window.parent.postMessage({ + cmd: 'returnHeight', + params: { + //告诉父级页面,子页面的弹框高度。 + code: 2, + data: 600 + 'px' + } + }, '*') }, methods: { // 返回(===既判断又赋值) @@ -185,15 +190,27 @@ }, /** 撤回任务 */ handleRevoke() { - console.log('1111122222', this.revokeList) + this.revokeList.businessSid = this.obj.businessSid + this.revokeList.instanceId = this.obj.instanceId + this.revokeList.taskId = this.obj.taskId + this.revokeList.taskDefKey = this.obj.taskDefKey + this.revokeList.taskName = this.obj.taskName + this.revokeList.userSid = window.sessionStorage.getItem('userSid') + this.revokeList.orgSidPath = window.sessionStorage.getItem('orgSidPath') request.revokeTask(this.revokeList).then((response) => { if (response.code === '200') { - this.$notify({ + /*this.$notify({ title: '提示', message: '执行成功', type: 'success', duration: 2000 - }) + })*/ + window.parent.postMessage({ + cmd: 'returnHeight', + params: { + code: 1, + } + }, '*') } else { this.$notify({ title: '提示', diff --git a/anrui-system-ui/src/views/flow/doneList.vue b/anrui-system-ui/src/views/flow/doneList.vue index bf1c9b2e3c..7af8d15998 100644 --- a/anrui-system-ui/src/views/flow/doneList.vue +++ b/anrui-system-ui/src/views/flow/doneList.vue @@ -261,6 +261,7 @@ this.selectUrl_list.taskDefKey = row.taskDefKey this.selectUrl_list.type = 2 // 详情 const parameter_list = { + businessSid: row.processVariables.businessSid, instanceId: row.procInsId, taskId: row.taskId, taskDefKey: row.taskDefKey, diff --git a/anrui-system-ui/src/views/flow/todoList.vue b/anrui-system-ui/src/views/flow/todoList.vue index 7a3d566a5a..34bc2f18c0 100644 --- a/anrui-system-ui/src/views/flow/todoList.vue +++ b/anrui-system-ui/src/views/flow/todoList.vue @@ -108,8 +108,12 @@ - -
+ +
+
+ 流程图 + +
-
- 流程图 - -
@@ -272,6 +272,7 @@ export default { iframe.height = this.dialogHeight;//iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight; }, async handleMessage (event) { + console.log(event); var code= event.data.params.code; if(code==1){ this.init()