diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/AgencyInfoDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/AgencyInfoDTO.java index 04d4896995..e2d3f77953 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/AgencyInfoDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/AgencyInfoDTO.java @@ -13,8 +13,9 @@ import java.util.List; */ @Data public class AgencyInfoDTO implements Serializable { - private String agencyId; - private String areaCode; - private List subAgencyIds; - private List subGridIds; + private String currentAgencyId; + private String currentAgencyName; + private String currentAreaCode; + private List subAgencies; + private List subGrids; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerAgencyCommonDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerAgencyCommonDTO.java new file mode 100644 index 0000000000..3a1078fd69 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerAgencyCommonDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * screen_customer_agency + * + * @author yinzuomei@elink-cn.com + * @date 2021/7/13 15:31 + */ +@Data +public class ScreenCustomerAgencyCommonDTO implements Serializable { + private static final long serialVersionUID = -6222325433226628163L; + private String agencyId; + private String agencyName; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerGridCommonDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerGridCommonDTO.java new file mode 100644 index 0000000000..2578a6c482 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerGridCommonDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * screen_customer_grid + * + * @author yinzuomei@elink-cn.com + * @date 2021/7/13 15:32 + */ +@Data +public class ScreenCustomerGridCommonDTO implements Serializable { + private static final long serialVersionUID = -4405092094598416917L; + private String gridId; + private String gridName; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordSubRank.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordSubRank.java index 91f3d027e9..84776cf8b1 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordSubRank.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordSubRank.java @@ -31,4 +31,6 @@ public class WorkRecordSubRank implements Serializable { * 组织次数 */ private Integer participateTotal; + + private String isDefault; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index a951b18406..e70eda7a4e 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -19,6 +19,7 @@ package com.epmet.datareport.dao.evaluationindex.screen; import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.result.ParentListResultDTO; +import com.epmet.dto.ScreenCustomerAgencyCommonDTO; import com.epmet.dto.result.ScreenCustomerAgencyDTO; import com.epmet.dto.result.plugins.AgencyNodeDTO; import com.epmet.dto.result.plugins.DeptNodeDTO; @@ -163,7 +164,7 @@ public interface ScreenCustomerAgencyDao { **/ List getNextAgencyIds(@Param("areaCode")String areaCode,@Param("agencyId")String agencyId); - List selectSubAgencyIds(@Param("areaCode")String areaCode,@Param("agencyId")String agencyId); + List selectSubAgencyIds(@Param("areaCode")String areaCode, @Param("agencyId")String agencyId); /** * @Description 根据agencyId查询网格 diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java index e0484794e6..abf21dd119 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java @@ -17,6 +17,7 @@ package com.epmet.datareport.dao.evaluationindex.screen; +import com.epmet.dto.ScreenCustomerGridCommonDTO; import com.epmet.evaluationindex.screen.dto.result.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -81,5 +82,5 @@ public interface ScreenCustomerGridDao { */ List selectGridInfo(@Param("agencyId")String agencyId); - List selectSubGridIds(@Param("areaCode")String areaCode, @Param("agencyId")String agencyId); + List selectSubGridIds(@Param("areaCode")String areaCode, @Param("agencyId")String agencyId); } \ No newline at end of file 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 d27a4eee75..734d8d938b 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 @@ -55,16 +55,14 @@ public interface ScreenWorkRecordOrgDailyDao extends BaseDao customerIds); + WorkRecordSubRank selectCurrentAgency(@Param("agencyId") String agencyId, + @Param("dateId")String dateId, + @Param("typeCodeList")List typeCodeList); + + List selectCustomerTypeCode(@Param("dataType")String dataType, @Param("customerId")String customerId); + + + WorkRecordSubRank selectUpToCalAgency(@Param("agencyId")String agencyId, @Param("dateId")String dateId,@Param("typeCodeList") List typeCodeList); - List selectCurrentAgency(@Param("agencyId") String agencyId, - @Param("dataType")String dataType, - @Param("customerId")String customerId, - @Param("dateId")String dateId); + WorkRecordSubRank selectUpToCalGrid(@Param("gridId")String gridId, @Param("dateId")String dateId, @Param("typeCodeList")List typeCodeList); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java index 538df72f10..c6dc8deba2 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java @@ -334,10 +334,10 @@ public class AgencyServiceImpl implements AgencyService { @Override public AgencyInfoDTO getAgencyInfoDTO(String areaCode, String agencyId) { AgencyInfoDTO agencyInfoDTO=new AgencyInfoDTO(); - agencyInfoDTO.setAgencyId(agencyId); - agencyInfoDTO.setAreaCode(areaCode); - agencyInfoDTO.setSubAgencyIds(screenCustomerAgencyDao.selectSubAgencyIds(areaCode,agencyId)); - agencyInfoDTO.setSubGridIds(screenCustomerGridDao.selectSubGridIds(areaCode,agencyId)); + agencyInfoDTO.setCurrentAgencyId(agencyId); + agencyInfoDTO.setCurrentAreaCode(areaCode); + agencyInfoDTO.setSubAgencies(screenCustomerAgencyDao.selectSubAgencyIds(areaCode,agencyId)); + agencyInfoDTO.setSubGrids(screenCustomerGridDao.selectSubGridIds(areaCode,agencyId)); return agencyInfoDTO; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java index 0991305f4f..3c3cc0419b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java @@ -18,7 +18,6 @@ package com.epmet.datareport.service.plugins; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; import com.epmet.datareport.entity.plugins.ScreenWorkRecordOrgDailyEntity; import com.epmet.plugins.ScreenWorkRecordOrgDailyDTO; import com.epmet.plugins.form.VoluntaryServiceTrendFormDTO; @@ -39,16 +38,6 @@ import java.util.Map; */ public interface ScreenWorkRecordOrgDailyService extends BaseService { - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2021-02-23 - */ - PageData page(Map params); - /** * 默认查询 * @@ -69,36 +58,6 @@ public interface ScreenWorkRecordOrgDailyService extends BaseService page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, ScreenWorkRecordOrgDailyDTO.class); - } @Override public List list(Map params) { @@ -108,65 +95,65 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl customerIds=new ArrayList<>(); - Result> result=operCrmOpenFeignClient.getAllSubCustomerIds(formDTO.getCustomerId()); - // log.info("根据customerId查询其所有下级子客户id result: "+JSON.toJSONString(result)); - if (result.success() && CollectionUtils.isNotEmpty(result.getData())) { - customerIds.addAll(result.getData()); - } - customerIds.add(formDTO.getCustomerId()); - String dateId= baseDao.selectLatestDateId(customerIds); - if(StringUtils.isBlank(dateId)){ - dateId= com.epmet.commons.tools.utils.DateUtils.getBeforeNDay(NumConstant.ONE); - log.warn("dateId 赋值为"+dateId+" ; selectLatestDateId dateId is null customerIds" + JSON.toJSONString(customerIds)); - } + //默认截止到前一天 + String dateId= com.epmet.commons.tools.utils.DateUtils.getBeforeNDay(NumConstant.ONE); WorkRecordRankResultDTO returnDto = new WorkRecordRankResultDTO(); AgencyInfoDTO agencyInfoDTO = agencyService.getAgencyInfoDTO(formDTO.getAreaCode(), formDTO.getAgencyId()); - // log.info("agencyInfoDTO: "+JSON.toJSONString(agencyInfoDTO)); - //当前组织的自身的数据 - List currentAgency = baseDao.selectCurrentAgency(formDTO.getAgencyId(), - formDTO.getDataType(), - formDTO.getCustomerId(), - dateId); - //下级所有组织 - List subAgencyRankList = CollectionUtils.isNotEmpty(agencyInfoDTO.getSubAgencyIds()) ? baseDao.selectSubList( - agencyInfoDTO.getSubAgencyIds(), - formDTO.getDataType(), - formDTO.getCustomerId(), - dateId) : new ArrayList<>(); - //直属网格 - List subGridList = CollectionUtils.isNotEmpty(agencyInfoDTO.getSubGridIds()) ? baseDao.selectSubGridList( - agencyInfoDTO.getSubGridIds(), - formDTO.getDataType(), - formDTO.getCustomerId(), - dateId) : new ArrayList<>(); + log.info("agencyInfoDTO: "+JSON.toJSONString(agencyInfoDTO)); + + //随手记类型编码;对应screen_customer_work_record_dict的资源编码 + List typeCodeList=baseDao.selectCustomerTypeCode(formDTO.getDataType(),formDTO.getCustomerId()); + if(CollectionUtils.isEmpty(typeCodeList)){ + log.warn(String.format("当前customerId=%s,screen_customer_work_record_dict 为空")); + } + + //1)、当前组织的自身的数据 + WorkRecordSubRank currentAgency = baseDao.selectCurrentAgency(formDTO.getAgencyId(),dateId,typeCodeList); + //2)、下级所有组织 + List subAgencyRankList = new ArrayList<>(); + for(ScreenCustomerAgencyCommonDTO agencyCommonDTO:agencyInfoDTO.getSubAgencies()){ + WorkRecordSubRank agencyRes= baseDao.selectUpToCalAgency(agencyCommonDTO.getAgencyId(),dateId,typeCodeList); + if(null !=agencyRes){ + subAgencyRankList.add(agencyRes); + }else{ + WorkRecordSubRank agencyDefault=new WorkRecordSubRank(); + agencyDefault.setOrgId(agencyCommonDTO.getAgencyId()); + agencyDefault.setName(agencyCommonDTO.getAgencyName()); + agencyDefault.setParticipateTotal(0); + agencyDefault.setParticipateUserTotal(0); + agencyDefault.setIsDefault("yes"); + subAgencyRankList.add(agencyDefault); + } + + } + //3)、直属网格 + List subGridList=new ArrayList<>(); + for(ScreenCustomerGridCommonDTO gridCommonDTO:agencyInfoDTO.getSubGrids()){ + WorkRecordSubRank gridRes=baseDao.selectUpToCalGrid(gridCommonDTO.getGridId(),dateId,typeCodeList); + if (null != gridRes) { + subGridList.add(gridRes); + } else { + WorkRecordSubRank gridResDefault = new WorkRecordSubRank(); + gridResDefault.setOrgId(gridCommonDTO.getGridId()); + gridResDefault.setName(gridCommonDTO.getGridName()); + gridResDefault.setParticipateTotal(0); + gridResDefault.setParticipateUserTotal(0); + gridResDefault.setIsDefault("yes"); + subAgencyRankList.add(gridResDefault); + } + } + + if(CollectionUtils.isNotEmpty(subAgencyRankList)){ + returnDto.getSubRankList().addAll(subAgencyRankList); + } + if(CollectionUtils.isNotEmpty(subGridList)){ + returnDto.getSubRankList().addAll(subGridList); + } - returnDto.getSubRankList().addAll(subAgencyRankList); - returnDto.getSubRankList().addAll(subGridList); // log.info("returnDto.getSubRankList()="+returnDto.getSubRankList()); int participateUserTotal = 0; int participateTotal = 0; @@ -174,11 +161,9 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl orgIds = new ArrayList<>(); - orgIds.addAll(agencyInfoDTO.getSubAgencyIds()); - orgIds.add(agencyInfoDTO.getAgencyId()); - orgIds.addAll(agencyInfoDTO.getSubGridIds()); + orgIds.addAll(agencyInfoDTO.getSubAgencies().stream().map(agency->agency.getAgencyId()).collect(Collectors.toSet())); + orgIds.add(agencyInfoDTO.getCurrentAgencyId()); + orgIds.addAll(agencyInfoDTO.getSubGrids().stream().map(grid->grid.getGridId()).collect(Collectors.toSet())); List list = screenWorkRecordOrgMonthlyDao.selectVoluntaryServiceTrendDTO(formDTO.getCustomerId(), orgIds, monthIdList.get(NumConstant.ZERO), 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 3f43d05337..7d6a14c085 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 @@ -3,19 +3,6 @@ - - + + + + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml index 83770370b5..183e74bb02 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml @@ -305,9 +305,10 @@ - SELECT - sca.AGENCY_ID as orgId + sca.AGENCY_ID as agencyId, + sca.AGENCY_NAME as agencyName FROM screen_customer_agency sca WHERE diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml index 2d9f8e5deb..a700e40792 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml @@ -122,9 +122,10 @@ GROUP BY scg.PARENT_AGENCY_ID - SELECT - m.GRID_ID as orgId + m.GRID_ID as gridId, + m.grid_name as gridName FROM screen_customer_grid m where m.DEL_FLAG = '0' diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordCommonFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordCommonFormDTO.java index f72d2f3667..ef83c2160b 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordCommonFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordCommonFormDTO.java @@ -18,6 +18,14 @@ public class ScreenWorkRecordCommonFormDTO implements Serializable { * 组织Id或者网格id */ private String orgId; + /** + * org_id的上级 + */ + private String pid; + /** + * org_id的所有上级英文冒号或者顿号隔开都可 + */ + private String pids; /** * 组织名称或者网格名 diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java index 65e98b940b..2a707f9540 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java @@ -15,11 +15,12 @@ * along with this program. If not, see . */ -package com.epmet.dto; +package com.epmet.dto.screen; + +import lombok.Data; import java.io.Serializable; import java.util.Date; -import lombok.Data; /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml index 9bf253e4a5..3be24445bf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml @@ -17,6 +17,8 @@ customer_id, DATE_ID, org_id, + pid, + pids, org_name, meeting_code, type_code, @@ -36,6 +38,8 @@ #{customerId}, #{dateId}, #{item.orgId}, + #{item.pid}, + #{item.pids}, #{item.orgName}, #{item.meetingCode}, #{item.typeCode},