完成挂账管理相关需求
This commit is contained in:
parent
4fb6310c9c
commit
80ca3204d5
|
|
@ -94,4 +94,11 @@ public class TbShopTableBookingController {
|
|||
List<ShopTableBookingDTO> list = tbShopTableBookingService.findShopTableList(params);
|
||||
return ResponseEntity.ok().body(list);
|
||||
}
|
||||
|
||||
@GetMapping("summary")
|
||||
@ApiOperation("根据电话号码统计历史预订信息")
|
||||
public ResponseEntity summary(@RequestBody String[] phoneNos) {
|
||||
Map<String, Object> data = tbShopTableBookingService.summary(phoneNos);
|
||||
return ResponseEntity.ok().body(data);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,10 @@ package cn.ysk.cashier.mybatis.mapper;
|
|||
import cn.ysk.cashier.mybatis.entity.TbShopTableBooking;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 店铺台桌预订
|
||||
|
|
@ -12,5 +16,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface TbShopTableBookingMapper extends BaseMapper<TbShopTableBooking> {
|
||||
|
||||
List<Map<String,Object>> summaryByPhoneNos(@Param("phoneNoList") List<String> phoneNoList);
|
||||
|
||||
}
|
||||
|
|
@ -36,4 +36,6 @@ public interface TbShopTableBookingService extends IService<TbShopTableBooking>
|
|||
|
||||
List<ShopTableBookingDTO> findShopTableList(Map<String, Object> params);
|
||||
|
||||
Map<String, Object> summary(String[] phoneNos);
|
||||
|
||||
}
|
||||
|
|
@ -211,7 +211,8 @@ public class TbPadProductCategoryServiceImpl extends ServiceImpl<TbPadProductCat
|
|||
BeanUtil.copyProperties(dto, entity);
|
||||
entity.setCreateTime(new Date());
|
||||
super.save(entity);
|
||||
for (Long productId : productIdList) {
|
||||
Set<Long> productIdSet = productIdList.stream().collect(Collectors.toSet());
|
||||
for (Long productId : productIdSet) {
|
||||
TbPadProductCategoryDetail subEntity = new TbPadProductCategoryDetail();
|
||||
subEntity.setProductId(productId);
|
||||
subEntity.setPadProductCategoryId(entity.getId());
|
||||
|
|
@ -269,8 +270,9 @@ public class TbPadProductCategoryServiceImpl extends ServiceImpl<TbPadProductCat
|
|||
BeanUtil.copyProperties(dto, entity, "createTime");
|
||||
entity.setUpdateTime(new Date());
|
||||
super.updateById(entity);
|
||||
for (Long productId : productIdList) {
|
||||
tbPadProductCategoryDetailMapper.delete(Wrappers.<TbPadProductCategoryDetail>lambdaQuery().eq(TbPadProductCategoryDetail::getPadProductCategoryId, entity.getId()));
|
||||
tbPadProductCategoryDetailMapper.delete(Wrappers.<TbPadProductCategoryDetail>lambdaQuery().eq(TbPadProductCategoryDetail::getPadProductCategoryId, entity.getId()));
|
||||
Set<Long> productIdSet = productIdList.stream().collect(Collectors.toSet());
|
||||
for (Long productId : productIdSet) {
|
||||
TbPadProductCategoryDetail subEntity = new TbPadProductCategoryDetail();
|
||||
subEntity.setProductId(productId);
|
||||
subEntity.setPadProductCategoryId(entity.getId());
|
||||
|
|
|
|||
|
|
@ -262,4 +262,19 @@ public class TbShopTableBookingServiceImpl extends ServiceImpl<TbShopTableBookin
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> summary(String[] phoneNos) {
|
||||
List<Map<String, Object>> list = baseMapper.summaryByPhoneNos(Arrays.asList(phoneNos));
|
||||
Map<String, Object> result = new HashMap<>(phoneNos.length);
|
||||
Map<String, Object> fillData = new HashMap<>(2);
|
||||
fillData.put("consumeOrders", 0);
|
||||
fillData.put("cancelOrders", 0);
|
||||
for (String phoneNo : phoneNos) {
|
||||
fillData.put("phoneNumber", phoneNo);
|
||||
Map<String, Object> data = list.stream().filter(item -> phoneNo.equals(item.get("phoneNumber"))).findFirst().orElse(fillData);
|
||||
result.put("Tel_"+phoneNo, data);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue