挂账需求和电话机预约需求

This commit is contained in:
谭凯凯
2024-11-27 10:40:19 +08:00
committed by Tankaikai
parent e82ba91551
commit ed7ef8915b
5 changed files with 20 additions and 13 deletions

View File

@@ -1,5 +1,8 @@
package cn.ysk.cashier.controller.booking; package cn.ysk.cashier.controller.booking;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.map.MapProxy;
import cn.hutool.core.map.MapUtil;
import cn.ysk.cashier.dto.booking.ShopTableBookingDTO; import cn.ysk.cashier.dto.booking.ShopTableBookingDTO;
import cn.ysk.cashier.mybatis.entity.TbShopTableBooking; import cn.ysk.cashier.mybatis.entity.TbShopTableBooking;
import cn.ysk.cashier.mybatis.service.TbShopTableBookingService; import cn.ysk.cashier.mybatis.service.TbShopTableBookingService;
@@ -97,8 +100,11 @@ public class TbShopTableBookingController {
@PostMapping("summary") @PostMapping("summary")
@ApiOperation("根据电话号码统计历史预订信息") @ApiOperation("根据电话号码统计历史预订信息")
public ResponseEntity summary(@RequestBody String[] phoneNos) { public ResponseEntity summary(@RequestBody Map<String, Object> params) {
Map<String, Object> data = tbShopTableBookingService.summary(phoneNos); MapProxy proxy = MapUtil.createProxy(params);
Integer shopId = proxy.getInt("shopId");
String[] phoneNos = Convert.toStrArray(proxy.get("phoneNos"));
Map<String, Object> data = tbShopTableBookingService.summary(shopId, phoneNos);
return ResponseEntity.ok().body(data); return ResponseEntity.ok().body(data);
} }
} }

View File

@@ -9,14 +9,14 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* 店铺台桌预订 * 店铺台桌预订
* *
* @author Tankaikai tankaikai@aliyun.com * @author Tankaikai tankaikai@aliyun.com
* @since 2.0 2024-11-21 * @since 2.0 2024-11-21
*/ */
@Mapper @Mapper
public interface TbShopTableBookingMapper extends BaseMapper<TbShopTableBooking> { public interface TbShopTableBookingMapper extends BaseMapper<TbShopTableBooking> {
List<Map<String,Object>> summaryByPhoneNos(@Param("phoneNoList") List<String> phoneNoList); List<Map<String, Object>> summaryByPhoneNos(@Param("shopId") Integer shopId, @Param("phoneNoList") List<String> phoneNoList);
} }

View File

@@ -36,6 +36,6 @@ public interface TbShopTableBookingService extends IService<TbShopTableBooking>
List<ShopTableBookingDTO> findShopTableList(Map<String, Object> params); List<ShopTableBookingDTO> findShopTableList(Map<String, Object> params);
Map<String, Object> summary(String[] phoneNos); Map<String, Object> summary(Integer shopId,String[] phoneNos);
} }

View File

@@ -265,8 +265,8 @@ public class TbShopTableBookingServiceImpl extends ServiceImpl<TbShopTableBookin
} }
@Override @Override
public Map<String, Object> summary(String[] phoneNos) { public Map<String, Object> summary(Integer shopId, String[] phoneNos) {
List<Map<String, Object>> list = baseMapper.summaryByPhoneNos(Arrays.asList(phoneNos)); List<Map<String, Object>> list = baseMapper.summaryByPhoneNos(shopId, Arrays.asList(phoneNos));
Map<String, Object> result = new HashMap<>(phoneNos.length); Map<String, Object> result = new HashMap<>(phoneNos.length);
Map<String, Object> fillData = new HashMap<>(2); Map<String, Object> fillData = new HashMap<>(2);
fillData.put("consumeOrders", 0); fillData.put("consumeOrders", 0);

View File

@@ -9,7 +9,8 @@
count( case when x.`status` = 10 then 1 end) AS consumeOrders, count( case when x.`status` = 10 then 1 end) AS consumeOrders,
count( case when x.`status` = -1 or x.`status` = 999 then 1 end) AS cancelOrders count( case when x.`status` = -1 or x.`status` = 999 then 1 end) AS cancelOrders
from tb_shop_table_booking x from tb_shop_table_booking x
where x.phone_number in where x.shopId = #{shopId}
and x.phone_number in
<foreach item="phoneNumber" collection="phoneNoList" open="(" separator="," close=")"> <foreach item="phoneNumber" collection="phoneNoList" open="(" separator="," close=")">
#{phoneNumber, jdbcType=VARCHAR} #{phoneNumber, jdbcType=VARCHAR}
</foreach> </foreach>