|
@@ -1,5 +1,6 @@
|
|
|
package org.dromara.customer.service.impl;
|
|
package org.dromara.customer.service.impl;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
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;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
@@ -62,22 +63,13 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Su
|
|
|
* @return 供应商信息
|
|
* @return 供应商信息
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public SupplierInformationVo queryById(Long id) throws JsonProcessingException {
|
|
|
|
|
|
|
+ public SupplierInfoVo queryById(Long id) throws JsonProcessingException {
|
|
|
SupplierInfoVo supplierInfoVo = baseMapper.selectVoById(id);
|
|
SupplierInfoVo supplierInfoVo = baseMapper.selectVoById(id);
|
|
|
- SupplierInformationVo supplierInformationVo = handleProcurementInfo(supplierInfoVo);
|
|
|
|
|
-
|
|
|
|
|
- ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
- Map<String, Object> originalMap = objectMapper.readValue(supplierInfoVo.getOtherCustomers(), Map.class);
|
|
|
|
|
- // 2. 转换字段名(大写驼峰 -> 小驼峰)
|
|
|
|
|
- Map<String, Object> convertedMap = convertFieldNames(originalMap);
|
|
|
|
|
-
|
|
|
|
|
-// Map<String, Object> result = new HashMap<>();
|
|
|
|
|
-// result.put("otherCustomers", convertedMap);
|
|
|
|
|
- supplierInformationVo.setOtherCustomersMap(convertedMap);
|
|
|
|
|
|
|
+ SupplierInfoVo supplierInformationVo = handleProcurementInfo(supplierInfoVo);
|
|
|
return supplierInformationVo;
|
|
return supplierInformationVo;
|
|
|
}
|
|
}
|
|
|
- private SupplierInformationVo handleProcurementInfo(SupplierInfoVo records) {
|
|
|
|
|
- SupplierInformationVo targetVo = new SupplierInformationVo();
|
|
|
|
|
|
|
+ private SupplierInfoVo handleProcurementInfo(SupplierInfoVo records) {
|
|
|
|
|
+ SupplierInfoVo targetVo = new SupplierInfoVo();
|
|
|
BeanUtils.copyProperties(records, targetVo, "otherCustomers");
|
|
BeanUtils.copyProperties(records, targetVo, "otherCustomers");
|
|
|
// 查询管理人员和采购人员
|
|
// 查询管理人员和采购人员
|
|
|
Long id = targetVo.getId();
|
|
Long id = targetVo.getId();
|
|
@@ -150,11 +142,11 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Su
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public TableDataInfo<SupplierInformationVo> getSupplierInformation(SupplierInfoBo bo, PageQuery pageQuery) {
|
|
|
|
|
|
|
+ public TableDataInfo<SupplierInfoVo> getSupplierInformation(SupplierInfoBo bo, PageQuery pageQuery) {
|
|
|
LambdaQueryWrapper<SupplierInfo> lqw = buildQueryWrapper(bo);
|
|
LambdaQueryWrapper<SupplierInfo> lqw = buildQueryWrapper(bo);
|
|
|
Page<SupplierInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
Page<SupplierInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
- List<SupplierInformationVo> supplierInformationVos = handleProcurementInfo(result.getRecords());
|
|
|
|
|
- Page<SupplierInformationVo> newPage = new Page<>();
|
|
|
|
|
|
|
+ List<SupplierInfoVo> supplierInformationVos = handleProcurementInfo(result.getRecords());
|
|
|
|
|
+ Page<SupplierInfoVo> newPage = new Page<>();
|
|
|
newPage.setRecords(supplierInformationVos);
|
|
newPage.setRecords(supplierInformationVos);
|
|
|
newPage.setTotal(result.getTotal());
|
|
newPage.setTotal(result.getTotal());
|
|
|
newPage.setCurrent(result.getCurrent());
|
|
newPage.setCurrent(result.getCurrent());
|
|
@@ -163,7 +155,7 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Su
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public TableDataInfo<SupplierInformationVo> getSupplierApproveInformation(SupplierInfoBo bo, PageQuery pageQuery) {
|
|
|
|
|
|
|
+ public TableDataInfo<SupplierInfoVo> getSupplierApproveInformation(SupplierInfoBo bo, PageQuery pageQuery) {
|
|
|
LambdaQueryWrapper<SupplierInfo> lqw = buildQueryWrapper(bo);
|
|
LambdaQueryWrapper<SupplierInfo> lqw = buildQueryWrapper(bo);
|
|
|
if (bo.getSupplyStatus() == null){
|
|
if (bo.getSupplyStatus() == null){
|
|
|
List<Long> status = new ArrayList<>();
|
|
List<Long> status = new ArrayList<>();
|
|
@@ -172,8 +164,8 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Su
|
|
|
lqw.in(SupplierInfo::getSupplyStatus,status);
|
|
lqw.in(SupplierInfo::getSupplyStatus,status);
|
|
|
}
|
|
}
|
|
|
Page<SupplierInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
Page<SupplierInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
- List<SupplierInformationVo> supplierInformationVos = handleProcurementInfo(result.getRecords());
|
|
|
|
|
- Page<SupplierInformationVo> newPage = new Page<>();
|
|
|
|
|
|
|
+ List<SupplierInfoVo> supplierInformationVos = handleProcurementInfo(result.getRecords());
|
|
|
|
|
+ Page<SupplierInfoVo> newPage = new Page<>();
|
|
|
newPage.setRecords(supplierInformationVos);
|
|
newPage.setRecords(supplierInformationVos);
|
|
|
newPage.setTotal(result.getTotal());
|
|
newPage.setTotal(result.getTotal());
|
|
|
newPage.setCurrent(result.getCurrent());
|
|
newPage.setCurrent(result.getCurrent());
|
|
@@ -184,22 +176,22 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Su
|
|
|
/**
|
|
/**
|
|
|
* 处理采购员和产品经理信息
|
|
* 处理采购员和产品经理信息
|
|
|
*/
|
|
*/
|
|
|
- private List<SupplierInformationVo> handleProcurementInfo(List<SupplierInfoVo> records) {
|
|
|
|
|
- List<SupplierInformationVo> supplierInformationVos = records.stream()
|
|
|
|
|
|
|
+ private List<SupplierInfoVo> handleProcurementInfo(List<SupplierInfoVo> records) {
|
|
|
|
|
+ List<SupplierInfoVo> supplierInformationVos = records.stream()
|
|
|
.map(supplierInfoVo -> {
|
|
.map(supplierInfoVo -> {
|
|
|
- SupplierInformationVo targetVo = new SupplierInformationVo();
|
|
|
|
|
|
|
+ SupplierInfoVo targetVo = new SupplierInfoVo();
|
|
|
BeanUtils.copyProperties(supplierInfoVo, targetVo);
|
|
BeanUtils.copyProperties(supplierInfoVo, targetVo);
|
|
|
return targetVo;
|
|
return targetVo;
|
|
|
})
|
|
})
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
//获取供应类别
|
|
//获取供应类别
|
|
|
- Map<Long, String> supplierCategoryMap = supplierInformationVos.stream().collect(Collectors.toMap(SupplierInformationVo::getId, SupplierInformationVo::getOperatingCategory));
|
|
|
|
|
|
|
+ Map<Long, String> supplierCategoryMap = supplierInformationVos.stream().collect(Collectors.toMap(SupplierInfoVo::getId, SupplierInfoVo::getOperatingCategory));
|
|
|
//查询供应品类
|
|
//查询供应品类
|
|
|
Map<Long, String> supplierCategoryNameMap = supplierCategoryNamesMap(supplierCategoryMap);
|
|
Map<Long, String> supplierCategoryNameMap = supplierCategoryNamesMap(supplierCategoryMap);
|
|
|
supplierInformationVos.forEach(vo -> {
|
|
supplierInformationVos.forEach(vo -> {
|
|
|
vo.setOperatingCategory(supplierCategoryNameMap.get(vo.getId()));
|
|
vo.setOperatingCategory(supplierCategoryNameMap.get(vo.getId()));
|
|
|
});
|
|
});
|
|
|
- for (SupplierInformationVo vo : supplierInformationVos) {
|
|
|
|
|
|
|
+ for (SupplierInfoVo vo : supplierInformationVos) {
|
|
|
// 查询管理人员和采购人员
|
|
// 查询管理人员和采购人员
|
|
|
Long id = vo.getId();
|
|
Long id = vo.getId();
|
|
|
LambdaQueryWrapper<SupplierProcurement> procurementLqw = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<SupplierProcurement> procurementLqw = Wrappers.lambdaQuery();
|
|
@@ -326,9 +318,9 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Su
|
|
|
lqw.orderByAsc(SupplierInfo::getId);
|
|
lqw.orderByAsc(SupplierInfo::getId);
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getSupplierNo()), SupplierInfo::getSupplierNo, bo.getSupplierNo());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getSupplierNo()), SupplierInfo::getSupplierNo, bo.getSupplierNo());
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getEnterpriseName()), SupplierInfo::getEnterpriseName, bo.getEnterpriseName());
|
|
lqw.like(StringUtils.isNotBlank(bo.getEnterpriseName()), SupplierInfo::getEnterpriseName, bo.getEnterpriseName());
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getMembershipSize()), SupplierInfo::getMembershipSize, bo.getMembershipSize());
|
|
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getSupplierType()), SupplierInfo::getSupplierType, bo.getSupplierType());
|
|
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getCooperationType()), SupplierInfo::getCooperationType, bo.getCooperationType());
|
|
|
|
|
|
|
+ lqw.eq(ObjectUtil.isNotEmpty(bo.getMembershipSize()), SupplierInfo::getMembershipSize, bo.getMembershipSize());
|
|
|
|
|
+ lqw.eq(ObjectUtil.isNotEmpty(bo.getSupplierType()), SupplierInfo::getSupplierType, bo.getSupplierType());
|
|
|
|
|
+ lqw.eq(ObjectUtil.isNotEmpty(bo.getCooperationType()), SupplierInfo::getCooperationType, bo.getCooperationType());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getFixedPhone()), SupplierInfo::getFixedPhone, bo.getFixedPhone());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getFixedPhone()), SupplierInfo::getFixedPhone, bo.getFixedPhone());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getFax()), SupplierInfo::getFax, bo.getFax());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getFax()), SupplierInfo::getFax, bo.getFax());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getUrl()), SupplierInfo::getUrl, bo.getUrl());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getUrl()), SupplierInfo::getUrl, bo.getUrl());
|
|
@@ -370,9 +362,9 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Su
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getOperatingBrand()), SupplierInfo::getOperatingBrand, bo.getOperatingBrand());
|
|
lqw.eq(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(StringUtils.isNotBlank(bo.getIndustrCategory()), SupplierInfo::getIndustrCategory, bo.getIndustrCategory());
|
|
|
|
|
|
|
+ lqw.eq(ObjectUtil.isNotEmpty(bo.getIndustrCategory()), SupplierInfo::getIndustrCategory, bo.getIndustrCategory());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getType()), SupplierInfo::getType, bo.getType());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getType()), SupplierInfo::getType, bo.getType());
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getOwnedCompany()), SupplierInfo::getOwnedCompany, bo.getOwnedCompany());
|
|
|
|
|
|
|
+ lqw.eq(ObjectUtil.isNotEmpty(bo.getOwnedCompany()), SupplierInfo::getOwnedCompany, bo.getOwnedCompany());
|
|
|
lqw.eq(bo.getPushStatus() != null, SupplierInfo::getPushStatus, bo.getPushStatus());
|
|
lqw.eq(bo.getPushStatus() != null, SupplierInfo::getPushStatus, bo.getPushStatus());
|
|
|
lqw.eq(bo.getValidityFromDate() != null, SupplierInfo::getValidityFromDate, bo.getValidityFromDate());
|
|
lqw.eq(bo.getValidityFromDate() != null, SupplierInfo::getValidityFromDate, bo.getValidityFromDate());
|
|
|
lqw.eq(bo.getValidityToDate() != null, SupplierInfo::getValidityToDate, bo.getValidityToDate());
|
|
lqw.eq(bo.getValidityToDate() != null, SupplierInfo::getValidityToDate, bo.getValidityToDate());
|