Commit 70ac486d18686712fe3736b41d3d1294dfc91d0b

Authored by 王明元
1 parent 317f562a

2022年12月29日15:28:30 优化

fw-dalaran-common/pom.xml
... ... @@ -48,6 +48,10 @@
48 48 <groupId>net.coobird</groupId>
49 49 <artifactId>thumbnailator</artifactId>
50 50 </dependency>
  51 + <dependency>
  52 + <groupId>org.springframework.boot</groupId>
  53 + <artifactId>spring-boot</artifactId>
  54 + </dependency>
51 55 </dependencies>
52 56  
53 57 </project>
... ...
fw-dalaran-common/src/main/java/cn/fw/dalaran/common/ConfigProperties.java 0 → 100644
  1 +package cn.fw.dalaran.common;
  2 +
  3 +import lombok.Data;
  4 +import org.springframework.boot.context.properties.ConfigurationProperties;
  5 +
  6 +/**
  7 + * @author wmy3969
  8 + * @version 1.0
  9 + * @date 2022/12/29 9:43
  10 + * @Description 配置文件关联
  11 + */
  12 +@Data
  13 +@ConfigurationProperties(prefix = "url")
  14 +public class ConfigProperties {
  15 + /**
  16 + * 图片文件
  17 + */
  18 + private String show;
  19 + /**
  20 + * 删除map缓存
  21 + */
  22 + private String delMapCache;
  23 + /**
  24 + * 重新计算综合得分
  25 + */
  26 + private String reCalcScore;
  27 +}
