Min 11 miesięcy temu
rodzic
commit
e0bba3baa7

+ 18 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ProductController.java

@@ -57,6 +57,8 @@ public class ProductController {
     private SysDictService sysDictService;
     @Resource
     private StageService stageService;
+    @Resource
+    private ContactsService contactsService;
 
 
     /**
@@ -268,6 +270,7 @@ public class ProductController {
         List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId, companyId));
 //        List<SysDict> businessStageList = sysDictService.list(new LambdaQueryWrapper<SysDict>().eq(SysDict::getCode, "BusinessStage"));
         List<Stage> businessStageList = stageService.list(new LambdaQueryWrapper<Stage>().eq(Stage::getCompanyId, companyId));
+        List<Contacts> contactsList = contactsService.list(new LambdaQueryWrapper<Contacts>().eq(Contacts::getCompanyId, companyId));
         opportunityList.forEach(c->{
             Optional<Custom> custom = customList.stream().filter(ct -> ct.getId().equals(c.getCustomerId())).findFirst();
             if(custom.isPresent()){
@@ -277,7 +280,7 @@ public class ProductController {
             if(user.isPresent()){
                 c.setCreatorName(user.get().getName());
             }
-            Optional<User> contacts = userList.stream().filter(u -> u.getId().equals(c.getContactsId())).findFirst();
+            Optional<Contacts> contacts = contactsList.stream().filter(u -> u.getId().equals(c.getContactsId())).findFirst();
             if(contacts.isPresent()){
                 c.setContactsName(contacts.get().getName());
             }
@@ -312,6 +315,8 @@ public class ProductController {
         orderIds.add(-1);
         List<SalesOrder> orderList = salesOrderService.list(new LambdaQueryWrapper<SalesOrder>().in(SalesOrder::getId, orderIds));
         List<SysDict> orderTypeList = sysDictService.list(new LambdaQueryWrapper<SysDict>().eq(SysDict::getCode, "OrderType"));
+        List<Integer> businessOpportunityIds = orderList.stream().map(SalesOrder::getBusinessOpportunityId).distinct().collect(Collectors.toList());
+        List<BusinessOpportunity> businessOpportunityList = businessOpportunityService.list(new LambdaQueryWrapper<BusinessOpportunity>().in(BusinessOpportunity::getId, businessOpportunityIds));
         orderList.forEach(o->{
             Optional<Custom> custom = customList.stream().filter(ct -> ct.getId().equals(o.getCustomId())).findFirst();
             if(custom.isPresent()){
@@ -321,10 +326,22 @@ public class ProductController {
             if(user.isPresent()){
                 o.setCreatorName(user.get().getName());
             }
+            Optional<User> customSigner = userList.stream().filter(u -> u.getId().equals(o.getCustomSigner())).findFirst();
+            if(customSigner.isPresent()){
+                o.setCustomSignerName(customSigner.get().getName());
+            }
+            Optional<User> companySigner = userList.stream().filter(u -> u.getId().equals(o.getCompanySigner())).findFirst();
+            if(companySigner.isPresent()){
+                o.setCompanySigner(companySigner.get().getName());
+            }
             Optional<User> incharger = userList.stream().filter(u -> u.getId().equals(o.getInchargerId())).findFirst();
             if(incharger.isPresent()){
                 o.setInchargerName(incharger.get().getName());
             }
+            Optional<BusinessOpportunity> businessOpportunity = businessOpportunityList.stream().filter(b -> o.getBusinessOpportunityId() != null && b.getId().equals(o.getBusinessOpportunityId())).findFirst();
+            if(businessOpportunity.isPresent()){
+                o.setBusinessOpportunityName(businessOpportunity.get().getName());
+            }
             Optional<SysDict> orderType = orderTypeList.stream().filter(ot -> ot.getId().equals(o.getType())).findFirst();
             if(orderType.isPresent()){
                 o.setTypeName(orderType.get().getName());