Эх сурвалжийг харах

打款添加添加是否往来

yzc 1 жил өмнө
parent
commit
38dae2e102

+ 8 - 2
hx-account/src/main/java/com/fjhx/account/entity/account/dto/AccountPaymentDto.java

@@ -38,8 +38,14 @@ public class AccountPaymentDto extends AccountPayment {
      */
     private String accountOpening;
 
+    /**
+     * 是否往来 1是 0不是
+     */
+    private Integer isTransaction;
 
-
-
+    /**
+     * 往来单位id
+     */
+    private Long transactionDeptId;
 
 }

+ 23 - 0
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountPaymentServiceImpl.java

@@ -16,11 +16,13 @@ import com.fjhx.account.entity.account.po.AccountPayment;
 import com.fjhx.account.entity.account.po.AccountRemainder;
 import com.fjhx.account.entity.account.po.AccountRunningWater;
 import com.fjhx.account.entity.account.vo.AccountPaymentVo;
+import com.fjhx.account.entity.transaction.po.Transaction;
 import com.fjhx.account.mapper.account.AccountPaymentMapper;
 import com.fjhx.account.service.account.AccountManagementService;
 import com.fjhx.account.service.account.AccountPaymentService;
 import com.fjhx.account.service.account.AccountRemainderService;
 import com.fjhx.account.service.account.AccountRunningWaterService;
+import com.fjhx.account.service.transaction.TransactionService;
 import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.common.service.corporation.CorporationService;
 import com.fjhx.file.utils.ObsFileUtil;
@@ -62,6 +64,9 @@ public class AccountPaymentServiceImpl extends ServiceImpl<AccountPaymentMapper,
     @Autowired
     private AccountManagementService accountManagementService;
 
+    @Autowired
+    private TransactionService transactionService;
+
     @Override
     public Page<AccountPaymentVo> getPage(AccountRequestFundsSelectDto dto) {
 
@@ -224,8 +229,26 @@ public class AccountPaymentServiceImpl extends ServiceImpl<AccountPaymentMapper,
         accountRunningWater.setBusinessId(accountPaymentDto.getId());
         //添加流水类型
         accountRunningWater.setType("10");
+        //赋值是否往来
+        accountRunningWater.setIsTransaction(accountPaymentDto.getIsTransaction());
+        accountRunningWater.setTransactionDeptId(accountPaymentDto.getTransactionDeptId());
         accountRunningWaterService.save(accountRunningWater);
 
+        //如果是往来
+        if (ObjectUtil.isNotEmpty(accountRunningWater.getIsTransaction()) && 1 == accountRunningWater.getIsTransaction()) {
+            //创建往来数据
+            Transaction transaction = new Transaction();
+            transaction.setDepartmentId(accountRunningWater.getTransactionDeptId());
+            transaction.setType("10".equals(accountRunningWater.getStatus()) ? 0 : 1);
+            transaction.setCurrency(accountRunningWater.getCurrency());
+            transaction.setAmount(accountRunningWater.getAmount());
+            transaction.setIsFlowingWater(1);
+            transaction.setAccountId(accountRunningWater.getAccountManagementId());
+            transaction.setRemark(accountRunningWater.getRemarks());
+            transaction.setAccountRunningWaterId(accountRunningWater.getId());
+            transactionService.save(transaction);
+        }
+
     }