b9411514
陈杰
first
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package com.sincere.student.service.impl;
import com.github.pagehelper.PageHelper;
import com.sincere.student.dto.MessageSearchDto;
import com.sincere.student.dto.PointSearchDto;
import com.sincere.student.dto.submit.SubmitLine;
import com.sincere.student.mapper.UniversityPointMapper;
import com.sincere.student.mapper.UniversitySubmitFileMapper;
import com.sincere.student.model.Point;
import com.sincere.student.model.SubmitFile;
import com.sincere.student.service.SubmitService;
import com.sincere.student.utils.Page;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class SubmitServiceImpl implements SubmitService {
@Autowired
|
123dbb81
徐泉
研学代码提交
|
24
|
UniversityPointMapper pointMapper ;
|
b9411514
陈杰
first
|
25
26
|
@Autowired
|
123dbb81
徐泉
研学代码提交
|
27
|
UniversitySubmitFileMapper submitFileMapper ;
|
b9411514
陈杰
first
|
28
29
30
|
@Override
public Page<SubmitFile> getAdminList(MessageSearchDto dto) {
|
123dbb81
徐泉
研学代码提交
|
31
32
33
34
35
|
Page<SubmitFile> result = new Page<>(dto.getPage(),dto.getPageSize());
PageHelper.startPage(dto.getPage(),dto.getPageSize());
List<SubmitFile> list = submitFileMapper.getList(dto) ;
for(SubmitFile submitFile : list){
String fileName = submitFile.getFileUrl().substring(submitFile.getFileUrl().lastIndexOf("/")+1);
|
05508d96
陈杰
bug 修复
|
36
37
38
|
submitFile.setFileName(fileName);
}
result.setList(list);
|
b9411514
陈杰
first
|
39
40
41
42
43
44
|
result.setCount(submitFileMapper.getListCount(dto));
return result;
}
@Override
public Page<SubmitLine> getAppList(PointSearchDto dto) {
|
123dbb81
徐泉
研学代码提交
|
45
46
47
|
Page<SubmitLine> result = new Page<>(dto.getPage(),dto.getPageSize());
if(StringUtils.isNotBlank(dto.getMajorName())){
dto.setMajorName("%"+dto.getMajorName()+"%");
|
b9411514
陈杰
first
|
48
|
}
|
123dbb81
徐泉
研学代码提交
|
49
50
|
if(StringUtils.isNotBlank(dto.getUniversityName())){
dto.setUniversityName("%"+dto.getUniversityName()+"%");
|
b9411514
陈杰
first
|
51
|
}
|
123dbb81
徐泉
研学代码提交
|
52
|
PageHelper.startPage(dto.getPage(),dto.getPageSize());
|
b9411514
陈杰
first
|
53
54
55
56
57
58
59
60
|
result.setList(submitFileMapper.getAppList(dto));
result.setCount(submitFileMapper.getAppListCount(dto));
return result;
}
@Override
public int create(SubmitFile submitFile) {
submitFileMapper.insert(submitFile);
|
123dbb81
徐泉
研学代码提交
|
61
|
int i = 0 ;
|
b9411514
陈杰
first
|
62
|
List<Point> list = new ArrayList<>();
|
123dbb81
徐泉
研学代码提交
|
63
|
for(Point point :submitFile.getList()){
|
b9411514
陈杰
first
|
64
|
point.setSubmitId(submitFile.getId());
|
123dbb81
徐泉
研学代码提交
|
65
|
i++ ;
|
b9411514
陈杰
first
|
66
|
list.add(point);
|
123dbb81
徐泉
研学代码提交
|
67
|
if(i % 100 == 0){
|
b9411514
陈杰
first
|
68
69
70
71
|
pointMapper.insertBatch(list);
list = new ArrayList<>();
}
}
|
123dbb81
徐泉
研学代码提交
|
72
|
if(list.size() > 0){
|
b9411514
陈杰
first
|
73
74
75
76
77
78
79
80
81
82
83
84
85
|
pointMapper.insertBatch(list);
}
return 1;
}
@Override
public int delete(int id) {
submitFileMapper.deleteByPrimaryKey(id);
pointMapper.deleteBySubmit(id);
return 1;
}
@Override
|
123dbb81
徐泉
研学代码提交
|
86
|
public int update(SubmitFile submitFile) {
|
2f3069be
陈杰
bug 修复
|
87
88
|
if(StringUtils.isNotBlank(submitFile.getFileUrl())){
int i = 0 ;
|
05508d96
陈杰
bug 修复
|
89
90
|
pointMapper.deleteBySubmit(submitFile.getId());
List<Point> list = new ArrayList<>();
|
2f3069be
陈杰
bug 修复
|
91
|
for(Point point :submitFile.getList()){
|
05508d96
陈杰
bug 修复
|
92
|
point.setSubmitId(submitFile.getId());
|
2f3069be
陈杰
bug 修复
|
93
|
i++ ;
|
05508d96
陈杰
bug 修复
|
94
|
list.add(point);
|
2f3069be
陈杰
bug 修复
|
95
|
if(i % 100 == 0){
|
05508d96
陈杰
bug 修复
|
96
97
98
99
|
pointMapper.insertBatch(list);
list = new ArrayList<>();
}
}
|
2f3069be
陈杰
bug 修复
|
100
|
if(list.size() > 0){
|
05508d96
陈杰
bug 修复
|
101
102
103
|
pointMapper.insertBatch(list);
}
}
|
4dbd6f38
陈杰
bug 修复
|
104
|
return submitFileMapper.updateByPrimaryKey(submitFile);
|
b9411514
陈杰
first
|
105
|
}
|
2f3069be
陈杰
bug 修复
|
106
|
}
|
b9411514
陈杰
first
|
|
|