3 Commits

Author SHA1 Message Date
501032ef17 TASK:试用用户试用期延长至7天 2025-12-31 13:15:13 +08:00
litianxiang
cb25bdd2e0 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2025-12-29 14:57:41 +08:00
litianxiang
7a9fb0213b 适配新推荐接口 2025-12-29 13:49:31 +08:00
4 changed files with 49 additions and 26 deletions

View File

@@ -23,5 +23,8 @@ public class UserPreferenceLogTest implements Serializable {
private Long accountId;
private String path;
private LocalDateTime dataTime;
private String category;
private String style;
private Long sysFileId;
}

View File

@@ -3960,27 +3960,27 @@ public class PythonService {
public List<String> getSystemSketchByCategory(String category, Long brandId, Double brandScale,String style) {
//******3.1.2版本临时使用java推荐方案去解决style未使用的问题**********
try {
//使用新库attribute_retrieval_style表命名修改为elementVO.getModelSex().toLowerCase() + "_" + styleCategory.toLowerCase()比如female_skirt,与传入的category保持一致
Integer countByStyle = attributeRetrievalMapper.getCountByStyle(category, style);
//根据数量随机获取一个系统sketch
if (countByStyle > 0) {
//获取一个不大于countByStyle的随机整数
Integer randomNum = RandomUtils.nextInt(0, countByStyle);
//返回格式为 dress/0902000649.jpg
String oneSystemSketchRadom = attributeRetrievalMapper.getOneSystemSketchRadom(category, style,randomNum);
String imgName = oneSystemSketchRadom.split("/")[1];
//补齐正确格式aida-sys-image/images/male/tops/mens_test_5689.png
//裁切category前半部分
String sex = category.split("_")[0];
String realCategory = category.split("_")[1];
String path = "aida-sys-image/images/" + sex + "/" +realCategory +"/" +imgName;
return Arrays.asList(path);
}
} catch (Exception e) {
log.info("推荐失败:{}",e.getMessage());
throw new BusinessException("system.error");
}
// try {
// //使用新库attribute_retrieval_style表命名修改为elementVO.getModelSex().toLowerCase() + "_" + styleCategory.toLowerCase()比如female_skirt,与传入的category保持一致
// Integer countByStyle = attributeRetrievalMapper.getCountByStyle(category, style);
// //根据数量随机获取一个系统sketch
// if (countByStyle > 0) {
// //获取一个不大于countByStyle的随机整数
// Integer randomNum = RandomUtils.nextInt(0, countByStyle);
// //返回格式为 dress/0902000649.jpg
// String oneSystemSketchRadom = attributeRetrievalMapper.getOneSystemSketchRadom(category, style,randomNum);
// String imgName = oneSystemSketchRadom.split("/")[1];
// //补齐正确格式aida-sys-image/images/male/tops/mens_test_5689.png
// //裁切category前半部分
// String sex = category.split("_")[0];
// String realCategory = category.split("_")[1];
// String path = "aida-sys-image/images/" + sex + "/" +realCategory +"/" +imgName;
// return Arrays.asList(path);
// }
// } catch (Exception e) {
// log.info("推荐失败:{}",e.getMessage());
// throw new BusinessException("system.error");
// }
//**********************end***********************************
AuthPrincipalVo userHolder = UserContext.getUserHolder();
@@ -3999,13 +3999,19 @@ public class PythonService {
String brandIdParam = (brandId != null) ? "" + brandId : "-1";
String brandScaleParam = (brandScale != null) ? String.format("%.2f", brandScale) : "0.00";
String url = String.format("%s:%s/api/recommend/%d/%s/1/%s/%s",
String baseUrl = String.format("%s:%s/api/recommend/%d/%s",
"http://18.167.251.121",
accessPythonPort,
userHolder.getId(),
category,
brandIdParam,
brandScaleParam);
category);
// 如果style不为空则添加到查询参数中
String url;
if (style != null && !style.isEmpty()) {
url = baseUrl + "?style=" + style;
} else {
url = baseUrl;
}
log.info("Recommendation request URL: {}", url);

View File

@@ -1284,7 +1284,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
account.setSystemUser(3);
account.setIsTrial(1);
account.setCredits(BigDecimal.valueOf(50));
account.setValidEndTime(toDayEnd(Instant.now().plus(5, ChronoUnit.DAYS).toEpochMilli()));
// 广场用户试用延长至7天
account.setValidEndTime(toDayEnd(Instant.now().plus(7, ChronoUnit.DAYS).toEpochMilli()));
account.setIsBeginner(1);
account.setValidStartTime(Instant.now().toEpochMilli());
account.setCreateDate(new Date());

View File

@@ -23,6 +23,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -1134,7 +1135,19 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
UserPreferenceLogTest userPreferenceLogTest = new UserPreferenceLogTest();
userPreferenceLogTest.setPath(designItemDetail.getPath());
SysFile sysFile = sysFileService.getOne(new LambdaQueryWrapper<SysFile>().eq(SysFile::getUrl, designItemDetail.getPath()));
userPreferenceLogTest.setAccountId(userHolder.getId());
if (sysFile != null){
userPreferenceLogTest.setCategory(sysFile.getLevel3Type().toLowerCase()+"_"+sysFile.getLevel2Type().toLowerCase());
userPreferenceLogTest.setSysFileId(sysFile.getId());
userPreferenceLogTest.setStyle(sysFile.getStyle());
}else {
log.error("sysFile not found:{}",designItemDetail.getPath());
SendEmailUtil.commonExceptionReminder("url在sysFile里找不到"+designItemDetail.getPath(), new String[]{"litianxiangxtt@163.com"});
continue;
}
// userPreferenceLogTest.setUserLikeGroupId(userLike.getUserLikeGroupId());
userPreferenceLogTest.setDataTime(designItemDetail.getCreateDate().toInstant()
.atZone(ZoneId.systemDefault())