Browse Source

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

master
zxc 4 years ago
parent
commit
a4c7a92739
  1. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmettduck/PrUserProjectResultDao.java
  2. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmettduck/PrVistRecordDao.java
  3. 13
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java
  4. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrUserProjectResultDao.xml
  5. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrVistRecordDao.xml

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmettduck/PrUserProjectResultDao.java

@ -3,6 +3,9 @@ package com.epmet.dataaggre.dao.epmettduck;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.entity.epmettduck.PrUserProjectResultEntity; import com.epmet.dataaggre.entity.epmettduck.PrUserProjectResultEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 项目表单项 * 项目表单项
@ -13,4 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface PrUserProjectResultDao extends BaseDao<PrUserProjectResultEntity> { public interface PrUserProjectResultDao extends BaseDao<PrUserProjectResultEntity> {
List<String> selectFillRecordByUserId(@Param("userId")String userId);
} }

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmettduck/PrVistRecordDao.java

@ -16,6 +16,6 @@ import java.util.List;
@Mapper @Mapper
public interface PrVistRecordDao extends BaseDao<PrVistRecordEntity> { public interface PrVistRecordDao extends BaseDao<PrVistRecordEntity> {
List<String> selectVisitRecordByUserId(@Param("userId")String userId);
} }

13
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java

