Merge branch 'main' of ssh://192.168.1.205:9922/cf_devdept2/cf_imes_server

This commit is contained in:
lym
2024-08-30 16:20:40 +08:00
21 changed files with 279 additions and 75 deletions
@@ -27,7 +27,7 @@ public class OrderGoodsPlateRespVO implements Comparable<OrderGoodsPlateRespVO>
private String color;
@Schema(description = "纹路")
private Integer texture;
private Boolean texture;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal width;
@@ -33,6 +33,7 @@ import com.cf.imes.module.system.api.dict.DictDataApi;
import com.cf.imes.module.system.api.dict.dto.DictDataRespDTO;
import com.cf.imes.module.system.enums.DictTypeConstants;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@@ -290,12 +291,10 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
seriesItem.put("id", entry.getKey());
// 材质-商品名称-颜色-纹理-宽-高-厚-品牌
OrderGoodsPlateRespVO orderGoodsPlateRespVO = entry.getValue();
// 获取纹路描述
DictDataRespDTO grainDTO = dictDataApi.getDictData(DictTypeConstants.GRAIN_TYPE, String.valueOf(orderGoodsPlateRespVO.getTexture())).getData();
String texture = ObjectUtil.isNotNull(grainDTO) ? grainDTO.getLabel() : "";
seriesItem.put("name", orderGoodsPlateRespVO.getMaterial() + "-" + orderGoodsPlateRespVO.getGoodsName() +
"-" + orderGoodsPlateRespVO.getColor() + "-" + texture + "-" + stripTrailingZeros(orderGoodsPlateRespVO.getWidth()) +
"×" + stripTrailingZeros(orderGoodsPlateRespVO.getHeight()) + "×" + stripTrailingZeros(orderGoodsPlateRespVO.getThickness()) + "-" + orderGoodsPlateRespVO.getBrand());
String specification = formatGoodsName('x', stripTrailingZeros(orderGoodsPlateRespVO.getWidth()),
stripTrailingZeros(orderGoodsPlateRespVO.getHeight()), stripTrailingZeros(orderGoodsPlateRespVO.getThickness()));
String goodsName = formatGoodsName('-', orderGoodsPlateRespVO.getMaterial(), orderGoodsPlateRespVO.getGoodsName(), orderGoodsPlateRespVO.getColor(), getTextureFromDict(orderGoodsPlateRespVO.getTexture()), specification, orderGoodsPlateRespVO.getBrand());
seriesItem.put("name", goodsName);
series.add(seriesItem);
}
resultMap.put(DATELIST_FIELD_NAME, dateList.stream().map(date -> generateDateRangeAxis(date, reqVO.getUnit())).toList());
@@ -362,12 +361,10 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
seriesItem.put("id", entry.getKey());
// 材质-商品名称-颜色-纹理-宽-高-厚-品牌
OrderGoodsPlateRespVO orderGoodsPlateRespVO = entry.getValue();
// 获取纹路描述
DictDataRespDTO grainDTO = dictDataApi.getDictData(DictTypeConstants.GRAIN_TYPE, String.valueOf(orderGoodsPlateRespVO.getTexture())).getData();
String texture = ObjectUtil.isNotNull(grainDTO) ? grainDTO.getLabel() : "";
seriesItem.put("name", orderGoodsPlateRespVO.getMaterial() + "-" + orderGoodsPlateRespVO.getGoodsName() +
"-" + orderGoodsPlateRespVO.getColor() + "-" + texture + "-" + stripTrailingZeros(orderGoodsPlateRespVO.getWidth()) +
"×" + stripTrailingZeros(orderGoodsPlateRespVO.getHeight()) + "×" + stripTrailingZeros(orderGoodsPlateRespVO.getThickness()) + "-" + orderGoodsPlateRespVO.getBrand());
String specification = formatGoodsName('x', stripTrailingZeros(orderGoodsPlateRespVO.getWidth()),
stripTrailingZeros(orderGoodsPlateRespVO.getHeight()), stripTrailingZeros(orderGoodsPlateRespVO.getThickness()));
String goodsName = formatGoodsName('-', orderGoodsPlateRespVO.getMaterial(), orderGoodsPlateRespVO.getGoodsName(), orderGoodsPlateRespVO.getColor(), getTextureFromDict(orderGoodsPlateRespVO.getTexture()), specification, orderGoodsPlateRespVO.getBrand());
seriesItem.put("name", goodsName);
series.add(seriesItem);
}
resultMap.put(DATELIST_FIELD_NAME, dateList.stream().map(date -> generateDateRangeAxis(date, reqVO.getUnit())).toList());
@@ -485,9 +482,10 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
}
// 任意取一个类型
PlateGoodDO plateGoodDO = plateGoodDOList.get(0);
seriesItem.put("name", plateGoodDO.getMaterial() + "-" + plateGoodDO.getGoodsName() +
"-" + plateGoodDO.getColor() + "-" + getTextureFromDict(plateGoodDO) + "-" + stripTrailingZeros(BigDecimal.valueOf(plateGoodDO.getWidth())) +
"×" + stripTrailingZeros(BigDecimal.valueOf(plateGoodDO.getHeight())) + "×" + stripTrailingZeros(BigDecimal.valueOf(plateGoodDO.getThickness())) + "-" + plateGoodDO.getBrand());
String specification = formatGoodsName('x', stripTrailingZeros(BigDecimal.valueOf(plateGoodDO.getWidth())),
stripTrailingZeros(BigDecimal.valueOf(plateGoodDO.getHeight())), stripTrailingZeros(BigDecimal.valueOf(plateGoodDO.getThickness())));
String goodsName = formatGoodsName('-', plateGoodDO.getMaterial(), plateGoodDO.getGoodsName(), plateGoodDO.getColor(), getTextureFromDict(plateGoodDO.getTexture()), specification, plateGoodDO.getBrand());
seriesItem.put("name", goodsName);
series.add(seriesItem);
}
resultMap.put(DATELIST_FIELD_NAME, dateList.stream().map(date -> generateDateRangeAxis(date, unit)).toList());
@@ -498,18 +496,44 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
return resultMap;
}
/**
* 板材信息用-连接
*
* @param connChar 连接符
* @param texts 信息内容
* @return 为空时不带connChar
*/
private String formatGoodsName(char connChar, String... texts) {
StringBuilder sb = new StringBuilder();
for (String text : texts) {
if (StringUtils.isNotEmpty(text)) {
sb.append(text).append(connChar);
}
}
// 移除最后一个 -
if (sb.length() > 0 && sb.charAt(sb.length() - 1) == connChar) {
sb.deleteCharAt(sb.length() - 1);
}
return sb.toString();
}
/**
* 根据纹路枚举获取字典中纹路描述
* @param plateGoodDO
*
* @param texture
* @return
*/
private String getTextureFromDict(PlateGoodDO plateGoodDO) {
private String getTextureFromDict(Boolean texture) {
if (ObjectUtil.isNull(texture)) {
return "";
}
// 获取纹路描述
DictDataRespDTO grainDTO = dictDataApi.getDictData(DictTypeConstants.GRAIN_TYPE, String.valueOf(plateGoodDO.getTexture())).getData();
DictDataRespDTO grainDTO = dictDataApi.getDictData(DictTypeConstants.PLATE_TEXTURE_TYPE, String.valueOf(texture)).getData();
if (ObjectUtil.isNotNull(grainDTO)) {
return grainDTO.getLabel();
return Objects.equals("", grainDTO.getLabel()) ? "" : "";
} else {
return "";
return "";
}
}