Browse Source

Merge remote-tracking branch 'origin/master'

master
hanlinghao 3 years ago
parent
commit
bed03f1bf9
  1. 6
      anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/commoncontract/CommonContractService.java
  2. 2
      anrui-flowable/anrui-flowable-api/src/main/java/com/yxt/anrui/flowable/api/utils/ProcDefEnum.java
  3. 12
      anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flowtask/FlowTaskMapper.xml
  4. 4
      anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flowtask/FlowTaskService.java
  5. 23
      anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/listener/BaseVehicleExecutionListener.java
  6. 51
      anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/flow/FlowTaskVo.java
  7. 8
      anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/flow/Flowable.java
  8. 4
      anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundDto.java
  9. 38
      anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundFeign.java
  10. 38
      anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundFeignFallback.java
  11. 28
      anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/SubmitScmApplyInboundDto.java
  12. 12
      anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/flow/FlowableMapper.java
  13. 5
      anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/flow/FlowableMapper.xml
  14. 99
      anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/flow/FlowableService.java
  15. 3
      anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundMapper.java
  16. 14
      anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundMapper.xml
  17. 32
      anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundRest.java
  18. 211
      anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundService.java

6
anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/commoncontract/CommonContractService.java

@ -683,7 +683,11 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp
}
if (StringUtils.isNotBlank(future5.get())) {
printConfirmVo = new PrintConfirmVo();
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTNEWBLANK.getName()));
// 待确认:现车或订车
// 现车
// printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTNEWBLANK.getName()));
// 订车
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTBOOKBLANK.getName()));
printConfirmVo.setDownloadUrl(future5.get());
list.add(printConfirmVo);
}

2
anrui-flowable/anrui-flowable-api/src/main/java/com/yxt/anrui/flowable/api/utils/ProcDefEnum.java

