Browse Source

难点赌点 全删全增

master
wangchao 5 years ago
parent
commit
f709bedaf5
  1. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java
  2. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java
  3. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java
  4. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java
  5. 40
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java
  6. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenDifficultyDataService.java
  7. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java
  8. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java
  9. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java
  10. 19
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml
  11. 41
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java

@ -180,12 +180,12 @@ public interface FactOriginProjectMainDailyDao extends BaseDao<FactOriginProject
/**
* @Description 查询难点赌点的基本信息要排除之前已经结案过的项目
* @param customerId
* @param list
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity>
* @author wangc
* @date 2020.09.28 10:19
*/
List<ScreenDifficultyDataEntity> selectDifficultyBaseInfo(@Param("customerId")String customerId,@Param("list")List<String> list);
List<ScreenDifficultyDataEntity> selectDifficultyBaseInfo(@Param("customerId")String customerId,@Param("thresholdValue") Integer thresholdValue);
/**
* @Description 查询评价周期内新立的项目是为了增量新增难点赌点的图片库

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java

@ -103,14 +103,5 @@ public interface ProjectDao extends BaseDao<ProjectEntity> {
*/
String selectParameterValueByKey(@Param("customerId") String customerId);
/**
* @Description 得到超过阈值滞留的项目Id集合
* 规定只要项目的任何一个负责人(被流转到的自始至终不管有没有处理)超过了自定义或默认的滞留时间就算难点赌点
* @param customerId
* @param exclude
* @return java.util.List<java.lang.String>
* @author wangc
* @date 2020.11.06 14:14
*/
List<String> selectOvertimeProjectIds(@Param("customerId") String customerId,@Param("exclude") List<String> exclude,@Param("value") Integer value);
}

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

@ -248,12 +248,12 @@ public interface FactOriginProjectMainDailyService extends BaseService<FactOrigi
/**
* @Description 查询难点赌点基础信息
* @param customerId
* @param list
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity>
* @author wangc
* @date 2020.09.28 10:23
*/
List<ScreenDifficultyDataEntity> getDifficultyBaseInfo(String customerId , List<String> list);
List<ScreenDifficultyDataEntity> getDifficultyBaseInfo(String customerId ,Integer thresholdValue);
/**
* @Description 得到评价周期内新立项的id

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

@ -237,15 +237,15 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl<FactO
/**
* @Description 查询难点赌点基础信息
* @param customerId
* @param list
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity>
* @author wangc
* @date 2020.09.28 10:23
*/
@Override
public List<ScreenDifficultyDataEntity> getDifficultyBaseInfo(String customerId, List<String> list) {
if(CollectionUtils.isEmpty(list)) return null;
return baseDao.selectDifficultyBaseInfo(customerId,list);
public List<ScreenDifficultyDataEntity> getDifficultyBaseInfo(String customerId, Integer thresholdValue) {
return baseDao.selectDifficultyBaseInfo(customerId,thresholdValue);
}
/**

40
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java

@ -100,10 +100,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
Map<String, BigDecimal> scoreMap = cpcIndexCalculateService.getCpcScore(param.getCustomerId(),dateId);
//剔除垃圾数据
for(Iterator<ScreenPartyUserRankDataEntity> iter = registeredUsers.iterator();
iter.hasNext();){
if(null == gridMap.get(iter.next().getGridId())) iter.remove();
}
registeredUsers.removeIf(user -> null == gridMap.get(user.getGridId()));
//5.整合数据
if(!CollectionUtils.isEmpty(registeredUsers)){
@ -124,7 +121,6 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
user.setDataEndTime(finalDateId);
});
}
screenPartyUserRankDataService.dataClean(registeredUsers, param.getCustomerId());
}
@ -138,12 +134,8 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
**/
@Override
public void difficultyDataHub(ScreenCentralZoneDataFormDTO param) {
//查询难点赌点中有无已结案的项目,若有则保留
List<String> existed = screenDifficultyDataService.selectExistedInfo(param.getCustomerId());
//查询数据
List<ScreenDifficultyDataEntity> difficulties = factOriginProjectMainDailyService.getDifficultyBaseInfo(param.getCustomerId(),projectService.getOvertimeProjectByParameter(param.getCustomerId(),existed));
List<ScreenDifficultyDataEntity> difficulties = factOriginProjectMainDailyService.getDifficultyBaseInfo(param.getCustomerId(),projectService.getOvertimeProjectByParameter(param.getCustomerId()));
if(CollectionUtils.isEmpty(difficulties)) return;
//2.查询出客户下网格的相关信息
@ -151,24 +143,13 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
Map<String,GridInfoDTO> gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO :: getGridId,a -> a,(o, n) -> o));
//剔除垃圾数据(本次需要更新的数据集)
for(Iterator<ScreenDifficultyDataEntity> iter = difficulties.iterator(); iter.hasNext();){
ScreenDifficultyDataEntity pointer = iter.next();
if(null == gridMap.get(pointer.getOrgId())){
iter.remove();
}
}
//记录垃圾数(全量)
List<String> missing = new LinkedList<>();
List<ScreenDifficultyDataEntity> population = screenDifficultyDataService.getAllDifficultyByCustomerId(param.getCustomerId());
if(!CollectionUtils.isEmpty(population)){
for(Iterator<ScreenDifficultyDataEntity> iter = population.iterator(); iter.hasNext();){
ScreenDifficultyDataEntity pointer = iter.next();
if(null == gridMap.get(pointer.getOrgId())){
missing.add(pointer.getEventId());
}
}
}
//for(Iterator<ScreenDifficultyDataEntity> iter = difficulties.iterator(); iter.hasNext();){
// ScreenDifficultyDataEntity pointer = iter.next();
// if(null == gridMap.get(pointer.getOrgId())){
// iter.remove();
// }
//}
difficulties.removeIf( diff -> null == gridMap.get(diff.getOrgId()));
List<String> projectIds = difficulties.stream().map(ScreenDifficultyDataEntity :: getEventId).distinct().collect(Collectors.toList());
//最近一次操作
@ -196,7 +177,6 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
diff.setEventTitle(oper.getTitle());
diff.setEventCostTime(oper.getCostTime());
}
}
diff.setDataEndTime(DateUtils.getBeforeNDay(NumConstant.ONE));
@ -204,6 +184,6 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
List<ScreenDifficultyImgDataEntity> imgList = new LinkedList<>();
imgMap.values().forEach(list -> {imgList.addAll(list);});
screenDifficultyDataService.dataClean(param.getCustomerId(),difficulties,imgList,missing);
screenDifficultyDataService.dataClean(param.getCustomerId(),difficulties,imgList);
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenDifficultyDataService.java

