|
@@ -2,7 +2,14 @@ package com.yh.saas.plugin.yiliangyiyun.workflow;
|
|
|
|
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
import com.winsea.svc.base.base.entity.AuditHistory;
|
|
|
+import com.winsea.svc.base.base.entity.CommonStaff;
|
|
|
import com.winsea.svc.base.base.service.IAuditHistoryService;
|
|
|
+import com.winsea.svc.base.base.service.ICommonStaffService;
|
|
|
+import com.winsea.svc.base.security.util.AuthSecurityUtils;
|
|
|
+import com.winsea.svc.notice.entity.NoticeTaskInfo;
|
|
|
+import com.winsea.svc.notice.entity.base.BaseNotice;
|
|
|
+import com.winsea.svc.notice.service.INoticeService;
|
|
|
+import com.winsea.svc.notice.service.INoticeTaskService;
|
|
|
import com.yh.saas.common.support.workflow.AbstractWorkflowTaskListener;
|
|
|
import com.yh.saas.common.support.workflow.annotation.WorkflowTaskListener;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
|
|
@@ -14,6 +21,9 @@ import com.yh.saas.plugin.yiliangyiyun.service.IExpenseInfoService;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IPurchasePriceService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
@WorkflowTaskListener(name = "费用管理(新)", group = "费用管理(新)")
|
|
|
public class ExepenseInfoListener extends AbstractWorkflowTaskListener {
|
|
|
|
|
@@ -26,6 +36,12 @@ public class ExepenseInfoListener extends AbstractWorkflowTaskListener {
|
|
|
private IAuditHistoryService auditHistoryService;
|
|
|
@Autowired
|
|
|
private StatusRecordMapper statusRecordMapper;
|
|
|
+ @Autowired
|
|
|
+ private INoticeService noticeService;
|
|
|
+ @Autowired
|
|
|
+ private INoticeTaskService noticeTaskService;
|
|
|
+ @Autowired
|
|
|
+ private ICommonStaffService staffService;
|
|
|
|
|
|
@Override
|
|
|
public void handleStatusChanged(String businessKey, String status, String statusEn, boolean processIsEnd) {
|
|
@@ -50,6 +66,27 @@ public class ExepenseInfoListener extends AbstractWorkflowTaskListener {
|
|
|
statusRecord.setStatus(StatusEnum.ORDER_PASSED.getName());
|
|
|
statusRecordMapper.insert(statusRecord);
|
|
|
}
|
|
|
+
|
|
|
+ // 先删除任务
|
|
|
+ noticeService.removeNotice(BaseNotice.NoticeStatus.TASK, "FEIYONGGUANLI-APPROVE",
|
|
|
+ expenseInfo.getId(), null);
|
|
|
+ CommonStaff commitUserInfo = staffService.getInfo(AuthSecurityUtils.getCurrentUserId());
|
|
|
+ String taskContent = "有新的待付款操作需要你处理";
|
|
|
+ NoticeTaskInfo taskInfo = new NoticeTaskInfo();
|
|
|
+ taskInfo.setCompId(commitUserInfo.getCompId());
|
|
|
+ taskInfo.setAcceptType(BaseNotice.AcceptStatus.STAFF);
|
|
|
+ taskInfo.setBusinessId(expenseInfo.getId());
|
|
|
+ taskInfo.setBusinessType("FEIYONGGUANLI");
|
|
|
+ taskInfo.setMessageTitle("费用管理");
|
|
|
+ taskInfo.setMessageContent(taskContent);
|
|
|
+ taskInfo.setBusinessCode("FEIYONGGUANLI-APPROVE");
|
|
|
+ //查询出纳
|
|
|
+ List<CommonStaff> commonStaffList = staffService.selectList(new EntityWrapper<CommonStaff>()
|
|
|
+ .eq("major_role_id", "04e3ec4d03c7499fafa690572fdb4c1c")
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
+ List<String> staffIds = commonStaffList.stream().map(CommonStaff::getStaffId).collect(Collectors.toList());
|
|
|
+ noticeTaskService.createNoticeTask(staffIds,
|
|
|
+ null, taskInfo);
|
|
|
} else {
|
|
|
expenseInfo.setApproveStatus(status);
|
|
|
|