Browse Source

项目分类 org 单客户修改

master
zxc 4 years ago
parent
commit
b3c891ae5b
  1. 7
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryGridDailyDTO.java
  2. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectCategoryDailyDao.java
  3. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectCategoryDailyService.java
  4. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectCategoryDailyServiceImpl.java
  5. 44
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java
  6. 42
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml

7
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryGridDailyDTO.java

@ -108,4 +108,11 @@ public class ScreenProjectCategoryGridDailyDTO implements Serializable {
*/
private Date updatedTime;
private String orgId;
/**
* 用在 项目分类 org 统计中记录本记录是否被计数
*/
private Boolean status = false;
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectCategoryDailyDao.java

@ -43,4 +43,12 @@ public interface FactOriginProjectCategoryDailyDao extends BaseDao<FactOriginPro
* @Date 2021/3/23 9:58
**/
List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryGridDailyDTO(@Param("customerId") String customerId);
/**
* @Description 查询客户下组织直接立项的各项目分类下的项目数量筛选组织创建的项目fact_origin_project_main_daily表gridId为空
* @Param orgIds
* @author zxc
* @date 2021/4/13 下午4:36
*/
List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryByOrg(@Param("orgIds")List<String> orgIds,@Param("customerId") String customerId);
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectCategoryDailyService.java

@ -47,4 +47,12 @@ public interface FactOriginProjectCategoryDailyService extends BaseService<FactO
* @Date 2021/3/23 9:56
**/
List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryGridDailyDTO(String customerId);
/**
* @Description 查询客户下组织直接立项的各项目分类下的项目数量筛选组织创建的项目fact_origin_project_main_daily表gridId为空
* @Param orgIds
* @author zxc
* @date 2021/4/13 下午4:36
*/
List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryByOrg(List<String> orgIds,String customerId);
}

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectCategoryDailyServiceImpl.java

@ -32,6 +32,7 @@ import com.epmet.service.Issue.IssueProjectCategoryDictService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectCategoryDailyService;
import com.epmet.service.project.ProjectService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -119,4 +120,18 @@ public class FactOriginProjectCategoryDailyServiceImpl extends BaseServiceImpl<F
List<ScreenProjectCategoryGridDailyDTO> list=baseDao.selectListProjectCategoryGridDailyDTO(customerId);
return list;
}
/**
* @Description 查询客户下组织直接立项的各项目分类下的项目数量筛选组织创建的项目fact_origin_project_main_daily表gridId为空
* @Param orgIds
* @author zxc
* @date 2021/4/13 下午4:36
*/
@Override
public List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryByOrg(List<String> orgIds,String customerId) {
if (!CollectionUtils.isEmpty(orgIds)){
return new ArrayList<>();
}
return baseDao.selectListProjectCategoryByOrg(orgIds,customerId);
}
}

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

