TASK:mixi;
This commit is contained in:
@@ -91,6 +91,12 @@ public class AppProductController {
|
||||
public Response<PageBaseResponse<AppNewProductVO>> searchProductPage(@Valid @RequestBody SearchProductPageDTO query) {
|
||||
return Response.success(tAppProductService.searchProductPage(query));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "检索商品分页列表")
|
||||
@PostMapping("/searchAIProductPage")
|
||||
public Response<PageBaseResponse<AppNewProductVO>> searchAIProductPage(@Valid @RequestBody OutfitRecommendation outfitRecommendation) {
|
||||
return Response.success(tAppProductService.searchAIProductPage(outfitRecommendation));
|
||||
}
|
||||
@ApiOperation(value = "下拉-查询所有属性值")
|
||||
@GetMapping("/queryAllAttribute")
|
||||
public Response<List<AttributeVO>> queryAllAttribute() {
|
||||
|
||||
@@ -9,4 +9,7 @@ import java.util.List;
|
||||
@Data
|
||||
public class TaskRuleDTO extends TaskRule {
|
||||
private List<TaskCondition> taskConditionList;
|
||||
|
||||
private String startTimeString;
|
||||
private String endTimeString;
|
||||
}
|
||||
|
||||
@@ -943,4 +943,86 @@ public class TAppProductService extends ServiceImpl<TProductMapper, TProduct> {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public PageBaseResponse<AppNewProductVO> searchAIProductPage(OutfitRecommendation outfitRecommendation) {
|
||||
List<String> imageUrls = outfitRecommendation.getImageUrls();
|
||||
List<String> pictureNames = new ArrayList<>();
|
||||
for (String imageUrl : imageUrls) {
|
||||
String[] split = imageUrl.split("\\.jpg\\?");
|
||||
String s = split[0];
|
||||
String[] split1 = s.split("/");
|
||||
String pictureName = split1[split1.length - 1];
|
||||
pictureNames.add(pictureName);
|
||||
}
|
||||
|
||||
// 分页数据
|
||||
QueryWrapper<TProduct> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("picture_name", pictureNames);
|
||||
|
||||
//上架
|
||||
queryWrapper.eq("on_sale_state", 1);
|
||||
queryWrapper.eq("upload_state", 1);
|
||||
queryWrapper.orderByDesc("id");
|
||||
IPage<TProduct> page = getBaseMapper().selectPage(
|
||||
new Page<>(1, 20), queryWrapper);
|
||||
if (CollectionUtils.isEmpty(page.getRecords())) {
|
||||
return PageBaseResponse.success(new Page<>());
|
||||
}
|
||||
List<Long> productIds = page.getRecords().stream().map(TProduct::getId).collect(Collectors.toList());
|
||||
Map<Long,List<TProductLabel>> productToLabelMap = productLabelService.findByProductIds(productIds);
|
||||
List<Long> labelIds = productToLabelMap.values()
|
||||
.stream()
|
||||
.map(list->list.stream().map(TProductLabel::getLabelId).collect(Collectors.toList()))
|
||||
.flatMap(List::stream).collect(Collectors.toList());
|
||||
//标签map
|
||||
Map<Long,TLabel> labelMap = labelService.queryMapByIds(labelIds);
|
||||
IPage<AppNewProductVO> convert = page.convert((Function<TProduct, AppNewProductVO>)
|
||||
product ->
|
||||
{
|
||||
AppNewProductVO result = CopyUtil.copyObject(product, AppNewProductVO.class);
|
||||
result.setId(product.getId().toString());
|
||||
result.setPictureUrl(minioUtil.getPresignedUrl(result.getPictureUrl(), 24 * 60));
|
||||
QueryWrapper<MiTuProduct> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(MiTuProduct::getProductId, result.getId());
|
||||
List<MiTuProduct> miTuProductList = miTuProductMapper.selectList(qw);
|
||||
result.setPluCode(miTuProductList.get(0).getPluCode());
|
||||
result.setProductLabelInfo(CopyUtil.copyList(productToLabelMap.get(product.getId()),ProductLabelVO.class,(o,d) ->{
|
||||
d.setId(o.getLabelId().toString());
|
||||
d.setName(labelMap.get(o.getLabelId()).getName());
|
||||
d.setType(labelMap.get(o.getLabelId()).getType());
|
||||
}));
|
||||
// if (!StringUtils.isEmpty(query.getStoreId())) {
|
||||
// QueryWrapper<TProductStock> productStockQueryWrapper = new QueryWrapper<>();
|
||||
// productStockQueryWrapper.lambda().eq(TProductStock::getStoreId, query.getStoreId());
|
||||
// productStockQueryWrapper.lambda().eq(TProductStock::getProductId, result.getId());
|
||||
// productStockQueryWrapper.lambda().orderByDesc(TProductStock::getCreateDate);
|
||||
// List<TProductStock> list = tProductStockService.list(productStockQueryWrapper);
|
||||
// if (CollectionUtils.isEmpty(list)) {
|
||||
// result.setIsSoldOut(1);
|
||||
// }else {
|
||||
// TProductStock tProductStock = list.get(0);
|
||||
// if (tProductStockService.hasPositiveStock(tProductStock)) {
|
||||
// result.setIsSoldOut(0);
|
||||
// }else {
|
||||
// result.setIsSoldOut(1);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return result;
|
||||
});
|
||||
// List<AppNewProductVO> records = convert.getRecords();
|
||||
// List<AppNewProductVO> newRecords = new ArrayList<>();
|
||||
// for (AppNewProductVO record : records) {
|
||||
// if (record.getIsSoldOut() == 0) {
|
||||
// newRecords.add(record);
|
||||
// }
|
||||
// }
|
||||
// for (AppNewProductVO record : records) {
|
||||
// if (record.getIsSoldOut() == 1) {
|
||||
// newRecords.add(record);
|
||||
// }
|
||||
// }
|
||||
// convert.setRecords(newRecords);
|
||||
return PageBaseResponse.success(convert);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,20 @@ public class SalesIncentivesServiceImpl extends ServiceImpl<TaskRuleMapper, Task
|
||||
taskConditionMapper.insert(taskCondition);
|
||||
}
|
||||
}else {
|
||||
// 定义日期时间格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
if (!StringUtils.isEmpty(taskRuleDTO.getStartTimeString())) {
|
||||
// 将字符串解析为LocalDateTime
|
||||
LocalDateTime startTime = LocalDateTime.parse(taskRuleDTO.getStartTimeString(), formatter);
|
||||
// 设置taskRule的startTime
|
||||
taskRule.setStartTime(startTime);
|
||||
}
|
||||
if (!StringUtils.isEmpty(taskRuleDTO.getEndTimeString())) {
|
||||
// 将字符串解析为LocalDateTime
|
||||
LocalDateTime endTime = LocalDateTime.parse(taskRuleDTO.getEndTimeString(), formatter);
|
||||
// 设置taskRule的startTime
|
||||
taskRule.setEndTime(endTime);
|
||||
}
|
||||
taskRuleMapper.updateById(taskRule);
|
||||
|
||||
// deleteBatchByTaskId(taskRule.getId());
|
||||
|
||||
Reference in New Issue
Block a user