|
|
@@ -1,5 +1,7 @@
|
|
|
package org.springblade.gateway.shop_gateway.controller;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
@@ -13,7 +15,9 @@ import org.springblade.common.enums.AppConstant;
|
|
|
import org.springblade.common.enums.WithdrawType;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
+import org.springblade.core.tenant.annotation.TenantIgnore;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.support.Kv;
|
|
|
import org.springblade.gateway.shop_gateway.entity.dto.ShopAuditDto;
|
|
|
import org.springblade.gateway.shop_gateway.entity.vo.BalanceAccountInfoVO;
|
|
|
import org.springblade.gateway.shop_gateway.entity.vo.IndexVO;
|
|
|
@@ -23,24 +27,25 @@ import org.springblade.gateway.shop_gateway.service.IAppShopService;
|
|
|
import org.springblade.ldt.bills.entity.Bills;
|
|
|
import org.springblade.ldt.bills.entity.WithdrawRec;
|
|
|
import org.springblade.ldt.bills.service.IBillsService;
|
|
|
-import org.springblade.ldt.notice.entity.NoticeManagement;
|
|
|
import org.springblade.ldt.notice.entity.NoticeManagementContent;
|
|
|
import org.springblade.ldt.notice.service.INoticeManagementContentService;
|
|
|
-import org.springblade.ldt.notice.service.INoticeManagementService;
|
|
|
-import org.springblade.ldt.notice.vo.NoticeManagementVO;
|
|
|
import org.springblade.ldt.notice.wrapper.NoticeManagementContentWrapper;
|
|
|
-import org.springblade.ldt.notice.wrapper.NoticeManagementWrapper;
|
|
|
import org.springblade.ldt.shop.entity.Shop;
|
|
|
import org.springblade.ldt.shop.service.IShopService;
|
|
|
import org.springblade.ldt.shop.vo.ShopVO;
|
|
|
import org.springblade.ldt.shop.wrapper.ShopWrapper;
|
|
|
import org.springblade.ldt.user.entity.Member;
|
|
|
import org.springblade.ldt.user.service.IMemberService;
|
|
|
+import org.springblade.modules.auth.utils.TokenUtil;
|
|
|
+import org.springblade.modules.system.entity.User;
|
|
|
+import org.springblade.modules.system.entity.UserInfo;
|
|
|
+import org.springblade.modules.system.service.impl.UserServiceImpl;
|
|
|
import org.springblade.yeePay.common.YeepayApiConstant;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -56,6 +61,7 @@ public class AppShopController {
|
|
|
private IMemberService memberService;
|
|
|
private IShopService shopService;
|
|
|
private IBillsService billsService;
|
|
|
+ private UserServiceImpl userService;
|
|
|
private INoticeManagementContentService noticeManagementContentService;
|
|
|
|
|
|
/**
|
|
|
@@ -75,6 +81,40 @@ public class AppShopController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 商户端获取我的商户列表
|
|
|
+ */
|
|
|
+ @GetMapping("/myShop")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "商户端获取我的商户列表", notes = "shop")
|
|
|
+ @TenantIgnore
|
|
|
+ public R myShop(Shop shop) {
|
|
|
+ List<Shop> list = shopService.list(Condition.getQueryWrapper(shop));
|
|
|
+ if (CollUtil.isEmpty(list)) {
|
|
|
+ return R.data(list);
|
|
|
+ }
|
|
|
+ List<ShopVO> resList = new ArrayList();
|
|
|
+ for (Shop item : list) {
|
|
|
+ ShopVO shopVO = new ShopVO();
|
|
|
+ BeanUtil.copyProperties(item,shopVO);
|
|
|
+ Kv tokenInfo = this.getRefreshToken(item);
|
|
|
+ shopVO.setTokenInfo(tokenInfo);
|
|
|
+ resList.add(shopVO);
|
|
|
+ }
|
|
|
+ return R.data(resList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *根据tenantId获取对应refresh_token信息
|
|
|
+ */
|
|
|
+ private Kv getRefreshToken(Shop shop){
|
|
|
+ User user = userService.getBaseMapper().selectOne(new QueryWrapper<User>().lambda().eq(User::getTenantId, shop.getTenantId()).orderByAsc(User::getCreateTime).last("limit 1"));
|
|
|
+ UserInfo userInfo = userService.buildUserInfo(user);
|
|
|
+ Kv authInfo = TokenUtil.createAuthInfo(userInfo);
|
|
|
+ authInfo.put("shop", shop);
|
|
|
+ return authInfo;
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping("submitAudit")
|
|
|
@ApiOperation(value = "商户提交审核")
|
|
|
public R submitAudit(@RequestBody ShopAuditDto shopAuditDto) {
|