|
@@ -14,15 +14,19 @@ import com.fjhx.account.service.account.AccountPaymentService;
|
|
import com.fjhx.account.service.account.AccountRequestFundsDetailService;
|
|
import com.fjhx.account.service.account.AccountRequestFundsDetailService;
|
|
import com.fjhx.account.service.account.AccountRequestFundsService;
|
|
import com.fjhx.account.service.account.AccountRequestFundsService;
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
|
|
+import com.fjhx.common.enums.FlowStatusEnum1;
|
|
import com.fjhx.common.utils.Assert;
|
|
import com.fjhx.common.utils.Assert;
|
|
import com.fjhx.file.utils.ObsFileUtil;
|
|
import com.fjhx.file.utils.ObsFileUtil;
|
|
import com.fjhx.flow.core.FlowDelegate;
|
|
import com.fjhx.flow.core.FlowDelegate;
|
|
import com.fjhx.flow.enums.FlowStatusEnum;
|
|
import com.fjhx.flow.enums.FlowStatusEnum;
|
|
|
|
+import com.ruoyi.common.core.domain.BasePo;
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
|
+import com.ruoyi.common.utils.SecurityUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -60,22 +64,7 @@ public class AccountRequestFundsFlow extends FlowDelegate {
|
|
@Override
|
|
@Override
|
|
public Long start(Long flowId, JSONObject submitData) {
|
|
public Long start(Long flowId, JSONObject submitData) {
|
|
|
|
|
|
- // 获取提交数据
|
|
|
|
- AccountRequestFundsDto accountRequestFundsDto = submitData.toJavaObject(AccountRequestFundsDto.class);
|
|
|
|
-
|
|
|
|
- // 添加请款表的信息
|
|
|
|
- accountRequestFundsDto.setStatus(AccountRequestFundsStatusEnum.UNDER_REVIEW.getKey());
|
|
|
|
- accountRequestFundsService.save(accountRequestFundsDto);
|
|
|
|
-
|
|
|
|
- // 添加请款详情表的信息
|
|
|
|
- List<AccountRequestFundsDetail> accountRequestFundsDetailList = accountRequestFundsDto.getAccountRequestFundsDetailList();
|
|
|
|
- if (CollectionUtils.isNotEmpty(accountRequestFundsDetailList)) {
|
|
|
|
- accountRequestFundsDetailList.forEach(item -> item.setAccountRequestFundsId(accountRequestFundsDto.getId()));
|
|
|
|
- accountRequestFundsDetailService.saveBatch(accountRequestFundsDetailList);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 添加附件信息
|
|
|
|
- ObsFileUtil.saveFile(accountRequestFundsDto.getFileList(), accountRequestFundsDto.getId());
|
|
|
|
|
|
+ AccountRequestFundsDto accountRequestFundsDto = commStart(submitData, 0);
|
|
|
|
|
|
return accountRequestFundsDto.getId();
|
|
return accountRequestFundsDto.getId();
|
|
}
|
|
}
|
|
@@ -117,7 +106,59 @@ public class AccountRequestFundsFlow extends FlowDelegate {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void defaultMethod(Long flowId, Long businessId, FlowStatusEnum flowStatusEnum, JSONObject submitData) {
|
|
public void defaultMethod(Long flowId, Long businessId, FlowStatusEnum flowStatusEnum, JSONObject submitData) {
|
|
|
|
+ //重新发起
|
|
|
|
+ if (FlowStatusEnum.READY_START.equals(flowStatusEnum)) {
|
|
|
|
+ commStart(submitData, 1);
|
|
|
|
+ }
|
|
|
|
+ //驳回
|
|
|
|
+ if (FlowStatusEnum.REJECT.equals(flowStatusEnum)) {
|
|
|
|
+ accountRequestFundsService.update(q -> q
|
|
|
|
+ .eq(AccountRequestFunds::getId, businessId)
|
|
|
|
+ .set(AccountRequestFunds::getStatus, FlowStatusEnum1.REJECT.getKey())//20为驳回
|
|
|
|
+ .set(BasePo::getUpdateTime, new Date())
|
|
|
|
+ .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 开始公共代码抽取
|
|
|
|
+ *
|
|
|
|
+ * @param opType 操作类型 0直接发起 1重新发起
|
|
|
|
+ */
|
|
|
|
+ private AccountRequestFundsDto commStart(JSONObject submitData, Integer opType) {
|
|
|
|
+ // 获取提交数据
|
|
|
|
+ AccountRequestFundsDto accountRequestFundsDto = submitData.toJavaObject(AccountRequestFundsDto.class);
|
|
|
|
+
|
|
|
|
+ if (opType == 1) {
|
|
|
|
+ Assert.notEmpty(accountRequestFundsDto.getId(), "请款id不能为空");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 添加请款表的信息
|
|
|
|
+ accountRequestFundsDto.setStatus(AccountRequestFundsStatusEnum.UNDER_REVIEW.getKey());
|
|
|
|
+ accountRequestFundsService.saveOrUpdate(accountRequestFundsDto);
|
|
|
|
+
|
|
|
|
+ // 添加请款详情表的信息
|
|
|
|
+ List<AccountRequestFundsDetail> accountRequestFundsDetailList = accountRequestFundsDto.getAccountRequestFundsDetailList();
|
|
|
|
+ if (CollectionUtils.isNotEmpty(accountRequestFundsDetailList)) {
|
|
|
|
+ if (opType == 1) {
|
|
|
|
+ //先删除被删除的产品
|
|
|
|
+ accountRequestFundsDetailService.editLinked(accountRequestFundsDetailList, AccountRequestFundsDetail::getContractId, accountRequestFundsDto.getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ accountRequestFundsDetailList.forEach(item -> item.setAccountRequestFundsId(accountRequestFundsDto.getId()));
|
|
|
|
+ accountRequestFundsDetailService.saveOrUpdateBatch(accountRequestFundsDetailList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (opType == 1) {
|
|
|
|
+ // 编辑附件信息
|
|
|
|
+ ObsFileUtil.editFile(accountRequestFundsDto.getFileList(), accountRequestFundsDto.getId());
|
|
|
|
+ } else {
|
|
|
|
+ // 添加附件信息
|
|
|
|
+ ObsFileUtil.saveFile(accountRequestFundsDto.getFileList(), accountRequestFundsDto.getId());
|
|
|
|
+ }
|
|
|
|
+ return accountRequestFundsDto;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|