@ -49,7 +49,7 @@ public interface ScreenDifficultyDataService extends BaseService<ScreenDifficult
* @author wangc
* @date 2020.09.28 11:04
*/
void dataClean(String customerId,List<ScreenDifficultyDataEntity> difficulties, List<ScreenDifficultyImgDataEntity> imgs,List<String> missing);
void dataClean(String customerId,List<ScreenDifficultyDataEntity> difficulties, List<ScreenDifficultyImgDataEntity> imgs);
/**
* @Description 根据客户Id查出全部的难点赌点的项目Id和网格Id因为需要比对全部的信息然后删除因为删除网格而导致的垃圾数据

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

@ -53,17 +53,17 @@ public class ScreenDifficultyDataServiceImpl extends BaseServiceImpl<ScreenDiffi
@Override
@Transactional(rollbackFor = Exception.class)
public void dataClean(String customerId, List<ScreenDifficultyDataEntity> difficulties, List<ScreenDifficultyImgDataEntity> imgs,List<String> missing) {
if(!CollectionUtils.isEmpty(missing)){
baseDao.deleteBatchDifficulty(customerId, missing);
baseDao.deleteBatchDifficultyImg(missing);
public void dataClean(String customerId, List<ScreenDifficultyDataEntity> difficulties, List<ScreenDifficultyImgDataEntity> imgs) {
List<ScreenDifficultyDataEntity> orient = baseDao.selectAllDifficultyByCustomerId(customerId);
if(!CollectionUtils.isEmpty(orient)){
baseDao.deleteBatchDifficultyImg(orient.stream().map(ScreenDifficultyDataEntity::getEventId).distinct().collect(Collectors.toList()));
}
baseDao.deleteBatchDifficulty(customerId,null);
if (!CollectionUtils.isEmpty(difficulties)) {
baseDao.deleteBatchDifficulty(customerId, difficulties.stream().map(ScreenDifficultyDataEntity::getEventId).distinct().collect(Collectors.toList()));
baseDao.insertBatch(difficulties);
}
if (!CollectionUtils.isEmpty(imgs)) {
baseDao.deleteBatchDifficultyImg(imgs.stream().map(ScreenDifficultyImgDataEntity::getEventId).distinct().collect(Collectors.toList()));
baseDao.insertBatchImg(imgs);
}
baseDao.updateTime(customerId, DateUtils.getBeforeNDay(NumConstant.ONE));

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java

@ -104,10 +104,9 @@ public interface ProjectService extends BaseService<ProjectEntity> {
* @Description 得到超过阈值滞留的项目Id集合
* 规定只要项目的任何一个负责人(被流转到的自始至终不管有没有处理)超过了自定义或默认的滞留时间就算难点赌点
* @param customerId
* @param exclude
* @return java.util.List<java.lang.String>
* @author wangc
* @date 2020.11.06 14:14
*/
List<String> getOvertimeProjectByParameter(String customerId,List<String> exclude);
Integer getOvertimeProjectByParameter(String customerId);
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java

