每日统计
This commit is contained in:
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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())
|
||||
|
@ -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, "菜品名称已存在");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user