店铺信息接口获取台桌code非必传
This commit is contained in:
@@ -41,9 +41,10 @@ public class ProductController {
|
||||
@RequestHeader("id") String userId,
|
||||
@RequestParam(required = false) String lat,
|
||||
@RequestParam(required = false) String lng,
|
||||
@RequestParam("code") String code
|
||||
@RequestParam(required = false) String code,
|
||||
@RequestParam Integer shopId
|
||||
) {
|
||||
return productService.queryShopIdByTableCode(userId, openId, code,lat,lng);
|
||||
return productService.queryShopIdByTableCode(userId, openId, code,lat,lng, shopId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -118,17 +118,20 @@ public class ProductService {
|
||||
return orderInfoList.isEmpty() ? null : orderInfoList.get(0);
|
||||
}
|
||||
|
||||
public Result queryShopIdByTableCode(String userId, String openId, String code, String lat, String lng) {
|
||||
if (StringUtils.isBlank(code)) return Result.fail("桌码信息为空");
|
||||
public Result queryShopIdByTableCode(String userId, String openId, String code, String lat, String lng, Integer shopId) {
|
||||
if (StringUtils.isBlank(lat) || lat.equals("undefined")) {
|
||||
lat = "34.343207";
|
||||
lng = "108.939645";
|
||||
}
|
||||
TbShopTable tbShopTable = tbShopTableMapper.selectQRcode(code);
|
||||
if (tbShopTable == null) {
|
||||
return Result.fail("台桌信息不存在");
|
||||
TbShopTable tbShopTable = null;
|
||||
if (StrUtil.isNotBlank(code)) {
|
||||
tbShopTable = tbShopTableMapper.selectQRcode(code);
|
||||
if (tbShopTable == null) {
|
||||
return Result.fail("台桌信息不存在");
|
||||
}
|
||||
}
|
||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(tbShopTable.getShopId());
|
||||
|
||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(shopId);
|
||||
String distance = LocationUtils.getDistanceString(
|
||||
Double.parseDouble(lng), Double.parseDouble(lat),
|
||||
Double.parseDouble(shopInfo.getLng()), Double.parseDouble(shopInfo.getLat()));
|
||||
@@ -137,12 +140,15 @@ public class ProductService {
|
||||
// 获取当前台桌最新订单id
|
||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(code, shopInfo.getId());
|
||||
TbOrderInfo order = getCurrentOrder(shopEatTypeInfoDTO, code, shopInfo.getId());
|
||||
tbShopTable.setOrderId(order == null ? null : order.getId());
|
||||
tbShopTable.setChoseCount(order != null && (order.getSeatCount() != null));
|
||||
if (tbShopTable != null) {
|
||||
tbShopTable.setOrderId(order == null ? null : order.getId());
|
||||
tbShopTable.setChoseCount(order != null && (order.getSeatCount() != null));
|
||||
}
|
||||
|
||||
concurrentMap.put("shopTableInfo", tbShopTable);
|
||||
concurrentMap.put("storeInfo", shopInfo);
|
||||
concurrentMap.put("distance", distance);
|
||||
TbShopUser shopUser = tbShopUserMapper.selectByUserIdAndShopId(userId, tbShopTable.getShopId().toString());
|
||||
TbShopUser shopUser = tbShopUserMapper.selectByUserIdAndShopId(userId, shopId.toString());
|
||||
try {
|
||||
if (ObjectUtil.isEmpty(shopUser)) {
|
||||
TbUserInfo tbUserInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
|
||||
@@ -163,7 +169,7 @@ public class ProductService {
|
||||
shopUser.setConsumeNumber(0);
|
||||
shopUser.setLevelConsume(BigDecimal.ZERO);
|
||||
shopUser.setStatus(Byte.parseByte("1"));
|
||||
shopUser.setShopId(tbShopTable.getShopId().toString());
|
||||
shopUser.setShopId(shopId.toString());
|
||||
shopUser.setUserId(userId);
|
||||
shopUser.setMiniOpenId(openId);
|
||||
shopUser.setCreatedAt(System.currentTimeMillis());
|
||||
|
||||
Reference in New Issue
Block a user