From 94e3a209bb9a31c4ddbd31494bb1628f6fe2e96e Mon Sep 17 00:00:00 2001 From: lidongdong <1459917685@qq.com> Date: 星期三, 12 十月 2022 17:54:49 +0800 Subject: [PATCH] 新增首页工单 办事指南排行榜接口 导办人员排行榜接口 组织排行榜接口 新增办事指南统计接口 导办人员统计接口 组织胖行榜统计接口 --- flower_city/src/main/java/com/dg/core/controller/HomeStatisticsController.java | 134 +++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 123 insertions(+), 11 deletions(-) diff --git a/flower_city/src/main/java/com/dg/core/controller/HomeStatisticsController.java b/flower_city/src/main/java/com/dg/core/controller/HomeStatisticsController.java index b696e0d..03a9ca0 100644 --- a/flower_city/src/main/java/com/dg/core/controller/HomeStatisticsController.java +++ b/flower_city/src/main/java/com/dg/core/controller/HomeStatisticsController.java @@ -2,10 +2,8 @@ import com.dg.core.ResultData; import com.dg.core.db.gen.entity.*; -import com.dg.core.service.IClassifyAdministrationService; -import com.dg.core.service.IGuideEvolveService; -import com.dg.core.service.IGuideRepairOrderService; -import com.dg.core.service.ITransactionEventService; +import com.dg.core.service.*; +import com.dg.core.util.TableDataInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; @@ -15,14 +13,12 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.List; +import java.util.*; @Api(tags = {"首页统计接口"}) @RestController @RequestMapping("/Home") -public class HomeStatisticsController +public class HomeStatisticsController extends BaseController { //导办工单接口 @Autowired @@ -38,6 +34,18 @@ @Autowired ITransactionEventService iTransactionEventService; + + @Autowired + HomeStatisticsService homeStatisticsService; + + + @Autowired + com.dg.core.service.ISysUserService IUserService; + + + @Autowired + IOrganizationChartService iOrganizationChartService; + @ApiOperation("首页统计不同状态工单数") @GetMapping("/getWorkOrder") @@ -203,15 +211,119 @@ } - @ApiOperation("组织排行榜") + + + + @ApiOperation("组织排行榜 type 1 安评价 2 按办结量") @GetMapping("/getOrganization") - public ResultData getOrganization() + public TableDataInfo getOrganization(@RequestParam("type") String type) { + List<OrganizationEntity> guidePlates=homeStatisticsService.getDepartment(); + if(StringUtils.equals("1",type)) + { + for (OrganizationEntity bean:guidePlates) + { + bean.setNum(0+""); + List<String> ids=iOrganizationChartService.getIds(bean.getId()+""); - return ResultData.success(); + //总评分 + String scoreNum=homeStatisticsService.organizationScore(ids)+""; + int score=0; + if(!StringUtils.isEmpty(scoreNum) && !StringUtils.equals("null",scoreNum)) + { + score=Integer.valueOf(scoreNum); + } + + //总数量 + int allNum=homeStatisticsService.organizationNum(ids); + + if(allNum>0 && score>0) + { + java.text.DecimalFormat weekDf=new java.text.DecimalFormat("##.##");//传入格式模板 + String workEfficiency=weekDf.format((float)(score/allNum)); + bean.setNum(workEfficiency); + } + } + } + else + { + for (OrganizationEntity bean:guidePlates) + { + bean.setNum(0+""); + List<String> ids=iOrganizationChartService.getIds(bean.getId()+""); + //总数量 + int allNum=homeStatisticsService.organizationNum(ids); + if(allNum>0) + { + bean.setNum(allNum+""); + } + } + } + + OrganizationEntity entity=null; + for(int i = 0 ;i< guidePlates.size() -1; i++) { + for (int j = 0; j < guidePlates.size() - 1 - i; j++) { + + if(Float.valueOf(guidePlates.get(j).getNum())>Float.valueOf(guidePlates.get(j+1).getNum())) + { + entity=guidePlates.get(j); + guidePlates.set(j,guidePlates.get(j+1)); + guidePlates.set(j+1,entity); + } + } + } + + Collections.reverse(guidePlates); + + return getDataTable(guidePlates,guidePlates.size()); } + @ApiOperation("导办人员排行榜 type 1 安评价 2 按办结量 3 按超时") + @GetMapping("/getGuidePlate") + public TableDataInfo getGuidePlate(@RequestParam("type") String type) + { + int allNum=homeStatisticsService.staffNum(); + + if(StringUtils.equals("1",type)) + { + //安评价 + return getDataTable(homeStatisticsService.score(),allNum); + } + else if(StringUtils.equals("2",type)) + { + //2 按办结量 + return getDataTable(homeStatisticsService.guidePlatePeople(),allNum); + } + else + { + //3 按超时 + return getDataTable(homeStatisticsService.timeout(),allNum); + } + } + + + + @ApiOperation("办事指南排行榜 type 1 按浏览量 2 按办结量") + @GetMapping("/getGuidance") + public TableDataInfo getGuidance(@RequestParam("type") String type) + { + int allNum=homeStatisticsService.countWork(); + if(StringUtils.equals("1",type)) + { + return getDataTable(homeStatisticsService.guidanceBrowse(),allNum); + } + else + { + return getDataTable(homeStatisticsService.guidanceTransaction(),allNum); + } + + } + + + + + } -- Gitblit v1.7.1