优化+今日菜单
This commit is contained in:
@ -1,13 +1,13 @@
|
|||||||
package cn.iocoder.yudao.module.system.controller.admin.dishes.vo;
|
package cn.iocoder.yudao.module.system.controller.admin.dishes.vo;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import java.math.BigDecimal;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
@ -52,4 +52,6 @@ public class DishesPageReqVO extends PageParam {
|
|||||||
private Long carteenId;
|
private Long carteenId;
|
||||||
@Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
@Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||||
private Long typeId;
|
private Long typeId;
|
||||||
|
|
||||||
|
private String weekTime;
|
||||||
}
|
}
|
@ -78,4 +78,6 @@ public class DishesRespVO {
|
|||||||
@Schema(description = "菜品类型")
|
@Schema(description = "菜品类型")
|
||||||
@ExcelProperty("菜品类型")
|
@ExcelProperty("菜品类型")
|
||||||
private String dishecTypeName;
|
private String dishecTypeName;
|
||||||
|
|
||||||
|
private String weekTime;
|
||||||
}
|
}
|
@ -63,4 +63,6 @@ public class DishesSaveReqVO {
|
|||||||
private List<DishesNutritionSaveReqVO> dishesNutritionList;
|
private List<DishesNutritionSaveReqVO> dishesNutritionList;
|
||||||
@Schema(description = "菜品原材料", example = "1")
|
@Schema(description = "菜品原材料", example = "1")
|
||||||
private List<DishesRawSaveReqVO> dishesRawList;
|
private List<DishesRawSaveReqVO> dishesRawList;
|
||||||
|
|
||||||
|
private String weekTime;
|
||||||
}
|
}
|
@ -25,6 +25,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
|
||||||
@ -93,4 +95,10 @@ public class DishesAppController {
|
|||||||
// BeanUtils.toBean(list, DishesRespVO.class));
|
// BeanUtils.toBean(list, DishesRespVO.class));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@GetMapping("/getToday")
|
||||||
|
@Operation(summary = "获取今日菜品")
|
||||||
|
public CommonResult<List<DishesRespVO>> getTodayDishes() {
|
||||||
|
List<DishesDO> todayDishes = dishesService.getTodayDishes();
|
||||||
|
return success(BeanUtils.toBean(todayDishes, DishesRespVO.class));
|
||||||
|
}
|
||||||
}
|
}
|
@ -76,4 +76,6 @@ public class DishesDO extends BaseDO {
|
|||||||
* 菜品总重量
|
* 菜品总重量
|
||||||
*/
|
*/
|
||||||
private BigDecimal dishesNumber;
|
private BigDecimal dishesNumber;
|
||||||
|
|
||||||
|
private String weekTime;
|
||||||
}
|
}
|
@ -65,5 +65,6 @@ public interface DishesService {
|
|||||||
|
|
||||||
Map<Long,String> getDishName(List<Long> ids);
|
Map<Long,String> getDishName(List<Long> ids);
|
||||||
|
|
||||||
|
List<DishesDO> getTodayDishes();
|
||||||
|
|
||||||
}
|
}
|
@ -30,7 +30,10 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.TextStyle;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -216,6 +219,17 @@ public class DishesServiceImpl implements DishesService {
|
|||||||
return collect;
|
return collect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DishesDO> getTodayDishes() {
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
String dayOfWeekInChinese = today.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.CHINESE);
|
||||||
|
Long carteenId = deviceInfoService.getCarteen(getHearder());
|
||||||
|
List<DishesDO> dishesDOS = dishesMapper.selectList(Wrappers.<DishesDO>lambdaQuery()
|
||||||
|
.eq(DishesDO::getCarteenId, carteenId)
|
||||||
|
.eq(DishesDO::getWeekTime,dayOfWeekInChinese));
|
||||||
|
return dishesDOS;
|
||||||
|
}
|
||||||
|
|
||||||
public String getHearder() {
|
public String getHearder() {
|
||||||
try {
|
try {
|
||||||
return httpServletRequest.getHeader("Authorization");
|
return httpServletRequest.getHeader("Authorization");
|
||||||
@ -223,4 +237,12 @@ public class DishesServiceImpl implements DishesService {
|
|||||||
throw exception(2000_10_001, "无法获取设备编码");
|
throw exception(2000_10_001, "无法获取设备编码");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
String dayOfWeekInChinese = today.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.CHINESE);
|
||||||
|
System.out.println("今天是:" + dayOfWeekInChinese);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user