|
|
@@ -1,15 +1,14 @@
|
|
|
package com.skyversation.xjcy;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.skyversation.xjcy.bean.Enterprise;
|
|
|
-import com.skyversation.xjcy.bean.EnterpriseEconomic;
|
|
|
-import com.skyversation.xjcy.bean.LeaseDetail;
|
|
|
+import com.skyversation.xjcy.bean.*;
|
|
|
import com.skyversation.xjcy.computer.EnterpriseHealthComputer;
|
|
|
import com.skyversation.xjcy.dms.DMSColumn;
|
|
|
import com.skyversation.xjcy.dms.DMSQuery;
|
|
|
import com.skyversation.xjcy.dms.DMSService;
|
|
|
import com.skyversation.xjcy.oauth.AuthService;
|
|
|
import com.skyversation.xjcy.service.InvestmentPreCountService;
|
|
|
+import com.skyversation.xjcy.service.MessageService;
|
|
|
import com.skyversation.xjcy.service.ParkPreCountService;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
@@ -20,7 +19,10 @@ import java.time.LocalDateTime;
|
|
|
import java.time.MonthDay;
|
|
|
import java.time.temporal.TemporalField;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Component
|
|
|
//放一些定时器的简单类
|
|
|
@@ -30,12 +32,14 @@ public class Timer {
|
|
|
private final InvestmentPreCountService investmentPreCountService;
|
|
|
private final DMSService dMSService;
|
|
|
private final AuthService authService;
|
|
|
+ private final MessageService messageService;
|
|
|
|
|
|
- public Timer(ParkPreCountService parkPreCountService, InvestmentPreCountService investmentPreCountService, DMSService dMSService, AuthService authService) {
|
|
|
+ public Timer(ParkPreCountService parkPreCountService, InvestmentPreCountService investmentPreCountService, DMSService dMSService, AuthService authService, MessageService messageService) {
|
|
|
this.parkPreCountService = parkPreCountService;
|
|
|
this.investmentPreCountService = investmentPreCountService;
|
|
|
this.dMSService = dMSService;
|
|
|
this.authService = authService;
|
|
|
+ this.messageService = messageService;
|
|
|
}
|
|
|
|
|
|
//@Scheduled(fixedRate = 5000)
|
|
|
@@ -51,7 +55,7 @@ public class Timer {
|
|
|
@PostConstruct
|
|
|
public void checkEnterpriseHealth(){
|
|
|
LocalDate now = LocalDate.now();
|
|
|
- LocalDateTime actuallyTime = now.minusDays(1).atTime(23,59,59,9999);
|
|
|
+ LocalDateTime actuallyTime = now.minusDays(1).atTime(23,59,59,999999999);
|
|
|
// LocalDateTime actuallyTime = LocalDateTime.of(2025,9,30,23,59,59,9999);
|
|
|
|
|
|
List<Enterprise> enterprises = dMSService.query(authService.getTokenOfServiceAccount(), DMSQuery.ENTERPRISE, Enterprise.class,actuallyTime.toLocalDate());
|
|
|
@@ -92,5 +96,17 @@ public class Timer {
|
|
|
System.out.println("保存失败");
|
|
|
}
|
|
|
}
|
|
|
+ List<User> users = dMSService.query(authService.getTokenOfServiceAccount(),DMSQuery.USER_BIND_ENTERPRISE,User.class,actuallyTime.toLocalDate());
|
|
|
+ Map<String, List<User>> userMap = users.stream().filter(u->u.getCGlGs()!=null).collect(Collectors.groupingBy(User::getCGlGs));
|
|
|
+
|
|
|
+ enterpriseHealthComputer.getResults().stream().filter(EnterpriseHealth::isPositive).forEach(e->{
|
|
|
+ String enterpriseCode = e.getCEnterpriseCode();
|
|
|
+ List<User> userList = userMap.get(enterpriseCode);
|
|
|
+ if (userList!=null) {
|
|
|
+ for (User user : userList) {
|
|
|
+ messageService.sendMessageByEnterpriseHealth(e,actuallyTime,user);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|