fix(bpm): 优化财务支付审批通知和数据库查询
重构财务支付模块中的审批通知逻辑,优化消息发送流程,并调整数据库查询以正确处理部门ID。改进了财务支付页面的MyBatis映射和VO参数命名,以提高代码的可读性和一致性。 -修正了在创建财务支付记录时向发起人发送审批结果通知的逻辑,确保根据审批结果正确发送消息。 - 调整了MyBatis映射文件中的部门ID查询条件,以使用正确的字段
This commit is contained in:
parent
237db15944
commit
b026cffe70
@ -25,5 +25,5 @@ public interface FinancialPaymentMapper extends BaseMapperX<FinancialPaymentDO>
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
IPage<FinancialPaymentDO> getFinancialPaymentPage(@Param("vp") FinancialPaymentPageReqVO vo, @Param("page") Page page);
|
||||
IPage<FinancialPaymentDO> getFinancialPaymentPage(@Param("vo") FinancialPaymentPageReqVO vo, @Param("page") Page page);
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.financialpayment;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.Constants;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||
@ -7,6 +9,7 @@ import cn.iocoder.yudao.module.bpm.controller.admin.financialpayment.vo.Financia
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.financialpayment.vo.FinancialPaymentSaveReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.financialpayment.vo.FinancialPaymentSaveVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.financialpaymentitem.vo.FinancialPaymentItemSaveReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.convert.message.BpmMessageConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.financialpaymentitem.FinancialPaymentItemDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOACashDO;
|
||||
@ -20,7 +23,13 @@ import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAImprestMapper;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAProcurePayMapper;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAReimbursementMapper;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.system.api.subscribe.SubscribeMessageSendApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@ -34,6 +43,7 @@ import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLogi
|
||||
* @author 艾楷
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Validated
|
||||
public class FinancialPaymentServiceImpl implements FinancialPaymentService {
|
||||
|
||||
@ -49,6 +59,12 @@ public class FinancialPaymentServiceImpl implements FinancialPaymentService {
|
||||
private BpmOAProcurePayMapper oAProcurePayMapper;
|
||||
@Resource
|
||||
private BpmOAReimbursementMapper reimbursementMapper;
|
||||
@Resource
|
||||
private SubscribeMessageSendApi subscribeMessageSendApi;
|
||||
@Resource
|
||||
private RuntimeService runtimeService;
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Override
|
||||
public Long createFinancialPayment(FinancialPaymentSaveVO vo) {
|
||||
@ -80,12 +96,26 @@ public class FinancialPaymentServiceImpl implements FinancialPaymentService {
|
||||
} else if (financialPayment.getType() == 4) {
|
||||
reimbursementMapper.updateById(new BpmOAReimbursementDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||
}
|
||||
|
||||
// --- 发消息通知发起人
|
||||
|
||||
|
||||
}
|
||||
this.updateById(financialPayment);
|
||||
try {
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(financialPayment.getProcessInstanceId()).singleResult();
|
||||
AdminUserRespDTO adminUserRespDTO = userApi.getUser(financialPayment.getUserId()).getData();
|
||||
if (StrUtil.isNotEmpty(adminUserRespDTO.getOpenId())) {
|
||||
// --- 发消息通知发起人
|
||||
String time = financialPaymentItem.getCreateTime().format(Constants.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND);
|
||||
subscribeMessageSendApi.sendApprovalResultNotification(
|
||||
BpmMessageConvert.INSTANCE.convertApprovalResultNotification(
|
||||
adminUserRespDTO.getOpenId(), processInstance.getProcessDefinitionName(), time, vo.getStatus() == 1 ? "通过" : "拒绝", financialPaymentItem.getNotes(),
|
||||
financialPayment.getProcessInstanceId(),
|
||||
/**
|
||||
* 跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版
|
||||
*/
|
||||
"formal"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("财务管理审批发送通知人失败:{}", financialPayment);
|
||||
}
|
||||
// 返回
|
||||
return financialPayment.getId();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
<where>
|
||||
a.deleted = 0
|
||||
<if test="vo.deptId != null">
|
||||
and b.dept_id = #{vo.deptId}
|
||||
and c.id = #{vo.deptId}
|
||||
</if>
|
||||
<if test="vo.nickname != null and vo.nickname != ''">
|
||||
and b.nickname like concat('%', #{vo.nickname}, '%')
|
||||
|
Loading…
Reference in New Issue
Block a user