TASK:mannequin;

This commit is contained in:
shahaibo
2025-05-28 09:37:27 +08:00
parent d3b4d15df8
commit 1be4701f6d
16 changed files with 204 additions and 40 deletions

View File

@@ -29,7 +29,6 @@ import com.google.common.collect.Maps;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -45,7 +44,6 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.HttpURLConnection;
import java.net.URLEncoder;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
@@ -350,7 +348,7 @@ public class PythonService {
private DesignPythonObject createDesignPythonObject(ValidateElementVO elementVO, CurrentDesignPictureTypeEnum designPictureType, BigDecimal systemScale, String singleOverall, String switchCategory, int i) {
DesignPythonObject pythonObject = new DesignPythonObject();
pythonObject.setItems(coverToDesignPythonItemNew(elementVO, designPictureType, systemScale));
pythonObject.setBasic(coverToBasic(pythonObject.getItems().get(0), singleOverall, switchCategory, elementVO.getDesignLibraryModelPoint()));
pythonObject.setBasic(coverToBasic(pythonObject.getItems().get(0), singleOverall, switchCategory, elementVO.getDesignLibraryModelPoint(), elementVO.getMannequins()));
if (CollectionUtil.isNotEmpty(elementVO.getRequestIdList())) {
pythonObject.setObjectSign(elementVO.getRequestIdList().get(i));
}
@@ -2169,7 +2167,7 @@ public class PythonService {
}
private DesignPythonBasic coverToBasic(DesignPythonItem designPythonItem, String singleOverall,
String switchCategory, DesignLibraryModelPointVO designLibraryModelPoint) {
String switchCategory, DesignLibraryModelPointVO designLibraryModelPoint, List<DesignLibraryModelPointVO> mannequins) {
DesignPythonBasic basic = new DesignPythonBasic();
basic.setSingle_overall(singleOverall);
basic.setSwitch_category(switchCategory);
@@ -2182,12 +2180,25 @@ public class PythonService {
basic.setSelf_template(Boolean.TRUE);
}
basic.setScale_earrings(0.16);
basic.setBody_point_test(getMap(designLibraryModelPoint));
if (!CollectionUtils.isEmpty(mannequins)) {
DesignLibraryModelPointVO vo = getRandomDesignLibraryModelPoint(mannequins);
basic.setBody_point_test(getMap(vo));
}else {
basic.setBody_point_test(getMap(designLibraryModelPoint));
}
return basic;
}
private Map<String, List<Integer>> getMap(DesignLibraryModelPointVO designLibraryModelPointOld) {
Map<String, List<Integer>> body_point = Maps.newHashMap();
private DesignLibraryModelPointVO getRandomDesignLibraryModelPoint(List<DesignLibraryModelPointVO> mannequins) {
DesignLibraryModelPointVO vo = new DesignLibraryModelPointVO();
Random random = new Random();
int randomNumber = random.nextInt(mannequins.size());
return mannequins.get(randomNumber);
}
private Map<String, Object> getMap(DesignLibraryModelPointVO designLibraryModelPointOld) {
Map<String, Object> body_point = Maps.newHashMap();
if (Objects.nonNull(designLibraryModelPointOld)) {
DesignLibraryModelPointVO designLibraryModelPoint =
CopyUtil.copyObject(designLibraryModelPointOld, DesignLibraryModelPointVO.class);
@@ -2198,6 +2209,8 @@ public class PythonService {
body_point.put("waistband_right", resolve(designLibraryModelPoint.getWaistbandRight()));
body_point.put("hand_point_left", resolve(designLibraryModelPoint.getHandLeft()));
body_point.put("hand_point_right", resolve(designLibraryModelPoint.getHandRight()));
body_point.put("relation_id", designLibraryModelPoint.getRelationId());
body_point.put("relation_type", designLibraryModelPoint.getRelationType());
} else {
//默认是13个点
body_point.put("shoulder_left", Arrays.asList(755, 519));