|
@ -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,23 +206,28 @@ 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) { |
|
|
|
|
|
if (t.getIsEveryoneWriteOnceUid() == NumConstant.ONE && r.equals(t.getKey())){ |
|
|
|
|
|
t.setIsFillQuestion(false); |
|
|
|
|
|
} |
|
|
if (r.equals(t.getKey())){ |
|
|
if (r.equals(t.getKey())){ |
|
|
t.setFillStatus(true); |
|
|
t.setFillStatus(true); |
|
|
continue; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
//赋值 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 = ""; |
|
|