feat(finance): 新增财务付款与退款审批功能

- 在配置文件中增加财务付款和退款的流程定义及实例Bean配置
- 扩展OmsPaymentBill实体类,新增审批相关字段如审批人、申请时间等
- 实现付款和退款的审批流程启动、撤销以及退款申请功能
- 增加前端页面按钮控制及对应API调用逻辑
- 添加付款审批列表和已审批列表查询接口
- 更新路由配置以支持新的财务付款审批页面访问路径
- 引入流程删除命令确保重复提交时旧流程实例被清理
- 完善付款单据审批状态更新及相关业务回调处理逻辑
- 优化审批流中的公司领导审批分支处理逻辑
- 提供付款单据回执单查看、发起付款/退款、退回及撤销操作界面交互支持
dev_1.0.0
chenhao 2025-12-16 09:43:34 +08:00
parent dc1f5f7302
commit 2cf2fdff08
14 changed files with 340 additions and 27 deletions

View File

@ -68,6 +68,15 @@ export function addPayment(data) {
}) })
} }
export function handleRevoke(id) {
return request({
url: '/finance/payment/revoke',
method: 'post',
data: {id: id},
needLoading: true
})
}
// 申请付款 // 申请付款
export function applyPaymentApi(data) { export function applyPaymentApi(data) {
return request({ return request({
@ -85,6 +94,14 @@ export function applyRefund(id) {
}) })
} }
export function applyRefundApprove(id) {
return request({
url: '/finance/payment/applyRefundApprove',
method: 'post',
data: {id: id}
})
}
// 查询应付单列表 (用于新增付款单-非预付) // 查询应付单列表 (用于新增付款单-非预付)
export function listPayableBills(query) { export function listPayableBills(query) {
return request({ return request({
@ -106,3 +123,27 @@ export function listOrders(query) {
}) })
} }
// 查询付款审批列表
export function listPaymentApprove(query) {
return request({
url: '/finance/payment/approve/list',
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data: tansParams(query)
})
}
// 查询已审批付款列表
export function listPaymentApproved(query) {
return request({
url: '/finance/payment/approved/list',
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data: tansParams(query)
})
}

View File

@ -94,6 +94,11 @@ export const constantRoutes = [
component: () => import('@/views/approve/approved_order/index'), component: () => import('@/views/approve/approved_order/index'),
hidden: true hidden: true
}, },
{
path: 'paymentLog',
component: () => import('@/views/approve/finance/payment/approved/index'),
hidden: true
},
] ]
}, },
{ {

View File

@ -179,18 +179,28 @@
size="mini" size="mini"
type="text" type="text"
icon="el-icon-money" icon="el-icon-money"
v-show="scope.row.approveStatus==='2' "
@click="handleReceipt(scope.row)" @click="handleReceipt(scope.row)"
>{{ scope.row.paymentBillType === 'REFUND' ? '退款图' : '回执单' }}</el-button> >{{ scope.row.paymentBillType === 'REFUND' ? '退款图' : '回执单' }}</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-position" icon="el-icon-position"
v-show="(scope.row.approveStatus==='0' || scope.row.approveStatus==='3') && scope.row.paymentBillType==='FROM_PAYABLE' "
@click="applyPayment(scope.row)" @click="applyPayment(scope.row)"
>发起付款</el-button> >发起付款</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-position"
v-show="(scope.row.approveStatus==='0' || scope.row.approveStatus==='3') && scope.row.paymentBillType==='REFUND' "
@click="applyRefundApprove(scope.row)"
>发起退款</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-refresh-left" icon="el-icon-refresh-left"
v-show="scope.row.paymentBillType==='FROM_PAYABLE' && scope.row.paymentStatus==='1' && (scope.row.approveStatus==='0' || scope.row.approveStatus==='3')"
@click="handleReturn(scope.row)" @click="handleReturn(scope.row)"
>退回</el-button> >退回</el-button>
<el-button <el-button
@ -200,6 +210,13 @@
v-if="scope.row.paymentStatus === '2' && scope.row.refundStatus !== 'REFUND_APPLIED' && scope.row.paymentBillType !== 'REFUND'" v-if="scope.row.paymentStatus === '2' && scope.row.refundStatus !== 'REFUND_APPLIED' && scope.row.paymentBillType !== 'REFUND'"
@click="handleApplyRefund(scope.row)" @click="handleApplyRefund(scope.row)"
>退款</el-button> >退款</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-refresh-right"
v-if="scope.row.paymentStatus === '1' && scope.row.approveStatus==='2'"
@click="handleRevoke(scope.row)"
>撤销</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -256,7 +273,7 @@
</template> </template>
<script> <script>
import { listPayment, getPayment, returnPayment, addPaymentFromPayable, applyPaymentApi, applyRefund,addPayment } from "@/api/finance/payment"; import { listPayment, getPayment, returnPayment, addPaymentFromPayable, applyPaymentApi,applyRefundApprove, applyRefund,addPayment,handleRevoke } from "@/api/finance/payment";
import { addDateRange } from "@/utils/ruoyi"; import { addDateRange } from "@/utils/ruoyi";
import DetailDrawer from "./components/DetailDrawer.vue"; import DetailDrawer from "./components/DetailDrawer.vue";
import AddForm from "./components/AddForm.vue"; import AddForm from "./components/AddForm.vue";
@ -414,6 +431,14 @@ export default {
this.getList(); this.getList();
this.$modal.msgSuccess("退回成功"); this.$modal.msgSuccess("退回成功");
}).catch(() => {}); }).catch(() => {});
},
applyRefundApprove(row) {
this.$modal.confirm('是否对付款单编号为"' + row.paymentBillCode + '"的数据项发起退款?').then(function() {
return applyRefundApprove(row.id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("发起成功");
}).catch(() => {});
}, },
/** 申请退款按钮操作 */ /** 申请退款按钮操作 */
handleApplyRefund(row) { handleApplyRefund(row) {
@ -423,6 +448,14 @@ export default {
this.getList(); this.getList();
this.$modal.msgSuccess("申请退款成功"); this.$modal.msgSuccess("申请退款成功");
}).catch(() => {}); }).catch(() => {});
},
handleRevoke(row) {
this.$modal.confirm('是否撤销对付款单编号为"' + row.paymentBillCode + '"的款项?').then(() => {
return handleRevoke(row.id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("撤销成功");
}).catch(() => {});
} }
} }
}; };

