From 1b4c59f5f3a0e332ad1cc27c836d98c6d2bdf22c Mon Sep 17 00:00:00 2001 From: wang-hao-jie <1550036656@qq.com> Date: 星期三, 08 十二月 2021 14:49:16 +0800 Subject: [PATCH] 违章记录 --- xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java | 30 +++++++++++++++++++++++------- 1 files changed, 23 insertions(+), 7 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 bc93fad..4728a4c 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 @@ -44,13 +44,19 @@ UserStatistic one = iUserStatisticService.getOne(wrapper); if(one==null){ one = new UserStatistic(); + one.setUserId(user.getId()); } //鍙告満 if(type2==0){ Integer max = iDrivingRecordService.maxByUserId(user.getId()); Integer min = iDrivingRecordService.minByUserId(user.getId()); - one.setSafeDriving(max-min); - one.setDriving(max-min); + if(max==null||min==null){ + one.setSafeDriving(0); + one.setDriving(0); + }else{ + one.setSafeDriving(max-min); + one.setDriving(max-min); + } QueryWrapper<DrivingRecord> wrapper2 = new QueryWrapper<>(); wrapper2.eq("user_id",user.getId()); @@ -65,6 +71,15 @@ int count = iOrderTaskService.count(wrapper2); 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); @@ -73,11 +88,12 @@ wrapper3.eq("user_id",user.getId()); Area area = iAreaService.getOne(wrapper3); - QueryWrapper<Customer> wrapper4 = new QueryWrapper<>(); - wrapper4.eq("area_id",area.getId()); - int count3 = iCustomerService.count(wrapper4); - - one.setService(count3); + if(area!=null){ + QueryWrapper<Customer> wrapper4 = new QueryWrapper<>(); + wrapper4.eq("area_id",area.getId()); + int count3 = iCustomerService.count(wrapper4); + one.setService(count3); + } } iUserStatisticService.saveOrUpdate(one); -- Gitblit v1.9.1