From 05683f2b2bdbdbe21cf17ad523c21ab338bd1c54 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期二, 19 七月 2022 21:49:55 +0800
Subject: [PATCH] 优化添加设备 功能

---
 service-acct/src/main/java/com/java110/acct/bmo/accountWithdrawalApply/impl/UpdateAccountWithdrawalApplyBMOImpl.java |   35 ++++++++++++++++++++++++++---------
 1 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/service-acct/src/main/java/com/java110/acct/bmo/accountWithdrawalApply/impl/UpdateAccountWithdrawalApplyBMOImpl.java b/service-acct/src/main/java/com/java110/acct/bmo/accountWithdrawalApply/impl/UpdateAccountWithdrawalApplyBMOImpl.java
index 993481a..f01a15a 100644
--- a/service-acct/src/main/java/com/java110/acct/bmo/accountWithdrawalApply/impl/UpdateAccountWithdrawalApplyBMOImpl.java
+++ b/service-acct/src/main/java/com/java110/acct/bmo/accountWithdrawalApply/impl/UpdateAccountWithdrawalApplyBMOImpl.java
@@ -2,13 +2,16 @@
 
 import com.alibaba.fastjson.JSONObject;
 import com.java110.acct.bmo.accountWithdrawalApply.IUpdateAccountWithdrawalApplyBMO;
+import com.java110.acct.dao.IAccountServiceDao;
 import com.java110.core.annotation.Java110Transactional;
 
+import com.java110.dto.account.AccountDto;
 import com.java110.dto.accountWithdrawalApply.AccountWithdrawalApplyDto;
 import com.java110.intf.acct.IAccountInnerServiceSMO;
 import com.java110.intf.acct.IAccountWithdrawalApplyInnerServiceSMO;
 import com.java110.po.accountDetail.AccountDetailPo;
 import com.java110.po.accountWithdrawalApply.AccountWithdrawalApplyPo;
+import com.java110.utils.util.BeanConvertUtil;
 import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
@@ -24,6 +27,8 @@
     private IAccountWithdrawalApplyInnerServiceSMO accountWithdrawalApplyInnerServiceSMOImpl;
     @Autowired
     private IAccountInnerServiceSMO accountInnerServiceSMOImpl;
+    @Autowired
+    private IAccountServiceDao accountServiceDaoImpl;
     /**
      *
      *
@@ -36,16 +41,28 @@
             if(accountWithdrawalApplyPo.getState().equals( AccountWithdrawalApplyPo.STATE_PASS ) || accountWithdrawalApplyPo.getState().equals( AccountWithdrawalApplyPo.STATE_ERROR_PAYER )){
                 AccountWithdrawalApplyDto accountWithdrawalApplyDto = new AccountWithdrawalApplyDto();
                 accountWithdrawalApplyDto.setApplyId( accountWithdrawalApplyPo.getApplyId() );
-                accountWithdrawalApplyDto.setState( "0" );
+                accountWithdrawalApplyDto.setAcctId( accountWithdrawalApplyPo.getAcctId() );
+                //鏌ヨ鍒拌处鎴蜂綋鐜扮殑璐圭敤
                 List<AccountWithdrawalApplyDto> accountWithdrawalApplyDtos = accountWithdrawalApplyInnerServiceSMOImpl.queryAccountWithdrawalApplys( accountWithdrawalApplyDto );
-                if(null != accountWithdrawalApplyDtos && accountWithdrawalApplyDtos.size() > 0){
-                    AccountWithdrawalApplyDto WithdrawalApplyDto = accountWithdrawalApplyDtos.get( 0 );
-                    AccountDetailPo accountDetailPo = new AccountDetailPo();
-                    accountDetailPo.setAcctId( WithdrawalApplyDto.getAcctId() );
-                    accountDetailPo.setAmount( WithdrawalApplyDto.getAmount() );
-                    accountDetailPo.setRemark( accountWithdrawalApplyPo.getContext() );
-                    accountInnerServiceSMOImpl.prestoreAccount( accountDetailPo );
-            }
+                if (accountWithdrawalApplyDtos == null || accountWithdrawalApplyDtos.size() < 1) {
+                    throw new IllegalArgumentException("璐︽埛鎻愮幇淇℃伅涓嶅瓨鍦�");
+                }
+                AccountWithdrawalApplyDto WithdrawalApplyDto = accountWithdrawalApplyDtos.get( 0 );
+                AccountDetailPo accountDetailPo = new AccountDetailPo();
+                accountDetailPo.setAcctId( WithdrawalApplyDto.getAcctId() );
+                accountDetailPo.setAmount( WithdrawalApplyDto.getAmount() );
+                accountDetailPo.setRemark( accountWithdrawalApplyPo.getContext() );
+                //鏌ヨ璐︽埛璇︾粏淇℃伅鑾峰緱objId
+                AccountDto accountDto = new AccountDto();
+                accountDto.setAcctId(WithdrawalApplyDto.getAcctId());
+                List<AccountDto> accounts = BeanConvertUtil.covertBeanList(accountServiceDaoImpl.getAccountInfo(BeanConvertUtil.beanCovertMap(accountDto)), AccountDto.class);
+                if (accounts == null || accounts.size() < 1) {
+                    throw new IllegalArgumentException("璐︽埛涓嶅瓨鍦�");
+                }
+                accountDetailPo.setObjId( accounts.get( 0 ).getObjId() );
+                accountDetailPo.setObjType( "7007");
+                //璋冪敤棰勫瓨鎺ュ彛
+                accountInnerServiceSMOImpl.prestoreAccount( accountDetailPo );
         }
 
         int flag = accountWithdrawalApplyInnerServiceSMOImpl.updateAccountWithdrawalApply(accountWithdrawalApplyPo);

--
Gitblit v1.8.0