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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
package com.yiboshi.science.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yiboshi.arch.exception.BusinessException;
import com.yiboshi.science.base.BaseServiceImpl;
import com.yiboshi.science.base.Pagination;
import com.yiboshi.science.config.security.SecurityUserHolder;
import com.yiboshi.science.dao.ComTalentApplyDAO;
import com.yiboshi.science.entity.ComTalentApply;
import com.yiboshi.science.entity.SystemParameter;
import com.yiboshi.science.enumeration.CommonEnum;
import com.yiboshi.science.param.dto.*;
import com.yiboshi.science.param.query.ComTalentApplyQueryVO;
import com.yiboshi.science.service.*;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 人才申请表 Service 实现类
* @author xujun
* @version 2025-03-12
*/
@Service
@AllArgsConstructor
public class ComTalentApplyServiceImpl extends BaseServiceImpl<ComTalentApplyDAO, ComTalentApplyQueryVO, ComTalentApplyDTO, ComTalentApply> implements ComTalentApplyService {
@Autowired
private ComTalentApplyDAO comTalentApplyDAO;
@Autowired
private ComPersonService comPersonService;
@Autowired
private ComPersonResumeService comPersonResumeService;
@Autowired
private ComPersonScientificGainService comPersonScientificGainService;
@Autowired
private ComTalentMembersService comTalentMembersService;
@Autowired
private ComTalentBudgetService comTalentBudgetService;
@Autowired
private SystemParameterService systemParameterService;
@Autowired
private ComFileService comFileService;
@Autowired
private ComBatchService comBatchService;
@Override
protected void setCriteriaForQuery(ComTalentApplyQueryVO vo, QueryWrapper<ComTalentApplyQueryVO> criteria) {
if (Objects.nonNull(vo.getCertId())) {
criteria.like("b.cert_id", vo.getCertId());
}
if (Objects.nonNull(vo.getPersonName())) {
criteria.like("b.person_name", vo.getPersonName());
}
if (Objects.nonNull(vo.getSex())) {
criteria.eq("b.sex", vo.getSex());
}
if (Objects.nonNull(vo.getBirthday())) {
criteria.eq("b.birthday", vo.getBirthday());
}
if (Objects.nonNull(vo.getTalentState())) {
switch (vo.getTalentState()) {
case 1:
criteria.in("talent_state",
CommonEnum.projState.draft.getCode(),
CommonEnum.projState.waitSubmit.getCode());
break;
case 2:
criteria.eq("talent_state", CommonEnum.projState.returnModify.getCode());
break;
case 3:
criteria.in("talent_state",
CommonEnum.projState.toAudit.getCode(),
CommonEnum.projState.failed.getCode(),
CommonEnum.projState.pass.getCode(),
CommonEnum.projState.report.getCode(),
CommonEnum.projState.conclusion.getCode());
break;
case 4:
break;
case 5:
criteria.ge("talent_state", CommonEnum.projState.pass.getCode());
break;
case 6:
criteria.ge("talent_state", CommonEnum.projState.report.getCode());
break;
default:
criteria.eq("talent_state", vo.getTalentState());
break;
}
}
if (Objects.nonNull(vo.getAppUnitId())) {
criteria.eq("a.app_unit_id", vo.getAppUnitId());
}
if (Objects.nonNull(vo.getAppPersonId())) {
criteria.eq("a.app_person_id", vo.getAppPersonId());
}
}
@Override
public Pagination<ComTalentApplyDTO> getListByPage(ComTalentApplyQueryVO vo) {
QueryWrapper criteria = new QueryWrapper();
setCriteriaForQuery(vo, criteria);
Page<ComTalentApplyQueryVO> page = new Page<>(vo.getPageIndex(), vo.getPageSize());
List<ComTalentApplyDTO> dtoList = comTalentApplyDAO.getListByPage(page, criteria).getRecords();
return new Pagination<>(dtoList, page.getTotal(), vo.getPageSize());
}
public DataStatisticsDTO getCount(ComTalentApply e) {
QueryWrapper criteria = new QueryWrapper();
this.notNullField(e, criteria);
return comTalentApplyDAO.getCount(criteria);
}
public ComTalentApplyDTO getNewTalentApply() {
ComTalentApplyDTO dto = new ComTalentApplyDTO();
List<ComTalentBudgetDTO> bugetList = comTalentBudgetService.getList();
dto.setBudgetList(bugetList);
dto.setApplyFund(new BigDecimal(0.00));
dto.setOtherFund(new BigDecimal(0.00));
dto.setTotalFund(new BigDecimal(0.00));
dto.setReportYear(comBatchService.getReportYear(null, CommonEnum.timeType.talentApply.getCode()));
dto.setCompleteStatus("0,0,0,0,0,0");
dto.setTalentState(CommonEnum.projState.draft.getCode());
dto.setAppPersonId(SecurityUserHolder.getPersonId());
dto.setAppUnitId(SecurityUserHolder.getUnitId());
return dto;
}
public ComTalentApplyDTO getTalentApplyById(String id) {
ComTalentApplyDTO dto = comTalentApplyDAO.getById(id);
if (null == dto)
throw new BusinessException("人才申报记录不存在或已删除!");
// 申报人
ComPersonDTO comPersonDTO = comPersonService.getPersonById(dto.getPersonId());
if (null != comPersonDTO) {
loadPersonInfo(dto, comPersonDTO);
}
List<ComTalentMembersDTO> memList = comTalentMembersService.getListByTalentId(dto.getId());
dto.setMembersList(memList);
List<ComTalentBudgetDTO> bugetList = comTalentBudgetService.getListByTalentId(dto.getId());
if (null != bugetList && bugetList.size() > 0)
dto.setBudgetList(bugetList);
else {
bugetList = comTalentBudgetService.getList();
dto.setBudgetList(bugetList);
}
List<ComPersonResumeDTO> resumeList = comPersonResumeService.getListByTalentId(dto.getId());
dto.setResumeList(resumeList);
List<ComPersonScientificGainDTO> scientificList = comPersonScientificGainService.getListByTalentId(dto.getId());
dto.setScientificList(scientificList);
if (Objects.isNull(dto.getApplyFund()))
dto.setApplyFund(new BigDecimal(0.00));
if (Objects.isNull(dto.getOtherFund()))
dto.setOtherFund(new BigDecimal(0.00));
if (Objects.isNull(dto.getTotalFund()))
dto.setTotalFund(new BigDecimal(0.00));
return dto;
}
private void loadPersonInfo(ComTalentApplyDTO dto, ComPersonDTO comPersonDTO) {
dto.setPersonName(comPersonDTO.getPersonName());
dto.setCertId(comPersonDTO.getCertId());
dto.setSex(comPersonDTO.getSex());
dto.setBirthday(comPersonDTO.getBirthday());
dto.setNation(comPersonDTO.getNation());
dto.setDegree(comPersonDTO.getDegree());
dto.setDegreeTime(comPersonDTO.getDegreeTime());
dto.setDegreeUnit(comPersonDTO.getDegreeUnit());
dto.setGraduateTeacher(comPersonDTO.getGraduateTeacher());
dto.setPoliticalParty(comPersonDTO.getPoliticalParty());
//dto.setNationName(comPersonDTO.getNationName());
//dto.setDegreeName(comPersonDTO.getDegreeName());
dto.setTitle(comPersonDTO.getTitle());
dto.setDuty(comPersonDTO.getDuty());
dto.setSpec(comPersonDTO.getSpec());
dto.setMobile(comPersonDTO.getMobile());
dto.setFax(comPersonDTO.getFax());
dto.setEmail(comPersonDTO.getEmail());
}
public String save(ComTalentApplyDTO dto) {
String id = "";
switch (dto.getStep()) {
case 0://申报人基本情况
id = talentSaveStep0(dto);
break;
case 1://申报人简历
id = talentSaveStep1(dto);
break;
case 2://申报人科研成绩
id = talentSaveStep2(dto);
break;
case 3://团队人员名单
id = talentSaveStep3(dto);
break;
case 4://经费预算及培养计划和目标
id = talentSaveStep4(dto);
break;
case 5://附件
id = talentSaveStep5(dto);
break;
}
return id;
}
private String talentSaveStep0(ComTalentApplyDTO dto) {
String id = "";
if (Objects.isNull(dto.getId()))
id = InsertTalentBaseInfo(dto);
else {
ComTalentApply apply = this.entityById(dto.getId());
if (null == apply) {
id = InsertTalentBaseInfo(dto);
} else
id = UpdateProjectBaseInfo(dto);
}
return id;
}
@Transactional
public String talentSaveStep1(ComTalentApplyDTO dto) {
ComTalentApply comTalentApply = convert2Entity(dto);
this.update(comTalentApply);
List<ComPersonResumeDTO> ResumeList = dto.getResumeList();
List<SystemParameter> ParameterList = systemParameterService.getListByType(18);
for (SystemParameter p : ParameterList) {
List<ComPersonResumeDTO> FindList = ResumeList.stream().filter(e -> p.getId().equals(e.getResumeType())).collect(Collectors.toList());
if (null != FindList && FindList.size() > 0) {
comPersonResumeService.insertList(FindList, dto.getId(), p.getId());
}
}
return dto.getId();
}
@Transactional
public String talentSaveStep2(ComTalentApplyDTO dto) {
ComTalentApply comTalentApply = convert2Entity(dto);
this.update(comTalentApply);
List<ComPersonScientificGainDTO> ScientificGainList = dto.getScientificList();
List<SystemParameter> ParameterList = systemParameterService.getListByType(19);
for (SystemParameter p : ParameterList) {
List<ComPersonScientificGainDTO> FindList = ScientificGainList.stream().filter(e -> p.getId().equals(e.getGainType())).collect(Collectors.toList());
if (null != FindList && FindList.size() > 0) {
comPersonScientificGainService.insertList(FindList, dto.getId(), p.getId());
}
}
return dto.getId();
}
@Transactional
public String talentSaveStep3(ComTalentApplyDTO dto) {
List<ComTalentMembersDTO> MemberList = dto.getMembersList();
comTalentMembersService.insertList(MemberList, dto.getId());
return dto.getId();
}
@Transactional
public String talentSaveStep4(ComTalentApplyDTO dto) {
ComTalentApply comTalentApply = convert2Entity(dto);
this.update(comTalentApply);
List<ComTalentBudgetDTO> BudgetList = dto.getBudgetList();
comTalentBudgetService.insertList(BudgetList, dto.getId());
return dto.getId();
}
@Transactional
public String talentSaveStep5(ComTalentApplyDTO dto) {
ComTalentApply comTalentApply = convert2Entity(dto);
this.update(comTalentApply);
// 附件
comFileService.insertList(dto.getFileList(), dto.getId(), CommonEnum.fileType.talentApply.getCode());
return dto.getId();
}
private String InsertTalentBaseInfo(ComTalentApplyDTO dto) {
String PersonID = comPersonService.insertOrUpdate(dto);
ComTalentApply apply = convert2Entity(dto);
apply.setPersonId(PersonID);
String id = this.insert(apply);
return id;
}
private String UpdateProjectBaseInfo(ComTalentApplyDTO dto) {
comPersonService.insertOrUpdate(dto);
ComTalentApply apply = convert2Entity(dto);
return this.update(apply);
}
}