@ -31,12 +31,14 @@ import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryGridDailyDao;
import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao;
import com.epmet.dto.ScreenCustomerGridDTO;
import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO;
import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO;
import com.epmet.dto.screen.ScreenProjectCategoryOrgDailyDTO;
import com.epmet.dto.screen.result.CategoryProjectResultDTO;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
import com.epmet.entity.crm.CustomerRelationEntity;
import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryOrgDailyEntity;
import com.epmet.service.crm.CustomerRelationService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectCategoryDailyService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService;
import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryOrgDailyService;
@ -74,6 +76,8 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
private ScreenProjectCategoryGridDailyDao gridDailyDao;
@Autowired
private ScreenCustomerGridService gridService;
@Autowired
private FactOriginProjectCategoryDailyService factOriginProjectCategoryDailyService;
@Override
public PageData<ScreenProjectCategoryOrgDailyDTO> page(Map<String, Object> params) {
@ -194,23 +198,23 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
Map<String, List<CustomerAgencyInfoResultDTO>> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel));
if (groupByLevel.containsKey(ScreenConstant.COMMUNITY)){
// 社区级别
disposeOneCustomerSub(ScreenConstant.COMMUNITY,true,customerId,dateId);
disposeOneCustomerSub(ScreenConstant.COMMUNITY,true,customerId,dateId,agencyIdList);
}
if (groupByLevel.containsKey(ScreenConstant.STREET)){
// 街道级别
disposeOneCustomerSub(ScreenConstant.STREET,false,customerId,dateId);
disposeOneCustomerSub(ScreenConstant.STREET,false,customerId,dateId,agencyIdList);
}
if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){
// 区级
disposeOneCustomerSub(ScreenConstant.DISTRICT,false,customerId,dateId);
disposeOneCustomerSub(ScreenConstant.DISTRICT,false,customerId,dateId,agencyIdList);
}
if (groupByLevel.containsKey(ScreenConstant.CITY)){
// 市级
disposeOneCustomerSub(ScreenConstant.CITY,false,customerId,dateId);
disposeOneCustomerSub(ScreenConstant.CITY,false,customerId,dateId,agencyIdList);
}
if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){
// 省级
disposeOneCustomerSub(ScreenConstant.PROVINCE,false,customerId,dateId);
disposeOneCustomerSub(ScreenConstant.PROVINCE,false,customerId,dateId,agencyIdList);
}
}
}
@ -224,7 +228,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
* @author zxc
* @date 2021/3/25 上午10:44
*/
public void disposeOneCustomerSub(String level, Boolean isGrid, String customerId, String dateId){
public void disposeOneCustomerSub(String level, Boolean isGrid, String customerId, String dateId,List<CustomerAgencyInfoResultDTO> agencyIdList){
List<ScreenProjectCategoryOrgDailyEntity> result = new ArrayList<>();
if (isGrid){
// 是社区级别
@ -255,6 +259,34 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
}
result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class);
}
// 组织项目分类 项目数
List<String> orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList());
List<ScreenProjectCategoryGridDailyDTO> screenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIds,customerId);
if (!CollectionUtils.isEmpty(result)){
if (!CollectionUtils.isEmpty(screenProjectCategory)){
result.forEach(r -> {
screenProjectCategory.forEach(pc -> {
if (r.getOrgId().equals(pc.getOrgId()) && r.getCategoryCode().equals(pc.getCategoryCode())){
pc.setStatus(true);
r.setProjectTotal(r.getProjectTotal() + pc.getProjectTotal());
}
});
});
Map<Boolean, List<ScreenProjectCategoryGridDailyDTO>> groupByStatus = screenProjectCategory.stream().collect(Collectors.groupingBy(ScreenProjectCategoryGridDailyDTO::getStatus));
List<ScreenProjectCategoryGridDailyDTO> screenProjectCategoryNoCal = groupByStatus.get(false);
if (!CollectionUtils.isEmpty(screenProjectCategoryNoCal)){
List<ScreenProjectCategoryOrgDailyEntity> noCalCategory = ConvertUtils.sourceToTarget(screenProjectCategoryNoCal, ScreenProjectCategoryOrgDailyEntity.class);
result.addAll(noCalCategory);
}
}
}else {
if (!CollectionUtils.isEmpty(screenProjectCategory)){
result = ConvertUtils.sourceToTarget(screenProjectCategory, ScreenProjectCategoryOrgDailyEntity.class);
}
}
if (!CollectionUtils.isEmpty(result)){
result.forEach(r -> {r.setOrgType(level);r.setDateId(dateId);});
}
deleteAndInsert(customerId,dateId,result);
}

42
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml

@ -63,4 +63,46 @@
p.AGENCY_ID,
P.PIDS
</select>
<!-- 查询客户下,组织直接立项的,各项目分类下的项目数量 -->
<select id="selectListProjectCategoryByOrg" resultType="com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO">
SELECT
c.CUSTOMER_ID,
c.CATEGORY_CODE,
c.`LEVEL`,
p.AGENCY_ID AS orgId,
p.PID AS PID,
P.PIDS,
COUNT(DISTINCT p.ID) AS projectTotal
FROM fact_origin_project_main_daily p
LEFT JOIN fact_origin_project_category_daily c ON ( c.PROJECT_Id = p.id AND p.del_flag='0' AND p.GRID_ID IS NULL)
WHERE c.DEL_FLAG = '0'
AND c.CUSTOMER_ID = #{customerId}
AND (
<foreach collection="orgIds" item="orgId" separator=" OR ">
p.AGENCY_ID = #{orgId}
</foreach>
)
AND c.`LEVEL` = '2'
GROUP BY c.CUSTOMER_ID, c.CATEGORY_CODE, c.`LEVEL`, p.AGENCY_ID, p.PID, P.PIDS
UNION ALL
SELECT
c.CUSTOMER_ID,
left(c.CATEGORY_CODE, 4) AS CATEGORY_CODE,
'1' AS `LEVEL`,
p.AGENCY_ID AS orgId,
p.PID AS PID,
P.PIDS,
COUNT(distinct p.ID) AS projectTotal
FROM fact_origin_project_main_daily p
LEFT JOIN fact_origin_project_category_daily c ON ( c.PROJECT_Id = p.id AND p.del_flag='0' AND p.GRID_ID IS NULL)
WHERE c.DEL_FLAG = '0'
AND c.CUSTOMER_ID = #{customerId}
AND (
<foreach collection="orgIds" item="orgId" separator=" OR ">
p.AGENCY_ID = #{orgId}
</foreach>
)
GROUP BY c.CUSTOMER_ID, left(c.CATEGORY_CODE, 4), c.`LEVEL`, p.PID, p.AGENCY_ID, P.PIDS
</select>
</mapper>

Loading…
Cancel
Save