fix:产品管理导出功能调整
parent
b274c5e4af
commit
773f400add
|
|
@ -27,35 +27,43 @@ public class ProductInfo extends BaseEntity
|
||||||
/** ID */
|
/** ID */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 产品编码 */
|
|
||||||
@Excel(name = "产品编码")
|
@Excel(name = "产品编码")
|
||||||
private String productCode;
|
private String productCode;
|
||||||
private List<String> productCodeList;
|
private List<String> productCodeList;
|
||||||
@Excel(name = "华智编码")
|
@Excel(name = "华智编码")
|
||||||
private String hzCode;
|
private String hzCode;
|
||||||
private String type;
|
|
||||||
private String value;
|
|
||||||
//目录单价
|
|
||||||
private String cataloguePrice;
|
|
||||||
//指导折扣
|
|
||||||
private String guidanceDiscount;
|
|
||||||
|
|
||||||
/** 产品名称 */
|
|
||||||
@Excel(name = "产品名称")
|
@Excel(name = "产品名称")
|
||||||
private String productName;
|
private String productName;
|
||||||
|
|
||||||
/** 产品代码 */
|
|
||||||
@Excel(name = "产品代码")
|
@Excel(name = "产品代码")
|
||||||
private String model;
|
private String model;
|
||||||
|
private String type;
|
||||||
/** 产品描述 */
|
@Excel(name = "产品类型")
|
||||||
@Excel(name = "产品描述")
|
private String typeName;
|
||||||
private String description;
|
private String level2Type;
|
||||||
|
@Excel(name = "二级类型")
|
||||||
/** 创建时间 */
|
private String level2TypeName;
|
||||||
|
private String value;
|
||||||
|
@Excel(name = "目录单价")
|
||||||
|
private String cataloguePrice;
|
||||||
|
@Excel(name = "指导折扣")
|
||||||
|
private String guidanceDiscount;
|
||||||
|
@Excel(name = "制造商")
|
||||||
|
private String vendorCode;
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date createdAt;
|
private Date createdAt;
|
||||||
|
@Excel(name = "备注")
|
||||||
|
private String remark;
|
||||||
|
@Excel(name = "产品描述")
|
||||||
|
private String description;
|
||||||
|
@Excel(name = "终端类型")
|
||||||
|
private String terminalType;
|
||||||
|
@Excel(name = "国产化")
|
||||||
|
private String localization;
|
||||||
|
@Excel(name = "CPU品牌")
|
||||||
|
private String cpuBrand;
|
||||||
|
@Excel(name = "CPU架构")
|
||||||
|
private String cpuArchitecture;
|
||||||
|
|
||||||
/** 更新时间 */
|
/** 更新时间 */
|
||||||
private Date updatedAt;
|
private Date updatedAt;
|
||||||
|
|
@ -63,7 +71,6 @@ public class ProductInfo extends BaseEntity
|
||||||
/** 删除时间 */
|
/** 删除时间 */
|
||||||
private Date deletedAt;
|
private Date deletedAt;
|
||||||
private String serialNumber;
|
private String serialNumber;
|
||||||
private String vendorCode;
|
|
||||||
private List<String> vendorCodeList;
|
private List<String> vendorCodeList;
|
||||||
private String vendorName;
|
private String vendorName;
|
||||||
//实时库存
|
//实时库存
|
||||||
|
|
@ -73,16 +80,6 @@ public class ProductInfo extends BaseEntity
|
||||||
private Long inventoryCount;
|
private Long inventoryCount;
|
||||||
private Long warehouseId;
|
private Long warehouseId;
|
||||||
private String warehouseName;
|
private String warehouseName;
|
||||||
// 二级类型
|
|
||||||
private String level2Type;
|
|
||||||
// 终端类型
|
|
||||||
private String terminalType;
|
|
||||||
// 国产化
|
|
||||||
private String localization;
|
|
||||||
// CPU品牌
|
|
||||||
private String cpuBrand;
|
|
||||||
// CPU架构
|
|
||||||
private String cpuArchitecture;
|
|
||||||
@Getter
|
@Getter
|
||||||
public enum ProductTypeEnum {
|
public enum ProductTypeEnum {
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.ruoyi.sip.service.impl;
|
package com.ruoyi.sip.service.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
|
@ -30,6 +33,15 @@ import com.ruoyi.common.core.text.Convert;
|
||||||
@Service
|
@Service
|
||||||
public class ProductInfoServiceImpl implements IProductInfoService
|
public class ProductInfoServiceImpl implements IProductInfoService
|
||||||
{
|
{
|
||||||
|
private static final Map<String, String> PRODUCT_TYPE_DESC_MAP = Arrays.stream(ProductInfo.ProductTypeEnum.values())
|
||||||
|
.collect(Collectors.toMap(ProductInfo.ProductTypeEnum::getType, ProductInfo.ProductTypeEnum::getDesc));
|
||||||
|
private static final Map<String, String> SOFTWARE_LEVEL2_DESC_MAP = Arrays.stream(ProductInfo.ProductTypeLevel2SoftwareEnum.values())
|
||||||
|
.collect(Collectors.toMap(ProductInfo.ProductTypeLevel2SoftwareEnum::getType, ProductInfo.ProductTypeLevel2SoftwareEnum::getDesc));
|
||||||
|
private static final Map<String, String> HARDWARE_LEVEL2_DESC_MAP = Arrays.stream(ProductInfo.ProductTypeLevel2HardwareEnum.values())
|
||||||
|
.collect(Collectors.toMap(ProductInfo.ProductTypeLevel2HardwareEnum::getType, ProductInfo.ProductTypeLevel2HardwareEnum::getDesc));
|
||||||
|
private static final Map<String, String> SERVICE_LEVEL2_DESC_MAP = Arrays.stream(ProductInfo.ProductTypeLevel2ServiceEnum.values())
|
||||||
|
.collect(Collectors.toMap(ProductInfo.ProductTypeLevel2ServiceEnum::getType, ProductInfo.ProductTypeLevel2ServiceEnum::getDesc));
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProductInfoMapper productInfoMapper;
|
private ProductInfoMapper productInfoMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -57,7 +69,57 @@ public class ProductInfoServiceImpl implements IProductInfoService
|
||||||
@Override
|
@Override
|
||||||
public List<ProductInfo> selectProductInfoList(ProductInfo productInfo)
|
public List<ProductInfo> selectProductInfoList(ProductInfo productInfo)
|
||||||
{
|
{
|
||||||
return productInfoMapper.selectProductInfoList(productInfo);
|
List<ProductInfo> productInfoList = productInfoMapper.selectProductInfoList(productInfo);
|
||||||
|
if (CollUtil.isEmpty(productInfoList)) {
|
||||||
|
return productInfoList;
|
||||||
|
}
|
||||||
|
productInfoList.forEach(this::fillTypeDesc);
|
||||||
|
return productInfoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillTypeDesc(ProductInfo productInfo) {
|
||||||
|
if (productInfo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String typeName = PRODUCT_TYPE_DESC_MAP.get(productInfo.getType());
|
||||||
|
if (StringUtils.isNotEmpty(typeName)) {
|
||||||
|
productInfo.setTypeName(typeName);
|
||||||
|
}
|
||||||
|
String level2TypeName = resolveLevel2TypeName(productInfo.getType(), productInfo.getLevel2Type());
|
||||||
|
if (StringUtils.isNotEmpty(level2TypeName)) {
|
||||||
|
productInfo.setLevel2TypeName(level2TypeName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String resolveLevel2TypeName(String type, String level2Type) {
|
||||||
|
if (StringUtils.isEmpty(type) || StringUtils.isEmpty(level2Type)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (isSoftwareType(type)) {
|
||||||
|
return SOFTWARE_LEVEL2_DESC_MAP.get(level2Type);
|
||||||
|
}
|
||||||
|
if (isHardwareType(type)) {
|
||||||
|
return HARDWARE_LEVEL2_DESC_MAP.get(level2Type);
|
||||||
|
}
|
||||||
|
if (isServiceType(type)) {
|
||||||
|
return SERVICE_LEVEL2_DESC_MAP.get(level2Type);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isSoftwareType(String type) {
|
||||||
|
return Objects.equals(type, ProductInfo.ProductTypeEnum.SOFTWARE.getType())
|
||||||
|
|| Objects.equals(type, ProductInfo.ProductTypeEnum.SOFTWARE_MAINTENANCE.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isHardwareType(String type) {
|
||||||
|
return Objects.equals(type, ProductInfo.ProductTypeEnum.HARDWARE.getType())
|
||||||
|
|| Objects.equals(type, ProductInfo.ProductTypeEnum.HARDWARE_MAINTENANCE.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isServiceType(String type) {
|
||||||
|
return Objects.equals(type, ProductInfo.ProductTypeEnum.SERVICE.getType())
|
||||||
|
|| Objects.equals(type, ProductInfo.ProductTypeEnum.PROVINCE_SERVICE.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue