From baaa190b39abda6a56291e7c4bf93e951dffa223 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 19 Oct 2022 15:34:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E5=8C=BA=E7=9B=B4=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/ScreenDeptEventEfficiencyDao.java | 39 ++- .../ScreenDeptEventEfficiencyServiceImpl.java | 199 ++++++++------ .../screen/ScreenDeptEventEfficiencyDao.xml | 253 +++++++++++++++++- 3 files changed, 397 insertions(+), 94 deletions(-) diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/dao/ScreenDeptEventEfficiencyDao.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/dao/ScreenDeptEventEfficiencyDao.java index ad63bf9f7..a7f2f5183 100644 --- a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/dao/ScreenDeptEventEfficiencyDao.java +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/dao/ScreenDeptEventEfficiencyDao.java @@ -79,7 +79,7 @@ public interface ScreenDeptEventEfficiencyDao extends BaseDao getScreenDataByInterval(EventStatisticsFormDTO formDTO); - void deleteData(@Param("statDate") String statDate); + void deleteData(@Param("statDate") String statDate, @Param("level") String level); /** * 柱状图 @@ -89,4 +89,41 @@ public interface ScreenDeptEventEfficiencyDao extends BaseDao getEventBar(EventStatisticsFormDTO formDTO); + + + /** + * 区直部门日统计 + * @Param statDate + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2022/10/11 15:50 + */ + List getDeptEventEfficiencyDaily(@Param("statDate") String statDate); + + /** + * 区直部门月统计 + * @Param statDate + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2022/10/11 15:50 + */ + List getDeptEventEfficiencyMonthly(@Param("statDate") String statDate); + + /** + * 区直部门年统计 + * @Param statDate + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2022/10/11 15:50 + */ + List getDeptEventEfficiencyYearly(@Param("statDate") String statDate); + + /** + * 获取区直部门大屏数据-自定义时间区间 + * @Param formDTO + * @Return {@link List< EfficiencyEvaluationResultDTO>} + * @Author zhaoqifeng + * @Date 2022/10/12 14:40 + */ + List getDeptScreenDataByInterval(EventStatisticsFormDTO formDTO); } \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/ScreenDeptEventEfficiencyServiceImpl.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/ScreenDeptEventEfficiencyServiceImpl.java index 0fb116928..9aa781f2b 100644 --- a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/ScreenDeptEventEfficiencyServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/ScreenDeptEventEfficiencyServiceImpl.java @@ -68,65 +68,13 @@ public class ScreenDeptEventEfficiencyServiceImpl extends BaseServiceImpl list = baseDao.getEventEfficiencyDaily(statDate); - if (CollectionUtils.isNotEmpty(list)) { - list.forEach(item -> { - item.setStatDate(statDate); - if (item.getEventCount() != NumConstant.ZERO) { - BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); - BigDecimal eventCount = new BigDecimal(item.getEventCount()); - BigDecimal closedCount = new BigDecimal(item.getClosedCount()); - BigDecimal responseCount = new BigDecimal(item.getResponseCount()); - BigDecimal satisfiedCount = new BigDecimal(item.getSatisfiedCount()); - item.setClosedRatio(closedCount.multiply(hundred).divide(eventCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); - item.setResponseRatio(responseCount.multiply(hundred).divide(eventCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); - if (item.getClosedCount() != NumConstant.ZERO) { - item.setSatisfiedRatio(satisfiedCount.multiply(hundred).divide(closedCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); - } - } - - if (item.getLivelihoodCount() != NumConstant.ZERO) { - BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); - BigDecimal eventCount = new BigDecimal(item.getLivelihoodCount()); - BigDecimal closedCount = new BigDecimal(item.getLivelihoodClosedCount()); - BigDecimal responseCount = new BigDecimal(item.getLivelihoodResponseCount()); - BigDecimal satisfiedCount = new BigDecimal(item.getLivelihoodSatisfiedCount()); - item.setLivelihoodClosedRatio(closedCount.multiply(hundred).divide(eventCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); - item.setLivelihoodResponseRatio(responseCount.multiply(hundred).divide(eventCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); - if (item.getLivelihoodClosedCount() != NumConstant.ZERO) { - item.setLivelihoodSatisfiedRatio(satisfiedCount.multiply(hundred).divide(closedCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); - } - } - - if (item.getDevelopCount() != NumConstant.ZERO) { - BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); - BigDecimal eventCount = new BigDecimal(item.getDevelopCount()); - BigDecimal closedCount = new BigDecimal(item.getDevelopClosedCount()); - BigDecimal responseCount = new BigDecimal(item.getDevelopResponseCount()); - BigDecimal satisfiedCount = new BigDecimal(item.getDevelopSatisfiedCount()); - item.setDevelopClosedRatio(closedCount.multiply(hundred).divide(eventCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); - item.setDevelopResponseRatio(responseCount.multiply(hundred).divide(eventCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); - if (item.getDevelopClosedCount() != NumConstant.ZERO) { - item.setDevelopSatisfiedRatio(satisfiedCount.multiply(hundred).divide(closedCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); - } - } + getData(statDate, list); - if (item.getLawCount() != NumConstant.ZERO) { - BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); - BigDecimal eventCount = new BigDecimal(item.getLawCount()); - BigDecimal closedCount = new BigDecimal(item.getLawClosedCount()); - BigDecimal responseCount = new BigDecimal(item.getLawResponseCount()); - BigDecimal satisfiedCount = new BigDecimal(item.getLawSatisfiedCount()); - item.setLawClosedRatio(closedCount.multiply(hundred).divide(eventCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); - item.setLawResponseRatio(responseCount.multiply(hundred).divide(eventCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); - if (item.getLawClosedCount() != NumConstant.ZERO) { - item.setLawSatisfiedRatio(satisfiedCount.multiply(hundred).divide(closedCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); - } - } - }); - baseDao.deleteData(statDate); - insertBatch(list); - } + //区直部门统计 + List deptList = baseDao.getDeptEventEfficiencyDaily(statDate); + getDeptData(statDate, deptList); } /** @@ -147,25 +95,11 @@ public class ScreenDeptEventEfficiencyServiceImpl extends BaseServiceImpl list = baseDao.getEventEfficiencyMonthly(statDate); - if (CollectionUtils.isNotEmpty(list)) { - list.forEach(item -> { - item.setStatDate(statDate); - if (item.getEventCount() != NumConstant.ZERO) { - BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); - BigDecimal eventCount = new BigDecimal(item.getEventCount()); - BigDecimal closedCount = new BigDecimal(item.getClosedCount()); - BigDecimal responseCount = new BigDecimal(item.getResponseCount()); - BigDecimal satisfiedCount = new BigDecimal(item.getSatisfiedCount()); - item.setClosedRatio(closedCount.multiply(hundred).divide(eventCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); - item.setResponseRatio(responseCount.multiply(hundred).divide(eventCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); - if (item.getClosedCount() != NumConstant.ZERO) { - item.setSatisfiedRatio(satisfiedCount.multiply(hundred).divide(closedCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); - } - } - }); - baseDao.deleteData(statDate); - insertBatch(list); - } + getData(statDate, list); + + //区直部门统计 + List deptList = baseDao.getDeptEventEfficiencyMonthly(statDate); + getDeptData(statDate, deptList); } /** @@ -186,6 +120,51 @@ public class ScreenDeptEventEfficiencyServiceImpl extends BaseServiceImpl list = baseDao.getEventEfficiencyYearly(statDate); + getData(statDate, list); + + //区直部门统计 + List deptList = baseDao.getDeptEventEfficiencyYearly(statDate); + getDeptData(statDate, deptList); + } + + private void getDeptData(String statDate, List deptList) { + if (CollectionUtils.isNotEmpty(deptList)) { + deptList.forEach(item -> { + item.setStatDate(statDate); + if (item.getEventCount() != NumConstant.ZERO) { + BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); + BigDecimal eventCount = new BigDecimal(item.getEventCount()); + BigDecimal closedCount = new BigDecimal(item.getClosedCount()); + item.setClosedRatio(closedCount.multiply(hundred).divide(eventCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); + } + + if (item.getLivelihoodCount() != NumConstant.ZERO) { + BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); + BigDecimal eventCount = new BigDecimal(item.getLivelihoodCount()); + BigDecimal closedCount = new BigDecimal(item.getLivelihoodClosedCount()); + item.setLivelihoodClosedRatio(closedCount.multiply(hundred).divide(eventCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); + } + + if (item.getDevelopCount() != NumConstant.ZERO) { + BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); + BigDecimal eventCount = new BigDecimal(item.getDevelopCount()); + BigDecimal closedCount = new BigDecimal(item.getDevelopClosedCount()); + item.setDevelopClosedRatio(closedCount.multiply(hundred).divide(eventCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); + } + + if (item.getLawCount() != NumConstant.ZERO) { + BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); + BigDecimal eventCount = new BigDecimal(item.getLawCount()); + BigDecimal closedCount = new BigDecimal(item.getLawClosedCount()); + item.setLawClosedRatio(closedCount.multiply(hundred).divide(eventCount, NumConstant.SIX, RoundingMode.HALF_UP).stripTrailingZeros()); + } + }); + baseDao.deleteData(statDate, NumConstant.TWO_STR); + insertBatch(deptList); + } + } + + private void getData(String statDate, List list) { if (CollectionUtils.isNotEmpty(list)) { list.forEach(item -> { item.setStatDate(statDate); @@ -201,8 +180,47 @@ public class ScreenDeptEventEfficiencyServiceImpl extends BaseServiceImpl list = baseDao.getScreenDataByInterval(formDTO); + List list; + if (NumConstant.ONE_STR.equals(formDTO.getType())) { + list = baseDao.getScreenDataByInterval(formDTO); + } else { + list = baseDao.getDeptScreenDataByInterval(formDTO); + } if (CollectionUtils.isNotEmpty(list)) { list.forEach(item -> { if ("grid_party".equals(item.getDeptLevel())) { @@ -243,17 +266,19 @@ public class ScreenDeptEventEfficiencyServiceImpl extends BaseServiceImpl + AND (DEPT_LEVEL = 'street_dept' OR DEPT_LEVEL = 'district_dept') + + + AND DEPT_LEVEL != 'street_dept' + AND DEPT_LEVEL != 'district_dept' + + + + + + + \ No newline at end of file