| | |
| | | package com.yuanchu.mom; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.yuanchu.mom.exception.ErrorException; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.apache.el.lang.ExpressionBuilder; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import javax.script.ScriptEngine; |
| | | import javax.script.ScriptEngineManager; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.time.temporal.WeekFields; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Locale; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | @SpringBootTest |
| | | class SystemRunApplicationTest { |
| | | |
| | | @Test |
| | | void contextLoads() { |
| | | // 获取当前日期 |
| | | LocalDate today = LocalDate.now(); |
| | | void contextLoads() { |
| | | List<List<String>> outerList = new ArrayList<>(); |
| | | String str = "[[\"127\",\"123\",\"124\",\"123\",\"119\",\"122\",\"\",\"\",\"126\",\"112\"],[\"117\",\"124\",\"121\",\"122\",\"123\",\"127\",\"123\",\"112\"],[\"125\",\"125\",\"122\",\"123\",\"129\",\"124\",\"122\",\"118\"]]"; |
| | | String[] value = str.split("\\],\\["); |
| | | String[] split = value[0].replaceAll("[\\[\\]\"]", "").split(","); |
| | | String aa=split[6]; |
| | | System.out.println(aa); |
| | | |
| | | // 获取本月的第一天和最后一天 |
| | | LocalDate firstDayOfMonth = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | LocalDate lastDayOfMonth = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | |
| | | // 获取周字段信息(根据区域设置) |
| | | WeekFields weekFields = WeekFields.of(Locale.getDefault()); |
| | | |
| | | // 获取本月第一天的周一 |
| | | LocalDate startOfWeek = firstDayOfMonth.with(TemporalAdjusters.previousOrSame(weekFields.getFirstDayOfWeek())); |
| | | |
| | | // 遍历本月所有天数,找出每周的第一天和最后一天 |
| | | LocalDate endOfWeek; |
| | | while (startOfWeek.isBefore(firstDayOfMonth.plusMonths(1))) { |
| | | endOfWeek = startOfWeek.plusDays(6); |
| | | LocalDateTime startDateTime = LocalDateTime.of(startOfWeek, LocalTime.MIDNIGHT); |
| | | LocalDateTime endDateTime = LocalDateTime.of(endOfWeek, LocalTime.MIDNIGHT); |
| | | |
| | | System.out.println("Week starts on " + startDateTime + " and ends on " + endDateTime); |
| | | |
| | | startOfWeek = startOfWeek.plusWeeks(1); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |