|
@@ -24,7 +24,6 @@ import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -91,18 +90,17 @@ public class StatisticsInfoServiceImpl extends ServiceImpl<StatisticsInfoMapper,
|
|
|
public FindByStatisticsVO findByStatistics(String orgCode, int dateAsInt, int firstDayInt,int yesterdayNum ) {
|
|
|
StatisticsInfo byOrgCode = statisticsInfoMapper.findByOrgCode(orgCode, dateAsInt);
|
|
|
FindByStatisticsVO findByStatisticsVO =new FindByStatisticsVO();
|
|
|
- List<FindByStatisticsChartVO> findByStatisticsChartVOS = new ArrayList<>();
|
|
|
if(byOrgCode!=null){
|
|
|
- // 定义日期格式(yyyyMMdd)
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
|
|
BeanUtils.copyProperties(byOrgCode,findByStatisticsVO);
|
|
|
- findByStatisticsChartVOS = statisticsInfoMapper.findByOrgCodeAndDay(orgCode,dateAsInt,firstDayInt);
|
|
|
- for (FindByStatisticsChartVO findByStatisticsChartVO : findByStatisticsChartVOS) {
|
|
|
- Integer dateDaily = findByStatisticsChartVO.getDateDaily();
|
|
|
- // 解析为 LocalDate
|
|
|
- LocalDate date = LocalDate.parse(String.valueOf(dateDaily), formatter);
|
|
|
- findByStatisticsChartVO.setDateDailyDate(date);
|
|
|
- }
|
|
|
+ }
|
|
|
+ // 定义日期格式(yyyyMMdd)
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
|
|
+ List<FindByStatisticsChartVO> findByStatisticsChartVOS = statisticsInfoMapper.findByOrgCodeAndDay(orgCode,dateAsInt,firstDayInt);
|
|
|
+ for (FindByStatisticsChartVO findByStatisticsChartVO : findByStatisticsChartVOS) {
|
|
|
+ Integer dateDaily = findByStatisticsChartVO.getDateDaily();
|
|
|
+ // 解析为 LocalDate
|
|
|
+ LocalDate date = LocalDate.parse(String.valueOf(dateDaily), formatter);
|
|
|
+ findByStatisticsChartVO.setDateDailyDate(date);
|
|
|
}
|
|
|
StatisticsInfo byOrgCodeOld = statisticsInfoMapper.findByOrgCode(orgCode, yesterdayNum);
|
|
|
getStatisticsInfo(byOrgCode,byOrgCodeOld,findByStatisticsVO);
|
|
@@ -114,17 +112,17 @@ public class StatisticsInfoServiceImpl extends ServiceImpl<StatisticsInfoMapper,
|
|
|
public List<FindByStatisticsChartVO> findByShopMoneyList(String orgCode,Integer type) {
|
|
|
LocalDateTime today = LocalDateTime.now();
|
|
|
/**获取当天的yyyyMMdd时间格式 int类型*/
|
|
|
- int startTime = Integer.parseInt(
|
|
|
+ int endTime = Integer.parseInt(
|
|
|
today.format(DateTimeFormatter.ofPattern("yyyyMMdd"))
|
|
|
);
|
|
|
/**获取当月的yyyyMMdd时间格式 int类型*/
|
|
|
- int endTime = Integer.parseInt(today.format(DateTimeFormatter.ofPattern("yyyyMMdd")));//默认当天
|
|
|
+ int startTime = Integer.parseInt(today.format(DateTimeFormatter.ofPattern("yyyyMMdd")));//默认当天
|
|
|
if (type==1){//今日
|
|
|
- endTime = Integer.parseInt(today.format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
|
|
+ startTime = Integer.parseInt(today.format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
|
|
} else if (type==2) {//本周
|
|
|
- endTime = Integer.parseInt(today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
|
|
+ startTime = Integer.parseInt(today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
|
|
}else if (type==3){//本月
|
|
|
- endTime = Integer.parseInt(today.withDayOfMonth(1).format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
|
|
+ startTime = Integer.parseInt(today.withDayOfMonth(1).format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
|
|
}
|
|
|
return statisticsInfoMapper.findByShopMoneyList(orgCode,startTime,endTime);
|
|
|
}
|
|
@@ -133,23 +131,22 @@ public class StatisticsInfoServiceImpl extends ServiceImpl<StatisticsInfoMapper,
|
|
|
public List<FindByShopSumVO> findByShopSumList(String orgCode, Integer type) {
|
|
|
// 获取当前日期
|
|
|
LocalDate today = LocalDate.now();
|
|
|
- LocalDateTime startTime = today.atStartOfDay();
|
|
|
- // 1. 明天 00:00:00
|
|
|
LocalDateTime endTime = today.plusDays(1).atStartOfDay();
|
|
|
+ // 1. 今天 00:00:00
|
|
|
+ LocalDateTime startTime =today.atStartOfDay();
|
|
|
if (type==1){
|
|
|
// 1. 明天 00:00:00
|
|
|
- endTime = today.plusDays(1).atStartOfDay();
|
|
|
+ startTime = today.plusDays(1).atStartOfDay();
|
|
|
} else if (type==2) {
|
|
|
// 2. 本周第一天(周一)00:00:00
|
|
|
- endTime = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY))
|
|
|
+ startTime = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY))
|
|
|
.atStartOfDay();
|
|
|
} else if (type==3) {
|
|
|
// 3. 当月第一天 00:00:00
|
|
|
- endTime = today.with(TemporalAdjusters.firstDayOfMonth())
|
|
|
+ startTime = today.with(TemporalAdjusters.firstDayOfMonth())
|
|
|
.atStartOfDay();
|
|
|
}
|
|
|
- List<FindByShopSumVO> findByShopSumVOS= appOrderMapper.findByShopSumList(orgCode,startTime,endTime);
|
|
|
- return null;
|
|
|
+ return appOrderMapper.findByShopSumList(orgCode,startTime,endTime);
|
|
|
}
|
|
|
|
|
|
private void getStatisticsInfo(StatisticsInfo statisticsInfoNew ,StatisticsInfo statisticsInfoOld,FindByStatisticsVO findByStatisticsVO){
|