|
|
@ -1,9 +1,10 @@
|
|
|
|
package com.tz.platform.competitiion.pc.biz;
|
|
|
|
package com.tz.platform.competitiion.pc.biz;
|
|
|
|
|
|
|
|
|
|
|
|
import com.tz.platform.common.core.base.Result;
|
|
|
|
import com.tz.platform.common.core.base.Result;
|
|
|
|
|
|
|
|
import com.tz.platform.competitiion.pc.dto.CompetitionDTO;
|
|
|
|
import com.tz.platform.competitiion.pc.dto.PageCompetitionDTO;
|
|
|
|
import com.tz.platform.competitiion.pc.dto.PageCompetitionDTO;
|
|
|
|
import com.tz.platform.competitiion.pc.vo.CompetitionVO;
|
|
|
|
import com.tz.platform.competitiion.pc.vo.CompetitionVO;
|
|
|
|
import com.tz.platform.competitiion.pc.vo.PageCompetitionVo;
|
|
|
|
import com.tz.platform.competitiion.pc.vo.PageCompetitionVO;
|
|
|
|
import com.tz.platform.entity.Competition;
|
|
|
|
import com.tz.platform.entity.Competition;
|
|
|
|
import com.tz.platform.repository.CompetitionDao;
|
|
|
|
import com.tz.platform.repository.CompetitionDao;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
@ -14,6 +15,9 @@ import org.springframework.data.domain.Pageable;
|
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
|
|
|
|
@Component
|
|
|
|
@Component
|
|
|
|
public class PCCompetitionBiz {
|
|
|
|
public class PCCompetitionBiz {
|
|
|
@ -25,8 +29,13 @@ public class PCCompetitionBiz {
|
|
|
|
if(StringUtils.isEmpty(vo.getName())){
|
|
|
|
if(StringUtils.isEmpty(vo.getName())){
|
|
|
|
return Result.error("大赛名称不能为空");
|
|
|
|
return Result.error("大赛名称不能为空");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(vo.getType() == null||vo.getType()<=0){
|
|
|
|
|
|
|
|
return Result.error("");
|
|
|
|
|
|
|
|
}
|
|
|
|
Competition competition = new Competition();
|
|
|
|
Competition competition = new Competition();
|
|
|
|
BeanUtils.copyProperties(vo,competition);
|
|
|
|
BeanUtils.copyProperties(vo,competition);
|
|
|
|
|
|
|
|
competition.setStartTime(new Date());
|
|
|
|
|
|
|
|
competition.setStatus(-1);
|
|
|
|
competition =competitionDao.save(competition);
|
|
|
|
competition =competitionDao.save(competition);
|
|
|
|
return Result.success(competition.getId());
|
|
|
|
return Result.success(competition.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -46,7 +55,7 @@ public class PCCompetitionBiz {
|
|
|
|
return Result.success("success");
|
|
|
|
return Result.success("success");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Result<PageCompetitionDTO> list(PageCompetitionVo vo){
|
|
|
|
public Result<PageCompetitionDTO> list(PageCompetitionVO vo){
|
|
|
|
Sort sort = Sort.by(Sort.Direction.DESC,"id");
|
|
|
|
Sort sort = Sort.by(Sort.Direction.DESC,"id");
|
|
|
|
Pageable pageable = PageRequest.of(vo.getPageNo(),vo.getPageSize(),sort);
|
|
|
|
Pageable pageable = PageRequest.of(vo.getPageNo(),vo.getPageSize(),sort);
|
|
|
|
Page<Competition> competitionPage = competitionDao.findAll(pageable);
|
|
|
|
Page<Competition> competitionPage = competitionDao.findAll(pageable);
|
|
|
@ -54,4 +63,11 @@ public class PCCompetitionBiz {
|
|
|
|
dto.setPage(competitionPage);
|
|
|
|
dto.setPage(competitionPage);
|
|
|
|
return Result.success(dto);
|
|
|
|
return Result.success(dto);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Result<CompetitionDTO> get(@RequestBody CompetitionVO vo){
|
|
|
|
|
|
|
|
Competition competition = competitionDao.getById(vo.getId());
|
|
|
|
|
|
|
|
CompetitionDTO dto = new CompetitionDTO();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(competition,dto);
|
|
|
|
|
|
|
|
return Result.success(dto);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|