Commit 2d46e3c0 by wangxin

首页滚动提示

parent c7bf5538
......@@ -230,6 +230,14 @@ public interface ResearchClient {
*/
@GetMapping("/research/details")
ResearchVo getResearchDetails(@RequestParam("id") Long id);
/**
* 滚动提示接口:投票管理(4天内创建且已上架的数据)
* @param model
* @return
*/
@PostMapping("/research/api/scroll/vote/list")
List<ResearchVo> apiVoteManagementForScroll(@RequestBody BaseModel<PageVo> model);
}
......@@ -426,5 +426,15 @@ public class ResearchController {
ResearchVo getResearchDetails(@RequestParam("id") Long id) {
return researchService.getResearchDetails(id);
}
/**
* 滚动提示接口:投票管理(4天内创建且已上架的数据)
* @param model
* @return
*/
@PostMapping("/api/scroll/vote/list")
public List<Research> apiVoteManagementForScroll(@RequestBody BaseModel<PageVo> model) {
return researchService.apiVoteManagementForScroll(model);
}
}
......@@ -132,4 +132,15 @@ public interface ResearchMapper extends BaseMapper<Research> {
int checkTPlanResearchState(@Param("idsInRange") List<Long> idsInRange, @Param("id") Long id,
@Param("siteId") Long siteId);
/**
* 滚动提示接口:投票管理(4天内创建且已上架的数据)
* @param idsInRange
* @param siteId
* @param now
* @return
*/
List<Research> selectVoteManagementForScroll(@Param("idsInRange") List<Long> idsInRange,
@Param("siteId") Long siteId,
@Param("now") Date now);
}
......@@ -316,8 +316,7 @@
and tb.org_id in
(<foreach collection="range.orgIds" item="item" separator=",">#{item}</foreach>)
</if>
-->
-->
and tb.deleted = 0
</where>
......@@ -617,6 +616,42 @@
AND <![CDATA[ DATE_FORMAT(c.end_time, '%Y-%m-%d') >= DATE_FORMAT(#{date}, '%Y-%m-%d') ]]>
</select>
<!-- 滚动提示接口:投票管理(4天内创建且已上架的数据) -->
<select id="selectVoteManagementForScroll" resultType="com.yizhi.research.application.vo.domain.Research">
select distinct
tb.id AS id
,tb.research_no AS researchNo
,tb.name AS name
,tb.start_time AS startTime
,tb.end_time AS endTime
,tb.visible_range AS visibleRange
,tb.content AS content
,tb.state AS state
,tb.deleted AS deleted
,tb.company_id AS companyId
,tb.org_id AS orgId
,tb.site_id AS siteId
,tb.biz_type
,tb.page_mode,
tb.create_time
from research tb
where
-- 状态、站点
tb.state = 1 and tb.deleted = 0 and tb.site_id = #{siteId}
-- 可见范围
and (tb.visible_range = 1
<if test="idsInRange != null and idsInRange.size > 0">
or (tb.visible_range = 2 and tb.id in
(<foreach collection="idsInRange" separator="," item="id">#{id}</foreach>))
</if>
)
and tb.biz_type = 2
<!-- 4天内创建的数据过滤 -->
and tb.create_time >= DATE_SUB(NOW(), INTERVAL 4 DAY)
order by tb.create_time desc,tb.end_time
</select>
<select id="getResearchTop" resultType="com.yizhi.research.application.vo.domain.ResearchVo">
select tb.id,tb.name,tb.image AS logo_img,tb.create_by_name,tb.create_time
from research tb
......
......@@ -168,4 +168,11 @@ public interface IResearchService extends IService<Research> {
* @return
*/
ResearchVo getResearchDetails(Long id);
/**
* 滚动提示接口:投票管理(4天内创建且已上架的数据)
* @param model
* @return
*/
List<Research> apiVoteManagementForScroll(BaseModel<PageVo> model);
}
......@@ -612,6 +612,23 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i
page.setRecords(researchList);
return page;
}
@Override
public List<Research> apiVoteManagementForScroll(BaseModel<PageVo> model) {
RequestContext context = model.getContext();
Date now = new Date();
// 查出指定学员可见的调研id
List<Long> researchIdsInRange = null;
if (!CollectionUtils.isEmpty(context.getRelationIds())) {
researchIdsInRange = researchAuthorizeMapper.getResearchIdsInRange(context.getRelationIds());
}
// 调用Mapper中的新方法获取4天内创建的投票管理数据
List<Research> researchList = this.baseMapper.selectVoteManagementForScroll(researchIdsInRange, context.getSiteId(), now);
return researchList;
}
//设置实际参加人数
public void selectRealCount(List<Research> list) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment