From 26b7cb51f41673ba39817d2fd4fad3f2dcc337a5 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 25 Feb 2021 13:17:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=97=A5=E5=BF=97=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=8E=A5=E5=8F=A3bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/WorkRecordRankResultDTO.java | 7 ++++ .../plugins/ScreenWorkRecordOrgDailyDao.java | 2 +- .../ScreenWorkRecordOrgDailyServiceImpl.java | 11 +++++-- .../plugins/ScreenWorkRecordOrgDailyDao.xml | 33 ++++++++++++++----- 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordRankResultDTO.java index 08c8df3ff2..4ca6521cce 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordRankResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordRankResultDTO.java @@ -4,6 +4,7 @@ import lombok.AllArgsConstructor; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -29,4 +30,10 @@ public class WorkRecordRankResultDTO implements Serializable { *下级排行列表 */ private List subRankList; + + public WorkRecordRankResultDTO() { + this.participateTotal=0; + this.participateUserTotal=0; + this.subRankList=new ArrayList<>(); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java index ca0bc02fda..a8aee6c4ed 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java @@ -51,7 +51,7 @@ public interface ScreenWorkRecordOrgDailyDao extends BaseDao selectCurrentAgency(@Param("areaCode") String areaCode, @Param("dataType") String dataType, @Param("dateId")String dateId); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java index 84a5abbc36..3b3f424ed2 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java @@ -45,6 +45,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.time.LocalDate; import java.time.format.DateTimeFormatter; @@ -139,10 +140,14 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl()); } else { //非社区的 - WorkRecordRankResultDTO resultDTO = baseDao.selectCurrentAgency(agencyDTO.getAreaCode(), formDTO.getDataType(), dateId); - resultDTO.setSubRankList(baseDao.selectSubList(agencyDTO.getAreaCode(), agencyDTO.getAgencyId(), formDTO.getDataType(), formDTO.getTopRow(), dateId)); - return resultDTO; + List resultDTOList = baseDao.selectCurrentAgency(agencyDTO.getAreaCode(), formDTO.getDataType(), dateId); + if(!CollectionUtils.isEmpty(resultDTOList)){ + WorkRecordRankResultDTO resultDTO=resultDTOList.get(0); + resultDTO.setSubRankList(baseDao.selectSubList(agencyDTO.getAreaCode(), agencyDTO.getAgencyId(), formDTO.getDataType(), formDTO.getTopRow(), dateId)); + return resultDTO; + } } + return new WorkRecordRankResultDTO(); } /** diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml index f09b5f3f51..d0eace34dc 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml @@ -18,16 +18,27 @@ SELECT sca.AGENCY_ID AS orgId, sca.AGENCY_NAME AS `NAME`, - IFNULL( sum( m.PARTICIPATE_USER_TOTAL ), 0 ) AS participateUserTotal, - IFNULL( sum( m.ORGANIZE_TOTAL ), 0 ) AS participateTotal + IFNULL( sum( temp.PARTICIPATE_USER_TOTAL ), 0 ) AS participateUserTotal, + IFNULL( sum( temp.ORGANIZE_TOTAL ), 0 ) AS participateTotal FROM screen_customer_agency sca - LEFT JOIN screen_work_record_org_daily m ON ( sca.AGENCY_ID = m.ORG_ID AND m.DEL_FLAG = '0' AND m.DATE_ID = #{dateId} ) - LEFT JOIN screen_customer_work_record_dict dict ON ( m.TYPE_CODE = dict.RESOURCE_CODE AND dict.DEL_FLAG = '0' AND dict.DATA_TYPE = #{dataType} ) + left join ( + select m.* from screen_work_record_org_daily m + where m.DEL_FLAG = '0' + AND m.DATE_ID = #{dateId} + and m.TYPE_CODE in( + select dict. RESOURCE_CODE from screen_customer_work_record_dict dict + where dict.DEL_FLAG = '0' + AND dict.DATA_TYPE = #{dataType} + and dict.`LEVEL`='1' + ) + )temp on( + sca.AGENCY_ID = temp.ORG_ID AND temp.DEL_FLAG = '0' AND temp.DATE_ID =#{dateId} + ) WHERE sca.DEL_FLAG = '0' - AND sca.PARENT_AREA_CODE like concat( #{areaCode},'%') - and sca.AGENCY_ID !=#{agencyId} + AND sca.PARENT_AREA_CODE =#{areaCode} + AND sca.AGENCY_ID != #{agencyId} GROUP BY sca.AGENCY_ID, sca.AGENCY_NAME @@ -43,8 +54,14 @@ IFNULL( sum( m.ORGANIZE_TOTAL ), 0 ) AS participateTotal FROM screen_customer_agency sca - inner JOIN screen_work_record_org_daily m ON ( sca.AGENCY_ID = m.ORG_ID AND m.DEL_FLAG = '0' AND m.DATE_ID = #{dateId} ) - inner JOIN screen_customer_work_record_dict dict ON ( m.TYPE_CODE = dict.RESOURCE_CODE AND dict.DEL_FLAG = '0' AND dict.DATA_TYPE = #{dataType} ) + inner JOIN screen_work_record_org_daily m ON ( sca.AGENCY_ID = m.ORG_ID AND m.DEL_FLAG = '0' AND m.DATE_ID = #{dateId} + ) + inner JOIN screen_customer_work_record_dict dict + ON ( m.TYPE_CODE = dict.RESOURCE_CODE + and dict.`LEVEL`='1' + AND dict.DEL_FLAG = '0' + AND dict.DATA_TYPE = #{dataType} + ) WHERE sca.DEL_FLAG = '0' AND sca.PARENT_AREA_CODE like concat( #{areaCode},'%')