Forráskód Böngészése

Merge branch 'refs/heads/master' into zenas-dev-20240930

zq940222 5 hónapja
szülő
commit
c65b71e1e3

+ 5 - 4
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/common/util/DateUtil.java

@@ -112,9 +112,10 @@ public class DateUtil {
      * @param end
      * @return
      */
-    public static long diffDays(Date start, Date end) {
-        return ChronoUnit.DAYS.between(
-                LocalDate.ofInstant(start.toInstant(), DEFAULT_ZONE_ID),
-                LocalDate.ofInstant(end.toInstant(), DEFAULT_ZONE_ID));
+    public static int diffDays(Date start, Date end) {
+        return (int)
+                ChronoUnit.DAYS.between(
+                        LocalDate.ofInstant(end.toInstant(), DEFAULT_ZONE_ID),
+                        LocalDate.ofInstant(start.toInstant(), DEFAULT_ZONE_ID));
     }
 }

+ 2 - 0
jeecg-module-system/jeecg-system-start/src/test/java/org/jeecg/modules/adweb/dmp/service/google/GoogleServiceTest.java

@@ -7,10 +7,12 @@ import org.jeecg.modules.adweb.dmp.dto.google.analytics.report.data.CountryChart
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
 
 import java.util.List;
 
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("dev")
 public class GoogleServiceTest {
 
     @Autowired GAReportService gaReportService;

+ 5 - 7
jeecg-module-system/jeecg-system-start/src/test/java/org/jeecg/modules/mq/RabbitMQTest.java

@@ -2,17 +2,18 @@ package org.jeecg.modules.mq;
 
 import cn.hutool.core.util.RandomUtil;
 
-import org.jeecg.modules.adweb.enquiry.dto.EnquiryDTO;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.springframework.amqp.rabbit.core.RabbitTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
 
 /**
  * @author wfansh
  */
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("dev")
 public class RabbitMQTest {
 
     @Autowired private RabbitTemplate rabbitTemplate;
@@ -20,14 +21,11 @@ public class RabbitMQTest {
     @Test
     @Disabled
     public void testSendMessage() {
-        int num = 100000;
+        int num = 10;
         for (int i = 0; i < num; i++) {
-            EnquiryDTO enquiryDTO = new EnquiryDTO();
-            enquiryDTO.setId(RandomUtil.randomInt());
-            enquiryDTO.setMsg(RandomUtil.randomString(16));
-            rabbitTemplate.convertAndSend("enquiry", enquiryDTO);
+            rabbitTemplate.convertAndSend("site_enquiry", RandomUtil.randomString(12));
         }
 
-        System.out.println("Sent messages to enquiry queue num = " + num);
+        System.out.println("Sent messages to site_enquiry queue num = " + num);
     }
 }