Browse Source

难点赌点列表:difficultyrank-multic

dev_shibei_match
yinzuomei 4 years ago
parent
commit
ff85e01f2e
  1. 4
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java
  2. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java
  3. 21
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  4. 35
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java
  5. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java
  6. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenProjectSettleService.java
  7. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java
  8. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java
  9. 28
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java
  10. 38
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java
  11. 50
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml
  12. 2
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java
  13. 34
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java

4
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java

@ -180,5 +180,9 @@ public class ScreenProjectDataDTO implements Serializable {
private String topicId; private String topicId;
private Integer responseCount; private Integer responseCount;
/**
* 满意度得分
*/
private BigDecimal satisfactionScore;
} }

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java

@ -112,4 +112,9 @@ public class ScreenProjectDataInfoFormDTO implements Serializable {
* 议题图片地址 * 议题图片地址
*/ */
private String[] projectImgUrl; private String[] projectImgUrl;
/**
* 满意度得分
*/
private BigDecimal satisfactionScore;
} }

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

@ -44,6 +44,7 @@ import com.epmet.service.evaluationindex.indexcal.*;
import com.epmet.service.evaluationindex.screen.*; import com.epmet.service.evaluationindex.screen.*;
import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimAgencyService;
import com.epmet.service.stats.DimCustomerPartymemberService; import com.epmet.service.stats.DimCustomerPartymemberService;
import com.epmet.service.stats.DimCustomerService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -121,6 +122,8 @@ public class DemoController {
private FactGridGovernDailyService factGridGovernDailyService; private FactGridGovernDailyService factGridGovernDailyService;
@Autowired @Autowired
private FactAgencyGovernDailyService factAgencyGovernDailyService; private FactAgencyGovernDailyService factAgencyGovernDailyService;
@Autowired
private DimCustomerService dimCustomerService;
@GetMapping("testAlarm") @GetMapping("testAlarm")
public void testAlarm() { public void testAlarm() {
@ -936,4 +939,22 @@ public class DemoController {
return new Result(); return new Result();
} }
/**
* @return com.epmet.commons.tools.utils.Result
* @param
* @author yinzuomei
* @description 将产品内部客户来源于议题并且已结案的项目赋值满意度得分
* @Date 2021/6/23 15:55
**/
@PostMapping("update-satisfaction-core")
public Result updateProjectSatisfactionScore(){
List<String> customerIds=dimCustomerService.getAllCustomerId();
customerIds.forEach(customerId->{
screenProjectSettleService.updateProjectSatisfactionScore(customerId,null,null);
log.info("更新完成");
});
return new Result();
}
} }

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

@ -18,20 +18,17 @@
package com.epmet.dao.project; package com.epmet.dao.project;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerProjectParameterDTO;
import com.epmet.dto.ProjectDTO; import com.epmet.dto.ProjectDTO;
import com.epmet.dto.ProjectSatisfactionStatisticsDTO;
import com.epmet.dto.project.ProjectAgencyDTO; import com.epmet.dto.project.ProjectAgencyDTO;
import com.epmet.dto.project.ProjectCategoryDTO; import com.epmet.dto.project.ProjectCategoryDTO;
import com.epmet.dto.project.ProjectGridDTO; import com.epmet.dto.project.ProjectGridDTO;
import com.epmet.dto.project.ProjectPointDTO; import com.epmet.dto.project.ProjectPointDTO;
import com.epmet.dto.project.result.ProjectExceedParamsResultDTO; import com.epmet.dto.project.result.ProjectExceedParamsResultDTO;
import com.epmet.dto.screen.ScreenProjectProcessAttachmentDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity;
import com.epmet.entity.project.ProjectEntity; import com.epmet.entity.project.ProjectEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
@ -158,4 +155,34 @@ public interface ProjectDao extends BaseDao<ProjectEntity> {
* @return java.lang.String * @return java.lang.String
*/ */
String selectValueByKey(@Param("customerId") String customerId, @Param("parameterKey") String parameterKey); String selectValueByKey(@Param("customerId") String customerId, @Param("parameterKey") String parameterKey);
/**
* 计算某个项目的群满意度得分
*
* @param customerId
* @param projectId
* @return 得分
*/
BigDecimal selectProjectSatisfactionScore(@Param("customerId")String customerId,
@Param("projectId")String projectId);
/**
* 查询当天dateId有评价记录的项目id
*
* @param customerId
* @param dateId
* @return
*/
List<String> selectEvaluateProjectIds(@Param("customerId") String customerId, @Param("dateId")String dateId);
/**
* 可根据状态筛选项目id
*
* @param customerId
* @param projectStatus 状态:待处理 pending结案closed
* @return
*/
List<String> selectClosedProjectIds(@Param("customerId")String customerId,
@Param("origin")String origin,
@Param("projectStatus")String projectStatus);
} }

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java

