Browse Source

项目结案添加项目评价初始化数据

master
zxc 4 years ago
parent
commit
1d6f16178d
  1. 2
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSatisfactionStatisticsDao.java
  2. 8
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java
  3. 21
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java
  4. 1
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSatisfactionStatisticsDao.xml

2
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSatisfactionStatisticsDao.java

@ -48,7 +48,7 @@ public interface ProjectSatisfactionStatisticsDao extends BaseDao<ProjectSatisfa
* @author zxc
* @date 2021/5/10 4:57 下午
*/
void updateEvaluateData(@Param("projectId")String projectId,@Param("evalType")String evalType,@Param("shouldEvaluateCount")Integer shouldEvaluateCount);
void updateEvaluateData(@Param("projectId")String projectId,@Param("evalType")String evalType);
/**
* @Description 查询已经存在的记录

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

@ -238,8 +238,10 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl<Projec
throw new RenException(EpmetErrorCode.ALREADY_EVALUATE.getCode());
}
baseDao.insert(entity);
// 更新
statisticsDao.updateEvaluateData(formDTO.getProjectId(), formDTO.getSatisfaction());
RLock lock = null;
/*RLock lock = null;
try {
lock = distributedLock.getLock("evaluate_project");
if (null != lock){
@ -279,7 +281,7 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl<Projec
statisticsDao.insert(entity1);
}else {
// 更新
statisticsDao.updateEvaluateData(formDTO.getProjectId(), formDTO.getSatisfaction(),userIds.size());
statisticsDao.updateEvaluateData(formDTO.getProjectId(), formDTO.getSatisfaction());
}
}
}catch (Exception e){
@ -288,7 +290,7 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl<Projec
if (lock != null){
lock.unlock();
}
}
}*/
}
/**

21
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java

@ -36,6 +36,7 @@ import com.epmet.constant.SmsTemplateConstant;
import com.epmet.constant.UserMessageConstant;
import com.epmet.dao.ProjectDao;
import com.epmet.dao.ProjectOrgRelationDao;
import com.epmet.dao.ProjectSatisfactionStatisticsDao;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
@ -132,6 +133,8 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
private ProjectTraceService projectTraceService;
@Autowired
private ResiGroupOpenFeignClient resiGroupOpenFeignClient;
@Autowired
private ProjectSatisfactionStatisticsDao statisticsDao;
private final static String ONE_DAY = "<1";
@ -712,6 +715,24 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
if (!msgResult) {
log.error("项目实时统计消息发送失败");
}
// 项目评价初始化信息插入
// 应评价数 = 话题创建者 + 议题发起者 + 议题表决人 【去重】
// 议题发起者 和 议题表决人 和 话题创建者 查询
Result<List<String>> canEvaluateProjectCount = govIssueOpenFeignClient.canEvaluateProjectCount(projectEntity.getOriginId());
if (!canEvaluateProjectCount.success()){
throw new RenException("【查询项目应评价人数失败】,【"+canEvaluateProjectCount.getMsg()+"】");
}
List<String> userIds = canEvaluateProjectCount.getData();
ProjectSatisfactionStatisticsEntity entity1 = new ProjectSatisfactionStatisticsEntity();
entity1.setShouldEvaluateCount(userIds.size());
entity1.setCustomerId(projectEntity.getCustomerId());
entity1.setProjectId(fromDTO.getProjectId());
entity1.setBadCount(NumConstant.ZERO);
entity1.setGoodCount(NumConstant.ZERO);
entity1.setPerfectCount(NumConstant.ZERO);
// 新添一条记录
statisticsDao.insert(entity1);
}
@Override

1
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSatisfactionStatisticsDao.xml

@ -16,7 +16,6 @@
<if test="evalType == 'perfect' ">
PERFECT_COUNT = PERFECT_COUNT + 1,
</if>
SHOULD_EVALUATE_COUNT = #{shouldEvaluateCount},
UPDATED_TIME = NOW()
WHERE DEL_FLAG = '0'
AND PROJECT_ID = #{projectId}

Loading…
Cancel
Save