View File

@ -145,6 +145,8 @@ process:
orderApproveOnline: order_approve_online orderApproveOnline: order_approve_online
orderApproveOffline: order_approve_offline orderApproveOffline: order_approve_offline
purchaseOrderApprove: purchase_order_online purchaseOrderApprove: purchase_order_online
financePayment: finance_payment
financeRefund: finance_refund
#业务执行实例bean name ,可以按审批节点配置 业务审批回调方法处理业务逻辑. key 为流程节点主键ID value 要执行的业务方法名称,不配置则默认调用TodoCommonTemplate.todoApproveCallback #业务执行实例bean name ,可以按审批节点配置 业务审批回调方法处理业务逻辑. key 为流程节点主键ID value 要执行的业务方法名称,不配置则默认调用TodoCommonTemplate.todoApproveCallback
instance: instance:
@ -154,6 +156,10 @@ process:
beanName: projectOrderInfoServiceImpl beanName: projectOrderInfoServiceImpl
purchaseOrderOnline: purchaseOrderOnline:
beanName: omsPurchaseOrderServiceImpl beanName: omsPurchaseOrderServiceImpl
financePayment:
beanName: omsPaymentBillServiceImpl
financeRefund:
beanName: omsPaymentBillServiceImpl
unis: unis:
inventory: inventory:
allAuthRole: 103,101 allAuthRole: 103,101

View File

@ -9,9 +9,11 @@ import lombok.Data;
*/ */
@Data @Data
public class Definition { public class Definition {
/** 故障工单 */
private String orderApproveOnline; private String orderApproveOnline;
private String orderApproveOffline; private String orderApproveOffline;
private String purchaseOrderApprove; private String purchaseOrderApprove;
private String financePayment;
private String financeRefund;
} }

