Browse Source

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

dev_shibei_match
wxz 4 years ago
parent
commit
548870d13a
  1. 10
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/result/TDuckListResultDTO.java
  2. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmettduck/PrUserProjectResultDao.java
  3. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmettduck/PrVistRecordDao.java
  4. 17
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java
  5. 13
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrUserProjectDao.xml
  6. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrUserProjectResultDao.xml
  7. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrVistRecordDao.xml

10
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/result/TDuckListResultDTO.java

@ -1,6 +1,7 @@
package com.epmet.dataaggre.dto.epmettduck.result; package com.epmet.dataaggre.dto.epmettduck.result;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
@ -74,6 +75,11 @@ public class TDuckListResultDTO implements Serializable {
*/ */
private Boolean fillStatus; private Boolean fillStatus;
/**
* 是否还能填写问卷true不能false
*/
private Boolean isFillQuestion;
/** /**
* 回收状态 0:未回收1已回收 * 回收状态 0:未回收1已回收
*/ */
@ -86,6 +92,9 @@ public class TDuckListResultDTO implements Serializable {
private String createdBy; private String createdBy;
@JsonIgnore
private Integer isEveryoneWriteOnceUid;
public TDuckListResultDTO() { public TDuckListResultDTO() {
this.customerId = ""; this.customerId = "";
this.key = ""; this.key = "";
@ -99,6 +108,7 @@ public class TDuckListResultDTO implements Serializable {
this.client = ""; this.client = "";
this.createdTime = ""; this.createdTime = "";
this.fillStatus = false; this.fillStatus = false;
this.isFillQuestion = true;
this.orgName = ""; this.orgName = "";
} }
} }

7
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;
/** /**
* 项目表单项 * 项目表单项
@ -12,5 +15,7 @@ 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);
} }

17
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,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 = "";

13
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrUserProjectDao.xml

@ -82,16 +82,17 @@
<!-- 根据keys查询project --> <!-- 根据keys查询project -->
<select id="queryProjectList" resultType="com.epmet.dataaggre.dto.epmettduck.result.TDuckListResultDTO"> <select id="queryProjectList" resultType="com.epmet.dataaggre.dto.epmettduck.result.TDuckListResultDTO">
select * from pr_user_project select up.*,ps.is_everyone_write_once_uid from pr_user_project up
where del_flag = 0 LEFT JOIN pr_user_project_setting ps ON (ps.project_key = up.`key` AND ps.del_flag = 0)
AND status = #{status} where up.del_flag = 0
AND client = #{client} AND up.status = #{status}
AND `key` in ( AND up.client = #{client}
AND up.`key` in (
<foreach collection="keys" item="key" separator=","> <foreach collection="keys" item="key" separator=",">
#{key} #{key}
</foreach> </foreach>
) )
ORDER BY created_time DESC ORDER BY up.created_time DESC
</select> </select>
</mapper> </mapper>

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