|
3 | 3 | import java.io.File; |
4 | 4 | import java.io.IOException; |
5 | 5 | import java.text.DecimalFormat; |
| 6 | +import java.text.ParseException; |
| 7 | +import java.text.SimpleDateFormat; |
6 | 8 | import java.util.ArrayList; |
7 | 9 | import java.util.Calendar; |
8 | 10 | import java.util.Date; |
@@ -1275,4 +1277,27 @@ public String uploadDetailImageByFoodId(@RequestParam MultipartFile[] detailImag |
1275 | 1277 | return responseMap; |
1276 | 1278 | } |
1277 | 1279 |
|
| 1280 | + @RequestMapping("getTopFive") |
| 1281 | + public @ResponseBody Map<String, Object> getTopFive(@RequestParam String dateStart,@RequestParam String dateEnd, Integer page, Integer limit){ |
| 1282 | + Map<String,Object> requestMap = new HashMap<String, Object>(); |
| 1283 | + Map<String,Object> responseMap = new HashMap<String, Object>(); |
| 1284 | + |
| 1285 | + if(dateStart!=null&&dateEnd!=null){ |
| 1286 | + try { |
| 1287 | + requestMap.put("dateStart", new SimpleDateFormat("yyyy-MM-dd").parse(dateStart)); |
| 1288 | + requestMap.put("dateEnd", new SimpleDateFormat("yyyy-MM-dd").parse(dateEnd)); |
| 1289 | + requestMap.put("limit", limit); |
| 1290 | + requestMap.put("offset", (page-1)*limit); |
| 1291 | + JSONArray hotFive = (JSONArray) JSONArray.toJSON(foodService.getTopFive(requestMap)); |
| 1292 | + responseMap.put("hotFive", hotFive); |
| 1293 | + } catch (ParseException e) { |
| 1294 | + // TODO Auto-generated catch block |
| 1295 | + e.printStackTrace(); |
| 1296 | + } |
| 1297 | + } |
| 1298 | + |
| 1299 | + /*JSONArray hotFive = (JSONArray) JSONArray.toJSON(foodService.getTopFive(requestMap)); |
| 1300 | + responseMap.put("hotFive", hotFive);*/ |
| 1301 | + return responseMap; |
| 1302 | + } |
1278 | 1303 | } |
0 commit comments