View File

@ -15,6 +15,8 @@ public class Instance {
private Map<String, Object> order_approve_online; private Map<String, Object> order_approve_online;
private Map<String, Object> order_approve_offline; private Map<String, Object> order_approve_offline;
private Map<String, Object> purchase_order_online; private Map<String, Object> purchase_order_online;
private Map<String, Object> finance_payment;
private Map<String, Object> finance_refund;
} }

View File

@ -57,6 +57,25 @@ public class OmsPaymentBillController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
@RequiresPermissions("finance:payment:approve")
@PostMapping("/approve/list")
@ResponseBody
public TableDataInfo listApprove(OmsPaymentBill omsPaymentBill) {
startPage();
List<OmsPaymentBill> list = omsPaymentBillService.listApprove(omsPaymentBill);
return getDataTable(list);
}
@RequiresPermissions("finance:payment:approve")
@PostMapping("/approved/list")
@ResponseBody
public TableDataInfo listApproved(OmsPaymentBill omsPaymentBill) {
startPage();
List<OmsPaymentBill> list = omsPaymentBillService.listApproved(omsPaymentBill);
return getDataTable(list);
}
/** /**
* *
*/ */
@ -212,6 +231,26 @@ public class OmsPaymentBillController extends BaseController
return AjaxResult.error("操作失败:" + e.getMessage()); return AjaxResult.error("操作失败:" + e.getMessage());
} }
} }
@PostMapping("/revoke")
@ResponseBody
public AjaxResult revoke(@RequestBody OmsPaymentBill paymentBill) {
try {
return omsPaymentBillService.revoke(paymentBill);
} catch (Exception e) {
logger.error("撤销付款单失败", e);
return AjaxResult.error("操作失败:" + e.getMessage());
}
}
@PostMapping("/applyRefundApprove")
@ResponseBody
public AjaxResult applyRefundApprove(@RequestBody OmsPaymentBill paymentBill) {
try {
return omsPaymentBillService.applyRefundApprove(paymentBill);
} catch (Exception e) {
logger.error("撤销付款单失败", e);
return AjaxResult.error("操作失败:" + e.getMessage());
}
}

View File

@ -126,7 +126,13 @@ public class OmsPaymentBill extends BaseEntity
/** 退款状态 */ /** 退款状态 */
private String refundStatus; private String refundStatus;
private String hzUserName;
private Long approveUser;
private Date applyTime;
private Date todoApproveTime;
private String processKey;
private String todoId;
private String taskId;
@Getter @Getter

View File

@ -124,6 +124,7 @@ public interface TodoService
* @return * @return
*/ */
ProcessInstance startProcess(String businessKey, Map<String, Object> variables,String processKey); ProcessInstance startProcess(String businessKey, Map<String, Object> variables,String processKey);
ProcessInstance startProcessDeleteBefore(String businessKey,String FlowBusinessKey, Map<String, Object> variables,String processKey);
List<Todo> selectTodoListByProcessInstanceId(Todo todo); List<Todo> selectTodoListByProcessInstanceId(Todo todo);

View File