@ -144,5 +144,8 @@ public class ScreenProjectDataEntity extends BaseEpmetEntity {
*/ */
private String allParentIds; private String allParentIds;
/**
* 满意度得分
*/
private BigDecimal satisfactionScore;
} }

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenProjectSettleService.java

@ -24,4 +24,14 @@ public interface ScreenProjectSettleService {
*/ */
void extractScreenData(ScreenCentralZoneDataFormDTO param); void extractScreenData(ScreenCentralZoneDataFormDTO param);
/**
* 更新项目得分
*
* @param customerId
* @param dateId //dateId可以为空,如果为空重新计算当前客户下所有的项目的分数; dateId不为空,只计算当天存在评价记录的项目,更新项目对应的得分。
* @param projectId 项目id可为空
* @return void
*/
void updateProjectSatisfactionScore(String customerId,String dateId,String projectId);
} }

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

@ -280,6 +280,13 @@ public class ScreenExtractServiceImpl implements ScreenExtractService {
}catch (Exception e){ }catch (Exception e){
log.error("大屏项目数据抽取_按天抽取_按天统计失败,customerId为:"+customerId+"dateId为:"+dateId, e); log.error("大屏项目数据抽取_按天抽取_按天统计失败,customerId为:"+customerId+"dateId为:"+dateId, e);
} }
try{
//dateId可以为空,如果为空重新计算当前客户下所有的项目的分数
//dateId不为空,只计算当天存在评价记录的项目,更新项目对应的得分。
screenProjectSettleService.updateProjectSatisfactionScore(customerId,dateId,null);
}catch(Exception e){
log.error("群众不满得分更新失败");
}
} }
/** /**

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

@ -102,6 +102,8 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
} else { } else {
meta.setLinkUserId(meta.getLinkName()); meta.setLinkUserId(meta.getLinkName());
} }
//项目满意度得分
meta.setSatisfactionScore(projectService.calProjectSatisfactionScore(param.getCustomerId(),meta.getProjectId()));
return meta; return meta;
})).collect(Collectors.toList()); })).collect(Collectors.toList());
} }
@ -170,4 +172,36 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
} }
/**
* 更新项目得分
*
* @param customerId
* @param dateId //dateId可以为空,如果为空重新计算当前客户下所有的项目的分数; dateId不为空,只计算当天存在评价记录的项目,更新项目对应的得分。
* @param projectId 项目id可为空
* @return void
*/
@Override
public void updateProjectSatisfactionScore(String customerId, String dateId,String projectId) {
if(StringUtils.isNotBlank(projectId)){
projectService.calProjectSatisfactionScore(customerId,projectId);
return;
}
List<String> projectIds=new ArrayList<>();
if(StringUtils.isNotBlank(dateId)){
List<String> list=projectService.selectEvaluateProjectIds(customerId,dateId);
if(!CollectionUtils.isEmpty(list)){
projectIds.addAll(list);
}
}else{
// 只有来源于议题的项目,才有分数
List<String> closedProjectIds=projectService.selectClosedProjectIds(customerId,"issue","closed");
if(!CollectionUtils.isEmpty(closedProjectIds)){
projectIds.addAll(closedProjectIds);
}
}
projectIds.forEach(id->{
projectService.calProjectSatisfactionScore(customerId,id);
});
}
} }

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

