|
@@ -1,5 +1,6 @@
|
|
|
package com.caimei.modules.shiro.service.impl;
|
|
|
|
|
|
+import com.caimei.modules.order.entity.NewOrderProduct;
|
|
|
import com.caimei.modules.shiro.dao.HomePageDao;
|
|
|
import com.caimei.modules.shiro.service.HomePageService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -7,9 +8,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Service
|
|
|
public class HomePageServiceImpl implements HomePageService {
|
|
@@ -56,27 +55,48 @@ public class HomePageServiceImpl implements HomePageService {
|
|
|
@Override
|
|
|
public Map<String, Object> sale() {
|
|
|
Map<String, Object> map = new HashMap();
|
|
|
- Map<String, String> map1 = CalendarUtils(0);
|
|
|
- Long totalFee1 = homePageDao.findTotalFee(map1.get("endTime"), map1.get("startTime"));
|
|
|
- map.put(map1.get("month"), totalFee1);
|
|
|
- Map<String, String> map2 = CalendarUtils(-1);
|
|
|
- Long totalFee2 = homePageDao.findTotalFee(map2.get("endTime"), map2.get("startTime"));
|
|
|
- map.put(map2.get("month"), totalFee2);
|
|
|
- Map<String, String> map3 = CalendarUtils(-2);
|
|
|
- Long totalFee3 = homePageDao.findTotalFee(map3.get("endTime"), map3.get("startTime"));
|
|
|
- map.put(map3.get("month"), totalFee3);
|
|
|
- Map<String, String> map4 = CalendarUtils(-3);
|
|
|
- Long totalFee4 = homePageDao.findTotalFee(map4.get("endTime"), map4.get("startTime"));
|
|
|
- map.put(map4.get("month"), totalFee4);
|
|
|
- Map<String, String> map5 = CalendarUtils(-4);
|
|
|
- Long totalFee5 = homePageDao.findTotalFee(map5.get("endTime"), map5.get("startTime"));
|
|
|
- map.put(map5.get("month"), totalFee5);
|
|
|
+ List<String> list1 = new ArrayList();
|
|
|
+ List<Long> list2 = new ArrayList();
|
|
|
Map<String, String> map6 = CalendarUtils(-5);
|
|
|
Long totalFee6 = homePageDao.findTotalFee(map6.get("endTime"), map6.get("startTime"));
|
|
|
- map.put(map6.get("month"), totalFee6);
|
|
|
+ list1.add(map6.get("month"));
|
|
|
+ list2.add(totalFee6);
|
|
|
+
|
|
|
+ Map<String, String> map5 = CalendarUtils(-4);
|
|
|
+ Long totalFee5 = homePageDao.findTotalFee(map5.get("endTime"), map5.get("startTime"));
|
|
|
+ list1.add(map5.get("month"));
|
|
|
+ list2.add(totalFee5);
|
|
|
+
|
|
|
+ Map<String, String> map4 = CalendarUtils(-3);
|
|
|
+ Long totalFee4 = homePageDao.findTotalFee(map4.get("endTime"), map4.get("startTime"));
|
|
|
+ list1.add(map4.get("month"));
|
|
|
+ list2.add(totalFee4);
|
|
|
+
|
|
|
+ Map<String, String> map3 = CalendarUtils(-2);
|
|
|
+ Long totalFee3 = homePageDao.findTotalFee(map3.get("endTime"), map3.get("startTime"));
|
|
|
+ list1.add(map3.get("month"));
|
|
|
+ list2.add(totalFee3);
|
|
|
+
|
|
|
+ Map<String, String> map2 = CalendarUtils(-1);
|
|
|
+ Long totalFee2 = homePageDao.findTotalFee(map2.get("endTime"), map2.get("startTime"));
|
|
|
+ list1.add(map2.get("month"));
|
|
|
+ list2.add(totalFee2);
|
|
|
+
|
|
|
+ Map<String, String> map1 = CalendarUtils(0);
|
|
|
+ Long totalFee1 = homePageDao.findTotalFee(map1.get("endTime"), map1.get("startTime"));
|
|
|
+ list1.add(map1.get("month"));
|
|
|
+ list2.add(totalFee1);
|
|
|
+
|
|
|
+ map.put("month", list1);
|
|
|
+ map.put("payTotalFee", list2);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<NewOrderProduct> commodity(String endTime, String startTime) {
|
|
|
+ return homePageDao.commodity(endTime, startTime);
|
|
|
+ }
|
|
|
+
|
|
|
public Map<String, String> CalendarUtils(Integer money) {
|
|
|
Map<String, String> map = new HashMap();
|
|
|
//2、获取本月第一天凌晨开始时间00:00:00和最后一天的最后一刻时间23:59:59
|
|
@@ -95,12 +115,10 @@ public class HomePageServiceImpl implements HomePageService {
|
|
|
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), actualMinimum, 00, 00, 00);
|
|
|
//打印本月起始日的年月日时分秒格式
|
|
|
map.put("startTime", sdf.format(cal.getTime()));
|
|
|
- System.out.println("这个月的第一天是: " + sdf.format(cal.getTime()));
|
|
|
//设置本月结束日的年月日时分秒格式
|
|
|
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), actualMaximum, 23, 59, 59);
|
|
|
//打印本月结束日的年月日时分秒格式
|
|
|
map.put("endTime", sdf.format(cal.getTime()));
|
|
|
- System.out.println("这个月的最后一天是: " + sdf.format(cal.getTime()));
|
|
|
return map;
|
|
|
}
|
|
|
}
|