Ver código fonte

fengji 机构充值

yanite 3 anos atrás
pai
commit
9ac9ce9a30

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java

@@ -599,9 +599,10 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
 
     @Override
     public Map<String, Object> recharge(Integer tenantId, BigDecimal amount) throws Exception {
+        log.error("机构 " + tenantId.toString() + "充值");
         TenantInfo tenantInfo = Optional.ofNullable(tenantId)
                                         .map(baseMapper::selectById)
-                                        .orElseThrow(() -> new BizException("未查询到机构信息!"));
+                                        .orElseThrow(() -> new BizException("充值时,未查询到机构信息!"));
         String key = "Tenant_Pay:" + tenantId;
         RBucket<Object> bucket = redissonClient.getBucket(key);
         //原子操作 抢锁成功为true

+ 3 - 5
mec-web/src/main/java/com/ym/mec/web/controller/TenantInfoController.java

@@ -8,6 +8,7 @@ import com.ym.mec.biz.service.TenantInfoService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.yqpay.Msg;
 import com.ym.mec.util.validator.ValidationKit;
 import io.swagger.annotations.*;
@@ -112,11 +113,8 @@ public class TenantInfoController extends BaseController {
     public HttpResponseResult<Map<String, Object>> recharge(
             @ApiParam(value = "充值金额", required = true) @PathVariable("amount") Double amount
     ) throws Exception {
-        SysUser user = sysUserFeignService.queryUserInfo();
-        if (user == null) {
-            return failed("用户信息获取失败");
-        }
-        return succeed(tenantInfoService.recharge(user.getTenantId(), new BigDecimal(amount)));
+        Integer tenantId = TenantContextHolder.getTenantId();
+        return succeed(tenantInfoService.recharge(tenantId, new BigDecimal(amount)));
     }
 
     @ApiOperation(value = "轮询查询订单状态")