Ver código fonte

优化更新状态

shiyj1101 5 anos atrás
pai
commit
3f20dd6731

+ 1 - 1
service-acct/src/main/java/com/java110/acct/api/AccountWithdrawalApplyApi.java

@@ -42,7 +42,7 @@ public class AccountWithdrawalApplyApi {
         Assert.hasKeyAndValue(reqJson, "amount", "请求报文中未包含amount");
 
         AccountWithdrawalApplyPo accountWithdrawalApplyPo = BeanConvertUtil.covertBean(reqJson, AccountWithdrawalApplyPo.class);
-        return saveAccountWithdrawalApplyBMOImpl.save(accountWithdrawalApplyPo,userId);
+        return saveAccountWithdrawalApplyBMOImpl.save(accountWithdrawalApplyPo,userId,reqJson);
     }
 
     /**

+ 2 - 1
service-acct/src/main/java/com/java110/acct/bmo/accountWithdrawalApply/ISaveAccountWithdrawalApplyBMO.java

@@ -1,6 +1,7 @@
 package com.java110.acct.bmo.accountWithdrawalApply;
 
 import com.alibaba.fastjson.JSONObject;
+import com.google.gson.JsonObject;
 import com.java110.po.accountWithdrawalApply.AccountWithdrawalApplyPo;
 import org.springframework.http.ResponseEntity;
 public interface ISaveAccountWithdrawalApplyBMO {
@@ -12,7 +13,7 @@ public interface ISaveAccountWithdrawalApplyBMO {
      * @param accountWithdrawalApplyPo
      * @return
      */
-    ResponseEntity<String> save(AccountWithdrawalApplyPo accountWithdrawalApplyPo, String userId);
+    ResponseEntity<String> save(AccountWithdrawalApplyPo accountWithdrawalApplyPo, String userId, JSONObject reqJson);
 
 
 }

+ 2 - 1
service-acct/src/main/java/com/java110/acct/bmo/accountWithdrawalApply/impl/SaveAccountWithdrawalApplyBMOImpl.java

@@ -35,7 +35,7 @@ public class SaveAccountWithdrawalApplyBMOImpl implements ISaveAccountWithdrawal
      * @return 订单服务能够接受的报文
      */
     @Java110Transactional
-    public ResponseEntity<String> save(AccountWithdrawalApplyPo accountWithdrawalApplyPo, String userId) {
+    public ResponseEntity<String> save(AccountWithdrawalApplyPo accountWithdrawalApplyPo, String userId,JSONObject reqJson) {
 
 
         UserDto userDto = new UserDto();
@@ -53,6 +53,7 @@ public class SaveAccountWithdrawalApplyBMOImpl implements ISaveAccountWithdrawal
             accountDetailPo.setAcctId( accountWithdrawalApplyPo.getAcctId() );
             accountDetailPo.setAmount( accountWithdrawalApplyPo.getAmount() );
             accountDetailPo.setRemark( accountWithdrawalApplyPo.getContext() );
+            accountDetailPo.setObjId( reqJson.getString( "objId" ) );
             //调用扣款接口进行扣款
             int acctflag = accountInnerServiceSMOImpl.withholdAccount( accountDetailPo );
             if (acctflag < 1) {

+ 25 - 9
service-acct/src/main/java/com/java110/acct/bmo/accountWithdrawalApply/impl/UpdateAccountWithdrawalApplyBMOImpl.java

@@ -2,13 +2,16 @@ package com.java110.acct.bmo.accountWithdrawalApply.impl;
 
 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 @@ public class UpdateAccountWithdrawalApplyBMOImpl implements IUpdateAccountWithdr
     private IAccountWithdrawalApplyInnerServiceSMO accountWithdrawalApplyInnerServiceSMOImpl;
     @Autowired
     private IAccountInnerServiceSMO accountInnerServiceSMOImpl;
+    @Autowired
+    private IAccountServiceDao accountServiceDaoImpl;
     /**
      *
      *
@@ -36,16 +41,27 @@ public class UpdateAccountWithdrawalApplyBMOImpl implements IUpdateAccountWithdr
             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() );
+                //调用预存接口
+                accountInnerServiceSMOImpl.prestoreAccount( accountDetailPo );
         }
 
         int flag = accountWithdrawalApplyInnerServiceSMOImpl.updateAccountWithdrawalApply(accountWithdrawalApplyPo);