Browse Source

Merge remote-tracking branch 'origin/dev_add_closedCount_category' into develop

# Conflicts:
#	epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
master
zxc 4 years ago
parent
commit
2eaccd82eb
  1. 10
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  2. 3
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java
  3. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java
  4. 43
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml
  5. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  6. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java
  7. 45
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java
  8. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java
  9. 22
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml

10
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -12,6 +12,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
/** /**
* @author Mark sunlightcs@gmail.com * @author Mark sunlightcs@gmail.com
@ -568,6 +569,15 @@ public class RedisKeys {
return rootPrefix.concat("message:mq:blocked:").concat(blockedMsgLabel); return rootPrefix.concat("message:mq:blocked:").concat(blockedMsgLabel);
} }
/**
* desc:获取执行完毕的 业务 参数结果key
* @param bizMethod
* @return
*/
public static String getBackDoorbizExcuteResult(String bizMethod) {
return rootPrefix.concat("backdoor:").concat(bizMethod);
}
/** /**
* @description 登录票据目前只有IC基层治理平台用到 * @description 登录票据目前只有IC基层治理平台用到
* *

3
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java

@ -55,6 +55,7 @@ public interface ScreenProjectDataDao {
* @date 2021/11/5 1:40 下午 * @date 2021/11/5 1:40 下午
*/ */
List<CategoryProjectListResultDTO> selectCategoryProjectList(@Param("customerId") String customerId,@Param("orgId") String orgId, List<CategoryProjectListResultDTO> selectCategoryProjectList(@Param("customerId") String customerId,@Param("orgId") String orgId,
@Param("categoryCode")String categoryCode,@Param("status")String status); @Param("categoryCode")String categoryCode,@Param("status")String status,
@Param("startTime")String startTime,@Param("endTime")String endTime);
} }

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java

@ -382,7 +382,7 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
PageCategoryProjectListResultDTO result = new PageCategoryProjectListResultDTO(); PageCategoryProjectListResultDTO result = new PageCategoryProjectListResultDTO();
List<CategoryProjectListResultDTO> list; List<CategoryProjectListResultDTO> list;
PageInfo<CategoryProjectListResultDTO> objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) PageInfo<CategoryProjectListResultDTO> objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage())
.doSelectPageInfo(() -> screenProjectDataDao.selectCategoryProjectList(tokenDto.getCustomerId(), formDTO.getOrgId(), formDTO.getCategoryCode(), formDTO.getStatus())); .doSelectPageInfo(() -> screenProjectDataDao.selectCategoryProjectList(tokenDto.getCustomerId(), formDTO.getOrgId(), formDTO.getCategoryCode(), formDTO.getStatus(),formDTO.getStartTime(),formDTO.getEndTime()));
list = objectPageInfo.getList(); list = objectPageInfo.getList();
result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal()))); result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal())));

43
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml

