Commit 2f3069beda46767b59d567ec02b6382e85eefb49
1 parent
4dbd6f38
Exists in
master
bug 修复
Showing
10 changed files
with
99 additions
and
18 deletions
Show diff stats
src/main/java/com/sincere/student/controller/AdminController.java
@@ -82,9 +82,35 @@ public class AdminController { | @@ -82,9 +82,35 @@ public class AdminController { | ||
82 | @MemberAccess | 82 | @MemberAccess |
83 | @ApiOperation("投档线更新接口 ,如果文件没更新,fileUrl不用传") | 83 | @ApiOperation("投档线更新接口 ,如果文件没更新,fileUrl不用传") |
84 | @RequestMapping(value = "/submit/update" , method = RequestMethod.POST) | 84 | @RequestMapping(value = "/submit/update" , method = RequestMethod.POST) |
85 | - public BaseDto deleteFile(@RequestBody SubmitFile submitFile){ | 85 | + public BaseDto updateFile(@RequestBody SubmitFile submitFile){ |
86 | BaseDto result = new BaseDto<>(); | 86 | BaseDto result = new BaseDto<>(); |
87 | - submitService.update(submitFile); | 87 | + try{ |
88 | + SubmitFile beforeFile = submitService.getById(submitFile.getId()); | ||
89 | + if(beforeFile.getFileUrl().equals(submitFile.getFileUrl())){ | ||
90 | + submitFile.setFileUrl(null); | ||
91 | + }else { | ||
92 | + List<Point> list = ExcelUtils.analysisExcel(submitFile.getFileUrl()); | ||
93 | + List<Point> points = new ArrayList<>(); | ||
94 | + for(Point point : list){ | ||
95 | + Integer universityId = universityService.selectByName(point.getUniversityName()); | ||
96 | + if(universityId == null){ | ||
97 | + throw new ResultException(902,point.getUniversityName()+"不存在"); | ||
98 | + } | ||
99 | + point.setUniversityId(universityId); | ||
100 | + Integer majorId = universityService.selectIdByMajor(point.getMajor(),universityId); | ||
101 | + if(majorId == null){ | ||
102 | + throw new ResultException(902,point.getUniversityName()+"-"+point.getMajor()+"关系不存在"); | ||
103 | + } | ||
104 | + point.setMajorId(majorId); | ||
105 | + points.add(point); | ||
106 | + } | ||
107 | + submitFile.setList(points); | ||
108 | + } | ||
109 | + submitService.update(submitFile); | ||
110 | + }catch (ResultException e){ | ||
111 | + result.setSuccess(false); | ||
112 | + result.setMessage(e.getMessage()); | ||
113 | + } | ||
88 | return result ; | 114 | return result ; |
89 | } | 115 | } |
90 | 116 | ||
@@ -381,6 +407,15 @@ public class AdminController { | @@ -381,6 +407,15 @@ public class AdminController { | ||
381 | } | 407 | } |
382 | 408 | ||
383 | @MemberAccess | 409 | @MemberAccess |
410 | + @ApiOperation("获取专业列表 一级二级关系列表") | ||
411 | + @RequestMapping(value = "/major/getList" , method = RequestMethod.POST) | ||
412 | + public BaseDto<List<Major>> majorGetList(){ | ||
413 | + BaseDto<List<Major>> result = new BaseDto<>(); | ||
414 | + result.setData(majorService.selectMajor()); | ||
415 | + return result ; | ||
416 | + } | ||
417 | + | ||
418 | + @MemberAccess | ||
384 | @ApiOperation("新增专业相关接口") | 419 | @ApiOperation("新增专业相关接口") |
385 | @RequestMapping(value = "/major/createMajor" , method = RequestMethod.POST) | 420 | @RequestMapping(value = "/major/createMajor" , method = RequestMethod.POST) |
386 | public BaseDto createMajor(@RequestBody Major major){ | 421 | public BaseDto createMajor(@RequestBody Major major){ |
src/main/java/com/sincere/student/mapper/MajorMapper.java
src/main/java/com/sincere/student/model/Video.java
@@ -26,12 +26,22 @@ public class Video { | @@ -26,12 +26,22 @@ public class Video { | ||
26 | private String code; | 26 | private String code; |
27 | @ApiModelProperty(value = "状态 0预览1发布") | 27 | @ApiModelProperty(value = "状态 0预览1发布") |
28 | private int status ; | 28 | private int status ; |
29 | - @ApiModelProperty(value = "图片地址") | 29 | + @ApiModelProperty(value = "图片地址 展示用 学校logo") |
30 | private String imgUrl ; | 30 | private String imgUrl ; |
31 | @ApiModelProperty(value = "视频时长") | 31 | @ApiModelProperty(value = "视频时长") |
32 | private String duration ; | 32 | private String duration ; |
33 | - @ApiModelProperty(value = "视频名称 展示用") | 33 | + @ApiModelProperty(value = "视频标题") |
34 | private String videoName ; | 34 | private String videoName ; |
35 | + @ApiModelProperty(value = "视频封面") | ||
36 | + private String coverUrl ; | ||
37 | + | ||
38 | + public String getCoverUrl() { | ||
39 | + return coverUrl; | ||
40 | + } | ||
41 | + | ||
42 | + public void setCoverUrl(String coverUrl) { | ||
43 | + this.coverUrl = coverUrl; | ||
44 | + } | ||
35 | 45 | ||
36 | public String getVideoName() { | 46 | public String getVideoName() { |
37 | return videoName; | 47 | return videoName; |
src/main/java/com/sincere/student/service/MajorService.java
@@ -4,6 +4,8 @@ import com.sincere.student.dto.MajorSearchDto; | @@ -4,6 +4,8 @@ import com.sincere.student.dto.MajorSearchDto; | ||
4 | import com.sincere.student.model.Major; | 4 | import com.sincere.student.model.Major; |
5 | import com.sincere.student.utils.Page; | 5 | import com.sincere.student.utils.Page; |
6 | 6 | ||
7 | +import java.util.List; | ||
8 | + | ||
7 | public interface MajorService { | 9 | public interface MajorService { |
8 | 10 | ||
9 | Page<Major> getList(MajorSearchDto majorSearchDto); | 11 | Page<Major> getList(MajorSearchDto majorSearchDto); |
@@ -13,4 +15,6 @@ public interface MajorService { | @@ -13,4 +15,6 @@ public interface MajorService { | ||
13 | int update(Major major); | 15 | int update(Major major); |
14 | 16 | ||
15 | int delete(int id); | 17 | int delete(int id); |
18 | + | ||
19 | + List<Major> selectMajor(); | ||
16 | } | 20 | } |
src/main/java/com/sincere/student/service/SubmitService.java
src/main/java/com/sincere/student/service/impl/MajorServiceImpl.java
@@ -52,4 +52,9 @@ public class MajorServiceImpl implements MajorService { | @@ -52,4 +52,9 @@ public class MajorServiceImpl implements MajorService { | ||
52 | public int delete(int id) { | 52 | public int delete(int id) { |
53 | return majorMapper.delete(id); | 53 | return majorMapper.delete(id); |
54 | } | 54 | } |
55 | + | ||
56 | + @Override | ||
57 | + public List<Major> selectMajor() { | ||
58 | + return majorMapper.selectMajor(); | ||
59 | + } | ||
55 | } | 60 | } |
src/main/java/com/sincere/student/service/impl/SubmitServiceImpl.java
@@ -83,24 +83,29 @@ public class SubmitServiceImpl implements SubmitService { | @@ -83,24 +83,29 @@ public class SubmitServiceImpl implements SubmitService { | ||
83 | } | 83 | } |
84 | 84 | ||
85 | @Override | 85 | @Override |
86 | - public int update(SubmitFile submitFile) { | ||
87 | - if(StringUtils.isNotBlank(submitFile.getFileUrl())){ | ||
88 | - int i = 0 ; | 86 | + public int update(SubmitFile submitFile){ |
87 | + if (StringUtils.isNotBlank(submitFile.getFileUrl())) { | ||
88 | + int i = 0; | ||
89 | pointMapper.deleteBySubmit(submitFile.getId()); | 89 | pointMapper.deleteBySubmit(submitFile.getId()); |
90 | List<Point> list = new ArrayList<>(); | 90 | List<Point> list = new ArrayList<>(); |
91 | - for(Point point :submitFile.getList()){ | 91 | + for (Point point : submitFile.getList()) { |
92 | point.setSubmitId(submitFile.getId()); | 92 | point.setSubmitId(submitFile.getId()); |
93 | - i++ ; | 93 | + i++; |
94 | list.add(point); | 94 | list.add(point); |
95 | - if(i % 100 == 0){ | 95 | + if (i % 100 == 0) { |
96 | pointMapper.insertBatch(list); | 96 | pointMapper.insertBatch(list); |
97 | list = new ArrayList<>(); | 97 | list = new ArrayList<>(); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | - if(list.size() > 0){ | 100 | + if (list.size() > 0) { |
101 | pointMapper.insertBatch(list); | 101 | pointMapper.insertBatch(list); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | return submitFileMapper.updateByPrimaryKeySelective(submitFile); | 104 | return submitFileMapper.updateByPrimaryKeySelective(submitFile); |
105 | } | 105 | } |
106 | + | ||
107 | + @Override | ||
108 | + public SubmitFile getById(int id) { | ||
109 | + return submitFileMapper.selectByPrimaryKey(id); | ||
110 | + } | ||
106 | } | 111 | } |
src/main/resources/mapper/MajorMapper.xml
@@ -55,4 +55,21 @@ | @@ -55,4 +55,21 @@ | ||
55 | </trim> | 55 | </trim> |
56 | where id = #{id} | 56 | where id = #{id} |
57 | </update> | 57 | </update> |
58 | + | ||
59 | + <resultMap id="MajorMap2" type="com.sincere.student.model.Major"> | ||
60 | + <result column="f_id" property="id"/> | ||
61 | + <result column="f_major" property="major"/> | ||
62 | + <collection property="children" ofType="com.sincere.student.model.Major"> | ||
63 | + <result column="s_id" property="id"/> | ||
64 | + <result column="s_major" property="major"/> | ||
65 | + </collection> | ||
66 | + </resultMap> | ||
67 | + | ||
68 | + <select id="selectMajor" resultMap="MajorMap2" > | ||
69 | + select f.id as f_id , f.major as f_major , s.id as s_id , s.major as s_major from | ||
70 | + university_major s | ||
71 | + join university_major f on f.id = s.p_id | ||
72 | + join university_relate_major r on s.id = r.major_id | ||
73 | + | ||
74 | + </select> | ||
58 | </mapper> | 75 | </mapper> |
src/main/resources/mapper/UniversitySubmitFileMapper.xml
@@ -106,12 +106,9 @@ | @@ -106,12 +106,9 @@ | ||
106 | order by sort | 106 | order by sort |
107 | </select> | 107 | </select> |
108 | 108 | ||
109 | - <sql id="Base_Column_List"> | ||
110 | - id, title, year, sort, create_time | ||
111 | - </sql> | 109 | + |
112 | <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | 110 | <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |
113 | - select | ||
114 | - <include refid="Base_Column_List" /> | 111 | + select * |
115 | from university_submit_file | 112 | from university_submit_file |
116 | where id = #{id,jdbcType=INTEGER} | 113 | where id = #{id,jdbcType=INTEGER} |
117 | </select> | 114 | </select> |
src/main/resources/mapper/VideoMapper.xml
@@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
14 | <result column="status" property="status" /> | 14 | <result column="status" property="status" /> |
15 | <result column="logo_url" property="imgUrl" /> | 15 | <result column="logo_url" property="imgUrl" /> |
16 | <result column="duration" property="duration" /> | 16 | <result column="duration" property="duration" /> |
17 | + <result column="cover_url" property="coverUrl" /> | ||
17 | </resultMap> | 18 | </resultMap> |
18 | 19 | ||
19 | <select id="getById" parameterType="java.lang.Integer" resultMap="VideoMap"> | 20 | <select id="getById" parameterType="java.lang.Integer" resultMap="VideoMap"> |
@@ -107,8 +108,8 @@ | @@ -107,8 +108,8 @@ | ||
107 | </select> | 108 | </select> |
108 | 109 | ||
109 | <insert id="create" parameterType="com.sincere.student.model.Video" > | 110 | <insert id="create" parameterType="com.sincere.student.model.Video" > |
110 | - insert into university_video (column_type,university_id,sort,video_url,create_time,status,duration) | ||
111 | - values (#{columnType},#{universityId},#{sort},#{videoUrl},GETDATE(),#{status},#{duration}) | 111 | + insert into university_video (column_type,university_id,sort,video_url,create_time,status,duration,cover_url,video_name) |
112 | + values (#{columnType},#{universityId},#{sort},#{videoUrl},GETDATE(),#{status},#{duration},#{coverUrl},#{videoName}) | ||
112 | </insert> | 113 | </insert> |
113 | 114 | ||
114 | <delete id="delete" parameterType="java.lang.Integer"> | 115 | <delete id="delete" parameterType="java.lang.Integer"> |
@@ -124,6 +125,9 @@ | @@ -124,6 +125,9 @@ | ||
124 | <if test="duration!=null and duration != ''"> | 125 | <if test="duration!=null and duration != ''"> |
125 | duration=#{duration}, | 126 | duration=#{duration}, |
126 | </if> | 127 | </if> |
128 | + <if test="coverUrl!=null and coverUrl != ''"> | ||
129 | + cover_url=#{coverUrl}, | ||
130 | + </if> | ||
127 | <if test="columnType!=0"> | 131 | <if test="columnType!=0"> |
128 | column_type=#{columnType}, | 132 | column_type=#{columnType}, |
129 | </if> | 133 | </if> |