Browse Source

项目分类统计

dev_shibei_match
zxc 4 years ago
parent
commit
47b2f5bda6
  1. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java
  2. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java
  3. 32
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java
  4. 24
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java

@ -75,4 +75,13 @@ public interface ScreenProjectCategoryOrgDailyDao extends BaseDao<ScreenProjectC
* @date 2021/5/21 3:26 下午 * @date 2021/5/21 3:26 下午
*/ */
int deleteAppointData(@Param("customerId") String customerId, @Param("dateId") String dateId,@Param("orgIds")List<String> orgIds); int deleteAppointData(@Param("customerId") String customerId, @Param("dateId") String dateId,@Param("orgIds")List<String> orgIds);
/**
* @Description 计算平阴县的分类时使用查询内部客户组织的项目分类
* @Param dateId
* @Param orgIds
* @author zxc
* @date 2021/8/16 10:36 上午
*/
List<CategoryProjectResultDTO> selectSelfAgencyCategory(@Param("dateId") String dateId,@Param("orgIds")List<String> orgIds);
} }

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java

@ -19,6 +19,7 @@ package com.epmet.entity.evaluationindex.screen;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -79,4 +80,7 @@ public class ScreenProjectCategoryOrgDailyEntity extends BaseEpmetEntity {
* 分类等级12.... * 分类等级12....
*/ */
private Integer level; private Integer level;
@JsonIgnore
private Boolean useStatus = false;
} }

32
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java

@ -413,7 +413,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
Map<String, List<CategoryProjectResultDTO>> groupByCategoryCode = categoryProjectResultDTOS.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getCategoryCode)); Map<String, List<CategoryProjectResultDTO>> groupByCategoryCode = categoryProjectResultDTOS.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getCategoryCode));
// 这时的result集合要清空,因为被上边使用 【result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class);】 // 这时的result集合要清空,因为被上边使用 【result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class);】
result.clear(); result.clear();
List<ScreenProjectCategoryOrgDailyEntity> finalResult = result; List<ScreenProjectCategoryOrgDailyEntity> finalResult = new ArrayList<>();
groupByCategoryCode.forEach((code, list) -> { groupByCategoryCode.forEach((code, list) -> {
ScreenProjectCategoryOrgDailyEntity e = new ScreenProjectCategoryOrgDailyEntity(); ScreenProjectCategoryOrgDailyEntity e = new ScreenProjectCategoryOrgDailyEntity();
e.setCustomerId(customerId); e.setCustomerId(customerId);
@ -428,7 +428,32 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
}); });
if (!CollectionUtils.isEmpty(sonResult)){ if (!CollectionUtils.isEmpty(sonResult)){
List<ScreenProjectCategoryOrgDailyEntity> entities = ConvertUtils.sourceToTarget(sonResult, ScreenProjectCategoryOrgDailyEntity.class); List<ScreenProjectCategoryOrgDailyEntity> entities = ConvertUtils.sourceToTarget(sonResult, ScreenProjectCategoryOrgDailyEntity.class);
result.addAll(entities); finalResult.addAll(entities);
}
Map<String, List<CustomerAgencyInfoResultDTO>> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel));
List<CustomerAgencyInfoResultDTO> levelAgencyInfo = groupByLevel.get(level);
// 计算内部客户的分类
if (!CollectionUtils.isEmpty(levelAgencyInfo)){
List<String> orgIdss = levelAgencyInfo.stream().map(m -> m.getAgencyId()).collect(Collectors.toList());
orgIds.addAll(orgIdss);
List<CategoryProjectResultDTO> selfOrgCategory = baseDao.selectSelfAgencyCategory(dateId, orgIdss);
if (!CollectionUtils.isEmpty(selfOrgCategory)){
List<ScreenProjectCategoryOrgDailyEntity> selfResult = ConvertUtils.sourceToTarget(selfOrgCategory, ScreenProjectCategoryOrgDailyEntity.class);
selfResult.forEach(s -> {
finalResult.forEach(f -> {
if (s.getCategoryCode().equals(f.getCategoryCode())){
s.setProjectTotal(s.getProjectTotal() + f.getProjectTotal());
f.setUseStatus(true);
}
});
});
result.addAll(selfResult);
}
}
Map<Boolean, List<ScreenProjectCategoryOrgDailyEntity>> groupByStatus = finalResult.stream().collect(Collectors.groupingBy(ScreenProjectCategoryOrgDailyEntity::getUseStatus));
List<ScreenProjectCategoryOrgDailyEntity> falseList = groupByStatus.get(false);
if (!CollectionUtils.isEmpty(falseList)){
result.addAll(falseList);
} }
// 添加此 锦水、孔村、榆山 orgId,删除时使用 // 添加此 锦水、孔村、榆山 orgId,删除时使用
orgIds.add(PingYinConstant.JIN_SHUI_AGENCY_ID); orgIds.add(PingYinConstant.JIN_SHUI_AGENCY_ID);
@ -441,9 +466,8 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
List<CustomerAgencyInfoResultDTO> levelAgencyInfo = groupByLevel.get(level); List<CustomerAgencyInfoResultDTO> levelAgencyInfo = groupByLevel.get(level);
if (!CollectionUtils.isEmpty(levelAgencyInfo)) { if (!CollectionUtils.isEmpty(levelAgencyInfo)) {
List<String> orgIdss = levelAgencyInfo.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); List<String> orgIdss = levelAgencyInfo.stream().map(m -> m.getAgencyId()).collect(Collectors.toList());
orgIds.addAll(orgIdss);
// 查询客户下,组织直接立项的,各项目分类下的项目数量【筛选组织创建的项目,fact_origin_project_main_daily表gridId为空】 // 查询客户下,组织直接立项的,各项目分类下的项目数量【筛选组织创建的项目,fact_origin_project_main_daily表gridId为空】
List<ScreenProjectCategoryGridDailyDTO> screenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIds, customerId); List<ScreenProjectCategoryGridDailyDTO> screenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIdss, customerId);
if (!CollectionUtils.isEmpty(result)) { if (!CollectionUtils.isEmpty(result)) {
if (!CollectionUtils.isEmpty(screenProjectCategory)) { if (!CollectionUtils.isEmpty(screenProjectCategory)) {
result.forEach(r -> { result.forEach(r -> {

24
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml

@ -76,4 +76,28 @@
GROUP BY od.CATEGORY_CODE,od.pid GROUP BY od.CATEGORY_CODE,od.pid
</select> </select>
<!-- 查询内部客户组织的项目分类 -->
<select id="selectSelfAgencyCategory" resultType="com.epmet.dto.screen.result.CategoryProjectResultDTO">
SELECT
od.pid AS orgId,
IFNULL(sca.PID,'0') AS pid,
IFNULL(sca.PIDS,'0') AS pids,
od.level,
od.CATEGORY_CODE,
IFNULL(SUM(od.PROJECT_TOTAL),0) AS projectTotal,
od.DATE_ID
FROM screen_project_category_org_daily od
LEFT JOIN customer_project_category_dict cd ON (cd.CATEGORY_CODE = od.CATEGORY_CODE AND cd.CUSTOMER_ID = od.CUSTOMER_ID)
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = od.PID
WHERE 1=1
AND od.DEL_FLAG = '0'
AND od.ORG_ID IN (
<foreach collection="orgIds" item="orgId" separator=",">
#{orgId}
</foreach>
)
AND od.date_id = #{dateId}
GROUP BY od.CATEGORY_CODE,od.pid
</select>
</mapper> </mapper>
Loading…
Cancel
Save