Browse Source

列表

master
zxc 4 years ago
parent
commit
c0e242eb43
  1. 37
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/form/TDuckListFormDTO.java
  2. 96
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/result/TDuckListResultDTO.java
  3. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetTDuckController.java
  4. 18
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmettduck/PrUserProjectDao.java
  5. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmettduck/PrVistRecordDao.java
  6. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/PrUserProjectService.java
  7. 36
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java
  8. 22
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrUserProjectDao.xml
  9. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrVistRecordDao.xml

37
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/form/TDuckListFormDTO.java

@ -0,0 +1,37 @@
package com.epmet.dataaggre.dto.epmettduck.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/9/17 10:47 上午
* @DESC
*/
@Data
public class TDuckListFormDTO implements Serializable {
private static final long serialVersionUID = 3624352114576287768L;
public interface TDuckListForm{}
/**
* 1未发布2收集中3已结束
*/
@NotNull(message = "问卷调查状态不能为空",groups = TDuckListForm.class)
private Integer status;
@NotNull(message = "pageNo不能为空",groups = TDuckListForm.class)
private Integer pageNo;
@NotNull(message = "pageSize不能为空",groups = TDuckListForm.class)
private Integer pageSize;
@NotBlank(message = "orgIds不能为空",groups = TDuckListForm.class)
private String orgIds;
private String userId;
}

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

@ -0,0 +1,96 @@
package com.epmet.dataaggre.dto.epmettduck.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/9/17 10:47 上午
* @DESC
*/
@Data
public class TDuckListResultDTO implements Serializable {
private static final long serialVersionUID = 3624352114576287768L;
/**
* 客户id
*/
private String customerId;
/**
* 项目code
*/
private String key;
/**
* 来源Id
*/
private String sourceId;
/**
* 来源类型
*/
private Integer sourceType;
/**
* 项目名称
*/
private String name;
/**
* 项目描述
*/
private String describe;
/**
* 用户ID
*/
private String userId;
/**
* 项目类型
*/
private Integer type;
/**
* 状态
*/
private Integer status;
/**
* 适用于哪个端 resi居民端用户gov工作端用户运营端用户oper
*/
private String client;
private String createdTime;
/**
* 是否填写问卷truefalse
*/
private Boolean fillStatus;
/**
* 回收状态 0:未回收1已回收
*/
private Integer recycled;
public TDuckListResultDTO() {
this.customerId = "";
this.key = "";
this.sourceId = "";
this.sourceType = NumConstant.ONE;
this.name = "";
this.describe = "";
this.userId = "";
this.type = NumConstant.ONE;
this.status = NumConstant.ONE;
this.client = "";
this.createdTime = "";
this.fillStatus = false;
}
}

12
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetTDuckController.java

@ -2,9 +2,14 @@ package com.epmet.dataaggre.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.epmettduck.form.TDuckDetailFormDTO;
import com.epmet.dataaggre.dto.epmettduck.form.TDuckListFormDTO;
import com.epmet.dataaggre.dto.epmettduck.result.TDuckListResultDTO;
import com.epmet.dataaggre.entity.epmettduck.PrUserProjectEntity;
import com.epmet.dataaggre.entity.epmettduck.PrUserProjectItemEntity;
import com.epmet.dataaggre.service.epmettduck.PrUserProjectItemService;
import org.springframework.beans.factory.annotation.Autowired;
@ -75,4 +80,11 @@ public class EpmetTDuckController {
}
@PostMapping("list")
public Result<List<TDuckListResultDTO>> queryProjectList(@RequestBody TDuckListFormDTO formDTO,@LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO,TDuckListFormDTO.TDuckListForm.class);
formDTO.setUserId(tokenDto.getUserId());
return new Result<List<TDuckListResultDTO>>().ok(prUserProjectService.queryProjectList(formDTO));
}
}

18
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmettduck/PrUserProjectDao.java

@ -3,9 +3,11 @@ package com.epmet.dataaggre.dao.epmettduck;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.epmettduck.result.AnalysisReportResDTO;
import com.epmet.dataaggre.dto.epmettduck.result.ProjectProfileResultDTO;
import com.epmet.dataaggre.dto.epmettduck.result.TDuckListResultDTO;
import com.epmet.dataaggre.entity.epmettduck.PrUserProjectEntity;
import com.epmet.dataaggre.entity.epmettduck.PrUserProjectResultEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -46,4 +48,20 @@ public interface PrUserProjectDao extends BaseDao<PrUserProjectEntity> {
* @date 2021/9/16 6:18 下午
*/
List<PrUserProjectResultEntity> selectResults(String projectKey);
/**
* @Description 查询范围内的问卷调查
* @Param orgId
* @author zxc
* @date 2021/9/17 2:16 下午
*/
List<String> selectProjectKey(@Param("orgIds")String orgIds);
/**
* @Description 根据keys查询project
* @Param keys
* @author zxc
* @date 2021/9/17 3:41 下午
*/
List<TDuckListResultDTO> queryProjectList(@Param("keys")List<String> keys, @Param("status")Integer status);
}

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

