|
@@ -0,0 +1,48 @@
|
|
|
+package com.yh.saas.plugin.yiliangyiyun.workflow;
|
|
|
+
|
|
|
+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;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.ExpenseInfo;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.service.IExpenseInfoService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+
|
|
|
+@WorkflowTaskListener(name = "利润核算", group = "费用管理")
|
|
|
+public class ExepenseListener extends AbstractWorkflowTaskListener {
|
|
|
+
|
|
|
+ private static final long serialVersionUID = 4103656734835351132L;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IExpenseInfoService expenseInfoService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void handleStatusChanged(String businessKey, String status, String statusEn, boolean processIsEnd) {
|
|
|
+ ExpenseInfo expenseInfo = expenseInfoService.selectById(businessKey);
|
|
|
+ if (expenseInfo == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (processIsEnd) {
|
|
|
+ expenseInfo.setStatusFlag(StatusEnum.NOT_COLLECTION_PAY.getFlag());
|
|
|
+ expenseInfo.setStatus(StatusEnum.NOT_COLLECTION_PAY.getName());
|
|
|
+ expenseInfo.setWorkflowId(null);
|
|
|
+ expenseInfo.setApproveStatus(null);
|
|
|
+ } else {
|
|
|
+ expenseInfo.setApproveStatus(status);
|
|
|
+ }
|
|
|
+ expenseInfoService.updateAllColumnById(expenseInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void handleRejectApplicationRepulsed(String workflowId, String businessKey, boolean needReapply) {
|
|
|
+ ExpenseInfo expenseInfo = expenseInfoService.selectById(businessKey);
|
|
|
+ if (expenseInfo == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ expenseInfo.setStatusFlag(StatusEnum.PURCHASE_FAILED.getFlag());
|
|
|
+ expenseInfo.setStatus(StatusEnum.PURCHASE_FAILED.getName());
|
|
|
+ expenseInfo.setApproveStatus(null);
|
|
|
+ expenseInfoService.updateAllColumnById(expenseInfo);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|