@ -86,16 +86,15 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
* @Description 得到超过阈值滞留的项目Id集合
* 规定只要项目的任何一个负责人(被流转到的自始至终不管有没有处理)超过了自定义或默认的滞留时间就算难点赌点
* @param customerId
* @param exclude
* @return java.util.List<java.lang.String>
* @author wangc
* @date 2020.11.06 14:14
*/
@Override
public List<String> getOvertimeProjectByParameter(String customerId, List<String> exclude) {
public Integer getOvertimeProjectByParameter(String customerId) {
String parameter = baseDao.selectParameterValueByKey(customerId);
if(StringUtils.isBlank(parameter)) parameter = baseDao.selectParameterValueByKey("default");
return baseDao.selectOvertimeProjectIds(customerId, exclude, StringUtils.isBlank(parameter) ? NumConstant.FIVE : Integer.parseInt(parameter));
return StringUtils.isBlank(parameter) ? NumConstant.FIVE : Integer.parseInt(parameter);
}
}

19
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml

@ -385,11 +385,20 @@
WHERE
project.DEL_FLAG = '0'
AND project.CUSTOMER_ID = #{customerId}
<if test="null != list and list.size() != 0">
<foreach collection="list" item="projectId" open="AND " separator=" OR " >
project.ID = #{projectId}
</foreach>
</if>
AND project.ID IN (
SELECT DISTINCT
project_id
FROM
fact_origin_project_org_period_daily
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND TIMESTAMPDIFF( MINUTE, informed_date, IFNULL( handled_date, NOW( ) ) ) > #{thresholdValue}
)
</select>
<!-- 查询当天新立的项目,是为了增量新增难点赌点的图片库 -->

41
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml

@ -106,45 +106,4 @@
and PARAMETER_KEY ='detention_days'
</select>
<select id="selectOvertimeProjectIds" resultType="string">
SELECT
DISTINCT
project.ID
FROM
project project
WHERE
project.del_flag = '0'
AND project.customer_id = #{customerId}
<if test="null != exclude and exclude.size() > 0">
<foreach collection="exclude" item="id" open="AND ( " separator=" OR " close=" ) ">
project.ID <![CDATA[ <> ]]> #{id}
</foreach>
</if>
AND EXISTS (
SELECT
stff.ID
FROM
project_staff stff
LEFT JOIN project_org_relation period ON stff.ID = period.PROJECT_STAFF_ID
AND period.DEL_FLAG = '0'
WHERE
stff.DEL_FLAG = '0'
AND stff.CUSTOMER_ID = #{customerId}
AND project.ID = stff.PROJECT_ID
AND ABS(
TIMESTAMPDIFF(
DAY,
period.INFORMED_DATE,
IF
(
period.HANDLED_DATE IS NULL,
IF
( project.`STATUS` = 'closed', project.UPDATED_TIME, NOW( ) ),
period.HANDLED_DATE
)
)
) > #{value}
)
</select>
</mapper>
Loading…
Cancel
Save