|
@@ -1,14 +1,19 @@
|
|
|
package com.aizuda.boot.modules.test.service.impl;
|
|
|
|
|
|
-import com.aizuda.core.api.ApiAssert;
|
|
|
+import com.aizuda.boot.modules.flw.service.IFlwProcessService;
|
|
|
import com.aizuda.boot.modules.test.entity.TestPurchaseOrder;
|
|
|
+import com.aizuda.boot.modules.test.entity.dto.TestProcessStartDTO;
|
|
|
import com.aizuda.boot.modules.test.mapper.TestPurchaseOrderMapper;
|
|
|
import com.aizuda.boot.modules.test.service.ITestPurchaseOrderService;
|
|
|
+import com.aizuda.bpm.engine.core.FlowCreator;
|
|
|
+import com.aizuda.core.api.ApiAssert;
|
|
|
import com.aizuda.service.service.BaseServiceImpl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
/**
|
|
|
* 测试采购单 服务实现类
|
|
@@ -17,7 +22,9 @@ import org.springframework.stereotype.Service;
|
|
|
* @since 2024-06-10
|
|
|
*/
|
|
|
@Service
|
|
|
+@AllArgsConstructor
|
|
|
public class TestPurchaseOrderServiceImpl extends BaseServiceImpl<TestPurchaseOrderMapper, TestPurchaseOrder> implements ITestPurchaseOrderService {
|
|
|
+ private IFlwProcessService flwProcessService;
|
|
|
|
|
|
@Override
|
|
|
public Page<TestPurchaseOrder> page(Page<TestPurchaseOrder> page, TestPurchaseOrder testPurchaseOrder) {
|
|
@@ -30,4 +37,17 @@ public class TestPurchaseOrderServiceImpl extends BaseServiceImpl<TestPurchaseOr
|
|
|
ApiAssert.fail(null == testPurchaseOrder.getId(), "主键不存在无法更新");
|
|
|
return super.updateById(testPurchaseOrder);
|
|
|
}
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public boolean launchProcess(TestProcessStartDTO dto, FlowCreator flowCreator) {
|
|
|
+ Long flwInstanceId = flwProcessService.launchProcess(dto.getProcessStart(), flowCreator);
|
|
|
+ ApiAssert.fail(null == flwInstanceId, "流程发起失败");
|
|
|
+ TestPurchaseOrder tpo = new TestPurchaseOrder();
|
|
|
+ tpo.setId(dto.getId());
|
|
|
+ tpo.setFlwInstanceId(flwInstanceId);
|
|
|
+ // 设置为审批状态
|
|
|
+ tpo.setStatus(1);
|
|
|
+ return super.updateById(tpo);
|
|
|
+ }
|
|
|
}
|