Commit 473605c5672e749eb8ecc40d048733dfdbad4c53

Authored by 陈杰
1 parent fafdccdc
Exists in master

bug 修复

src/main/java/com/sincere/student/controller/AdminController.java
@@ -86,6 +86,11 @@ public class AdminController { @@ -86,6 +86,11 @@ public class AdminController {
86 @RequestMapping(value = "/submit/update" , method = RequestMethod.POST) 86 @RequestMapping(value = "/submit/update" , method = RequestMethod.POST)
87 public BaseDto updateFile(@RequestBody SubmitFile submitFile){ 87 public BaseDto updateFile(@RequestBody SubmitFile submitFile){
88 BaseDto result = new BaseDto<>(); 88 BaseDto result = new BaseDto<>();
  89 + if(!submitFile.getFileUrl().contains("xls")){
  90 + result.setSuccess(false) ;
  91 + result.setMessage("请上传excel") ;
  92 + return result ;
  93 + }
89 try{ 94 try{
90 SubmitFile beforeFile = submitService.getById(submitFile.getId()); 95 SubmitFile beforeFile = submitService.getById(submitFile.getId());
91 if(beforeFile.getFileUrl().equals(submitFile.getFileUrl())){ 96 if(beforeFile.getFileUrl().equals(submitFile.getFileUrl())){
@@ -121,6 +126,11 @@ public class AdminController { @@ -121,6 +126,11 @@ public class AdminController {
121 @RequestMapping(value = "/submit/createFile" , method = RequestMethod.POST) 126 @RequestMapping(value = "/submit/createFile" , method = RequestMethod.POST)
122 public BaseDto createFile(@RequestBody SubmitFile submitFile){ 127 public BaseDto createFile(@RequestBody SubmitFile submitFile){
123 BaseDto result = new BaseDto(); 128 BaseDto result = new BaseDto();
  129 + if(!submitFile.getFileUrl().contains("xls")){
  130 + result.setSuccess(false);
  131 + result.setMessage("请上传excel");
  132 + return result ;
  133 + }
124 try{ 134 try{
125 List<Point> list = ExcelUtils.analysisExcel(submitFile.getFileUrl()); 135 List<Point> list = ExcelUtils.analysisExcel(submitFile.getFileUrl());
126 List<Point> points = new ArrayList<>(); 136 List<Point> points = new ArrayList<>();
@@ -446,8 +456,15 @@ public class AdminController { @@ -446,8 +456,15 @@ public class AdminController {
446 @ApiOperation("修改专业相关接口") 456 @ApiOperation("修改专业相关接口")
447 @RequestMapping(value = "/major/updateMajor" , method = RequestMethod.POST) 457 @RequestMapping(value = "/major/updateMajor" , method = RequestMethod.POST)
448 public BaseDto updateMajor(@RequestBody Major major){ 458 public BaseDto updateMajor(@RequestBody Major major){
449 - majorService.update(major);  
450 - return new BaseDto() ; 459 + BaseDto result = new BaseDto();
  460 + Major before = majorService.getById(major.getId());
  461 + if(before.getPid() == -1 && major.getPid() != -1){
  462 + result.setSuccess(false);
  463 + result.setMessage("一级专业不能被设置成二级");
  464 + }else {
  465 + majorService.update(major);
  466 + }
  467 + return result ;
451 } 468 }
452 469
453 @MemberAccess 470 @MemberAccess
@@ -470,7 +487,7 @@ public class AdminController { @@ -470,7 +487,7 @@ public class AdminController {
470 public BaseDto<Page<Article>> getArticleList(@RequestBody ArticleSearchDto articleSearchDto){ 487 public BaseDto<Page<Article>> getArticleList(@RequestBody ArticleSearchDto articleSearchDto){
471 BaseDto<Page<Article>> result = new BaseDto<>() ; 488 BaseDto<Page<Article>> result = new BaseDto<>() ;
472 articleSearchDto.setStatus(0); 489 articleSearchDto.setStatus(0);
473 - Page<Article> page = articleService.getList(articleSearchDto); 490 + Page<Article> page = articleService.getAdminList(articleSearchDto);
474 result.setData(page); 491 result.setData(page);
475 return result ; 492 return result ;
476 } 493 }
src/main/java/com/sincere/student/mapper/MajorMapper.java
@@ -8,6 +8,8 @@ public interface MajorMapper { @@ -8,6 +8,8 @@ public interface MajorMapper {
8 8
9 List<Major> getList(Major major); 9 List<Major> getList(Major major);
10 10
  11 + Major getById(int id);
  12 +
11 int getListCount(Major major); 13 int getListCount(Major major);
12 14
13 int create(Major major); 15 int create(Major major);
src/main/java/com/sincere/student/model/Consult.java
@@ -27,6 +27,8 @@ public class Consult { @@ -27,6 +27,8 @@ public class Consult {
27 private String columnTypeName; 27 private String columnTypeName;
28 @ApiModelProperty(value = "视频地址") 28 @ApiModelProperty(value = "视频地址")
29 private String videoUrl; 29 private String videoUrl;
  30 + @ApiModelProperty(value = "视频地址")
  31 + private List<String> videoUrlList;
30 @ApiModelProperty(value = "内容") 32 @ApiModelProperty(value = "内容")
31 private String context; 33 private String context;
32 @ApiModelProperty(value = "联系方式") 34 @ApiModelProperty(value = "联系方式")
@@ -36,6 +38,14 @@ public class Consult { @@ -36,6 +38,14 @@ public class Consult {
36 @ApiModelProperty(value = "4个栏目") 38 @ApiModelProperty(value = "4个栏目")
37 private List<UniversityConsultDetail> list ; 39 private List<UniversityConsultDetail> list ;
38 40
  41 + public List<String> getVideoUrlList() {
  42 + return videoUrlList;
  43 + }
  44 +
  45 + public void setVideoUrlList(List<String> videoUrlList) {
  46 + this.videoUrlList = videoUrlList;
  47 + }
  48 +
39 public String getColumnTypeName() { 49 public String getColumnTypeName() {
40 return columnTypeName; 50 return columnTypeName;
41 } 51 }
src/main/java/com/sincere/student/model/Video.java
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel; @@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
4 import io.swagger.annotations.ApiModelProperty; 4 import io.swagger.annotations.ApiModelProperty;
5 5
6 import java.util.Date; 6 import java.util.Date;
  7 +import java.util.List;
7 8
8 @ApiModel 9 @ApiModel
9 public class Video { 10 public class Video {
@@ -16,6 +17,9 @@ public class Video { @@ -16,6 +17,9 @@ public class Video {
16 private int columnType ; 17 private int columnType ;
17 @ApiModelProperty(value = "视频路径") 18 @ApiModelProperty(value = "视频路径")
18 private String videoUrl ; 19 private String videoUrl ;
  20 +
  21 + @ApiModelProperty(value = "视频路径")
  22 + private List<String> videoUrlList ;
19 @ApiModelProperty(value = "排序") 23 @ApiModelProperty(value = "排序")
20 private int sort ; 24 private int sort ;
21 @ApiModelProperty(value = "创建时间") 25 @ApiModelProperty(value = "创建时间")
@@ -35,6 +39,14 @@ public class Video { @@ -35,6 +39,14 @@ public class Video {
35 @ApiModelProperty(value = "视频封面") 39 @ApiModelProperty(value = "视频封面")
36 private String coverUrl ; 40 private String coverUrl ;
37 41
  42 + public List<String> getVideoUrlList() {
  43 + return videoUrlList;
  44 + }
  45 +
  46 + public void setVideoUrlList(List<String> videoUrlList) {
  47 + this.videoUrlList = videoUrlList;
  48 + }
  49 +
38 public String getCoverUrl() { 50 public String getCoverUrl() {
39 return coverUrl; 51 return coverUrl;
40 } 52 }
src/main/java/com/sincere/student/service/ArticleService.java
@@ -11,6 +11,8 @@ public interface ArticleService { @@ -11,6 +11,8 @@ public interface ArticleService {
11 11
12 Page<Article> getList(ArticleSearchDto articleSearchDto); 12 Page<Article> getList(ArticleSearchDto articleSearchDto);
13 13
  14 + Page<Article> getAdminList(ArticleSearchDto articleSearchDto);
  15 +
14 List<Article> getRelationList(int universityId); 16 List<Article> getRelationList(int universityId);
15 17
16 Article selectById(int id); 18 Article selectById(int id);
src/main/java/com/sincere/student/service/MajorService.java
@@ -10,6 +10,8 @@ public interface MajorService { @@ -10,6 +10,8 @@ public interface MajorService {
10 10
11 Page<Major> getList(MajorSearchDto majorSearchDto); 11 Page<Major> getList(MajorSearchDto majorSearchDto);
12 12
  13 + Major getById(int id);
  14 +
13 int create(Major major); 15 int create(Major major);
14 16
15 int update(Major major); 17 int update(Major major);
src/main/java/com/sincere/student/service/impl/ArticleServiceImpl.java
@@ -37,7 +37,7 @@ public class ArticleServiceImpl implements ArticleService { @@ -37,7 +37,7 @@ public class ArticleServiceImpl implements ArticleService {
37 List<Article> addAdvertList = new ArrayList<>(); 37 List<Article> addAdvertList = new ArrayList<>();
38 for(int i = 0 ; i < list.size() ;i++){ 38 for(int i = 0 ; i < list.size() ;i++){
39 addAdvertList.add(list.get(i)); 39 addAdvertList.add(list.get(i));
40 - if(i % 5 ==4){ 40 + if(i % 6 ==5){
41 Article advert =articleMapper.getAdvert(); 41 Article advert =articleMapper.getAdvert();
42 String[] urlList = advert.getImageUrl().split(","); 42 String[] urlList = advert.getImageUrl().split(",");
43 advert.setImageUrlList(Arrays.asList(urlList)); 43 advert.setImageUrlList(Arrays.asList(urlList));
@@ -51,6 +51,24 @@ public class ArticleServiceImpl implements ArticleService { @@ -51,6 +51,24 @@ public class ArticleServiceImpl implements ArticleService {
51 } 51 }
52 52
53 @Override 53 @Override
  54 + public Page<Article> getAdminList(ArticleSearchDto articleSearchDto) {
  55 + Page<Article> result = new Page<>(articleSearchDto.getPage(),articleSearchDto.getPageSize());
  56 + if(StringUtils.isNotBlank(articleSearchDto.getTitle())){
  57 + articleSearchDto.setTitle("%"+articleSearchDto.getTitle()+"%");
  58 + }
  59 + PageHelper.startPage(articleSearchDto.getPage(),articleSearchDto.getPageSize());
  60 + List<Article> list = articleMapper.getList(articleSearchDto) ;
  61 + for(Article article : list){
  62 + String[] urlList = article.getImageUrl().split(",");
  63 + article.setImageUrlList(Arrays.asList(urlList));
  64 + article.setImageCount(urlList.length);
  65 + }
  66 + result.setList(list);
  67 + result.setCount(articleMapper.getListCount(articleSearchDto));
  68 + return result;
  69 + }
  70 +
  71 + @Override
54 public List<Article> getRelationList(int universityId) { 72 public List<Article> getRelationList(int universityId) {
55 return articleMapper.getRelationList(universityId); 73 return articleMapper.getRelationList(universityId);
56 } 74 }
src/main/java/com/sincere/student/service/impl/ConsultServiceImpl.java
@@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils; @@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
17 import org.springframework.beans.factory.annotation.Autowired; 17 import org.springframework.beans.factory.annotation.Autowired;
18 import org.springframework.stereotype.Service; 18 import org.springframework.stereotype.Service;
19 19
  20 +import java.util.Arrays;
20 import java.util.List; 21 import java.util.List;
21 22
22 @Service 23 @Service
@@ -77,6 +78,7 @@ public class ConsultServiceImpl implements ConsultService { @@ -77,6 +78,7 @@ public class ConsultServiceImpl implements ConsultService {
77 @Override 78 @Override
78 public Consult getDetail(int id) { 79 public Consult getDetail(int id) {
79 Consult consult = universityConsultMapper.selectByPrimaryKey(id); 80 Consult consult = universityConsultMapper.selectByPrimaryKey(id);
  81 + consult.setVideoUrlList(Arrays.asList(consult.getVideoUrl().split(",")));
80 consult.setList(universityConsultDetailMapper.selectByConsult(id)); 82 consult.setList(universityConsultDetailMapper.selectByConsult(id));
81 return consult ; 83 return consult ;
82 } 84 }
src/main/java/com/sincere/student/service/impl/MajorServiceImpl.java
@@ -36,6 +36,11 @@ public class MajorServiceImpl implements MajorService { @@ -36,6 +36,11 @@ public class MajorServiceImpl implements MajorService {
36 } 36 }
37 37
38 @Override 38 @Override
  39 + public Major getById(int id) {
  40 + return majorMapper.getById(id);
  41 + }
  42 +
  43 + @Override
39 public int create(Major major) { 44 public int create(Major major) {
40 if(major.getPid() == 0){ //说明是一级专业 45 if(major.getPid() == 0){ //说明是一级专业
41 major.setPid(-1); 46 major.setPid(-1);
src/main/java/com/sincere/student/service/impl/VideoServiceImpl.java
@@ -10,6 +10,7 @@ import org.apache.commons.lang3.StringUtils; @@ -10,6 +10,7 @@ import org.apache.commons.lang3.StringUtils;
10 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
12 12
  13 +import java.util.Arrays;
13 import java.util.List; 14 import java.util.List;
14 15
15 @Service 16 @Service
@@ -40,6 +41,10 @@ public class VideoServiceImpl implements VideoService { @@ -40,6 +41,10 @@ public class VideoServiceImpl implements VideoService {
40 41
41 PageHelper.startPage(dto.getPage(),dto.getPageSize()); 42 PageHelper.startPage(dto.getPage(),dto.getPageSize());
42 List<Video> list = videoMapper.getList(dto); 43 List<Video> list = videoMapper.getList(dto);
  44 + for(Video video : list){
  45 + String[] array = video.getVideoUrl().split(",");
  46 + video.setVideoUrlList(Arrays.asList(array));
  47 + }
43 page.setList(list); 48 page.setList(list);
44 page.setCount(videoMapper.getListCount(dto)); 49 page.setCount(videoMapper.getListCount(dto));
45 return page; 50 return page;
src/main/resources/mapper/MajorMapper.xml
@@ -10,6 +10,11 @@ @@ -10,6 +10,11 @@
10 <result column="create_time" property="createTime"/> 10 <result column="create_time" property="createTime"/>
11 </resultMap> 11 </resultMap>
12 12
  13 + <select id="getById" parameterType="java.lang.Integer" resultMap="MajorMap">
  14 + select * from university_major
  15 + where id =#{id}
  16 + </select>
  17 +
13 <select id="getList" parameterType="com.sincere.student.model.Major" resultMap="MajorMap"> 18 <select id="getList" parameterType="com.sincere.student.model.Major" resultMap="MajorMap">
14 select * from university_major 19 select * from university_major
15 <where> 20 <where>