TASK:mannequin;
This commit is contained in:
@@ -29,7 +29,7 @@ public enum CollectionLevel1TypeEnum {
|
|||||||
*/
|
*/
|
||||||
MARKETING_SKETCH("MarketingSketch"),
|
MARKETING_SKETCH("MarketingSketch"),
|
||||||
|
|
||||||
MANNEQUIN("Mannequin");
|
MODEL("Models");
|
||||||
|
|
||||||
private String realName;
|
private String realName;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.ai.da.mapper.primary;
|
||||||
|
|
||||||
|
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||||
|
import com.ai.da.mapper.primary.entity.CollectionElementRelModel;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public interface CollectionElementRelModelMapper extends CommonMapper<CollectionElementRelModel> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.ai.da.mapper.primary.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("collection_element_rel_model")
|
||||||
|
public class CollectionElementRelModel implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Long relationId;
|
||||||
|
|
||||||
|
private String relationType;
|
||||||
|
|
||||||
|
private Long collectionElementId;
|
||||||
|
|
||||||
|
private String ageGroup;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -63,6 +63,9 @@ public class DesignItem implements Serializable {
|
|||||||
@TableField("is_like")
|
@TableField("is_like")
|
||||||
private Byte hasLike;
|
private Byte hasLike;
|
||||||
|
|
||||||
|
private Long relationId;
|
||||||
|
private String modelType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ public class DesignCollectionDTO {
|
|||||||
@ApiModelProperty("手稿板图片id 数组")
|
@ApiModelProperty("手稿板图片id 数组")
|
||||||
private List<CollectionSketchDTO> sketchBoards;
|
private List<CollectionSketchDTO> sketchBoards;
|
||||||
|
|
||||||
|
private List<MannequinDTO> mannequins;
|
||||||
|
|
||||||
@NotNull(message = "systemScale.cannot.be.empty")
|
@NotNull(message = "systemScale.cannot.be.empty")
|
||||||
@ApiModelProperty("系统取图比列")
|
@ApiModelProperty("系统取图比列")
|
||||||
private BigDecimal systemScale;
|
private BigDecimal systemScale;
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import lombok.NoArgsConstructor;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class MannequinDTO {
|
public class MannequinDTO {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
private Long collectionElementId;
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
// private String modelType;
|
// private String modelType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,4 +46,7 @@ public class CollectionElementVO {
|
|||||||
|
|
||||||
private List<String> segmentedImages;
|
private List<String> segmentedImages;
|
||||||
|
|
||||||
|
private Long mannequinRelationId;
|
||||||
|
private String mannequinRelationType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,5 +40,9 @@ public class DesignLibraryModelPointVO implements Serializable {
|
|||||||
|
|
||||||
private String templateUrl;
|
private String templateUrl;
|
||||||
|
|
||||||
|
private Long relationId;
|
||||||
|
|
||||||
|
private String relationType;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,4 +35,6 @@ public class ModuleChooseVO {
|
|||||||
private SketchReconstructionVO deReconstruction;
|
private SketchReconstructionVO deReconstruction;
|
||||||
|
|
||||||
private ThreeDModuleVO patternMaking3D;
|
private ThreeDModuleVO patternMaking3D;
|
||||||
|
|
||||||
|
private List<CollectionElementVO> mannequin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("用户choose详细-响应")
|
@ApiModel("用户choose详细-响应")
|
||||||
@@ -15,7 +17,7 @@ public class UserLikeChooseVO {
|
|||||||
private Long userGroupId;
|
private Long userGroupId;
|
||||||
|
|
||||||
@ApiModelProperty("分组详细数组")
|
@ApiModelProperty("分组详细数组")
|
||||||
private java.util.List<UserLikeVO> userLikeDetails;
|
private List<UserLikeVO> userLikeDetails;
|
||||||
|
|
||||||
@ApiModelProperty("关联的collection")
|
@ApiModelProperty("关联的collection")
|
||||||
private UserLikeCollectionVO collection;
|
private UserLikeCollectionVO collection;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ai.da.model.vo;
|
|||||||
|
|
||||||
import com.ai.da.mapper.primary.entity.CollectionElement;
|
import com.ai.da.mapper.primary.entity.CollectionElement;
|
||||||
import com.ai.da.model.dto.CollectionColorDTO;
|
import com.ai.da.model.dto.CollectionColorDTO;
|
||||||
|
import com.ai.da.model.dto.MannequinDTO;
|
||||||
import com.ai.da.python.vo.DesignPythonItemPrint;
|
import com.ai.da.python.vo.DesignPythonItemPrint;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
@@ -59,4 +60,5 @@ public class ValidateElementVO {
|
|||||||
private Long brandId;
|
private Long brandId;
|
||||||
|
|
||||||
private Double brandScale;
|
private Double brandScale;
|
||||||
|
private List<DesignLibraryModelPointVO> mannequins;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import com.google.common.collect.Maps;
|
|||||||
import io.netty.util.internal.StringUtil;
|
import io.netty.util.internal.StringUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import okhttp3.*;
|
import okhttp3.*;
|
||||||
import org.apache.catalina.User;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -45,7 +44,6 @@ import java.io.IOException;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
import java.util.concurrent.TimeUnit;
|
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) {
|
private DesignPythonObject createDesignPythonObject(ValidateElementVO elementVO, CurrentDesignPictureTypeEnum designPictureType, BigDecimal systemScale, String singleOverall, String switchCategory, int i) {
|
||||||
DesignPythonObject pythonObject = new DesignPythonObject();
|
DesignPythonObject pythonObject = new DesignPythonObject();
|
||||||
pythonObject.setItems(coverToDesignPythonItemNew(elementVO, designPictureType, systemScale));
|
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())) {
|
if (CollectionUtil.isNotEmpty(elementVO.getRequestIdList())) {
|
||||||
pythonObject.setObjectSign(elementVO.getRequestIdList().get(i));
|
pythonObject.setObjectSign(elementVO.getRequestIdList().get(i));
|
||||||
}
|
}
|
||||||
@@ -2169,7 +2167,7 @@ public class PythonService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private DesignPythonBasic coverToBasic(DesignPythonItem designPythonItem, String singleOverall,
|
private DesignPythonBasic coverToBasic(DesignPythonItem designPythonItem, String singleOverall,
|
||||||
String switchCategory, DesignLibraryModelPointVO designLibraryModelPoint) {
|
String switchCategory, DesignLibraryModelPointVO designLibraryModelPoint, List<DesignLibraryModelPointVO> mannequins) {
|
||||||
DesignPythonBasic basic = new DesignPythonBasic();
|
DesignPythonBasic basic = new DesignPythonBasic();
|
||||||
basic.setSingle_overall(singleOverall);
|
basic.setSingle_overall(singleOverall);
|
||||||
basic.setSwitch_category(switchCategory);
|
basic.setSwitch_category(switchCategory);
|
||||||
@@ -2182,12 +2180,25 @@ public class PythonService {
|
|||||||
basic.setSelf_template(Boolean.TRUE);
|
basic.setSelf_template(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
basic.setScale_earrings(0.16);
|
basic.setScale_earrings(0.16);
|
||||||
|
if (!CollectionUtils.isEmpty(mannequins)) {
|
||||||
|
DesignLibraryModelPointVO vo = getRandomDesignLibraryModelPoint(mannequins);
|
||||||
|
basic.setBody_point_test(getMap(vo));
|
||||||
|
}else {
|
||||||
basic.setBody_point_test(getMap(designLibraryModelPoint));
|
basic.setBody_point_test(getMap(designLibraryModelPoint));
|
||||||
|
}
|
||||||
return basic;
|
return basic;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, List<Integer>> getMap(DesignLibraryModelPointVO designLibraryModelPointOld) {
|
private DesignLibraryModelPointVO getRandomDesignLibraryModelPoint(List<DesignLibraryModelPointVO> mannequins) {
|
||||||
Map<String, List<Integer>> body_point = Maps.newHashMap();
|
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)) {
|
if (Objects.nonNull(designLibraryModelPointOld)) {
|
||||||
DesignLibraryModelPointVO designLibraryModelPoint =
|
DesignLibraryModelPointVO designLibraryModelPoint =
|
||||||
CopyUtil.copyObject(designLibraryModelPointOld, DesignLibraryModelPointVO.class);
|
CopyUtil.copyObject(designLibraryModelPointOld, DesignLibraryModelPointVO.class);
|
||||||
@@ -2198,6 +2209,8 @@ public class PythonService {
|
|||||||
body_point.put("waistband_right", resolve(designLibraryModelPoint.getWaistbandRight()));
|
body_point.put("waistband_right", resolve(designLibraryModelPoint.getWaistbandRight()));
|
||||||
body_point.put("hand_point_left", resolve(designLibraryModelPoint.getHandLeft()));
|
body_point.put("hand_point_left", resolve(designLibraryModelPoint.getHandLeft()));
|
||||||
body_point.put("hand_point_right", resolve(designLibraryModelPoint.getHandRight()));
|
body_point.put("hand_point_right", resolve(designLibraryModelPoint.getHandRight()));
|
||||||
|
body_point.put("relation_id", designLibraryModelPoint.getRelationId());
|
||||||
|
body_point.put("relation_type", designLibraryModelPoint.getRelationType());
|
||||||
} else {
|
} else {
|
||||||
//默认是13个点
|
//默认是13个点
|
||||||
body_point.put("shoulder_left", Arrays.asList(755, 519));
|
body_point.put("shoulder_left", Arrays.asList(755, 519));
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class DesignPythonBasic {
|
|||||||
|
|
||||||
private Double scale_earrings;
|
private Double scale_earrings;
|
||||||
|
|
||||||
private Map<String, List<Integer>> body_point_test = Maps.newHashMap();
|
private Map<String, Object> body_point_test = Maps.newHashMap();
|
||||||
|
|
||||||
private Boolean layer_order = Boolean.FALSE;
|
private Boolean layer_order = Boolean.FALSE;
|
||||||
|
|
||||||
|
|||||||
@@ -601,6 +601,24 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 校验模特
|
// 校验模特
|
||||||
|
if (!CollectionUtils.isEmpty(designDTO.getMannequins())) {
|
||||||
|
List<DesignLibraryModelPointVO> designLibraryModelPointVOList = new ArrayList<>();
|
||||||
|
for (MannequinDTO mannequin : designDTO.getMannequins()) {
|
||||||
|
if (mannequin.getType().equals("System")) {
|
||||||
|
Library byId = libraryService.getById(mannequin.getId());
|
||||||
|
LibraryModelPoint modelPoint = libraryModelPointService.getByRelationId(byId.getId(), designDTO.getModelType());
|
||||||
|
designLibraryModelPointVOList.add(calculateTemplatePointTemplate(modelPoint, byId.getHigh(), byId.getWidth(), byId.getUrl()));
|
||||||
|
}else {
|
||||||
|
SysFileVO byId = sysFileService.getById(mannequin.getId());
|
||||||
|
// if (!StringUtils.isEmpty(byId.getLevel3Type()) && byId.getLevel2Type().equals("Female")) {
|
||||||
|
// elementVO.setStyle(byId.getLevel3Type());
|
||||||
|
// }
|
||||||
|
LibraryModelPoint modelPoint = libraryModelPointService.getByRelationId(byId.getId(), designDTO.getModelType());
|
||||||
|
designLibraryModelPointVOList.add(calculateTemplatePointTemplate(modelPoint, 700, 320, byId.getUrl()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elementVO.setMannequins(designLibraryModelPointVOList);
|
||||||
|
}else {
|
||||||
if (!StringUtils.isEmpty(designDTO.getModelType())) {
|
if (!StringUtils.isEmpty(designDTO.getModelType())) {
|
||||||
if (designDTO.getModelType().equals(ModelType.LIBRARY.getValue())) {
|
if (designDTO.getModelType().equals(ModelType.LIBRARY.getValue())) {
|
||||||
Library byId = libraryService.getById(designDTO.getTemplateId());
|
Library byId = libraryService.getById(designDTO.getTemplateId());
|
||||||
@@ -615,6 +633,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint, 700, 320, byId.getUrl()));
|
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint, 700, 320, byId.getUrl()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
elementVO.setModelSex(designDTO.getModelSex());
|
elementVO.setModelSex(designDTO.getModelSex());
|
||||||
elementVO.setRequestIdList(designDTO.getRequestIdList());
|
elementVO.setRequestIdList(designDTO.getRequestIdList());
|
||||||
if (null != designDTO.getDesignNum()) {
|
if (null != designDTO.getDesignNum()) {
|
||||||
@@ -660,6 +679,8 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
libraryModelPoint.setWaistbandLeft(calculateTemplatePointOne(modelPoint.getWaistbandLeft(), high, width));
|
libraryModelPoint.setWaistbandLeft(calculateTemplatePointOne(modelPoint.getWaistbandLeft(), high, width));
|
||||||
libraryModelPoint.setWaistbandRight(calculateTemplatePointOne(modelPoint.getWaistbandRight(), high, width));
|
libraryModelPoint.setWaistbandRight(calculateTemplatePointOne(modelPoint.getWaistbandRight(), high, width));
|
||||||
libraryModelPoint.setTemplateUrl(templateUrl);
|
libraryModelPoint.setTemplateUrl(templateUrl);
|
||||||
|
libraryModelPoint.setRelationId(modelPoint.getRelationId());
|
||||||
|
libraryModelPoint.setRelationType(modelPoint.getModelType());
|
||||||
return libraryModelPoint;
|
return libraryModelPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -759,6 +759,20 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
designItem.setDesignUrl(item.getBasic().getSave_name());
|
designItem.setDesignUrl(item.getBasic().getSave_name());
|
||||||
designItem.setHasLike((byte) 0);
|
designItem.setHasLike((byte) 0);
|
||||||
//生成designItem
|
//生成designItem
|
||||||
|
Map<String, Object> bodyPointTest = item.getBasic().getBody_point_test();
|
||||||
|
// 转换 relation_id (Long)
|
||||||
|
Long relationId = Optional.ofNullable(bodyPointTest.get("relation_id"))
|
||||||
|
.filter(Number.class::isInstance)
|
||||||
|
.map(num -> ((Number) num).longValue())
|
||||||
|
.orElseThrow(null);
|
||||||
|
|
||||||
|
// 转换 relation_type (String)
|
||||||
|
String relationType = Optional.ofNullable(bodyPointTest.get("relation_type"))
|
||||||
|
.filter(String.class::isInstance)
|
||||||
|
.map(String.class::cast)
|
||||||
|
.orElse(null);
|
||||||
|
designItem.setRelationId(relationId);
|
||||||
|
designItem.setModelType(relationType);
|
||||||
Long designItemId = designItemService.saveOne(designItem);
|
Long designItemId = designItemService.saveOne(designItem);
|
||||||
// python design返回入库及封装
|
// python design返回入库及封装
|
||||||
// JSONObject outfit = data.getJSONObject(i + "");
|
// JSONObject outfit = data.getJSONObject(i + "");
|
||||||
|
|||||||
@@ -131,6 +131,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
private ThreeDModuleMapper threeDModuleMapper;
|
private ThreeDModuleMapper threeDModuleMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ProductImageService productImageService;
|
private ProductImageService productImageService;
|
||||||
|
@Resource
|
||||||
|
private CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteUserGroup(Long userGroupId) {
|
public void deleteUserGroup(Long userGroupId) {
|
||||||
@@ -1653,11 +1655,36 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
moduleChooseVO.setPatternMaking3D(threeDModuleVO);
|
moduleChooseVO.setPatternMaking3D(threeDModuleVO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else if (module.equals(Module.mannequin.name())) {
|
||||||
|
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(CollectionElement::getProjectId, projectDTO.getId());
|
||||||
|
qw.lambda().eq(CollectionElement::getLevel1Type, CollectionLevel1TypeEnum.MODEL.getRealName());
|
||||||
|
List<CollectionElement> collectionElements = collectionElementMapper.selectList(qw);
|
||||||
|
List<CollectionElementVO> list = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(collectionElements)) {
|
||||||
|
for (CollectionElement collectionElement : collectionElements) {
|
||||||
|
CollectionElementVO collectionElementVO = CopyUtil.copyObject(collectionElement, CollectionElementVO.class);
|
||||||
|
CollectionElementRelModel relModel = getCollectionElementRelModel(collectionElementVO.getId());
|
||||||
|
collectionElementVO.setUrl(minioUtil.getPreSignedUrl(collectionElementVO.getUrl(), 24 * 60));
|
||||||
|
collectionElementVO.setMannequinRelationId(relModel.getRelationId());
|
||||||
|
collectionElementVO.setMannequinRelationType(relModel.getRelationType());
|
||||||
|
collectionElementVO.setCollectionId(collectionElement.getId());
|
||||||
|
list.add(collectionElementVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
moduleChooseVO.setMannequin(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return moduleChooseVO;
|
return moduleChooseVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CollectionElementRelModel getCollectionElementRelModel(Long id) {
|
||||||
|
QueryWrapper<CollectionElementRelModel> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(CollectionElementRelModel::getCollectionElementId, id);
|
||||||
|
CollectionElementRelModel collectionElementRelModel = collectionElementRelModelMapper.selectOne(qw);
|
||||||
|
return collectionElementRelModel;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public ModuleChooseVO saveModuleContent(ModuleSaveDTO moduleSaveDTO) {
|
public ModuleChooseVO saveModuleContent(ModuleSaveDTO moduleSaveDTO) {
|
||||||
@@ -1905,61 +1932,79 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
if (CollectionUtil.isNotEmpty(moduleSaveDTO.getMannequin())) {
|
if (CollectionUtil.isNotEmpty(moduleSaveDTO.getMannequin())) {
|
||||||
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
|
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
|
||||||
qw.lambda().eq(CollectionElement::getProjectId, projectId);
|
qw.lambda().eq(CollectionElement::getProjectId, projectId);
|
||||||
qw.lambda().eq(CollectionElement::getLevel1Type, CollectionLevel1TypeEnum.MANNEQUIN.getRealName());
|
qw.lambda().eq(CollectionElement::getLevel1Type, CollectionLevel1TypeEnum.MODEL.getRealName());
|
||||||
List<CollectionElement> collectionElements = collectionElementMapper.selectList(qw);
|
List<CollectionElement> collectionElements = collectionElementMapper.selectList(qw);
|
||||||
Set<Long> old = collectionElements.stream().map(CollectionElement::getId).collect(Collectors.toSet());
|
Set<Long> old = collectionElements.stream().map(CollectionElement::getId).collect(Collectors.toSet());
|
||||||
// Set<String> oldUrl = collectionElements.stream().map(CollectionElement::getUrl).collect(Collectors.toSet());
|
// Set<String> oldUrl = collectionElements.stream().map(CollectionElement::getUrl).collect(Collectors.toSet());
|
||||||
List<MannequinDTO> mannequin = moduleSaveDTO.getMannequin();
|
List<MannequinDTO> mannequin = moduleSaveDTO.getMannequin();
|
||||||
for (MannequinDTO dto : mannequin) {
|
for (MannequinDTO dto : mannequin) {
|
||||||
|
if (null != dto.getCollectionElementId()) {
|
||||||
|
old.remove(dto.getId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (dto.getType().equals("System")) {
|
if (dto.getType().equals("System")) {
|
||||||
SysFile sysFile = sysFileMapper.selectById(dto.getId());
|
SysFile sysFile = sysFileMapper.selectById(dto.getId());
|
||||||
|
|
||||||
CollectionElement collectionElement = new CollectionElement();
|
CollectionElement collectionElement = new CollectionElement();
|
||||||
collectionElement.setAccountId(accountId);
|
collectionElement.setAccountId(accountId);
|
||||||
collectionElement.setProjectId(projectId);
|
collectionElement.setProjectId(projectId);
|
||||||
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.MANNEQUIN.getRealName());
|
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.MODEL.getRealName());
|
||||||
// collectionElement.setLevel2Type(board.getLevel2Type());
|
// collectionElement.setLevel2Type(board.getLevel2Type());
|
||||||
collectionElement.setName(sysFile.getName());
|
collectionElement.setName(sysFile.getName());
|
||||||
collectionElement.setUrl(sysFile.getUrl());
|
collectionElement.setUrl(sysFile.getUrl());
|
||||||
// collectionElement.setHasPin(board.getIsPin());
|
// collectionElement.setHasPin(board.getIsPin());
|
||||||
collectionElement.setMd5(sysFile.getMd5());
|
collectionElement.setMd5(sysFile.getMd5());
|
||||||
collectionElement.setCreateDate(new Date());
|
collectionElement.setCreateDate(new Date());
|
||||||
|
collectionElement.setHasPin((byte) 0);
|
||||||
collectionElementMapper.insert(collectionElement);
|
collectionElementMapper.insert(collectionElement);
|
||||||
|
CollectionElementRelModel collectionElementRelModel = new CollectionElementRelModel();
|
||||||
|
collectionElementRelModel.setCollectionElementId(collectionElement.getId());
|
||||||
|
collectionElementRelModel.setRelationId(dto.getId());
|
||||||
|
collectionElementRelModel.setRelationType("System");
|
||||||
|
collectionElementRelModelMapper.insert(collectionElementRelModel);
|
||||||
}else if (dto.getType().equals("Library")) {
|
}else if (dto.getType().equals("Library")) {
|
||||||
Library library = libraryMapper.selectById(dto.getId());
|
Library library = libraryMapper.selectById(dto.getId());
|
||||||
|
|
||||||
CollectionElement collectionElement = new CollectionElement();
|
CollectionElement collectionElement = new CollectionElement();
|
||||||
collectionElement.setAccountId(accountId);
|
collectionElement.setAccountId(accountId);
|
||||||
collectionElement.setProjectId(projectId);
|
collectionElement.setProjectId(projectId);
|
||||||
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.MANNEQUIN.getRealName());
|
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.MODEL.getRealName());
|
||||||
// collectionElement.setLevel2Type(board.getLevel2Type());
|
// collectionElement.setLevel2Type(board.getLevel2Type());
|
||||||
collectionElement.setName(library.getName());
|
collectionElement.setName(library.getName());
|
||||||
collectionElement.setUrl(library.getUrl());
|
collectionElement.setUrl(library.getUrl());
|
||||||
// collectionElement.setHasPin(board.getIsPin());
|
// collectionElement.setHasPin(board.getIsPin());
|
||||||
collectionElement.setMd5(library.getMd5());
|
collectionElement.setMd5(library.getMd5());
|
||||||
collectionElement.setCreateDate(new Date());
|
collectionElement.setCreateDate(new Date());
|
||||||
|
collectionElement.setHasPin((byte) 0);
|
||||||
collectionElementMapper.insert(collectionElement);
|
collectionElementMapper.insert(collectionElement);
|
||||||
|
CollectionElementRelModel collectionElementRelModel = new CollectionElementRelModel();
|
||||||
|
collectionElementRelModel.setCollectionElementId(collectionElement.getId());
|
||||||
|
collectionElementRelModel.setRelationId(dto.getId());
|
||||||
|
collectionElementRelModel.setRelationType("System");
|
||||||
|
collectionElementRelModelMapper.insert(collectionElementRelModel);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
if (old.contains(dto.getId())) {
|
// if (old.contains(dto.getId())) {
|
||||||
CollectionElement collectionElement = collectionElementMapper.selectById(dto.getId());
|
// CollectionElement collectionElement = collectionElementMapper.selectById(dto.getId());
|
||||||
// collectionElement.setLevel2Type(board.getLevel2Type());
|
//// collectionElement.setLevel2Type(board.getLevel2Type());
|
||||||
// collectionElement.setHasPin(board.getIsPin());
|
//// collectionElement.setHasPin(board.getIsPin());
|
||||||
collectionElement.setUpdateDate(new Date());
|
// collectionElement.setUpdateDate(new Date());
|
||||||
collectionElementMapper.updateById(collectionElement);
|
// collectionElementMapper.updateById(collectionElement);
|
||||||
old.remove(dto.getId());
|
// old.remove(dto.getId());
|
||||||
}else {
|
// }else {
|
||||||
CollectionElement collectionElement = collectionElementMapper.selectById(dto.getId());
|
// CollectionElement collectionElement = collectionElementMapper.selectById(dto.getId());
|
||||||
collectionElement.setProjectId(projectId);
|
// collectionElement.setProjectId(projectId);
|
||||||
// collectionElement.setLevel2Type(board.getLevel2Type());
|
//// collectionElement.setLevel2Type(board.getLevel2Type());
|
||||||
// collectionElement.setHasPin(board.getIsPin());
|
//// collectionElement.setHasPin(board.getIsPin());
|
||||||
collectionElement.setUpdateDate(new Date());
|
// collectionElement.setUpdateDate(new Date());
|
||||||
collectionElementMapper.updateById(collectionElement);
|
// collectionElementMapper.updateById(collectionElement);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!CollectionUtils.isEmpty(old)) {
|
if (!CollectionUtils.isEmpty(old)) {
|
||||||
collectionElementMapper.deleteBatchIds(old);
|
collectionElementMapper.deleteBatchIds(old);
|
||||||
|
// 删除关联关系
|
||||||
|
deleteByCollectionElementIdList(old);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1993,6 +2038,12 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void deleteByCollectionElementIdList(Set<Long> old) {
|
||||||
|
QueryWrapper<CollectionElementRelModel> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().in(CollectionElementRelModel::getCollectionElementId, old);
|
||||||
|
collectionElementRelModelMapper.delete(qw);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryLibraryPageVO getMannequinDetail(MannequinDTO mannequinDTO) {
|
public QueryLibraryPageVO getMannequinDetail(MannequinDTO mannequinDTO) {
|
||||||
QueryLibraryPageVO vo = new QueryLibraryPageVO();
|
QueryLibraryPageVO vo = new QueryLibraryPageVO();
|
||||||
|
|||||||
Reference in New Issue
Block a user