每日统计

This commit is contained in:
seesaw
2024-10-16 15:51:59 +08:00
parent 185520f436
commit a8f4660f16
9 changed files with 316 additions and 11 deletions

View File

@ -19,12 +19,10 @@ public class DishImagePageReqVO extends PageParam {
private String name;
@Schema(description = "开始日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] startDate;
private String startDate;
@Schema(description = "结束日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] endDate;
private String endDate;
@Schema(description = "地址", example = "https://www.iocoder.cn")
private String imageUrl;

View File

@ -22,4 +22,13 @@ public class AppSaveVO {
@Schema(description = "总价格", example = "1")
private BigDecimal dishesSumPrice;
@Schema(description = "菜品图片", example = "1")
private String dishesImageUrl;
@Schema(description = "周几", example = "星期一")
private String weekTime;
@Schema(description = "时段", example = "")
private String timeSlot;
}

View File

@ -23,8 +23,8 @@ public interface DishImageMapper extends BaseMapperX<DishImageDO> {
return selectPage(reqVO, new LambdaQueryWrapperX<DishImageDO>()
.eqIfPresent(DishImageDO::getCarteenId,reqVO.getCarteenId())
.likeIfPresent(DishImageDO::getName, reqVO.getName())
.betweenIfPresent(DishImageDO::getStartDate, reqVO.getStartDate())
.betweenIfPresent(DishImageDO::getEndDate, reqVO.getEndDate())
.eqIfPresent(DishImageDO::getStartDate, reqVO.getStartDate())
.eqIfPresent(DishImageDO::getEndDate, reqVO.getEndDate())
.eqIfPresent(DishImageDO::getImageUrl, reqVO.getImageUrl())
.eqIfPresent(DishImageDO::getRemark, reqVO.getRemark())
.betweenIfPresent(DishImageDO::getCreateTime, reqVO.getCreateTime())

View File

@ -69,6 +69,8 @@ public class DishesServiceImpl implements DishesService {
DishesDO dishes = BeanUtils.toBean(createReqVO, DishesDO.class);
dishes.setDeleted(Boolean.FALSE);
checkDishes(dishes.getDishesName(),dishes.getCarteenId());
LocalDateTime today = LocalDateTime.now();
int hour = today.getHour();
String time = dishesMapper.getTime(hour);
@ -115,6 +117,8 @@ public class DishesServiceImpl implements DishesService {
dishes.setCarteenId(carteenId);
dishes.setDishesNumber(new BigDecimal("50"));
checkDishes(dishes.getDishesName(),dishes.getCarteenId());
LocalDateTime today = LocalDateTime.now();
int hour = today.getHour();
String time = dishesMapper.getTime(hour);
@ -144,6 +148,8 @@ public class DishesServiceImpl implements DishesService {
// 更新
DishesDO updateObj = BeanUtils.toBean(updateReqVO, DishesDO.class);
checkDishes(updateObj.getDishesName(),updateObj.getCarteenId());
//计算每g多少钱
BigDecimal dishesSumPrice = updateObj.getDishesSumPrice();
BigDecimal dishesNumber = updateObj.getDishesNumber();
@ -169,8 +175,11 @@ public class DishesServiceImpl implements DishesService {
@Override
public void updateDishesApp(AppUpdateVO vo) {
validateDishesExists(vo.getId());
DishesDO updateObj = BeanUtils.toBean(vo, DishesDO.class);
checkDishes(updateObj.getDishesName(),updateObj.getCarteenId());
//计算每g多少钱
BigDecimal dishesSumPrice = updateObj.getDishesSumPrice();
BigDecimal dishesNumber = new BigDecimal("50");
@ -292,12 +301,21 @@ public class DishesServiceImpl implements DishesService {
week.add(dayOfWeekInChinese);
week.add("整周");
// Long carteenId = deviceInfoService.getCarteen(getHearder());
List<DishesDO> dishesDOS = dishesMapper.selectList(Wrappers.<DishesDO>lambdaQuery()
// .eq(DishesDO::getCarteenId, carteenId)
.in(DishesDO::getWeekTime, week)
.orderByDesc(DishesDO::getCreateTime));
return dishesDOS;
}
void checkDishes(String dishName,Long carteenId){
List<DishesDO> dishesDOS = dishesMapper.selectList(Wrappers.<DishesDO>lambdaQuery()
.eq(DishesDO::getCarteenId, carteenId)
.eq(DishesDO::getDishesName, dishName));
if(!dishesDOS.isEmpty()){
throw exception(2000_10_002, "菜品名称已存在");
}
}
}