huangfuli 1 år sedan
förälder
incheckning
d8a7551a84

+ 37 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/workflow/ExepenseInfoListener.java

@@ -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);
 

+ 37 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/workflow/ExepenseListener.java

@@ -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;
@@ -13,6 +20,9 @@ import com.yh.saas.plugin.yiliangyiyun.mapper.StatusRecordMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.IExpenseInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.List;
+import java.util.stream.Collectors;
+
 @WorkflowTaskListener(name = "费用管理", group = "费用管理")
 public class ExepenseListener extends AbstractWorkflowTaskListener {
 
@@ -25,6 +35,12 @@ public class ExepenseListener 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) {
@@ -49,6 +65,27 @@ public class ExepenseListener 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);
 

+ 35 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/workflow/ExepenseYunListener.java

@@ -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;
@@ -17,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
 
 import java.util.List;
+import java.util.stream.Collectors;
 
 @WorkflowTaskListener(name = "费用运费", group = "费用运费")
 public class ExepenseYunListener extends AbstractWorkflowTaskListener {
@@ -32,6 +40,12 @@ public class ExepenseYunListener 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) {
@@ -65,6 +79,27 @@ public class ExepenseYunListener 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);