太湖英才详情证书修改
This commit is contained in:
@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.TaihuTalent;
|
||||
import com.peanut.modules.common.entity.UserCertificate;
|
||||
import com.peanut.modules.common.entity.UserCertificateLabel;
|
||||
import com.peanut.modules.common.service.TaihuTalentService;
|
||||
import com.peanut.modules.common.service.UserCertificateLabelService;
|
||||
import com.peanut.modules.common.service.UserCertificateService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -24,6 +26,8 @@ public class TaihuTalentController {
|
||||
private TaihuTalentService taihuTalentService;
|
||||
@Autowired
|
||||
private UserCertificateService userCertificateService;
|
||||
@Autowired
|
||||
private UserCertificateLabelService userCertificateLabelService;
|
||||
|
||||
//太湖英才列表
|
||||
@RequestMapping("/getTaihuTalents")
|
||||
@@ -38,41 +42,63 @@ public class TaihuTalentController {
|
||||
@RequestMapping("/taihuTalentInfo")
|
||||
public R taihuTalentInfo(@RequestBody Map<String,Object> params){
|
||||
TaihuTalent taihuTalent = taihuTalentService.getById(params.get("id").toString());
|
||||
List<UserCertificate> certificates = userCertificateService.list(new LambdaQueryWrapper<UserCertificate>()
|
||||
.eq(UserCertificate::getUserId,taihuTalent.getUserId()));
|
||||
List<UserCertificate> res = new ArrayList<>();
|
||||
Set<String> label = new HashSet<>();
|
||||
List<UserCertificateLabel> labels = userCertificateLabelService.list(new LambdaQueryWrapper<UserCertificateLabel>()
|
||||
.eq(UserCertificateLabel::getPid,0));
|
||||
List<UserCertificateLabel> filterLabels = new ArrayList<>();
|
||||
for (UserCertificateLabel label : labels){
|
||||
List<UserCertificate> us = new ArrayList<>();
|
||||
getUserCertificates(us,label,taihuTalent.getUserId());
|
||||
label.setUserCertificates(us);
|
||||
if (us.size() > 0){
|
||||
filterLabels.add(label);
|
||||
}
|
||||
}
|
||||
List<UserCertificateLabel> res = new ArrayList<>();
|
||||
Set<String> titleLabel = new HashSet<>();
|
||||
//出师证、太湖国际中医师证、太湖国际针灸师证排在前面
|
||||
for (UserCertificate uc:certificates) {
|
||||
if (uc.getLabelId()==22){
|
||||
res.add(uc);
|
||||
label.add("出师证");
|
||||
for (UserCertificateLabel label:filterLabels) {
|
||||
if (label.getId()==22){
|
||||
res.add(label);
|
||||
titleLabel.add("出师证");
|
||||
}
|
||||
}
|
||||
for (UserCertificate uc:certificates) {
|
||||
if (uc.getLabelId()==13){
|
||||
res.add(uc);
|
||||
label.add("太湖国际中医师");
|
||||
for (UserCertificateLabel label:filterLabels) {
|
||||
if (label.getId()==13){
|
||||
res.add(label);
|
||||
titleLabel.add("太湖国际中医师");
|
||||
}
|
||||
}
|
||||
for (UserCertificate uc:certificates) {
|
||||
if (uc.getLabelId()==19){
|
||||
res.add(uc);
|
||||
label.add("太湖国际针灸师");
|
||||
for (UserCertificateLabel label:filterLabels) {
|
||||
if (label.getId()==19){
|
||||
res.add(label);
|
||||
titleLabel.add("太湖国际针灸师");
|
||||
}
|
||||
}
|
||||
for (UserCertificate uc:certificates) {
|
||||
if (uc.getLabelId()!=22&&uc.getLabelId()!=13&&uc.getLabelId()!=19){
|
||||
res.add(uc);
|
||||
for (UserCertificateLabel label:filterLabels) {
|
||||
if (label.getId()!=22&&label.getId()!=13&&label.getId()!=19){
|
||||
res.add(label);
|
||||
}
|
||||
}
|
||||
return R.ok()
|
||||
.put("taihuTalent",taihuTalent)
|
||||
.put("label",label)
|
||||
.put("label",titleLabel)
|
||||
.put("certificates",res);
|
||||
}
|
||||
|
||||
|
||||
void getUserCertificates(List<UserCertificate> us,UserCertificateLabel label,int userId){
|
||||
if (label.getIsLast()==1) {
|
||||
List<UserCertificate> userCertificates = userCertificateService.list(new LambdaQueryWrapper<UserCertificate>()
|
||||
.eq(UserCertificate::getLabelId,label.getId())
|
||||
.eq(UserCertificate::getUserId,userId));
|
||||
us.addAll(userCertificates);
|
||||
}else {
|
||||
List<UserCertificateLabel> ls = userCertificateLabelService.list(new LambdaQueryWrapper<UserCertificateLabel>()
|
||||
.eq(UserCertificateLabel::getPid,label.getId()));
|
||||
for (UserCertificateLabel l:ls){
|
||||
getUserCertificates(us,l,userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user