diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/financialpayment/FinancialPaymentMapper.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/financialpayment/FinancialPaymentMapper.java index d520f67a..346e3fe9 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/financialpayment/FinancialPaymentMapper.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/financialpayment/FinancialPaymentMapper.java @@ -25,5 +25,5 @@ public interface FinancialPaymentMapper extends BaseMapperX * @param page * @return */ - IPage getFinancialPaymentPage(@Param("vp") FinancialPaymentPageReqVO vo, @Param("page") Page page); + IPage getFinancialPaymentPage(@Param("vo") FinancialPaymentPageReqVO vo, @Param("page") Page page); } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/financialpayment/FinancialPaymentServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/financialpayment/FinancialPaymentServiceImpl.java index 3874be70..963487d1 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/financialpayment/FinancialPaymentServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/financialpayment/FinancialPaymentServiceImpl.java @@ -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(); } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/mapper/financialpayment/FinancialPaymentMapper.xml b/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/mapper/financialpayment/FinancialPaymentMapper.xml index e9429b9d..e67e467d 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/mapper/financialpayment/FinancialPaymentMapper.xml +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/mapper/financialpayment/FinancialPaymentMapper.xml @@ -23,7 +23,7 @@ a.deleted = 0 - and b.dept_id = #{vo.deptId} + and c.id = #{vo.deptId} and b.nickname like concat('%', #{vo.nickname}, '%')