Commit 05508d96c04979e0bea6c5008eaca30c5ae01948

Authored by 陈杰
1 parent b246a387
Exists in master

bug 修复

src/main/java/com/sincere/student/controller/AdminController.java
@@ -71,6 +71,24 @@ public class AdminController { @@ -71,6 +71,24 @@ public class AdminController {
71 } 71 }
72 72
73 @MemberAccess 73 @MemberAccess
  74 + @ApiOperation("投档线删除接口")
  75 + @RequestMapping(value = "/submit/delete" , method = RequestMethod.POST)
  76 + public BaseDto deleteFile(@RequestBody IdDto idDto){
  77 + BaseDto result = new BaseDto<>();
  78 + submitService.delete(idDto.getId());
  79 + return result ;
  80 + }
  81 +
  82 + @MemberAccess
  83 + @ApiOperation("投档线更新接口 ,如果文件没更新,fileUrl不用传")
  84 + @RequestMapping(value = "/submit/update" , method = RequestMethod.POST)
  85 + public BaseDto deleteFile(@RequestBody SubmitFile submitFile){
  86 + BaseDto result = new BaseDto<>();
  87 + submitService.update(submitFile);
  88 + return result ;
  89 + }
  90 +
  91 + @MemberAccess
74 @ApiOperation("投档线创建接口") 92 @ApiOperation("投档线创建接口")
75 @RequestMapping(value = "/submit/createFile" , method = RequestMethod.POST) 93 @RequestMapping(value = "/submit/createFile" , method = RequestMethod.POST)
76 public BaseDto createFile(@RequestBody SubmitFile submitFile){ 94 public BaseDto createFile(@RequestBody SubmitFile submitFile){
src/main/java/com/sincere/student/model/Major.java
@@ -3,6 +3,8 @@ package com.sincere.student.model; @@ -3,6 +3,8 @@ package com.sincere.student.model;
3 import io.swagger.annotations.ApiModel; 3 import io.swagger.annotations.ApiModel;
4 import io.swagger.annotations.ApiModelProperty; 4 import io.swagger.annotations.ApiModelProperty;
5 5
  6 +import java.util.Date;
  7 +
6 @ApiModel 8 @ApiModel
7 public class Major { 9 public class Major {
8 10
@@ -14,6 +16,16 @@ public class Major { @@ -14,6 +16,16 @@ public class Major {
14 private String majorCode ; 16 private String majorCode ;
15 @ApiModelProperty(value = "父级专业id") //-1 说明是一级专业 17 @ApiModelProperty(value = "父级专业id") //-1 说明是一级专业
16 private int pId ; 18 private int pId ;
  19 + @ApiModelProperty(value = "创建时间")
  20 + private Date createTime ;
  21 +
  22 + public Date getCreateTime() {
  23 + return createTime;
  24 + }
  25 +
  26 + public void setCreateTime(Date createTime) {
  27 + this.createTime = createTime;
  28 + }
17 29
18 public int getId() { 30 public int getId() {
19 return id; 31 return id;
src/main/java/com/sincere/student/model/SubmitFile.java
@@ -10,19 +10,29 @@ import java.util.List; @@ -10,19 +10,29 @@ import java.util.List;
10 public class SubmitFile { 10 public class SubmitFile {
11 @ApiModelProperty(value = "主键 , 新增接口不用传") 11 @ApiModelProperty(value = "主键 , 新增接口不用传")
12 private Integer id; 12 private Integer id;
13 - @ApiModelProperty(value = "必传 标题") 13 + @ApiModelProperty(value = " 标题")
14 private String title; 14 private String title;
15 - @ApiModelProperty(value = "必传 年") 15 + @ApiModelProperty(value = " 年")
16 private String year; 16 private String year;
17 - @ApiModelProperty(value = "必传 排序") 17 + @ApiModelProperty(value = " 排序")
18 private Integer sort; 18 private Integer sort;
19 - @ApiModelProperty(value = "必传 文件路径") 19 + @ApiModelProperty(value = " 文件路径")
20 private String fileUrl ; 20 private String fileUrl ;
  21 + @ApiModelProperty(value = " 文件名称 展示用")
  22 + private String fileName ;
21 @ApiModelProperty(value = "不用传") 23 @ApiModelProperty(value = "不用传")
22 private Date createTime; 24 private Date createTime;
23 @ApiModelProperty(value = "不用传") 25 @ApiModelProperty(value = "不用传")
24 private List<Point> list ; 26 private List<Point> list ;
25 27
  28 + public String getFileName() {
  29 + return fileName;
  30 + }
  31 +
  32 + public void setFileName(String fileName) {
  33 + this.fileName = fileName;
  34 + }
  35 +
26 public String getFileUrl() { 36 public String getFileUrl() {
27 return fileUrl; 37 return fileUrl;
28 } 38 }
src/main/java/com/sincere/student/model/Video.java
@@ -27,13 +27,23 @@ public class Video { @@ -27,13 +27,23 @@ public class Video {
27 @ApiModelProperty(value = "状态 0预览1发布") 27 @ApiModelProperty(value = "状态 0预览1发布")
28 private int status ; 28 private int status ;
29 @ApiModelProperty(value = "图片地址") 29 @ApiModelProperty(value = "图片地址")
30 - private int imgUrl ; 30 + private String imgUrl ;
  31 + @ApiModelProperty(value = "视频时长")
  32 + private String duration ;
31 33
32 - public int getImgUrl() { 34 + public String getDuration() {
  35 + return duration;
  36 + }
  37 +
  38 + public void setDuration(String duration) {
  39 + this.duration = duration;
  40 + }
  41 +
  42 + public String getImgUrl() {
33 return imgUrl; 43 return imgUrl;
34 } 44 }
35 45
36 - public void setImgUrl(int imgUrl) { 46 + public void setImgUrl(String imgUrl) {
37 this.imgUrl = imgUrl; 47 this.imgUrl = imgUrl;
38 } 48 }
39 49
src/main/java/com/sincere/student/service/impl/AdvertServiceImpl.java
@@ -5,8 +5,6 @@ import com.sincere.student.mapper.AdvertMapper; @@ -5,8 +5,6 @@ import com.sincere.student.mapper.AdvertMapper;
5 import com.sincere.student.model.Advert; 5 import com.sincere.student.model.Advert;
6 import com.sincere.student.service.AdvertService; 6 import com.sincere.student.service.AdvertService;
7 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
8 -import org.springframework.cache.annotation.CacheEvict;  
9 -import org.springframework.cache.annotation.Cacheable;  
10 import org.springframework.stereotype.Service; 8 import org.springframework.stereotype.Service;
11 9
12 import java.util.List; 10 import java.util.List;
src/main/java/com/sincere/student/service/impl/SubmitServiceImpl.java
@@ -30,7 +30,12 @@ public class SubmitServiceImpl implements SubmitService { @@ -30,7 +30,12 @@ public class SubmitServiceImpl implements SubmitService {
30 public Page<SubmitFile> getAdminList(MessageSearchDto dto) { 30 public Page<SubmitFile> getAdminList(MessageSearchDto dto) {
31 Page<SubmitFile> result = new Page<>(dto.getPage(),dto.getPageSize()); 31 Page<SubmitFile> result = new Page<>(dto.getPage(),dto.getPageSize());
32 PageHelper.startPage(dto.getPage(),dto.getPageSize()); 32 PageHelper.startPage(dto.getPage(),dto.getPageSize());
33 - result.setList(submitFileMapper.getList(dto)); 33 + List<SubmitFile> list = submitFileMapper.getList(dto) ;
  34 + for(SubmitFile submitFile : list){
  35 + String fileName = submitFile.getFileUrl().substring(submitFile.getFileUrl().lastIndexOf("/")+1);
  36 + submitFile.setFileName(fileName);
  37 + }
  38 + result.setList(list);
34 result.setCount(submitFileMapper.getListCount(dto)); 39 result.setCount(submitFileMapper.getListCount(dto));
35 return result; 40 return result;
36 } 41 }
@@ -79,6 +84,23 @@ public class SubmitServiceImpl implements SubmitService { @@ -79,6 +84,23 @@ public class SubmitServiceImpl implements SubmitService {
79 84
80 @Override 85 @Override
81 public int update(SubmitFile submitFile) { 86 public int update(SubmitFile submitFile) {
  87 + if(StringUtils.isNotBlank(submitFile.getFileUrl())){
  88 + int i = 0 ;
  89 + pointMapper.deleteBySubmit(submitFile.getId());
  90 + List<Point> list = new ArrayList<>();
  91 + for(Point point :submitFile.getList()){
  92 + point.setSubmitId(submitFile.getId());
  93 + i++ ;
  94 + list.add(point);
  95 + if(i % 100 == 0){
  96 + pointMapper.insertBatch(list);
  97 + list = new ArrayList<>();
  98 + }
  99 + }
  100 + if(list.size() > 0){
  101 + pointMapper.insertBatch(list);
  102 + }
  103 + }
82 return submitFileMapper.updateByPrimaryKey(submitFile); 104 return submitFileMapper.updateByPrimaryKey(submitFile);
83 } 105 }
84 } 106 }
src/main/resources/mapper/MajorMapper.xml
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 <result column="major" property="major"/> 7 <result column="major" property="major"/>
8 <result column="major_code" property="majorCode"/> 8 <result column="major_code" property="majorCode"/>
9 <result column="p_id" property="pId"/> 9 <result column="p_id" property="pId"/>
  10 + <result column="create_time" property="createTime"/>
10 </resultMap> 11 </resultMap>
11 12
12 <select id="getList" parameterType="com.sincere.student.model.Major" resultMap="MajorMap"> 13 <select id="getList" parameterType="com.sincere.student.model.Major" resultMap="MajorMap">
@@ -37,8 +38,8 @@ @@ -37,8 +38,8 @@
37 </select> 38 </select>
38 39
39 <insert id="create" parameterType="com.sincere.student.model.Major" > 40 <insert id="create" parameterType="com.sincere.student.model.Major" >
40 - insert into university_major (major,major_code,p_id)  
41 - values (#{major},#{majorCode},#{pId}) 41 + insert into university_major (major,major_code,p_id,create_time)
  42 + values (#{major},#{majorCode},#{pId},GETDATE())
42 </insert> 43 </insert>
43 44
44 <delete id="delete" parameterType="java.lang.Integer"> 45 <delete id="delete" parameterType="java.lang.Integer">
src/main/resources/mapper/UniversityConsultMapper.xml
@@ -120,7 +120,7 @@ @@ -120,7 +120,7 @@
120 create_time, sort) 120 create_time, sort)
121 values (#{universityId,jdbcType=INTEGER}, #{columnType,jdbcType=INTEGER}, 121 values (#{universityId,jdbcType=INTEGER}, #{columnType,jdbcType=INTEGER},
122 #{videoUrl,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}, 122 #{videoUrl,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR},
123 - #{createTime,jdbcType=TIMESTAMP}, #{sort,jdbcType=INTEGER}) 123 + GETDATE(), #{sort,jdbcType=INTEGER})
124 </insert> 124 </insert>
125 125
126 <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.UniversityConsult"> 126 <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.UniversityConsult">
src/main/resources/mapper/UniversityMessageMapper.xml
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 </resultMap> 10 </resultMap>
11 11
12 <select id="getListCount" parameterType="com.sincere.student.dto.MessageSearchDto" resultType="java.lang.Integer"> 12 <select id="getListCount" parameterType="com.sincere.student.dto.MessageSearchDto" resultType="java.lang.Integer">
13 - select * from university_message 13 + select count(0) from university_message
14 <where> 14 <where>
15 <if test="search != null and search != ''"> 15 <if test="search != null and search != ''">
16 and title like #{search} 16 and title like #{search}
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 insert into university_message (title, context, 41 insert into university_message (title, context,
42 phone, create_time) 42 phone, create_time)
43 values (#{title,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR}, 43 values (#{title,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR},
44 - #{phone,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}) 44 + #{phone,jdbcType=VARCHAR}, GETDATE())
45 </insert> 45 </insert>
46 <insert id="insertSelective" parameterType="com.sincere.student.model.Message"> 46 <insert id="insertSelective" parameterType="com.sincere.student.model.Message">
47 insert into university_message 47 insert into university_message
src/main/resources/mapper/UniversityReplyMapper.xml
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 insert into university_reply (message_id, context, 29 insert into university_reply (message_id, context,
30 create_time) 30 create_time)
31 values (#{messageId,jdbcType=INTEGER}, #{context,jdbcType=VARCHAR}, 31 values (#{messageId,jdbcType=INTEGER}, #{context,jdbcType=VARCHAR},
32 - #{createTime,jdbcType=TIMESTAMP}) 32 + GETDATE())
33 </insert> 33 </insert>
34 <insert id="insertSelective" parameterType="com.sincere.student.model.Reply"> 34 <insert id="insertSelective" parameterType="com.sincere.student.model.Reply">
35 insert into university_reply 35 insert into university_reply
src/main/resources/mapper/UniversitySubmitFileMapper.xml
@@ -81,6 +81,7 @@ @@ -81,6 +81,7 @@
81 <resultMap id="BaseResultMap" type="com.sincere.student.model.SubmitFile"> 81 <resultMap id="BaseResultMap" type="com.sincere.student.model.SubmitFile">
82 <id column="id" jdbcType="INTEGER" property="id" /> 82 <id column="id" jdbcType="INTEGER" property="id" />
83 <result column="title" jdbcType="VARCHAR" property="title" /> 83 <result column="title" jdbcType="VARCHAR" property="title" />
  84 + <result column="file_url" jdbcType="VARCHAR" property="fileUrl" />
84 <result column="year" jdbcType="VARCHAR" property="year" /> 85 <result column="year" jdbcType="VARCHAR" property="year" />
85 <result column="sort" jdbcType="INTEGER" property="sort" /> 86 <result column="sort" jdbcType="INTEGER" property="sort" />
86 <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> 87 <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
@@ -120,9 +121,9 @@ @@ -120,9 +121,9 @@
120 </delete> 121 </delete>
121 <insert id="insert" parameterType="com.sincere.student.model.SubmitFile" useGeneratedKeys="true" keyProperty="id"> 122 <insert id="insert" parameterType="com.sincere.student.model.SubmitFile" useGeneratedKeys="true" keyProperty="id">
122 insert into university_submit_file (title, year, 123 insert into university_submit_file (title, year,
123 - sort, create_time) 124 + sort, create_time,file_url)
124 values (#{title,jdbcType=VARCHAR}, #{year,jdbcType=VARCHAR}, 125 values (#{title,jdbcType=VARCHAR}, #{year,jdbcType=VARCHAR},
125 - #{sort,jdbcType=INTEGER}, GETDATE()) 126 + #{sort,jdbcType=INTEGER}, GETDATE(),#{fileUrl})
126 </insert> 127 </insert>
127 <insert id="insertSelective" parameterType="com.sincere.student.model.SubmitFile"> 128 <insert id="insertSelective" parameterType="com.sincere.student.model.SubmitFile">
128 insert into university_submit_file 129 insert into university_submit_file
src/main/resources/mapper/VideoMapper.xml
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 <result column="code" property="code"/> 13 <result column="code" property="code"/>
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 </resultMap> 17 </resultMap>
17 18
18 <select id="getById" parameterType="java.lang.Integer" resultMap="VideoMap"> 19 <select id="getById" parameterType="java.lang.Integer" resultMap="VideoMap">
@@ -106,8 +107,8 @@ @@ -106,8 +107,8 @@
106 </select> 107 </select>
107 108
108 <insert id="create" parameterType="com.sincere.student.model.Video" > 109 <insert id="create" parameterType="com.sincere.student.model.Video" >
109 - insert into university_video (column_type,university_id,sort,video_url,create_time,status)  
110 - values (#{columnType},#{universityId},#{sort},#{videoUrl},GETDATE(),#{status}) 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> 112 </insert>
112 113
113 <delete id="delete" parameterType="java.lang.Integer"> 114 <delete id="delete" parameterType="java.lang.Integer">
@@ -117,13 +118,16 @@ @@ -117,13 +118,16 @@
117 <update id="update" parameterType="com.sincere.student.model.Video"> 118 <update id="update" parameterType="com.sincere.student.model.Video">
118 update university_video 119 update university_video
119 <trim prefix="set" suffixOverrides=","> 120 <trim prefix="set" suffixOverrides=",">
120 - <if test="videoUrl!=null"> 121 + <if test="videoUrl!=null and videoUrl != ''">
121 video_url=#{videoUrl}, 122 video_url=#{videoUrl},
122 </if> 123 </if>
  124 + <if test="duration!=null and duration != ''">
  125 + duration=#{duration},
  126 + </if>
123 <if test="columnType!=0"> 127 <if test="columnType!=0">
124 column_type=#{columnType}, 128 column_type=#{columnType},
125 </if> 129 </if>
126 - <if test="universityName!=null"> 130 + <if test="universityName!=null and universityName != ''">
127 university_name=#{universityName}, 131 university_name=#{universityName},
128 </if> 132 </if>
129 <if test="universityId!=0"> 133 <if test="universityId!=0">