Merge branch 'dev/dev_xp' into dev/dev

This commit is contained in:
2025-04-02 13:34:11 +08:00
5 changed files with 14 additions and 37 deletions

View File

@@ -28,6 +28,7 @@ import javax.validation.Valid;
import java.io.File;
import java.text.ParseException;
import java.util.Date;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
@@ -205,7 +206,7 @@ public class LibraryController {
@ApiOperation(value = "将系统模特添加到个人library")
@GetMapping("addSysModelToLib")
public Response<Long> addSysModelToLib(@ApiParam("系统模特id") @RequestParam("sysModelId")long sysModelId){
public Response<Map<String, String>> addSysModelToLib(@ApiParam("系统模特id") @RequestParam("sysModelId")long sysModelId){
return Response.success(libraryService.addSysModelToLib(sysModelId));
}

View File

@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@Data
@@ -35,34 +34,4 @@ public class ModifyModelProportionDTO {
@NotBlank(message = "modelPath type cannot be empty")
private String modelPath;
/* @NotNull(message = "handLeft cannot be null")
@NotEmpty(message = "handLeft cannot be empty")
@ApiModelProperty("handLeft")
private Float[] handLeft;
@NotNull(message = "handRight cannot be null")
@NotEmpty(message = "handRight cannot be empty")
@ApiModelProperty("handRight")
private Float[] handRight;
@NotNull(message = "shoulderLeft cannot be null")
@NotEmpty(message = "shoulderLeft cannot be empty")
@ApiModelProperty("shoulderLeft")
private Float[] shoulderLeft;
@NotNull(message = "shoulderRight cannot be null")
@NotEmpty(message = "shoulderRight cannot be empty")
@ApiModelProperty("shoulderRight")
private Float[] shoulderRight;
@NotNull(message = "waistbandLeft cannot be null")
@NotEmpty(message = "waistbandLeft cannot be empty")
@ApiModelProperty("waistbandLeft")
private Float[] waistbandLeft;
@NotNull(message = "waistbandRight cannot be null")
@NotEmpty(message = "waistbandRight cannot be empty")
@ApiModelProperty("waistbandRight")
private Float[] waistbandRight;*/
}

View File

@@ -8,9 +8,9 @@ import com.ai.da.model.vo.LibraryVo;
import com.ai.da.model.vo.QueryLibraryPageVO;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.Valid;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
/**
* 服务类
@@ -89,5 +89,5 @@ public interface LibraryService extends IService<Library> {
void moveLibraryDate() throws ParseException;
Long addSysModelToLib(long sysModelId);
Map<String, String> addSysModelToLib(long sysModelId);
}

View File

@@ -24,6 +24,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -69,7 +70,7 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
// 当前模特路径
String url = libraryModelPointDTO.getModelPath();
// 标志是否有更改过模特比例(即更换模特图)
boolean flag = url.equals(libModel.getUrl());
boolean flag = !url.equals(libModel.getUrl());
if (libraryModelPointDTO.getIsCovered() && Objects.nonNull(libraryModelPointDTO.getTemplateId())){
// 覆盖保存,即更新原有数据(点位数据和模特图片)
@@ -102,6 +103,8 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
saveAsModel.setAccountId(libModel.getAccountId());
saveAsModel.setLevel1Type(libModel.getLevel1Type());
saveAsModel.setLevel2Type(libModel.getLevel2Type());
String ageGroup = StringUtil.isNullOrEmpty(libModel.getLevel3Type()) ? "Adult" : libModel.getLevel3Type();
saveAsModel.setLevel3Type(ageGroup);
saveAsModel.setName(DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD));
saveAsModel.setUrl(url);
saveAsModel.setMd5(MD5Utils.encryptFile(minioUtil.getPreSignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME), false));

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.exceptions.ExceptionUtil;
import com.ai.da.common.config.FileProperties;
import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.common.constant.CommonConstant;
import com.ai.da.common.context.UserContext;
import com.ai.da.common.enums.*;
import com.ai.da.common.response.PageBaseResponse;
@@ -842,7 +843,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
}
@Override
public Long addSysModelToLib(long sysModelId) {
public Map<String, String> addSysModelToLib(long sysModelId) {
Long accountId = UserContext.getUserHolder().getId();
SysFile sysFile = sysFileMapper.selectById(sysModelId);
if (Objects.isNull(sysFile)) {
@@ -871,6 +872,9 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
sysModelPoint.setCreateDate(new Date());
libraryModelPointService.save(sysModelPoint);
return library.getId();
Map<String, String> resp = new HashMap<>();
resp.put("id", library.getId().toString());
resp.put("url", minioUtil.getPreSignedUrl(library.getUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
return resp;
}
}