@ -38,6 +38,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.constant.TDuckConstant; import com.epmet.dataaggre.constant.TDuckConstant;
import com.epmet.dataaggre.dao.epmettduck.PrUserProjectDao; import com.epmet.dataaggre.dao.epmettduck.PrUserProjectDao;
import com.epmet.dataaggre.dao.epmettduck.PrUserProjectResultDao;
import com.epmet.dataaggre.dao.epmettduck.PrVistRecordDao; import com.epmet.dataaggre.dao.epmettduck.PrVistRecordDao;
import com.epmet.dataaggre.dto.epmettduck.PrPublishRangeDTO; import com.epmet.dataaggre.dto.epmettduck.PrPublishRangeDTO;
import com.epmet.dataaggre.dto.epmettduck.PrUserProjectDTO; import com.epmet.dataaggre.dto.epmettduck.PrUserProjectDTO;
@ -85,7 +86,7 @@ import java.util.stream.Stream;
public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao, PrUserProjectEntity> implements PrUserProjectService { public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao, PrUserProjectEntity> implements PrUserProjectService {
@Autowired @Autowired
private PrVistRecordDao visitRecordDao; private PrUserProjectResultDao prUserProjectResultDao;
@Resource @Resource
private PrPublishRangeService prPublishRangeService; private PrPublishRangeService prPublishRangeService;
@Resource @Resource
@ -169,16 +170,20 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
@Override @Override
public List<TDuckListResultDTO> queryProjectList(TDuckListFormDTO formDTO) { public List<TDuckListResultDTO> queryProjectList(TDuckListFormDTO formDTO) {
List<String> orgIds = new ArrayList<>(); List<String> orgIds = new ArrayList<>();
// 工作端不需要传orgId
if (formDTO.getClient().equals(TDuckConstant.CLIENT_GOV)){ if (formDTO.getClient().equals(TDuckConstant.CLIENT_GOV)){
// 根据 客户ID 和 人ID 从redis获取信息
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
String pids = staffInfo.getAgencyPIds(); String pids = staffInfo.getAgencyPIds();
String agencyId = staffInfo.getAgencyId(); String agencyId = staffInfo.getAgencyId();
// 来源于 部门
if (staffInfo.getFromOrgType().equals(TDuckConstant.ORG_TYPE_DEPT)){ if (staffInfo.getFromOrgType().equals(TDuckConstant.ORG_TYPE_DEPT)){
List<IdAndNameDTO> deptList = staffInfo.getDeptList(); List<IdAndNameDTO> deptList = staffInfo.getDeptList();
if (CollectionUtils.isEmpty(deptList)){ if (CollectionUtils.isEmpty(deptList)){
return new ArrayList<>(); return new ArrayList<>();
} }
orgIds = joint(pids,agencyId,deptList); orgIds = joint(pids,agencyId,deptList);
// 来源于 网格
}else if (staffInfo.getFromOrgType().equals(TDuckConstant.ORG_TYPE_GRID)){ }else if (staffInfo.getFromOrgType().equals(TDuckConstant.ORG_TYPE_GRID)){
List<IdAndNameDTO> gridList = staffInfo.getGridList(); List<IdAndNameDTO> gridList = staffInfo.getGridList();
if (CollectionUtils.isEmpty(gridList)){ if (CollectionUtils.isEmpty(gridList)){
@ -192,6 +197,7 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
}else { }else {
CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO();
customerGridFormDTO.setGridId(formDTO.getOrgId()); customerGridFormDTO.setGridId(formDTO.getOrgId());
// 查询网格信息
Result<CustomerGridDTO> gridResult = govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); Result<CustomerGridDTO> gridResult = govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO);
if (!gridResult.success()){ if (!gridResult.success()){
throw new RenException("查询网格信息失败了..."); throw new RenException("查询网格信息失败了...");
@ -200,13 +206,15 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
String oneOrg = data.getPids() + ":" + data.getId(); String oneOrg = data.getPids() + ":" + data.getId();
orgIds.add(oneOrg); orgIds.add(oneOrg);
} }
// 根据orgIds查询 问卷调查的key
List<String> projectKeys = baseDao.selectProjectKey(orgIds); List<String> projectKeys = baseDao.selectProjectKey(orgIds);
if (CollectionUtils.isEmpty(projectKeys)){ if (CollectionUtils.isEmpty(projectKeys)){
return new ArrayList<>(); return new ArrayList<>();
} }
PageInfo<TDuckListResultDTO> projectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.queryProjectList(projectKeys, formDTO.getStatus(), formDTO.getClient())); PageInfo<TDuckListResultDTO> projectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.queryProjectList(projectKeys, formDTO.getStatus(), formDTO.getClient()));
List<TDuckListResultDTO> result = projectPageInfo.getList(); List<TDuckListResultDTO> result = projectPageInfo.getList();
List<String> records = visitRecordDao.selectVisitRecordByUserId(formDTO.getUserId()); // 查询此人已填写过的问卷 并赋值已填写字段
List<String> records = prUserProjectResultDao.selectFillRecordByUserId(formDTO.getUserId());
if (!CollectionUtils.isEmpty(records)){ if (!CollectionUtils.isEmpty(records)){
for (String r : records) { for (String r : records) {
for (TDuckListResultDTO t : result) { for (TDuckListResultDTO t : result) {
@ -217,6 +225,7 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
} }
} }
} }
//赋值 orgName
result.forEach(r -> { result.forEach(r -> {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), r.getCreatedBy()); CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), r.getCreatedBy());
String orgName = ""; String orgName = "";

5
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrUserProjectResultDao.xml

@ -3,4 +3,9 @@
<mapper namespace="com.epmet.dataaggre.dao.epmettduck.PrUserProjectResultDao"> <mapper namespace="com.epmet.dataaggre.dao.epmettduck.PrUserProjectResultDao">
<select id="selectFillRecordByUserId" resultType="java.lang.String">
SELECT DISTINCT project_key FROM pr_user_project_result
WHERE del_flag = 0
AND user_id = #{userId}
</select>
</mapper> </mapper>

6
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrVistRecordDao.xml

@ -3,10 +3,4 @@
<mapper namespace="com.epmet.dataaggre.dao.epmettduck.PrVistRecordDao"> <mapper namespace="com.epmet.dataaggre.dao.epmettduck.PrVistRecordDao">
<!-- 根据userId查询是否已填 -->
<select id="selectVisitRecordByUserId" resultType="java.lang.String">
SELECT project_key FROM pr_vist_record
WHERE del_flag = 0
AND user_id = #{userId}
</select>
</mapper> </mapper>
Loading…
Cancel
Save