|
@@ -1,8 +1,12 @@
|
|
|
package com.izouma.uwip.web;
|
|
package com.izouma.uwip.web;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
+import com.izouma.uwip.domain.Handle;
|
|
|
import com.izouma.uwip.domain.LogoPatent;
|
|
import com.izouma.uwip.domain.LogoPatent;
|
|
|
import com.izouma.uwip.domain.Partner;
|
|
import com.izouma.uwip.domain.Partner;
|
|
|
|
|
+import com.izouma.uwip.domain.User;
|
|
|
import com.izouma.uwip.repo.PartnerRepo;
|
|
import com.izouma.uwip.repo.PartnerRepo;
|
|
|
|
|
+import com.izouma.uwip.repo.UserRepo;
|
|
|
import com.izouma.uwip.service.LogoPatentService;
|
|
import com.izouma.uwip.service.LogoPatentService;
|
|
|
import com.izouma.uwip.dto.PageQuery;
|
|
import com.izouma.uwip.dto.PageQuery;
|
|
|
import com.izouma.uwip.exception.BusinessException;
|
|
import com.izouma.uwip.exception.BusinessException;
|
|
@@ -27,6 +31,7 @@ public class LogoPatentController extends BaseController {
|
|
|
private LogoPatentService logoPatentService;
|
|
private LogoPatentService logoPatentService;
|
|
|
private LogoPatentRepo logoPatentRepo;
|
|
private LogoPatentRepo logoPatentRepo;
|
|
|
private PartnerRepo partnerRepo;
|
|
private PartnerRepo partnerRepo;
|
|
|
|
|
+ private UserRepo userRepo;
|
|
|
|
|
|
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/save")
|
|
@PostMapping("/save")
|
|
@@ -44,9 +49,22 @@ public class LogoPatentController extends BaseController {
|
|
|
Map<Long, String> partnerMap = partners
|
|
Map<Long, String> partnerMap = partners
|
|
|
.stream()
|
|
.stream()
|
|
|
.collect(Collectors.toMap(Partner::getId, Partner::getName));
|
|
.collect(Collectors.toMap(Partner::getId, Partner::getName));
|
|
|
|
|
+ Map<Long, String> userMap = userRepo.findAll()
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .collect(Collectors.toMap(User::getId, User::getNickname));
|
|
|
return logoPatentService.all(pageQuery).map(logoPatent -> {
|
|
return logoPatentService.all(pageQuery).map(logoPatent -> {
|
|
|
logoPatent.setClientPartner(partnerMap.get(logoPatent.getClientPartnerId()));
|
|
logoPatent.setClientPartner(partnerMap.get(logoPatent.getClientPartnerId()));
|
|
|
logoPatent.setSupplierPartner(partnerMap.get(logoPatent.getSupplierPartnerId()));
|
|
logoPatent.setSupplierPartner(partnerMap.get(logoPatent.getSupplierPartnerId()));
|
|
|
|
|
+ logoPatent.setOperate(userMap.get(logoPatent.getUserId()));
|
|
|
|
|
+
|
|
|
|
|
+ List<Handle> handles = logoPatent.getHandle()
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .filter(handle -> handle.getLogoWorkflow().equals(logoPatent.getLogoWorkflow()))
|
|
|
|
|
+ .limit(1)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ if (CollUtil.isNotEmpty(handles)) {
|
|
|
|
|
+ logoPatent.setOperate(userMap.get(handles.get(0).getUserId()));
|
|
|
|
|
+ }
|
|
|
return logoPatent;
|
|
return logoPatent;
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|