@ -162,24 +162,29 @@
<!-- 查询分类下的项目列表 --> <!-- 查询分类下的项目列表 -->
<select id="selectCategoryProjectList" resultType="com.epmet.project.dto.result.CategoryProjectListResultDTO"> <select id="selectCategoryProjectList" resultType="com.epmet.project.dto.result.CategoryProjectListResultDTO">
SELECT SELECT
ALL_CATEGORY_NAME AS category, DISTINCT pd.PROJECT_ID AS projectId,
CASE WHEN PROJECT_STATUS_CODE = 'closed_case' THEN 'closed' ELSE PROJECT_STATUS_CODE END AS projectStatus, pd.ALL_CATEGORY_NAME AS category,
IFNULL(PROJECT_TITLE,'') AS projectTitle, CASE WHEN pd.PROJECT_STATUS_CODE = 'closed_case' THEN 'closed' ELSE pd.PROJECT_STATUS_CODE END AS projectStatus,
DATE_FORMAT(PROJECT_CREATE_TIME,'%Y-%m-%d %h:%i:%s') AS createTime, IFNULL(pd.PROJECT_TITLE,'') AS projectTitle,
ORG_ID, DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y-%m-%d %h:%i:%s') AS createTime,
ORG_TYPE, pd.ORG_ID,
PROJECT_ID, pd.ORG_TYPE,
LINK_NAME, pd.LINK_NAME,
LINK_MOBILE, pd.LINK_MOBILE,
PROJECT_ADDRESS pd.PROJECT_ADDRESS
FROM screen_project_data FROM screen_project_data pd
WHERE DEL_FLAG = '0' INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
<if test=' status == "closed" '> WHERE pd.DEL_FLAG = '0'
AND PROJECT_STATUS_CODE IN ('closed_case','closed') <if test=' status == "closed" '>
</if> AND pd.PROJECT_STATUS_CODE IN ('closed_case','closed')
AND CONCAT(ALL_PARENT_IDS,':',ORG_ID) LIKE CONCAT('%',#{orgId},'%') </if>
AND CATEGORY_CODE LIKE CONCAT('%',#{categoryCode},'%') AND CONCAT(pd.ALL_PARENT_IDS,':',pd.ORG_ID) LIKE CONCAT('%',#{orgId},'%')
AND CUSTOMER_ID = #{customerId} AND pc.CATEGORY_CODE LIKE CONCAT(#{categoryCode},'%')
ORDER BY PROJECT_CREATE_TIME DESC AND pd.CUSTOMER_ID = #{customerId}
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{endTime}
<if test="null != startTime and startTime != '' ">
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') >= #{startTime}
</if>
ORDER BY pd.PROJECT_CREATE_TIME DESC
</select> </select>
</mapper> </mapper>

14
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
@ -60,9 +62,7 @@ import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future; import java.util.concurrent.Future;
@ -73,7 +73,8 @@ import java.util.concurrent.Future;
public class DemoController { public class DemoController {
@Autowired @Autowired
private StatsDemoService demoService; private StatsDemoService demoService;
@Autowired
private RedisUtils redisUtils;
@Autowired @Autowired
private ExecutorService executorService; private ExecutorService executorService;
@ -1084,16 +1085,21 @@ public class DemoController {
@RequestParam(name = "startDate",required = false)String startDate, @RequestParam(name = "startDate",required = false)String startDate,
@RequestParam(name = "endDate",required = false)String endDate @RequestParam(name = "endDate",required = false)String endDate
){ ){
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
Set<String> result = new LinkedHashSet<>();
if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)){ if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)){
List<String> daysBetween = DateUtils.getDaysBetween(startDate, endDate); List<String> daysBetween = DateUtils.getDaysBetween(startDate, endDate);
daysBetween.forEach(d -> { daysBetween.forEach(d -> {
screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,d); screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,d);
screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,d); screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,d);
result.add(d);
redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("gridandorgdailynew"),customerId,result,3*24*60*60L);
}); });
}else { }else {
screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,dateId); screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,dateId);
screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,dateId); screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,dateId);
redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("gridandorgdailynew"),customerId,result,3*24*60*60L);
} }
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
long l = (end - start) / 1000; long l = (end - start) / 1000;

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java

