TASK:mixi;
This commit is contained in:
@@ -787,13 +787,13 @@ public class TProductService extends ServiceImpl<TProductMapper, TProduct> {
|
||||
if (originalFilename == null) {
|
||||
throw new BusinessException("file name is null.");
|
||||
}
|
||||
String itemNameColorCode = originalFilename.substring(0, originalFilename.lastIndexOf('.'));
|
||||
String fileName = originalFilename.substring(0, originalFilename.lastIndexOf('.'));
|
||||
// 根据itemName查询mi-tu商品信息
|
||||
// 根据最后一个"_"分割itemNameColorCode
|
||||
int lastUnderscoreIndex = itemNameColorCode.lastIndexOf("_");
|
||||
// int lastUnderscoreIndex = itemNameColorCode.lastIndexOf("_");
|
||||
|
||||
// String itemName = itemNameColorCode.substring(0, lastUnderscoreIndex);
|
||||
String colorCode = itemNameColorCode.substring(lastUnderscoreIndex + 1);
|
||||
// String colorCode = itemNameColorCode.substring(lastUnderscoreIndex + 1);
|
||||
// List<MiTuProduct> miTuProductList = getMiTuProductList(itemName, colorCode);
|
||||
int total = 0;
|
||||
// for (MiTuProduct miTuProduct : miTuProductList) {
|
||||
@@ -806,17 +806,19 @@ public class TProductService extends ServiceImpl<TProductMapper, TProduct> {
|
||||
String minioFullPath = minioUtil.upload(MI_TU_BUCKET_NAME, minioPath, file);
|
||||
TProduct saveProduct = new TProduct();
|
||||
saveProduct.setAccountId(accountId);
|
||||
saveProduct.setPrice(BigDecimal.valueOf(1000.0d));
|
||||
Random random = new Random();
|
||||
double randomDouble = 500 + (1500 - 500) * random.nextDouble();
|
||||
saveProduct.setPrice(BigDecimal.valueOf(randomDouble));
|
||||
saveProduct.setOnSaleState(1);
|
||||
//上传中
|
||||
saveProduct.setUploadState(0);
|
||||
saveProduct.setPictureUrl(minioFullPath);
|
||||
saveProduct.setPictureName(itemNameColorCode);
|
||||
saveProduct.setPictureName(fileName);
|
||||
saveProduct.setMd5(md5);
|
||||
//按时区计算
|
||||
saveProduct.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
|
||||
saveProduct.setColor(colorCode);
|
||||
// saveProduct.setColor(colorCode);
|
||||
// 根据当前已有店铺查询商品店铺库存
|
||||
// List<MiTuProductStock> miTuProductStock = new ArrayList<>();
|
||||
// List<TStore> storeList = storeService.list();
|
||||
@@ -832,7 +834,9 @@ public class TProductService extends ServiceImpl<TProductMapper, TProduct> {
|
||||
// for (MiTuProductStock tuProductStock : miTuProductStock) {
|
||||
// total = total + tuProductStock.getNum();
|
||||
// }
|
||||
saveProduct.setTotal(10);
|
||||
// Random random = new Random();
|
||||
int randomNumber = random.nextInt(16) + 5;
|
||||
saveProduct.setTotal(randomNumber);
|
||||
tProductMapper.insert(saveProduct);
|
||||
// List<TProductStock> productStockList = new ArrayList<>();
|
||||
// HashMap<String, List<BatchUploadProductStoreStockDTO>> map = new HashMap<>();
|
||||
@@ -1230,8 +1234,9 @@ public class TProductService extends ServiceImpl<TProductMapper, TProduct> {
|
||||
// vo.setItem_name(tProduct.getPictureName().split("_")[0]);
|
||||
vo.setItem_name(tProduct.getPictureName());
|
||||
vo.setImage_path(tProduct.getPictureUrl());
|
||||
String[] split = tProduct.getPictureUrl().split("/");
|
||||
vo.setSemantic_category(split[2] + "/" + split[3]);
|
||||
String attributeItem = getProductAttributeItem(tProduct.getId());
|
||||
// String[] split = tProduct.getPictureUrl().split("/");
|
||||
vo.setSemantic_category(attributeItem);
|
||||
query.add(vo);
|
||||
}
|
||||
for (TProduct tProduct : db) {
|
||||
@@ -1239,8 +1244,9 @@ public class TProductService extends ServiceImpl<TProductMapper, TProduct> {
|
||||
// vo.setItem_name(tProduct.getPictureName().split("_")[0]);
|
||||
vo.setItem_name(tProduct.getPictureName());
|
||||
vo.setImage_path(tProduct.getPictureUrl());
|
||||
String[] split = tProduct.getPictureUrl().split("/");
|
||||
vo.setSemantic_category(split[2] + "/" + split[3]);
|
||||
String attributeItem = getProductAttributeItem(tProduct.getId());
|
||||
// String[] split = tProduct.getPictureUrl().split("/");
|
||||
vo.setSemantic_category(attributeItem);
|
||||
database.add(vo);
|
||||
}
|
||||
List<GenerateCollocationOutVO> collocationOutResult = pythonService.generateCollocationNew(query, database);
|
||||
@@ -1277,6 +1283,16 @@ public class TProductService extends ServiceImpl<TProductMapper, TProduct> {
|
||||
return result;
|
||||
}
|
||||
|
||||
private String getProductAttributeItem(Long id) {
|
||||
QueryWrapper<TProductAttribute> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(TProductAttribute::getProductId, id);
|
||||
List<TProductAttribute> list = tProductAttributeService.list(qw);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return null;
|
||||
}
|
||||
return list.get(0).getAttributeItem();
|
||||
}
|
||||
|
||||
private Collection<TProductAssortment> resolveProductAssortmentNew(List<GenerateCollocationOutVO> collocationOutResult, String timeZone) {
|
||||
log.info("获取python推荐搭配总数据是###{}", JSON.toJSONString(collocationOutResult));
|
||||
List<TProductAssortment> result = Lists.newArrayList();
|
||||
|
||||
Reference in New Issue
Block a user