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 71 }
72 72  
73 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 92 @ApiOperation("投档线创建接口")
75 93 @RequestMapping(value = "/submit/createFile" , method = RequestMethod.POST)
76 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 3 import io.swagger.annotations.ApiModel;
4 4 import io.swagger.annotations.ApiModelProperty;
5 5  
  6 +import java.util.Date;
  7 +
6 8 @ApiModel
7 9 public class Major {
8 10  
... ... @@ -14,6 +16,16 @@ public class Major {
14 16 private String majorCode ;
15 17 @ApiModelProperty(value = "父级专业id") //-1 说明是一级专业
16 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 30 public int getId() {
19 31 return id;
... ...
src/main/java/com/sincere/student/model/SubmitFile.java
... ... @@ -10,19 +10,29 @@ import java.util.List;
10 10 public class SubmitFile {
11 11 @ApiModelProperty(value = "主键 , 新增接口不用传")
12 12 private Integer id;
13   - @ApiModelProperty(value = "必传 标题")
  13 + @ApiModelProperty(value = " 标题")
14 14 private String title;
15   - @ApiModelProperty(value = "必传 年")
  15 + @ApiModelProperty(value = " 年")
16 16 private String year;
17   - @ApiModelProperty(value = "必传 排序")
  17 + @ApiModelProperty(value = " 排序")
18 18 private Integer sort;
19   - @ApiModelProperty(value = "必传 文件路径")
  19 + @ApiModelProperty(value = " 文件路径")
20 20 private String fileUrl ;
  21 + @ApiModelProperty(value = " 文件名称 展示用")
  22 + private String fileName ;
21 23 @ApiModelProperty(value = "不用传")
22 24 private Date createTime;
23 25 @ApiModelProperty(value = "不用传")
24 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 36 public String getFileUrl() {
27 37 return fileUrl;
28 38 }
... ...
src/main/java/com/sincere/student/model/Video.java
... ... @@ -27,13 +27,23 @@ public class Video {
27 27 @ApiModelProperty(value = "状态 0预览1发布")
28 28 private int status ;
29 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 43 return imgUrl;
34 44 }
35 45  
36   - public void setImgUrl(int imgUrl) {
  46 + public void setImgUrl(String imgUrl) {
37 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 5 import com.sincere.student.model.Advert;
6 6 import com.sincere.student.service.AdvertService;
7 7 import org.springframework.beans.factory.annotation.Autowired;
8   -import org.springframework.cache.annotation.CacheEvict;
9   -import org.springframework.cache.annotation.Cacheable;
10 8 import org.springframework.stereotype.Service;
11 9  
12 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 30 public Page<SubmitFile> getAdminList(MessageSearchDto dto) {
31 31 Page<SubmitFile> result = new Page<>(dto.getPage(),dto.getPageSize());
32 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 39 result.setCount(submitFileMapper.getListCount(dto));
35 40 return result;
36 41 }
... ... @@ -79,6 +84,23 @@ public class SubmitServiceImpl implements SubmitService {
79 84  
80 85 @Override
81 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 104 return submitFileMapper.updateByPrimaryKey(submitFile);
83 105 }
84 106 }
... ...
src/main/resources/mapper/MajorMapper.xml
... ... @@ -7,6 +7,7 @@
7 7 <result column="major" property="major"/>
8 8 <result column="major_code" property="majorCode"/>
9 9 <result column="p_id" property="pId"/>
  10 + <result column="create_time" property="createTime"/>
10 11 </resultMap>
11 12  
12 13 <select id="getList" parameterType="com.sincere.student.model.Major" resultMap="MajorMap">
... ... @@ -37,8 +38,8 @@
37 38 </select>
38 39  
39 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 43 </insert>
43 44  
44 45 <delete id="delete" parameterType="java.lang.Integer">
... ...
src/main/resources/mapper/UniversityConsultMapper.xml
... ... @@ -120,7 +120,7 @@
120 120 create_time, sort)
121 121 values (#{universityId,jdbcType=INTEGER}, #{columnType,jdbcType=INTEGER},
122 122 #{videoUrl,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR},
123   - #{createTime,jdbcType=TIMESTAMP}, #{sort,jdbcType=INTEGER})
  123 + GETDATE(), #{sort,jdbcType=INTEGER})
124 124 </insert>
125 125  
126 126 <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.UniversityConsult">
... ...
src/main/resources/mapper/UniversityMessageMapper.xml
... ... @@ -10,7 +10,7 @@
10 10 </resultMap>
11 11  
12 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 14 <where>
15 15 <if test="search != null and search != ''">
16 16 and title like #{search}
... ... @@ -41,7 +41,7 @@
41 41 insert into university_message (title, context,
42 42 phone, create_time)
43 43 values (#{title,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR},
44   - #{phone,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
  44 + #{phone,jdbcType=VARCHAR}, GETDATE())
45 45 </insert>
46 46 <insert id="insertSelective" parameterType="com.sincere.student.model.Message">
47 47 insert into university_message
... ...
src/main/resources/mapper/UniversityReplyMapper.xml
... ... @@ -29,7 +29,7 @@
29 29 insert into university_reply (message_id, context,
30 30 create_time)
31 31 values (#{messageId,jdbcType=INTEGER}, #{context,jdbcType=VARCHAR},
32   - #{createTime,jdbcType=TIMESTAMP})
  32 + GETDATE())
33 33 </insert>
34 34 <insert id="insertSelective" parameterType="com.sincere.student.model.Reply">
35 35 insert into university_reply
... ...
src/main/resources/mapper/UniversitySubmitFileMapper.xml
... ... @@ -81,6 +81,7 @@
81 81 <resultMap id="BaseResultMap" type="com.sincere.student.model.SubmitFile">
82 82 <id column="id" jdbcType="INTEGER" property="id" />
83 83 <result column="title" jdbcType="VARCHAR" property="title" />
  84 + <result column="file_url" jdbcType="VARCHAR" property="fileUrl" />
84 85 <result column="year" jdbcType="VARCHAR" property="year" />
85 86 <result column="sort" jdbcType="INTEGER" property="sort" />
86 87 <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
... ... @@ -120,9 +121,9 @@
120 121 </delete>
121 122 <insert id="insert" parameterType="com.sincere.student.model.SubmitFile" useGeneratedKeys="true" keyProperty="id">
122 123 insert into university_submit_file (title, year,
123   - sort, create_time)
  124 + sort, create_time,file_url)
124 125 values (#{title,jdbcType=VARCHAR}, #{year,jdbcType=VARCHAR},
125   - #{sort,jdbcType=INTEGER}, GETDATE())
  126 + #{sort,jdbcType=INTEGER}, GETDATE(),#{fileUrl})
126 127 </insert>
127 128 <insert id="insertSelective" parameterType="com.sincere.student.model.SubmitFile">
128 129 insert into university_submit_file
... ...
src/main/resources/mapper/VideoMapper.xml
... ... @@ -13,6 +13,7 @@
13 13 <result column="code" property="code"/>
14 14 <result column="status" property="status" />
15 15 <result column="logo_url" property="imgUrl" />
  16 + <result column="duration" property="duration" />
16 17 </resultMap>
17 18  
18 19 <select id="getById" parameterType="java.lang.Integer" resultMap="VideoMap">
... ... @@ -106,8 +107,8 @@
106 107 </select>
107 108  
108 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 112 </insert>
112 113  
113 114 <delete id="delete" parameterType="java.lang.Integer">
... ... @@ -117,13 +118,16 @@
117 118 <update id="update" parameterType="com.sincere.student.model.Video">
118 119 update university_video
119 120 <trim prefix="set" suffixOverrides=",">
120   - <if test="videoUrl!=null">
  121 + <if test="videoUrl!=null and videoUrl != ''">
121 122 video_url=#{videoUrl},
122 123 </if>
  124 + <if test="duration!=null and duration != ''">
  125 + duration=#{duration},
  126 + </if>
123 127 <if test="columnType!=0">
124 128 column_type=#{columnType},
125 129 </if>
126   - <if test="universityName!=null">
  130 + <if test="universityName!=null and universityName != ''">
127 131 university_name=#{universityName},
128 132 </if>
129 133 <if test="universityId!=0">
... ...