Commit 38f027ea6d7de750b9ef83535bfb67a38658b24f
Merge branch 'dev' into test
Showing
44 changed files
with
1011 additions
and
179 deletions
fw-dalaran-common/pom.xml
@@ -48,6 +48,10 @@ | @@ -48,6 +48,10 @@ | ||
48 | <groupId>net.coobird</groupId> | 48 | <groupId>net.coobird</groupId> |
49 | <artifactId>thumbnailator</artifactId> | 49 | <artifactId>thumbnailator</artifactId> |
50 | </dependency> | 50 | </dependency> |
51 | + <dependency> | ||
52 | + <groupId>org.springframework.boot</groupId> | ||
53 | + <artifactId>spring-boot</artifactId> | ||
54 | + </dependency> | ||
51 | </dependencies> | 55 | </dependencies> |
52 | 56 | ||
53 | </project> | 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/DalaranConstants.java renamed to fw-dalaran-common/src/main/java/cn/fw/dalaran/common/constants/Constants.java
@@ -6,7 +6,7 @@ package cn.fw.dalaran.common.constants; | @@ -6,7 +6,7 @@ package cn.fw.dalaran.common.constants; | ||
6 | * @date 2022/4/13 16:40 | 6 | * @date 2022/4/13 16:40 |
7 | * @Description Dalaran系统常量 | 7 | * @Description Dalaran系统常量 |
8 | */ | 8 | */ |
9 | -public interface DalaranConstants { | 9 | +public interface Constants { |
10 | /** | 10 | /** |
11 | * 系统名 | 11 | * 系统名 |
12 | */ | 12 | */ |
@@ -30,9 +30,19 @@ public interface DalaranConstants { | @@ -30,9 +30,19 @@ public interface DalaranConstants { | ||
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 | */ |
37 | String ZBSJ_ROLE_CODE = "ZMT-ZBSJ"; | 37 | String ZBSJ_ROLE_CODE = "ZMT-ZBSJ"; |
38 | + | ||
39 | + /** | ||
40 | + * 薪酬绩效相关常量 | ||
41 | + */ | ||
42 | + interface Performance { | ||
43 | + /** | ||
44 | + * 综合得分目标达成率 | ||
45 | + */ | ||
46 | + String SCORE_RATE = "6574EA0766114615"; | ||
47 | + } | ||
38 | } | 48 | } |
fw-dalaran-common/src/main/java/cn/fw/dalaran/common/utils/DateUtil.java
1 | package cn.fw.dalaran.common.utils; | 1 | package cn.fw.dalaran.common.utils; |
2 | 2 | ||
3 | +import cn.fw.common.exception.BusinessException; | ||
4 | + | ||
3 | import java.sql.Timestamp; | 5 | import java.sql.Timestamp; |
4 | import java.text.ParseException; | 6 | import java.text.ParseException; |
5 | import java.text.SimpleDateFormat; | 7 | import java.text.SimpleDateFormat; |
6 | import java.time.*; | 8 | import java.time.*; |
9 | +import java.time.format.DateTimeFormatter; | ||
7 | import java.time.temporal.TemporalAdjusters; | 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,6 +18,9 @@ import java.util.Objects; | ||
17 | */ | 18 | */ |
18 | public final class DateUtil { | 19 | public final class DateUtil { |
19 | 20 | ||
21 | + public static final String START = "start"; | ||
22 | + public static final String END = "end"; | ||
23 | + | ||
20 | static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 24 | static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
21 | 25 | ||
22 | /** | 26 | /** |
@@ -26,7 +30,6 @@ public final class DateUtil { | @@ -26,7 +30,6 @@ public final class DateUtil { | ||
26 | throw new UnsupportedOperationException(); | 30 | throw new UnsupportedOperationException(); |
27 | } | 31 | } |
28 | 32 | ||
29 | - | ||
30 | public static Date parse(String date) { | 33 | public static Date parse(String date) { |
31 | try { | 34 | try { |
32 | return sdf.parse(date); | 35 | return sdf.parse(date); |
@@ -56,46 +59,6 @@ public final class DateUtil { | @@ -56,46 +59,6 @@ public final class DateUtil { | ||
56 | return localDateTime2Date(date2LocalDate(date).plusDays(1).atStartOfDay()); | 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 | public static Date getBeginInTime(Date inTime) { | 62 | public static Date getBeginInTime(Date inTime) { |
100 | if (inTime == null) { | 63 | if (inTime == null) { |
101 | return null; | 64 | return null; |
@@ -561,6 +524,366 @@ public final class DateUtil { | @@ -561,6 +524,366 @@ public final class DateUtil { | ||
561 | return a > 18 && a <= 23; | 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 | public static void main(String[] args) throws ParseException { | 887 | public static void main(String[] args) throws ParseException { |
565 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 888 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
566 | Date date = format.parse("2020-09-19 15:45:30"); | 889 | Date date = format.parse("2020-09-19 15:45:30"); |
fw-dalaran-dao/src/main/java/cn/fw/dalaran/dao/ActivityThemeDao.java
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | @@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
5 | import org.apache.ibatis.annotations.Mapper; | 5 | import org.apache.ibatis.annotations.Mapper; |
6 | import org.apache.ibatis.annotations.Param; | 6 | import org.apache.ibatis.annotations.Param; |
7 | 7 | ||
8 | +import java.util.List; | ||
9 | + | ||
8 | /** | 10 | /** |
9 | * @author wmy3969 | 11 | * @author wmy3969 |
10 | * @version 1.0 | 12 | * @version 1.0 |
@@ -19,4 +21,11 @@ public interface ActivityThemeDao extends BaseMapper<ActivityTheme> { | @@ -19,4 +21,11 @@ public interface ActivityThemeDao extends BaseMapper<ActivityTheme> { | ||
19 | * @param param 修改的参数封装 | 21 | * @param param 修改的参数封装 |
20 | */ | 22 | */ |
21 | boolean alertTheme(@Param("param") ActivityTheme param); | 23 | boolean alertTheme(@Param("param") ActivityTheme param); |
24 | + | ||
25 | + /** | ||
26 | + * 获取已经逻辑删除的主题列表 | ||
27 | + * | ||
28 | + * @return 已经逻辑删除的主题列表 | ||
29 | + */ | ||
30 | + List<ActivityTheme> getHasDelActivityTheme(); | ||
22 | } | 31 | } |
fw-dalaran-dao/src/main/resources/mapper/ActivityThemeDaoMapper.xml
@@ -43,4 +43,9 @@ | @@ -43,4 +43,9 @@ | ||
43 | </if> | 43 | </if> |
44 | </where> | 44 | </where> |
45 | </update> | 45 | </update> |
46 | + | ||
47 | + <select id="getHasDelActivityTheme" resultType="cn.fw.dalaran.domain.db.ActivityTheme"> | ||
48 | + SELECT * from activity_theme where logic_del = 1 | ||
49 | + </select> | ||
50 | + | ||
46 | </mapper> | 51 | </mapper> |
fw-dalaran-domain/src/main/java/cn/fw/dalaran/domain/db/ConfigGroup.java
@@ -54,7 +54,7 @@ public class ConfigGroup { | @@ -54,7 +54,7 @@ public class ConfigGroup { | ||
54 | */ | 54 | */ |
55 | private String configIds; | 55 | private String configIds; |
56 | /** | 56 | /** |
57 | - * 全部门店(-1:授权范围内, 0:否, 1:是) | 57 | + * 全部门店(-2:初始化, -1:授权范围内, 0:否, 1:是) |
58 | */ | 58 | */ |
59 | private Integer allShop; | 59 | private Integer allShop; |
60 | /** | 60 | /** |
fw-dalaran-domain/src/main/java/cn/fw/dalaran/domain/db/GlobalConfig.java
@@ -30,7 +30,7 @@ public class GlobalConfig implements Serializable { | @@ -30,7 +30,7 @@ public class GlobalConfig implements Serializable { | ||
30 | */ | 30 | */ |
31 | private Long configGroupId; | 31 | private Long configGroupId; |
32 | /** | 32 | /** |
33 | - * 配置项类型(1:封面, 2:话题) | 33 | + * 配置项类型(1:封面, 2:话题, 3:综合得分标准分) |
34 | */ | 34 | */ |
35 | private Integer type; | 35 | private Integer type; |
36 | /** | 36 | /** |
fw-dalaran-domain/src/main/java/cn/fw/dalaran/domain/db/TodoHistory.java
@@ -46,4 +46,11 @@ public class TodoHistory extends BaseAuditableTimeEntity<TodoHistory, Long> { | @@ -46,4 +46,11 @@ public class TodoHistory extends BaseAuditableTimeEntity<TodoHistory, Long> { | ||
46 | * 附加信息 | 46 | * 附加信息 |
47 | */ | 47 | */ |
48 | private String extra; | 48 | private String extra; |
49 | + | ||
50 | + /** | ||
51 | + * 自定义去重条件 | ||
52 | + */ | ||
53 | + public String getRemoveDuplicatesCondition() { | ||
54 | + return this.getUserId() + "-->" + this.getDataId(); | ||
55 | + } | ||
49 | } | 56 | } |
fw-dalaran-domain/src/main/java/cn/fw/dalaran/domain/enums/ConfigEnum.java
@@ -20,6 +20,10 @@ public enum ConfigEnum implements IEnum<Integer> { | @@ -20,6 +20,10 @@ public enum ConfigEnum implements IEnum<Integer> { | ||
20 | * 话题相似度 | 20 | * 话题相似度 |
21 | */ | 21 | */ |
22 | TOPIC_SIMILARITY(2, "话题相似度"), | 22 | TOPIC_SIMILARITY(2, "话题相似度"), |
23 | + /** | ||
24 | + * 综合得分集团标准分 | ||
25 | + */ | ||
26 | + STANDARD_SCORE(3,"综合得分集团标准分") | ||
23 | ; | 27 | ; |
24 | 28 | ||
25 | /** | 29 | /** |
fw-dalaran-domain/src/main/java/cn/fw/dalaran/domain/vo/ConfigGroupVo.java
@@ -33,6 +33,10 @@ public class ConfigGroupVo { | @@ -33,6 +33,10 @@ public class ConfigGroupVo { | ||
33 | */ | 33 | */ |
34 | private String userName; | 34 | private String userName; |
35 | /** | 35 | /** |
36 | + * 能否编辑 | ||
37 | + */ | ||
38 | + private boolean canAlter; | ||
39 | + /** | ||
36 | * 集团id | 40 | * 集团id |
37 | */ | 41 | */ |
38 | private Long groupId; | 42 | private Long groupId; |
fw-dalaran-domain/src/main/java/cn/fw/dalaran/domain/vo/LiveCheckVo.java
@@ -19,13 +19,13 @@ public class LiveCheckVo { | @@ -19,13 +19,13 @@ public class LiveCheckVo { | ||
19 | /** | 19 | /** |
20 | * 待审核直播列表 | 20 | * 待审核直播列表 |
21 | */ | 21 | */ |
22 | - private List<liveSummary> liveList; | 22 | + private List<LiveSummary> liveList; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * 待审核直播 | 25 | * 待审核直播 |
26 | */ | 26 | */ |
27 | @Data | 27 | @Data |
28 | - public static class liveSummary { | 28 | + public static class LiveSummary { |
29 | /** | 29 | /** |
30 | * 主键id | 30 | * 主键id |
31 | */ | 31 | */ |
fw-dalaran-rpc/pom.xml
@@ -39,6 +39,11 @@ | @@ -39,6 +39,11 @@ | ||
39 | <groupId>cn.fw</groupId> | 39 | <groupId>cn.fw</groupId> |
40 | <artifactId>fw-attendance-sdk</artifactId> | 40 | <artifactId>fw-attendance-sdk</artifactId> |
41 | </dependency> | 41 | </dependency> |
42 | + <!-- 绩效系统 --> | ||
43 | + <dependency> | ||
44 | + <groupId>cn.fw</groupId> | ||
45 | + <artifactId>fw-morax-sdk</artifactId> | ||
46 | + </dependency> | ||
42 | <!-- 校验注解 --> | 47 | <!-- 校验注解 --> |
43 | <dependency> | 48 | <dependency> |
44 | <groupId>javax.validation</groupId> | 49 | <groupId>javax.validation</groupId> |
fw-dalaran-rpc/src/main/java/cn/fw/dalaran/rpc/erp/ErpTaskRpc.java
1 | package cn.fw.dalaran.rpc.erp; | 1 | package cn.fw.dalaran.rpc.erp; |
2 | 2 | ||
3 | import cn.fw.common.exception.BusinessException; | 3 | import cn.fw.common.exception.BusinessException; |
4 | -import cn.fw.dalaran.common.constants.DalaranConstants; | 4 | +import cn.fw.dalaran.common.constants.Constants; |
5 | import cn.fw.dalaran.rpc.erp.dto.TaskSetReq; | 5 | import cn.fw.dalaran.rpc.erp.dto.TaskSetReq; |
6 | import cn.fw.data.base.domain.common.Message; | 6 | import cn.fw.data.base.domain.common.Message; |
7 | import cn.fw.erp.sdk.api.TaskApi; | 7 | import cn.fw.erp.sdk.api.TaskApi; |
@@ -29,7 +29,7 @@ public class ErpTaskRpc { | @@ -29,7 +29,7 @@ public class ErpTaskRpc { | ||
29 | try { | 29 | try { |
30 | TaskAddReq<T> addReq = new TaskAddReq<>(); | 30 | TaskAddReq<T> addReq = new TaskAddReq<>(); |
31 | BeanUtils.copyProperties(req, addReq); | 31 | BeanUtils.copyProperties(req, addReq); |
32 | - addReq.setSystem(DalaranConstants.APPLICATION_NAME); | 32 | + addReq.setSystem(Constants.APPLICATION_NAME); |
33 | final Message<Long> msg = taskApi.addTask(addReq); | 33 | final Message<Long> msg = taskApi.addTask(addReq); |
34 | log.info("调用ERP系统添加定时任务结果[{}]", JSON.toJSONString(msg)); | 34 | log.info("调用ERP系统添加定时任务结果[{}]", JSON.toJSONString(msg)); |
35 | } catch (Exception e) { | 35 | } catch (Exception e) { |
fw-dalaran-rpc/src/main/java/cn/fw/dalaran/rpc/morax/SalaryRpc.java
0 → 100644
1 | +package cn.fw.dalaran.rpc.morax; | ||
2 | + | ||
3 | +import cn.fw.dalaran.common.utils.PublicUtil; | ||
4 | +import cn.fw.data.base.domain.common.Message; | ||
5 | +import cn.fw.morax.sdk.api.IKpiReportService; | ||
6 | +import cn.fw.morax.sdk.api.ISalaryReportService; | ||
7 | +import cn.fw.morax.sdk.dto.CustomList; | ||
8 | +import cn.fw.morax.sdk.dto.kpi.KpiGroupUserQuery; | ||
9 | +import cn.fw.morax.sdk.dto.kpi.KpiGroupUserResult; | ||
10 | +import cn.fw.morax.sdk.dto.kpi.UserIndicatorReq; | ||
11 | +import lombok.RequiredArgsConstructor; | ||
12 | +import lombok.extern.slf4j.Slf4j; | ||
13 | +import org.springframework.stereotype.Component; | ||
14 | + | ||
15 | +import java.util.Collections; | ||
16 | +import java.util.List; | ||
17 | + | ||
18 | + | ||
19 | +/** | ||
20 | + * @author wmy3969 | ||
21 | + * @version 1.0 | ||
22 | + * @date 2022/10/9 14:05 | ||
23 | + * @Description 绩效薪酬rpc | ||
24 | + */ | ||
25 | +@Slf4j | ||
26 | +@Component | ||
27 | +@RequiredArgsConstructor | ||
28 | +public class SalaryRpc { | ||
29 | + | ||
30 | + private final IKpiReportService kpiApi;// 绩效api | ||
31 | + private final ISalaryReportService salaryApi;// 薪酬api | ||
32 | + | ||
33 | + /** | ||
34 | + * 查询绩效组人员 | ||
35 | + */ | ||
36 | + public List<KpiGroupUserResult> queryGroupUsers(KpiGroupUserQuery kpiGroupUserQuery) { | ||
37 | + try { | ||
38 | + Message<List<KpiGroupUserResult>> groupUser = kpiApi.queryKpiGroupUser(kpiGroupUserQuery); | ||
39 | + PublicUtil.assertTrue(groupUser.isSuccess(), "查询绩效组人员失败!"); | ||
40 | + return groupUser.getData(); | ||
41 | + } catch (Exception e) { | ||
42 | + log.error("查询绩效组人员发生错误, 错误信息为: {}", e.getMessage()); | ||
43 | + return Collections.emptyList(); | ||
44 | + } | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * 上报人员绩效数据 | ||
49 | + */ | ||
50 | + public void reportKpi(CustomList<UserIndicatorReq> userIndicatorList) { | ||
51 | + try { | ||
52 | + Message<Void> msg = kpiApi.indicatorReport(userIndicatorList); | ||
53 | + PublicUtil.assertTrue(msg.isSuccess(), "上报人员绩效数据失败!"); | ||
54 | + } catch (Exception e) { | ||
55 | + log.error("上报人员绩效数据发生错误, 错误信息为: {}", e.getMessage()); | ||
56 | + } | ||
57 | + } | ||
58 | + | ||
59 | +} |
fw-dalaran-server/pom.xml
@@ -26,6 +26,11 @@ | @@ -26,6 +26,11 @@ | ||
26 | <groupId>cn.fw</groupId> | 26 | <groupId>cn.fw</groupId> |
27 | <artifactId>fw-notice-sdk</artifactId> | 27 | <artifactId>fw-notice-sdk</artifactId> |
28 | </dependency> | 28 | </dependency> |
29 | + <!-- 绩效系统 --> | ||
30 | + <dependency> | ||
31 | + <groupId>cn.fw</groupId> | ||
32 | + <artifactId>fw-morax-sdk</artifactId> | ||
33 | + </dependency> | ||
29 | <dependency> | 34 | <dependency> |
30 | <groupId>cn.fw</groupId> | 35 | <groupId>cn.fw</groupId> |
31 | <artifactId>fw-attendance-sdk</artifactId> | 36 | <artifactId>fw-attendance-sdk</artifactId> |
@@ -65,6 +70,10 @@ | @@ -65,6 +70,10 @@ | ||
65 | <artifactId>spring-boot-starter-actuator</artifactId> | 70 | <artifactId>spring-boot-starter-actuator</artifactId> |
66 | </dependency> | 71 | </dependency> |
67 | <dependency> | 72 | <dependency> |
73 | + <groupId>io.micrometer</groupId> | ||
74 | + <artifactId>micrometer-registry-prometheus</artifactId> | ||
75 | + </dependency> | ||
76 | + <dependency> | ||
68 | <groupId>org.springframework.boot</groupId> | 77 | <groupId>org.springframework.boot</groupId> |
69 | <artifactId>spring-boot-starter-undertow</artifactId> | 78 | <artifactId>spring-boot-starter-undertow</artifactId> |
70 | </dependency> | 79 | </dependency> |
@@ -141,11 +150,10 @@ | @@ -141,11 +150,10 @@ | ||
141 | <version>1.0.0</version> | 150 | <version>1.0.0</version> |
142 | </dependency> | 151 | </dependency> |
143 | <dependency> | 152 | <dependency> |
144 | - <groupId>org.hibernate.validator</groupId> | ||
145 | - <artifactId>hibernate-validator</artifactId> | ||
146 | - <version>6.0.11.Final</version> | 153 | + <groupId>org.springframework.boot</groupId> |
154 | + <artifactId>spring-boot-configuration-processor</artifactId> | ||
155 | + <optional>true</optional> | ||
147 | </dependency> | 156 | </dependency> |
148 | - | ||
149 | </dependencies> | 157 | </dependencies> |
150 | 158 | ||
151 | <build> | 159 | <build> |
@@ -158,6 +166,7 @@ | @@ -158,6 +166,7 @@ | ||
158 | <include>**/*.yml</include> | 166 | <include>**/*.yml</include> |
159 | <include>**/*.properties</include> | 167 | <include>**/*.properties</include> |
160 | <include>**/*.xml</include> | 168 | <include>**/*.xml</include> |
169 | + <include>**/banner.txt</include> | ||
161 | </includes> | 170 | </includes> |
162 | </resource> | 171 | </resource> |
163 | </resources> | 172 | </resources> |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/Application.java
1 | package cn.fw.dalaran.server; | 1 | package cn.fw.dalaran.server; |
2 | 2 | ||
3 | +import cn.fw.dalaran.common.ConfigProperties; | ||
3 | import cn.fw.security.auth.client.EnableAuthClient; | 4 | import cn.fw.security.auth.client.EnableAuthClient; |
4 | import org.mybatis.spring.annotation.MapperScan; | 5 | import org.mybatis.spring.annotation.MapperScan; |
5 | import org.springframework.boot.SpringApplication; | 6 | import org.springframework.boot.SpringApplication; |
6 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
8 | +import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
7 | import org.springframework.cache.annotation.EnableCaching; | 9 | import org.springframework.cache.annotation.EnableCaching; |
8 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; | 10 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
9 | import org.springframework.cloud.openfeign.EnableFeignClients; | 11 | import org.springframework.cloud.openfeign.EnableFeignClients; |
10 | import org.springframework.context.annotation.ComponentScan; | 12 | import org.springframework.context.annotation.ComponentScan; |
11 | import org.springframework.context.annotation.Configuration; | 13 | import org.springframework.context.annotation.Configuration; |
14 | +import org.springframework.context.annotation.EnableAspectJAutoProxy; | ||
12 | import org.springframework.data.redis.repository.configuration.EnableRedisRepositories; | 15 | import org.springframework.data.redis.repository.configuration.EnableRedisRepositories; |
13 | import org.springframework.scheduling.annotation.EnableAsync; | 16 | import org.springframework.scheduling.annotation.EnableAsync; |
14 | import org.springframework.scheduling.annotation.EnableScheduling; | 17 | import org.springframework.scheduling.annotation.EnableScheduling; |
@@ -17,7 +20,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; | @@ -17,7 +20,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
17 | /** | 20 | /** |
18 | * 启动类 | 21 | * 启动类 |
19 | * | 22 | * |
20 | - *@author kurisu | 23 | + * @author kurisu |
21 | */ | 24 | */ |
22 | @EnableAsync | 25 | @EnableAsync |
23 | @SpringBootApplication | 26 | @SpringBootApplication |
@@ -31,6 +34,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; | @@ -31,6 +34,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
31 | @MapperScan("cn.fw.**.dao") | 34 | @MapperScan("cn.fw.**.dao") |
32 | @ComponentScan({"cn.fw.dalaran.*"}) | 35 | @ComponentScan({"cn.fw.dalaran.*"}) |
33 | @EnableFeignClients({"cn.fw.**.sdk"}) | 36 | @EnableFeignClients({"cn.fw.**.sdk"}) |
37 | +@EnableAspectJAutoProxy(exposeProxy = true) | ||
38 | +@EnableConfigurationProperties({ConfigProperties.class}) | ||
34 | public class Application { | 39 | public class Application { |
35 | public static void main(final String[] args) { | 40 | public static void main(final String[] args) { |
36 | SpringApplication.run(Application.class, args); | 41 | SpringApplication.run(Application.class, args); |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/controller/app/OtherController.java
@@ -41,6 +41,7 @@ public class OtherController { | @@ -41,6 +41,7 @@ public class OtherController { | ||
41 | 41 | ||
42 | private final OtherBizService otherBizService; | 42 | private final OtherBizService otherBizService; |
43 | private final Common common; | 43 | private final Common common; |
44 | + //private final TodoTask todoTask;// 定时任务 | ||
44 | 45 | ||
45 | /** | 46 | /** |
46 | * 获取直播审计页面 | 47 | * 获取直播审计页面 |
@@ -73,7 +74,7 @@ public class OtherController { | @@ -73,7 +74,7 @@ public class OtherController { | ||
73 | */ | 74 | */ |
74 | @GetMapping("/getLiveCheckDetails") | 75 | @GetMapping("/getLiveCheckDetails") |
75 | @ControllerMethod("获取某条审计详情") | 76 | @ControllerMethod("获取某条审计详情") |
76 | - public Message<LiveCheckVo.liveSummary> getLiveCheckDetails(@NotNull(message = "请必须指定数据id") Long id) { | 77 | + public Message<LiveCheckVo.LiveSummary> getLiveCheckDetails(@NotNull(message = "请必须指定数据id") Long id) { |
77 | return success(otherBizService.getLiveCheckDetails(id)); | 78 | return success(otherBizService.getLiveCheckDetails(id)); |
78 | } | 79 | } |
79 | 80 | ||
@@ -104,4 +105,16 @@ public class OtherController { | @@ -104,4 +105,16 @@ public class OtherController { | ||
104 | return success(result); | 105 | return success(result); |
105 | } | 106 | } |
106 | 107 | ||
108 | + /** | ||
109 | + * 重发直播审计待办 | ||
110 | + * | ||
111 | + * @param timestamp 时间戳 | ||
112 | + * @return | ||
113 | + */ | ||
114 | + /*@GetMapping("/resendLiveCheckBacklog") | ||
115 | + public Message<Void> test(@NotNull(message = "请必须指定时间戳") Long timestamp) { | ||
116 | + todoTask.sendLiveCheckBacklog(timestamp); | ||
117 | + return Message.success(); | ||
118 | + }*/ | ||
119 | + | ||
107 | } | 120 | } |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/controller/web/ConfigGroupController.java
1 | package cn.fw.dalaran.server.controller.web; | 1 | package cn.fw.dalaran.server.controller.web; |
2 | 2 | ||
3 | -import cn.fw.common.web.annotation.ControllerMethod; | ||
4 | import cn.fw.common.web.auth.LoginAuthBean; | 3 | import cn.fw.common.web.auth.LoginAuthBean; |
5 | import cn.fw.common.web.auth.annotation.CurrentUser; | 4 | import cn.fw.common.web.auth.annotation.CurrentUser; |
6 | import cn.fw.dalaran.domain.vo.ConfigGroupVo; | 5 | import cn.fw.dalaran.domain.vo.ConfigGroupVo; |
@@ -42,7 +41,6 @@ public class ConfigGroupController { | @@ -42,7 +41,6 @@ public class ConfigGroupController { | ||
42 | * @return 操作结果 | 41 | * @return 操作结果 |
43 | */ | 42 | */ |
44 | @GetMapping("/init") | 43 | @GetMapping("/init") |
45 | - @ControllerMethod("初始化配置组") | ||
46 | public Message<ConfigGroupVo> init(@CurrentUser LoginAuthBean user) { | 44 | public Message<ConfigGroupVo> init(@CurrentUser LoginAuthBean user) { |
47 | return success(configGroupService.init(user.getUserId(), user.getGroupId())); | 45 | return success(configGroupService.init(user.getUserId(), user.getGroupId())); |
48 | } | 46 | } |
@@ -66,7 +64,6 @@ public class ConfigGroupController { | @@ -66,7 +64,6 @@ public class ConfigGroupController { | ||
66 | * @return 符合条件的配置列表 | 64 | * @return 符合条件的配置列表 |
67 | */ | 65 | */ |
68 | @GetMapping("/list") | 66 | @GetMapping("/list") |
69 | - @ControllerMethod("查询配置列表") | ||
70 | public Message<List<ConfigGroupVo>> list(@CurrentUser LoginAuthBean user) { | 67 | public Message<List<ConfigGroupVo>> list(@CurrentUser LoginAuthBean user) { |
71 | return success(configGroupService.queryList(user.getUserId(), user.getGroupId())); | 68 | return success(configGroupService.queryList(user.getUserId(), user.getGroupId())); |
72 | } | 69 | } |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/controller/web/TestBizService.java
0 → 100644
1 | +package cn.fw.dalaran.server.controller.web; | ||
2 | + | ||
3 | +import cn.fw.attendance.sdk.api.AttendanceApi; | ||
4 | +import cn.fw.attendance.sdk.api.StaffStatusApi; | ||
5 | +import cn.fw.attendance.sdk.api.dto.UsersScheduleDetailsDto; | ||
6 | +import cn.fw.attendance.sdk.api.result.UserStatusVo; | ||
7 | +import cn.fw.attendance.sdk.api.result.UsersScheduleDetailsVo; | ||
8 | +import cn.fw.dalaran.domain.db.Account; | ||
9 | +import cn.fw.dalaran.domain.enums.PlatformEnum; | ||
10 | +import cn.fw.dalaran.service.data.AccountService; | ||
11 | +import cn.fw.data.base.domain.common.Message; | ||
12 | +import lombok.RequiredArgsConstructor; | ||
13 | +import lombok.extern.slf4j.Slf4j; | ||
14 | +import org.springframework.aop.framework.AopContext; | ||
15 | +import org.springframework.beans.factory.annotation.Autowired; | ||
16 | +import org.springframework.stereotype.Service; | ||
17 | +import org.springframework.transaction.annotation.Transactional; | ||
18 | + | ||
19 | +import java.util.Arrays; | ||
20 | +import java.util.Date; | ||
21 | +import java.util.List; | ||
22 | + | ||
23 | +/** | ||
24 | + * @author wmy3969 | ||
25 | + * @version 1.0 | ||
26 | + * @date 2022/10/12 0:23 | ||
27 | + * @Description | ||
28 | + */ | ||
29 | +@Slf4j | ||
30 | +@Service | ||
31 | +@RequiredArgsConstructor | ||
32 | +public class TestBizService { | ||
33 | + | ||
34 | + /* | ||
35 | + * A(不+事务注解)中调用B(+事务注解): | ||
36 | + * A无事务, B无事务 | ||
37 | + * | ||
38 | + * A(+事务注解)中调用B(+事务注解): | ||
39 | + * A有事务, B无事务 | ||
40 | + * | ||
41 | + * 解决方案: | ||
42 | + * 1: bean中自己注入自己, 让A中调用B方法使用注入的自己去调用B方法(testBizService.methodB(), 而不是this.methodB()) | ||
43 | + * 2: 配置类上声明@EnableAspectJAutoProxy(exposeProxy = true), 然后业务方法((TestBizService) AopContext.currentProxy()).methodB() | ||
44 | + * AopContext.currentProxy()其实就是获取的代理对象, bean中注入的自己也是代理对象 | ||
45 | + */ | ||
46 | + | ||
47 | + private TestBizService testBizService; | ||
48 | + private final StaffStatusApi staffStatusApi; | ||
49 | + private final AttendanceApi attendanceApi; | ||
50 | + | ||
51 | + @Autowired | ||
52 | + public void inject(TestBizService testBizService) { | ||
53 | + this.testBizService = testBizService; | ||
54 | + } | ||
55 | + | ||
56 | + private final AccountService accountService; | ||
57 | + | ||
58 | + @Transactional(rollbackFor = Exception.class) | ||
59 | + public void methodA() { | ||
60 | + Message<UserStatusVo> details = staffStatusApi.getUserStatusDetails(Arrays.asList(760L, 1545L, 1486L, 1342L), 1611975222000L, 1675047222937L); | ||
61 | + UsersScheduleDetailsDto dto = new UsersScheduleDetailsDto(); | ||
62 | + dto.setGroupId(2L); | ||
63 | + dto.setUserIds(Arrays.asList(760L, 1545L, 1486L, 1342L)); | ||
64 | + dto.setStartTime(new Date(1646818372000L)); | ||
65 | + dto.setEndTime(new Date(1678354372000L)); | ||
66 | + Message<List<UsersScheduleDetailsVo>> scheduleDetails = attendanceApi.getUsersScheduleDetails(dto); | ||
67 | + Account account = new Account(); | ||
68 | + account.setAccount("methodA"); | ||
69 | + account.setYn(Boolean.FALSE); | ||
70 | + account.setGroupId(2L); | ||
71 | + account.setType(PlatformEnum.DY); | ||
72 | + account.setUserId(1545L); | ||
73 | + account.setShopId(11L); | ||
74 | + accountService.save(account); | ||
75 | + try { | ||
76 | + //this.methodB(); | ||
77 | + //testBizService.methodB(); | ||
78 | + //testBizService1.methodB(); | ||
79 | + ((TestBizService) AopContext.currentProxy()).methodB(); | ||
80 | + } catch (Exception e) { | ||
81 | + e.printStackTrace(); | ||
82 | + } | ||
83 | + //int i = 1 / 0; | ||
84 | + } | ||
85 | + | ||
86 | + @Transactional(rollbackFor = Exception.class/*, propagation = Propagation.REQUIRES_NEW*/) | ||
87 | + public void methodB() { | ||
88 | + Account account = new Account(); | ||
89 | + account.setAccount("methodB"); | ||
90 | + account.setYn(Boolean.FALSE); | ||
91 | + account.setGroupId(2L); | ||
92 | + account.setType(PlatformEnum.DY); | ||
93 | + account.setUserId(1545L); | ||
94 | + account.setShopId(11L); | ||
95 | + accountService.save(account); | ||
96 | + int i = 1 / 0; | ||
97 | + } | ||
98 | +} |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/controller/web/TestController.java
0 → 100644
1 | +package cn.fw.dalaran.server.controller.web; | ||
2 | + | ||
3 | +import cn.fw.security.auth.client.annotation.Authorization; | ||
4 | +import cn.fw.security.auth.client.annotation.IgnoreAuth; | ||
5 | +import cn.fw.security.auth.client.enums.AuthType; | ||
6 | +import lombok.RequiredArgsConstructor; | ||
7 | +import lombok.extern.slf4j.Slf4j; | ||
8 | +import org.springframework.validation.annotation.Validated; | ||
9 | +import org.springframework.web.bind.annotation.GetMapping; | ||
10 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
11 | +import org.springframework.web.bind.annotation.RestController; | ||
12 | + | ||
13 | +/** | ||
14 | + * @author wmy3969 | ||
15 | + * @version 1.0 | ||
16 | + * @date 2022/10/12 0:23 | ||
17 | + * @Description | ||
18 | + */ | ||
19 | +@Slf4j | ||
20 | +@Validated | ||
21 | +@RestController | ||
22 | +@RequiredArgsConstructor | ||
23 | +@Authorization(AuthType.ERP) | ||
24 | +@RequestMapping("/web/test") | ||
25 | +@IgnoreAuth | ||
26 | +public class TestController { | ||
27 | + | ||
28 | + private final TestBizService testBizService; | ||
29 | + | ||
30 | + @GetMapping("/methodA") | ||
31 | + public void methodA() { | ||
32 | + testBizService.methodA(); | ||
33 | + } | ||
34 | + | ||
35 | +} |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/rocketMQ/InitStaffWorkStatusConsumer.java
1 | package cn.fw.dalaran.server.rocketMQ; | 1 | package cn.fw.dalaran.server.rocketMQ; |
2 | 2 | ||
3 | -import cn.fw.dalaran.common.constants.DalaranConstants; | 3 | +import cn.fw.dalaran.common.constants.Constants; |
4 | import cn.fw.dalaran.domain.db.Account; | 4 | import cn.fw.dalaran.domain.db.Account; |
5 | import cn.fw.dalaran.domain.db.ActivityTheme; | 5 | import cn.fw.dalaran.domain.db.ActivityTheme; |
6 | import cn.fw.dalaran.service.data.AccountService; | 6 | import cn.fw.dalaran.service.data.AccountService; |
@@ -25,9 +25,9 @@ import java.util.stream.Collectors; | @@ -25,9 +25,9 @@ import java.util.stream.Collectors; | ||
25 | @Component | 25 | @Component |
26 | @RequiredArgsConstructor | 26 | @RequiredArgsConstructor |
27 | @RocketMQMessageListener( | 27 | @RocketMQMessageListener( |
28 | - topic = "task-" + DalaranConstants.APPLICATION_NAME, | ||
29 | - consumerGroup = DalaranConstants.APPLICATION_NAME + "-task-" + DalaranConstants.INIT_ACCOUNT_STATUS, | ||
30 | - selectorExpression = DalaranConstants.INIT_ACCOUNT_STATUS) | 28 | + topic = "task-" + Constants.APPLICATION_NAME, |
29 | + consumerGroup = Constants.APPLICATION_NAME + "-task-" + Constants.INIT_ACCOUNT_STATUS, | ||
30 | + selectorExpression = Constants.INIT_ACCOUNT_STATUS) | ||
31 | public class InitStaffWorkStatusConsumer implements RocketMQListener<Long> { | 31 | public class InitStaffWorkStatusConsumer implements RocketMQListener<Long> { |
32 | 32 | ||
33 | private final AccountService accountService; | 33 | private final AccountService accountService; |
@@ -35,7 +35,7 @@ public class InitStaffWorkStatusConsumer implements RocketMQListener<Long> { | @@ -35,7 +35,7 @@ public class InitStaffWorkStatusConsumer implements RocketMQListener<Long> { | ||
35 | 35 | ||
36 | @Override | 36 | @Override |
37 | public void onMessage(Long themeId) { | 37 | public void onMessage(Long themeId) { |
38 | - log.info("收到topic为: task-{}, tag为: {}的消息, 消息内容(themeId): {}", DalaranConstants.APPLICATION_NAME, DalaranConstants.INIT_ACCOUNT_STATUS, themeId); | 38 | + log.info("收到topic为: task-{}, tag为: {}的消息, 消息内容(themeId): {}", Constants.APPLICATION_NAME, Constants.INIT_ACCOUNT_STATUS, themeId); |
39 | ActivityTheme theme; | 39 | ActivityTheme theme; |
40 | if (Objects.nonNull(theme = activityThemeService.getById(themeId))) { | 40 | if (Objects.nonNull(theme = activityThemeService.getById(themeId))) { |
41 | if (Objects.equals(theme.getAllShop(), 0)) { | 41 | if (Objects.equals(theme.getAllShop(), 0)) { |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/rocketMQ/SalaryEventConsumer.java
0 → 100644
1 | +package cn.fw.dalaran.server.rocketMQ; | ||
2 | + | ||
3 | +import cn.fw.dalaran.common.constants.Constants; | ||
4 | +import cn.fw.dalaran.common.utils.PublicUtil; | ||
5 | +import cn.fw.dalaran.rpc.morax.SalaryRpc; | ||
6 | +import cn.fw.dalaran.service.data.ActivityThemeService; | ||
7 | +import cn.fw.morax.sdk.dto.CustomList; | ||
8 | +import cn.fw.morax.sdk.dto.kpi.KpiGroupUserQuery; | ||
9 | +import cn.fw.morax.sdk.dto.kpi.KpiGroupUserResult; | ||
10 | +import cn.fw.morax.sdk.dto.kpi.KpiReportNoticeMQ; | ||
11 | +import cn.fw.morax.sdk.dto.kpi.UserIndicatorReq; | ||
12 | +import cn.fw.starter.redis.redis.RedisUtil; | ||
13 | +import com.alibaba.fastjson.JSON; | ||
14 | +import lombok.RequiredArgsConstructor; | ||
15 | +import lombok.extern.slf4j.Slf4j; | ||
16 | +import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; | ||
17 | +import org.apache.rocketmq.spring.core.RocketMQListener; | ||
18 | +import org.springframework.stereotype.Component; | ||
19 | + | ||
20 | +import java.util.List; | ||
21 | +import java.util.Objects; | ||
22 | + | ||
23 | +/** | ||
24 | + * @author wmy3969 | ||
25 | + * @version 1.0 | ||
26 | + * @date 2022/10/09 10:51 | ||
27 | + * @Description 薪酬绩效MQ | ||
28 | + */ | ||
29 | +@Slf4j | ||
30 | +@Component | ||
31 | +@RequiredArgsConstructor | ||
32 | +@RocketMQMessageListener( | ||
33 | + topic = KpiReportNoticeMQ.TOPIC, | ||
34 | + consumerGroup = Constants.APPLICATION_NAME + "-" + KpiReportNoticeMQ.TOPIC) | ||
35 | +public class SalaryEventConsumer implements RocketMQListener<KpiReportNoticeMQ> { | ||
36 | + | ||
37 | + private final RedisUtil redisUtil;// redis操作工具 | ||
38 | + private final SalaryRpc salaryRpc;// 薪酬绩效rpc | ||
39 | + private final ActivityThemeService activityThemeService;// 活动主题业务 | ||
40 | + | ||
41 | + /** | ||
42 | + * 处理'上报薪酬绩效'消息 | ||
43 | + * | ||
44 | + * @param kpiReport | ||
45 | + */ | ||
46 | + @Override | ||
47 | + public void onMessage(KpiReportNoticeMQ kpiReport) { | ||
48 | + String indicatorCode = kpiReport.getIndicatorCode(); | ||
49 | + if (Objects.equals(Constants.Performance.SCORE_RATE, indicatorCode)) | ||
50 | + return; | ||
51 | + log.info("收到上报薪酬绩效消息 message:{}", JSON.toJSONString(kpiReport)); | ||
52 | + String redisKey = "SalaryEventConsumer:onMessage"; | ||
53 | + if (redisUtil.getLock(redisKey)) { | ||
54 | + try { | ||
55 | + KpiGroupUserQuery param = new KpiGroupUserQuery(); | ||
56 | + param.setGroupId(kpiReport.getGroupId()); | ||
57 | + param.setDataDate(kpiReport.getUploadDate().getTime()); | ||
58 | + param.setPostId(kpiReport.getPostId()); | ||
59 | + param.setIndicatorCode(indicatorCode); | ||
60 | + List<KpiGroupUserResult> users = salaryRpc.queryGroupUsers(param); | ||
61 | + CustomList<UserIndicatorReq> indicates = new CustomList<>(); | ||
62 | + users.forEach(item -> {// 遍历每个组 | ||
63 | + /*BigDecimal targetValue = item.getTargetValue();// 目标值 | ||
64 | + TargetTypeEnum targetType = item.getTargetType();// 获取目标类型*/ | ||
65 | + List<KpiGroupUserResult.SimpleUserData> userIdList = item.getUserIdList(); | ||
66 | + userIdList.forEach(item1 -> {// 每个组下的不同人 | ||
67 | + UserIndicatorReq userIndicator = PublicUtil.copy(item1, UserIndicatorReq.class); | ||
68 | + userIndicator.setIndicatorCode(indicatorCode); | ||
69 | + userIndicator.setDataDate(kpiReport.getUploadDate()); | ||
70 | + userIndicator.setUid(kpiReport.getUid()); | ||
71 | + //userIndicator.setValue(); | ||
72 | + indicates.add(userIndicator); | ||
73 | + }); | ||
74 | + }); | ||
75 | + salaryRpc.reportKpi(indicates); | ||
76 | + } catch (Exception e) { | ||
77 | + log.error("处理上报薪酬绩效消息发生异常 message:{}", JSON.toJSONString(kpiReport), e); | ||
78 | + } finally { | ||
79 | + redisUtil.unlock(redisKey); | ||
80 | + } | ||
81 | + } else { | ||
82 | + log.info("执行cn.fw.dalaran.server.rocketMQ.SalaryEventConsumer.onMessage()方法获取锁失败, 不消费消息"); | ||
83 | + } | ||
84 | + } | ||
85 | + | ||
86 | +} |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/rocketMQ/StaffLeaveEventConsumer.java
1 | package cn.fw.dalaran.server.rocketMQ; | 1 | package cn.fw.dalaran.server.rocketMQ; |
2 | 2 | ||
3 | -import cn.fw.dalaran.common.constants.DalaranConstants; | 3 | +import cn.fw.dalaran.common.constants.Constants; |
4 | import cn.fw.dalaran.domain.db.Account; | 4 | import cn.fw.dalaran.domain.db.Account; |
5 | import cn.fw.dalaran.service.data.AccountService; | 5 | import cn.fw.dalaran.service.data.AccountService; |
6 | import cn.fw.ehr.sdk.api.mq.StaffLeaveEvent; | 6 | import cn.fw.ehr.sdk.api.mq.StaffLeaveEvent; |
@@ -24,7 +24,7 @@ import java.util.Date; | @@ -24,7 +24,7 @@ import java.util.Date; | ||
24 | @RequiredArgsConstructor | 24 | @RequiredArgsConstructor |
25 | @RocketMQMessageListener( | 25 | @RocketMQMessageListener( |
26 | topic = StaffLeaveEvent.TOPIC, | 26 | topic = StaffLeaveEvent.TOPIC, |
27 | - consumerGroup = DalaranConstants.APPLICATION_NAME + "-" + StaffLeaveEvent.TOPIC) | 27 | + consumerGroup = Constants.APPLICATION_NAME + "-" + StaffLeaveEvent.TOPIC) |
28 | public class StaffLeaveEventConsumer implements RocketMQListener<StaffLeaveEvent> { | 28 | public class StaffLeaveEventConsumer implements RocketMQListener<StaffLeaveEvent> { |
29 | 29 | ||
30 | private final AccountService accountService; | 30 | private final AccountService accountService; |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/task/OtherTask.java
@@ -38,7 +38,8 @@ public class OtherTask { | @@ -38,7 +38,8 @@ public class OtherTask { | ||
38 | .list() | 38 | .list() |
39 | .stream() | 39 | .stream() |
40 | .filter(item -> activityThemeService.themeHaveStopCatchData(item.getEndTime(), 7)) | 40 | .filter(item -> activityThemeService.themeHaveStopCatchData(item.getEndTime(), 7)) |
41 | - .collect(Collectors.toList());// 找到需要审计的主题 | 41 | + .collect(Collectors.toList());// 找到需要删除的主题 |
42 | + themeList.addAll(activityThemeService.getHasDelActivityTheme());// 找到已经逻辑删除的主题 | ||
42 | if (CollectionUtils.isEmpty(themeList)) | 43 | if (CollectionUtils.isEmpty(themeList)) |
43 | return; | 44 | return; |
44 | String tempDir = common.getActivityThemeCoverDir(); | 45 | String tempDir = common.getActivityThemeCoverDir(); |
@@ -48,9 +49,6 @@ public class OtherTask { | @@ -48,9 +49,6 @@ public class OtherTask { | ||
48 | sb.append("activityTheme"); | 49 | sb.append("activityTheme"); |
49 | sb.append(File.separator); | 50 | sb.append(File.separator); |
50 | sb.append(item.getId()); | 51 | sb.append(item.getId()); |
51 | - sb.append("「"); | ||
52 | - sb.append(item.getTheme()); | ||
53 | - sb.append("」"); | ||
54 | String dirPath = sb.toString(); | 52 | String dirPath = sb.toString(); |
55 | File file = new File(dirPath); | 53 | File file = new File(dirPath); |
56 | if (file.isDirectory()) | 54 | if (file.isDirectory()) |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/task/TodoTask.java
1 | package cn.fw.dalaran.server.task; | 1 | package cn.fw.dalaran.server.task; |
2 | 2 | ||
3 | -import cn.fw.dalaran.common.constants.DalaranConstants; | 3 | +import cn.fw.dalaran.common.constants.Constants; |
4 | +import cn.fw.dalaran.common.utils.DateUtil; | ||
4 | import cn.fw.dalaran.domain.db.Account; | 5 | import cn.fw.dalaran.domain.db.Account; |
5 | import cn.fw.dalaran.domain.db.ActivityTheme; | 6 | import cn.fw.dalaran.domain.db.ActivityTheme; |
6 | import cn.fw.dalaran.domain.db.LivePool; | 7 | import cn.fw.dalaran.domain.db.LivePool; |
@@ -52,7 +53,7 @@ public class TodoTask { | @@ -52,7 +53,7 @@ public class TodoTask { | ||
52 | List<TodoHistory> list = todoHistoryService.list(Wrappers.<TodoHistory>lambdaQuery() | 53 | List<TodoHistory> list = todoHistoryService.list(Wrappers.<TodoHistory>lambdaQuery() |
53 | .eq(TodoHistory::getSend, Boolean.FALSE) | 54 | .eq(TodoHistory::getSend, Boolean.FALSE) |
54 | .eq(TodoHistory::getDone, Boolean.FALSE) | 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 | if (CollectionUtils.isEmpty(list)) { | 58 | if (CollectionUtils.isEmpty(list)) { |
58 | return; | 59 | return; |
@@ -60,10 +61,10 @@ public class TodoTask { | @@ -60,10 +61,10 @@ public class TodoTask { | ||
60 | final Map<String, List<TodoHistory>> todoMap = list.stream() | 61 | final Map<String, List<TodoHistory>> todoMap = list.stream() |
61 | .collect(Collectors.groupingBy(TodoHistory::getTodoCode));// 根据待办编码分组 | 62 | .collect(Collectors.groupingBy(TodoHistory::getTodoCode));// 根据待办编码分组 |
62 | final List<TodoHistory> loginAccount = Optional | 63 | final List<TodoHistory> loginAccount = Optional |
63 | - .ofNullable(todoMap.get(DalaranConstants.ACCOUNT_INVALID)) | 64 | + .ofNullable(todoMap.get(Constants.ACCOUNT_INVALID)) |
64 | .orElse(new ArrayList<>()); | 65 | .orElse(new ArrayList<>()); |
65 | final List<TodoHistory> checkLive = Optional | 66 | final List<TodoHistory> checkLive = Optional |
66 | - .ofNullable(todoMap.get(DalaranConstants.CHECK_LIVE)) | 67 | + .ofNullable(todoMap.get(Constants.CHECK_LIVE)) |
67 | .orElse(new ArrayList<>()); | 68 | .orElse(new ArrayList<>()); |
68 | for (TodoHistory history : loginAccount) {// 处理账号登录待办 | 69 | for (TodoHistory history : loginAccount) {// 处理账号登录待办 |
69 | Account account = accountService.getById(history.getDataId()); | 70 | Account account = accountService.getById(history.getDataId()); |
@@ -116,12 +117,12 @@ public class TodoTask { | @@ -116,12 +117,12 @@ public class TodoTask { | ||
116 | return; | 117 | return; |
117 | } | 118 | } |
118 | for (TodoHistory history : list) { | 119 | for (TodoHistory history : list) { |
119 | - if (Objects.equals(history.getTodoCode(), DalaranConstants.ACCOUNT_INVALID)) {// 账号失效待办 | 120 | + /*if (Objects.equals(history.getTodoCode(), Constants.ACCOUNT_INVALID)) {// 账号失效待办 |
120 | Account account = accountService.getById(history.getDataId()); | 121 | Account account = accountService.getById(history.getDataId()); |
121 | if (Objects.isNull(account)) { | 122 | if (Objects.isNull(account)) { |
122 | continue; | 123 | continue; |
123 | } | 124 | } |
124 | - } | 125 | + }*/ |
125 | BackLogItemDTO dto = new BackLogItemDTO(history.getUserId(), history.getTodoCode(), | 126 | BackLogItemDTO dto = new BackLogItemDTO(history.getUserId(), history.getTodoCode(), |
126 | history.getDataId().toString(), new Date(), history.getShopId());// 构造待办参数 | 127 | history.getDataId().toString(), new Date(), history.getShopId());// 构造待办参数 |
127 | if (todoRpcService.complete(dto)) { | 128 | if (todoRpcService.complete(dto)) { |
@@ -136,15 +137,24 @@ public class TodoTask { | @@ -136,15 +137,24 @@ public class TodoTask { | ||
136 | */ | 137 | */ |
137 | @Scheduled(fixedRate = 15 * 60 * 1000, initialDelay = 5 * 1000) | 138 | @Scheduled(fixedRate = 15 * 60 * 1000, initialDelay = 5 * 1000) |
138 | public void sendLiveCheckBacklog() { | 139 | public void sendLiveCheckBacklog() { |
140 | + this.sendLiveCheckBacklog(System.currentTimeMillis()); | ||
141 | + } | ||
142 | + | ||
143 | + /** | ||
144 | + * 发送直播审计待办 | ||
145 | + * | ||
146 | + * @param timeStamp 指定时间 | ||
147 | + */ | ||
148 | + public void sendLiveCheckBacklog(Long timeStamp) { | ||
139 | final List<ActivityTheme> themeList = activityThemeService.lambdaQuery() | 149 | final List<ActivityTheme> themeList = activityThemeService.lambdaQuery() |
140 | - .gt(ActivityTheme::getEndTime, new Date(System.currentTimeMillis() - 7 * 24 * 3600 * 1000)) | 150 | + .gt(ActivityTheme::getEndTime, new Date(timeStamp - 7 * 24 * 3600 * 1000)) |
141 | .list() | 151 | .list() |
142 | .stream() | 152 | .stream() |
143 | .filter(item -> { | 153 | .filter(item -> { |
144 | - final long timeSub = System.currentTimeMillis() - item.getEndTime().getTime(); | 154 | + final long timeSub = timeStamp - item.getEndTime().getTime(); |
145 | return 24 * 3600 * 1000 < timeSub && timeSub < 2 * 24 * 3600 * 1000; | 155 | return 24 * 3600 * 1000 < timeSub && timeSub < 2 * 24 * 3600 * 1000; |
146 | }) | 156 | }) |
147 | - .collect(Collectors.toList());// 找到需要审计的主题 | 157 | + .collect(Collectors.toList());// 找到(理论上)需要审计的主题 |
148 | if (CollectionUtils.isEmpty(themeList)) | 158 | if (CollectionUtils.isEmpty(themeList)) |
149 | return; | 159 | return; |
150 | final List<LivePool> bestLives = livePoolService.lambdaQuery() | 160 | final List<LivePool> bestLives = livePoolService.lambdaQuery() |
@@ -155,8 +165,9 @@ public class TodoTask { | @@ -155,8 +165,9 @@ public class TodoTask { | ||
155 | .eq(LivePool::getValidLive, 11) | 165 | .eq(LivePool::getValidLive, 11) |
156 | .list();// 找到主题对应的所有人的最佳直播 | 166 | .list();// 找到主题对应的所有人的最佳直播 |
157 | final List<Long> waitCheckThemeIds = bestLives.stream() | 167 | final List<Long> waitCheckThemeIds = bestLives.stream() |
158 | - .map(LivePool::getThemeId).distinct() | ||
159 | - .collect(Collectors.toList());// 找到需要审核的主题id集合 | 168 | + .map(LivePool::getThemeId) |
169 | + .distinct() | ||
170 | + .collect(Collectors.toList());// 根据最佳直播分布, 找到(真正)需要审核的主题id集合 | ||
160 | if (CollectionUtils.isEmpty(waitCheckThemeIds)) | 171 | if (CollectionUtils.isEmpty(waitCheckThemeIds)) |
161 | return; | 172 | return; |
162 | final List<Long> usersInShopIds = accountService.lambdaQuery() | 173 | final List<Long> usersInShopIds = accountService.lambdaQuery() |
@@ -170,13 +181,13 @@ public class TodoTask { | @@ -170,13 +181,13 @@ public class TodoTask { | ||
170 | .distinct()// 祛除重复门店 | 181 | .distinct()// 祛除重复门店 |
171 | .collect(Collectors.toList());// 最佳直播的账户分布在对应的门店id集合 | 182 | .collect(Collectors.toList());// 最佳直播的账户分布在对应的门店id集合 |
172 | final List<ActivityThemeVo> themeVos = themeList.stream() | 183 | final List<ActivityThemeVo> themeVos = themeList.stream() |
173 | - .filter(item -> waitCheckThemeIds.contains(item.getId())) | 184 | + .filter(item -> waitCheckThemeIds.contains(item.getId()))// 过滤出(真正)需要审核的主题 |
174 | .map(ActivityTheme::toVO) | 185 | .map(ActivityTheme::toVO) |
175 | .collect(Collectors.toList());// 将主题转换成vo | 186 | .collect(Collectors.toList());// 将主题转换成vo |
176 | if (CollectionUtils.isEmpty(themeVos)) | 187 | if (CollectionUtils.isEmpty(themeVos)) |
177 | return; | 188 | return; |
178 | List<TodoHistory> hasSaveTodo = todoHistoryService.lambdaQuery() | 189 | List<TodoHistory> hasSaveTodo = todoHistoryService.lambdaQuery() |
179 | - .eq(TodoHistory::getTodoCode, DalaranConstants.CHECK_LIVE) | 190 | + .eq(TodoHistory::getTodoCode, Constants.CHECK_LIVE) |
180 | .in(TodoHistory::getDataId, themeVos.stream() | 191 | .in(TodoHistory::getDataId, themeVos.stream() |
181 | .map(ActivityThemeVo::getId) | 192 | .map(ActivityThemeVo::getId) |
182 | .collect(Collectors.toList()) | 193 | .collect(Collectors.toList()) |
@@ -186,12 +197,12 @@ public class TodoTask { | @@ -186,12 +197,12 @@ public class TodoTask { | ||
186 | .stream() | 197 | .stream() |
187 | .map(item -> {// 遍历每个门店 | 198 | .map(item -> {// 遍历每个门店 |
188 | TodoHistory todo = new TodoHistory(); | 199 | TodoHistory todo = new TodoHistory(); |
189 | - List<UserInfoDTO> users = userRoleRpcService.getUsers(item, DalaranConstants.ZBSJ_ROLE_CODE);// 获取门店拥有'直播审计'角色的人 | ||
190 | - if (users.size() > 0) { | 200 | + List<UserInfoDTO> users = userRoleRpcService.getUsers(item, Constants.ZBSJ_ROLE_CODE);// 获取门店拥有'直播审计'角色的人 |
201 | + if (!users.isEmpty()) { | ||
191 | todo.setSend(false); | 202 | todo.setSend(false); |
192 | todo.setDone(false); | 203 | todo.setDone(false); |
193 | todo.setTodoDone(false); | 204 | todo.setTodoDone(false); |
194 | - todo.setTodoCode(DalaranConstants.CHECK_LIVE); | 205 | + todo.setTodoCode(Constants.CHECK_LIVE); |
195 | todo.setDataId(themeVos.stream() | 206 | todo.setDataId(themeVos.stream() |
196 | .filter(item1 -> item1.getShopIds().contains(item)) | 207 | .filter(item1 -> item1.getShopIds().contains(item)) |
197 | .collect(Collectors.toList()) | 208 | .collect(Collectors.toList()) |
@@ -205,7 +216,7 @@ public class TodoTask { | @@ -205,7 +216,7 @@ public class TodoTask { | ||
205 | }) | 216 | }) |
206 | .filter(item -> Objects.nonNull(item.getTodoCode())) | 217 | .filter(item -> Objects.nonNull(item.getTodoCode())) |
207 | .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> | 218 | .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> |
208 | - new TreeSet<>(Comparator.comparing(TodoHistory::getDataId))), ArrayList::new) | 219 | + new TreeSet<>(Comparator.comparing(TodoHistory::getRemoveDuplicatesCondition))), ArrayList::new) |
209 | ); | 220 | ); |
210 | if (!Objects.equals(hasSaveTodo.size(), 0) && Objects.equals(collect.size(), hasSaveTodo.size())) | 221 | if (!Objects.equals(hasSaveTodo.size(), 0) && Objects.equals(collect.size(), hasSaveTodo.size())) |
211 | return; | 222 | return; |
fw-dalaran-server/src/main/resources/application-dev.yml
@@ -23,3 +23,8 @@ logging: | @@ -23,3 +23,8 @@ logging: | ||
23 | nacos: | 23 | nacos: |
24 | plugin: | 24 | plugin: |
25 | namespace: df959b8c-de58-4d02-b9fb-d65ca3be05f3 | 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
@@ -12,8 +12,14 @@ nacos: | @@ -12,8 +12,14 @@ nacos: | ||
12 | spring: | 12 | spring: |
13 | application: | 13 | application: |
14 | name: fw-dalaran-local | 14 | name: fw-dalaran-local |
15 | + banner: | ||
16 | + location: "classpath:banner.txt" | ||
17 | + redis: | ||
18 | + host: 172.26.154.169 | ||
19 | + password: fw@test@redis | ||
20 | + port: 6378 | ||
15 | rocketmq: | 21 | rocketmq: |
16 | -# name-server: 192.168.0.230:9876 | 22 | + # name-server: 192.168.0.230:9876 |
17 | name-server: 172.26.154.169:9876 | 23 | name-server: 172.26.154.169:9876 |
18 | producer: | 24 | producer: |
19 | group: ${spring.application.name} | 25 | group: ${spring.application.name} |
@@ -27,4 +33,7 @@ jedis: | @@ -27,4 +33,7 @@ jedis: | ||
27 | pwd: fw@test@redis | 33 | pwd: fw@test@redis |
28 | port: 6378 | 34 | port: 6378 |
29 | 35 | ||
30 | -file-server-addr: 'http://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,4 +51,7 @@ rocketmq: | ||
51 | task: | 51 | task: |
52 | switch: 'on' | 52 | switch: 'on' |
53 | 53 | ||
54 | -file-server-addr: 'http://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-server/src/main/resources/application-test.yml
fw-dalaran-server/src/main/resources/application.yml
1 | spring: | 1 | spring: |
2 | + banner: | ||
3 | + charset: US-ASCII | ||
2 | application: | 4 | application: |
3 | name: fw-dalaran | 5 | name: fw-dalaran |
4 | attachment: | 6 | attachment: |
@@ -112,3 +114,20 @@ logbook: | @@ -112,3 +114,20 @@ logbook: | ||
112 | task: | 114 | task: |
113 | switch: 'on' | 115 | switch: 'on' |
114 | todocode: 'xiOMX9KlMg' | 116 | todocode: 'xiOMX9KlMg' |
117 | + | ||
118 | +management: | ||
119 | + endpoints: | ||
120 | + web: | ||
121 | + exposure: | ||
122 | + include: '*' | ||
123 | + # 监控路径前缀 | ||
124 | + base-path: /actuator | ||
125 | + endpoint: | ||
126 | + # 开启允许远程shutdown,通过post请求。 | ||
127 | + shutdown: | ||
128 | + enabled: true | ||
129 | + health: | ||
130 | + show-details: always | ||
131 | + metrics: | ||
132 | + tags: | ||
133 | + application: ${spring.application.name} |
fw-dalaran-service/pom.xml
@@ -114,14 +114,14 @@ | @@ -114,14 +114,14 @@ | ||
114 | <groupId>com.baomidou</groupId> | 114 | <groupId>com.baomidou</groupId> |
115 | <artifactId>mybatis-plus-boot-starter</artifactId> | 115 | <artifactId>mybatis-plus-boot-starter</artifactId> |
116 | </dependency> | 116 | </dependency> |
117 | - <dependency> | 117 | + <!--<dependency> |
118 | <groupId>com.baomidou</groupId> | 118 | <groupId>com.baomidou</groupId> |
119 | <artifactId>mybatis-plus-generator</artifactId> | 119 | <artifactId>mybatis-plus-generator</artifactId> |
120 | </dependency> | 120 | </dependency> |
121 | <dependency> | 121 | <dependency> |
122 | <groupId>org.apache.velocity</groupId> | 122 | <groupId>org.apache.velocity</groupId> |
123 | <artifactId>velocity-engine-core</artifactId> | 123 | <artifactId>velocity-engine-core</artifactId> |
124 | - </dependency> | 124 | + </dependency>--> |
125 | <!-- mybatis-plus 代码生成器 end --> | 125 | <!-- mybatis-plus 代码生成器 end --> |
126 | </dependencies> | 126 | </dependencies> |
127 | 127 |
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/biz/AccountBizService.java
@@ -2,7 +2,7 @@ package cn.fw.dalaran.service.biz; | @@ -2,7 +2,7 @@ package cn.fw.dalaran.service.biz; | ||
2 | 2 | ||
3 | import cn.fw.common.page.AppPage; | 3 | import cn.fw.common.page.AppPage; |
4 | import cn.fw.common.web.annotation.DisLock; | 4 | import cn.fw.common.web.annotation.DisLock; |
5 | -import cn.fw.dalaran.common.constants.DalaranConstants; | 5 | +import cn.fw.dalaran.common.constants.Constants; |
6 | import cn.fw.dalaran.common.exception.BusinessException; | 6 | import cn.fw.dalaran.common.exception.BusinessException; |
7 | import cn.fw.dalaran.common.utils.DateUtil; | 7 | import cn.fw.dalaran.common.utils.DateUtil; |
8 | import cn.fw.dalaran.domain.db.Account; | 8 | import cn.fw.dalaran.domain.db.Account; |
@@ -10,6 +10,7 @@ import cn.fw.dalaran.domain.db.TodoHistory; | @@ -10,6 +10,7 @@ import cn.fw.dalaran.domain.db.TodoHistory; | ||
10 | import cn.fw.dalaran.domain.dto.AccountDTO; | 10 | import cn.fw.dalaran.domain.dto.AccountDTO; |
11 | import cn.fw.dalaran.domain.dto.AccountQueryDTO; | 11 | import cn.fw.dalaran.domain.dto.AccountQueryDTO; |
12 | import cn.fw.dalaran.domain.dto.UpdateAccountParam; | 12 | import cn.fw.dalaran.domain.dto.UpdateAccountParam; |
13 | +import cn.fw.dalaran.domain.enums.AccountStatusEnum; | ||
13 | import cn.fw.dalaran.domain.enums.PlatformEnum; | 14 | import cn.fw.dalaran.domain.enums.PlatformEnum; |
14 | import cn.fw.dalaran.domain.vo.AccountStatusVo; | 15 | import cn.fw.dalaran.domain.vo.AccountStatusVo; |
15 | import cn.fw.dalaran.domain.vo.AccountVO; | 16 | import cn.fw.dalaran.domain.vo.AccountVO; |
@@ -40,8 +41,8 @@ import static cn.fw.common.businessvalidator.Validator.BV; | @@ -40,8 +41,8 @@ import static cn.fw.common.businessvalidator.Validator.BV; | ||
40 | @RequiredArgsConstructor | 41 | @RequiredArgsConstructor |
41 | public class AccountBizService { | 42 | public class AccountBizService { |
42 | 43 | ||
43 | - private final AccountService accountService; | ||
44 | - private final TodoHistoryService todoHistoryService; | 44 | + private final AccountService accountService;// 账号业务 |
45 | + private final TodoHistoryService todoHistoryService;// 待办业务 | ||
45 | private final UserRoleRpcService userRoleRpcService; | 46 | private final UserRoleRpcService userRoleRpcService; |
46 | 47 | ||
47 | /** | 48 | /** |
@@ -112,9 +113,9 @@ public class AccountBizService { | @@ -112,9 +113,9 @@ public class AccountBizService { | ||
112 | history.setDataId(account1.getId()); | 113 | history.setDataId(account1.getId()); |
113 | history.setShopId(account1.getShopId()); | 114 | history.setShopId(account1.getShopId()); |
114 | history.setUserId(account1.getUserId()); | 115 | history.setUserId(account1.getUserId()); |
115 | - history.setTodoCode(DalaranConstants.ACCOUNT_INVALID); | 116 | + history.setTodoCode(Constants.ACCOUNT_INVALID); |
116 | todos.add(history); | 117 | todos.add(history); |
117 | - List<UserInfoDTO> users = userRoleRpcService.getUsers(account1.getShopId(), DalaranConstants.ZHSZ_ROLE_CODE); | 118 | + List<UserInfoDTO> users = userRoleRpcService.getUsers(account1.getShopId(), Constants.ZHSZ_ROLE_CODE); |
118 | if (!CollectionUtils.isEmpty(users)) { | 119 | if (!CollectionUtils.isEmpty(users)) { |
119 | Long managerId = users.get(0).getUserId(); | 120 | Long managerId = users.get(0).getUserId(); |
120 | TodoHistory manageTodo = new TodoHistory(); | 121 | TodoHistory manageTodo = new TodoHistory(); |
@@ -128,7 +129,7 @@ public class AccountBizService { | @@ -128,7 +129,7 @@ public class AccountBizService { | ||
128 | .map(Account::getId) | 129 | .map(Account::getId) |
129 | .collect(Collectors.toList());// 失败账号id | 130 | .collect(Collectors.toList());// 失败账号id |
130 | List<TodoHistory> todayHasSendList = todoHistoryService.lambdaQuery() | 131 | List<TodoHistory> todayHasSendList = todoHistoryService.lambdaQuery() |
131 | - .eq(TodoHistory::getTodoCode, DalaranConstants.ACCOUNT_INVALID) | 132 | + .eq(TodoHistory::getTodoCode, Constants.ACCOUNT_INVALID) |
132 | .in(!CollectionUtils.isEmpty(waitSendIds), TodoHistory::getDataId, waitSendIds) | 133 | .in(!CollectionUtils.isEmpty(waitSendIds), TodoHistory::getDataId, waitSendIds) |
133 | .last(" and DATEDIFF(create_time, NOW()) = 0") | 134 | .last(" and DATEDIFF(create_time, NOW()) = 0") |
134 | .list(); | 135 | .list(); |
@@ -256,8 +257,8 @@ public class AccountBizService { | @@ -256,8 +257,8 @@ public class AccountBizService { | ||
256 | .eq(Account::getAffirm, Boolean.TRUE) | 257 | .eq(Account::getAffirm, Boolean.TRUE) |
257 | .eq(Account::getValid, Boolean.TRUE) | 258 | .eq(Account::getValid, Boolean.TRUE) |
258 | .eq(Account::getType, platformEnum) | 259 | .eq(Account::getType, platformEnum) |
259 | - .ne(Account::getAccountStatus, -1) | ||
260 | - //.eq(Account::getAccountStatus, 1) | 260 | + .ne(Account::getAccountStatus, AccountStatusEnum.HAS_LEAVE.getValue()) |
261 | + //.eq(Account::getAccountStatus, AccountStatusEnum.IN_WORK.getValue()) | ||
261 | .eq(Account::getYn, Boolean.TRUE) | 262 | .eq(Account::getYn, Boolean.TRUE) |
262 | ); | 263 | ); |
263 | if (CollectionUtils.isEmpty(list)) { | 264 | if (CollectionUtils.isEmpty(list)) { |
@@ -281,6 +282,11 @@ public class AccountBizService { | @@ -281,6 +282,11 @@ public class AccountBizService { | ||
281 | */ | 282 | */ |
282 | @Transactional(rollbackFor = Exception.class) | 283 | @Transactional(rollbackFor = Exception.class) |
283 | public boolean deleteAccount(Long id) { | 284 | public boolean deleteAccount(Long id) { |
285 | + todoHistoryService.lambdaUpdate() | ||
286 | + .eq(TodoHistory::getDataId, id) | ||
287 | + .eq(TodoHistory::getTodoCode, Constants.ACCOUNT_INVALID) | ||
288 | + .set(TodoHistory::getDone, Boolean.TRUE) | ||
289 | + .update();// 账号删除完成登录待办 | ||
284 | return accountService.lambdaUpdate() | 290 | return accountService.lambdaUpdate() |
285 | .eq(Account::getId, id) | 291 | .eq(Account::getId, id) |
286 | .set(Account::getYn, 0) | 292 | .set(Account::getYn, 0) |
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/biz/CommonBizService.java
@@ -781,8 +781,9 @@ public class CommonBizService { | @@ -781,8 +781,9 @@ public class CommonBizService { | ||
781 | } | 781 | } |
782 | 782 | ||
783 | public static void main(String[] args) { | 783 | public static void main(String[] args) { |
784 | - String workTitle = "#长安汽车618闪购 #长安univ #自有引力"; | ||
785 | - String setTopic = "#618厂店联动团购会#长安汽车618闪购#嗨购618团购会"; | 784 | + System.out.println(System.getProperty("java.io.tmpdir")); |
785 | + String workTitle = "#现车加\\\"免\\\"开新过新年"; | ||
786 | + String setTopic = "#温暖回家路提现车过新年,#现车加\\免\\开新过新年,#温暖回家路春节不打烊,#开年有礼大展宏兔,#智电超能体验,#开新年夜FUN,#温暖回家路一路有你,#展厅实车带货UNI-K iDD".replace(",", ""); | ||
786 | Set<String> strings1 = processTags(workTitle); | 787 | Set<String> strings1 = processTags(workTitle); |
787 | Set<String> strings2 = processTags(setTopic); | 788 | Set<String> strings2 = processTags(setTopic); |
788 | System.out.println(CollectionUtils.containsAny(strings1, strings2)); | 789 | System.out.println(CollectionUtils.containsAny(strings1, strings2)); |
@@ -841,7 +842,7 @@ public class CommonBizService { | @@ -841,7 +842,7 @@ public class CommonBizService { | ||
841 | resultSet.retainAll(configTags);// 交集 | 842 | resultSet.retainAll(configTags);// 交集 |
842 | //resultSet.removeAll(configTags);// 差集 | 843 | //resultSet.removeAll(configTags);// 差集 |
843 | //resultSet.addAll(configTags);// 并集 | 844 | //resultSet.addAll(configTags);// 并集 |
844 | - containsTag = resultSet.size() > 0; | 845 | + containsTag = !resultSet.isEmpty(); |
845 | } else {// LCS计算话题匹配度 | 846 | } else {// LCS计算话题匹配度 |
846 | for (String configTag : configTags) { | 847 | for (String configTag : configTags) { |
847 | for (String tag : tags) { | 848 | for (String tag : tags) { |
@@ -971,17 +972,17 @@ public class CommonBizService { | @@ -971,17 +972,17 @@ public class CommonBizService { | ||
971 | public BigDecimal validCover(String theme, Long themeId, String fileId, String coverUrl, String account, String itemId, Integer type) throws Exception { | 972 | public BigDecimal validCover(String theme, Long themeId, String fileId, String coverUrl, String account, String itemId, Integer type) throws Exception { |
972 | int[][] imagePixArr1;// 图片1的像素数组 | 973 | int[][] imagePixArr1;// 图片1的像素数组 |
973 | int[][] imagePixArr2;// 图片2的像素数组 | 974 | int[][] imagePixArr2;// 图片2的像素数组 |
974 | - File imageFile1 = this.findLocalCacheImageTheme(theme, themeId, fileId); | 975 | + File imageFile1 = this.findLocalCacheImageTheme(/*theme,*/ themeId, fileId); |
975 | imagePixArr1 = ImageUtils.readImagePixel(imageFile1); | 976 | imagePixArr1 = ImageUtils.readImagePixel(imageFile1); |
976 | File imageFile2; | 977 | File imageFile2; |
977 | - File localCacheImage = this.findLocalCacheImageUser(theme, themeId, account, itemId, type); | 978 | + File localCacheImage = this.findLocalCacheImageUser(/*theme,*/ themeId, account, itemId, type); |
978 | if (Objects.nonNull(localCacheImage)) { | 979 | if (Objects.nonNull(localCacheImage)) { |
979 | imageFile2 = localCacheImage; | 980 | imageFile2 = localCacheImage; |
980 | } else { | 981 | } else { |
981 | imageFile2 = ImageUtils.convertFileByUrl(coverUrl, itemId); | 982 | imageFile2 = ImageUtils.convertFileByUrl(coverUrl, itemId); |
982 | String tempDir = common.getActivityThemeCoverDir(); | 983 | String tempDir = common.getActivityThemeCoverDir(); |
983 | File file = new File(ImageUtils.modifyResolution1(imageFile2.getPath(), | 984 | File file = new File(ImageUtils.modifyResolution1(imageFile2.getPath(), |
984 | - tempDir + "activityTheme" + File.separator + themeId + "「" + theme + "」" + File.separator + account + File.separator + (Objects.equals(type, 1) ? "video" : "live"), | 985 | + tempDir + "activityTheme" + File.separator + themeId /*+ "#" + theme*/ + File.separator + account + File.separator + (Objects.equals(type, 1) ? "video" : "live"), |
985 | "fw_theme_cover_" + itemId, | 986 | "fw_theme_cover_" + itemId, |
986 | 512, 512)); | 987 | 512, 512)); |
987 | if (imageFile2.delete()) { | 988 | if (imageFile2.delete()) { |
@@ -989,7 +990,7 @@ public class CommonBizService { | @@ -989,7 +990,7 @@ public class CommonBizService { | ||
989 | } | 990 | } |
990 | } | 991 | } |
991 | imagePixArr2 = ImageUtils.readImagePixel(imageFile2); | 992 | imagePixArr2 = ImageUtils.readImagePixel(imageFile2); |
992 | - String msg = String.format("\n 主题: %s\n 设置封面文件id: %s\n 账户号: %s\n %s%s\n", theme, fileId, account, Objects.equals(type, 1) ? "短视频id: " : "直播间号: ", itemId); | 993 | + String msg = String.format("\n 主题id: %s \n 主题名: %s\n 设置封面文件id: %s\n 账户号: %s\n %s%s\n", themeId, theme, fileId, account, Objects.equals(type, 1) ? "短视频id: " : "直播间号: ", itemId); |
993 | return BigDecimal.valueOf(ImageUtils.calcSimilarity(ImageUtils.getFingerprint(imagePixArr1), ImageUtils.getFingerprint(imagePixArr2), msg)); | 994 | return BigDecimal.valueOf(ImageUtils.calcSimilarity(ImageUtils.getFingerprint(imagePixArr1), ImageUtils.getFingerprint(imagePixArr2), msg)); |
994 | } | 995 | } |
995 | 996 | ||
@@ -1002,9 +1003,9 @@ public class CommonBizService { | @@ -1002,9 +1003,9 @@ public class CommonBizService { | ||
1002 | * @param itemId 视频id/直播间id | 1003 | * @param itemId 视频id/直播间id |
1003 | * @param type 1:视频, 2:直播 | 1004 | * @param type 1:视频, 2:直播 |
1004 | */ | 1005 | */ |
1005 | - private File findLocalCacheImageUser(String theme, Long themeId, String account, String itemId, Integer type) { | 1006 | + private File findLocalCacheImageUser(/*String theme,*/ Long themeId, String account, String itemId, Integer type) { |
1006 | String tempDir = common.getActivityThemeCoverDir(); | 1007 | String tempDir = common.getActivityThemeCoverDir(); |
1007 | - File file = new File(tempDir + File.separator + "activityTheme" + File.separator + themeId + "「" + theme + "」" + File.separator + account + File.separator + (Objects.equals(type, 1) ? "video" : "live")); | 1008 | + File file = new File(tempDir + File.separator + "activityTheme" + File.separator + themeId /*+ "#" + theme*/ + File.separator + account + File.separator + (Objects.equals(type, 1) ? "video" : "live")); |
1008 | if (!file.exists()) { | 1009 | if (!file.exists()) { |
1009 | boolean mkdirs = file.mkdirs(); | 1010 | boolean mkdirs = file.mkdirs(); |
1010 | if (mkdirs) | 1011 | if (mkdirs) |
@@ -1021,15 +1022,15 @@ public class CommonBizService { | @@ -1021,15 +1022,15 @@ public class CommonBizService { | ||
1021 | } | 1022 | } |
1022 | 1023 | ||
1023 | /** | 1024 | /** |
1024 | - * 获取本地已下载的主题背景图 | 1025 | + * 获取本地已下载的主题背景图(主题预设封面图) |
1025 | * | 1026 | * |
1026 | * @param theme 主题名 | 1027 | * @param theme 主题名 |
1027 | * @param themeId 主题id | 1028 | * @param themeId 主题id |
1028 | * @param fileId 文件id(主题配置指定封面图文件) | 1029 | * @param fileId 文件id(主题配置指定封面图文件) |
1029 | */ | 1030 | */ |
1030 | - private File findLocalCacheImageTheme(String theme, Long themeId, String fileId) { | 1031 | + private File findLocalCacheImageTheme(/*String theme,*/ Long themeId, String fileId) { |
1031 | String tempDir = common.getActivityThemeCoverDir(); | 1032 | String tempDir = common.getActivityThemeCoverDir(); |
1032 | - File file = new File(tempDir + "activityTheme" + File.separator + themeId + "「" + theme + "」" + File.separator + "settingCover"); | 1033 | + File file = new File(tempDir + "activityTheme" + File.separator + themeId /*+ "#" + theme*/ + File.separator + "settingCover"); |
1033 | if (!file.exists()) { | 1034 | if (!file.exists()) { |
1034 | boolean mkdirs = file.mkdirs(); | 1035 | boolean mkdirs = file.mkdirs(); |
1035 | if (mkdirs) | 1036 | if (mkdirs) |
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/biz/OtherBizService.java
1 | package cn.fw.dalaran.service.biz; | 1 | package cn.fw.dalaran.service.biz; |
2 | 2 | ||
3 | -import cn.fw.dalaran.common.constants.DalaranConstants; | 3 | +import cn.fw.dalaran.common.ConfigProperties; |
4 | +import cn.fw.dalaran.common.constants.Constants; | ||
4 | import cn.fw.dalaran.common.exception.BusinessException; | 5 | import cn.fw.dalaran.common.exception.BusinessException; |
5 | import cn.fw.dalaran.common.utils.PublicUtil; | 6 | import cn.fw.dalaran.common.utils.PublicUtil; |
6 | import cn.fw.dalaran.common.utils.StringUtils; | 7 | import cn.fw.dalaran.common.utils.StringUtils; |
@@ -43,6 +44,7 @@ import java.util.stream.Collectors; | @@ -43,6 +44,7 @@ import java.util.stream.Collectors; | ||
43 | public class OtherBizService { | 44 | public class OtherBizService { |
44 | @Value("${spring.profiles.active}") | 45 | @Value("${spring.profiles.active}") |
45 | private String env;// 获取系统当前环境 | 46 | private String env;// 获取系统当前环境 |
47 | + private final ConfigProperties configProperties; | ||
46 | private final ActivityThemeService activityThemeService; | 48 | private final ActivityThemeService activityThemeService; |
47 | private final LivePoolService livePoolService; | 49 | private final LivePoolService livePoolService; |
48 | private final LiveCheckResultService liveCheckResultService; | 50 | private final LiveCheckResultService liveCheckResultService; |
@@ -58,10 +60,10 @@ public class OtherBizService { | @@ -58,10 +60,10 @@ public class OtherBizService { | ||
58 | * @param themeId 主题id | 60 | * @param themeId 主题id |
59 | * @return 审计视图 | 61 | * @return 审计视图 |
60 | */ | 62 | */ |
61 | - @Transactional | 63 | + @Transactional(rollbackFor = Exception.class) |
62 | public LiveCheckVo getLiveCheck(Long userId, Long themeId) { | 64 | public LiveCheckVo getLiveCheck(Long userId, Long themeId) { |
63 | LiveCheckVo vo = new LiveCheckVo(); | 65 | LiveCheckVo vo = new LiveCheckVo(); |
64 | - final List<ShopMsg> userRoleRange = userRoleRpcService.getUserRoleRange(userId, DalaranConstants.ZBSJ_ROLE_CODE);// 查询用户角色授权范围 | 66 | + final List<ShopMsg> userRoleRange = userRoleRpcService.getUserRoleRange(userId, Constants.ZBSJ_ROLE_CODE);// 查询用户角色授权范围 |
65 | List<LiveCheckResult> waitCheckLives = new ArrayList<>(); | 67 | List<LiveCheckResult> waitCheckLives = new ArrayList<>(); |
66 | List<LiveCheckResult> list = liveCheckResultService.lambdaQuery() | 68 | List<LiveCheckResult> list = liveCheckResultService.lambdaQuery() |
67 | .eq(LiveCheckResult::getThemeId, themeId) | 69 | .eq(LiveCheckResult::getThemeId, themeId) |
@@ -103,13 +105,13 @@ public class OtherBizService { | @@ -103,13 +105,13 @@ public class OtherBizService { | ||
103 | } | 105 | } |
104 | if (!CollectionUtils.isEmpty(waitCheckLives)) { | 106 | if (!CollectionUtils.isEmpty(waitCheckLives)) { |
105 | vo.setTheme(ActivityTheme.toVO(Objects.requireNonNull(activityThemeService.getById(themeId)))); | 107 | vo.setTheme(ActivityTheme.toVO(Objects.requireNonNull(activityThemeService.getById(themeId)))); |
106 | - vo.setLiveList(PublicUtil.copyList(waitCheckLives, LiveCheckVo.liveSummary.class).stream() | 108 | + vo.setLiveList(PublicUtil.copyList(waitCheckLives, LiveCheckVo.LiveSummary.class).stream() |
107 | .peek(item -> { | 109 | .peek(item -> { |
108 | final LivePool live = livePoolService.getById(item.getLiveId()); | 110 | final LivePool live = livePoolService.getById(item.getLiveId()); |
109 | item.setTitle(live.getTitle()); | 111 | item.setTitle(live.getTitle()); |
110 | item.setPlaybackUrl(live.getPlaybackUrl()); | 112 | item.setPlaybackUrl(live.getPlaybackUrl()); |
111 | }) | 113 | }) |
112 | - .sorted(Comparator.comparing(LiveCheckVo.liveSummary::getCounterfeit)) | 114 | + .sorted(Comparator.comparing(LiveCheckVo.LiveSummary::getCounterfeit)) |
113 | .collect(Collectors.toList()) | 115 | .collect(Collectors.toList()) |
114 | ); | 116 | ); |
115 | } | 117 | } |
@@ -123,7 +125,7 @@ public class OtherBizService { | @@ -123,7 +125,7 @@ public class OtherBizService { | ||
123 | * @param param 审核结果 | 125 | * @param param 审核结果 |
124 | * @return 操作结果 | 126 | * @return 操作结果 |
125 | */ | 127 | */ |
126 | - @Transactional | 128 | + @Transactional(rollbackFor = Exception.class) |
127 | public boolean saveCheckResult(Long userId, LiveCheckParams param) { | 129 | public boolean saveCheckResult(Long userId, LiveCheckParams param) { |
128 | final Integer type = param.getType(); | 130 | final Integer type = param.getType(); |
129 | final Long dataId = param.getDataId(); | 131 | final Long dataId = param.getDataId(); |
@@ -172,7 +174,7 @@ public class OtherBizService { | @@ -172,7 +174,7 @@ public class OtherBizService { | ||
172 | liveCheckResult.setValid(Objects.equals(liveCheckResult.getCounterfeit(), 0) && Objects.equals(liveCheckResult.getPay(), 0) ? 1 : 0); | 174 | liveCheckResult.setValid(Objects.equals(liveCheckResult.getCounterfeit(), 0) && Objects.equals(liveCheckResult.getPay(), 0) ? 1 : 0); |
173 | return liveCheckResultService.updateById(liveCheckResult); | 175 | return liveCheckResultService.updateById(liveCheckResult); |
174 | } else if (Objects.equals(type, 1)) {// 完成待办 | 176 | } else if (Objects.equals(type, 1)) {// 完成待办 |
175 | - final List<LiveCheckVo.liveSummary> summaries = this.getLiveCheck(userId, dataId).getLiveList(); | 177 | + final List<LiveCheckVo.LiveSummary> summaries = this.getLiveCheck(userId, dataId).getLiveList(); |
176 | if (summaries.stream().anyMatch(item -> Objects.equals(item.getCounterfeit(), -1))) { | 178 | if (summaries.stream().anyMatch(item -> Objects.equals(item.getCounterfeit(), -1))) { |
177 | throw new BusinessException("还有未完成审核的直播, 请完成所有直播审核后重新提交"); | 179 | throw new BusinessException("还有未完成审核的直播, 请完成所有直播审核后重新提交"); |
178 | } else { | 180 | } else { |
@@ -180,12 +182,12 @@ public class OtherBizService { | @@ -180,12 +182,12 @@ public class OtherBizService { | ||
180 | .set(TodoHistory::getDone, true) | 182 | .set(TodoHistory::getDone, true) |
181 | .eq(TodoHistory::getUserId, userId) | 183 | .eq(TodoHistory::getUserId, userId) |
182 | .eq(TodoHistory::getDataId, dataId) | 184 | .eq(TodoHistory::getDataId, dataId) |
183 | - .eq(TodoHistory::getTodoCode, DalaranConstants.CHECK_LIVE) | 185 | + .eq(TodoHistory::getTodoCode, Constants.CHECK_LIVE) |
184 | .update()) | 186 | .update()) |
185 | throw new BusinessException("完成待办失败"); | 187 | throw new BusinessException("完成待办失败"); |
186 | final List<Long> invalidLiveIds = summaries.stream() | 188 | final List<Long> invalidLiveIds = summaries.stream() |
187 | .filter(item -> Objects.equals(item.getValid(), 0)) | 189 | .filter(item -> Objects.equals(item.getValid(), 0)) |
188 | - .map(LiveCheckVo.liveSummary::getLiveId) | 190 | + .map(LiveCheckVo.LiveSummary::getLiveId) |
189 | .collect(Collectors.toList()); | 191 | .collect(Collectors.toList()); |
190 | if (!CollectionUtils.isEmpty(invalidLiveIds)) { | 192 | if (!CollectionUtils.isEmpty(invalidLiveIds)) { |
191 | ActivityTheme activityTheme = activityThemeService.getById(param.getDataId()); | 193 | ActivityTheme activityTheme = activityThemeService.getById(param.getDataId()); |
@@ -196,7 +198,8 @@ public class OtherBizService { | @@ -196,7 +198,8 @@ public class OtherBizService { | ||
196 | while (!flag && cnt < 5) { | 198 | while (!flag && cnt < 5) { |
197 | if (cnt > 0) | 199 | if (cnt > 0) |
198 | LockSupport.parkNanos(TimeUnit.SECONDS.toNanos(1)); | 200 | LockSupport.parkNanos(TimeUnit.SECONDS.toNanos(1)); |
199 | - 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() + | ||
200 | sdf.format(activityTheme.getEndTime()) | 203 | sdf.format(activityTheme.getEndTime()) |
201 | ); | 204 | ); |
202 | cnt++; | 205 | cnt++; |
@@ -211,7 +214,7 @@ public class OtherBizService { | @@ -211,7 +214,7 @@ public class OtherBizService { | ||
211 | .set(LiveCheckResult::getStatus, type) | 214 | .set(LiveCheckResult::getStatus, type) |
212 | .in(LiveCheckResult::getId, summaries | 215 | .in(LiveCheckResult::getId, summaries |
213 | .stream() | 216 | .stream() |
214 | - .map(LiveCheckVo.liveSummary::getId) | 217 | + .map(LiveCheckVo.LiveSummary::getId) |
215 | .collect(Collectors.toList()) | 218 | .collect(Collectors.toList()) |
216 | ).update(); | 219 | ).update(); |
217 | } | 220 | } |
@@ -225,9 +228,9 @@ public class OtherBizService { | @@ -225,9 +228,9 @@ public class OtherBizService { | ||
225 | * @param id | 228 | * @param id |
226 | * @return | 229 | * @return |
227 | */ | 230 | */ |
228 | - public LiveCheckVo.liveSummary getLiveCheckDetails(Long id) { | 231 | + public LiveCheckVo.LiveSummary getLiveCheckDetails(Long id) { |
229 | final LiveCheckResult checkResult = liveCheckResultService.getById(id); | 232 | final LiveCheckResult checkResult = liveCheckResultService.getById(id); |
230 | - final LiveCheckVo.liveSummary liveSummary = PublicUtil.copy(checkResult, LiveCheckVo.liveSummary.class); | 233 | + final LiveCheckVo.LiveSummary liveSummary = PublicUtil.copy(checkResult, LiveCheckVo.LiveSummary.class); |
231 | final LivePool live = livePoolService.getById(checkResult.getLiveId()); | 234 | final LivePool live = livePoolService.getById(checkResult.getLiveId()); |
232 | liveSummary.setTitle(live.getTitle()); | 235 | liveSummary.setTitle(live.getTitle()); |
233 | liveSummary.setPlaybackUrl(live.getPlaybackUrl()); | 236 | liveSummary.setPlaybackUrl(live.getPlaybackUrl()); |
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/data/ActivityThemeService.java
@@ -111,4 +111,11 @@ public interface ActivityThemeService extends IService<ActivityTheme> { | @@ -111,4 +111,11 @@ public interface ActivityThemeService extends IService<ActivityTheme> { | ||
111 | * @return 主题是否结束数据抓取 | 111 | * @return 主题是否结束数据抓取 |
112 | */ | 112 | */ |
113 | boolean themeHaveStopCatchData(Date themeEndTime, int delayDays); | 113 | boolean themeHaveStopCatchData(Date themeEndTime, int delayDays); |
114 | + | ||
115 | + /** | ||
116 | + * 获取已经逻辑删除的主题列表 | ||
117 | + * | ||
118 | + * @return 已经逻辑删除的主题列表 | ||
119 | + */ | ||
120 | + List<ActivityTheme> getHasDelActivityTheme(); | ||
114 | } | 121 | } |
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/data/impl/ActivityThemeServiceImpl.java
@@ -2,7 +2,8 @@ package cn.fw.dalaran.service.data.impl; | @@ -2,7 +2,8 @@ package cn.fw.dalaran.service.data.impl; | ||
2 | 2 | ||
3 | import cn.fw.common.page.AppPage; | 3 | import cn.fw.common.page.AppPage; |
4 | import cn.fw.common.web.auth.LoginAuthBean; | 4 | import cn.fw.common.web.auth.LoginAuthBean; |
5 | -import cn.fw.dalaran.common.constants.DalaranConstants; | 5 | +import cn.fw.dalaran.common.ConfigProperties; |
6 | +import cn.fw.dalaran.common.constants.Constants; | ||
6 | import cn.fw.dalaran.common.exception.BusinessException; | 7 | import cn.fw.dalaran.common.exception.BusinessException; |
7 | import cn.fw.dalaran.common.utils.DateUtil; | 8 | import cn.fw.dalaran.common.utils.DateUtil; |
8 | import cn.fw.dalaran.common.utils.ImageUtils; | 9 | import cn.fw.dalaran.common.utils.ImageUtils; |
@@ -35,7 +36,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | @@ -35,7 +36,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
35 | import com.google.common.collect.Lists; | 36 | import com.google.common.collect.Lists; |
36 | import lombok.RequiredArgsConstructor; | 37 | import lombok.RequiredArgsConstructor; |
37 | import lombok.extern.slf4j.Slf4j; | 38 | import lombok.extern.slf4j.Slf4j; |
38 | -import org.springframework.beans.factory.annotation.Value; | ||
39 | import org.springframework.context.event.EventListener; | 39 | import org.springframework.context.event.EventListener; |
40 | import org.springframework.scheduling.annotation.Async; | 40 | import org.springframework.scheduling.annotation.Async; |
41 | import org.springframework.stereotype.Service; | 41 | import org.springframework.stereotype.Service; |
@@ -59,8 +59,7 @@ import java.util.stream.Collectors; | @@ -59,8 +59,7 @@ import java.util.stream.Collectors; | ||
59 | @RequiredArgsConstructor | 59 | @RequiredArgsConstructor |
60 | public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, ActivityTheme> implements ActivityThemeService { | 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 | private final ActivityThemeDao activityThemeDao; | 63 | private final ActivityThemeDao activityThemeDao; |
65 | private final ConfigGroupService configGroupService; | 64 | private final ConfigGroupService configGroupService; |
66 | private final ThemeFileService themeFileService; | 65 | private final ThemeFileService themeFileService; |
@@ -83,7 +82,14 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti | @@ -83,7 +82,14 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti | ||
83 | return themeList.stream() | 82 | return themeList.stream() |
84 | .anyMatch(item -> validDateOverlap(item.getStartTime(), item.getEndTime(), vo.getStartTime(), vo.getEndTime()) &&// 验证时间重叠 | 83 | .anyMatch(item -> validDateOverlap(item.getStartTime(), item.getEndTime(), vo.getStartTime(), vo.getEndTime()) &&// 验证时间重叠 |
85 | /*(Objects.equals(item.getAllShop(), 1) || vo.getAllShop() || validShopOverlap(Arrays.stream(item.getShopIds().split(",")).map(Long::valueOf).collect(Collectors.toList()), vo.getShopIds()))// 验证门店重叠*/ | 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 | ||
@@ -125,7 +131,7 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti | @@ -125,7 +131,7 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti | ||
125 | * @return | 131 | * @return |
126 | */ | 132 | */ |
127 | @Override | 133 | @Override |
128 | - @Transactional | 134 | + @Transactional(rollbackFor = Exception.class) |
129 | public boolean save(ActivityThemeVo themeVo) { | 135 | public boolean save(ActivityThemeVo themeVo) { |
130 | ConfigGroup configGroup = configGroupService.getById(themeVo.getConfigGroupId()); | 136 | ConfigGroup configGroup = configGroupService.getById(themeVo.getConfigGroupId()); |
131 | ActivityTheme activityTheme = ActivityThemeVo.toDB(themeVo); | 137 | ActivityTheme activityTheme = ActivityThemeVo.toDB(themeVo); |
@@ -140,9 +146,9 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti | @@ -140,9 +146,9 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti | ||
140 | if (result) { | 146 | if (result) { |
141 | erpTaskRpc.setTask(TaskSetReq.<Long>builder() | 147 | erpTaskRpc.setTask(TaskSetReq.<Long>builder() |
142 | .executeTime(new Date(activityTheme.getStartTime().getTime() + 24 * 3600 * 1000L)) | 148 | .executeTime(new Date(activityTheme.getStartTime().getTime() + 24 * 3600 * 1000L)) |
143 | - .system(DalaranConstants.APPLICATION_NAME) | 149 | + .system(Constants.APPLICATION_NAME) |
144 | .param(activityTheme.getId()) | 150 | .param(activityTheme.getId()) |
145 | - .tag(DalaranConstants.INIT_ACCOUNT_STATUS) | 151 | + .tag(Constants.INIT_ACCOUNT_STATUS) |
146 | .build() | 152 | .build() |
147 | ); | 153 | ); |
148 | this.saveFiles(activityTheme.getId(), themeVo.getAllFileDesc()); | 154 | this.saveFiles(activityTheme.getId(), themeVo.getAllFileDesc()); |
@@ -189,7 +195,7 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti | @@ -189,7 +195,7 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti | ||
189 | * @return | 195 | * @return |
190 | */ | 196 | */ |
191 | @Override | 197 | @Override |
192 | - @Transactional | 198 | + @Transactional(rollbackFor = Exception.class) |
193 | public boolean addCover(AddThemeCoverParams params) { | 199 | public boolean addCover(AddThemeCoverParams params) { |
194 | Long themeId = params.getThemeId(); | 200 | Long themeId = params.getThemeId(); |
195 | List<FileDesc> fileList = params.getCovers() | 201 | List<FileDesc> fileList = params.getCovers() |
@@ -363,9 +369,9 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti | @@ -363,9 +369,9 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti | ||
363 | allFileDesc.forEach(item -> { | 369 | allFileDesc.forEach(item -> { |
364 | try { | 370 | try { |
365 | String fileId = item.getFid(); | 371 | String fileId = item.getFid(); |
366 | - File downloadFile = ImageUtils.convertFileByUrl(serverAddr + fileId, fileId); | 372 | + File downloadFile = ImageUtils.convertFileByUrl(configProperties.getShow() + fileId, fileId); |
367 | ImageUtils.modifyResolution1(downloadFile.getPath(), | 373 | ImageUtils.modifyResolution1(downloadFile.getPath(), |
368 | - tempDir + "activityTheme" + File.separator + activityTheme.getId() + "「" + activityTheme.getTheme() + "」" + File.separator + "settingCover", | 374 | + tempDir + "activityTheme" + File.separator + activityTheme.getId() /*+ "#" + activityTheme.getTheme()*/ + File.separator + "settingCover", |
369 | "fw_theme_cover_" + fileId, | 375 | "fw_theme_cover_" + fileId, |
370 | 512, 512); | 376 | 512, 512); |
371 | boolean result = downloadFile.delete(); | 377 | boolean result = downloadFile.delete(); |
@@ -376,6 +382,47 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti | @@ -376,6 +382,47 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti | ||
376 | } | 382 | } |
377 | 383 | ||
378 | /** | 384 | /** |
385 | + * 活动主题数据封面图处理 | ||
386 | + */ | ||
387 | + public static void main(String[] args) { | ||
388 | + int themeId = 85; | ||
389 | + String tempDir = System.getProperty("java.io.tmpdir");// 获取当前环境临时文件夹路径 | ||
390 | + Arrays.asList("26b284da426c41cda324f3a11568991f", | ||
391 | + "417ac7dc65a641aea4153721742bcc71", | ||
392 | + "57610873d190488baa29449d094f31db", | ||
393 | + "5c3dc2e118ed436485185d9e4ee55bff", | ||
394 | + "5e33ad337aa04b44988df9498c5ddd43", | ||
395 | + "5f2caa0b050d4d63b6288ddb64c1748a", | ||
396 | + "5f3650d43fba461588396db5d07ef5c6", | ||
397 | + "71ff5e4eb1e8487c82b2f0f1e45fba3e", | ||
398 | + "721292bc2515482cb49f841a2ec40b1a", | ||
399 | + "78fe2f5e566047c7b6b41d227b77858c", | ||
400 | + "81316e2bb88648119194dfabf986439e", | ||
401 | + "924d99014f7a4223b86a67e669d34b61", | ||
402 | + "a0af2e55e03a4c1c852a6c0e081bc49f", | ||
403 | + "a804bee84e6d4084a123d729abe789fb", | ||
404 | + "b0c6f5ba7e7d4300aea5b1312afb7f55", | ||
405 | + "d478442fe3ee431b916d0f74ce72cf66", | ||
406 | + "d4e2df114e0a42ec8eb3ff3b36a6e168", | ||
407 | + "dd7f88410d124f8b8d15d2f142005ba0", | ||
408 | + "e73c04b8011a45ff8162cfb0750a4aef", | ||
409 | + "ea8d6dcad8d94be4b7234c076fe2363d", | ||
410 | + "ee484477b9fd44ca8c096360312ca212") | ||
411 | + .forEach(item -> { | ||
412 | + try { | ||
413 | + File downloadFile = ImageUtils.convertFileByUrl("https://gate.feewee.cn/file/show?fid=" + item, item); | ||
414 | + ImageUtils.modifyResolution(downloadFile.getPath(), | ||
415 | + tempDir + "activityTheme" + File.separator + themeId /*+ "#" + activityTheme.getTheme()*/ + File.separator + "settingCover", | ||
416 | + "fw_theme_cover_" + item, | ||
417 | + 512, 512); | ||
418 | + boolean result = downloadFile.delete(); | ||
419 | + } catch (Exception e) { | ||
420 | + log.error("下载转换封面图失败", e); | ||
421 | + } | ||
422 | + }); | ||
423 | + } | ||
424 | + | ||
425 | + /** | ||
379 | * 监听器, 收到消息后执行更新主题信息 | 426 | * 监听器, 收到消息后执行更新主题信息 |
380 | * | 427 | * |
381 | * @param msg 消息 | 428 | * @param msg 消息 |
@@ -435,4 +482,14 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti | @@ -435,4 +482,14 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti | ||
435 | );// 设置文件信息 | 482 | );// 设置文件信息 |
436 | } | 483 | } |
437 | 484 | ||
485 | + /** | ||
486 | + * 获取已经逻辑删除的主题列表 | ||
487 | + * | ||
488 | + * @return 已经逻辑删除的主题列表 | ||
489 | + */ | ||
490 | + @Override | ||
491 | + public List<ActivityTheme> getHasDelActivityTheme() { | ||
492 | + return activityThemeDao.getHasDelActivityTheme(); | ||
493 | + } | ||
494 | + | ||
438 | } | 495 | } |
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/data/impl/ConfigGroupServiceImpl.java
1 | package cn.fw.dalaran.service.data.impl; | 1 | package cn.fw.dalaran.service.data.impl; |
2 | 2 | ||
3 | -import cn.fw.dalaran.common.constants.DalaranConstants; | 3 | +import cn.fw.dalaran.common.constants.Constants; |
4 | import cn.fw.dalaran.common.exception.BusinessException; | 4 | import cn.fw.dalaran.common.exception.BusinessException; |
5 | import cn.fw.dalaran.dao.ConfigGroupDao; | 5 | import cn.fw.dalaran.dao.ConfigGroupDao; |
6 | import cn.fw.dalaran.domain.db.ActivityTheme; | 6 | import cn.fw.dalaran.domain.db.ActivityTheme; |
@@ -66,14 +66,15 @@ public class ConfigGroupServiceImpl extends ServiceImpl<ConfigGroupDao, ConfigGr | @@ -66,14 +66,15 @@ public class ConfigGroupServiceImpl extends ServiceImpl<ConfigGroupDao, ConfigGr | ||
66 | * @return | 66 | * @return |
67 | */ | 67 | */ |
68 | @Override | 68 | @Override |
69 | - @Transactional | 69 | + @Transactional(rollbackFor = Exception.class) |
70 | public ConfigGroupVo init(Long userId, Long groupId) { | 70 | public ConfigGroupVo init(Long userId, Long groupId) { |
71 | - if (this.lambdaQuery() | 71 | + if (!this.lambdaQuery() |
72 | .eq(ConfigGroup::getGroupId, groupId) | 72 | .eq(ConfigGroup::getGroupId, groupId) |
73 | .eq(ConfigGroup::getUserId, userId) | 73 | .eq(ConfigGroup::getUserId, userId) |
74 | .eq(ConfigGroup::getAllShop, -2) | 74 | .eq(ConfigGroup::getAllShop, -2) |
75 | - .list().size() > 0) | ||
76 | - throw new BusinessException("该用户存在一个已初始化但未赋值修改的配置组"); | 75 | + .list() |
76 | + .isEmpty() | ||
77 | + ) throw new BusinessException("该用户存在一个已初始化但未赋值修改的配置组"); | ||
77 | ConfigGroup configGroup = new ConfigGroup(); | 78 | ConfigGroup configGroup = new ConfigGroup(); |
78 | configGroup.setUserId(userId); | 79 | configGroup.setUserId(userId); |
79 | configGroup.setGroupId(groupId); | 80 | configGroup.setGroupId(groupId); |
@@ -94,7 +95,7 @@ public class ConfigGroupServiceImpl extends ServiceImpl<ConfigGroupDao, ConfigGr | @@ -94,7 +95,7 @@ public class ConfigGroupServiceImpl extends ServiceImpl<ConfigGroupDao, ConfigGr | ||
94 | * @return | 95 | * @return |
95 | */ | 96 | */ |
96 | @Override | 97 | @Override |
97 | - @Transactional | 98 | + @Transactional(rollbackFor = Exception.class) |
98 | public boolean update(Long userId, ConfigGroupVo param) { | 99 | public boolean update(Long userId, ConfigGroupVo param) { |
99 | if (!Objects.equals(userId, param.getUserId())) | 100 | if (!Objects.equals(userId, param.getUserId())) |
100 | throw new BusinessException("不允许修改别人的配置组"); | 101 | throw new BusinessException("不允许修改别人的配置组"); |
@@ -105,14 +106,14 @@ public class ConfigGroupServiceImpl extends ServiceImpl<ConfigGroupDao, ConfigGr | @@ -105,14 +106,14 @@ public class ConfigGroupServiceImpl extends ServiceImpl<ConfigGroupDao, ConfigGr | ||
105 | .list();// 找到对应集团的所有生效的配置组 | 106 | .list();// 找到对应集团的所有生效的配置组 |
106 | Integer allShop = param.getAllShop(); | 107 | Integer allShop = param.getAllShop(); |
107 | if (Objects.equals(allShop, 1)) {// 本次指定配置是否为全部门店 | 108 | if (Objects.equals(allShop, 1)) {// 本次指定配置是否为全部门店 |
108 | - if (list.size() > 0) throw new BusinessException("该集团已存在门店配置, 新配置不能设置为[全部门店]"); | 109 | + if (!list.isEmpty()) throw new BusinessException("该集团已存在门店配置, 新配置不能设置为[全部门店]"); |
109 | } else if (list.stream().anyMatch(item -> Objects.equals(item.getAllShop(), 1))) {// 已存在的配置组是否有全部门店的 | 110 | } else if (list.stream().anyMatch(item -> Objects.equals(item.getAllShop(), 1))) {// 已存在的配置组是否有全部门店的 |
110 | throw new BusinessException("该集团已存在[全部门店]配置, 新配置不能生效"); | 111 | throw new BusinessException("该集团已存在[全部门店]配置, 新配置不能生效"); |
111 | } else { | 112 | } else { |
112 | List<Long> shopIds = param.getShopIds();// 本次配置指定生效门店 | 113 | List<Long> shopIds = param.getShopIds();// 本次配置指定生效门店 |
113 | List<String> shopNames = param.getShopNames();// 本次配置指定生效门店 | 114 | List<String> shopNames = param.getShopNames();// 本次配置指定生效门店 |
114 | if (Objects.equals(allShop, -1)) {// 指定为授权门店 | 115 | if (Objects.equals(allShop, -1)) {// 指定为授权门店 |
115 | - List<ShopMsg> userRoleRange = userRoleRpcService.getUserRoleRange(param.getUserId(), DalaranConstants.ZBSZ_ROLE_CODE);// 查询用户角色授权范围 | 116 | + List<ShopMsg> userRoleRange = userRoleRpcService.getUserRoleRange(param.getUserId(), Constants.ZBSZ_ROLE_CODE);// 查询用户角色授权范围 |
116 | shopIds.clear(); | 117 | shopIds.clear(); |
117 | shopNames.clear(); | 118 | shopNames.clear(); |
118 | for (ShopMsg shopMsg : userRoleRange) { | 119 | for (ShopMsg shopMsg : userRoleRange) { |
@@ -201,20 +202,20 @@ public class ConfigGroupServiceImpl extends ServiceImpl<ConfigGroupDao, ConfigGr | @@ -201,20 +202,20 @@ public class ConfigGroupServiceImpl extends ServiceImpl<ConfigGroupDao, ConfigGr | ||
201 | */ | 202 | */ |
202 | @Override | 203 | @Override |
203 | public List<ConfigGroupVo> queryList(Long userId, Long groupId) { | 204 | public List<ConfigGroupVo> queryList(Long userId, Long groupId) { |
204 | - List<ConfigGroupVo> collect = this.lambdaQuery() | 205 | + Map<Long, List<ConfigGroupVo>> collectMap = this.lambdaQuery() |
205 | .eq(ConfigGroup::getGroupId, groupId) | 206 | .eq(ConfigGroup::getGroupId, groupId) |
206 | .list() | 207 | .list() |
207 | .stream() | 208 | .stream() |
208 | .map(item -> this.processVo(item, true)) | 209 | .map(item -> this.processVo(item, true)) |
209 | - .collect(Collectors.toList()); | ||
210 | - Map<Long, List<ConfigGroupVo>> collectMap = collect.stream() | ||
211 | .collect(Collectors.groupingBy(ConfigGroupVo::getUserId)); | 210 | .collect(Collectors.groupingBy(ConfigGroupVo::getUserId)); |
212 | List<ConfigGroupVo> vos = new ArrayList<>(Optional | 211 | List<ConfigGroupVo> vos = new ArrayList<>(Optional |
213 | .ofNullable(collectMap.get(userId)) | 212 | .ofNullable(collectMap.get(userId)) |
214 | .orElse(new ArrayList<>()) | 213 | .orElse(new ArrayList<>()) |
215 | );// 尝试获取属于登录用户的配置组 | 214 | );// 尝试获取属于登录用户的配置组 |
215 | + /* 下面两步操作, 为了让属于自己的配置组能展示在最前面 */ | ||
216 | collectMap.remove(userId);// 将属于该用户的配置从map中移除 | 216 | collectMap.remove(userId);// 将属于该用户的配置从map中移除 |
217 | collectMap.forEach((k, v) -> vos.addAll(v));// 将其他人的配置组加入vo | 217 | collectMap.forEach((k, v) -> vos.addAll(v));// 将其他人的配置组加入vo |
218 | + vos.forEach(item -> item.setCanAlter(Objects.equals(item.getUserId(), userId)));// 标记是否是自己的配置组 | ||
218 | return vos; | 219 | return vos; |
219 | } | 220 | } |
220 | 221 |
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/data/impl/GlobalConfigServiceImpl.java
@@ -6,6 +6,7 @@ import cn.fw.dalaran.domain.db.GlobalConfig; | @@ -6,6 +6,7 @@ import cn.fw.dalaran.domain.db.GlobalConfig; | ||
6 | import cn.fw.dalaran.domain.enums.ConfigEnum; | 6 | import cn.fw.dalaran.domain.enums.ConfigEnum; |
7 | import cn.fw.dalaran.service.data.GlobalConfigService; | 7 | import cn.fw.dalaran.service.data.GlobalConfigService; |
8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
9 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
10 | import org.springframework.transaction.annotation.Transactional; | 11 | import org.springframework.transaction.annotation.Transactional; |
11 | 12 | ||
@@ -25,6 +26,13 @@ import java.util.stream.Collectors; | @@ -25,6 +26,13 @@ import java.util.stream.Collectors; | ||
25 | @Service("globalConfigService") | 26 | @Service("globalConfigService") |
26 | public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigDao, GlobalConfig> implements GlobalConfigService { | 27 | public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigDao, GlobalConfig> implements GlobalConfigService { |
27 | 28 | ||
29 | + private GlobalConfigServiceImpl globalConfigService; | ||
30 | + | ||
31 | + @Autowired | ||
32 | + public void inject(GlobalConfigServiceImpl globalConfigService) { | ||
33 | + this.globalConfigService = globalConfigService; | ||
34 | + } | ||
35 | + | ||
28 | /** | 36 | /** |
29 | * 获取列表 | 37 | * 获取列表 |
30 | * | 38 | * |
@@ -39,6 +47,7 @@ public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigDao, Global | @@ -39,6 +47,7 @@ public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigDao, Global | ||
39 | .list();// 获取数据库中的配置列表 | 47 | .list();// 获取数据库中的配置列表 |
40 | final int length = ConfigEnum.values().length;// 获取枚举中规定的配置数 | 48 | final int length = ConfigEnum.values().length;// 获取枚举中规定的配置数 |
41 | if (list.size() != length) { | 49 | if (list.size() != length) { |
50 | + //list = ((GlobalConfigServiceImpl) AopContext.currentProxy()).initConfigList(configGroupId); | ||
42 | list = this.initConfigList(configGroupId); | 51 | list = this.initConfigList(configGroupId); |
43 | } | 52 | } |
44 | return list; | 53 | return list; |
@@ -51,8 +60,10 @@ public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigDao, Global | @@ -51,8 +60,10 @@ public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigDao, Global | ||
51 | */ | 60 | */ |
52 | @Override | 61 | @Override |
53 | public void updateConfig(List<GlobalConfig.GlobalConfigVo> globalConfigs) { | 62 | public void updateConfig(List<GlobalConfig.GlobalConfigVo> globalConfigs) { |
54 | - PublicUtil.assertFalse(globalConfigs.stream().anyMatch(item -> item.getRate().compareTo(BigDecimal.ZERO) < 0), "占比必须 > 0%"); | ||
55 | - PublicUtil.assertFalse(globalConfigs.stream().anyMatch(item -> item.getRate().compareTo(BigDecimal.valueOf(100)) > 0), "占比必须 < 100%"); | 63 | + PublicUtil.assertFalse(globalConfigs.stream() |
64 | + .anyMatch(item -> item.getRate().compareTo(BigDecimal.ZERO) < 0), "占比必须 > 0%"); | ||
65 | + PublicUtil.assertFalse(globalConfigs.stream() | ||
66 | + .anyMatch(item -> item.getRate().compareTo(BigDecimal.valueOf(100)) > 0), "占比必须 < 100%"); | ||
56 | this.saveOrUpdateBatch(PublicUtil.copyList(globalConfigs, GlobalConfig.class)); | 67 | this.saveOrUpdateBatch(PublicUtil.copyList(globalConfigs, GlobalConfig.class)); |
57 | } | 68 | } |
58 | 69 | ||
@@ -62,7 +73,7 @@ public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigDao, Global | @@ -62,7 +73,7 @@ public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigDao, Global | ||
62 | * @param configGroupId 所属配置组id | 73 | * @param configGroupId 所属配置组id |
63 | * @return | 74 | * @return |
64 | */ | 75 | */ |
65 | - @Transactional | 76 | + @Transactional(rollbackFor = Exception.class) |
66 | public List<GlobalConfig> initConfigList(Long configGroupId) { | 77 | public List<GlobalConfig> initConfigList(Long configGroupId) { |
67 | final List<GlobalConfig> list = this.lambdaQuery() | 78 | final List<GlobalConfig> list = this.lambdaQuery() |
68 | .eq(GlobalConfig::getConfigGroupId, configGroupId) | 79 | .eq(GlobalConfig::getConfigGroupId, configGroupId) |
@@ -76,13 +87,15 @@ public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigDao, Global | @@ -76,13 +87,15 @@ public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigDao, Global | ||
76 | List<GlobalConfig> collect1 = list.stream() | 87 | List<GlobalConfig> collect1 = list.stream() |
77 | .filter(item1 -> Objects.equals(item.getValue(), item1.getType())) | 88 | .filter(item1 -> Objects.equals(item.getValue(), item1.getType())) |
78 | .collect(Collectors.toList()); | 89 | .collect(Collectors.toList()); |
79 | - if (collect1.size() > 0) { | 90 | + if (!collect1.isEmpty()) { |
80 | rate = collect1.get(0).getRate(); | 91 | rate = collect1.get(0).getRate(); |
81 | } | 92 | } |
82 | return new GlobalConfig(configGroupId, item.getValue(), rate); | 93 | return new GlobalConfig(configGroupId, item.getValue(), rate); |
83 | }) | 94 | }) |
84 | .collect(Collectors.toList()); | 95 | .collect(Collectors.toList()); |
85 | this.saveBatch(collect); | 96 | this.saveBatch(collect); |
97 | + //int i = 1 / 0; | ||
86 | return collect; | 98 | return collect; |
87 | } | 99 | } |
100 | + | ||
88 | } | 101 | } |
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/data/impl/LivePoolServiceImpl.java
@@ -87,7 +87,7 @@ public class LivePoolServiceImpl extends ServiceImpl<LivePoolDao, LivePool> impl | @@ -87,7 +87,7 @@ public class LivePoolServiceImpl extends ServiceImpl<LivePoolDao, LivePool> impl | ||
87 | * @return | 87 | * @return |
88 | */ | 88 | */ |
89 | @Override | 89 | @Override |
90 | - @Transactional | 90 | + @Transactional(rollbackFor = Exception.class) |
91 | public boolean markBestLive(Long liveId) { | 91 | public boolean markBestLive(Long liveId) { |
92 | final LivePool live = this.getById(liveId); | 92 | final LivePool live = this.getById(liveId); |
93 | final Long themeId = live.getThemeId();// 获取主题id | 93 | final Long themeId = live.getThemeId();// 获取主题id |
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/data/impl/ValidConfigNewServiceImpl.java
@@ -38,7 +38,7 @@ public class ValidConfigNewServiceImpl extends ServiceImpl<ValidConfigNewDao, Va | @@ -38,7 +38,7 @@ public class ValidConfigNewServiceImpl extends ServiceImpl<ValidConfigNewDao, Va | ||
38 | * @return | 38 | * @return |
39 | */ | 39 | */ |
40 | @Override | 40 | @Override |
41 | - @Transactional | 41 | + @Transactional(rollbackFor = Exception.class) |
42 | public boolean updateConfig(List<ValidConfigNewVo.singleVo> details) { | 42 | public boolean updateConfig(List<ValidConfigNewVo.singleVo> details) { |
43 | details.forEach(item -> this.updateById(ValidConfigNewVo.toDB(item))); | 43 | details.forEach(item -> this.updateById(ValidConfigNewVo.toDB(item))); |
44 | publisher.publishEvent("validConfigAlertEvent#" + details.get(0).getConfigGroupId()); | 44 | publisher.publishEvent("validConfigAlertEvent#" + details.get(0).getConfigGroupId()); |
@@ -84,7 +84,7 @@ public class ValidConfigNewServiceImpl extends ServiceImpl<ValidConfigNewDao, Va | @@ -84,7 +84,7 @@ public class ValidConfigNewServiceImpl extends ServiceImpl<ValidConfigNewDao, Va | ||
84 | * @param configGroupId 所属配置组id | 84 | * @param configGroupId 所属配置组id |
85 | * @return | 85 | * @return |
86 | */ | 86 | */ |
87 | - @Transactional | 87 | + @Transactional(rollbackFor = Exception.class) |
88 | public List<ValidConfigNew> initVideoConfigList(Long configGroupId) { | 88 | public List<ValidConfigNew> initVideoConfigList(Long configGroupId) { |
89 | final List<ValidConfigNew> list = this.lambdaQuery() | 89 | final List<ValidConfigNew> list = this.lambdaQuery() |
90 | .eq(ValidConfigNew::getConfigGroupId, configGroupId) | 90 | .eq(ValidConfigNew::getConfigGroupId, configGroupId) |
@@ -115,7 +115,7 @@ public class ValidConfigNewServiceImpl extends ServiceImpl<ValidConfigNewDao, Va | @@ -115,7 +115,7 @@ public class ValidConfigNewServiceImpl extends ServiceImpl<ValidConfigNewDao, Va | ||
115 | * @param configGroupId 所属配置组id | 115 | * @param configGroupId 所属配置组id |
116 | * @return | 116 | * @return |
117 | */ | 117 | */ |
118 | - @Transactional | 118 | + @Transactional(rollbackFor = Exception.class) |
119 | public List<ValidConfigNew> initLiveConfigList(Long configGroupId) { | 119 | public List<ValidConfigNew> initLiveConfigList(Long configGroupId) { |
120 | final List<ValidConfigNew> list = this.lambdaQuery() | 120 | final List<ValidConfigNew> list = this.lambdaQuery() |
121 | .eq(ValidConfigNew::getConfigGroupId, configGroupId) | 121 | .eq(ValidConfigNew::getConfigGroupId, configGroupId) |
fw-dalaran-service/src/main/test/codeGenerator/CodeGenerator.java
1 | package codeGenerator; | 1 | package codeGenerator; |
2 | 2 | ||
3 | -import com.baomidou.mybatisplus.annotation.DbType; | ||
4 | -import com.baomidou.mybatisplus.annotation.FieldFill; | ||
5 | -import com.baomidou.mybatisplus.annotation.IdType; | ||
6 | -import com.baomidou.mybatisplus.generator.AutoGenerator; | ||
7 | -import com.baomidou.mybatisplus.generator.config.DataSourceConfig; | ||
8 | -import com.baomidou.mybatisplus.generator.config.GlobalConfig; | ||
9 | -import com.baomidou.mybatisplus.generator.config.PackageConfig; | ||
10 | -import com.baomidou.mybatisplus.generator.config.StrategyConfig; | ||
11 | -import com.baomidou.mybatisplus.generator.config.po.TableFill; | ||
12 | -import com.baomidou.mybatisplus.generator.config.rules.DateType; | ||
13 | -import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; | ||
14 | import org.junit.Test; | 3 | import org.junit.Test; |
15 | 4 | ||
16 | -import java.util.ArrayList; | ||
17 | - | ||
18 | public class CodeGenerator { | 5 | public class CodeGenerator { |
19 | 6 | ||
20 | @Test | 7 | @Test |
21 | public void getCode() { | 8 | public void getCode() { |
22 | - // 1、全局配置 | 9 | + /*// 1、全局配置 |
23 | GlobalConfig globalConfig = new GlobalConfig(); | 10 | GlobalConfig globalConfig = new GlobalConfig(); |
24 | globalConfig | 11 | globalConfig |
25 | .setOutputDir("D:\\Users\\wmy\\feiweiProjects\\fw-dalaran\\fw-dalaran-domain\\src\\main\\java\\codeGenerate" + "/src/main/java")//1.修改为你项目的目录 | 12 | .setOutputDir("D:\\Users\\wmy\\feiweiProjects\\fw-dalaran\\fw-dalaran-domain\\src\\main\\java\\codeGenerate" + "/src/main/java")//1.修改为你项目的目录 |
@@ -80,7 +67,7 @@ public class CodeGenerator { | @@ -80,7 +67,7 @@ public class CodeGenerator { | ||
80 | .setPackageInfo(packageConfig) | 67 | .setPackageInfo(packageConfig) |
81 | .setStrategy(strategyConfig); | 68 | .setStrategy(strategyConfig); |
82 | // 7、执行 | 69 | // 7、执行 |
83 | - autoGenerator.execute(); | 70 | + autoGenerator.execute();*/ |
84 | } | 71 | } |
85 | 72 | ||
86 | } | 73 | } |
fw-dalaran-service/src/main/test/example/ImageListener.java
@@ -19,8 +19,8 @@ public class ImageListener implements ActionListener { | @@ -19,8 +19,8 @@ public class ImageListener implements ActionListener { | ||
19 | } | 19 | } |
20 | 20 | ||
21 | public ImageListener() throws Exception { | 21 | public ImageListener() throws Exception { |
22 | - File imageFile1 = ImageUtils.convertFileByUrl("https://gate.feewee.cn/file/show?fid=e1d71b45dd0e4d73bde25afc3e260de5"); | ||
23 | - File imageFile2 = ImageUtils.convertFileByUrl("https://gate.feewee.cn/file/show?fid=7dfedbed8996443584b6b2221b79235e"); | 22 | + File imageFile1 = ImageUtils.convertFileByUrl("https://gate.feewee.cn/file/show?fid=0684ce9b0d384ff1a1070c61b7ed376c"); |
23 | + File imageFile2 = ImageUtils.convertFileByUrl("https://gate.feewee.cn/file/show?fid=0aff5b6acf6040459b6d5e69f1290c3b"); | ||
24 | //File imageFile2 = ImageUtils.convertFileByUrl("https://p2.a.yximgs.com/upic/2022/01/20/20/BMjAyMjAxMjAyMDEyMTZfNDcwOTM0NDgyXzY1MzMwMDA5Mjk0XzJfMw==_B0296c8ed5afa94b9b7a06dd1612c3ecb.jpg?tag=1-1642748356-nil-0-ndrgo4aid6-21e0d82706b2e935&clientCacheKey=3x4xb3uvxtpibvc.jpg&di=abd4f314&bp=10000"); | 24 | //File imageFile2 = ImageUtils.convertFileByUrl("https://p2.a.yximgs.com/upic/2022/01/20/20/BMjAyMjAxMjAyMDEyMTZfNDcwOTM0NDgyXzY1MzMwMDA5Mjk0XzJfMw==_B0296c8ed5afa94b9b7a06dd1612c3ecb.jpg?tag=1-1642748356-nil-0-ndrgo4aid6-21e0d82706b2e935&clientCacheKey=3x4xb3uvxtpibvc.jpg&di=abd4f314&bp=10000"); |
25 | /*File imageFile1 = new File("C:\\Users\\wmy3969\\Desktop\\2.png"); | 25 | /*File imageFile1 = new File("C:\\Users\\wmy3969\\Desktop\\2.png"); |
26 | File imageFile2 = new File("C:\\Users\\wmy3969\\Desktop\\2022.4.23-4.30短视频背景封面jpg\\春风十里焕新鲸喜\\1.png");*/ | 26 | File imageFile2 = new File("C:\\Users\\wmy3969\\Desktop\\2022.4.23-4.30短视频背景封面jpg\\春风十里焕新鲸喜\\1.png");*/ |
pom.xml
@@ -41,6 +41,7 @@ | @@ -41,6 +41,7 @@ | ||
41 | <fw.attendance.sdk.version>1.0.0</fw.attendance.sdk.version> | 41 | <fw.attendance.sdk.version>1.0.0</fw.attendance.sdk.version> |
42 | <fw.notice.sdk.version>1.0.0</fw.notice.sdk.version> | 42 | <fw.notice.sdk.version>1.0.0</fw.notice.sdk.version> |
43 | <fw.rocketmq.sdk.version>1.0</fw.rocketmq.sdk.version> | 43 | <fw.rocketmq.sdk.version>1.0</fw.rocketmq.sdk.version> |
44 | + <fw.morax.sdk.version>1.0.0</fw.morax.sdk.version> | ||
44 | <fastjson>1.2.78</fastjson> | 45 | <fastjson>1.2.78</fastjson> |
45 | <fw-oop-sdk.version>3.0.0</fw-oop-sdk.version> | 46 | <fw-oop-sdk.version>3.0.0</fw-oop-sdk.version> |
46 | <mybatis-typehandlers-jsr310>1.0.1</mybatis-typehandlers-jsr310> | 47 | <mybatis-typehandlers-jsr310>1.0.1</mybatis-typehandlers-jsr310> |
@@ -147,6 +148,12 @@ | @@ -147,6 +148,12 @@ | ||
147 | <artifactId>fw-backlog-sdk</artifactId> | 148 | <artifactId>fw-backlog-sdk</artifactId> |
148 | <version>${fw.backlog.sdk}</version> | 149 | <version>${fw.backlog.sdk}</version> |
149 | </dependency> | 150 | </dependency> |
151 | + <!-- 绩效系统 --> | ||
152 | + <dependency> | ||
153 | + <groupId>cn.fw</groupId> | ||
154 | + <artifactId>fw-morax-sdk</artifactId> | ||
155 | + <version>${fw.morax.sdk.version}</version> | ||
156 | + </dependency> | ||
150 | <dependency> | 157 | <dependency> |
151 | <groupId>cn.fw</groupId> | 158 | <groupId>cn.fw</groupId> |
152 | <artifactId>fw-erp-sdk</artifactId> | 159 | <artifactId>fw-erp-sdk</artifactId> |
@@ -167,6 +174,11 @@ | @@ -167,6 +174,11 @@ | ||
167 | <artifactId>mybatis-typehandlers-jsr310</artifactId> | 174 | <artifactId>mybatis-typehandlers-jsr310</artifactId> |
168 | <version>${mybatis-typehandlers-jsr310}</version> | 175 | <version>${mybatis-typehandlers-jsr310}</version> |
169 | </dependency> | 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> | ||
170 | 182 | ||
171 | <!-- image图片工具需要 start --> | 183 | <!-- image图片工具需要 start --> |
172 | <dependency> | 184 | <dependency> |
@@ -192,17 +204,17 @@ | @@ -192,17 +204,17 @@ | ||
192 | <artifactId>mybatis-plus-boot-starter</artifactId> | 204 | <artifactId>mybatis-plus-boot-starter</artifactId> |
193 | <version>3.3.2</version> | 205 | <version>3.3.2</version> |
194 | </dependency> | 206 | </dependency> |
195 | - <dependency> | 207 | + <!--<dependency> |
196 | <groupId>com.baomidou</groupId> | 208 | <groupId>com.baomidou</groupId> |
197 | <artifactId>mybatis-plus-generator</artifactId> | 209 | <artifactId>mybatis-plus-generator</artifactId> |
198 | <version>3.3.2</version> | 210 | <version>3.3.2</version> |
199 | - </dependency> | 211 | + </dependency>--> |
200 | <!-- 默认模板引擎, 可以选择自己熟悉的模板引擎(Freemarker、Beetl) --> | 212 | <!-- 默认模板引擎, 可以选择自己熟悉的模板引擎(Freemarker、Beetl) --> |
201 | - <dependency> | 213 | + <!--<dependency> |
202 | <groupId>org.apache.velocity</groupId> | 214 | <groupId>org.apache.velocity</groupId> |
203 | <artifactId>velocity-engine-core</artifactId> | 215 | <artifactId>velocity-engine-core</artifactId> |
204 | <version>2.0</version> | 216 | <version>2.0</version> |
205 | - </dependency> | 217 | + </dependency>--> |
206 | <!-- mybatis-plus 代码生成器 end --> | 218 | <!-- mybatis-plus 代码生成器 end --> |
207 | <!-- 图片分辨率修改 --> | 219 | <!-- 图片分辨率修改 --> |
208 | <dependency> | 220 | <dependency> |