@ -3,6 +3,9 @@ package com.epmet.dataaggre.dao.epmettduck;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.entity.epmettduck.PrVistRecordEntity;
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
public interface PrVistRecordDao extends BaseDao<PrVistRecordEntity> {
List<String> selectVisitRecordByUserId(@Param("userId")String userId);
}

4
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/PrUserProjectService.java

@ -20,8 +20,10 @@ package com.epmet.dataaggre.service.epmettduck;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dataaggre.dto.epmettduck.PrUserProjectDTO;
import com.epmet.dataaggre.dto.epmettduck.form.TDuckListFormDTO;
import com.epmet.dataaggre.dto.epmettduck.result.AnalysisReportResDTO;
import com.epmet.dataaggre.dto.epmettduck.result.ProjectProfileResultDTO;
import com.epmet.dataaggre.dto.epmettduck.result.TDuckListResultDTO;
import com.epmet.dataaggre.entity.epmettduck.PrUserProjectEntity;
import java.util.List;
@ -105,6 +107,8 @@ public interface PrUserProjectService extends BaseService<PrUserProjectEntity> {
*/
ProjectProfileResultDTO queryProjectProfile(String projectKey);
List<TDuckListResultDTO> queryProjectList(TDuckListFormDTO formDTO);
/**
* 分析报告
*

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

@ -19,9 +19,11 @@ package com.epmet.dataaggre.service.epmettduck.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
@ -29,16 +31,24 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.epmettduck.PrUserProjectDao;
import com.epmet.dataaggre.dao.epmettduck.PrVistRecordDao;
import com.epmet.dataaggre.dto.epmettduck.InputMapDTO;
import com.epmet.dataaggre.dto.epmettduck.PrUserProjectDTO;
import com.epmet.dataaggre.dto.epmettduck.form.TDuckListFormDTO;
import com.epmet.dataaggre.dto.epmettduck.ProjectItemTypeEnum;
import com.epmet.dataaggre.dto.epmettduck.result.AnalysisReportResDTO;
import com.epmet.dataaggre.dto.epmettduck.result.ProjectProfileResultDTO;
import com.epmet.dataaggre.dto.epmettduck.result.TDuckListResultDTO;
import com.epmet.dataaggre.dto.epmettduck.struct.RateExpandStruct;
import com.epmet.dataaggre.entity.epmettduck.PrPublishRangeEntity;
import com.epmet.dataaggre.entity.epmettduck.PrUserProjectEntity;
import com.epmet.dataaggre.entity.epmettduck.PrUserProjectResultEntity;
import com.epmet.dataaggre.service.epmettduck.PrUserProjectService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@ -59,6 +69,9 @@ import java.util.stream.Stream;
@Service
public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao, PrUserProjectEntity> implements PrUserProjectService {
@Autowired
private PrVistRecordDao visitRecordDao;
@Override
public PageData<PrUserProjectDTO> page(Map<String, Object> params) {
IPage<PrUserProjectEntity> page = baseDao.selectPage(
@ -124,6 +137,29 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
return baseDao.queryProjectProfile(projectKey);
}
@Override
public List<TDuckListResultDTO> queryProjectList(TDuckListFormDTO formDTO) {
List<String> projectKeys = baseDao.selectProjectKey(formDTO.getOrgIds());
if (CollectionUtils.isEmpty(projectKeys)){
return new ArrayList<>();
}
PageInfo<TDuckListResultDTO> projectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.queryProjectList(projectKeys, formDTO.getStatus()));
List<TDuckListResultDTO> result = projectPageInfo.getList();
List<String> records = visitRecordDao.selectVisitRecordByUserId(formDTO.getUserId());
if (!CollectionUtils.isEmpty(records)){
for (String r : records) {
for (TDuckListResultDTO t : result) {
if (r.equals(t.getKey())){
t.setFillStatus(true);
continue;
}
}
}
}
return result;
}
/**
* 分析报告
*

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

@ -47,4 +47,26 @@
and m.project_key=#{projectKey}
order by m.serial_number asc
</select>
<!-- 查询范围内的问卷调查 -->
<select id="selectProjectKey" resultType="java.lang.String">
SELECT
DISTINCT project_key
FROM pr_publish_range
WHERE del_flag = 0
AND #{orgIds} LIKE CONCAT(org_ids,'%')
</select>
<!-- 根据keys查询project -->
<select id="queryProjectList" resultType="com.epmet.dataaggre.dto.epmettduck.result.TDuckListResultDTO">
select * from pr_user_project
where del_flag = 0
AND status = #{status}
AND `key` in (
<foreach collection="keys" item="key" separator=",">
#{key}
</foreach>
)
ORDER BY created_time DESC
</select>
</mapper>

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

@ -3,4 +3,10 @@
<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>
Loading…
Cancel
Save