@ -27,6 +27,7 @@ import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity
import com.epmet.entity.project.ProjectEntity; import com.epmet.entity.project.ProjectEntity;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -162,4 +163,31 @@ public interface ProjectService extends BaseService<ProjectEntity> {
*/ */
List<FactOriginProjectMainDailyEntity> getProjectSatisfaction(String customerId); List<FactOriginProjectMainDailyEntity> getProjectSatisfaction(String customerId);
/**
* 计算某个项目的群满意度得分
*
* @param customerId
* @param projectId
* @return 得分
*/
BigDecimal calProjectSatisfactionScore(String customerId,String projectId);
/**
* 查询当天dateId有评价记录的项目id
*
* @param customerId
* @param dateId
* @return
*/
List<String> selectEvaluateProjectIds(String customerId, String dateId);
/**
* 可根据状态筛选项目id
*
* @param customerId
* @param origin :issue,agency
* @param projectStatus 状态:待处理 pending结案closed
* @return
*/
List<String> selectClosedProjectIds(String customerId,String origin ,String projectStatus);
} }

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

@ -35,6 +35,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -196,5 +197,42 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
/**
* 计算某个项目的群满意度得分
*
* @param customerId
* @param projectId
* @return 得分
*/
@Override
public BigDecimal calProjectSatisfactionScore(String customerId, String projectId) {
return baseDao.selectProjectSatisfactionScore(customerId,projectId);
}
/**
* 查询当天dateId有评价记录的项目id
*
* @param customerId
* @param dateId
* @return
*/
@Override
public List<String> selectEvaluateProjectIds(String customerId, String dateId) {
return baseDao.selectEvaluateProjectIds(customerId,dateId);
}
/**
* 可根据状态筛选项目id
*
* @param customerId
* @param origin 来源issue, agency
* @param projectStatus 状态:待处理 pending结案closed
* @return
*/
@Override
public List<String> selectClosedProjectIds(String customerId, String origin,String projectStatus) {
return baseDao.selectClosedProjectIds(customerId,origin,projectStatus);
}
} }

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

@ -162,4 +162,54 @@
and CUSTOMER_ID = #{customerId} and CUSTOMER_ID = #{customerId}
and PARAMETER_KEY = #{parameterKey} and PARAMETER_KEY = #{parameterKey}
</select> </select>
<!-- 计算某个项目的群满意度得分 -->
<select id="selectProjectSatisfactionScore" parameterType="map" resultType="java.math.BigDecimal">
SELECT
IFNULL(
(
(s.SHOULD_EVALUATE_COUNT - s.GOOD_COUNT - s.BAD_COUNT - s.PERFECT_COUNT) * 80
+ s.BAD_COUNT * 60
+ s.GOOD_COUNT * 80
+ s.PERFECT_COUNT * 100
)/s.SHOULD_EVALUATE_COUNT
,
0
) AS score
FROM
project_satisfaction_statistics s
WHERE
s.DEL_FLAG = '0'
AND s.CUSTOMER_ID = #{customerId}
and s.PROJECT_ID=#{projectId}
</select>
<!-- 查询当天(dateId)有评价记录的项目id -->
<select id="selectEvaluateProjectIds" parameterType="map" resultType="java.lang.String">
SELECT
psd.PROJECT_ID
FROM
project_satisfaction_detail psd
WHERE
psd.DEL_FLAG = '0'
AND psd.CUSTOMER_ID = #{customerId}
AND DATE_FORMAT(psd.CREATED_TIME,'%Y%m%d')=#{dateId}
</select>
<!-- 可根据状态筛选项目id -->
<select id="selectClosedProjectIds" parameterType="map" resultType="java.lang.String">
SELECT
p.id
FROM
project p
WHERE
p.DEL_FLAG = '0'
AND p.CUSTOMER_ID = #{customerId}
<if test="projectStatus != null and projectStatus.trim() != ''">
AND p.`STATUS` =#{projectStatus}
</if>
<if test="origin != null and origin.trim() != ''">
AND p.ORIGIN =#{origin}
</if>
</select>
</mapper> </mapper>

