Commit cadb7555 by 梅存智

活动优化

parent 830a07ab
......@@ -340,4 +340,12 @@ public interface TrainingProjectClient {
*/
@GetMapping("/trainingProject/getTrainingActivity")
TrainingActivityVO getTrainingActivity(@RequestParam("bizType") Integer bizType, @RequestParam(name = "startDate", required = false) String startDate, @RequestParam(name = "endDate", required = false) String endDate);
/**
* 获取置顶的项目
* @param id
* @return
*/
@GetMapping("/trainingProject/top/get")
List<TrainingProjectVo> getTop();
}
......@@ -145,4 +145,13 @@ public class TrainingProjectIntroductionVo {
@ApiModelProperty(value = "关联投票名称")
private String researchName;
@ApiModelProperty(value = "视频地址")
private String videoUrl;
@ApiModelProperty(value = "签到时间段id")
private Long signTimeId;
@ApiModelProperty(value = "签到途径:0:平台签到,1:自定义项目签到")
private Integer signType;
}
......@@ -71,4 +71,10 @@ public class TrainingProjectListVo {
@ApiModelProperty(value = "活动状态CODE")
private Integer activityStateCode;
@ApiModelProperty(value = "创建人")
private String createbyName;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}
......@@ -159,6 +159,9 @@ public class TrainingProjectVo extends Model<TrainingProjectVo> {
@ApiModelProperty(value = "活动类型CODE")
private Integer activityType;
@ApiModelProperty(value = "业务类型:1活动服务;2培训测试")
private Integer bizType;
@Override
protected Serializable pkVal() {
return this.id;
......
......@@ -930,5 +930,18 @@ public class TrainingProjectController {
@RequestParam(name = "startDate", required = false) String startDate, @RequestParam(name = "endDate", required = false) String endDate) {
return trainingProjectService.getTrainingActivity(bizType, startDate, endDate);
}
/**
* 获取置顶的项目
* @param id
* @return
*/
@GetMapping("/top/get")
List<TrainingProjectVo> getTop() {
RequestContext context = ContextHolder.get();
Long siteId = context.getSiteId();
List<TrainingProjectVo> list = trainingProjectService.getTop(siteId);
return list;
}
}
......@@ -195,6 +195,9 @@ public class TrainingProject extends Model<TrainingProject> {
@ApiModelProperty(value = "是否置顶:true是;false否")
private Boolean topUp;
@ApiModelProperty(value = "视频地址")
private String videoUrl;
@Override
protected Serializable pkVal() {
return this.id;
......
......@@ -47,4 +47,14 @@ public interface TpStudentEnrollPassedMapper extends BaseMapper<TpStudentEnrollP
@Select("select training_project_id from tr_sign_record " +
"where account_id = #{accountId}")
List<Long> selectSignTpIds(@Param("accountId") Long accountId);
/**
* 查询签到ID
*
* @param accountId
* @return
*/
@Select("select id from tr_sign_time " +
"where training_project_id = #{tpProjrctId} AND deleted=0 GROUP BY id")
Long selectSignTimeId(@Param("tpProjrctId") Long tpProjrctId);
}
......@@ -350,4 +350,11 @@ public interface TrainingProjectMapper extends BaseMapper<TrainingProject> {
* @return
*/
TrainingProjectVo selectTrainingProjectTime(@Param("siteId") Long siteId, @Param("projectId") Long projectId);
/**
* 获取置顶的项目
* @param siteId
* @return
*/
List<TrainingProjectVo> getTop(@Param("siteId") Long siteId);
}
......@@ -207,7 +207,7 @@
<!-- 培训项目首页列表 -->
<select id="apiPageList" resultType="com.yizhi.training.application.vo.domain.TrainingProjectVo">
select tb.*,en.enable_pay,en.actual_price,en.person_limit_num AS canNumber,en.start_time AS enrollStartTime, en.end_time AS enrollEndTime,
sg.start_time AS signStartTime, sg.end_time AS signEndTime,tb.activity_type
sg.start_time AS signStartTime, sg.end_time AS signEndTime,tb.activity_type,tb.biz_type
from training_project tb
left join tr_enroll en on tb.id = en.training_project_id
left join tr_sign_time sg on tb.id = sg.training_project_id
......@@ -882,4 +882,10 @@
where tb.id=#{projectId} and tb.site_id = #{siteId} and tb.status = 1 and tb.deleted = 0
</select>
<select id="getTop" resultType="com.yizhi.training.application.vo.domain.TrainingProjectVo">
select tb.id,tb.name,tb.logo_img,tb.create_by_name,tb.create_time
from training_project tb
where tb.site_id = #{siteId} and tb.biz_type = 2 and tb.status = 1 and tb.top_up = 1 and tb.deleted = 0
</select>
</mapper>
......@@ -239,4 +239,11 @@ public interface ITrainingProjectService extends IService<TrainingProject> {
* @return
*/
TrainingActivityVO getTrainingActivity(Integer bizType, String startDate, String endDate);
/**
* 获取置顶的项目信息
* @param siteId
* @return
*/
List<TrainingProjectVo> getTop(Long siteId);
}
......@@ -88,6 +88,7 @@ import com.yizhi.training.application.vo.api.TrainingProjectParamVo;
import com.yizhi.training.application.vo.api.TrainingProjectProgressVo;
import com.yizhi.training.application.vo.api.TrainingProjectVoPortalVo;
import com.yizhi.training.application.vo.domain.TrainingActivityVO;
import com.yizhi.training.application.vo.domain.TrainingProjectVo;
import com.yizhi.training.application.vo.manage.MessageRemindVo;
import com.yizhi.training.application.vo.manage.RelationIdVo;
import com.yizhi.training.application.vo.manage.TpRemindVo;
......@@ -172,6 +173,11 @@ public class TrainingProjectServiceImpl extends ServiceImpl<TrainingProjectMappe
private static final String ACTIVITY_KEY = "activity";
private static final String REDIS_PRO_ACTIVITY_TYPE_KEY = "REDIS_PRO_ACTIVITY_TYPE";
/**
* 业务类型:1活动服务
*/
private static final Integer PROJECT_BIZ_TYPE = 1;
@Override
public Page<TrainingProject> searchPage(String name, Long tpClassificationId,
......@@ -466,9 +472,9 @@ public class TrainingProjectServiceImpl extends ServiceImpl<TrainingProjectMappe
redisCache.set(REDIS_PRO_ACTIVITY_TYPE_KEY, siteDics, 7200L);
}
if (!CollectionUtils.isEmpty(list)) {
Date date = new Date();
/*Date date = new Date();
List<Long> tpIdsForJoinNum = null;
List<Long> relationIdsForJoinNum = null;
List<Long> relationIdsForJoinNum = null;*/
for (com.yizhi.training.application.vo.domain.TrainingProjectVo tr : list) {
TrainingProjectListVo vo = new TrainingProjectListVo();
vo.setEndTime(tr.getEndTime());
......@@ -482,7 +488,8 @@ public class TrainingProjectServiceImpl extends ServiceImpl<TrainingProjectMappe
//是否付费标签
vo.setEnablePay(tr.getEnablePay());
vo.setCanNumber(tr.getCanNumber());
vo.setCreateTime(tr.getCreateTime());
vo.setCreatebyName(tr.getCreateByName());
//活动名称
if(siteDics != null){
for(SiteDicVo dic : siteDics){
......@@ -500,7 +507,7 @@ public class TrainingProjectServiceImpl extends ServiceImpl<TrainingProjectMappe
vo.setActivityStateCode(state.getCode());
vo.setActivityStateName(state.getValue());
//活动没结束
if (state != TrEnrollStatusEnum.ACT_END) {
if (tr.getBizType().equals(PROJECT_BIZ_TYPE) && state != TrEnrollStatusEnum.ACT_END) {
//2、活动要报名和签到
if((tr.getEnableEnroll() == 1 && tr.getEnableSign() == 1) || tr.getEnableEnroll() == 1){
//判断学员是否报名了该项目
......@@ -700,11 +707,14 @@ public class TrainingProjectServiceImpl extends ServiceImpl<TrainingProjectMappe
addViewRecord(accountId, context, project, now);
//获取投票ID和名称
ResearchVo researchVo = researchClient.viewInfo(project.getResearchId());
if(researchVo != null){
introductionVo.setResearchId(researchVo.getId());
introductionVo.setResearchName(researchVo.getName());
if(project.getResearchId() != null){
ResearchVo researchVo = researchClient.viewInfo(project.getResearchId());
if(researchVo != null){
introductionVo.setResearchId(researchVo.getId());
introductionVo.setResearchName(researchVo.getName());
}
}
/**
* 设置活动状态: 1、先根据项目的开始和结束时间设置活动状态
*/
......@@ -718,7 +728,7 @@ public class TrainingProjectServiceImpl extends ServiceImpl<TrainingProjectMappe
}
// 2、活动要报名和签到
if ((tr.getEnableEnroll() == 1 && tr.getEnableSign() == 1) || tr.getEnableEnroll() == 1) {
if (project.getBizType().equals(PROJECT_BIZ_TYPE) && (tr.getEnableEnroll() == 1 && tr.getEnableSign() == 1) || tr.getEnableEnroll() == 1) {
// 报名通过的
List<Long> passEnrollTpIds = tpStudentEnrollPassedMapper.selectTpIds(context.getAccountId());
......@@ -758,7 +768,7 @@ public class TrainingProjectServiceImpl extends ServiceImpl<TrainingProjectMappe
}
}
}
} else if (tr.getEnableEnroll() == 0 && tr.getEnableSign() == 1) {
} else if (project.getBizType().equals(PROJECT_BIZ_TYPE) && tr.getEnableEnroll() == 0 && tr.getEnableSign() == 1) {
// 3、活动要签到
// 查询签到记录
List<Long> passSignTpIds = tpStudentEnrollPassedMapper.selectSignTpIds(context.getAccountId());
......@@ -779,6 +789,9 @@ public class TrainingProjectServiceImpl extends ServiceImpl<TrainingProjectMappe
}
}
Long signTimeId = tpStudentEnrollPassedMapper.selectSignTimeId(project.getId());
introductionVo.setSignTimeId(signTimeId);
introductionVo.setSignType(0);
return vo;
}
return null;
......@@ -879,6 +892,7 @@ public class TrainingProjectServiceImpl extends ServiceImpl<TrainingProjectMappe
vo.setOther(trainingProject.getOther());
vo.setOrganizer(trainingProject.getOrganizer());
vo.setCoOrganizer(trainingProject.getCoOrganizer());
vo.setVideoUrl(trainingProject.getVideoUrl());
Boolean finished = false;
// 如果需要报名,查看是否已经报名
if (trainingProject.getEnableEnroll() == 1) {
......@@ -1425,4 +1439,9 @@ public class TrainingProjectServiceImpl extends ServiceImpl<TrainingProjectMappe
}
return item;
}
@Override
public List<TrainingProjectVo> getTop(Long siteId) {
return trainingProjectMapper.getTop(siteId);
}
}
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