Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

TRX 1 год назад
Родитель
Сommit
989f054ff0

+ 4 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/base/SuperService.java

@@ -80,6 +80,10 @@ public abstract class SuperService {
         return null;
     }
 
+    public String getCurrentAppId(){
+        return authClientSecurityAuthenticationHelper.getParameter(new String[]{"appId","appid"});
+    }
+
     /**
      * 得到当时设置到head的 项目oid
      *

+ 30 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/pay/BalancePayService.java

@@ -26,12 +26,15 @@ import com.zhongshu.card.client.type.payAccount.PayAccountLevel;
 import com.zhongshu.card.client.type.payAccount.RechargeOrderStatus;
 import com.zhongshu.card.client.utils.DateUtils;
 import com.zhongshu.card.server.core.dao.pay.BalanceRechargeOrderDao;
+import com.zhongshu.card.server.core.domain.org.UserAccount;
 import com.zhongshu.card.server.core.domain.pay.BalanceRechargeOrder;
 import com.zhongshu.card.server.core.domain.pay.PayAccount;
+import com.zhongshu.card.server.core.service.base.SuperService;
 import com.zhongshu.card.server.core.service.paySetting.OrgPayAccountService;
 import com.zhongshu.card.server.core.service.paySetting.ProjectPaySettingServiceImpl;
 import com.zhongshu.card.server.core.util.BeanUtils;
 import com.zhongshu.card.server.core.util.CommonUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -43,7 +46,7 @@ import java.util.Map;
 import java.util.stream.Collectors;
 
 @Service
-public class BalancePayService {
+public class BalancePayService extends SuperService {
 
     @Autowired
     PayAccountService payAccountService;
@@ -72,6 +75,14 @@ public class BalancePayService {
      */
     @Transactional
     public Object recharge(RechargeParam param) {
+        String projectOid = getCurrentOid();
+        String userId = getCurrentUserId();
+        String appId = getCurrentAppId();
+
+        param.setProjectOid(projectOid);
+        param.setUserId(userId);
+        param.setAppid(appId);
+
         //根据项目id和支付渠道获取支付账户名
         String accountName = orgPayAccountService.queryOgPayAccount(param.getProjectOid(), param.getPaymentType());
         ;
@@ -182,6 +193,16 @@ public class BalancePayService {
     }
 
     public ResultContent queryRechargeOrder(QueryRechargeParam param) {
+        String projectOid = getCurrentProjectOid();
+        String userId = getCurrentUserId();
+
+        if (StringUtils.isEmpty(param.getProjectOid())){
+            param.setProjectOid(projectOid);
+        }
+        if (StringUtils.isEmpty(param.getUserId())){
+            param.setUserId(userId);
+        }
+
         Long monthStartTime = DateUtils.getMonthStartTime(param.getYear(), param.getMonth());
         Long monthEndTime = DateUtils.getMonthEndTime(param.getYear(), param.getMonth());
         List<BalanceRechargeOrder> balanceRechargeOrders = rechargeOrderDao.listByMonth(param.getProjectOid(), param.getUserId(), monthStartTime, monthEndTime);
@@ -189,6 +210,14 @@ public class BalancePayService {
     }
 
     public ResultContent<Long> queryUserBalance(String projectOid, String userId) {
+
+        if (StringUtils.isEmpty(projectOid)){
+            projectOid = getCurrentProjectOid();
+        }
+        if (StringUtils.isEmpty(userId)){
+            userId = getCurrentUserId();
+        }
+
         PayAccount userBalance = payAccountService.getUserChildren(projectOid, userId, PaymentChannelType.BalancePayment);
         ResultContent<GeneralLedgerQueryModel> ret = generalLedgerService.get(userBalance.getLedgerId());
         if (ret.getState().equals(ResultState.Success)) {