2
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java

@ -178,7 +178,7 @@ public interface ProjectConstant {
String EVALUATE_GOOD = "good"; String EVALUATE_GOOD = "good";
String EVALUATE_BAD = "bad"; String EVALUATE_BAD = "bad";
String EVALUATE_PERFECT = "perfect"; String EVALUATE_PERFECT = "perfect";
String EVALUATE="evaluate";
/** /**
* 三个月六个月12个月 * 三个月六个月12个月
*/ */

34
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java

@ -20,16 +20,20 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.rocketmq.messages.ProjectChangedMQMsg;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO; import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.IpUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.constant.ProjectConstant; import com.epmet.constant.ProjectConstant;
@ -39,25 +43,28 @@ import com.epmet.dao.ProjectSatisfactionStatisticsDao;
import com.epmet.dto.ProjectSatisfactionDetailDTO; import com.epmet.dto.ProjectSatisfactionDetailDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.entity.ProjectEntity;
import com.epmet.entity.ProjectSatisfactionDetailEntity; import com.epmet.entity.ProjectSatisfactionDetailEntity;
import com.epmet.entity.ProjectSatisfactionStatisticsEntity; import com.epmet.entity.ProjectSatisfactionStatisticsEntity;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.GovIssueOpenFeignClient; import com.epmet.feign.GovIssueOpenFeignClient;
import com.epmet.redis.ProjectRedis; import com.epmet.redis.ProjectRedis;
import com.epmet.redis.ProjectSatisfactionDetailRedis; import com.epmet.redis.ProjectSatisfactionDetailRedis;
import com.epmet.send.SendMqMsgUtil;
import com.epmet.service.ProjectSatisfactionDetailService; import com.epmet.service.ProjectSatisfactionDetailService;
import com.epmet.service.ProjectSatisfactionStatisticsService; import com.epmet.service.ProjectSatisfactionStatisticsService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RLock;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -91,6 +98,10 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl<Projec
private GovIssueOpenFeignClient govIssueOpenFeignClient; private GovIssueOpenFeignClient govIssueOpenFeignClient;
@Autowired @Autowired
private ProjectSatisfactionStatisticsService projectSatisfactionStatisticsService; private ProjectSatisfactionStatisticsService projectSatisfactionStatisticsService;
@Autowired
private LoginUserUtil loginUserUtil;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Override @Override
public PageData<ProjectSatisfactionDetailDTO> page(Map<String, Object> params) { public PageData<ProjectSatisfactionDetailDTO> page(Map<String, Object> params) {
@ -240,6 +251,21 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl<Projec
baseDao.insert(entity); baseDao.insert(entity);
// 更新 // 更新
statisticsDao.updateEvaluateData(formDTO.getProjectId(), formDTO.getSatisfaction()); statisticsDao.updateEvaluateData(formDTO.getProjectId(), formDTO.getSatisfaction());
//项目满意度评价-项目实时统计消息
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
ProjectChangedMQMsg msg = new ProjectChangedMQMsg(entity.getCustomerId(),
ProjectConstant.EVALUATE,
entity.getProjectId(),
formDTO.getUserId(),
new Date(),
StrConstant.EPMETY_STR,
IpUtils.getIpAddr(request),
loginUserUtil.getLoginUserApp(),
loginUserUtil.getLoginUserClient());
boolean msgResult = SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendProjectChangedMqMsg(msg);
if (!msgResult) {
log.error("项目实时统计消息发送失败");
}
} }
/** /**

Loading…
Cancel
Save