大赛概况添加 编辑
parent
d38fb00dd4
commit
6f6601265d
@ -1,4 +1,4 @@
|
||||
package com.tz.platform.common.core.vo;
|
||||
package com.tz.platform.common.core.bo;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
@ -0,0 +1,9 @@
|
||||
package com.tz.platform.common.core.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GroupCat {
|
||||
private Integer id;
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.tz.platform.common.core.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Rotation {
|
||||
private Integer id;
|
||||
private String img;
|
||||
private String link;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.tz.platform.common.core.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class Stage {
|
||||
private int id;
|
||||
private String name;
|
||||
private int status;
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
private Date signUpStartTime;
|
||||
private Date singUpEndTime;
|
||||
private boolean enableSignUp;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.tz.platform.common.core.vo;
|
||||
package com.tz.platform.common.core.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.tz.platform.competitiion;
|
||||
package com.tz.platform;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
@ -0,0 +1,41 @@
|
||||
package com.tz.platform.competitiion.pc;
|
||||
|
||||
import com.tz.platform.common.core.base.Result;
|
||||
import com.tz.platform.competitiion.pc.biz.PCCompetitionBiz;
|
||||
import com.tz.platform.competitiion.pc.dto.PageCompetitionDTO;
|
||||
import com.tz.platform.competitiion.pc.vo.CompetitionVO;
|
||||
import com.tz.platform.competitiion.pc.vo.PageCompetitionVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/pc/competition")
|
||||
public class CompetitionController {
|
||||
|
||||
@Autowired
|
||||
private PCCompetitionBiz biz;
|
||||
|
||||
@PostMapping(value = "add")
|
||||
public Result<Long> add(@RequestBody CompetitionVO vo){
|
||||
return biz.add(vo);
|
||||
}
|
||||
|
||||
@PostMapping(value = "update")
|
||||
public Result<String> update(@RequestBody CompetitionVO vo){
|
||||
return biz.update(vo);
|
||||
}
|
||||
|
||||
@PostMapping(value = "delete")
|
||||
public Result<String> delete(@RequestBody CompetitionVO vo){
|
||||
return biz.delete(vo);
|
||||
}
|
||||
|
||||
@PostMapping(value = "list")
|
||||
public Result<PageCompetitionDTO> list(@RequestBody PageCompetitionVo vo){
|
||||
return biz.list(vo);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.tz.platform.competitiion.pc.biz;
|
||||
|
||||
import com.tz.platform.common.core.base.Result;
|
||||
import com.tz.platform.competitiion.pc.dto.PageCompetitionDTO;
|
||||
import com.tz.platform.competitiion.pc.vo.CompetitionVO;
|
||||
import com.tz.platform.competitiion.pc.vo.PageCompetitionVo;
|
||||
import com.tz.platform.entity.Competition;
|
||||
import com.tz.platform.repository.CompetitionDao;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Component
|
||||
public class PCCompetitionBiz {
|
||||
|
||||
@Autowired
|
||||
private CompetitionDao competitionDao ;
|
||||
|
||||
public Result<Long> add(CompetitionVO vo){
|
||||
if(StringUtils.isEmpty(vo.getName())){
|
||||
return Result.error("大赛名称不能为空");
|
||||
}
|
||||
Competition competition = new Competition();
|
||||
BeanUtils.copyProperties(vo,competition);
|
||||
competition =competitionDao.save(competition);
|
||||
return Result.success(competition.getId());
|
||||
}
|
||||
|
||||
public Result<String> update(CompetitionVO vo){
|
||||
if(StringUtils.isEmpty(vo.getName())){
|
||||
return Result.error("大赛名称不能为空");
|
||||
}
|
||||
Competition competition = new Competition();
|
||||
BeanUtils.copyProperties(vo,competition);
|
||||
competitionDao.save(competition);
|
||||
return Result.success("编辑成功");
|
||||
}
|
||||
|
||||
public Result<String> delete(CompetitionVO vo){
|
||||
competitionDao.deleteById(vo.getId());
|
||||
return Result.success("success");
|
||||
}
|
||||
|
||||
public Result<PageCompetitionDTO> list(PageCompetitionVo vo){
|
||||
Sort sort = Sort.by(Sort.Direction.DESC,"id");
|
||||
Pageable pageable = PageRequest.of(vo.getPageNo(),vo.getPageSize(),sort);
|
||||
Page<Competition> competitionPage = competitionDao.findAll(pageable);
|
||||
PageCompetitionDTO dto = new PageCompetitionDTO();
|
||||
dto.setPage(competitionPage);
|
||||
return Result.success(dto);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.tz.platform.competitiion.pc.dto;
|
||||
|
||||
import com.tz.platform.entity.Competition;
|
||||
import lombok.Data;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PageCompetitionDTO implements Serializable {
|
||||
private Page<Competition> page;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.tz.platform.competitiion.pc.vo;
|
||||
|
||||
import com.tz.platform.common.core.bo.Rotation;
|
||||
import com.tz.platform.common.core.bo.Stage;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CompetitionVO implements Serializable {
|
||||
private Long userNo;
|
||||
private Long id;
|
||||
private String name;
|
||||
private Integer type;
|
||||
private String sponsor;
|
||||
private String supporter;
|
||||
private Integer teamMinCount;
|
||||
private Integer teamMaxCount;
|
||||
private List<Stage> stageList;
|
||||
private Integer currentStage;
|
||||
private List<Rotation> bannerList;
|
||||
private String thumbnail;
|
||||
private String summary;
|
||||
private String rule;
|
||||
private String prize;
|
||||
private String news;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.tz.platform.competitiion.pc.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class PageCompetitionVo {
|
||||
private Long userNo;
|
||||
private Integer pageSize;
|
||||
private Integer pageNo;
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.tz.platform.entity;
|
||||
|
||||
import com.tz.platform.common.core.bo.Rotation;
|
||||
import com.tz.platform.common.core.bo.Stage;
|
||||
import com.vladmihalcea.hibernate.type.json.JsonStringType;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.hibernate.annotations.TypeDef;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@TypeDef(name = "json", typeClass = JsonStringType.class)
|
||||
@Data
|
||||
public class Competition {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private Long userNo;
|
||||
private String name;
|
||||
private Integer type;
|
||||
private String sponsor;
|
||||
private String supporter;
|
||||
private Integer teamMinCount;
|
||||
private Integer teamMaxCount;
|
||||
private Integer status;
|
||||
@Type(type = "json")
|
||||
@Column(columnDefinition = "json")
|
||||
private List<Stage> stageList;
|
||||
private Integer currentStage;
|
||||
private String currentStageName;
|
||||
private Date creatTime;
|
||||
@Type(type = "json")
|
||||
@Column(columnDefinition = "json")
|
||||
private List<Rotation> bannerList;
|
||||
private String thumbnail;
|
||||
@Column(columnDefinition = "text")
|
||||
private String summary;
|
||||
@Column(columnDefinition = "text")
|
||||
private String rule;
|
||||
@Column(columnDefinition = "text")
|
||||
private String prize;
|
||||
@Column(columnDefinition = "text")
|
||||
private String news;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.tz.platform.entity;
|
||||
|
||||
import com.tz.platform.common.core.bo.GroupCat;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(indexes = {@Index(columnList = "competitionId")})
|
||||
public class CompetitionGroup {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
private Long competitionId;
|
||||
private String name;
|
||||
private Integer limitType;
|
||||
@Type(type = "json")
|
||||
@Column(columnDefinition = "json")
|
||||
private List<GroupCat> catList;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.tz.platform.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(indexes = {@Index(columnList = "competitionId")})
|
||||
public class CompetitionTask {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
private Long competitionId;
|
||||
private Integer stageId;
|
||||
private Long financePower;
|
||||
private Long examPower;
|
||||
private Date operationStartTime;
|
||||
private Date operationEndTime;
|
||||
private Integer tradeType;
|
||||
private Long initCapital;
|
||||
private String operationLogo;
|
||||
private Long financeBasePower;
|
||||
private Long financeProfitPower;
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.tz.platform.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
@Table(indexes = {@Index(columnList = "competitionId")})
|
||||
public class ExamPaper {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private Long competitionId;
|
||||
private Integer stageId;
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.tz.platform.repository;
|
||||
|
||||
import com.tz.platform.entity.Competition;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface CompetitionDao extends JpaRepository<Competition,Long> {
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.tz.platform.repository;
|
||||
|
||||
import com.tz.platform.entity.CompetitionGroup;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface CompetitionGroupDao extends JpaRepository<CompetitionGroup,Integer> {
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.tz.platform.repository;
|
||||
|
||||
import com.tz.platform.entity.CompetitionTask;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface CompetitionTaskDao extends JpaRepository<CompetitionTask,Integer> {
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.tz.platform.repository;
|
||||
|
||||
import com.tz.platform.entity.ExamPaper;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface ExamPaperDao extends JpaRepository<ExamPaper,Long> {
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
server:
|
||||
port: 50012
|
||||
spring:
|
||||
application:
|
||||
name: tz-competition-service
|
||||
profiles:
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 127.0.0.1:8848
|
||||
username: nacos
|
||||
password: nacos
|
||||
config:
|
||||
namespace: ${spring.profiles.active}
|
||||
file-extension: yaml
|
||||
discovery:
|
||||
namespace: ${spring.profiles.active}
|
@ -0,0 +1,77 @@
|
||||
package com.tz.platform.pc.biz;
|
||||
|
||||
import com.tz.platform.common.core.base.Result;
|
||||
import com.tz.platform.entity.Question;
|
||||
import com.tz.platform.pc.dto.MultiQuestionDTO;
|
||||
import com.tz.platform.pc.dto.PageMuiltQuestionDTO;
|
||||
import com.tz.platform.pc.dto.PageQuestionDTO;
|
||||
import com.tz.platform.pc.vo.*;
|
||||
import com.tz.platform.repository.QuestionDao;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Component
|
||||
public class PCMuiltQuestionBiz {
|
||||
|
||||
@Autowired
|
||||
private QuestionDao questionDao;
|
||||
|
||||
public Result<PageMuiltQuestionDTO> list(PageQuestionVO questionVO){
|
||||
PageMuiltQuestionDTO questionDTO = new PageMuiltQuestionDTO();
|
||||
Pageable pageable = PageRequest.of(questionVO.getPageNo(),20);
|
||||
Page<Question> questions =null;
|
||||
if((questionVO.getCourseId() == null|| questionVO.getCourseId() == 0) && StringUtils.isEmpty(questionVO.getStem())){
|
||||
questions = questionDao.findAllByType(1,pageable);
|
||||
}else if(questionVO.getCourseId()>0&&StringUtils.hasText(questionVO.getStem())){
|
||||
questions = questionDao.findAllByCourseIdAndStemAndType(questionVO.getCourseId(),questionVO.getStem(),1,pageable);
|
||||
}else if(questionVO.getCourseId()>0){
|
||||
questions = questionDao.findAllByCourseIdAndType(questionVO.getCourseId(),1,pageable);
|
||||
}else {
|
||||
questions = questionDao.findAllByStemAndType(questionVO.getStem(), 1,pageable);
|
||||
}
|
||||
return Result.success(questionDTO.setPage(questions));
|
||||
}
|
||||
|
||||
public Result<Long> add(MuiltQuestionVO vo){
|
||||
Question question = new Question();
|
||||
BeanUtils.copyProperties(vo,question);
|
||||
question = questionDao.save(question);
|
||||
return Result.success(question.getId());
|
||||
}
|
||||
|
||||
public Result<String> update(MultiQuestionUpdateVO vo){
|
||||
Question question = questionDao.getById(vo.getId());
|
||||
if(question==null){
|
||||
return Result.error("无数据");
|
||||
}
|
||||
BeanUtils.copyProperties(vo,question);
|
||||
questionDao.save(question);
|
||||
return Result.success("success");
|
||||
}
|
||||
|
||||
public Result<String> delete(QuestionVO vo){
|
||||
questionDao.deleteById(vo.getId());
|
||||
return Result.success("success");
|
||||
}
|
||||
|
||||
public Result<MultiQuestionDTO> get(QuestionVO vo){
|
||||
Question question = questionDao.getById(vo.getId());
|
||||
if(question == null){
|
||||
return Result.error("没有数据");
|
||||
}
|
||||
MultiQuestionDTO questionDTO = new MultiQuestionDTO();
|
||||
BeanUtils.copyProperties(question,questionDTO);
|
||||
return Result.success(questionDTO);
|
||||
}
|
||||
|
||||
public Result<String> batch(BatchQuestionVO vo){
|
||||
questionDao.batchUpdate(vo.getStatus(),vo.getIds());
|
||||
return Result.success("success");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.tz.platform.system.pc;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class ProviceController {
|
||||
|
||||
}
|
Loading…
Reference in New Issue