... ...
fw-dalaran-common/src/main/java/cn/fw/dalaran/common/constants/Constants.java
... ... @@ -30,7 +30,7 @@ public interface Constants {
30 30 /**
31 31 * 账号配置角色码
32 32 */
33   - String ZHSZ_ROLE_CODE = "ZMT-ZHSZ";
  33 + String ZHSZ_ROLE_CODE = "MKT-HDCZ";
34 34 /**
35 35 * 直播审计角色码
36 36 */
... ...
fw-dalaran-common/src/main/java/cn/fw/dalaran/common/utils/DateUtil.java
1 1 package cn.fw.dalaran.common.utils;
2 2  
  3 +import cn.fw.common.exception.BusinessException;
  4 +
3 5 import java.sql.Timestamp;
4 6 import java.text.ParseException;
5 7 import java.text.SimpleDateFormat;
6 8 import java.time.*;
  9 +import java.time.format.DateTimeFormatter;
7 10 import java.time.temporal.TemporalAdjusters;
8   -import java.util.Calendar;
9   -import java.util.Date;
10   -import java.util.Objects;
  11 +import java.util.*;
11 12  
12 13 /**
13 14 * 日期处理工具
... ... @@ -17,6 +18,9 @@ import java.util.Objects;
17 18 */
18 19 public final class DateUtil {
19 20  
  21 + public static final String START = "start";
  22 + public static final String END = "end";
  23 +
20 24 static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
21 25  
22 26 /**
... ... @@ -26,7 +30,6 @@ public final class DateUtil {
26 30 throw new UnsupportedOperationException();
27 31 }
28 32  
29   -
30 33 public static Date parse(String date) {
31 34 try {
32 35 return sdf.parse(date);
... ... @@ -56,46 +59,6 @@ public final class DateUtil {
56 59 return localDateTime2Date(date2LocalDate(date).plusDays(1).atStartOfDay());
57 60 }
58 61  
59   - /**
60   - * 处理日期,保留年月日
61   - */
62   - public static LocalDate date2LocalDate(final Date date) {
63   - if (date == null) {
64   - return null;
65   - }
66   - return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()).toLocalDate();
67   - }
68   -
69   - public static LocalTime date2LocalTime(final Date date) {
70   - if (date == null) {
71   - return null;
72   - }
73   - return LocalTime.of(date.getHours(), date.getMinutes(), date.getSeconds());
74   - }
75   -
76   - public static LocalDateTime date2LocalDateTime(final Date date) {
77   - Instant instant = date.toInstant();
78   - ZoneId zoneId = ZoneId.systemDefault();
79   - return instant.atZone(zoneId).toLocalDateTime();
80   - }
81   -
82   - /**
83   - * convert LocalDateTime to Date
84   - */
85   - public static Date localDateTime2Date(final LocalDateTime dateTime) {
86   - return Date.from(dateTime.atZone(ZoneId.systemDefault()).toInstant());
87   - }
88   -
89   - /**
90   - * convert LocalDate to Date
91   - */
92   - public static Date localDate2Date(final LocalDate localDate) {
93   - if (localDate == null) {
94   - return null;
95   - }
96   - return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
97   - }
98   -
99 62 public static Date getBeginInTime(Date inTime) {
100 63 if (inTime == null) {
101 64 return null;
... ... @@ -561,6 +524,366 @@ public final class DateUtil {
561 524 return a > 18 && a <= 23;
562 525 }
563 526  
  527 +
  528 + /**
  529 + * 获取date的天的时间范围
  530 + * date: 2022-8-18 11:19:32
  531 + * return: 2022-8-18 0:00:00 ——> 2022-8-18 23:59:59
  532 + */
  533 + public static Map<String, Date> getDayRange(Date date) {
  534 + Map<String, Date> dateMap = new HashMap<>();
  535 + dateMap.put(START, dayBegin(date));
  536 + dateMap.put(END, dayEnd(date));
  537 + return dateMap;
  538 + }
  539 +
  540 + /**
  541 + * 获取date的月份的时间范围
  542 + * date: 2022-8-18 11:19:32
  543 + * return: 2022-8-01 0:00:00 ——> 2022-8-31 23:59:59
  544 + */
  545 + public static Map<String, Date> getMonthRange(Date date) {
  546 + Map<String, Date> dateMap = new HashMap<>();
  547 + LocalDate localDate = date2LocalDate(date);
  548 + dateMap.put(START, dayBegin(localDate2Date(localDate.withDayOfMonth(1))));
  549 + dateMap.put(END, dayEnd(localDate2Date(localDate.with(TemporalAdjusters.lastDayOfMonth()))));
  550 + return dateMap;
  551 + }
  552 +
  553 + /**
  554 + * 获取date的近4个月的时间范围
  555 + * date: 2022-8-18 11:19:32
  556 + * return: 2022-5-01 0:00:00 ——> 2022-8-31 23:59:59
  557 + */
  558 + public static Map<String, Date> get4MonthRange(Date date) {
  559 + Map<String, Date> dateMap = new HashMap<>();
  560 + LocalDate localDate = date2LocalDate(date);
  561 + dateMap.put(START, dayBegin(localDate2Date(localDate.withDayOfMonth(1).minusMonths(3))));
  562 + dateMap.put(END, dayEnd(localDate2Date(localDate.with(TemporalAdjusters.lastDayOfMonth()))));
  563 + return dateMap;
  564 + }
  565 +
  566 + /**
  567 + * 获取date的近1年的时间范围
  568 + * date: 2022-8-18 11:19:32
  569 + * return: 2021-9-01 0:00:00 ——> 2022-8-31 23:59:59
  570 + */
  571 + public static Map<String, Date> getOneYearRange(Date date) {
  572 + Map<String, Date> dateMap = new HashMap<>();
  573 + LocalDate localDate = date2LocalDate(date);
  574 + dateMap.put(START, dayBegin(localDate2Date(localDate.withDayOfMonth(1).minusMonths(11))));
  575 + dateMap.put(END, dayEnd(localDate2Date(localDate.with(TemporalAdjusters.lastDayOfMonth()))));
  576 + return dateMap;
  577 + }
  578 +
  579 + /**
  580 + * 获取指定时间那天的最小时间
  581 + * date: 2022-8-18 11:19:32
  582 + * return: 2022-8-18 0:00:00
  583 + */
  584 + public static Date dayBegin(Date date) {
  585 + return localDateTime2Date(LocalDateTime
  586 + .of(date2LocalDate(Objects.requireNonNull(date)), LocalTime.MIN)
  587 + );
  588 + }
  589 +
  590 + /**
  591 + * 获取指定时间那天的最大时间
  592 + * date: 2022-8-18 11:19:32
  593 + * return: 2022-8-18 23:59:59
  594 + */
  595 + public static Date dayEnd(Date date) {
  596 + return localDateTime2Date(LocalDateTime
  597 + .of(date2LocalDate(Objects.requireNonNull(date)), LocalTime.MAX)
  598 + );
  599 + }
  600 +
  601 + /**
  602 + * 获取指定时间那月的最小时间
  603 + * date: 2022-8-18 11:19:32
  604 + * return: 2022-8-01 0:00:00
  605 + */
  606 + public static Date monthBegin(Date date) {
  607 + return localDateTime2Date(LocalDateTime
  608 + .of(date2LocalDate(Objects.requireNonNull(date)).withDayOfMonth(1), LocalTime.MIN)
  609 + );
  610 + }
  611 +
  612 + /**
  613 + * 获取指定时间那月的最大时间
  614 + * date: 2022-8-18 11:19:32
  615 + * return: 2022-8-31 23:59:59
  616 + */
  617 + public static Date monthEnd(Date date) {
  618 + return localDateTime2Date(LocalDateTime
  619 + .of(date2LocalDate(Objects.requireNonNull(date)).with(TemporalAdjusters.lastDayOfMonth()), LocalTime.MAX)
  620 + );
  621 + }
  622 +
  623 + /**
  624 + * LocalDate转Date
  625 + */
  626 + public static Date localDate2Date(LocalDate localDate) {
  627 + return Date.from(Objects.requireNonNull(localDate)
  628 + .atStartOfDay()
  629 + .atZone(ZoneId.systemDefault())
  630 + .toInstant()
  631 + );
  632 + }
  633 +
  634 + /**
  635 + * LocalDateTime转Date
  636 + */
  637 + public static Date localDateTime2Date(LocalDateTime localDateTime) {
  638 + return Date.from(Objects.requireNonNull(localDateTime)
  639 + .atZone(ZoneId.systemDefault())
  640 + .toInstant()
  641 + );
  642 + }
  643 +
  644 + /**
  645 + * Date转LocalDateTime
  646 + */
  647 + public static LocalDateTime date2LocalDateTime(Date date) {
  648 + return Objects.requireNonNull(date)
  649 + .toInstant()
  650 + .atZone(ZoneId.systemDefault())
  651 + .toLocalDateTime()
  652 + ;
  653 + }
  654 +
  655 + /**
  656 + * Date转LocalTime
  657 + */
  658 + public static LocalTime date2LocalTime(Date date) {
  659 + return Objects.requireNonNull(date)
  660 + .toInstant()
  661 + .atZone(ZoneId.systemDefault())
  662 + .toLocalTime()
  663 + ;
  664 + }
  665 +
  666 + /**
  667 + * Date转LocalDate
  668 + */
  669 + public static LocalDate date2LocalDate(Date date) {
  670 + return Objects.requireNonNull(date)
  671 + .toInstant()
  672 + .atZone(ZoneId.systemDefault())
  673 + .toLocalDate()
  674 + ;
  675 + }
  676 +
  677 + /**
  678 + * 时间戳转LocalDate
  679 + */
  680 + public static LocalDate timestamp2LocalDate(Long timestamp) {
  681 + return Instant.
  682 + ofEpochMilli(Objects.requireNonNull(timestamp))
  683 + .atZone(ZoneId.systemDefault())
  684 + .toLocalDate()
  685 + ;
  686 + }
  687 +
  688 + /**
  689 + * 时间戳转LocalDateTime
  690 + */
  691 + public static LocalDateTime timestamp2LocalDateTime(Long timestamp) {
  692 + return Instant.
  693 + ofEpochMilli(Objects.requireNonNull(timestamp))
  694 + .atZone(ZoneId.systemDefault())
  695 + .toLocalDateTime()
  696 + ;
  697 + }
  698 +
  699 + /**
  700 + * LocalDate转时间戳
  701 + */
  702 + public static Long localDate2Timestamp(LocalDate localDate) {
  703 + return Objects.requireNonNull(localDate)
  704 + .atStartOfDay(ZoneId.systemDefault())
  705 + .toInstant()
  706 + .toEpochMilli()
  707 + ;
  708 + }
  709 +
  710 + /**
  711 + * LocalDateTime转时间戳
  712 + */
  713 + public static Long localDateTime2Timestamp(LocalDateTime localDateTime) {
  714 + return Objects.requireNonNull(localDateTime)
  715 + .toInstant(ZoneOffset.ofHours(8))
  716 + .toEpochMilli()
  717 + ;
  718 + }
  719 +
  720 + /**
  721 + * 按照pattern指定的格式格式化LocalDateTime对象
  722 + */
  723 + public static String formatLocalDateTime(LocalDateTime localDateTime, String pattern) {
  724 + DateTimeFormatter dtf = DateTimeFormatter.ofPattern(Objects.requireNonNull(pattern));
  725 + return Objects.requireNonNull(localDateTime).format(dtf);
  726 + }
  727 +
  728 + /**
  729 + * 两个时间是否在同一天
  730 + */
  731 + public static boolean sameDay(Date day1, Date day2) {
  732 + return Objects.equals(date2LocalDate(Objects.requireNonNull(day1)), date2LocalDate(Objects.requireNonNull(day2)));
  733 + }
  734 +
  735 + /**
  736 + * 两个时间是否在同一月
  737 + */
  738 + public static boolean sameMonth(Date day1, Date day2) {
  739 + LocalDate date1 = date2LocalDate(Objects.requireNonNull(day1));
  740 + LocalDate date2 = date2LocalDate(Objects.requireNonNull(day2));
  741 + return Objects.equals(date1.getYear(), date2.getYear()) && Objects.equals(date1.getMonthValue(), date2.getMonthValue());
  742 + }
  743 +
  744 + /**
  745 + * 两个时间是否在同一年
  746 + */
  747 + public static boolean sameYear(Date day1, Date day2) {
  748 + LocalDate date1 = date2LocalDate(Objects.requireNonNull(day1));
  749 + LocalDate date2 = date2LocalDate(Objects.requireNonNull(day2));
  750 + return Objects.equals(date1.getYear(), date2.getYear());
  751 + }
  752 +
  753 + /**
  754 + * 指定时间 + 指定秒
  755 + */
  756 + public static Date plusSeconds(Date date, int seconds) {
  757 + return localDateTime2Date(date2LocalDateTime(Objects.requireNonNull(date)).plusSeconds(Math.abs(seconds)));
  758 + }
  759 +
  760 + /**
  761 + * 指定时间 - 指定秒
  762 + */
  763 + public static Date minusSeconds(Date date, int seconds) {
  764 + return localDateTime2Date(date2LocalDateTime(Objects.requireNonNull(date)).minusSeconds(Math.abs(seconds)));
  765 + }
  766 +
  767 + /**
  768 + * 指定时间 + 指定分钟
  769 + */
  770 + public static Date plusMinutes(Date date, int minutes) {
  771 + return localDateTime2Date(date2LocalDateTime(Objects.requireNonNull(date)).plusMinutes(Math.abs(minutes)));
  772 + }
  773 +
  774 + /**
  775 + * 指定时间 - 指定秒
  776 + */
  777 + public static Date minusMinutes(Date date, int minutes) {
  778 + return localDateTime2Date(date2LocalDateTime(Objects.requireNonNull(date)).minusMinutes(Math.abs(minutes)));
  779 + }
  780 +
  781 + /**
  782 + * 指定时间 + 指定小时
  783 + */
  784 + public static Date plusHours(Date date, int hours) {
  785 + return localDateTime2Date(date2LocalDateTime(Objects.requireNonNull(date)).plusHours(Math.abs(hours)));
  786 + }
  787 +
  788 + /**
  789 + * 指定时间 - 指定小时
  790 + */
  791 + public static Date minusHours(Date date, int hours) {
  792 + return localDateTime2Date(date2LocalDateTime(Objects.requireNonNull(date)).minusHours(Math.abs(hours)));
  793 + }
  794 +
  795 + /**
  796 + * 指定时间 + 指定天
  797 + */
  798 + public static Date plusDays(Date date, int days) {
  799 + return localDateTime2Date(date2LocalDateTime(Objects.requireNonNull(date)).plusDays(Math.abs(days)));
  800 + }
  801 +
  802 + /**
  803 + * 指定时间 - 指定天
  804 + */
  805 + public static Date minusDays(Date date, int days) {
  806 + return localDateTime2Date(date2LocalDateTime(Objects.requireNonNull(date)).minusDays(Math.abs(days)));
  807 + }
  808 +
  809 + /**
  810 + * 指定时间 + 指定星期
  811 + */
  812 + public static Date plusWeeks(Date date, int weeks) {
  813 + return localDateTime2Date(date2LocalDateTime(Objects.requireNonNull(date)).plusWeeks(Math.abs(weeks)));
  814 + }
  815 +
  816 + /**
  817 + * 指定时间 - 指定星期
  818 + */
  819 + public static Date minusWeeks(Date date, int weeks) {
  820 + return localDateTime2Date(date2LocalDateTime(Objects.requireNonNull(date)).minusWeeks(Math.abs(weeks)));
  821 + }
  822 +
  823 + /**
  824 + * 指定时间 + 指定月
  825 + */
  826 + public static Date plusMonths(Date date, int months) {
  827 + return localDateTime2Date(date2LocalDateTime(Objects.requireNonNull(date)).plusMonths(Math.abs(months)));
  828 + }
  829 +
  830 + /**
  831 + * 指定时间 - 指定月
  832 + */
  833 + public static Date minusMonths(Date date, int months) {
  834 + return localDateTime2Date(date2LocalDateTime(Objects.requireNonNull(date)).minusMonths(Math.abs(months)));
  835 + }
  836 +
  837 + /**
  838 + * 指定时间 + 指定年
  839 + */
  840 + public static Date plusYears(Date date, int years) {
  841 + return localDateTime2Date(date2LocalDateTime(Objects.requireNonNull(date)).plusYears(Math.abs(years)));
  842 + }
  843 +
  844 + /**
  845 + * 指定时间 - 指定年
  846 + */
  847 + public static Date minusYears(Date date, int years) {
  848 + return localDateTime2Date(date2LocalDateTime(Objects.requireNonNull(date)).minusYears(Math.abs(years)));
  849 + }
  850 +
  851 + /**
  852 + * 校验时间有无重叠
  853 + *
  854 + * @param startDate1 开始时间1
  855 + * @param endDate1 结束时间1
  856 + * @param startDate2 开始时间2
  857 + * @param endDate2 结束时间2
  858 + * @return 两个时间区间是否有重叠
  859 + */
  860 + public static boolean validDateOverlap(Date startDate1, Date endDate1, Date startDate2, Date endDate2) {
  861 + if (startDate1.after(endDate1) || startDate2.after(endDate2))
  862 + throw new BusinessException("开始时间必须在结束时间之前");
  863 + return !endDate2.before(startDate1) && !startDate2.after(endDate1) && !endDate1.before(startDate2) && !startDate1.after(endDate2);
  864 + }
  865 +
  866 + /**
  867 + * 毫秒->xx天xx小时xx分xx秒xx毫秒
  868 + */
  869 + public static String millisToString(Long totalMillis) {
  870 + totalMillis = Math.abs(totalMillis);
  871 + int secondMillis = 1000;// 每秒钟毫秒数
  872 + int minuteMillis = secondMillis * 60;// 每分钟毫秒数
  873 + int hourMillis = minuteMillis * 60;// 每小时毫秒数
  874 + int dayMillis = hourMillis * 24;// 每天毫秒数
  875 + long days = totalMillis / dayMillis;// 共有多少天
  876 + long hours = (totalMillis - days * dayMillis) / hourMillis;// 还有多少小时
  877 + long minutes = (totalMillis - days * dayMillis - hours * hourMillis) / minuteMillis;// 还有多少分钟
  878 + /*long seconds = (totalMillis - days * dayMillis - hours * hourMillis - minutes * minuteMillis) / secondMillis;// 还有多少秒
  879 + long millis = totalMillis - days * dayMillis - hours * hourMillis - minutes * minuteMillis - seconds * secondMillis;// 还有多少毫秒*/
  880 + return (days > 0 ? days : 0) + "天" +
  881 + (hours > 0 ? hours : 0) + "小时" +
  882 + (minutes > 0 ? minutes : 0) + "分" /*+
  883 + (seconds > 0 ? seconds : 0) + "秒" +
  884 + (millis > 0 ? millis : 0) + "毫秒"*/;
  885 + }
  886 +
564 887 public static void main(String[] args) throws ParseException {
565 888 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
566 889 Date date = format.parse("2020-09-19 15:45:30");
... ...
fw-dalaran-server/pom.xml
... ... @@ -149,7 +149,11 @@
149 149 <artifactId>fw-dalaran-domain</artifactId>
150 150 <version>1.0.0</version>
151 151 </dependency>
152   -
  152 + <dependency>
  153 + <groupId>org.springframework.boot</groupId>
  154 + <artifactId>spring-boot-configuration-processor</artifactId>
  155 + <optional>true</optional>
  156 + </dependency>
153 157 </dependencies>
154 158  
155 159 <build>
... ...
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/Application.java
1 1 package cn.fw.dalaran.server;
2 2  
  3 +import cn.fw.dalaran.common.ConfigProperties;
3 4 import cn.fw.security.auth.client.EnableAuthClient;
4 5 import org.mybatis.spring.annotation.MapperScan;
5 6 import org.springframework.boot.SpringApplication;
6 7 import org.springframework.boot.autoconfigure.SpringBootApplication;
  8 +import org.springframework.boot.context.properties.EnableConfigurationProperties;
7 9 import org.springframework.cache.annotation.EnableCaching;
8 10 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
9 11 import org.springframework.cloud.openfeign.EnableFeignClients;
... ... @@ -33,6 +35,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
33 35 @ComponentScan({"cn.fw.dalaran.*"})
34 36 @EnableFeignClients({"cn.fw.**.sdk"})
35 37 @EnableAspectJAutoProxy(exposeProxy = true)
  38 +@EnableConfigurationProperties({ConfigProperties.class})
36 39 public class Application {
37 40 public static void main(final String[] args) {
38 41 SpringApplication.run(Application.class, args);
... ...
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/task/TodoTask.java
1 1 package cn.fw.dalaran.server.task;
2 2  
3 3 import cn.fw.dalaran.common.constants.Constants;
  4 +import cn.fw.dalaran.common.utils.DateUtil;
4 5 import cn.fw.dalaran.domain.db.Account;
5 6 import cn.fw.dalaran.domain.db.ActivityTheme;
6 7 import cn.fw.dalaran.domain.db.LivePool;
... ... @@ -52,7 +53,7 @@ public class TodoTask {
52 53 List<TodoHistory> list = todoHistoryService.list(Wrappers.<TodoHistory>lambdaQuery()
53 54 .eq(TodoHistory::getSend, Boolean.FALSE)
54 55 .eq(TodoHistory::getDone, Boolean.FALSE)
55   - .ge(TodoHistory::getCreateTime, new Date(System.currentTimeMillis() - 7 * 24 * 3600 * 1000L))// 创建时间不超过7天的
  56 + .ge(TodoHistory::getCreateTime, DateUtil.minusDays(new Date(), 7))// 创建时间不超过7天的
56 57 );// 找到需要推送待办的数据项
57 58 if (CollectionUtils.isEmpty(list)) {
58 59 return;
... ...
fw-dalaran-server/src/main/resources/application-dev.yml
... ... @@ -23,3 +23,8 @@ logging:
23 23 nacos:
24 24 plugin:
25 25 namespace: df959b8c-de58-4d02-b9fb-d65ca3be05f3
  26 +
  27 +url:
  28 + show: https://testgate.feewee.cn/file/show?fid= #文件服务器地址
  29 + del-map-cache: http://testgate.feewee.cn/report2/dalaran/004/other/clearCache #清除报表系统自媒体数据缓存
  30 + re-calc-score: http://testgate.feewee.cn/report2/debug/extract/data/dalaran?dateType=DAILY&type=Dalaran004D&date= #重新抽取综合得分
... ...
fw-dalaran-server/src/main/resources/application-local.yml
... ... @@ -33,4 +33,7 @@ jedis:
33 33 pwd: fw@test@redis
34 34 port: 6378
35 35  
36   -file-server-addr: 'https://testgate.feewee.cn/file/show?fid='
  36 +url:
  37 + show: https://testgate.feewee.cn/file/show?fid= #文件服务器地址
  38 + del-map-cache: http://testgate.feewee.cn/report2/dalaran/004/other/clearCache #清除报表系统自媒体数据缓存
  39 + re-calc-score: http://testgate.feewee.cn/report2/debug/extract/data/dalaran?dateType=DAILY&type=Dalaran004D&date= #重新抽取综合得分
... ...
fw-dalaran-server/src/main/resources/application-prd.yml
... ... @@ -51,4 +51,7 @@ rocketmq:
51 51 task:
52 52 switch: 'on'
53 53  
54   -file-server-addr: 'https://gate.feewee.cn/file/show?fid='
  54 +url:
  55 + show: https://gate.feewee.cn/file/show?fid= #文件服务器地址
  56 + del-map-cache: http://gate.feewee.cn/report2/dalaran/004/other/clearCache #清除报表系统自媒体数据缓存
  57 + re-calc-score: http://gate.feewee.cn/report2/debug/extract/data/dalaran?dateType=DAILY&type=Dalaran004D&date= #重新抽取综合得分
... ...
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/biz/OtherBizService.java
1 1 package cn.fw.dalaran.service.biz;
2 2  
  3 +import cn.fw.dalaran.common.ConfigProperties;
3 4 import cn.fw.dalaran.common.constants.Constants;
4 5 import cn.fw.dalaran.common.exception.BusinessException;
5 6 import cn.fw.dalaran.common.utils.PublicUtil;
... ... @@ -43,6 +44,7 @@ import java.util.stream.Collectors;
43 44 public class OtherBizService {
44 45 @Value("${spring.profiles.active}")
45 46 private String env;// 获取系统当前环境
  47 + private final ConfigProperties configProperties;
46 48 private final ActivityThemeService activityThemeService;
47 49 private final LivePoolService livePoolService;
48 50 private final LiveCheckResultService liveCheckResultService;
... ... @@ -196,8 +198,8 @@ public class OtherBizService {
196 198 while (!flag && cnt < 5) {
197 199 if (cnt > 0)
198 200 LockSupport.parkNanos(TimeUnit.SECONDS.toNanos(1));
199   - this.sendGetRequest("http://" + (env.contains("prd") ? "" : "test") + "gate.feewee.cn/report2/dalaran/004/other/clearCache");// 清空缓存
200   - flag = this.sendGetRequest("http://" + (env.contains("prd") ? "" : "test") + "gate.feewee.cn/report2/debug/extract/data/dalaran?dateType=DAILY&type=Dalaran004D&date=" +
  201 + this.sendGetRequest(configProperties.getDelMapCache());// 清空缓存
  202 + flag = this.sendGetRequest(configProperties.getReCalcScore() +
201 203 sdf.format(activityTheme.getEndTime())
202 204 );
203 205 cnt++;
... ...
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/data/impl/ActivityThemeServiceImpl.java
... ... @@ -2,6 +2,7 @@ package cn.fw.dalaran.service.data.impl;
2 2  
3 3 import cn.fw.common.page.AppPage;
4 4 import cn.fw.common.web.auth.LoginAuthBean;
  5 +import cn.fw.dalaran.common.ConfigProperties;
5 6 import cn.fw.dalaran.common.constants.Constants;
6 7 import cn.fw.dalaran.common.exception.BusinessException;
7 8 import cn.fw.dalaran.common.utils.DateUtil;
... ... @@ -35,7 +36,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
35 36 import com.google.common.collect.Lists;
36 37 import lombok.RequiredArgsConstructor;
37 38 import lombok.extern.slf4j.Slf4j;
38   -import org.springframework.beans.factory.annotation.Value;
39 39 import org.springframework.context.event.EventListener;
40 40 import org.springframework.scheduling.annotation.Async;
41 41 import org.springframework.stereotype.Service;
... ... @@ -59,8 +59,7 @@ import java.util.stream.Collectors;
59 59 @RequiredArgsConstructor
60 60 public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, ActivityTheme> implements ActivityThemeService {
61 61  
62   - @Value("${file-server-addr}")
63   - private String serverAddr;
  62 + private final ConfigProperties configProperties;
64 63 private final ActivityThemeDao activityThemeDao;
65 64 private final ConfigGroupService configGroupService;
66 65 private final ThemeFileService themeFileService;
... ... @@ -83,7 +82,14 @@ public class ActivityThemeServiceImpl extends ServiceImpl&lt;ActivityThemeDao, Acti
83 82 return themeList.stream()
84 83 .anyMatch(item -> validDateOverlap(item.getStartTime(), item.getEndTime(), vo.getStartTime(), vo.getEndTime()) &&// 验证时间重叠
85 84 /*(Objects.equals(item.getAllShop(), 1) || vo.getAllShop() || validShopOverlap(Arrays.stream(item.getShopIds().split(",")).map(Long::valueOf).collect(Collectors.toList()), vo.getShopIds()))// 验证门店重叠*/
86   - (Objects.equals(item.getAllShop(), 1) || configGroup.getAllShop() > 0 || validShopOverlap(Arrays.stream(item.getShopIds().split(",")).map(Long::valueOf).collect(Collectors.toList()), Arrays.stream(configGroup.getShopIds().split(",")).map(Long::valueOf).collect(Collectors.toList())))// 验证门店重叠
  85 + (Objects.equals(item.getAllShop(), 1) || configGroup.getAllShop() > 0 ||
  86 + validShopOverlap(Arrays.stream(item.getShopIds().split(","))
  87 + .map(Long::valueOf)
  88 + .collect(Collectors.toList()), Arrays.stream(configGroup.getShopIds().split(","))
  89 + .map(Long::valueOf)
  90 + .collect(Collectors.toList())
  91 + )
  92 + )// 验证门店重叠
87 93 );
88 94 }
89 95  
... ... @@ -363,7 +369,7 @@ public class ActivityThemeServiceImpl extends ServiceImpl&lt;ActivityThemeDao, Acti
363 369 allFileDesc.forEach(item -> {
364 370 try {
365 371 String fileId = item.getFid();
366   - File downloadFile = ImageUtils.convertFileByUrl(serverAddr + fileId, fileId);
  372 + File downloadFile = ImageUtils.convertFileByUrl(configProperties.getShow() + fileId, fileId);
367 373 ImageUtils.modifyResolution1(downloadFile.getPath(),
368 374 tempDir + "activityTheme" + File.separator + activityTheme.getId() /*+ "#" + activityTheme.getTheme()*/ + File.separator + "settingCover",
369 375 "fw_theme_cover_" + fileId,
... ...
... ... @@ -174,6 +174,11 @@
174 174 <artifactId>mybatis-typehandlers-jsr310</artifactId>
175 175 <version>${mybatis-typehandlers-jsr310}</version>
176 176 </dependency>
  177 + <dependency>
  178 + <groupId>org.springframework.boot</groupId>
  179 + <artifactId>spring-boot-configuration-processor</artifactId>
  180 + <version>2.1.12.RELEASE</version>
  181 + </dependency>
177 182  
178 183 <!-- image图片工具需要 start -->
179 184 <dependency>
... ...