@ -80,7 +80,7 @@ public interface ScreenProjectDataDao extends BaseDao<ScreenProjectDataEntity> {
* @author zxc * @author zxc
* @date 2021/11/10 3:12 下午 * @date 2021/11/10 3:12 下午
*/ */
List<GridAndOrgCategoryCountResultDTO> selectGridCategoryProjectCount(@Param("customerIds") List<String> customerIds,@Param("dateId") String dateId, List<GridAndOrgCategoryCountResultDTO> selectGridCategoryProjectCount(@Param("dateId") String dateId,@Param("parentCustomerId") String parentCustomerId,
@Param("status")String status,@Param("customerId") String customerId, @Param("status")String status,@Param("customerId") String customerId,
@Param("subCount")Integer subCount); @Param("subCount")Integer subCount);

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

@ -65,6 +65,8 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
*/ */
@Override @Override
public void extractCategoryProjectGridData(String customerId, String dateId) { public void extractCategoryProjectGridData(String customerId, String dateId) {
log.info("开始执行网格项目分类统计");
long start = System.currentTimeMillis();
List<CustomerRelationEntity> relationInfo = relationService.selectSubCustomer(customerId); List<CustomerRelationEntity> relationInfo = relationService.selectSubCustomer(customerId);
List<String> customerIds = new ArrayList<>(); List<String> customerIds = new ArrayList<>();
customerIds.add(customerId); customerIds.add(customerId);
@ -72,19 +74,28 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
List<GridAndOrgCategoryCountResultDTO> closedList = new ArrayList<>(); List<GridAndOrgCategoryCountResultDTO> closedList = new ArrayList<>();
if (CollectionUtils.isEmpty(relationInfo)){ if (CollectionUtils.isEmpty(relationInfo)){
// 单客户 // 单客户
allList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_ALL,customerId, NumConstant.FOUR); allList = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_ALL,customerId, NumConstant.FOUR);
closedList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_CLOSED,customerId, NumConstant.FOUR); closedList = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_CLOSED,customerId, NumConstant.FOUR);
}else { }else {
// 多客户 // 多客户
List<String> subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList()); List<String> subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList());
customerIds.addAll(subCustomerIds); customerIds.addAll(subCustomerIds);
allList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_ALL,customerId, NumConstant.TWO); List<GridAndOrgCategoryCountResultDTO> finalAllList = allList;
closedList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_CLOSED,customerId, NumConstant.TWO); List<GridAndOrgCategoryCountResultDTO> finalClosedList1 = closedList;
customerIds.forEach(c -> {
List<GridAndOrgCategoryCountResultDTO> all = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_ALL, c, NumConstant.TWO);
finalAllList.addAll(all);
List<GridAndOrgCategoryCountResultDTO> closed = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_CLOSED, c, NumConstant.TWO);
finalClosedList1.addAll(closed);
});
} }
List<GridAndOrgCategoryCountResultDTO> finalClosedList = closedList; List<GridAndOrgCategoryCountResultDTO> finalClosedList = closedList;
allList.forEach(a -> finalClosedList.stream().filter(c -> c.getGridId().equals(a.getGridId()) && c.getCategoryCode().equals(a.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); allList.forEach(a -> finalClosedList.stream().filter(c -> c.getGridId().equals(a.getGridId()) && c.getCategoryCode().equals(a.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
gridDel(customerId,dateId); gridDel(customerId,dateId);
log.info("网格-所有项目分类即将插入的集合{}",JSON.toJSONString(allList));
gridInsert(allList); gridInsert(allList);
long end = System.currentTimeMillis();
log.info("网格项目分类统计结束,耗时:"+ (end-start)/1000 + "s");
} }
/** /**
@ -128,6 +139,8 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
*/ */
@Override @Override
public void extractCategoryProjectOrgData(String customerId, String dateId) { public void extractCategoryProjectOrgData(String customerId, String dateId) {
log.info("开始执行组织项目分类统计");
long start = System.currentTimeMillis();
List<CustomerRelationEntity> relationInfo = relationService.selectSubCustomer(customerId); List<CustomerRelationEntity> relationInfo = relationService.selectSubCustomer(customerId);
List<String> customerIds = new ArrayList<>(); List<String> customerIds = new ArrayList<>();
customerIds.add(customerId); customerIds.add(customerId);
@ -136,14 +149,18 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
// one customer // one customer
List<ScreenProjectOrgDailyDTO> agencies = screenCustomerAgencyDao.selectAgencyByCustomer(customerId); List<ScreenProjectOrgDailyDTO> agencies = screenCustomerAgencyDao.selectAgencyByCustomer(customerId);
List<GridAndOrgCategoryCountResultDTO> allAgencies = ConvertUtils.sourceToTarget(agencies, GridAndOrgCategoryCountResultDTO.class); List<GridAndOrgCategoryCountResultDTO> allAgencies = ConvertUtils.sourceToTarget(agencies, GridAndOrgCategoryCountResultDTO.class);
result = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies); result = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies);
List<GridAndOrgCategoryCountResultDTO> closedList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies);
result.forEach(r -> closedList.stream().filter(c -> r.getOrgId().equals(c.getOrgId()) && r.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> r.setClosedProjectTotal(c.getClosedProjectTotal())));
List<GridAndOrgCategoryCountResultDTO> oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies); List<GridAndOrgCategoryCountResultDTO> oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies);
List<GridAndOrgCategoryCountResultDTO> oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies); List<GridAndOrgCategoryCountResultDTO> oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies);
oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
result.addAll(oneLevelList); result.addAll(oneLevelList);
List<GridAndOrgCategoryCountResultDTO> closedList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies); }else {
result.forEach(r -> closedList.stream().filter(c -> r.getOrgId().equals(c.getOrgId()) && r.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> r.setClosedProjectTotal(c.getClosedProjectTotal())));
}else {
// more customers // more customers
// 去除孔村的客户ID,孔村镇的单独查😡 // 去除孔村的客户ID,孔村镇的单独查😡
List<String> subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList()); List<String> subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList());
@ -153,22 +170,28 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
continue; continue;
} }
} }
subCustomerIds.add(customerId);
List<GridAndOrgCategoryCountResultDTO> allAgencies = screenCustomerAgencyDao.selectParentSonAgency(subCustomerIds, PingYinConstant.KONG_CUN_CUSTOMER_ID); List<GridAndOrgCategoryCountResultDTO> allAgencies = screenCustomerAgencyDao.selectParentSonAgency(subCustomerIds, PingYinConstant.KONG_CUN_CUSTOMER_ID);
List<List<GridAndOrgCategoryCountResultDTO>> partition = ListUtils.partition(allAgencies, NumConstant.FIFTY); List<List<GridAndOrgCategoryCountResultDTO>> partition = ListUtils.partition(allAgencies, NumConstant.FIFTY);
List<GridAndOrgCategoryCountResultDTO> allOrgCategoryList = result; List<GridAndOrgCategoryCountResultDTO> allOrgCategoryList = result;
partition.forEach(p -> { partition.forEach(p -> {
List<GridAndOrgCategoryCountResultDTO> allOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.TWO, p); List<GridAndOrgCategoryCountResultDTO> allOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.TWO, p);
List<GridAndOrgCategoryCountResultDTO> oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies);
List<GridAndOrgCategoryCountResultDTO> oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies);
oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
allOrgList.addAll(oneLevelList);
List<GridAndOrgCategoryCountResultDTO> closedOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.TWO, p); List<GridAndOrgCategoryCountResultDTO> closedOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.TWO, p);
allOrgList.forEach(a -> closedOrgList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); allOrgList.forEach(a -> closedOrgList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
List<GridAndOrgCategoryCountResultDTO> oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.TWO, p);
List<GridAndOrgCategoryCountResultDTO> oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.TWO, p);
oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
allOrgList.addAll(oneLevelList);
allOrgCategoryList.addAll(allOrgList); allOrgCategoryList.addAll(allOrgList);
}); });
} }
orgDel(customerId,dateId); orgDel(customerId,dateId);
log.info("组织-即将插入的项目分类{}",JSON.toJSONString(result));
orgInsert(result); orgInsert(result);
long end = System.currentTimeMillis();
log.info("组织项目分类统计结束,耗时:"+ (end-start)/1000 + "s");
} }
/** /**

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

@ -373,11 +373,12 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectD
entity.setCategoryCode(categoryEntity.getEpmetCategoryCode()); entity.setCategoryCode(categoryEntity.getEpmetCategoryCode());
CustomerProjectCategoryDictEntity parent = customerProjectCategoryDictService.getByCategoryCode(parentCustomer.getData(), categoryEntity.getEpmetCategoryCode()); CustomerProjectCategoryDictEntity parent = customerProjectCategoryDictService.getByCategoryCode(parentCustomer.getData(), categoryEntity.getEpmetCategoryCode());
entity.setParentCategoryCode(parent.getParentCategoryCode()); entity.setParentCategoryCode(parent.getParentCategoryCode());
entity.setLevel(parent.getLevel());
} else { } else {
entity.setCategoryCode(categoryEntity.getCategoryCode()); entity.setCategoryCode(categoryEntity.getCategoryCode());
entity.setParentCategoryCode(categoryEntity.getParentCategoryCode()); entity.setParentCategoryCode(categoryEntity.getParentCategoryCode());
entity.setLevel(categoryEntity.getLevel());
} }
entity.setLevel(categoryEntity.getLevel());
} }
projectCategoryList.add(entity); projectCategoryList.add(entity);
}); });

22
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml

@ -274,7 +274,7 @@
<select id="selectGridCategoryProjectCount" resultType="com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO"> <select id="selectGridCategoryProjectCount" resultType="com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO">
SELECT SELECT
#{dateId} AS dateId, #{dateId} AS dateId,
#{customerId} AS customerId, #{parentCustomerId} AS customerId,
pc.CATEGORY_CODE, pc.CATEGORY_CODE,
pd.ORG_ID AS gridId, pd.ORG_ID AS gridId,
pd.PARENT_ID AS pid, pd.PARENT_ID AS pid,
@ -287,12 +287,9 @@
COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal
</if> </if>
FROM screen_project_data pd FROM screen_project_data pd
LEFT JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0') inner JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
WHERE pd.DEL_FLAG = '0' WHERE pd.DEL_FLAG = '0'
AND pd.CUSTOMER_ID IN AND pd.CUSTOMER_ID =#{customerId}
<foreach collection="customerIds" item="c" separator="," open="(" close=")">
#{c}
</foreach>
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId} AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId}
AND pd.ORG_TYPE = 'grid' AND pd.ORG_TYPE = 'grid'
AND pc.level = 2 AND pc.level = 2
@ -303,7 +300,7 @@
UNION ALL UNION ALL
SELECT SELECT
#{dateId} AS dateId, #{dateId} AS dateId,
#{customerId} AS customerId, #{parentCustomerId} AS customerId,
left(pc.CATEGORY_CODE, #{subCount}) AS categoryCode, left(pc.CATEGORY_CODE, #{subCount}) AS categoryCode,
pd.ORG_ID AS gridId, pd.ORG_ID AS gridId,
pd.PARENT_ID AS pid, pd.PARENT_ID AS pid,
@ -316,12 +313,9 @@
COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal
</if> </if>
FROM screen_project_data pd FROM screen_project_data pd
INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0') INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
WHERE pd.DEL_FLAG = '0' WHERE pd.DEL_FLAG = '0'
AND pd.CUSTOMER_ID IN AND pd.CUSTOMER_ID = #{customerId}
<foreach collection="customerIds" item="c" separator="," open="(" close=")">
#{c}
</foreach>
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId} AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId}
AND pd.ORG_TYPE = 'grid' AND pd.ORG_TYPE = 'grid'
<if test=' status == "closed" '> <if test=' status == "closed" '>
@ -350,7 +344,7 @@
COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal
</if> </if>
FROM screen_project_data pd FROM screen_project_data pd
LEFT JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0') inner JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
WHERE pd.DEL_FLAG = '0' WHERE pd.DEL_FLAG = '0'
AND pc.level = 2 AND pc.level = 2
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId} AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId}
@ -381,7 +375,7 @@
COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal
</if> </if>
FROM screen_project_data pd FROM screen_project_data pd
INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0') INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
WHERE pd.DEL_FLAG = '0' WHERE pd.DEL_FLAG = '0'
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId} AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId}
AND ALL_PARENT_IDS LIKE CONCAT('%',#{a.orgId},'%') AND ALL_PARENT_IDS LIKE CONCAT('%',#{a.orgId},'%')

Loading…
Cancel
Save