|
@@ -11,7 +11,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
-
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
@@ -21,7 +20,6 @@ import java.time.LocalDateTime;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
-import java.util.Optional;
|
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -295,41 +293,42 @@ public class ProductController {
|
|
@RequestMapping("/businessListWithProduct")
|
|
@RequestMapping("/businessListWithProduct")
|
|
public HttpRespMsg businessListWithProduct(Integer id){
|
|
public HttpRespMsg businessListWithProduct(Integer id){
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
- Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
|
- List<BusinessItemProduct> businessItemProducts = businessItemProductService.list(new LambdaQueryWrapper<BusinessItemProduct>().eq(BusinessItemProduct::getProductId, id));
|
|
|
|
- List<Integer> businessIds = businessItemProducts.stream().map(BusinessItemProduct::getBusinessId).distinct().collect(Collectors.toList());
|
|
|
|
- businessIds.add(-1);
|
|
|
|
- List<BusinessOpportunity> opportunityList = businessOpportunityService.list(new LambdaQueryWrapper<BusinessOpportunity>().in(BusinessOpportunity::getId, businessIds)
|
|
|
|
- .eq(BusinessOpportunity::getIsDelete,0)
|
|
|
|
- );
|
|
|
|
- List<Custom> customList = customService.list(new LambdaQueryWrapper<Custom>().eq(Custom::getCompanyId, companyId));
|
|
|
|
- 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()){
|
|
|
|
- c.setCustomerName(custom.get().getCustomName());
|
|
|
|
- }
|
|
|
|
- Optional<User> user = userList.stream().filter(u -> u.getId().equals(c.getCreatorId())).findFirst();
|
|
|
|
- if(user.isPresent()){
|
|
|
|
- c.setCreatorName(user.get().getName());
|
|
|
|
- }
|
|
|
|
- Optional<Contacts> contacts = contactsList.stream().filter(u -> u.getId().equals(c.getContactsId())).findFirst();
|
|
|
|
- if(contacts.isPresent()){
|
|
|
|
- c.setContactsName(contacts.get().getName());
|
|
|
|
- }
|
|
|
|
- Optional<User> incharger = userList.stream().filter(u -> u.getId().equals(c.getInchargerId())).findFirst();
|
|
|
|
- if(incharger.isPresent()){
|
|
|
|
- c.setInchargerName(incharger.get().getName());
|
|
|
|
- }
|
|
|
|
- Optional<Stage> businessStage = businessStageList.stream().filter(b -> b.getId().equals(c.getStageId())).findFirst();
|
|
|
|
- if(businessStage.isPresent()){
|
|
|
|
- c.setStageValue(businessStage.get().getName());
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- msg.setData(opportunityList);
|
|
|
|
|
|
+ msg = productService.businessListWithProduct(id);
|
|
|
|
+// Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
|
+// List<BusinessItemProduct> businessItemProducts = businessItemProductService.list(new LambdaQueryWrapper<BusinessItemProduct>().eq(BusinessItemProduct::getProductId, id));
|
|
|
|
+// List<Integer> businessIds = businessItemProducts.stream().map(BusinessItemProduct::getBusinessId).distinct().collect(Collectors.toList());
|
|
|
|
+// businessIds.add(-1);
|
|
|
|
+// List<BusinessOpportunity> opportunityList = businessOpportunityService.list(new LambdaQueryWrapper<BusinessOpportunity>().in(BusinessOpportunity::getId, businessIds)
|
|
|
|
+// .eq(BusinessOpportunity::getIsDelete,0)
|
|
|
|
+// );
|
|
|
|
+// List<Custom> customList = customService.list(new LambdaQueryWrapper<Custom>().eq(Custom::getCompanyId, companyId));
|
|
|
|
+// 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()){
|
|
|
|
+// c.setCustomerName(custom.get().getCustomName());
|
|
|
|
+// }
|
|
|
|
+// Optional<User> user = userList.stream().filter(u -> u.getId().equals(c.getCreatorId())).findFirst();
|
|
|
|
+// if(user.isPresent()){
|
|
|
|
+// c.setCreatorName(user.get().getName());
|
|
|
|
+// }
|
|
|
|
+// Optional<Contacts> contacts = contactsList.stream().filter(u -> u.getId().equals(c.getContactsId())).findFirst();
|
|
|
|
+// if(contacts.isPresent()){
|
|
|
|
+// c.setContactsName(contacts.get().getName());
|
|
|
|
+// }
|
|
|
|
+// Optional<User> incharger = userList.stream().filter(u -> u.getId().equals(c.getInchargerId())).findFirst();
|
|
|
|
+// if(incharger.isPresent()){
|
|
|
|
+// c.setInchargerName(incharger.get().getName());
|
|
|
|
+// }
|
|
|
|
+// Optional<Stage> businessStage = businessStageList.stream().filter(b -> b.getId().equals(c.getStageId())).findFirst();
|
|
|
|
+// if(businessStage.isPresent()){
|
|
|
|
+// c.setStageValue(businessStage.get().getName());
|
|
|
|
+// }
|
|
|
|
+// });
|
|
|
|
+// msg.setData(opportunityList);
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -343,48 +342,49 @@ public class ProductController {
|
|
@RequestMapping("/orderWithProduct")
|
|
@RequestMapping("/orderWithProduct")
|
|
public HttpRespMsg orderWithProduct(Integer id){
|
|
public HttpRespMsg orderWithProduct(Integer id){
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
- Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
|
- List<OrderProductDetail> productDetailList = orderProductDetailService.list(new LambdaQueryWrapper<OrderProductDetail>().eq(OrderProductDetail::getProductId, id));
|
|
|
|
- List<Integer> orderIds = productDetailList.stream().map(OrderProductDetail::getOrderId).distinct().collect(Collectors.toList());
|
|
|
|
- List<Custom> customList = customService.list(new LambdaQueryWrapper<Custom>().eq(Custom::getCompanyId, companyId));
|
|
|
|
- List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId, companyId));
|
|
|
|
- orderIds.add(-1);
|
|
|
|
- List<SalesOrder> orderList = salesOrderService.list(new LambdaQueryWrapper<SalesOrder>().in(SalesOrder::getId, orderIds).eq(SalesOrder::getIsDelete,0));
|
|
|
|
- List<SysDict> orderTypeList = sysDictService.list(new LambdaQueryWrapper<SysDict>().eq(SysDict::getCode, "OrderType"));
|
|
|
|
- List<Integer> businessOpportunityIds = orderList.stream().map(SalesOrder::getBusinessOpportunityId).distinct().collect(Collectors.toList());
|
|
|
|
- businessOpportunityIds.add(-1);
|
|
|
|
- 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()){
|
|
|
|
- o.setCustomName(custom.get().getCustomName());
|
|
|
|
- }
|
|
|
|
- Optional<User> user = userList.stream().filter(u -> u.getId().equals(o.getCreatorId())).findFirst();
|
|
|
|
- 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());
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- msg.setData(orderList);
|
|
|
|
|
|
+ msg = productService.orderWithProduct(id);
|
|
|
|
+// Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
|
+// List<OrderProductDetail> productDetailList = orderProductDetailService.list(new LambdaQueryWrapper<OrderProductDetail>().eq(OrderProductDetail::getProductId, id));
|
|
|
|
+// List<Integer> orderIds = productDetailList.stream().map(OrderProductDetail::getOrderId).distinct().collect(Collectors.toList());
|
|
|
|
+// List<Custom> customList = customService.list(new LambdaQueryWrapper<Custom>().eq(Custom::getCompanyId, companyId));
|
|
|
|
+// List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId, companyId));
|
|
|
|
+// orderIds.add(-1);
|
|
|
|
+// List<SalesOrder> orderList = salesOrderService.list(new LambdaQueryWrapper<SalesOrder>().in(SalesOrder::getId, orderIds).eq(SalesOrder::getIsDelete,0));
|
|
|
|
+// List<SysDict> orderTypeList = sysDictService.list(new LambdaQueryWrapper<SysDict>().eq(SysDict::getCode, "OrderType"));
|
|
|
|
+// List<Integer> businessOpportunityIds = orderList.stream().map(SalesOrder::getBusinessOpportunityId).distinct().collect(Collectors.toList());
|
|
|
|
+// businessOpportunityIds.add(-1);
|
|
|
|
+// 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()){
|
|
|
|
+// o.setCustomName(custom.get().getCustomName());
|
|
|
|
+// }
|
|
|
|
+// Optional<User> user = userList.stream().filter(u -> u.getId().equals(o.getCreatorId())).findFirst();
|
|
|
|
+// 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());
|
|
|
|
+// }
|
|
|
|
+// });
|
|
|
|
+// msg.setData(orderList);
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
|