|
@@ -189,10 +189,30 @@ public class PosOrderShOprateController extends BaseController {
|
|
|
@RequestParam(defaultValue = "1") int page,
|
|
@RequestParam(defaultValue = "1") int page,
|
|
|
@RequestParam(defaultValue = "10") int size,
|
|
@RequestParam(defaultValue = "10") int size,
|
|
|
@RequestParam(required = false) String tab,
|
|
@RequestParam(required = false) String tab,
|
|
|
- @RequestParam(required = false) Long mdId,
|
|
|
|
|
@RequestParam(required = false) String type) {
|
|
@RequestParam(required = false) String type) {
|
|
|
|
|
+ JwtUtil jwtUtil = new JwtUtil();
|
|
|
|
|
+ String userId = jwtUtil.getusid(token);
|
|
|
|
|
+ // 查询当前用户信息
|
|
|
|
|
+ InfoUser currentUser = infoUserService.getOne(new LambdaQueryWrapper<InfoUser>().eq(InfoUser::getUserId, Long.valueOf(userId)));
|
|
|
|
|
+ if (currentUser == null) {
|
|
|
|
|
+ throw new ServiceException("用户信息不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
LambdaQueryWrapper<PosOrder> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<PosOrder> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(mdId != null, PosOrder::getMdId, mdId);
|
|
|
|
|
|
|
+ String userType = currentUser.getUserType();
|
|
|
|
|
+ if ("3".equals(userType)) {
|
|
|
|
|
+ // 夜市商家:shId等于用户id
|
|
|
|
|
+ wrapper.eq(PosOrder::getShId, Long.valueOf(userId));
|
|
|
|
|
+ } else if ("1".equals(userType)) {
|
|
|
|
|
+ // 普通商家:shId等于用户id
|
|
|
|
|
+ wrapper.eq(PosOrder::getShId, Long.valueOf(userId));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 摊位商家:mdId等于用户表中的storeId
|
|
|
|
|
+ if (currentUser.getStoreId() == null) {
|
|
|
|
|
+ throw new ServiceException("摊位关联门店信息不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ wrapper.eq(PosOrder::getMdId, currentUser.getStoreId());
|
|
|
|
|
+ }
|
|
|
if (type != null && !type.isEmpty()) {
|
|
if (type != null && !type.isEmpty()) {
|
|
|
wrapper.eq(PosOrder::getType, Long.valueOf(type));
|
|
wrapper.eq(PosOrder::getType, Long.valueOf(type));
|
|
|
}
|
|
}
|