|
@@ -2,12 +2,15 @@ package org.springblade.modules.api.controller;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.DesensitizedUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.common.base.BaseEntity;
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.common.enums.AuditStatusEnum;
|
|
|
import org.springblade.common.enums.FacilityStatusEnum;
|
|
@@ -23,11 +26,13 @@ import org.springblade.modules.api.request.TimeRangeReq;
|
|
|
import org.springblade.modules.api.response.MerchantPieRes;
|
|
|
import org.springblade.modules.api.response.TurnoverRes;
|
|
|
import org.springblade.modules.api.utils.TimeRangeReqUtils;
|
|
|
+import org.springblade.modules.api.vo.ChildDealtVO;
|
|
|
import org.springblade.modules.api.vo.MerchantIncomeVO;
|
|
|
import org.springblade.modules.api.vo.PageMemberVO;
|
|
|
import org.springblade.modules.auth.enums.UserEnum;
|
|
|
import org.springblade.modules.auth.utils.TokenUtil;
|
|
|
import org.springblade.modules.business.entity.Facility;
|
|
|
+import org.springblade.modules.business.entity.Shop;
|
|
|
import org.springblade.modules.business.service.IFacilityService;
|
|
|
import org.springblade.modules.business.service.IShopService;
|
|
|
import org.springblade.modules.finance.entity.OrderGoods;
|
|
@@ -54,7 +59,7 @@ import java.util.stream.Collectors;
|
|
|
@AllArgsConstructor
|
|
|
@RequestMapping(CommonConstant.API_URL)
|
|
|
@Api(value = "商家端", tags = "商家端用户接口")
|
|
|
-public class ApiMerchantUserController {
|
|
|
+public class ApiMerchantUserController extends BaseController {
|
|
|
|
|
|
private final IUserMerchantService iUserMerchantService;
|
|
|
private final IUserService iUserService;
|
|
@@ -88,6 +93,37 @@ public class ApiMerchantUserController {
|
|
|
return R.status(iUserService.updateById(user));
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/childDealt")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "子账号详情", notes = "传入id")
|
|
|
+ public R<ChildDealtVO> childDealt(@ApiParam(value = "主键集合", required = true) @RequestParam Long childAccountId) {
|
|
|
+ UserMerchant userMerchant = iUserMerchantService.getById(childAccountId);
|
|
|
+ Assert.notNull(userMerchant, "子账号数据异常");
|
|
|
+ //查询用户信息
|
|
|
+ User user = iUserService.getById(userMerchant.getUserId());
|
|
|
+ Assert.notNull(user, "未查询到用户信息");
|
|
|
+
|
|
|
+ ChildDealtVO childDealtVO = new ChildDealtVO();
|
|
|
+ childDealtVO.setId(userMerchant.getId());
|
|
|
+ childDealtVO.setPhone(user.getPhone());
|
|
|
+ childDealtVO.setNickname(user.getName());
|
|
|
+ childDealtVO.setRealName(user.getRealName());
|
|
|
+ childDealtVO.setCover(user.getAvatar());
|
|
|
+
|
|
|
+ //查询授权门店
|
|
|
+ LambdaQueryWrapper<Shop> wrapper = Wrappers.lambdaQuery(Shop.class);
|
|
|
+ wrapper.eq(Shop::getMerchantId, AuthUtil.getUserId());
|
|
|
+ if (!isMerchant()) {
|
|
|
+ wrapper.in(BaseEntity::getId, iUserMerchantService.getAuthShopId(AuthUtil.getUserId()));
|
|
|
+ } else {
|
|
|
+ wrapper.eq(Shop::getMerchantId, AuthUtil.getUserId());
|
|
|
+ }
|
|
|
+ List<Shop> list = shopService.list(wrapper);
|
|
|
+
|
|
|
+ childDealtVO.setAuthShops(list);
|
|
|
+ return R.data(childDealtVO);
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping("/addChildAccount")
|
|
|
@ApiOperationSupport(order = 3)
|
|
|
@ApiOperation(value = "添加子账号", notes = "传入userMerchant")
|
|
@@ -127,7 +163,7 @@ public class ApiMerchantUserController {
|
|
|
@ApiOperation(value = "修改子账号", notes = "alertChildAccountRequest")
|
|
|
public R<Void> deleteChildAccount(@Valid @RequestBody AlertChildAccountRequest request) {
|
|
|
UserMerchant userMerchant = iUserMerchantService.getById(request.getId());
|
|
|
- if (Objects.isNull(userMerchant)){
|
|
|
+ if (Objects.isNull(userMerchant)) {
|
|
|
return R.fail("子账号不存在");
|
|
|
}
|
|
|
//获取子账号用户信息
|