|
@@ -1,6 +1,7 @@
|
|
|
package org.dromara.customer.service.impl;
|
|
package org.dromara.customer.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -25,10 +26,9 @@ import org.dromara.customer.domain.vo.EnterpriseScaleVo;
|
|
|
import org.dromara.customer.domain.vo.SupplierBusinessInfoVo;
|
|
import org.dromara.customer.domain.vo.SupplierBusinessInfoVo;
|
|
|
import org.dromara.customer.domain.vo.SupplierInformationVo;
|
|
import org.dromara.customer.domain.vo.SupplierInformationVo;
|
|
|
import org.dromara.customer.enums.SupplierStatusEnum;
|
|
import org.dromara.customer.enums.SupplierStatusEnum;
|
|
|
|
|
+import org.dromara.customer.mapper.SupplierAuthorizeMapper;
|
|
|
import org.dromara.customer.mapper.SupplierBusinessInfoMapper;
|
|
import org.dromara.customer.mapper.SupplierBusinessInfoMapper;
|
|
|
-import org.dromara.customer.service.IEnterpriseScaleService;
|
|
|
|
|
-import org.dromara.customer.service.ISupplierProcurementService;
|
|
|
|
|
-import org.dromara.customer.service.ISupplyAreaService;
|
|
|
|
|
|
|
+import org.dromara.customer.service.*;
|
|
|
import org.dromara.product.api.RemoteCategoryService;
|
|
import org.dromara.product.api.RemoteCategoryService;
|
|
|
import org.dromara.product.api.RemoteProductService;
|
|
import org.dromara.product.api.RemoteProductService;
|
|
|
import org.dromara.product.api.domain.RemoteProductBrand;
|
|
import org.dromara.product.api.domain.RemoteProductBrand;
|
|
@@ -41,7 +41,6 @@ import org.dromara.customer.domain.bo.SupplierInfoBo;
|
|
|
import org.dromara.customer.domain.vo.SupplierInfoVo;
|
|
import org.dromara.customer.domain.vo.SupplierInfoVo;
|
|
|
import org.dromara.customer.domain.SupplierInfo;
|
|
import org.dromara.customer.domain.SupplierInfo;
|
|
|
import org.dromara.customer.mapper.SupplierInfoMapper;
|
|
import org.dromara.customer.mapper.SupplierInfoMapper;
|
|
|
-import org.dromara.customer.service.ISupplierInfoService;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -68,6 +67,8 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Su
|
|
|
|
|
|
|
|
private final SupplierBusinessInfoMapper supplierBusinessInfoMapper;
|
|
private final SupplierBusinessInfoMapper supplierBusinessInfoMapper;
|
|
|
|
|
|
|
|
|
|
+ private final CommonSupplierAuthorizeService commonSupplierAuthorizeMapper;
|
|
|
|
|
+
|
|
|
@DubboReference
|
|
@DubboReference
|
|
|
private final RemoteComStaffService remoteComStaffService;
|
|
private final RemoteComStaffService remoteComStaffService;
|
|
|
|
|
|
|
@@ -246,17 +247,50 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Su
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public TableDataInfo<SupplierInfoVo> getSupplierInformation(SupplierInfoBo bo, PageQuery pageQuery) {
|
|
public TableDataInfo<SupplierInfoVo> getSupplierInformation(SupplierInfoBo bo, PageQuery pageQuery) {
|
|
|
|
|
+ LambdaQueryWrapper<SupplierInfo> lqw = new LambdaQueryWrapper<>();
|
|
|
// 1. 基础分页查询
|
|
// 1. 基础分页查询
|
|
|
if (bo.getSupplyStatus() == null){
|
|
if (bo.getSupplyStatus() == null){
|
|
|
//正式供应商
|
|
//正式供应商
|
|
|
- bo.setSupplyStatus(1L);
|
|
|
|
|
|
|
+ lqw.eq(SupplierInfo::getSupplyStatus, 1L);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ lqw.eq(SupplierInfo::getSupplyStatus,bo.getSupplyStatus());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// 2. 添加品牌条件
|
|
// 2. 添加品牌条件
|
|
|
- if (bo.getOperatingBrand()!= null){
|
|
|
|
|
|
|
+ if (bo.getOperatingBrand()!= null && StringUtils.isNotBlank(bo.getOperatingBrand())){
|
|
|
|
|
+ if (StringUtils.isNotBlank(bo.getOperatingBrand())){
|
|
|
|
|
+ Long productBrandIdByName = remoteProductService.getProductBrandIdByName(bo.getOperatingBrand());
|
|
|
|
|
+ if (productBrandIdByName != null){
|
|
|
|
|
+ lqw.like(SupplierInfo::getOperatingBrand, productBrandIdByName);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //3.可供货区域省和市 - 添加供应区域过滤
|
|
|
|
|
+ if (StringUtils.isNotBlank(bo.getProvince()) || StringUtils.isNotBlank(bo.getCity())) {
|
|
|
|
|
+ // 查询符合条件的供应商ID列表
|
|
|
|
|
+ List<Long> supplierIds = supplyAreaService.getSupplierIdsByArea(bo.getProvince(), bo.getCity());
|
|
|
|
|
+ if (supplierIds != null && !supplierIds.isEmpty()) {
|
|
|
|
|
+ lqw.in(SupplierInfo::getId, supplierIds);
|
|
|
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ lqw.in(SupplierInfo::getId, -1L);
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- LambdaQueryWrapper<SupplierInfo> lqw = buildQueryWrapper(bo);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ //产品经理和采购人员
|
|
|
|
|
+ if (bo.getProductManager() != null || bo.getBuyer() != null) {
|
|
|
|
|
+ // 查询符合条件的供应商ID列表
|
|
|
|
|
+ List<Long> supplierIds = supplierProcurementService.getSupplierIdsByProcurement(bo.getProductManager(), bo.getBuyer());
|
|
|
|
|
+ if (supplierIds != null && !supplierIds.isEmpty()) {
|
|
|
|
|
+ lqw.in(SupplierInfo::getId, supplierIds);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ lqw.in(SupplierInfo::getId, -1L);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
Page<SupplierInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
Page<SupplierInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
List<SupplierInfoVo> supplierVos = result.getRecords();
|
|
List<SupplierInfoVo> supplierVos = result.getRecords();
|
|
|
|
|
|
|
@@ -271,16 +305,53 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Su
|
|
|
// 3. 封装分页结果
|
|
// 3. 封装分页结果
|
|
|
Page<SupplierInfoVo> newPage = copyPageResult(result, supplierVos);
|
|
Page<SupplierInfoVo> newPage = copyPageResult(result, supplierVos);
|
|
|
return TableDataInfo.build(newPage);
|
|
return TableDataInfo.build(newPage);
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public TableDataInfo<SupplierInfoVo> getSupplierApproveInformation(SupplierInfoBo bo, PageQuery pageQuery) {
|
|
public TableDataInfo<SupplierInfoVo> getSupplierApproveInformation(SupplierInfoBo bo, PageQuery pageQuery) {
|
|
|
// 1. 构建审批状态条件
|
|
// 1. 构建审批状态条件
|
|
|
- LambdaQueryWrapper<SupplierInfo> lqw = buildQueryWrapper(bo);
|
|
|
|
|
|
|
+ LambdaQueryWrapper<SupplierInfo> lqw = new LambdaQueryWrapper<>();
|
|
|
if (bo.getSupplyStatus() == null) {
|
|
if (bo.getSupplyStatus() == null) {
|
|
|
List<Long> status = Arrays.asList(0L, 4L);
|
|
List<Long> status = Arrays.asList(0L, 4L);
|
|
|
lqw.in(SupplierInfo::getSupplyStatus, status);
|
|
lqw.in(SupplierInfo::getSupplyStatus, status);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ lqw.eq(SupplierInfo::getSupplyStatus,bo.getSupplyStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 2.添加品牌条件
|
|
|
|
|
+ if (bo.getOperatingBrand()!= null && StringUtils.isNotBlank(bo.getOperatingBrand())){
|
|
|
|
|
+ if (StringUtils.isNotBlank(bo.getOperatingBrand())){
|
|
|
|
|
+ Long productBrandIdByName = remoteProductService.getProductBrandIdByName(bo.getOperatingBrand());
|
|
|
|
|
+ if (productBrandIdByName != null){
|
|
|
|
|
+ lqw.like(SupplierInfo::getOperatingBrand, productBrandIdByName);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ //3.可供货区域省和市 - 添加供应区域过滤
|
|
|
|
|
+ if (StringUtils.isNotBlank(bo.getProvince()) || StringUtils.isNotBlank(bo.getCity())) {
|
|
|
|
|
+ // 查询符合条件的供应商ID列表
|
|
|
|
|
+ List<Long> supplierIds = supplyAreaService.getSupplierIdsByArea(bo.getProvince(), bo.getCity());
|
|
|
|
|
+ if (supplierIds != null && !supplierIds.isEmpty()) {
|
|
|
|
|
+ lqw.in(SupplierInfo::getId, supplierIds);
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ lqw.in(SupplierInfo::getId, -1L);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //产品经理和采购人员
|
|
|
|
|
+ if (bo.getProductManager() != null || bo.getBuyer() != null) {
|
|
|
|
|
+ // 查询符合条件的供应商ID列表
|
|
|
|
|
+ List<Long> supplierIds = supplierProcurementService.getSupplierIdsByProcurement(bo.getProductManager(), bo.getBuyer());
|
|
|
|
|
+ if (supplierIds != null && !supplierIds.isEmpty()) {
|
|
|
|
|
+ lqw.in(SupplierInfo::getId, supplierIds);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ lqw.in(SupplierInfo::getId, -1L);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// 2. 基础分页查询
|
|
// 2. 基础分页查询
|
|
|
Page<SupplierInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
Page<SupplierInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
@@ -302,8 +373,40 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Su
|
|
|
// 1. 构建产能列表查询条件
|
|
// 1. 构建产能列表查询条件
|
|
|
LambdaQueryWrapper<SupplierInfo> lqw = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<SupplierInfo> lqw = new LambdaQueryWrapper<>();
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getSupplierNo()), SupplierInfo::getSupplierNo, bo.getSupplierNo());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getSupplierNo()), SupplierInfo::getSupplierNo, bo.getSupplierNo());
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getSupplierName()), SupplierInfo::getSupplierName, bo.getSupplierName());
|
|
|
|
|
- lqw.like(StringUtils.isNotBlank(bo.getSupplyBrand()), SupplierInfo::getOperatingBrand, bo.getSupplyBrand());
|
|
|
|
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getSupplierName()), SupplierInfo::getEnterpriseName, bo.getSupplierName());
|
|
|
|
|
+
|
|
|
|
|
+ //可供应品牌
|
|
|
|
|
+ if (StringUtils.isNotBlank(bo.getSupplyBrand())){
|
|
|
|
|
+ Long productBrandIdByName = remoteProductService.getProductBrandIdByName(bo.getSupplyBrand());
|
|
|
|
|
+ if (productBrandIdByName != null){
|
|
|
|
|
+ lqw.like(SupplierInfo::getOperatingBrand, productBrandIdByName);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //可供货区域省和市 - 添加供应区域过滤
|
|
|
|
|
+ if (StringUtils.isNotBlank(bo.getProvince()) || StringUtils.isNotBlank(bo.getCity())) {
|
|
|
|
|
+ // 查询符合条件的供应商ID列表
|
|
|
|
|
+ List<Long> supplierIds = supplyAreaService.getSupplierIdsByArea(bo.getProvince(), bo.getCity());
|
|
|
|
|
+ if (supplierIds != null &&!supplierIds.isEmpty()) {
|
|
|
|
|
+ lqw.in(SupplierInfo::getId, supplierIds);
|
|
|
|
|
+
|
|
|
|
|
+ }else {
|
|
|
|
|
+ lqw.in(SupplierInfo::getId, -1L);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 新增:根据品牌名称过滤(从SupplierAuthorize表)
|
|
|
|
|
+ if (StringUtils.isNotBlank(bo.getBrandName())) {
|
|
|
|
|
+ // 通过SupplierAuthorizeService查询符合条件的供应商ID
|
|
|
|
|
+ List<Long> supplierIdsByBrand = commonSupplierAuthorizeMapper.getSupplierIdsByBrandName(bo.getBrandName());
|
|
|
|
|
+ if (supplierIdsByBrand!=null &&!supplierIdsByBrand.isEmpty()) {
|
|
|
|
|
+ lqw.in(SupplierInfo::getId, supplierIdsByBrand);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ lqw.in(SupplierInfo::getId, -1L);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
lqw.orderByDesc(SupplierInfo::getSupplierNo);
|
|
lqw.orderByDesc(SupplierInfo::getSupplierNo);
|
|
|
|
|
|
|
|
// 2. 基础分页查询
|
|
// 2. 基础分页查询
|
|
@@ -1336,8 +1439,8 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Su
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getSupplierName()), SupplierInfo::getSupplierName, bo.getSupplierName());
|
|
lqw.like(StringUtils.isNotBlank(bo.getSupplierName()), SupplierInfo::getSupplierName, bo.getSupplierName());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getSupplierPhone()), SupplierInfo::getSupplierPhone, bo.getSupplierPhone());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getSupplierPhone()), SupplierInfo::getSupplierPhone, bo.getSupplierPhone());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getSupplierPassword()), SupplierInfo::getSupplierPassword, bo.getSupplierPassword());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getSupplierPassword()), SupplierInfo::getSupplierPassword, bo.getSupplierPassword());
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getOperatingCategory()), SupplierInfo::getOperatingCategory, bo.getOperatingCategory());
|
|
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getOperatingBrand()), SupplierInfo::getOperatingBrand, bo.getOperatingBrand());
|
|
|
|
|
|
|
+ lqw.like(StringUtils.isNotBlank(bo.getOperatingCategory()), SupplierInfo::getOperatingCategory, bo.getOperatingCategory());
|
|
|
|
|
+ lqw.like(StringUtils.isNotBlank(bo.getOperatingBrand()), SupplierInfo::getOperatingBrand, bo.getOperatingBrand());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getOtherCustomers()), SupplierInfo::getOtherCustomers, bo.getOtherCustomers());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getOtherCustomers()), SupplierInfo::getOtherCustomers, bo.getOtherCustomers());
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getShortName()), SupplierInfo::getShortName, bo.getShortName());
|
|
lqw.like(StringUtils.isNotBlank(bo.getShortName()), SupplierInfo::getShortName, bo.getShortName());
|
|
|
lqw.eq(ObjectUtil.isNotEmpty(bo.getIndustrCategory()), SupplierInfo::getIndustrCategory, bo.getIndustrCategory());
|
|
lqw.eq(ObjectUtil.isNotEmpty(bo.getIndustrCategory()), SupplierInfo::getIndustrCategory, bo.getIndustrCategory());
|