@ -17,12 +17,14 @@ import com.ruoyi.sip.domain.OmsPurchaseOrder;
import com.ruoyi.sip.domain.ProjectOrderInfo; import com.ruoyi.sip.domain.ProjectOrderInfo;
import com.ruoyi.sip.flowable.domain.Todo; import com.ruoyi.sip.flowable.domain.Todo;
import com.ruoyi.sip.flowable.mapper.TodoMapper; import com.ruoyi.sip.flowable.mapper.TodoMapper;
import com.ruoyi.sip.flowable.service.DeleteFlowableProcessInstanceCmd;
import com.ruoyi.sip.flowable.service.TodoCommonTemplate; import com.ruoyi.sip.flowable.service.TodoCommonTemplate;
import com.ruoyi.sip.flowable.service.TodoService; import com.ruoyi.sip.flowable.service.TodoService;
import com.ruoyi.sip.service.IProjectOrderInfoService; import com.ruoyi.sip.service.IProjectOrderInfoService;
import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.SysUserMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.flowable.engine.ManagementService;
import org.flowable.engine.RuntimeService; import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService; import org.flowable.engine.TaskService;
import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.runtime.ProcessInstance;
@ -63,6 +65,8 @@ public class TodoServiceImpl implements TodoService {
private TaskService taskService; private TaskService taskService;
@Autowired @Autowired
private SysUserMapper sysUserMapper; private SysUserMapper sysUserMapper;
@Autowired
private ManagementService managementService;
@Autowired @Autowired
private IProjectOrderInfoService projectOrderInfoService; private IProjectOrderInfoService projectOrderInfoService;
@ -311,6 +315,31 @@ public class TodoServiceImpl implements TodoService {
return null; return null;
} }
@Override
public ProcessInstance startProcessDeleteBefore(String businessKey, String flowBusinessKey, Map<String, Object> variables, String processKey) {
List<ProcessInstance> processInstanceList = listProcessInstance(businessKey);
if (CollUtil.isNotEmpty(processInstanceList)) {
for (ProcessInstance processInstance : processInstanceList) {
String processDefinitionKey = processInstance.getProcessDefinitionKey();
if (processDefinitionKey.equals(processKey)){
//删除流程实例 不删流程实例可能导致 提交流程被驳回后 另外一个无法提交审核 因为流程驳回是驳回后,流程处理人是售前A
DeleteFlowableProcessInstanceCmd cmd = new DeleteFlowableProcessInstanceCmd(processInstance.getProcessInstanceId(), "删除流程实例", true);
managementService.executeCommand(cmd);
}
}
deleteTodoByBusinessKey(businessKey);
}
// String orderFlowKey = ProjectOrderInfo.ProcessTypeEnum.ONLINE.getCode().equals(projectOrderInfo.getProcessType()) ?
// orderOnlineFlowKey : orderOfflineFlowKey;
//启动流程
ProcessInstance processInstance = startProcess(flowBusinessKey, variables, processConfig.getDefinition().getFinancePayment());
completed(null, null, flowBusinessKey);
return processInstance;
}
@Override @Override
public List<Todo> selectTodoListByProcessInstanceId(Todo todo) { public List<Todo> selectTodoListByProcessInstanceId(Todo todo) {
return todoMapper.selectTodoListByProcessInstanceId(todo); return todoMapper.selectTodoListByProcessInstanceId(todo);

View File

@ -2,10 +2,9 @@ package com.ruoyi.sip.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.sip.domain.OmsPayableBill;
import com.ruoyi.sip.domain.OmsPaymentBill; import com.ruoyi.sip.domain.OmsPaymentBill;
import com.ruoyi.sip.domain.dto.PaymentBillDetailDTO; import com.ruoyi.sip.domain.dto.PaymentBillDetailDTO;
import com.ruoyi.sip.domain.dto.PaymentBillPayableDetailDTO; import org.apache.ibatis.annotations.Param;
/** /**
* Mapper * Mapper
@ -92,4 +91,8 @@ public interface OmsPaymentBillMapper
void clearRelationPayable(String payableBillCode); void clearRelationPayable(String payableBillCode);
OmsPaymentBill selectOmsPaymentBillByCode(String businessKey); OmsPaymentBill selectOmsPaymentBillByCode(String businessKey);
List<OmsPaymentBill> listApprove(@Param("entity") OmsPaymentBill omsPaymentBill, @Param("tableName")String buTodo);
void revoke(OmsPaymentBill paymentBill);
} }

View File

@ -95,4 +95,12 @@ public interface IOmsPaymentBillService
* @return * @return
*/ */
public AjaxResult uploadRefundProof(Long paymentBillId, MultipartFile file) throws Exception; public AjaxResult uploadRefundProof(Long paymentBillId, MultipartFile file) throws Exception;
List<OmsPaymentBill> listApprove(OmsPaymentBill omsPaymentBill);
List<OmsPaymentBill> listApproved(OmsPaymentBill omsPaymentBill);
AjaxResult revoke(OmsPaymentBill paymentBill);
AjaxResult applyRefundApprove(OmsPaymentBill paymentBill);
} }

