|
@@ -22,10 +22,12 @@ import com.obs.services.internal.ServiceException;
|
|
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.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 请款流程
|
|
|
|
|
|
+ * 请款流程
|
|
|
|
+ *
|
|
* @Author:caozj
|
|
* @Author:caozj
|
|
* @DATE:2023/4/3 17:38
|
|
* @DATE:2023/4/3 17:38
|
|
*/
|
|
*/
|
|
@@ -43,7 +45,8 @@ public class AccountRequestFundsFlow extends FlowDelegate {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 发起流程
|
|
* 发起流程
|
|
- * @param flowId 流程ID
|
|
|
|
|
|
+ *
|
|
|
|
+ * @param flowId 流程ID
|
|
* @param submitData 请款表信息
|
|
* @param submitData 请款表信息
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@@ -52,37 +55,38 @@ public class AccountRequestFundsFlow extends FlowDelegate {
|
|
// DynamicDataSourceContextHolder.push(SourceConstant.ACCOUNT);
|
|
// DynamicDataSourceContextHolder.push(SourceConstant.ACCOUNT);
|
|
AccountRequestFundsService accountRequestFundsService = SpringUtil.getBean(AccountRequestFundsService.class);
|
|
AccountRequestFundsService accountRequestFundsService = SpringUtil.getBean(AccountRequestFundsService.class);
|
|
AccountRequestFundsDetailService accountRequestFundsDetailService = SpringUtil.getBean(AccountRequestFundsDetailService.class);
|
|
AccountRequestFundsDetailService accountRequestFundsDetailService = SpringUtil.getBean(AccountRequestFundsDetailService.class);
|
|
- AccountRequestFundsDto accountRequestFundsDto = submitData.toJavaObject( AccountRequestFundsDto.class);
|
|
|
|
|
|
+ AccountRequestFundsDto accountRequestFundsDto = submitData.toJavaObject(AccountRequestFundsDto.class);
|
|
accountRequestFundsDto.setStatus(AccountRequestFundsStatusEnum.UNDER_REVIEW.getKey());
|
|
accountRequestFundsDto.setStatus(AccountRequestFundsStatusEnum.UNDER_REVIEW.getKey());
|
|
//添加请款表的信息
|
|
//添加请款表的信息
|
|
accountRequestFundsService.save(accountRequestFundsDto);
|
|
accountRequestFundsService.save(accountRequestFundsDto);
|
|
|
|
|
|
//获取请款详情表的详细信息
|
|
//获取请款详情表的详细信息
|
|
List<AccountRequestFundsDetail> accountRequestFundsDetailList = accountRequestFundsDto.getAccountRequestFundsDetailList();
|
|
List<AccountRequestFundsDetail> accountRequestFundsDetailList = accountRequestFundsDto.getAccountRequestFundsDetailList();
|
|
- if(CollectionUtils.isNotEmpty(accountRequestFundsDetailList)){
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(accountRequestFundsDetailList)) {
|
|
accountRequestFundsDetailList.forEach(accountRequestFundsDetail -> accountRequestFundsDetail
|
|
accountRequestFundsDetailList.forEach(accountRequestFundsDetail -> accountRequestFundsDetail
|
|
.setAccountRequestFundsId(accountRequestFundsDto.getId()));
|
|
.setAccountRequestFundsId(accountRequestFundsDto.getId()));
|
|
//添加请款详情表的信息
|
|
//添加请款详情表的信息
|
|
accountRequestFundsDetailService.saveBatch(accountRequestFundsDetailList);
|
|
accountRequestFundsDetailService.saveBatch(accountRequestFundsDetailList);
|
|
}
|
|
}
|
|
//添加附件信息
|
|
//添加附件信息
|
|
- ObsFileUtil.saveFile(accountRequestFundsDto.getFileList(),accountRequestFundsDto.getId());
|
|
|
|
|
|
+ ObsFileUtil.saveFile(accountRequestFundsDto.getFileList(), accountRequestFundsDto.getId());
|
|
return accountRequestFundsDto.getId();
|
|
return accountRequestFundsDto.getId();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 结束流程
|
|
* 结束流程
|
|
- * @param flowId 流程ID
|
|
|
|
|
|
+ *
|
|
|
|
+ * @param flowId 流程ID
|
|
* @param businessId 业务ID
|
|
* @param businessId 业务ID
|
|
- * @param submitData 请款表信息
|
|
|
|
|
|
+ * @param submitData 请款表信息
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public void end(Long flowId, Long businessId, JSONObject submitData) {
|
|
public void end(Long flowId, Long businessId, JSONObject submitData) {
|
|
AccountRequestFundsService accountRequestFundsService = SpringUtil.getBean(AccountRequestFundsService.class);
|
|
AccountRequestFundsService accountRequestFundsService = SpringUtil.getBean(AccountRequestFundsService.class);
|
|
//通过业务ID查询申购数据
|
|
//通过业务ID查询申购数据
|
|
AccountRequestFunds accountRequestFunds = accountRequestFundsService.getById(businessId);
|
|
AccountRequestFunds accountRequestFunds = accountRequestFundsService.getById(businessId);
|
|
- AccountRequestFundsDto accountRequestFundsDto = submitData.toJavaObject( AccountRequestFundsDto.class);
|
|
|
|
- if(ObjectUtils.isEmpty(accountRequestFunds)){
|
|
|
|
|
|
+ AccountRequestFundsDto accountRequestFundsDto = submitData.toJavaObject(AccountRequestFundsDto.class);
|
|
|
|
+ if (ObjectUtils.isEmpty(accountRequestFunds)) {
|
|
throw new ServiceException("请款表的数据不存在");
|
|
throw new ServiceException("请款表的数据不存在");
|
|
}
|
|
}
|
|
//修改申购状态为审批通过
|
|
//修改申购状态为审批通过
|
|
@@ -95,7 +99,7 @@ public class AccountRequestFundsFlow extends FlowDelegate {
|
|
/**
|
|
/**
|
|
* 添加打款表的数据
|
|
* 添加打款表的数据
|
|
*/
|
|
*/
|
|
- private void addPayment(AccountRequestFundsDto accountRequestFundsDto){
|
|
|
|
|
|
+ private void addPayment(AccountRequestFundsDto accountRequestFundsDto) {
|
|
AccountPaymentDto accountPayment = new AccountPaymentDto();
|
|
AccountPaymentDto accountPayment = new AccountPaymentDto();
|
|
accountPayment.setBusinessId(accountRequestFundsDto.getId());
|
|
accountPayment.setBusinessId(accountRequestFundsDto.getId());
|
|
accountPayment.setType(PaymentTypeEnum.UNDER_REVIEW.getKey());
|
|
accountPayment.setType(PaymentTypeEnum.UNDER_REVIEW.getKey());
|
|
@@ -115,6 +119,13 @@ public class AccountRequestFundsFlow extends FlowDelegate {
|
|
accountPayment.setCurrency(accountPayment.getCurrency());
|
|
accountPayment.setCurrency(accountPayment.getCurrency());
|
|
accountPayment.setAccountOpening(accountRequestFundsDto.getAccountOpening());
|
|
accountPayment.setAccountOpening(accountRequestFundsDto.getAccountOpening());
|
|
accountPayment.setInterbankNumber(accountPayment.getInterbankNumber());
|
|
accountPayment.setInterbankNumber(accountPayment.getInterbankNumber());
|
|
|
|
+
|
|
|
|
+ //如果是核销 核销数据审批通过后,根据“核销总额 - 预支总额”生成“待打款”数据
|
|
|
|
+ if ("3".equals(accountRequestFundsDto.getType())) {
|
|
|
|
+ BigDecimal subtract = accountRequestFundsDto.getWriteOffAmount().subtract(accountRequestFundsDto.getAdvanceAmount());
|
|
|
|
+ accountPayment.setAmount(subtract);
|
|
|
|
+ }
|
|
|
|
+
|
|
accountPaymentService.save(accountPayment);
|
|
accountPaymentService.save(accountPayment);
|
|
}
|
|
}
|
|
}
|
|
}
|