Commit 52c8f832 by wangxin

首页滚动提示

parent 465b672e
...@@ -37,4 +37,6 @@ public interface LeaveWordClient { ...@@ -37,4 +37,6 @@ public interface LeaveWordClient {
@GetMapping("/manage/leaveWord/getAuthzUserGroup") @GetMapping("/manage/leaveWord/getAuthzUserGroup")
public AuthzUserGroupVo getAuthzUserGroup(@RequestParam(name = "userId")Long userId); public AuthzUserGroupVo getAuthzUserGroup(@RequestParam(name = "userId")Long userId);
} }
...@@ -358,4 +358,13 @@ public interface TrainingProjectClient { ...@@ -358,4 +358,13 @@ public interface TrainingProjectClient {
*/ */
@GetMapping("/trainingProject/finished") @GetMapping("/trainingProject/finished")
Boolean trainingProjectFinished(@RequestParam("trainingProjectId") Long trainingProjectId, @RequestParam("siteId") Long siteId, @RequestParam("accountId") Long accountId); Boolean trainingProjectFinished(@RequestParam("trainingProjectId") Long trainingProjectId, @RequestParam("siteId") Long siteId, @RequestParam("accountId") Long accountId);
/**
* 滚动提示接口:活动管理(4天内创建且已上架的数据)
* @param model
* @return
*/
@PostMapping("/trainingProject/api/scroll/activity/list")
List<TrainingProjectListVo> apiActivityManagementForScroll(@RequestBody BaseModel<TrainingProjectMyParamVo> model);
} }
...@@ -74,6 +74,8 @@ public class TrainingProjectListVo { ...@@ -74,6 +74,8 @@ public class TrainingProjectListVo {
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
private String createbyName; private String createbyName;
@ApiModelProperty(value = "创建人")
private Long createbyId;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date createTime; private Date createTime;
......
...@@ -631,6 +631,18 @@ public class TrainingProjectController { ...@@ -631,6 +631,18 @@ public class TrainingProjectController {
return trainingProjectService.apiMyPageList(model); return trainingProjectService.apiMyPageList(model);
} }
/**
* 滚动提示接口:活动管理(4天内创建且已上架的数据)
* @param model
* @return
* @throws Exception
*/
@PostMapping("/api/scroll/activity/list")
public List<TrainingProjectListVo> apiActivityManagementForScroll(@RequestBody BaseModel<TrainingProjectMyParamVo> model) throws Exception {
return trainingProjectService.apiActivityManagementForScroll(model);
}
@GetMapping("/pc/train/portal/train/relation") @GetMapping("/pc/train/portal/train/relation")
public List<TrainingProject> pcTrainingProjectList( public List<TrainingProject> pcTrainingProjectList(
......
...@@ -26,4 +26,11 @@ public interface LeaveWordMapper extends BaseMapper<LeaveWord> { ...@@ -26,4 +26,11 @@ public interface LeaveWordMapper extends BaseMapper<LeaveWord> {
@MapKey("id") @MapKey("id")
Map<Long, Map<Long, String>> queryAccountNameByIds(@Param("accountIds") List<Long> accountIds); Map<Long, Map<Long, String>> queryAccountNameByIds(@Param("accountIds") List<Long> accountIds);
/**
* 滚动提示接口:留言管理(4天内创建且待接收的数据)
* @param siteId
* @return
*/
List<LeaveWord> selectMessageManagementForScroll(@Param("siteId") Long siteId);
} }
...@@ -61,4 +61,23 @@ ...@@ -61,4 +61,23 @@
</foreach> </foreach>
AND a.deleted=0 AND a.deleted=0
</select> </select>
<!-- 滚动提示接口:留言管理(4天内创建且待接收的数据) -->
<select id="selectMessageManagementForScroll" resultType="com.yizhi.training.application.domain.LeaveWord">
select
id,
name,
create_time,
create_by_name,
state
from
leave_word
where
deleted = 0
and state = 1
<!-- 4天内创建的数据过滤 -->
and create_time >= DATE_SUB(NOW(), INTERVAL 4 DAY)
order by create_time desc
LIMIT 10
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -374,4 +374,19 @@ public interface TrainingProjectMapper extends BaseMapper<TrainingProject> { ...@@ -374,4 +374,19 @@ public interface TrainingProjectMapper extends BaseMapper<TrainingProject> {
* @return * @return
*/ */
List<Long> getVisiables(@Param("siteId") Long siteId, @Param("orgId") Long orgId, @Param("accountId") Long accountId); List<Long> getVisiables(@Param("siteId") Long siteId, @Param("orgId") Long orgId, @Param("accountId") Long accountId);
/**
* 滚动提示接口:活动管理(4天内创建且已上架的数据)
* @param now
* @param siteId
* @param keyword
* @param visiableTpIds
* @param finishedTpIds
* @return
*/
List<TrainingProject> selectActivityManagementForScroll(@Param("now") Date now, @Param("siteId") Long siteId, @Param("keyword") String keyword,
@Param("visiableTpIds") List<Long> visiableTpIds,
@Param("finishedTpIds") List<Long> finishedTpIds);
} }
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
tb.site_id AS tb_site_id, tb.site_id AS tb_site_id,
tb.org_id AS tb_org_id, tb.org_id AS tb_org_id,
tb.create_time AS tb_create_time, tb.create_time AS tb_create_time,
tb.create_by_id AS tb_create_by_id,
tb.company_id AS tb_company_id tb.company_id AS tb_company_id
</sql> </sql>
...@@ -929,4 +930,32 @@ ...@@ -929,4 +930,32 @@
FROM tp_authorization_range FROM tp_authorization_range
WHERE site_id=#{siteId} AND relation_id=#{accountId} AND type=2 AND deleted = 0 WHERE site_id=#{siteId} AND relation_id=#{accountId} AND type=2 AND deleted = 0
</select> </select>
<!-- 滚动提示接口:活动管理(4天内创建且已上架的数据) -->
<select id="selectActivityManagementForScroll" resultMap="BaseResultMap">
select <include refid="Base_Column_List_simple"/>
from training_project tb
where
-- 首先用站点 id 和上架状态缩小范围
(tb.site_id = #{siteId} and tb.status = 1 and tb.deleted = 0 and
<![CDATA[ DATE_FORMAT(tb.start_time, '%Y-%m-%d') <= DATE_FORMAT(#{now}, '%Y-%m-%d')
and DATE_FORMAT(tb.end_time, '%Y-%m-%d') >= DATE_FORMAT(#{now}, '%Y-%m-%d') ]]>)
and
(tb.visible_range = 1
<if test="visiableTpIds != null and visiableTpIds.size > 0">
or
(tb.visible_range = 0
and tb.id in <foreach collection="visiableTpIds" open="(" close=")" separator="," item="item">#{item}</foreach>)
</if>
)
<if test="finishedTpIds != null and finishedTpIds.size > 0">
and (tb.id not in <foreach collection="finishedTpIds" open="(" close=")" separator="," item="item">#{item}</foreach>)
</if>
<!-- 4天内创建的数据过滤 -->
and tb.create_time >= DATE_SUB(NOW(), INTERVAL 4 DAY)
order by tb.end_time asc,tb.create_time desc
</select>
</mapper> </mapper>
...@@ -255,4 +255,12 @@ public interface ITrainingProjectService extends IService<TrainingProject> { ...@@ -255,4 +255,12 @@ public interface ITrainingProjectService extends IService<TrainingProject> {
* @return * @return
*/ */
Boolean trainingProjectFinished(Long trainingProjectId, Long siteId, Long accountId); Boolean trainingProjectFinished(Long trainingProjectId, Long siteId, Long accountId);
/**
* 滚动提示接口:活动管理(4天内创建且已上架的数据)
* @param model
* @return
*/
List<TrainingProjectListVo> apiActivityManagementForScroll(BaseModel<TrainingProjectMyParamVo> model) throws Exception;
} }
...@@ -1568,4 +1568,45 @@ public class TrainingProjectServiceImpl extends ServiceImpl<TrainingProjectMappe ...@@ -1568,4 +1568,45 @@ public class TrainingProjectServiceImpl extends ServiceImpl<TrainingProjectMappe
return count == 0 ? false : true; return count == 0 ? false : true;
} }
@Override
public List<TrainingProjectListVo> apiActivityManagementForScroll(BaseModel<TrainingProjectMyParamVo> model) throws Exception {
TrainingProjectMyParamVo param = model.getObj();
RequestContext context = model.getContext();
Date now = new Date();
// 获取可见范围的培训项目ID
List<Long> visiableTpIds = this.baseMapper.getVisiables(context.getSiteId(), context.getOrgId(), context.getAccountId());
// 获取已完成的培训项目ID
List<Long> finishedTpIds = this.baseMapper.selectMyFinishedPageNum(context.getAccountId(), context.getSiteId(), visiableTpIds) > 0 ?
this.baseMapper.selectMyFinishedPage(context.getAccountId(), context.getSiteId(), visiableTpIds, new RowBounds()).stream()
.map(TrainingProject::getId)
.collect(Collectors.toList()) : new ArrayList<>();
// 调用Mapper中的新方法获取4天内创建的活动管理数据
List<TrainingProject> trainingProjects = this.baseMapper.selectActivityManagementForScroll(
now, context.getSiteId(), param.getKeyword(), visiableTpIds, finishedTpIds);
// 转换为TrainingProjectListVo
List<TrainingProjectListVo> listVos = new ArrayList<>();
if (!CollectionUtils.isEmpty(trainingProjects)) {
for (TrainingProject project : trainingProjects) {
TrainingProjectListVo vo = new TrainingProjectListVo();
vo.setId(project.getId());
vo.setName(project.getName());
vo.setCreatebyName(project.getCreateByName());
vo.setCreatebyId(project.getCreateById());
vo.setCreateTime(project.getCreateTime());
vo.setStartTime(project.getStartTime());
vo.setEndTime(project.getEndTime());
listVos.add(vo);
}
}
return listVos;
}
} }
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