增加IM接口
This commit is contained in:
parent
501b9777b5
commit
6df2b92bc6
@ -716,6 +716,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
|
||||
@Override
|
||||
public MemberVO getMember(String id) {
|
||||
Member byId = this.getById(id);
|
||||
return new MemberVO(this.getById(id));
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,80 @@
|
||||
package cn.lili.controller.im;
|
||||
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.entity.dto.FootPrintQueryParams;
|
||||
import cn.lili.modules.member.service.FootprintService;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||
import cn.lili.modules.store.entity.dos.Store;
|
||||
import cn.lili.modules.store.service.StoreService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* @author Chopper
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "Im消息接口")
|
||||
@RequestMapping("/im/user")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class ImUserController {
|
||||
|
||||
private final MemberService memberService;
|
||||
|
||||
@Autowired
|
||||
private StoreService storeService;
|
||||
|
||||
@Autowired
|
||||
private FootprintService footprintService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取用户信息")
|
||||
public ResultMessage<Member> getImUser() {
|
||||
AuthUser authUser = UserContext.getCurrentUser();
|
||||
return ResultUtil.data(memberService.getById(authUser.getId()));
|
||||
}
|
||||
|
||||
@GetMapping("/store")
|
||||
@ApiOperation(value = "获取店铺信息")
|
||||
public ResultMessage<Store> getStoreUser() {
|
||||
AuthUser authUser = UserContext.getCurrentUser();
|
||||
return ResultUtil.data(storeService.getById(authUser.getStoreId()));
|
||||
}
|
||||
|
||||
@GetMapping("/{memberId}")
|
||||
@ApiImplicitParam(name = "memberId", value = "店铺Id", required = true, dataType = "String", paramType = "path")
|
||||
@ApiOperation(value = "获取用户信息")
|
||||
public ResultMessage<Member> getImUserDetail(@PathVariable String memberId) {
|
||||
return ResultUtil.data(memberService.getById(memberId));
|
||||
}
|
||||
|
||||
@GetMapping("/store/{storeId}")
|
||||
@ApiImplicitParam(name = "storeId", value = "店铺Id", required = true, dataType = "String", paramType = "path")
|
||||
@ApiOperation(value = "获取店铺信息")
|
||||
public ResultMessage<Store> getStoreUserDetail(@PathVariable String storeId) {
|
||||
return ResultUtil.data(storeService.getById(storeId));
|
||||
}
|
||||
|
||||
@GetMapping("/history")
|
||||
@ApiOperation(value = "获取会员的历史足迹")
|
||||
public ResultMessage<IPage<EsGoodsIndex>> getMemberHistory(FootPrintQueryParams params) {
|
||||
return ResultUtil.data(footprintService.footPrintPage(params));
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.aop.annotation.DemoSite;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -16,6 +18,8 @@ import cn.lili.modules.goods.entity.vos.GoodsVO;
|
||||
import cn.lili.modules.goods.entity.vos.StockWarningVO;
|
||||
import cn.lili.modules.goods.service.GoodsService;
|
||||
import cn.lili.modules.goods.service.GoodsSkuService;
|
||||
import cn.lili.modules.statistics.aop.PageViewPoint;
|
||||
import cn.lili.modules.statistics.aop.enums.PageViewEnum;
|
||||
import cn.lili.modules.store.entity.dos.StoreDetail;
|
||||
import cn.lili.modules.store.service.StoreDetailService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -24,11 +28,14 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -39,6 +46,7 @@ import java.util.stream.Collectors;
|
||||
* @since 2020-02-23 15:18:56
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@Api(tags = "店铺端,商品接口")
|
||||
@RequestMapping("/store/goods/goods")
|
||||
public class GoodsStoreController {
|
||||
@ -174,4 +182,27 @@ public class GoodsStoreController {
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id获取商品信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "path"),
|
||||
@ApiImplicitParam(name = "skuId", value = "skuId", required = true, paramType = "path")
|
||||
})
|
||||
@GetMapping(value = "/sku/{goodsId}/{skuId}")
|
||||
@PageViewPoint(type = PageViewEnum.SKU, id = "#id")
|
||||
public ResultMessage<Map<String, Object>> getSku(@NotNull(message = "商品ID不能为空") @PathVariable("goodsId") String goodsId,
|
||||
@NotNull(message = "SKU ID不能为空") @PathVariable("skuId") String skuId) {
|
||||
try {
|
||||
// 读取选中的列表
|
||||
Map<String, Object> map = goodsSkuService.getGoodsSkuDetail(goodsId, skuId);
|
||||
return ResultUtil.data(map);
|
||||
} catch (ServiceException se) {
|
||||
log.info(se.getMsg(), se);
|
||||
throw se;
|
||||
} catch (Exception e) {
|
||||
log.error(ResultCode.GOODS_ERROR.message(), e);
|
||||
return ResultUtil.error(ResultCode.GOODS_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dto.FootPrintQueryParams;
|
||||
import cn.lili.modules.member.service.FootprintService;
|
||||
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 商家端,浏览历史接口
|
||||
*
|
||||
* @author chc
|
||||
* @since 2022/6/2114:46
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "商家端,浏览历史接口")
|
||||
@RequestMapping("/store/member/footprint")
|
||||
public class FootprintStoreController {
|
||||
|
||||
/**
|
||||
* 会员足迹
|
||||
*/
|
||||
@Autowired
|
||||
private FootprintService footprintService;
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<EsGoodsIndex>> getByPage(FootPrintQueryParams params) {
|
||||
return ResultUtil.data(footprintService.footPrintPage(params));
|
||||
}
|
||||
}
|
@ -8,6 +8,8 @@ import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import cn.lili.modules.store.entity.dos.Store;
|
||||
import cn.lili.modules.store.service.StoreService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -29,6 +31,9 @@ public class StoreUserController {
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
|
||||
@Autowired
|
||||
private StoreService storeService;
|
||||
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@ApiOperation(value = "获取当前登录用户接口")
|
||||
@ -42,5 +47,16 @@ public class StoreUserController {
|
||||
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
|
||||
}
|
||||
|
||||
@GetMapping(value = "")
|
||||
@ApiOperation(value = "获取当前登录店铺接口")
|
||||
public ResultMessage<Store> getStoreInfo() {
|
||||
AuthUser tokenUser = UserContext.getCurrentUser();
|
||||
if (tokenUser != null) {
|
||||
Store store = storeService.getById(tokenUser.getStoreId());
|
||||
return ResultUtil.data(store);
|
||||
}
|
||||
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user