From fb53a9997de491c3d0a30ed333a6bd3b24877b82 Mon Sep 17 00:00:00 2001
From: wang-hao-jie <1550036656@qq.com>
Date: 星期一, 27 十二月 2021 11:43:58 +0800
Subject: [PATCH] 违章记录
---
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java | 68 ++++++++++++++++++++++------------
1 files changed, 44 insertions(+), 24 deletions(-)
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java
index 70f537c..2fae93d 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java
@@ -11,7 +11,7 @@
import java.io.IOException;
import java.util.List;
-
+//瀹㈡埛绔椤垫暟鎹粺璁�
@Component
public class StatisticScheduleImpl {
@@ -33,8 +33,11 @@
@Autowired
private ICustomerService iCustomerService;
- @Scheduled(cron="0 0 * * * ?")//姣忔櫄鍑屾櫒1鐐规墽琛�
- public void execute() throws IOException {
+ @Autowired
+ private IAlarmService iAlarmService;
+
+ @Scheduled(cron="0 0 1 * * ?")//姣忔櫄鍑屾櫒1鐐规墽琛�
+ public void execute(){
List<User> all = userService.findAll();
for(User user:all){
Integer type2 = user.getType2();
@@ -51,48 +54,65 @@
Integer max = iDrivingRecordService.maxByUserId(user.getId());
Integer min = iDrivingRecordService.minByUserId(user.getId());
if(max==null||min==null){
- one.setSafeDriving(0);
- one.setDriving(0);
+ one.setSafeDriving(0);//瀹夊叏椹鹃┒閲岀▼
+ one.setDriving(0);//椹鹃┒閲岀▼
}else{
- one.setSafeDriving(max-min);
- one.setDriving(max-min);
+ one.setSafeDriving(max-min);//瀹夊叏椹鹃┒閲岀▼
+ one.setDriving(max-min);//椹鹃┒閲岀▼
}
QueryWrapper<DrivingRecord> wrapper2 = new QueryWrapper<>();
wrapper2.eq("user_id",user.getId());
int count = iDrivingRecordService.count(wrapper2);
- one.setOutCar(count);
+ one.setOutCar(count);//鍑鸿溅娆℃暟
+ one.setLikes(iDrivingRecordService.sumLikeByUserId(user.getId()));//鐐硅禐鏁�
+
+ QueryWrapper<Alarm> wrapper3 = new QueryWrapper<>();
+ wrapper3.eq("car_user_id",user.getId());
+ wrapper3.eq("type",1);
+ one.setFatigueDriving(iAlarmService.count(wrapper3));//鐤插姵椹鹃┒
+ wrapper3.eq("type",3);
+ one.setNoBelt(iAlarmService.count(wrapper3));//涓嶇郴瀹夊叏甯�
+ wrapper3.eq("type",4);
+ one.setSmoking(iAlarmService.count(wrapper3));//鎶界儫
+ wrapper3.eq("type",2);
+ one.setPhone(iAlarmService.count(wrapper3));//鎺ユ墦鐢佃瘽
}
//閰嶉�佸憳
if(type2==1){
QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<>();
wrapper2.eq("user_id",user.getId());
int count = iOrderTaskService.count(wrapper2);
+ one.setSends(count);//閰嶉�佹鏁�
+
wrapper2.ne("status",0);
int count2 = iOrderTaskService.count(wrapper2);
- wrapper2.ne("level",0);
- wrapper2.gt("level",2);
- int count5 = iOrderTaskService.count(wrapper2);
- if(count2==0){
- one.setLikesRate(0);
- }else{
- int rate = (count5/count2)*100;
- one.setLikesRate(rate);
- }
-
- one.setSends(count);
- one.setSends2(count2);
+ one.setSends2(count2);//閫佽揪娆℃暟
QueryWrapper<Area> wrapper3 = new QueryWrapper<>();
wrapper3.eq("user_id",user.getId());
Area area = iAreaService.getOne(wrapper3);
+ if(area!=null){
+ QueryWrapper<Customer> wrapper4 = new QueryWrapper<>();
+ wrapper4.eq("area_id",area.getId());
+ int count3 = iCustomerService.count(wrapper4);
+ one.setService(count3);//鏈嶅姟鍟嗘埛鏁�
+ }
- QueryWrapper<Customer> wrapper4 = new QueryWrapper<>();
- wrapper4.eq("area_id",area.getId());
- int count3 = iCustomerService.count(wrapper4);
+ int i = iOrderTaskService.countLike();
+ one.setLikes(i);//鐐硅禐娆℃暟
+ int likeCount = iOrderTaskService.count();
+ if(likeCount==0){
+ one.setLikesRate(0);//鐐硅禐鐜�
+ }else{
+ one.setLikesRate((i*100)/likeCount);//鐐硅禐鐜�
+ }
- one.setService(count3);
+ QueryWrapper<Alarm> wrapper4 = new QueryWrapper<>();
+ wrapper4.eq("follow_user_id",user.getId());
+ wrapper4.eq("type",5);
+ one.setAbnormalOpen(iAlarmService.count(wrapper4));//寮傚父寮�鍚�
}
iUserStatisticService.saveOrUpdate(one);
--
Gitblit v1.9.1