DrawLotsGroupJudgesServiceImpl.java
7.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.dto.group.JudgeScoreScreenDTO;
import com.subsidy.dto.group.MatchJudgesDTO;
import com.subsidy.dto.judge.AddJudgeDTO;
import com.subsidy.mapper.DrawLotGroupDictMapper;
import com.subsidy.mapper.DrawLotsGroupItemsMapper;
import com.subsidy.mapper.ProjectMapper;
import com.subsidy.model.DrawLotGroupDictDO;
import com.subsidy.model.DrawLotsGroupItemsDO;
import com.subsidy.model.DrawLotsGroupJudgesDO;
import com.subsidy.mapper.DrawLotsGroupJudgesMapper;
import com.subsidy.model.DrawLotsScenesDO;
import com.subsidy.service.DrawLotsGroupJudgesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.vo.group.JudgeScoreScreenVO;
import com.subsidy.vo.group.MatchJudgesVO;
import com.subsidy.vo.group.ScoreScreenVO;
import com.subsidy.vo.group.SelectJudgesVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 赛组评委表 服务实现类
* </p>
*
* @author Tuyp
* @since 2025-12-10
*/
@Service
public class DrawLotsGroupJudgesServiceImpl extends ServiceImpl<DrawLotsGroupJudgesMapper, DrawLotsGroupJudgesDO> implements DrawLotsGroupJudgesService {
@Autowired
private DrawLotGroupDictMapper drawLotGroupDictMapper;
@Autowired
private DrawLotsGroupItemsMapper drawLotsGroupItemsMapper;
@Autowired
private DrawLotsGroupJudgesMapper drawLotsGroupJudgesMapper;
@Autowired
private ProjectMapper projectMapper;
@Override
public IPage<MatchJudgesVO> matchJudges(MatchJudgesDTO matchJudgesDTO) {
Page page = new Page(matchJudgesDTO.getPageNum(), matchJudgesDTO.getPageSize());
IPage<MatchJudgesVO> matchJudgesVOIPage = this.baseMapper.matchJudges(page, matchJudgesDTO.getSceneId(), matchJudgesDTO.getUserName(), matchJudgesDTO.getExpectorType(), matchJudgesDTO.getRoleType());
List<MatchJudgesVO> matchJudgesVOS = matchJudgesVOIPage.getRecords();
for (MatchJudgesVO matchJudgesVO : matchJudgesVOS){
List<DrawLotGroupDictDO> drawLotGroupDictDOS = drawLotsGroupJudgesMapper.judgeGroups(matchJudgesVO.getId(),matchJudgesDTO.getSceneId());
matchJudgesVO.setGroupDictDOS(drawLotGroupDictDOS);
}
return matchJudgesVOIPage;
}
@Override
public IPage<SelectJudgesVO> selectJudges(MatchJudgesDTO matchJudgesDTO) {
Page page = new Page(matchJudgesDTO.getPageNum(), matchJudgesDTO.getPageSize());
return this.baseMapper.selectJudges(page, matchJudgesDTO.getSceneId(), matchJudgesDTO.getUserName());
}
@Override
public String removeJudge(DrawLotsGroupJudgesDO drawLotsGroupJudgesDO) {
this.baseMapper.deleteById(drawLotsGroupJudgesDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
@Override
public String updateJudge(AddJudgeDTO addJudgeDTO) {
//将之前的清掉
this.baseMapper.delete(new QueryWrapper<DrawLotsGroupJudgesDO>()
.lambda()
.eq(DrawLotsGroupJudgesDO::getJudgeId,addJudgeDTO.getId()));
List<Long> groupIds = addJudgeDTO.getGroupIds();
for (Long id : groupIds){
DrawLotsGroupJudgesDO drawLotsGroupJudgesDO = new DrawLotsGroupJudgesDO();
drawLotsGroupJudgesDO.setJudgeId(addJudgeDTO.getId());
drawLotsGroupJudgesDO.setGroupId(id);
drawLotsGroupJudgesDO.setSceneId(addJudgeDTO.getSceneId());
this.baseMapper.insert(drawLotsGroupJudgesDO);
}
return ConstantUtils.SUCCESS_UPDATE;
}
@Override
public String addJudge(AddJudgeDTO addJudgeDTO) {
List<Long> judgeIds = addJudgeDTO.getJudgeIds();
for (Long judgeId : judgeIds) {
DrawLotsGroupJudgesDO drawLotsGroupJudgesDO = new DrawLotsGroupJudgesDO();
drawLotsGroupJudgesDO.setJudgeId(judgeId);
drawLotsGroupJudgesDO.setSceneId(addJudgeDTO.getSceneId());
this.baseMapper.insert(drawLotsGroupJudgesDO);
}
return ConstantUtils.ADD_SUCCESS;
}
@Override
public String assignJudge(AddJudgeDTO addJudgeDTO) {
List<Long> judgeIds = addJudgeDTO.getIds();
List<Long> groupIds = addJudgeDTO.getGroupIds();
for (Long id : judgeIds) {
//将之前的清掉
this.baseMapper.delete(new QueryWrapper<DrawLotsGroupJudgesDO>()
.lambda()
.eq(DrawLotsGroupJudgesDO::getJudgeId,id));
for (Long groupId : groupIds){
DrawLotsGroupJudgesDO drawLotsGroupJudgesDO = new DrawLotsGroupJudgesDO();
drawLotsGroupJudgesDO.setJudgeId(id);
drawLotsGroupJudgesDO.setGroupId(groupId);
drawLotsGroupJudgesDO.setSceneId(addJudgeDTO.getSceneId());
this.baseMapper.insert(drawLotsGroupJudgesDO);
}
}
return ConstantUtils.SUCCESS_UPDATE;
}
@Override
public List<JudgeScoreScreenVO> judgeScoreScreen(JudgeScoreScreenDTO judgeScoreScreenDTO) {
List<JudgeScoreScreenVO> result = new ArrayList<>();
//项目编号
List<Integer> integers = judgeScoreScreenDTO.getGroupNums();
DrawLotGroupDictDO drawLotGroupDictDO = drawLotGroupDictMapper.selectById(judgeScoreScreenDTO.getGroupId());
for (Integer integer : integers) {
JudgeScoreScreenVO judgeScoreScreenVO = new JudgeScoreScreenVO();
String userName = projectMapper.projectUserName(Long.valueOf(integer));
judgeScoreScreenVO.setUserName(userName);
judgeScoreScreenVO.setGroupName(drawLotGroupDictDO.getGroupName());
judgeScoreScreenVO.setGroupNum(integer);
List<ScoreScreenVO> scoreScreenVOS = this.baseMapper.judgeScoreScreen(judgeScoreScreenDTO.getGroupId(), integer);
judgeScoreScreenVO.setScoreScreenVOS(scoreScreenVOS);
DrawLotsGroupItemsDO drawLotsGroupItemsDO = drawLotsGroupItemsMapper.selectOne(new QueryWrapper<DrawLotsGroupItemsDO>()
.lambda()
.eq(DrawLotsGroupItemsDO::getGroupId, judgeScoreScreenDTO.getGroupId())
.eq(DrawLotsGroupItemsDO::getProjectId, integer));
judgeScoreScreenVO.setTotalScore(drawLotsGroupItemsDO.getTotalScore());
result.add(judgeScoreScreenVO);
}
return result;
}
@Override
public List<DrawLotsScenesDO> judgeScenes(DrawLotsGroupJudgesDO drawLotsGroupJudgesDO) {
return this.baseMapper.judgeScenes(drawLotsGroupJudgesDO.getJudgeId());
}
@Override
public List<DrawLotGroupDictDO> judgeGroups(DrawLotsGroupJudgesDO drawLotsGroupJudgesDO) {
return this.baseMapper.judgeGroups(drawLotsGroupJudgesDO.getJudgeId(),drawLotsGroupJudgesDO.getSceneId());
}
}