View File

@ -1,12 +1,16 @@
package com.ruoyi.sip.service.impl; package com.ruoyi.sip.service.impl;
import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.config.flow.ProcessConfig;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.ApproveStatusEnum; import com.ruoyi.common.enums.ApproveStatusEnum;
@ -17,8 +21,11 @@ import com.ruoyi.sip.domain.*;
import com.ruoyi.sip.domain.dto.PaymentBillDetailDTO; import com.ruoyi.sip.domain.dto.PaymentBillDetailDTO;
import com.ruoyi.sip.domain.dto.PaymentBillPayableDetailDTO; import com.ruoyi.sip.domain.dto.PaymentBillPayableDetailDTO;
import com.ruoyi.sip.flowable.domain.Todo; import com.ruoyi.sip.flowable.domain.Todo;
import com.ruoyi.sip.flowable.service.DeleteFlowableProcessInstanceCmd;
import com.ruoyi.sip.flowable.service.TodoCommonTemplate; import com.ruoyi.sip.flowable.service.TodoCommonTemplate;
import com.ruoyi.sip.flowable.service.TodoService;
import com.ruoyi.sip.service.*; import com.ruoyi.sip.service.*;
import org.flowable.engine.ManagementService;
import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
@ -50,6 +57,12 @@ public class OmsPaymentBillServiceImpl implements IOmsPaymentBillService , TodoC
@Autowired @Autowired
@Lazy @Lazy
private IOmsPayableBillService payableBillService; private IOmsPayableBillService payableBillService;
@Autowired
private TodoService todoService;
@Autowired
private ProcessConfig processConfig;
@Autowired
protected ManagementService managementService;
/** /**
* *
* *
@ -206,8 +219,14 @@ public class OmsPaymentBillServiceImpl implements IOmsPaymentBillService , TodoC
public int applyPayment(OmsPaymentBill paymentBill) { public int applyPayment(OmsPaymentBill paymentBill) {
paymentBill.setUpdateTime(DateUtils.getNowDate()); paymentBill.setUpdateTime(DateUtils.getNowDate());
paymentBill.setUpdateBy(ShiroUtils.getLoginName()); paymentBill.setUpdateBy(ShiroUtils.getLoginName());
// todo 开启审批流程
paymentBill.setApproveStatus(ApproveStatusEnum.WAIT_APPROVE.getCode()); paymentBill.setApproveStatus(ApproveStatusEnum.WAIT_APPROVE.getCode());
OmsPaymentBill existBill = selectOmsPaymentBillById(paymentBill.getId());
todoService.startProcessDeleteBefore(existBill.getPaymentBillCode(), existBill.getPaymentBillCode(),
new HashMap<String, Object>() {{
put("applyUserName", ShiroUtils.getSysUser().getUserName());
put("applyUser", ShiroUtils.getUserId());
}}
, processConfig.getDefinition().getFinancePayment());
return omsPaymentBillMapper.updateOmsPaymentBill(paymentBill); return omsPaymentBillMapper.updateOmsPaymentBill(paymentBill);
} }
@ -230,10 +249,10 @@ public class OmsPaymentBillServiceImpl implements IOmsPaymentBillService , TodoC
OmsPaymentBill existData = omsPaymentBillMapper.selectOmsPaymentBillByCode(businessKey); OmsPaymentBill existData = omsPaymentBillMapper.selectOmsPaymentBillByCode(businessKey);
OmsPaymentBill omsPaymentBill = new OmsPaymentBill(); OmsPaymentBill omsPaymentBill = new OmsPaymentBill();
omsPaymentBill.setPayableBillCode(businessKey); omsPaymentBill.setPaymentBillCode(businessKey);
omsPaymentBill.setApproveStatus(ApproveStatusEnum.APPROVE_COMPLETE.getCode()); omsPaymentBill.setApproveStatus(ApproveStatusEnum.APPROVE_COMPLETE.getCode());
if (existData.getPaymentBillType().equals(OmsPaymentBill.PaymentBillTypeEnum.PRE_PAYMENT.getCode())){ if (existData.getPaymentBillType().equals(OmsPaymentBill.PaymentBillTypeEnum.PRE_PAYMENT.getCode())){
existData.setPreResidueAmount(existData.getTotalPriceWithTax()); omsPaymentBill.setPreResidueAmount(existData.getTotalPriceWithTax());
} }
omsPaymentBill.setApproveTime(DateUtils.getNowDate()); omsPaymentBill.setApproveTime(DateUtils.getNowDate());
omsPaymentBill.setUpdateTime(DateUtils.getNowDate()); omsPaymentBill.setUpdateTime(DateUtils.getNowDate());
@ -242,7 +261,6 @@ public class OmsPaymentBillServiceImpl implements IOmsPaymentBillService , TodoC
@Override @Override
public boolean todoApproveCallback(Todo todo) { public boolean todoApproveCallback(Todo todo) {
if (CollUtil.isEmpty(todo.getVariables())) { if (CollUtil.isEmpty(todo.getVariables())) {
return TodoCommonTemplate.super.todoApproveCallback(todo); return TodoCommonTemplate.super.todoApproveCallback(todo);
} }
@ -251,20 +269,20 @@ public class OmsPaymentBillServiceImpl implements IOmsPaymentBillService , TodoC
if (approveBtn == null) { if (approveBtn == null) {
return TodoCommonTemplate.super.todoApproveCallback(todo); return TodoCommonTemplate.super.todoApproveCallback(todo);
} }
String taskName = todo.getTaskName(); String taskName = todo.getTaskName();
String businessKey = todo.getBusinessKey(); String businessKey = todo.getBusinessKey();
if (todo.getProcessKey().equals(processConfig.getDefinition().getFinancePayment())) {
// 审批驳回处理 // 审批驳回处理
if (approveBtn.equals(0)) { if (approveBtn.equals(0)) {
handleRejectOrder( businessKey); handleRejectOrder(businessKey);
}
} else {
if (approveBtn.equals(0)) {
handleRejectOrder(businessKey);
}else{
handleCompanyLeaderApproval(businessKey);
}
} }
// else {
// if ("公司领导".equals(taskName) && approveBtn == 1) {
// handleCompanyLeaderApproval(businessKey);
// }
// }
return TodoCommonTemplate.super.todoApproveCallback(todo); return TodoCommonTemplate.super.todoApproveCallback(todo);
@ -272,13 +290,24 @@ public class OmsPaymentBillServiceImpl implements IOmsPaymentBillService , TodoC
private void handleRejectOrder(String businessKey) { private void handleRejectOrder(String businessKey) {
OmsPaymentBill omsPaymentBill = new OmsPaymentBill(); OmsPaymentBill omsPaymentBill = new OmsPaymentBill();
omsPaymentBill.setPayableBillCode(businessKey); omsPaymentBill.setPaymentBillCode(businessKey);
omsPaymentBill.setApproveStatus(ApproveStatusEnum.APPROVE_REJECT.getCode()); omsPaymentBill.setApproveStatus(ApproveStatusEnum.APPROVE_REJECT.getCode());
omsPaymentBillMapper.updateOmsPaymentBillByCode(omsPaymentBill); omsPaymentBillMapper.updateOmsPaymentBillByCode(omsPaymentBill);
} }
@Override @Override
public boolean multiInstanceApproveCallback(String activityName, ProcessInstance processInstance) { public boolean multiInstanceApproveCallback(String activityName, ProcessInstance processInstance) {
if (processInstance.getProcessDefinitionKey().equals(processConfig.getDefinition().getFinancePayment())) {
String flowBusinessKey = processInstance.getBusinessKey();
String[] split = flowBusinessKey.split("#");
String businessKey = split.length > 1 ? split[1] : split[0];
Map<String, Object> processVariables = processInstance.getProcessVariables();
Integer approveBtn = (Integer) processVariables.get("approveBtn");
if ("公司领导".equals(activityName) && approveBtn == 1) {
handleCompanyLeaderApproval(businessKey);
}
}
return TodoCommonTemplate.super.multiInstanceApproveCallback(activityName, processInstance); return TodoCommonTemplate.super.multiInstanceApproveCallback(activityName, processInstance);
} }
@ -359,12 +388,13 @@ public class OmsPaymentBillServiceImpl implements IOmsPaymentBillService , TodoC
updateOmsPaymentBill(originalBill); updateOmsPaymentBill(originalBill);
//4 创建付款明细 //4 创建付款明细
detailService.applyRefund(originalBill.getPayableBillCode(),refundBill.getPayableBillCode()); detailService.applyRefund(originalBill.getPayableBillCode(),refundBill.getPayableBillCode());
//5.todo 开始退款审批流程 //5. 开始退款审批流程
todoService.startProcessDeleteBefore(originalBill.getPaymentBillCode(), originalBill.getPaymentBillCode(),
new HashMap<String, Object>() {{
put("applyUserName", ShiroUtils.getSysUser().getUserName());
put("applyUser", ShiroUtils.getUserId());
}}
, processConfig.getDefinition().getFinanceRefund());
return AjaxResult.success("退款申请已提交,新的退款单号为:" + refundBill.getPaymentBillCode()); return AjaxResult.success("退款申请已提交,新的退款单号为:" + refundBill.getPaymentBillCode());
} }
@ -395,4 +425,41 @@ public class OmsPaymentBillServiceImpl implements IOmsPaymentBillService , TodoC
return AjaxResult.success(attachment); return AjaxResult.success(attachment);
} }
@Override
public List<OmsPaymentBill> listApprove(OmsPaymentBill omsPaymentBill) {
omsPaymentBill.setApproveUser(ShiroUtils.getUserId());
return omsPaymentBillMapper.listApprove(omsPaymentBill, "bu_todo");
}
@Override
public List<OmsPaymentBill> listApproved(OmsPaymentBill omsPaymentBill) {
omsPaymentBill.setApproveUser(ShiroUtils.getUserId());
return omsPaymentBillMapper.listApprove(omsPaymentBill, "bu_todo_completed");
}
@Override
public AjaxResult revoke(OmsPaymentBill paymentBill) {
paymentBill.setApproveStatus(ApproveStatusEnum.WAIT_COMMIT.getCode());
omsPaymentBillMapper.revoke(paymentBill);
return AjaxResult.success("撤销成功");
}
@Override
public AjaxResult applyRefundApprove(OmsPaymentBill paymentBill) {
paymentBill.setUpdateTime(DateUtils.getNowDate());
paymentBill.setUpdateBy(ShiroUtils.getLoginName());
paymentBill.setApproveStatus(ApproveStatusEnum.WAIT_APPROVE.getCode());
OmsPaymentBill existBill = selectOmsPaymentBillById(paymentBill.getId());
todoService.startProcessDeleteBefore(existBill.getPaymentBillCode(), existBill.getPaymentBillCode(),
new HashMap<String, Object>() {{
put("applyUserName", ShiroUtils.getSysUser().getUserName());
put("applyUser", ShiroUtils.getUserId());
}}
, processConfig.getDefinition().getFinanceRefund());
omsPaymentBillMapper.updateOmsPaymentBill(paymentBill);
return AjaxResult.success("申请退款成功");
}
} }

View File

@ -273,6 +273,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
where payment_bill_code = #{paymentBillCode} where payment_bill_code = #{paymentBillCode}
</update> </update>
<update id="revoke">
update oms_payment_bill
set approve_status = #{approveStatus},
approve_time =null,
pre_residue_amount=null,
update_time=now()
where id = #{id}
</update>
<delete id="deleteOmsPaymentBillById" parameterType="Long"> <delete id="deleteOmsPaymentBillById" parameterType="Long">
delete from oms_payment_bill where id = #{id} delete from oms_payment_bill where id = #{id}
@ -302,6 +310,69 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectOmsPaymentBillVo"/> <include refid="selectOmsPaymentBillVo"/>
where pb.payment_bill_code = #{code} where pb.payment_bill_code = #{code}
</select> </select>
<select id="listApprove" resultType="com.ruoyi.sip.domain.OmsPaymentBill">
select
pb.id,
pb.payment_bill_code,
pb.payment_bill_type,
pb.payment_time,
pb.vendor_code,
pb.order_code,
pb.total_price_with_tax,
pb.total_price_without_tax,
pb.tax_amount,
pb.create_by,
pb.create_time,
pb.update_by,
pb.update_time,
pb.remark,
pb.del_flag,
pb.project_code,
pb.project_name,
pb.pre_residue_amount,
pb.actual_payment_time,
pb.payment_status,
pb.approve_status,
pb.approve_node,
pb.approve_time,
pb.payment_method,
pb.pay_name,
pb.pay_bank_number,
pb.pay_bank_open_address,
pb.bank_number,
pb.refund_status,
t2.vendor_name
,t5.user_name as hz_user_name
,t3.apply_time,t3.process_key,t3.todo_id,t3.task_id
<if test="'bu_todo_completed'.equals(tableName)">
,t3.approve_time as todo_approve_time
</if>
from oms_payment_bill pb
left join oms_vendor_info t2 on pb.vendor_code = t2.vendor_code
left join project_order_info t4 on pb.order_code = t4.order_code
left join sys_user t5 on t5.user_id = t4.duty
inner join ${tableName} t3 on (t3.process_key in ('finance_payment') and t3.approve_user=#{entity.approveUser} and t3.task_name!='商务' and t3.business_key=pb.payment_bill_code)
<where>
<if test="entity.paymentBillCode != null and entity.paymentBillCode != ''"> and pb.payment_bill_code like concat('%', #{entity.paymentBillCode}, '%')</if>
<if test="entity.paymentBillType != null and entity.paymentBillType != ''"> and pb.payment_bill_type = #{entity.paymentBillType}</if>
<if test="entity.paymentTime != null "> and date_format(pb.payment_time,'%Y-%m-%d') = date_format(#{entity.paymentTime},'%Y-%m-%d')</if>
<if test="entity.vendorCode != null and entity.vendorCode != ''"> and pb.vendor_code like concat('%', #{entity.vendorCode}, '%')</if>
<if test="entity.orderCode != null and entity.orderCode != ''"> and pb.order_code like concat('%', #{entity.orderCode}, '%')</if>
<if test="entity.totalPriceWithTax != null "> and pb.total_price_with_tax = #{entity.totalPriceWithTax}</if>
<if test="entity.totalPriceWithoutTax != null "> and pb.total_price_without_tax = #{entity.totalPriceWithoutTax}</if>
<if test="entity.taxAmount != null "> and pb.tax_amount = #{taxAmount}</if>
<if test="entity.projectCode != null and entity.projectCode != ''"> and pb.project_code like concat('%', #{entity.projectCode}, '%')</if>
<if test="entity.projectName != null and entity.projectName != ''"> and pb.project_name like concat('%', #{entity.projectName}, '%')</if>
<if test="entity.paymentStatus != null and entity.paymentStatus != ''"> and pb.payment_status = #{entity.paymentStatus}</if>
<if test="entity.approveStatus != null and entity.approveStatus != ''"> and pb.approve_status = #{entity.approveStatus}</if>
<if test="entity.approveNode != null and entity.approveNode != ''"> and pb.approve_node = #{entity.approveNode}</if>
<if test="entity.approveTime != null "> and date_format(pb.approve_time,'%Y-%m-%d') = date_format(#{entity.approveTime},'%Y-%m-%d')</if>
<if test="entity.actualPaymentTime != null "> and date_format(pb.actual_payment_time,'%Y-%m-%d') = date_format(#{entity.actualPaymentTime},'%Y-%m-%d')</if>
<if test="entity.paymentMethod != null and entity.paymentMethod != ''"> and pb.payment_method = #{entity.paymentMethod}</if>
<if test="entity.payableBillCode != null and entity.payableBillCode != ''"> and apb.payable_bill_code like concat('%', #{entity.payableBillCode}, '%')</if>
and pb.del_flag = '0'
</where>
</select>
</mapper> </mapper>