新增付款申请审批流程

This commit is contained in:
jinqiming 2022-02-21 17:56:34 +08:00
parent eb5e2ea3c6
commit 9d3f337d7b
4 changed files with 97 additions and 18 deletions

View File

@ -1,23 +1,31 @@
package com.snow.system.controller;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.hutool.core.bean.BeanUtil;
import com.snow.common.annotation.Log;
import com.snow.common.enums.BusinessType;
import org.springframework.stereotype.Controller;
import com.snow.system.domain.SysFnPayment;
import com.snow.system.service.ISysFnPaymentService;
import com.snow.common.annotation.RepeatSubmit;
import com.snow.common.core.controller.BaseController;
import com.snow.common.core.domain.AjaxResult;
import com.snow.common.utils.poi.ExcelUtil;
import com.snow.common.core.page.TableDataInfo;
import com.snow.common.enums.BusinessType;
import com.snow.common.utils.poi.ExcelUtil;
import com.snow.flowable.domain.payment.PaymentCashierTask;
import com.snow.flowable.domain.payment.PaymentForm;
import com.snow.flowable.service.FlowableService;
import com.snow.flowable.service.FlowableTaskService;
import com.snow.framework.util.ShiroUtils;
import com.snow.system.domain.SysFnPayment;
import com.snow.system.domain.SysUser;
import com.snow.system.service.ISysFnPaymentService;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 支付申请Controller
@ -27,6 +35,7 @@ import com.snow.common.core.page.TableDataInfo;
*/
@Controller
@RequestMapping("/system/payment")
@Slf4j
public class SysFnPaymentController extends BaseController
{
private String prefix = "system/payment";
@ -34,6 +43,12 @@ public class SysFnPaymentController extends BaseController
@Autowired
private ISysFnPaymentService sysFnPaymentService;
@Autowired
private FlowableService flowableService;
@Autowired
private FlowableTaskService flowableTaskService;
@RequiresPermissions("system:payment:view")
@GetMapping()
public String payment()
@ -107,8 +122,14 @@ public class SysFnPaymentController extends BaseController
@Log(title = "支付申请", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysFnPayment sysFnPayment)
{
public AjaxResult editSave(SysFnPayment sysFnPayment) {
//发起审批
PaymentForm paymentForm = BeanUtil.copyProperties(sysFnPayment, PaymentForm.class);
paymentForm.setBusinessKey(paymentForm.getPaymentNo());
paymentForm.setStartUserId(String.valueOf(ShiroUtils.getUserId()));
paymentForm.setBusVarUrl("/system/payment/detail");
ProcessInstance processInstance = flowableService.startProcessInstanceByAppForm(paymentForm);
log.info("@@发起业务单号为:{}付款申请流程:{}",sysFnPayment.getPaymentNo(),processInstance.getProcessInstanceId());
return toAjax(sysFnPaymentService.updateSysFnPayment(sysFnPayment));
}
@ -123,4 +144,22 @@ public class SysFnPaymentController extends BaseController
{
return toAjax(sysFnPaymentService.deleteSysFnPaymentByIds(ids));
}
/**
* 出纳审核
*/
@PostMapping("/cashierTask")
@ResponseBody
@Transactional
@RepeatSubmit
public AjaxResult cashierTask(PaymentCashierTask paymentCashierTask) {
SysUser sysUser = ShiroUtils.getSysUser();
//完成任务
paymentCashierTask.setUserId(String.valueOf(sysUser.getUserId()));
paymentCashierTask.setIsUpdateBus(true);
paymentCashierTask.setIsStart(paymentCashierTask.getIsPass());
flowableTaskService.submitTask(paymentCashierTask);
return AjaxResult.success();
}
}

View File

@ -2,17 +2,56 @@ package com.snow.flowable.domain.payment;
import com.snow.flowable.common.enums.FlowDefEnum;
import com.snow.flowable.domain.AppForm;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author qimingjin
* @Title:
* @Title: 付款申请表单
* @Description:
* @date 2022/2/21 15:40
*/
@Data
public class PaymentForm extends AppForm implements Serializable {
private static final long serialVersionUID = -2763605585222075354L;
private Long id;
/** 支付单号 */
private String paymentNo;
/** 订单金额 */
private BigDecimal orderPrice;
/** 支付金额 */
private BigDecimal paymentPrice;
/** 支付标题 */
private String paymentTitle;
/** 关联单号 */
private String relateNo;
/** 关联单号类型1--采购单) */
private Long relateNoType;
/** 支付时间 */
private Date paymentTime;
/** 支付状态0--待支付1-已支付2--作废) */
private Long paymentStatus;
/** 流程状态0--待发起1-审批中2--审批通过3--已驳回4--作废) */
private Long processStatus;
/** 申请人 */
private String paymentUser;
/** 备注 */
private String paymentRemark;
@Override
public FlowDefEnum getFlowDef() {

View File

@ -39,6 +39,7 @@ public abstract class AbstractTaskListener<T extends FinishTaskDTO> implements T
processTask();
} finally {
delegateTaskThreadLocal.remove();
localTaskParam.remove();
}
}

View File

@ -21,6 +21,6 @@ public class PaymentCashierTaskListener extends AbstractTaskListener<PaymentCash
@Override
protected void processTask() {
PaymentCashierTask taskParam = getTaskParam();
}
}