优化菜单
This commit is contained in:
		| @ -54,4 +54,6 @@ public class DishesPageReqVO extends PageParam { | |||||||
|     private Long  typeId; |     private Long  typeId; | ||||||
|  |  | ||||||
|     private String weekTime; |     private String weekTime; | ||||||
|  |  | ||||||
|  |     private String timeSlot; | ||||||
| } | } | ||||||
| @ -80,4 +80,6 @@ public class DishesRespVO { | |||||||
|     private String dishecTypeName; |     private String dishecTypeName; | ||||||
|  |  | ||||||
|     private String weekTime; |     private String weekTime; | ||||||
|  |  | ||||||
|  |     private String timeSlot; | ||||||
| } | } | ||||||
| @ -65,4 +65,6 @@ public class DishesSaveReqVO { | |||||||
|     private List<DishesRawSaveReqVO> dishesRawList; |     private List<DishesRawSaveReqVO> dishesRawList; | ||||||
|  |  | ||||||
|     private String weekTime; |     private String weekTime; | ||||||
|  |  | ||||||
|  |     private String timeSlot; | ||||||
| } | } | ||||||
| @ -78,4 +78,6 @@ public class DishesDO extends BaseDO { | |||||||
|     private BigDecimal dishesNumber; |     private BigDecimal dishesNumber; | ||||||
|  |  | ||||||
|     private String weekTime; |     private String weekTime; | ||||||
|  |  | ||||||
|  |     private String timeSlot; | ||||||
| } | } | ||||||
| @ -35,4 +35,9 @@ public interface DishesMapper extends BaseMapperX<DishesDO> { | |||||||
|     } |     } | ||||||
|     @Select("select b.nickname from member_dining_plates as a INNER JOIN member_user as b on a.user_id=b.id where a.dining_plates_num=#{cId}") |     @Select("select b.nickname from member_dining_plates as a INNER JOIN member_user as b on a.user_id=b.id where a.dining_plates_num=#{cId}") | ||||||
|     String selectByCidUserName(@Param("cId") String cId); |     String selectByCidUserName(@Param("cId") String cId); | ||||||
|  |  | ||||||
|  |     @Select("select name from t_time where #{hour} >= start_time and  #{hour} <= end_time") | ||||||
|  |     String getTime(@Param("hour") int hour); | ||||||
|  |  | ||||||
|  |  | ||||||
| } | } | ||||||
| @ -30,8 +30,9 @@ 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.LocalDateTime; | ||||||
| import java.time.format.TextStyle; | import java.time.format.TextStyle; | ||||||
|  | import java.util.ArrayList; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Locale; | import java.util.Locale; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| @ -100,6 +101,13 @@ public class DishesServiceImpl implements DishesService { | |||||||
|         Long carteenId = deviceInfoService.getCarteen(getHearder()); |         Long carteenId = deviceInfoService.getCarteen(getHearder()); | ||||||
|         dishes.setCarteenId(carteenId); |         dishes.setCarteenId(carteenId); | ||||||
|         dishes.setDishesNumber(new BigDecimal("50")); |         dishes.setDishesNumber(new BigDecimal("50")); | ||||||
|  |  | ||||||
|  |         LocalDateTime today = LocalDateTime.now(); | ||||||
|  |         int hour = today.getHour(); | ||||||
|  |         String time = dishesMapper.getTime(hour); | ||||||
|  |         String dayOfWeekInChinese = today.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.CHINESE); | ||||||
|  |         dishes.setWeekTime(dayOfWeekInChinese); | ||||||
|  |         dishes.setTimeSlot(time); | ||||||
|         //计算每g多少钱 |         //计算每g多少钱 | ||||||
|         BigDecimal dishesSumPrice = vo.getDishesSumPrice(); |         BigDecimal dishesSumPrice = vo.getDishesSumPrice(); | ||||||
|         BigDecimal dishesNumber = new BigDecimal("50"); |         BigDecimal dishesNumber = new BigDecimal("50"); | ||||||
| @ -221,12 +229,20 @@ public class DishesServiceImpl implements DishesService { | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public List<DishesDO> getTodayDishes() { |     public List<DishesDO> getTodayDishes() { | ||||||
|         LocalDate today = LocalDate.now(); |         LocalDateTime today = LocalDateTime.now(); | ||||||
|  |         int hour = today.getHour(); | ||||||
|  |         String time = dishesMapper.getTime(hour); | ||||||
|         String dayOfWeekInChinese = today.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.CHINESE); |         String dayOfWeekInChinese = today.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.CHINESE); | ||||||
|  |  | ||||||
|  |         ArrayList<String> week = new ArrayList<>(); | ||||||
|  |         week.add(dayOfWeekInChinese); | ||||||
|  |         week.add("整周"); | ||||||
|  |  | ||||||
|         Long carteenId = deviceInfoService.getCarteen(getHearder()); |         Long carteenId = deviceInfoService.getCarteen(getHearder()); | ||||||
|         List<DishesDO> dishesDOS = dishesMapper.selectList(Wrappers.<DishesDO>lambdaQuery() |         List<DishesDO> dishesDOS = dishesMapper.selectList(Wrappers.<DishesDO>lambdaQuery() | ||||||
|                 .eq(DishesDO::getCarteenId, carteenId) |                 .eq(DishesDO::getCarteenId, carteenId) | ||||||
|                 .eq(DishesDO::getWeekTime,dayOfWeekInChinese)); |                 .in(DishesDO::getWeekTime, week) | ||||||
|  |                 .eq(DishesDO::getTimeSlot, time)); | ||||||
|         return dishesDOS; |         return dishesDOS; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @ -238,11 +254,5 @@ public class DishesServiceImpl implements DishesService { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     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
	 zengtao01
					zengtao01