@ -14,7 +14,7 @@ public enum ProcDefEnum {
ADVANCEGINVOICEAPPLY("提前开票申请流程","advance_ginvoiceapply:1:242664"),
ARREARSCARRYVEHICLE("欠款提车审批流程","arrears_carryvehicle:1:232589"),
VEHICLEAPPLY("排产申请流程","process_9egcg169:1:242660"),
RECORDAPPLICATION("入账申请","record_application_7y80d4r8"),
RECORDAPPLICATION("入账申请","record_application_7y80d4r8:1:265008"),
;
ProcDefEnum(String proDefName, String proDefId) {

12
anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flowtask/FlowTaskMapper.xml

@ -125,9 +125,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT * FROM (
SELECT DISTINCT
ahti.ID_,
/*ahti.NAME_,*/
ahti.NAME_,
ahti.ASSIGNEE_,
ahti.START_TIME_,
ahti.TASK_DEF_KEY_ taskDefKey,
ahpi.START_USER_ID_,
ahpi.END_ACT_ID_,
ahpi.END_TIME_,
@ -136,13 +137,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
arpd.KEY_ AS PROC_DEF_KEY_,
arpd.NAME_ AS PROC_DEF_NAME_,
arpd.VERSION_ AS PROC_DEF_VERSION_,
arpd.DEPLOYMENT_ID_ AS DEPLOYMENT_ID_,
sfl.taskDefKey AS taskDefKey,
sfl.nodeState NAME_
arpd.DEPLOYMENT_ID_ AS DEPLOYMENT_ID_
/*sfl.taskDefKey AS taskDefKey,*/
/*sfl.nodeState NAME_*/
FROM ACT_HI_PROCINST ahpi
INNER JOIN (SELECT PROC_INST_ID_ from ACT_HI_TASKINST WHERE ASSIGNEE_=#{userSid} AND END_TIME_ IS NOT NULL)
temp ON ahpi.PROC_INST_ID_=temp.PROC_INST_ID_
LEFT JOIN ACT_HI_TASKINST ahti on ahti.PROC_INST_ID_=temp.PROC_INST_ID_
/*LEFT JOIN ACT_HI_TASKINST ahti on ahti.PROC_INST_ID_=temp.PROC_INST_ID_*/
LEFT JOIN (SELECT * FROM (SELECT DISTINCT(ID_) ID_,NAME_,ASSIGNEE_,START_TIME_,TASK_DEF_KEY_,PROC_INST_ID_ FROM ACT_HI_TASKINST ORDER BY START_TIME_ DESC) t1 GROUP BY t1.PROC_INST_ID_) ahti ON ahti.PROC_INST_ID_ = temp.PROC_INST_ID_
INNER JOIN `ACT_HI_VARINST` A0 ON ahpi.PROC_INST_ID_ = A0.PROC_INST_ID_
LEFT JOIN ACT_RE_PROCDEF arpd ON ahpi.PROC_DEF_ID_ = arpd.ID_
LEFT JOIN sys_form_link sfl ON ahpi.PROC_INST_ID_ = sfl.procInsId

4
anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flowtask/FlowTaskService.java

@ -1003,6 +1003,10 @@ public class FlowTaskService extends MybatisBaseService<FlowTaskMapper, FlowTask
// 目的获取所有需要被跳转的节点 currentIds
// 取其中一个父级任务,因为后续要么存在公共网关,要么就是串行公共线路
UserTask oneUserTask = parentUserTaskList.get(0);
// 判断是否驳回到发起环节,设置发起人
if (oneUserTask.getIncomingFlows().get(0).getSourceRef().contains("start")) {
oneUserTask.setAssignee(historicTaskInstanceList.get(0).getAssignee());
}
// 获取所有正常进行的任务节点 Key,这些任务不能直接使用,需要找出其中需要撤回的任务
List<Task> runTaskList = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()).list();
List<String> runTaskKeyList = new ArrayList<>();

23
anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/listener/BaseVehicleExecutionListener.java

@ -0,0 +1,23 @@
package com.yxt.anrui.flowable.listener;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;
/**
* @author liuguohui
* @version 1.0
* @description 建立车辆库存台账
* @date 2022/04/11
*/
@Component
public class BaseVehicleExecutionListener implements ExecutionListener {
@Override
public void notify(DelegateExecution execution) {
// 入账申请审批通过后,自动生成车辆库存台账
// TODO
System.out.println("入账申请审批通过后,自动生成车辆库存台账");
}
}

51
anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/flow/FlowTaskVo.java

@ -0,0 +1,51 @@
package com.yxt.anrui.scm.api.flow;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>流程任务<p>
*
* @author XuanXuan
* @date 2021-04-03
*/
@ApiModel("工作流任务相关--请求参数")
@Data
public class FlowTaskVo {
@ApiModelProperty("任务Id")
private String taskId;
@ApiModelProperty("用户Id")
private String userId;
@ApiModelProperty("用户Sid")
private String userSid;
@ApiModelProperty("任务意见")
private String comment;
@ApiModelProperty("流程实例Id")
private String instanceId;
@ApiModelProperty("节点")
private String targetKey;
@ApiModelProperty("流程变量信息")
private Map<String, Object> values=new HashMap<>();
@ApiModelProperty("审批人")
private String assignee;
@ApiModelProperty("候选人")
private List<String> candidateUsers=new ArrayList<>();
@ApiModelProperty("审批组")
private List<String> candidateGroups=new ArrayList<>();
}

8
anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/flow/Flowable.java

@ -0,0 +1,8 @@
package com.yxt.anrui.scm.api.flow;
import com.yxt.common.core.domain.BaseEntity;
import lombok.Data;
@Data
public class Flowable extends BaseEntity {
}

4
anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundDto.java

@ -32,6 +32,10 @@ public class ScmApplyInboundDto implements Dto {
@ApiModelProperty("车辆入账单sid")
private String sid;
@ApiModelProperty("用户sid")
@NotBlank(message = "用户sid不能为空")
private String userSid;
@ApiModelProperty("申请编号")
@NotBlank(message = "申请编号不能为空")

38
anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundFeign.java

@ -1,15 +1,18 @@
package com.yxt.anrui.scm.api.scmapplyinbound;
import com.yxt.anrui.scm.api.flow.FlowTaskVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
* Project: anrui-scm(进销存) <br/>
@ -47,4 +50,39 @@ public interface ScmApplyInboundFeign {
@ApiOperation("根据sid查询车辆入账单详情")
@GetMapping("/fetchSid/{sid}")
public ResultBean<ScmApplyInboundVo> fetchSid(@PathVariable("sid") String sid);
/*************************************************审批流程***************************************************/
@ApiOperation("提交入账申请")
@PostMapping("/submitRecordApplication")
public ResultBean submitRecordApplication(@RequestBody @Valid SubmitScmApplyInboundDto dto);
@ApiOperation(value = "办理(同意)")
@PostMapping("/complete")
public ResultBean complete(@ApiParam(value = "变量集合,json对象") @RequestBody Map<String, Object> variables);
@ApiOperation(value = "撤回流程")
@PostMapping(value = "/revokeProcess/{userSid}/{businessSid}")
public ResultBean revokeProcess(
@ApiParam(value = "用户sid") @PathVariable(value = "userSid")String userSid,
@ApiParam(value = "业务sid") @PathVariable(value = "businessSid")String businessSid,
@ApiParam(value = "工作流任务相关--请求参数") @RequestBody FlowTaskVo flowTaskVo) ;
@ApiOperation(value = "驳回任务")
@PostMapping(value = "/reject/{businessSid}")
public ResultBean taskReject(@ApiParam(value = "业务sid") @PathVariable(value = "businessSid")String businessSid,
@ApiParam(value = "工作流任务相关--请求参数")@RequestBody FlowTaskVo flowTaskVo);
@ApiOperation(value = "终止任务")
@PostMapping(value = "/breakProcess/{businessSid}")
public ResultBean breakProcess(@ApiParam(value = "业务sid") @PathVariable(value = "businessSid")String businessSid,
@RequestBody FlowTaskVo flowTaskVo);
@ApiOperation(value = "流程历史流转记录" )
@GetMapping(value = "/task/flowRecord/{procInsId}/{deployId}")
public ResultBean flowRecord( @ApiParam(value = "流程实例id")@PathVariable(value = "procInsId")String procInsId,
@ApiParam(value = "目前没用")@PathVariable(value = "deployId")String deployId);
/*************************************************审批流程***************************************************/
}

38
anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundFeignFallback.java

@ -1,11 +1,13 @@
package com.yxt.anrui.scm.api.scmapplyinbound;
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 org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
* Project: anrui-scm(进销存) <br/>
@ -45,4 +47,40 @@ public class ScmApplyInboundFeignFallback implements ScmApplyInboundFeign {
ResultBean rb = ResultBean.fireFail();
return rb.setMsg("接口anrui-scm/scmapplyinbound/fetchSid无法访问");
}
@Override
public ResultBean submitRecordApplication(SubmitScmApplyInboundDto dto) {
ResultBean rb = ResultBean.fireFail();
return rb.setMsg("接口anrui-scm/scmapplyinbound/submitRecordApplication无法访问");
}
@Override
public ResultBean complete(Map<String, Object> variables) {
ResultBean rb = ResultBean.fireFail();
return rb.setMsg("接口anrui-scm/scmapplyinbound/complete无法访问");
}
@Override
public ResultBean revokeProcess(String userSid, String businessSid, FlowTaskVo flowTaskVo) {
ResultBean rb = ResultBean.fireFail();
return rb.setMsg("接口anrui-scm/scmapplyinbound/revokeProcess无法访问");
}
@Override
public ResultBean taskReject(String businessSid, FlowTaskVo flowTaskVo) {
ResultBean rb = ResultBean.fireFail();
return rb.setMsg("接口anrui-scm/scmapplyinbound/taskReject无法访问");
}
@Override
public ResultBean breakProcess(String businessSid, FlowTaskVo flowTaskVo) {
ResultBean rb = ResultBean.fireFail();
return rb.setMsg("接口anrui-scm/scmapplyinbound/breakProcess无法访问");
}
@Override
public ResultBean flowRecord(String procInsId, String deployId) {
ResultBean rb = ResultBean.fireFail();
return rb.setMsg("接口anrui-scm/scmapplyinbound/flowRecord无法访问");
}
}

28
anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/SubmitScmApplyInboundDto.java

@ -0,0 +1,28 @@
package com.yxt.anrui.scm.api.scmapplyinbound;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author liuguohui
* @version 1.0
* @description
* @date 2022/04/13
*/
@ApiModel("提交")
@Data
public class SubmitScmApplyInboundDto extends ScmApplyInboundDto{
@ApiModelProperty("业务sid")
private String businessSid;
@ApiModelProperty("意见")
private String comment;
@ApiModelProperty("流程实例id")
private String instanceId;
@ApiModelProperty("任务id")
private String taskId;
}

12
anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/flow/FlowableMapper.java

@ -0,0 +1,12 @@
package com.yxt.anrui.scm.biz.flow;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yxt.anrui.buscenter.api.flow.Flowable;
import org.apache.ibatis.annotations.Mapper;
import java.util.Map;
@Mapper
public interface FlowableMapper extends BaseMapper<Flowable> {
}

5
anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/flow/FlowableMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yxt.anrui.scm.biz.flow.FlowableMapper">
</mapper>

99
anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/flow/FlowableService.java

@ -0,0 +1,99 @@
/*********************************************************
*********************************************************
******************** *******************
************* ************
******* _oo0oo_ *******
*** o8888888o ***
* 88" . "88 *
* (| -_- |) *
* 0\ = /0 *
* ___/`---'\___ *
* .' \\| |// '. *
* / \\||| : |||// \ *
* / _||||| -:- |||||- \ *
* | | \\\ - /// | | *
* | \_| ''\---/'' |_/ | *
* \ .-\__ '-' ___/-. / *
* ___'. .' /--.--\ `. .'___ *
* ."" '< `.___\_<|>_/___.' >' "". *
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
* \ \ `_. \_ __\ /__ _/ .-` / / *
* =====`-.____`.___ \_____/___.-`___.-'===== *
* `=---=' *
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
*********************************************************/
package com.yxt.anrui.scm.biz.flow;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.yxt.anrui.buscenter.api.flow.*;
import com.yxt.anrui.flowable.api.flowdefinition.FlowDefinitionFeign;
import com.yxt.anrui.flowable.api.flowtask.FlowTask;
import com.yxt.anrui.flowable.api.flowtask.FlowTaskFeign;
import com.yxt.anrui.flowable.api.flowtask.LatestTaskVo;
import com.yxt.anrui.flowable.api.sysformlink.SysFormLinkFlowStateEnum;
import com.yxt.anrui.flowable.api.utils.ProcessStateEnum;
import com.yxt.anrui.flowable.sqloperationsymbol.BusinessTaskParam;
import com.yxt.anrui.flowable.sqloperationsymbol.BusinessTaskQuery;
import com.yxt.anrui.flowable.sqloperationsymbol.BusinessVariables;
import com.yxt.anrui.flowable.sqloperationsymbol.SQLOperationSymbol;
import com.yxt.common.base.service.MybatisBaseService;
import com.yxt.common.base.utils.DateUtils;
import com.yxt.common.base.utils.StringUtils;
import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.*;
/**
* Project: anrui-parent <br/>
* File: FlowableService.java <br/>
* Class: com.yxt.anrui.scm.biz.flow.FlowableService <br/>
* Description: <描述类的功能>. <br/>
* Copyright: Copyright (c) 2011 <br/>
* Company: https://gitee.com/liuzp315 <br/>
* Makedate: 2021/10/23 上午11:14 <br/>
*
* @author popo
* @version 1.0
* @since 1.0
*/
@Service
public class FlowableService extends MybatisBaseService<FlowableMapper, Flowable> {
@Autowired
private FlowDefinitionFeign flowDefinitionFeign;
@Autowired
private FlowTaskFeign flowTaskFeign;
public ResultBean businessStart(@ApiParam(value = "流程定义id") @PathVariable(value = "procDefId") String procDefId,
@ApiParam(value = "用户sid") @PathVariable(value = "userSid") String userSid,
@ApiParam(value = "变量集合,json对象") @RequestBody Map<String, Object> variables) {
variables.put("procDefId",procDefId);
variables.put("userSid",userSid);
BusinessVariables bv= BusinessVariables.builder().build();
bv.setDetailUrl("");
bv.setHandleUrl("");
bv.setFormVariables(variables);
ResultBean<FlowTask> rb = flowDefinitionFeign.businessStart(bv);
if (!rb.getSuccess()) {
return rb;
}
String procId = rb.getData().getProcInsId();
List<LatestTaskVo> list = flowTaskFeign.getLatestTasks(procId).getData();
String nodeState = list.get(0).getName_();
String task_def_key_ = list.get(0).getTask_def_key_();
Map<String, String> map = new HashMap<>();
map.put("sid", variables.get("businessSid").toString());
map.put("nodeState", nodeState);
map.put("procInsId", rb.getData().getProcInsId());
map.put("taskDefKey", task_def_key_);
return new ResultBean().success().setData(map);
}
}

3
anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundMapper.java

@ -12,6 +12,7 @@ import com.yxt.anrui.scm.api.scmapplyinbound.ScmApplyInbound;
import com.yxt.anrui.scm.api.scmapplyinbound.ScmApplyInboundVo;
import java.util.List;
import java.util.Map;
/**
* Project: anrui-scm(进销存) <br/>
@ -38,4 +39,6 @@ public interface ScmApplyInboundMapper extends BaseMapper<ScmApplyInbound> {
@Select("select * from scm_apply_inbound")
List<ScmApplyInboundVo> selectListVo();
int updateFlowFiled(Map<String, Object> map);
}

14
anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundMapper.xml

@ -4,7 +4,7 @@
<!-- <where> ${ew.sqlSegment} </where>-->
<!-- ${ew.customSqlSegment} -->
<select id="selectPageVo" resultType="com.yxt.anrui.scm.api.scmapplyinbound.ScmApplyInboundListVo">
SELECT id, sid, applicationCode, applicationDate, purchaseOrderNo, modelName,
SELECT id, sid, applicationCode, applicationDate, purchaseOrderNo, modelName,nodeState,
(select count(1) from scm_apply_inbound_vehicle where applySid=scm_apply_inbound.sid) vehicleNum
FROM scm_apply_inbound
<where> ${ew.sqlSegment} </where>
@ -14,4 +14,16 @@
<select id="selectListAllVo" resultType="com.yxt.anrui.scm.api.scmapplyinbound.ScmApplyInboundVo">
SELECT * FROM scm_apply_inbound <where> ${ew.sqlSegment} </where>
</select>
<update id="updateFlowFiled" parameterType="java.util.Map">
UPDATE scm_apply_inbound
SET nodeState=#{nodeState}, taskDefKey=#{taskDefKey}
<if test="procDefId != null and procDefId != ''">
, procDefId=#{procDefId}
</if>
<if test="procInsId != null and procInsId != ''">
, procInsId=#{procInsId}
</if>
WHERE sid=#{sid}
</update>
</mapper>

32
anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundRest.java

@ -1,6 +1,7 @@
package com.yxt.anrui.scm.biz.scmapplyinbound;
import cn.hutool.core.bean.BeanUtil;
import com.yxt.anrui.scm.api.flow.FlowTaskVo;
import com.yxt.anrui.scm.api.scmapplyinbound.*;
import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
@ -10,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* Project: anrui-scm(进销存) <br/>
@ -55,4 +57,34 @@ public class ScmApplyInboundRest implements ScmApplyInboundFeign {
public ResultBean<ScmApplyInboundVo> fetchSid(String sid) {
return new ResultBean().success().setData(scmApplyInboundService.selectBySid(sid));
}
@Override
public ResultBean submitRecordApplication(SubmitScmApplyInboundDto dto) {
return new ResultBean().success().setData(scmApplyInboundService.submitRecordApplication(dto));
}
@Override
public ResultBean complete(Map<String, Object> variables) {
return scmApplyInboundService.complete(variables);
}
@Override
public ResultBean revokeProcess(String userSid, String businessSid, FlowTaskVo flowTaskVo) {
return scmApplyInboundService.revokeProcess(userSid, businessSid, flowTaskVo);
}
@Override
public ResultBean taskReject(String businessSid, FlowTaskVo flowTaskVo) {
return scmApplyInboundService.taskReject(businessSid, flowTaskVo);
}
@Override
public ResultBean breakProcess(String businessSid, FlowTaskVo flowTaskVo) {
return scmApplyInboundService.breakProcess(businessSid, flowTaskVo);
}
@Override
public ResultBean flowRecord(String procInsId, String deployId) {
return scmApplyInboundService.flowRecord(procInsId, deployId);
}
}

211
anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundService.java

@ -3,10 +3,19 @@ package com.yxt.anrui.scm.biz.scmapplyinbound;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yxt.anrui.flowable.api.flowtask.FlowTaskFeign;
import com.yxt.anrui.flowable.api.flowtask.LatestTaskVo;
import com.yxt.anrui.flowable.api.sysformlink.SysFormLinkFlowStateEnum;
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.SysStaffOrgFeign;
import com.yxt.anrui.portal.api.sysuser.SysUserFeign;
import com.yxt.anrui.scm.api.flow.FlowTaskVo;
import com.yxt.anrui.scm.api.scmapplyinbound.*;
import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicle;
import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleDto;
import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleVo;
import com.yxt.anrui.scm.biz.flow.FlowableService;
import com.yxt.anrui.scm.biz.scmapplyinboundvehicle.ScmApplyInboundVehicleService;
import org.apache.commons.lang3.StringUtils;
import com.yxt.common.base.service.MybatisBaseService;
@ -19,7 +28,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
@ -41,6 +52,14 @@ public class ScmApplyInboundService extends MybatisBaseService<ScmApplyInboundMa
@Autowired
private ScmApplyInboundVehicleService scmApplyInboundVehicleService;
@Autowired
private SysUserFeign sysUserFeign;
@Autowired
private SysStaffOrgFeign sysStaffOrgFeign;
@Autowired
private FlowableService flowableService;
@Autowired
private FlowTaskFeign flowTaskFeign;
public PagerVo<ScmApplyInbound> listPage(PagerQuery<ScmApplyInboundQuery> pq) {
ScmApplyInboundQuery query = pq.getParams();
@ -119,7 +138,7 @@ public class ScmApplyInboundService extends MybatisBaseService<ScmApplyInboundMa
save(inboundVehicle);
// 保存车辆列表
scmApplyInboundVehicleService.saveApplyInboundVehicleList(vehicleList, inboundVehicle.getSid(), inboundVehicle.getModelSid());
return new ResultBean().success().setMsg("保存成功");
return new ResultBean().success().setMsg("保存成功").setData(inboundVehicle.getSid());
} else { // 修改
// 采购订单下线日期一旦维护,二次确认,则不能修改 TODO
// 验证数据库是否重复
@ -134,7 +153,7 @@ public class ScmApplyInboundService extends MybatisBaseService<ScmApplyInboundMa
updateById(scmApplyInbound);
// 更新车辆列表信息
scmApplyInboundVehicleService.updateApplyInboundVehicleList(vehicleList);
return new ResultBean().success().setMsg("修改成功");
return new ResultBean().success().setMsg("修改成功").setData(dto.getSid());
}
}
@ -151,4 +170,190 @@ public class ScmApplyInboundService extends MybatisBaseService<ScmApplyInboundMa
vo.setInboundVehicleList(list);
return vo;
}
/**
* 检查用户是否设置部门
*
* @param userSid
* @return 返回部门sid
*/
private String checkUserOrg(String userSid) {
String orgSid = "";
String staffSid = sysUserFeign.selectBySid(userSid).getData().getStaffSid();
ResultBean<String> resultBean = sysStaffOrgFeign.getSysStaffOrgSidListByStaffSid(staffSid);
if (resultBean.getSuccess()) {
orgSid = resultBean.getData();
}
return orgSid;
}
/**
* 更新流程相关的状态
* @param map
* @return
*/
private int updateFlowFiled(Map<String, Object> map) {
return baseMapper.updateFlowFiled(map);
}
/**
* 提交入账申请
* @param dto
* @return
*/
public ResultBean submitRecordApplication(SubmitScmApplyInboundDto dto) {
String orgSid = checkUserOrg(dto.getUserSid());
ResultBean resultBean = saveOrUpdateApplyInBound(dto);
String businessSid = resultBean.getData().toString();
Map<String, Object> variables = new HashMap<>();
variables.put("businessSid", businessSid);
variables.put("orgSid", orgSid); //部门sid
if (StringUtils.isBlank(dto.getTaskId())) { // 新提交
ResultBean resultBean1 = flowableService.businessStart(ProcDefEnum.RECORDAPPLICATION.getProDefId(), dto.getUserSid(), variables);
if (resultBean1.getSuccess() && resultBean1.getData() != null) {
Map<String, String> map = (Map<String, String>) resultBean1.getData();
//更新业务表中的流程状态
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("sid", businessSid);
paramMap.put("procDefId", ProcDefEnum.RECORDAPPLICATION.getProDefId());
paramMap.put("nodeState", map.get("nodeState"));
paramMap.put("procInsId", map.get("procInsId"));
paramMap.put("taskDefKey", map.get("taskDefKey"));
updateFlowFiled(paramMap);
}
return resultBean1;
} else { // 驳回到发起人后再次提交
variables.put("comment", StringUtils.isNotBlank(dto.getComment()) ? dto.getComment() : "重新提交");
variables.put("instanceId", dto.getInstanceId());
variables.put("taskId", dto.getTaskId());
variables.put("userSid", dto.getUserSid());
return complete(variables);
}
}
/**
* 办理
* @param variables
* @return
*/
public ResultBean complete(Map<String, Object> variables) {
BusinessVariables bv= BusinessVariables.builder().build();
bv.setDetailUrl("");
bv.setHandleUrl("");
bv.setFormVariables(variables);
ResultBean<com.yxt.anrui.flowable.api.flowtask.FlowTask> resultBean = flowTaskFeign.businessComplete(bv);
if (!resultBean.getSuccess()) {
return resultBean;
}
String nodeState = "";
String taskDefKey = "";
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("sid", variables.get("businessSid").toString());
if (resultBean.getData() != null) {
ResultBean<List<LatestTaskVo>> listResultBean = flowTaskFeign.getLatestTasks(resultBean.getData().getProcInsId());
if (listResultBean.getSuccess() && listResultBean.getData() != null && 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";
paramMap.put("flowState", SysFormLinkFlowStateEnum.FINISH.getCode());
}
}
paramMap.put("nodeState", nodeState);
paramMap.put("taskDefKey", taskDefKey);
updateFlowFiled(paramMap);
return resultBean;
}
/**
* 撤回
* @param userSid
* @param businessSid
* @param flowTaskVo
* @return
*/
public ResultBean revokeProcess(String userSid, String businessSid, FlowTaskVo flowTaskVo) {
com.yxt.anrui.flowable.api.flowtask.FlowTaskVo fl=new com.yxt.anrui.flowable.api.flowtask.FlowTaskVo();
BeanUtil.copyProperties(flowTaskVo,fl);
fl.setUserSid(userSid);
ResultBean<List<LatestTaskVo>> resultBean = flowTaskFeign.revokeProcess(fl);
if (!resultBean.getSuccess()) {
return resultBean;
}
String nodeState = resultBean.getData().get(0).getName_();
String taskDefKey = resultBean.getData().get(0).getTask_def_key_();
String incomingSourceRef = resultBean.getData().get(0).getIncomingSourceRef();
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("sid", businessSid);
if (incomingSourceRef.contains("start")) {
paramMap.put("nodeState", SysFormLinkFlowStateEnum.UNCOMMITTED.getState());
paramMap.put("taskDefKey", taskDefKey);
paramMap.put("flowState", SysFormLinkFlowStateEnum.UNCOMMITTED.getCode());
} else {
paramMap.put("nodeState",nodeState );
paramMap.put("taskDefKey",taskDefKey );
}
updateFlowFiled(paramMap);
return resultBean;
}
/**
* 驳回
* @param businessSid
* @param flowTaskVo
* @return
*/
public ResultBean taskReject(String businessSid, FlowTaskVo flowTaskVo) {
com.yxt.anrui.flowable.api.flowtask.FlowTaskVo fl=new com.yxt.anrui.flowable.api.flowtask.FlowTaskVo();
BeanUtil.copyProperties(flowTaskVo,fl);
ResultBean<List<LatestTaskVo>> resultBean = flowTaskFeign.taskReject(fl);
if (!resultBean.getSuccess()) {
return resultBean;
}
String nodeState = resultBean.getData().get(0).getName_();
String taskDefKey = resultBean.getData().get(0).getTask_def_key_();
String incomingSourceRef = resultBean.getData().get(0).getIncomingSourceRef();
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("sid", businessSid);
paramMap.put("nodeState", nodeState);
paramMap.put("taskDefKey", taskDefKey);
if (incomingSourceRef.contains("start")) {
paramMap.put("flowState", SysFormLinkFlowStateEnum.REJECT.getCode());
}
updateFlowFiled(paramMap);
return resultBean;
}
/**
* 终止流程
* @param businessSid
* @param flowTaskVo
* @return
*/
public ResultBean breakProcess(String businessSid, FlowTaskVo flowTaskVo) {
com.yxt.anrui.flowable.api.flowtask.FlowTaskVo fl=new com.yxt.anrui.flowable.api.flowtask.FlowTaskVo();
BeanUtil.copyProperties(flowTaskVo,fl);
ResultBean resultBean = flowTaskFeign.breakProcess(fl);
if (!resultBean.getSuccess()) {
return resultBean;
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("sid", businessSid);
paramMap.put("nodeState", String.valueOf(resultBean.getData()));
paramMap.put("taskDefKey", "Event_end");
paramMap.put("flowState", SysFormLinkFlowStateEnum.BREAK.getCode());
updateFlowFiled(paramMap);
return resultBean;
}
/**
* 流程历史流转记录
* @param procInsId
* @param deployId
* @return
*/
public ResultBean flowRecord(String procInsId, String deployId) {
return flowTaskFeign.businessFlowRecord(procInsId,deployId);
}
}
Loading…
Cancel
Save