|
@@ -1,35 +1,48 @@
|
|
|
package com.fjhx.account.flow;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
+import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.fjhx.account.entity.account.dto.AccountPaymentDto;
|
|
|
import com.fjhx.account.entity.account.dto.AccountRequestFundsDto;
|
|
|
import com.fjhx.account.entity.account.enums.AccountRequestFundsStatusEnum;
|
|
|
+import com.fjhx.account.entity.account.enums.PaymentStatusEnum;
|
|
|
+import com.fjhx.account.entity.account.enums.PaymentTypeEnum;
|
|
|
+import com.fjhx.account.entity.account.po.AccountPayment;
|
|
|
import com.fjhx.account.entity.account.po.AccountRequestFunds;
|
|
|
import com.fjhx.account.entity.account.po.AccountRequestFundsDetail;
|
|
|
+import com.fjhx.account.entity.account.vo.AccountPaymentVo;
|
|
|
+import com.fjhx.account.service.account.AccountPaymentService;
|
|
|
import com.fjhx.account.service.account.AccountRequestFundsDetailService;
|
|
|
import com.fjhx.account.service.account.AccountRequestFundsService;
|
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
|
import com.fjhx.file.utils.ObsFileUtil;
|
|
|
import com.fjhx.flow.core.FlowDelegate;
|
|
|
import com.obs.services.internal.ServiceException;
|
|
|
+import org.checkerframework.checker.units.qual.A;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import oshi.util.FileUtil;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
- * 采购流程
|
|
|
+ * 请款流程
|
|
|
* @Author:caozj
|
|
|
* @DATE:2023/4/3 17:38
|
|
|
*/
|
|
|
@DS(SourceConstant.ACCOUNT)
|
|
|
@Component
|
|
|
public class AccountRequestFundsFlow extends FlowDelegate {
|
|
|
+ @Autowired
|
|
|
+ private AccountPaymentService accountPaymentService;
|
|
|
|
|
|
@Override
|
|
|
public String getFlowKey() {
|
|
@@ -45,12 +58,14 @@ public class AccountRequestFundsFlow extends FlowDelegate {
|
|
|
*/
|
|
|
@Override
|
|
|
public Long start(Long flowId, JSONObject submitData) {
|
|
|
+// DynamicDataSourceContextHolder.push(SourceConstant.ACCOUNT);
|
|
|
AccountRequestFundsService accountRequestFundsService = SpringUtil.getBean(AccountRequestFundsService.class);
|
|
|
AccountRequestFundsDetailService accountRequestFundsDetailService = SpringUtil.getBean(AccountRequestFundsDetailService.class);
|
|
|
AccountRequestFundsDto accountRequestFundsDto = submitData.toJavaObject( AccountRequestFundsDto.class);
|
|
|
accountRequestFundsDto.setStatus(AccountRequestFundsStatusEnum.UNDER_REVIEW.getKey());
|
|
|
//添加请款表的信息
|
|
|
accountRequestFundsService.save(accountRequestFundsDto);
|
|
|
+
|
|
|
//获取请款详情表的详细信息
|
|
|
List<AccountRequestFundsDetail> accountRequestFundsDetailList = accountRequestFundsDto.getAccountRequestFundsDetailList();
|
|
|
if(CollectionUtils.isNotEmpty(accountRequestFundsDetailList)){
|
|
@@ -59,9 +74,14 @@ public class AccountRequestFundsFlow extends FlowDelegate {
|
|
|
//添加请款详情表的信息
|
|
|
accountRequestFundsDetailService.saveBatch(accountRequestFundsDetailList);
|
|
|
}
|
|
|
+ //删除流程
|
|
|
+ ObsFileUtil.removeFile(accountRequestFundsDto.getId());
|
|
|
//添加附件信息
|
|
|
ObsFileUtil.saveFile(accountRequestFundsDto.getFileList(),accountRequestFundsDto.getId());
|
|
|
|
|
|
+
|
|
|
+ //添加打款的数据
|
|
|
+ addPayment(accountRequestFundsDto);
|
|
|
return accountRequestFundsDto.getId();
|
|
|
}
|
|
|
|
|
@@ -83,4 +103,19 @@ public class AccountRequestFundsFlow extends FlowDelegate {
|
|
|
accountRequestFunds.setStatus(AccountRequestFundsStatusEnum.PASS.getKey());
|
|
|
accountRequestFundsService.updateById(accountRequestFunds);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加打款表的数据
|
|
|
+ */
|
|
|
+ private void addPayment(AccountRequestFundsDto accountRequestFundsDto){
|
|
|
+ AccountPaymentDto accountPayment = new AccountPaymentDto();
|
|
|
+ accountPayment.setBusinessId(accountRequestFundsDto.getId());
|
|
|
+ accountPayment.setType(PaymentTypeEnum.UNDER_REVIEW.getKey());
|
|
|
+ accountPayment.setStatus(PaymentStatusEnum.UNDER_REVIEW.getKey());
|
|
|
+ accountPayment.setPaymentTime(accountPayment.getPaymentTime());
|
|
|
+ accountPayment.setPaymentRemark(accountRequestFundsDto.getPaymentRemarks());
|
|
|
+ accountPayment.setDepartmentId(accountRequestFundsDto.getDepartmentId());
|
|
|
+ accountPayment.setCorporationId(accountRequestFundsDto.getCorporationId());
|
|
|
+ accountPaymentService.save(accountPayment);
|
|
|
+ }
|
|
|
}
|