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
package com.yiboshi.science.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yiboshi.science.base.BaseServiceImpl;
import com.yiboshi.science.dao.ComExpertSpecDAO;
import com.yiboshi.science.entity.ComExpertSpec;
import com.yiboshi.science.entity.ComFile;
import com.yiboshi.science.entity.SystemMenu;
import com.yiboshi.science.entity.SelectListItem;
import com.yiboshi.science.param.dto.ComExpertDTO;
import com.yiboshi.science.param.dto.ComExpertSpecDTO;
import com.yiboshi.science.param.query.ComExpertSpecQueryVO;
import com.yiboshi.science.service.ComExpertSpecService;
import com.yiboshi.science.utils.AgeUtil;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import static java.util.Objects.isNull;
@Service
@AllArgsConstructor
public class ComExpertSpecServiceImpl extends BaseServiceImpl<ComExpertSpecDAO, ComExpertSpecQueryVO, ComExpertSpecDTO, ComExpertSpec> implements ComExpertSpecService {
@Autowired
private ComExpertSpecDAO comExpertSpecDAO;
@Override
protected void setCriteriaForQuery(ComExpertSpecQueryVO vo, QueryWrapper<ComExpertSpecQueryVO> criteria) {
if (Objects.nonNull(vo.getExpertId())) {
criteria.eq("expert_id", vo.getExpertId());
}
if (Objects.nonNull(vo.getSpecId())) {
criteria.eq("spec_id", vo.getExpertId());
}
}
public void insertSpecList(List<ComExpertSpecDTO> list, String expertId) {
if (list != null && list.size() > 0) {
ComExpertSpec comExpertSpec = new ComExpertSpec();
comExpertSpec.setExpertId(expertId);
this.delete(comExpertSpec);
for (int i = 0; i < list.size(); i++) {
if (!isObjectNull(list.get(i))) {
ComExpertSpec expertSpec = new ComExpertSpec();
expertSpec.setExpertId(expertId);
expertSpec.setSpecId(list.get(i).getSpecId());
list.get(i).setShowIndex(i + 1);
this.insert(expertSpec);
}
}
}
}
public List<String> getIdListByExpertId(String expertId) {
return comExpertSpecDAO.getIdListByExpertId(expertId);
}
public List<ComExpertSpecDTO> getListByExpertId(String expertId) {
return comExpertSpecDAO.getListByExpertId(expertId);
}
public Integer getExpertTypeByExpertId(String expertId) {
List<ComExpertSpecDTO> SpecList = this.getListByExpertId(expertId);
List<ComExpertSpecDTO> FindList = SpecList.stream().filter(e -> e.getSpecId().toLowerCase().equals("a70f06d1-b6aa-11ef-b6cb-0c42a1381189")).collect(Collectors.toList());
//1技术专家、2财务专家
if (null != FindList && FindList.size() > 0)
return 2;
else
return 1;
}
public List<SelectListItem> getExpertListBySpecId(Map<String, Object> specId) {
List<String> idList = null;
if (specId.containsKey("specId")) {
idList = (List<String>) specId.get("specId");
}
QueryWrapper<SystemMenu> wrapper = new QueryWrapper<SystemMenu>();
if (Objects.nonNull(idList) && idList.size() > 0) {
List<String> item = idList.stream().filter(f -> !f.equals("")).collect(Collectors.toList());
if (Objects.nonNull(item) && item.size() > 0)
wrapper.in("a.spec_id", item).or().in("d.parent_id", item);
// wrapper.or(qw -> qw.in("a.spec_id", finalIdList).in("d.parent_id", finalIdList));
}
List<ComExpertDTO> list = comExpertSpecDAO.getExpertListBySpecId(wrapper);
List<SelectListItem> allItem = new ArrayList<>();
if (null != list && list.size() > 0) {
list.forEach((e) -> {
String description = e.getSex() + "/" + AgeUtil.getResidentAge(e.getBirthday()) + "岁/" + e.getWorkUnit();
SelectListItem treeListItem = new SelectListItem(e.getPersonName(), e.getId(), description, false, false, new ArrayList<>());
allItem.add(treeListItem);
});
}
return allItem;
}
public List<SelectListItem> getExpertListBySpecIdProjId(List<String> SpecList, List<String> ProjList) {
List<ComExpertDTO> list = comExpertSpecDAO.getExpertListBySpecIdProjId(SpecList, ProjList);
List<SelectListItem> allItem = new ArrayList<>();
if (null != list && list.size() > 0) {
list.forEach((e) -> {
String description = e.getSex() + "/" + AgeUtil.getResidentAge(e.getBirthday()) + "岁/" + e.getWorkUnit();
SelectListItem treeListItem = new SelectListItem(e.getPersonName(), e.getId(), description, false, false, new ArrayList<>());
allItem.add(treeListItem);
});
}
return allItem;
}
public List<SelectListItem> getExpertListByExpertSpecIds(List<String> SpecList, List<String> ParentList, String personName) {
List<ComExpertDTO> list = comExpertSpecDAO.getExpertListByExpertSpecIds(SpecList, ParentList, personName);
List<SelectListItem> allItem = new ArrayList<>();
if (null != list && list.size() > 0) {
list.forEach((e) -> {
String description = e.getSex() + "/" + AgeUtil.getResidentAge(e.getBirthday()) + "岁/" + e.getWorkUnit();
SelectListItem treeListItem = new SelectListItem(e.getPersonName(), e.getId(), description, false, false, new ArrayList<>());
allItem.add(treeListItem);
});
}
return allItem;
}
public List<SelectListItem> getExpertListByExpertSpecIdOrParentId(String specId, String pkey, String ppkey, String personName) {
List<ComExpertDTO> list = comExpertSpecDAO.getExpertListByExpertSpecIdOrParentId(specId, pkey, ppkey, personName);
List<SelectListItem> allItem = new ArrayList<>();
if (null != list && list.size() > 0) {
list.forEach((e) -> {
String description = e.getSex() + "/" + AgeUtil.getResidentAge(e.getBirthday()) + "岁/" + e.getWorkUnit();
SelectListItem treeListItem = new SelectListItem(e.getPersonName(), e.getId(), description, false, false, new ArrayList<>());
allItem.add(treeListItem);
});
}
return allItem;
}
}