@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system.count;
import cn.hutool.core.text.StrPool ;
import cn.hutool.core.text.StrPool ;
import com.alibaba.fastjson.JSONObject ;
import com.alibaba.fastjson.JSONObject ;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper ;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper ;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper ;
import com.ruoyi.common.core.controller.BaseController ;
import com.ruoyi.common.core.controller.BaseController ;
import com.ruoyi.common.core.domain.AjaxResult ;
import com.ruoyi.common.core.domain.AjaxResult ;
@ -18,6 +19,8 @@ import com.ruoyi.system.service.ITdNotifyService;
import com.ruoyi.system.service.check.TdCheckReportService ;
import com.ruoyi.system.service.check.TdCheckReportService ;
import com.ruoyi.web.controller.manager.CheckReportManager ;
import com.ruoyi.web.controller.manager.CheckReportManager ;
import io.swagger.annotations.ApiOperation ;
import io.swagger.annotations.ApiOperation ;
import lombok.val ;
import org.apache.catalina.User ;
import org.apache.shiro.authz.annotation.RequiresPermissions ;
import org.apache.shiro.authz.annotation.RequiresPermissions ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.stereotype.Controller ;
import org.springframework.stereotype.Controller ;
@ -75,7 +78,7 @@ public class TdChecknumController extends BaseController{
@PostMapping ( "/countCheckMonth" )
@PostMapping ( "/countCheckMonth" )
@ResponseBody
@ResponseBody
public AjaxResult countCheckMonth ( ) {
public AjaxResult countCheckMonth ( ) {
List < String > recentlySixMonth = ObtainLastSixMonthsUtil . getRecently Twelve Month( ) ;
List < String > recentlySixMonth = ObtainLastSixMonthsUtil . getRecently Six Month( ) ;
List < Long > yAxisData = new ArrayList < > ( ) ;
List < Long > yAxisData = new ArrayList < > ( ) ;
recentlySixMonth . forEach ( month - > {
recentlySixMonth . forEach ( month - > {
// 获取指定月份的最大日期
// 获取指定月份的最大日期
@ -102,6 +105,44 @@ public class TdChecknumController extends BaseController{
return AjaxResult . success ( obj ) ;
return AjaxResult . success ( obj ) ;
}
}
/ * *
*
* 统 计 近 6 个 月 最 高 得 分 占 比
* @return
* /
@PostMapping ( "/countCheckScoresMonth" )
@ResponseBody
public AjaxResult countCheckScoresMonth ( ) {
List < String > recentlySixMonth = ObtainLastSixMonthsUtil . getRecentlySixMonth ( ) ;
List < Double > yAxisData = new ArrayList < > ( ) ;
recentlySixMonth . forEach ( month - > {
// 获取指定月份的最大日期
String lastDayOfMonth = ObtainLastSixMonthsUtil . getLastDayOfMonth ( month ) ;
// 获取指定天的最大时间
Date date = Date . from ( LocalDate . parse ( lastDayOfMonth ) . atStartOfDay ( ) . atZone ( ZoneId . systemDefault ( ) ) . toInstant ( ) ) ;
Date maxDayTime = ObtainLastSixMonthsUtil . getEndOfDay ( date ) ;
// 获取最小时间
date = Date . from ( LocalDate . parse ( month . concat ( StrPool . DASHED ) . concat ( "01" ) ) . atStartOfDay ( ) . atZone ( ZoneId . systemDefault ( ) ) . toInstant ( ) ) ;
Date minDayTime = ObtainLastSixMonthsUtil . getStartOfDay ( date ) ;
AtomicReference < Double > yAxis = new AtomicReference < > ( ) ;
TdCheckReport checkReport = new LambdaQueryChainWrapper < > ( checkReportService . getBaseMapper ( ) )
. ge ( TdCheckReport : : getCreateTime , minDayTime )
. le ( TdCheckReport : : getCreateTime , maxDayTime )
. orderByDesc ( TdCheckReport : : getPercentageScore )
. last ( "limit 1" ) . one ( ) ;
if ( Objects . isNull ( checkReport ) ) {
yAxis . set ( 0.0 ) ;
} else {
yAxis . set ( Double . valueOf ( checkReport . getPercentageScore ( ) ) ) ;
}
yAxisData . add ( yAxis . get ( ) ) ;
} ) ;
JSONObject obj = new JSONObject ( ) ;
obj . put ( "xAxisData" , recentlySixMonth . toArray ( ) ) ;
obj . put ( "yAxisData" , yAxisData ) ;
return AjaxResult . success ( obj ) ;
}