From f29586dbcd6af0077af62efa95105ef2350d794b Mon Sep 17 00:00:00 2001 From: Administrator <15274802129@163.com> Date: Wed, 09 Jul 2025 18:17:54 +0800 Subject: [PATCH] feat(clothes): 新增多图案和图案位置功能 --- src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesLocationRemarkVo.java | 22 src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesSocialServiceImpl.java | 158 ++++- src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesLocationRemarkVo.java | 12 src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiPatternAddDto.java | 16 src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiSocialMuseVo.java | 15 src/main/resources/templates/febs/views/modules/clothesType/patternList.html | 24 src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java | 48 + src/main/java/cc/mrbird/febs/mall/entity/ClothesLocationRemark.java | 23 src/main/java/cc/mrbird/febs/mall/mapper/ClothesPatternRemarkMapper.java | 7 src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesPatternInfoVo.java | 22 src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialMuse.java | 10 src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java | 135 +++- src/main/java/cc/mrbird/febs/mall/entity/ClothesPatternRemark.java | 23 src/main/java/cc/mrbird/febs/common/enumerates/SocialPatternLocationTypeEnum.java | 26 + src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesSocialMuseVo.java | 25 src/main/resources/mapper/modules/ClothesPatternRemarkMapper.xml | 5 src/main/java/cc/mrbird/febs/mall/controller/clothes/ApiClothesController.java | 9 src/main/java/cc/mrbird/febs/mall/service/ApiClothesService.java | 2 src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesServiceImpl.java | 74 ++ src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java | 90 ++ src/main/resources/templates/febs/views/modules/clothesType/socialMuseUpdate.html | 521 +++++++++++++++---- src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesPatternRemarkVo.java | 22 src/main/resources/mapper/modules/ClothesLocationRemarkMapper.xml | 5 src/main/java/cc/mrbird/febs/common/enumerates/SocialSourceTypeEnum.java | 2 src/main/java/cc/mrbird/febs/mall/mapper/ClothesLocationRemarkMapper.java | 7 src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiMyDraftVo.java | 21 src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiClothesOrderItemInfoDto.java | 2 src/main/resources/templates/febs/views/modules/clothesType/patternAdd.html | 24 src/main/resources/templates/febs/views/modules/clothesType/typeList.html | 12 src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiLocationAddDto.java | 16 src/main/resources/templates/febs/views/modules/clothesType/locationList.html | 2 src/main/java/cc/mrbird/febs/common/enumerates/SocialTypeEnum.java | 2 src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiClothesMemberStatureUpdateStateDto.java | 20 src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesPatternRemarkVo.java | 12 src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesLocationInfoVo.java | 22 src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiMyDraftSaveDto.java | 6 src/main/resources/templates/febs/views/modules/clothesType/patternInfo.html | 25 37 files changed, 1,126 insertions(+), 341 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/common/enumerates/SocialPatternLocationTypeEnum.java b/src/main/java/cc/mrbird/febs/common/enumerates/SocialPatternLocationTypeEnum.java new file mode 100644 index 0000000..f5d1227 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/common/enumerates/SocialPatternLocationTypeEnum.java @@ -0,0 +1,26 @@ +package cc.mrbird.febs.common.enumerates; + +import lombok.Getter; + +/** + * + **/ +@Getter +public enum SocialPatternLocationTypeEnum { + + /** + * 类型 1-订单 2-草稿 3-灵感 + */ + + MUSE(3), + DRAFT(2), + ORDER(1) + + ; + + private final int value; + + SocialPatternLocationTypeEnum(int value) { + this.value = value; + } +} diff --git a/src/main/java/cc/mrbird/febs/common/enumerates/SocialSourceTypeEnum.java b/src/main/java/cc/mrbird/febs/common/enumerates/SocialSourceTypeEnum.java index b22e4b1..03b7955 100644 --- a/src/main/java/cc/mrbird/febs/common/enumerates/SocialSourceTypeEnum.java +++ b/src/main/java/cc/mrbird/febs/common/enumerates/SocialSourceTypeEnum.java @@ -13,7 +13,7 @@ */ COMMENT(2), - SOCIAL(1), + SOCIAL(1) ; diff --git a/src/main/java/cc/mrbird/febs/common/enumerates/SocialTypeEnum.java b/src/main/java/cc/mrbird/febs/common/enumerates/SocialTypeEnum.java index bc93414..6337dbf 100644 --- a/src/main/java/cc/mrbird/febs/common/enumerates/SocialTypeEnum.java +++ b/src/main/java/cc/mrbird/febs/common/enumerates/SocialTypeEnum.java @@ -13,7 +13,7 @@ */ COLLECT(2), - LIKE(1), + LIKE(1) ; diff --git a/src/main/java/cc/mrbird/febs/mall/controller/clothes/ApiClothesController.java b/src/main/java/cc/mrbird/febs/mall/controller/clothes/ApiClothesController.java index 83595a3..48bf0a4 100644 --- a/src/main/java/cc/mrbird/febs/mall/controller/clothes/ApiClothesController.java +++ b/src/main/java/cc/mrbird/febs/mall/controller/clothes/ApiClothesController.java @@ -123,13 +123,20 @@ return clothesService.statureInfo(dto); } - @ApiOperation(value = "身材数据-详情", notes = "身材数据-详情") + @ApiOperation(value = "身材数据-保存", notes = "身材数据-保存") @PostMapping(value = "/statureUpdate") public FebsResponse statureUpdate(@RequestBody @Validated ApiClothesMemberStatureUpdateDto dto) { return clothesService.statureUpdate(dto); } + @ApiOperation(value = "身材数据-设置默认", notes = "身材数据-设置默认") + @PostMapping(value = "/statureUpdateState") + public FebsResponse statureUpdateState(@RequestBody @Validated ApiClothesMemberStatureUpdateStateDto dto) { + + return clothesService.statureUpdateState(dto); + } + @ApiOperation(value = "身材数据-删除", notes = "身材数据-删除") @PostMapping(value = "/statureDel") public FebsResponse statureDel(@RequestBody @Validated ApiClothesMemberStatureInfoDto dto) { diff --git a/src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java b/src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java index 1884665..392ec52 100644 --- a/src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java +++ b/src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java @@ -2,6 +2,7 @@ import cc.mrbird.febs.common.controller.BaseController; import cc.mrbird.febs.common.entity.FebsConstant; +import cc.mrbird.febs.common.enumerates.SocialPatternLocationTypeEnum; import cc.mrbird.febs.common.utils.FebsUtil; import cc.mrbird.febs.mall.entity.*; import cc.mrbird.febs.mall.mapper.*; @@ -10,6 +11,8 @@ import cc.mrbird.febs.mall.vo.AdminLabelSetVo; import cc.mrbird.febs.mall.vo.AdminMallOrderVo; import cc.mrbird.febs.mall.vo.clothes.AdminClothesDeliverGoodsVo; +import cc.mrbird.febs.mall.vo.clothes.AdminClothesLocationRemarkVo; +import cc.mrbird.febs.mall.vo.clothes.AdminClothesPatternRemarkVo; import cc.mrbird.febs.mall.vo.clothes.AdminClothesTypeInfoVo; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; @@ -54,6 +57,8 @@ private final ClothesSocialMuseMapper clothesSocialMuseMapper; private final ClothesSocialFileMapper clothesSocialFileMapper; private final MallExpressInfoMapper mallExpressInfoMapper; + private final ClothesPatternRemarkMapper clothesPatternRemarkMapper; + private final ClothesLocationRemarkMapper clothesLocationRemarkMapper; /** * 社区分类列表 @@ -151,12 +156,45 @@ .last("LIMIT 1") ); - String patternRemark = clothesSocialMuse.getPatternRemark(); - if(StrUtil.isNotBlank(patternRemark)){ - JSON parse = JSONUtil.parse(patternRemark); - clothesSocialMuse.setPatternText(parse.getByPath("text", String.class)); - clothesSocialMuse.setPatternImage(parse.getByPath("file", String.class)); + List<AdminClothesPatternRemarkVo> patternData = new ArrayList<>(); + List<ClothesPatternRemark> patternRemarks = clothesPatternRemarkMapper.selectList( + Wrappers.lambdaQuery(ClothesPatternRemark.class) + .eq(ClothesPatternRemark::getSourceId, clothesSocialMuse.getId()) + .eq(ClothesPatternRemark::getType, SocialPatternLocationTypeEnum.MUSE.getValue()) + ); + if(CollUtil.isNotEmpty(patternRemarks)){ + for (ClothesPatternRemark entity : patternRemarks){ + AdminClothesPatternRemarkVo vo = new AdminClothesPatternRemarkVo(); + vo.setPatternId(entity.getPatternId()); + ClothesPattern clothesPattern = clothesPatternMapper.selectById(entity.getPatternId()); + vo.setPatternName(clothesPattern.getName()); + JSON parse = JSONUtil.parse(entity.getRemark()); + vo.setPatternText(parse.getByPath("text", String.class)); + vo.setSkuPatternImage(parse.getByPath("file", String.class)); + patternData.add(vo); + } + clothesSocialMuse.setPatternData(patternData); } + List<AdminClothesLocationRemarkVo> locationData = new ArrayList<>(); + List<ClothesLocationRemark> locationRemarks = clothesLocationRemarkMapper.selectList( + Wrappers.lambdaQuery(ClothesLocationRemark.class) + .eq(ClothesLocationRemark::getSourceId, clothesSocialMuse.getId()) + .eq(ClothesLocationRemark::getType, SocialPatternLocationTypeEnum.MUSE.getValue()) + ); + if(CollUtil.isNotEmpty(locationRemarks)){ + for (ClothesLocationRemark entity : locationRemarks){ + AdminClothesLocationRemarkVo vo = new AdminClothesLocationRemarkVo(); + vo.setLocationId(entity.getLocationId()); + ClothesLocation clothesLocation = clothesLocationMapper.selectById(entity.getLocationId()); + vo.setLocationName(clothesLocation.getName()); + JSON parse = JSONUtil.parse(entity.getRemark()); + vo.setLocationText(parse.getByPath("text", String.class)); + vo.setSkuLocationImage(parse.getByPath("file", String.class)); + locationData.add(vo); + } + clothesSocialMuse.setLocationData(locationData); + } + model.addAttribute("socialMuse", clothesSocialMuse); return FebsUtil.view("modules/clothesType/socialMuseUpdate"); diff --git a/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiClothesMemberStatureUpdateStateDto.java b/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiClothesMemberStatureUpdateStateDto.java new file mode 100644 index 0000000..5af8137 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiClothesMemberStatureUpdateStateDto.java @@ -0,0 +1,20 @@ +package cc.mrbird.febs.mall.dto.clothes; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Data +@ApiModel(value = "ApiClothesMemberStatureUpdateStateDto", description = "参数") +public class ApiClothesMemberStatureUpdateStateDto { + + @NotNull(message = "身材不能为空") + @ApiModelProperty(value = "ID") + private Long id; + + @NotNull(message = "是否默认不能为空") + @ApiModelProperty(value = "是否默认 0-否 1-是") + private Integer state; +} diff --git a/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiClothesOrderItemInfoDto.java b/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiClothesOrderItemInfoDto.java index 8fa0f47..aa68da2 100644 --- a/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiClothesOrderItemInfoDto.java +++ b/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiClothesOrderItemInfoDto.java @@ -19,7 +19,7 @@ private Integer cnt; @NotNull(message = "参数不能为空") - @ApiModelProperty(value = "类型 1图案 2图案位置 3工艺 4布料 5尺码 6尺码自定义", example = "2") + @ApiModelProperty(value = "类型 1正面图案 2反面图案 3工艺 4布料 5尺码 6尺码自定义", example = "2") private Integer type; @ApiModelProperty(value = "自定义图案内容", example = "2") diff --git a/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiLocationAddDto.java b/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiLocationAddDto.java new file mode 100644 index 0000000..74f538d --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiLocationAddDto.java @@ -0,0 +1,16 @@ +package cc.mrbird.febs.mall.dto.clothes; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(value = "ApiLocationAddDto", description = "") +public class ApiLocationAddDto { + + @ApiModelProperty(value = "反面图案ID") + private Long locationId; + + @ApiModelProperty(value = "自定义内容") + private String patternRemark; +} diff --git a/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiMyDraftSaveDto.java b/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiMyDraftSaveDto.java index f585ff9..60e28b3 100644 --- a/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiMyDraftSaveDto.java +++ b/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiMyDraftSaveDto.java @@ -5,6 +5,7 @@ import lombok.Data; import javax.validation.constraints.NotNull; +import java.util.List; @Data @ApiModel(value = "ApiMyDraftSaveDto", description = "参数") @@ -25,6 +26,11 @@ @ApiModelProperty(value = "尺码ID") private Long sizeId; + @ApiModelProperty(value = "正面图案") + private List<ApiPatternAddDto> patternList; + @ApiModelProperty(value = "反面图案") + private List<ApiLocationAddDto> locationList; + @NotNull(message = "图案不能为空") @ApiModelProperty(value = "图案ID") diff --git a/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiPatternAddDto.java b/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiPatternAddDto.java new file mode 100644 index 0000000..1f2febd --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiPatternAddDto.java @@ -0,0 +1,16 @@ +package cc.mrbird.febs.mall.dto.clothes; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(value = "ApiPatternAddDto", description = "") +public class ApiPatternAddDto { + + @ApiModelProperty(value = "正面图案ID") + private Long patternId; + + @ApiModelProperty(value = "自定义内容") + private String patternRemark; +} diff --git a/src/main/java/cc/mrbird/febs/mall/entity/ClothesLocationRemark.java b/src/main/java/cc/mrbird/febs/mall/entity/ClothesLocationRemark.java new file mode 100644 index 0000000..d18af06 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/entity/ClothesLocationRemark.java @@ -0,0 +1,23 @@ +package cc.mrbird.febs.mall.entity; + +import cc.mrbird.febs.common.entity.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +@Data +@TableName("clothes_location_remark") +public class ClothesLocationRemark extends BaseEntity { + /** + * + `member_id` bigint(20) DEFAULT NULL, + `type` int(11) DEFAULT NULL COMMENT '类型 1-订单 2-草稿 3-灵感', + `source_id` bigint(20) DEFAULT NULL COMMENT '订单、草稿、灵感ID', + `location_id` bigint(20) DEFAULT NULL COMMENT '正面ID', + `remark` varchar(500) DEFAULT NULL COMMENT '文字图片内容', + */ + private Long memberId; + private Integer type; + private Long sourceId; + private Long locationId; + private String remark; +} diff --git a/src/main/java/cc/mrbird/febs/mall/entity/ClothesPatternRemark.java b/src/main/java/cc/mrbird/febs/mall/entity/ClothesPatternRemark.java new file mode 100644 index 0000000..96916c6 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/entity/ClothesPatternRemark.java @@ -0,0 +1,23 @@ +package cc.mrbird.febs.mall.entity; + +import cc.mrbird.febs.common.entity.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +@Data +@TableName("clothes_pattern_remark") +public class ClothesPatternRemark extends BaseEntity { + /** + * + `member_id` bigint(20) DEFAULT NULL, + `type` int(11) DEFAULT NULL COMMENT '类型 1-订单 2-草稿 3-灵感', + `source_id` bigint(20) DEFAULT NULL COMMENT '订单、草稿、灵感ID', + `pattern_id` bigint(20) DEFAULT NULL COMMENT '正面ID', + `remark` varchar(500) DEFAULT NULL COMMENT '文字图片内容', + */ + private Long memberId; + private Integer type; + private Long sourceId; + private Long patternId; + private String remark; +} diff --git a/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialMuse.java b/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialMuse.java index f1baea9..7322154 100644 --- a/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialMuse.java +++ b/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialMuse.java @@ -1,9 +1,13 @@ package cc.mrbird.febs.mall.entity; import cc.mrbird.febs.common.entity.BaseEntity; +import cc.mrbird.febs.mall.vo.clothes.AdminClothesLocationRemarkVo; +import cc.mrbird.febs.mall.vo.clothes.AdminClothesPatternRemarkVo; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; + +import java.util.List; @Data @TableName("clothes_social_muse") @@ -35,4 +39,10 @@ private String patternText; @TableField(exist = false) private String patternImage; + @TableField(exist = false) + private List<AdminClothesPatternRemarkVo> patternData; + @TableField(exist = false) + private List<AdminClothesLocationRemarkVo> locationData; + + } diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/ClothesLocationRemarkMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/ClothesLocationRemarkMapper.java new file mode 100644 index 0000000..2d57daf --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/mapper/ClothesLocationRemarkMapper.java @@ -0,0 +1,7 @@ +package cc.mrbird.febs.mall.mapper; + +import cc.mrbird.febs.mall.entity.ClothesLocationRemark; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +public interface ClothesLocationRemarkMapper extends BaseMapper<ClothesLocationRemark> { +} diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/ClothesPatternRemarkMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/ClothesPatternRemarkMapper.java new file mode 100644 index 0000000..e83ad0f --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/mapper/ClothesPatternRemarkMapper.java @@ -0,0 +1,7 @@ +package cc.mrbird.febs.mall.mapper; + +import cc.mrbird.febs.mall.entity.ClothesPatternRemark; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +public interface ClothesPatternRemarkMapper extends BaseMapper<ClothesPatternRemark> { +} diff --git a/src/main/java/cc/mrbird/febs/mall/service/ApiClothesService.java b/src/main/java/cc/mrbird/febs/mall/service/ApiClothesService.java index ebfb6e2..c283dc9 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/ApiClothesService.java +++ b/src/main/java/cc/mrbird/febs/mall/service/ApiClothesService.java @@ -29,6 +29,8 @@ FebsResponse statureUpdate(ApiClothesMemberStatureUpdateDto dto); + FebsResponse statureUpdateState(ApiClothesMemberStatureUpdateStateDto dto); + FebsResponse statureDel(ApiClothesMemberStatureInfoDto dto); FebsResponse draftSave(ApiMyDraftSaveDto dto); diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java index d5beead..42e3832 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java @@ -74,6 +74,9 @@ private final IApiMallMemberWalletService apiMallMemberWalletService; private final IMallMoneyFlowService mallMoneyFlowService; + private final ClothesPatternRemarkMapper clothesPatternRemarkMapper; + private final ClothesLocationRemarkMapper clothesLocationRemarkMapper; + @Override public FebsResponse myDraft(ApiMyDraftPageDto dto) { @@ -112,30 +115,50 @@ record.setStatureName(clothesMemberStature.getName()); } - Long patternId = ObjectUtil.defaultIfNull(record.getPatternId(),0L); - List<ClothesTypePattern> clothesTypePatterns = clothesTypePatternMapper.selectList(Wrappers.<ClothesTypePattern>lambdaQuery().eq(ClothesTypePattern::getTypeId, typeId)); - if (CollUtil.isNotEmpty(clothesTypePatterns)){ - Set<Long> patternIds = clothesTypePatterns.stream().map(ClothesTypePattern::getPatternId).collect(Collectors.toSet()); - if(CollUtil.isNotEmpty( patternIds) && patternIds.contains(patternId)){ + BigDecimal totalPatternPrice = BigDecimal.ZERO; + List<ClothesPatternRemark> clothesPatternRemarks = clothesPatternRemarkMapper.selectList( + Wrappers.lambdaQuery(ClothesPatternRemark.class) + .eq(ClothesPatternRemark::getSourceId, record.getId()) + .eq(ClothesPatternRemark::getType, SocialPatternLocationTypeEnum.DRAFT.getValue()) + ); + if(CollUtil.isNotEmpty(clothesPatternRemarks)){ + List<ApiClothesPatternInfoVo> vos = new ArrayList<>(); + for (ClothesPatternRemark entity : clothesPatternRemarks){ + Long patternId = entity.getPatternId(); + ApiClothesPatternInfoVo vo = new ApiClothesPatternInfoVo(); + vo.setPatternId(patternId); ClothesPattern clothesPattern = clothesPatternMapper.selectById(patternId); - if (ObjectUtil.isNotNull(clothesPattern)){ - record.setPatternName(clothesPattern.getName()); - record.setPatternPrice(clothesPattern.getPrice()); - } + vo.setPatternName(clothesPattern.getName()); + vo.setPatternPrice(clothesPattern.getPrice()); + vo.setPatternRemark(entity.getRemark()); + vos.add(vo); + + totalPatternPrice = totalPatternPrice.add(clothesPattern.getPrice()); } + record.setPatternList(vos); } - Long locationId = ObjectUtil.defaultIfNull(record.getLocationId(),0L); - List<ClothesTypeLocation> clothesTypeLocations = clothesTypeLocationMapper.selectList(Wrappers.<ClothesTypeLocation>lambdaQuery().eq(ClothesTypeLocation::getTypeId, typeId)); - if (CollUtil.isNotEmpty(clothesTypeLocations)){ - Set<Long> locationIds = clothesTypeLocations.stream().map(ClothesTypeLocation::getLocationId).collect(Collectors.toSet()); - if(CollUtil.isNotEmpty( locationIds) && locationIds.contains(locationId)){ - ClothesLocation clothesLocation = clothesLocationMapper.selectById(locationId); - if (ObjectUtil.isNotNull(clothesLocation)){ - record.setLocationName(clothesLocation.getName()); - record.setLocationPrice(clothesLocation.getPrice()); - } + BigDecimal totalLocationPrice = BigDecimal.ZERO; + List<ClothesLocationRemark> clothesLocationRemarks = clothesLocationRemarkMapper.selectList( + Wrappers.lambdaQuery(ClothesLocationRemark.class) + .eq(ClothesLocationRemark::getSourceId, record.getId()) + .eq(ClothesLocationRemark::getType, SocialPatternLocationTypeEnum.DRAFT.getValue()) + ); + if(CollUtil.isNotEmpty(clothesLocationRemarks)){ + List<ApiClothesLocationInfoVo> vos = new ArrayList<>(); + for (ClothesLocationRemark entity : clothesLocationRemarks){ + Long locationId = entity.getLocationId(); + ApiClothesLocationInfoVo vo = new ApiClothesLocationInfoVo(); + vo.setLocationId(locationId); + ClothesLocation location = clothesLocationMapper.selectById(locationId); + vo.setLocationName(location.getName()); + vo.setLocationPrice(location.getPrice()); + vo.setLocationRemark(entity.getRemark()); + vos.add(vo); + + totalLocationPrice = totalLocationPrice.add(location.getPrice()); } + record.setLocationList(vos); } Long artId = ObjectUtil.defaultIfNull(record.getArtId(),0L); @@ -165,11 +188,11 @@ } BigDecimal amount = - record.getClothPrice() - .add(record.getLocationPrice()) + record.getClothPrice() + .add(totalPatternPrice) .add(record.getArtPrice()) .add(record.getSizePrice()) - .add(record.getPatternPrice()).setScale(2, RoundingMode.DOWN); + .add(totalLocationPrice).setScale(2, RoundingMode.DOWN); record.setAmount(amount); } } @@ -192,7 +215,6 @@ record.setTypeId(typeId); record.setTypeName(clothesType.getName()); record.setTypeImage(clothesType.getImage()); - record.setPatternRemark(clothesOrderDraft.getPatternRemark()); Long sizeId = ObjectUtil.defaultIfNull(clothesOrderDraft.getSizeId(),0L); List<ClothesTypeSize> clothesTypeSizes = clothesTypeSizeMapper.selectList(Wrappers.<ClothesTypeSize>lambdaQuery().eq(ClothesTypeSize::getTypeId, typeId)); @@ -215,32 +237,50 @@ record.setStatureName(clothesMemberStature.getName()); } - Long patternId = ObjectUtil.defaultIfNull(clothesOrderDraft.getPatternId(),0L); - List<ClothesTypePattern> clothesTypePatterns = clothesTypePatternMapper.selectList(Wrappers.<ClothesTypePattern>lambdaQuery().eq(ClothesTypePattern::getTypeId, typeId)); - if (CollUtil.isNotEmpty(clothesTypePatterns)){ - Set<Long> patternIds = clothesTypePatterns.stream().map(ClothesTypePattern::getPatternId).collect(Collectors.toSet()); - if(CollUtil.isNotEmpty( patternIds) && patternIds.contains(patternId)){ + BigDecimal totalPatternPrice = BigDecimal.ZERO; + List<ClothesPatternRemark> clothesPatternRemarks = clothesPatternRemarkMapper.selectList( + Wrappers.lambdaQuery(ClothesPatternRemark.class) + .eq(ClothesPatternRemark::getSourceId, record.getId()) + .eq(ClothesPatternRemark::getType, SocialPatternLocationTypeEnum.DRAFT.getValue()) + ); + if(CollUtil.isNotEmpty(clothesPatternRemarks)){ + List<ApiClothesPatternInfoVo> vos = new ArrayList<>(); + for (ClothesPatternRemark entity : clothesPatternRemarks){ + Long patternId = entity.getPatternId(); + ApiClothesPatternInfoVo vo = new ApiClothesPatternInfoVo(); + vo.setPatternId(patternId); ClothesPattern clothesPattern = clothesPatternMapper.selectById(patternId); - if (ObjectUtil.isNotNull(clothesPattern)){ - record.setPatternId(patternId); - record.setPatternName(clothesPattern.getName()); - record.setPatternPrice(clothesPattern.getPrice()); - } + vo.setPatternName(clothesPattern.getName()); + vo.setPatternPrice(clothesPattern.getPrice()); + vo.setPatternRemark(entity.getRemark()); + vos.add(vo); + + totalPatternPrice = totalPatternPrice.add(clothesPattern.getPrice()); } + record.setPatternList(vos); } - Long locationId = ObjectUtil.defaultIfNull(clothesOrderDraft.getLocationId(),0L); - List<ClothesTypeLocation> clothesTypeLocations = clothesTypeLocationMapper.selectList(Wrappers.<ClothesTypeLocation>lambdaQuery().eq(ClothesTypeLocation::getTypeId, typeId)); - if (CollUtil.isNotEmpty(clothesTypeLocations)){ - Set<Long> locationIds = clothesTypeLocations.stream().map(ClothesTypeLocation::getLocationId).collect(Collectors.toSet()); - if(CollUtil.isNotEmpty( locationIds) && locationIds.contains(locationId)){ - ClothesLocation clothesLocation = clothesLocationMapper.selectById(locationId); - if (ObjectUtil.isNotNull(clothesLocation)){ - record.setLocationId(locationId); - record.setLocationName(clothesLocation.getName()); - record.setLocationPrice(clothesLocation.getPrice()); - } + BigDecimal totalLocationPrice = BigDecimal.ZERO; + List<ClothesLocationRemark> clothesLocationRemarks = clothesLocationRemarkMapper.selectList( + Wrappers.lambdaQuery(ClothesLocationRemark.class) + .eq(ClothesLocationRemark::getSourceId, record.getId()) + .eq(ClothesLocationRemark::getType, SocialPatternLocationTypeEnum.DRAFT.getValue()) + ); + if(CollUtil.isNotEmpty(clothesLocationRemarks)){ + List<ApiClothesLocationInfoVo> vos = new ArrayList<>(); + for (ClothesLocationRemark entity : clothesLocationRemarks){ + Long locationId = entity.getLocationId(); + ApiClothesLocationInfoVo vo = new ApiClothesLocationInfoVo(); + vo.setLocationId(locationId); + ClothesLocation location = clothesLocationMapper.selectById(locationId); + vo.setLocationName(location.getName()); + vo.setLocationPrice(location.getPrice()); + vo.setLocationRemark(entity.getRemark()); + vos.add(vo); + + totalLocationPrice = totalLocationPrice.add(location.getPrice()); } + record.setLocationList(vos); } Long artId = ObjectUtil.defaultIfNull(clothesOrderDraft.getArtId(),0L); @@ -273,10 +313,10 @@ BigDecimal amount = record.getClothPrice() - .add(record.getLocationPrice()) + .add(totalPatternPrice) .add(record.getArtPrice()) .add(record.getSizePrice()) - .add(record.getPatternPrice()).setScale(2, RoundingMode.DOWN); + .add(totalLocationPrice).setScale(2, RoundingMode.DOWN); record.setAmount(amount); } @@ -372,6 +412,7 @@ clothesOrderMapper.insert(orderInfo); Long orderId = orderInfo.getId(); + /** * 创建订单子表 */ @@ -420,6 +461,7 @@ orderItem.setPrice(location.getPrice()); orderItem.setItemCnt(item.getCnt()); orderItem.setAmount(orderItem.getPrice().multiply(new BigDecimal(orderItem.getItemCnt())).setScale(2, RoundingMode.DOWN)); + orderItem.setRemark(item.getPatternRemark()); clothesOrderItemMapper.insert(orderItem); total = total.add(orderItem.getAmount()); @@ -434,6 +476,7 @@ orderItem.setName(pattern.getName()); orderItem.setPrice(pattern.getPrice()); orderItem.setItemCnt(item.getCnt()); + orderItem.setRemark(item.getPatternRemark()); orderItem.setAmount(orderItem.getPrice().multiply(new BigDecimal(orderItem.getItemCnt())).setScale(2, RoundingMode.DOWN)); clothesOrderItemMapper.insert(orderItem); diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesServiceImpl.java index 0459e9a..0133cd2 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesServiceImpl.java @@ -2,6 +2,7 @@ import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.common.enumerates.ClothesEnum; +import cc.mrbird.febs.common.enumerates.SocialPatternLocationTypeEnum; import cc.mrbird.febs.common.enumerates.StateUpDownEnum; import cc.mrbird.febs.common.exception.FebsException; import cc.mrbird.febs.common.utils.LoginUserUtil; @@ -46,6 +47,8 @@ private final ClothesTypeArtMapper clothesTypeArtMapper; private final ClothesMemberStatureMapper clothesMemberStatureMapper; private final ClothesOrderDraftMapper clothesOrderDraftMapper; + private final ClothesPatternRemarkMapper clothesPatternRemarkMapper; + private final ClothesLocationRemarkMapper clothesLocationRemarkMapper; @Override public FebsResponse clothesType() { @@ -261,6 +264,28 @@ } @Override + public FebsResponse statureUpdateState(ApiClothesMemberStatureUpdateStateDto dto) { + Long memberId = LoginUserUtil.getLoginUser().getId(); + ClothesMemberStature clothesMemberStature = clothesMemberStatureMapper.selectById(dto.getId()); + if (ObjectUtil.isNotEmpty(clothesMemberStature)){ + clothesMemberStature.setState(dto.getState()); + clothesMemberStatureMapper.updateById(clothesMemberStature); + + if(ClothesEnum.UP.getCode() == dto.getState()){ + clothesMemberStatureMapper.update(null, + Wrappers.lambdaUpdate(ClothesMemberStature.class) + .set(ClothesMemberStature::getState, ClothesEnum.DOWN.getCode()) + .eq(ClothesMemberStature::getMemberId, memberId) + .ne(ClothesMemberStature::getId, clothesMemberStature.getId()) + .eq(ClothesMemberStature::getDelFlag, ClothesEnum.DOWN.getCode()) + ); + } + } + + return new FebsResponse().success().message("操作成功"); + } + + @Override public FebsResponse statureDel(ApiClothesMemberStatureInfoDto dto) { Long memberId = LoginUserUtil.getLoginUser().getId(); clothesMemberStatureMapper.update(null, @@ -298,23 +323,6 @@ } clothesOrderDraft.setSizeId(sizeId); - Long patternId = ObjectUtil.defaultIfNull(dto.getPatternId(),0L); - ClothesPattern pattern = clothesPatternMapper.selectById(patternId); - if (ObjectUtil.isNull(pattern)){ - throw new FebsException("请选择图案"); - } - clothesOrderDraft.setPatternId(patternId); - if(StrUtil.isNotBlank(dto.getPatternRemark())){ - clothesOrderDraft.setPatternRemark(dto.getPatternRemark()); - } - - Long locationId = ObjectUtil.defaultIfNull(dto.getLocationId(),0L); - ClothesLocation clothesLocation = clothesLocationMapper.selectById(locationId); - if (ObjectUtil.isNull(clothesLocation)){ - throw new FebsException("请选择图案位置"); - } - clothesOrderDraft.setLocationId(locationId); - Long clothId = ObjectUtil.defaultIfNull(dto.getClothId(),0L); ClothesCloth clothesCloth = clothesClothMapper.selectById(clothId); if (ObjectUtil.isNull(clothesCloth)){ @@ -338,6 +346,38 @@ clothesOrderDraftMapper.insert(clothesOrderDraft); + List<ApiPatternAddDto> patternList = dto.getPatternList(); + if (CollUtil.isNotEmpty(patternList)){ + for (ApiPatternAddDto patternAddDto : patternList){ + Long patternId = patternAddDto.getPatternId(); + String patternRemark = patternAddDto.getPatternRemark(); + + ClothesPatternRemark clothesPatternRemark = new ClothesPatternRemark(); + clothesPatternRemark.setMemberId(memberId); + clothesPatternRemark.setType(SocialPatternLocationTypeEnum.DRAFT.getValue()); + clothesPatternRemark.setSourceId(clothesOrderDraft.getId()); + clothesPatternRemark.setPatternId(patternId); + clothesPatternRemark.setRemark(patternRemark); + clothesPatternRemarkMapper.insert(clothesPatternRemark); + } + } + + List<ApiLocationAddDto> locationList = dto.getLocationList(); + if (CollUtil.isNotEmpty(locationList)){ + for (ApiLocationAddDto locationAddDto : locationList){ + Long locationId = locationAddDto.getLocationId(); + String patternRemark = locationAddDto.getPatternRemark(); + + ClothesLocationRemark clothesLocationRemark = new ClothesLocationRemark(); + clothesLocationRemark.setMemberId(memberId); + clothesLocationRemark.setType(SocialPatternLocationTypeEnum.DRAFT.getValue()); + clothesLocationRemark.setSourceId(clothesOrderDraft.getId()); + clothesLocationRemark.setLocationId(locationId); + clothesLocationRemark.setRemark(patternRemark); + clothesLocationRemarkMapper.insert(clothesLocationRemark); + } + } + return new FebsResponse().success().message("操作成功"); } } diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesSocialServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesSocialServiceImpl.java index 69b2836..6e9ee3b 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesSocialServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesSocialServiceImpl.java @@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import io.swagger.annotations.ApiModelProperty; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -59,6 +60,8 @@ private final ClothesTypeSizeMapper clothesTypeSizeMapper; private final ClothesTypeLocationMapper clothesTypeLocationMapper; private final ClothesTypeArtMapper clothesTypeArtMapper; + private final ClothesLocationRemarkMapper clothesLocationRemarkMapper; + private final ClothesPatternRemarkMapper clothesPatternRemarkMapper; @Override @@ -147,10 +150,6 @@ if(ObjectUtil.isNotNull(clothesSocialMuse)){ BigDecimal totalAmount = BigDecimal.ZERO; apiSocialMuseVo.setMuseId(clothesSocialMuse.getId()); - - apiSocialMuseVo.setPatternImage(clothesSocialMuse.getPatternImage()); - apiSocialMuseVo.setPatternText(clothesSocialMuse.getPatternText()); - ClothesType clothesType = clothesTypeMapper.selectById(clothesSocialMuse.getTypeId()); if(ObjectUtil.isNotNull(clothesType)){ apiSocialMuseVo.setTypeName(clothesType.getName()); @@ -161,16 +160,6 @@ apiSocialMuseVo.setSizeName(clothesSize.getName()); totalAmount = totalAmount.add(clothesSize.getPrice()); } - ClothesPattern clothesPattern = clothesPatternMapper.selectById(clothesSocialMuse.getPatternId()); - if(ObjectUtil.isNotNull(clothesPattern)){ - apiSocialMuseVo.setPatternName(clothesPattern.getName()); - totalAmount = totalAmount.add(clothesPattern.getPrice()); - } - ClothesLocation clothesLocation = clothesLocationMapper.selectById(clothesSocialMuse.getLocationId()); - if(ObjectUtil.isNotNull(clothesLocation)){ - apiSocialMuseVo.setLocationName(clothesLocation.getName()); - totalAmount = totalAmount.add(clothesLocation.getPrice()); - } ClothesCloth clothesCloth = clothesClothMapper.selectById(clothesSocialMuse.getClothId()); if(ObjectUtil.isNotNull(clothesCloth)){ apiSocialMuseVo.setClothName(clothesCloth.getName()); @@ -180,6 +169,46 @@ if(ObjectUtil.isNotNull(clothesArt)){ apiSocialMuseVo.setArtName(clothesArt.getName()); totalAmount = totalAmount.add(clothesArt.getPrice()); + } + + + List<ApiClothesPatternRemarkVo> patternRemarkList = new ArrayList<>(); + + List<ClothesPatternRemark> patternRemarks = clothesPatternRemarkMapper.selectList( + Wrappers.lambdaQuery(ClothesPatternRemark.class) + .eq(ClothesPatternRemark::getSourceId, clothesSocialMuse.getId()) + .eq(ClothesPatternRemark::getType, SocialPatternLocationTypeEnum.MUSE.getValue()) + ); + if(CollUtil.isNotEmpty(patternRemarks)){ + for (ClothesPatternRemark entity : patternRemarks){ + ApiClothesPatternRemarkVo vo = new ApiClothesPatternRemarkVo(); + ClothesPattern pattern = clothesPatternMapper.selectById(entity.getPatternId()); + vo.setPatternName(pattern.getName()); + vo.setPatternRemark(entity.getRemark()); + patternRemarkList.add( vo); + + totalAmount = totalAmount.add(pattern.getPrice()); + } + apiSocialMuseVo.setPatternRemarkList(patternRemarkList); + } + + List<ApiClothesLocationRemarkVo> locationRemarkList = new ArrayList<>(); + List<ClothesLocationRemark> locationRemarks = clothesLocationRemarkMapper.selectList( + Wrappers.lambdaQuery(ClothesLocationRemark.class) + .eq(ClothesLocationRemark::getSourceId, clothesSocialMuse.getId()) + .eq(ClothesLocationRemark::getType, SocialPatternLocationTypeEnum.MUSE.getValue()) + ); + if(CollUtil.isNotEmpty(locationRemarks)){ + for (ClothesLocationRemark entity : locationRemarks){ + ApiClothesLocationRemarkVo vo = new ApiClothesLocationRemarkVo(); + ClothesLocation clothesLocation = clothesLocationMapper.selectById(entity.getLocationId()); + vo.setLocationName(clothesLocation.getName()); + vo.setLocationRemark(entity.getRemark()); + locationRemarkList.add(vo); + + totalAmount = totalAmount.add(clothesLocation.getPrice()); + } + apiSocialMuseVo.setLocationRemarkList(locationRemarkList); } apiSocialMuseVo.setTotalAmount(totalAmount.setScale(2, RoundingMode.DOWN)); } @@ -239,6 +268,9 @@ Wrappers.lambdaQuery(ClothesOrderItem.class) .eq(ClothesOrderItem::getOrderId, orderId) ); + + List<ClothesLocationRemark> clothesLocationRemarks = new ArrayList<>(); + List<ClothesPatternRemark> clothesPatternRemarks = new ArrayList<>(); if(CollUtil.isEmpty(clothesOrderItems)){ for (ClothesOrderItem item : clothesOrderItems){ if (ClothesOrderItemEnum.CLOTH.getCode() == item.getType()) { @@ -251,12 +283,23 @@ continue; } else if (ClothesOrderItemEnum.LOCATION.getCode() == item.getType()) { ClothesLocation location = clothesLocationMapper.selectById(item.getItemId()); - clothesSocialMuse.setLocationId(location.getId()); + ClothesLocationRemark entity = new ClothesLocationRemark(); + entity.setLocationId(location.getId()); + entity.setMemberId(memberId); + entity.setSourceId(clothesSocialMuse.getId()); + entity.setType(SocialPatternLocationTypeEnum.MUSE.getValue()); + entity.setRemark(item.getRemark()); + clothesLocationRemarks.add(entity); continue; } else if (ClothesOrderItemEnum.PATTERN.getCode() == item.getType()) { ClothesPattern pattern = clothesPatternMapper.selectById(item.getItemId()); - clothesSocialMuse.setPatternId(pattern.getId()); - clothesSocialMuse.setPatternRemark(item.getRemark()); + ClothesPatternRemark entity = new ClothesPatternRemark(); + entity.setPatternId(pattern.getId()); + entity.setMemberId(memberId); + entity.setSourceId(clothesSocialMuse.getId()); + entity.setType(SocialPatternLocationTypeEnum.MUSE.getValue()); + entity.setRemark(item.getRemark()); + clothesPatternRemarks.add(entity); continue; } else if (ClothesOrderItemEnum.ART.getCode() == item.getType()) { ClothesArt art = clothesArtMapper.selectById(item.getItemId()); @@ -268,6 +311,20 @@ } } clothesSocialMuseMapper.insert(clothesSocialMuse); + + if (CollUtil.isNotEmpty(clothesLocationRemarks)){ + for (ClothesLocationRemark entity : clothesLocationRemarks){ + entity.setSourceId(clothesSocialMuse.getId()); + clothesLocationRemarkMapper.insert(entity); + } + } + + if (CollUtil.isNotEmpty(clothesPatternRemarks)){ + for (ClothesPatternRemark entity : clothesPatternRemarks){ + entity.setSourceId(clothesSocialMuse.getId()); + clothesPatternRemarkMapper.insert(entity); + } + } return new FebsResponse().success().message("操作成功"); } @@ -338,7 +395,6 @@ record.setTypeId(typeId); record.setTypeName(clothesType.getName()); record.setTypeImage(clothesType.getImage()); - record.setPatternRemark(entity.getPatternRemark()); Long sizeId = ObjectUtil.defaultIfNull(entity.getSizeId(),0L); List<ClothesTypeSize> clothesTypeSizes = clothesTypeSizeMapper.selectList(Wrappers.<ClothesTypeSize>lambdaQuery().eq(ClothesTypeSize::getTypeId, typeId)); @@ -354,32 +410,49 @@ } } - Long patternId = ObjectUtil.defaultIfNull(entity.getPatternId(),0L); - List<ClothesTypePattern> clothesTypePatterns = clothesTypePatternMapper.selectList(Wrappers.<ClothesTypePattern>lambdaQuery().eq(ClothesTypePattern::getTypeId, typeId)); - if (CollUtil.isNotEmpty(clothesTypePatterns)){ - Set<Long> patternIds = clothesTypePatterns.stream().map(ClothesTypePattern::getPatternId).collect(Collectors.toSet()); - if(CollUtil.isNotEmpty( patternIds) && patternIds.contains(patternId)){ - ClothesPattern clothesPattern = clothesPatternMapper.selectById(patternId); - if (ObjectUtil.isNotNull(clothesPattern)){ - record.setPatternId(patternId); - record.setPatternName(clothesPattern.getName()); - record.setPatternPrice(clothesPattern.getPrice()); - } + BigDecimal totalPatternAmount = BigDecimal.ZERO; + List<ApiClothesPatternRemarkVo> patternRemarkList = new ArrayList<>(); + List<ClothesPatternRemark> patternRemarks = clothesPatternRemarkMapper.selectList( + Wrappers.lambdaQuery(ClothesPatternRemark.class) + .eq(ClothesPatternRemark::getSourceId, entity.getId()) + .eq(ClothesPatternRemark::getType, SocialPatternLocationTypeEnum.MUSE.getValue()) + ); + if(CollUtil.isNotEmpty(patternRemarks)){ + for (ClothesPatternRemark patternRemark : patternRemarks){ + ApiClothesPatternRemarkVo vo = new ApiClothesPatternRemarkVo(); + ClothesPattern pattern = clothesPatternMapper.selectById(patternRemark.getPatternId()); + vo.setPatternName(pattern.getName()); + vo.setPatternPrice(pattern.getPrice()); + vo.setPatternId(pattern.getId()); + vo.setPatternRemark(patternRemark.getRemark()); + patternRemarkList.add( vo); + + totalPatternAmount = totalPatternAmount.add(pattern.getPrice()); } + record.setPatternRemarkList(patternRemarkList); } - Long locationId = ObjectUtil.defaultIfNull(entity.getLocationId(),0L); - List<ClothesTypeLocation> clothesTypeLocations = clothesTypeLocationMapper.selectList(Wrappers.<ClothesTypeLocation>lambdaQuery().eq(ClothesTypeLocation::getTypeId, typeId)); - if (CollUtil.isNotEmpty(clothesTypeLocations)){ - Set<Long> locationIds = clothesTypeLocations.stream().map(ClothesTypeLocation::getLocationId).collect(Collectors.toSet()); - if(CollUtil.isNotEmpty( locationIds) && locationIds.contains(locationId)){ - ClothesLocation clothesLocation = clothesLocationMapper.selectById(locationId); - if (ObjectUtil.isNotNull(clothesLocation)){ - record.setLocationId(locationId); - record.setLocationName(clothesLocation.getName()); - record.setLocationPrice(clothesLocation.getPrice()); - } + + BigDecimal totalLocationAmount = BigDecimal.ZERO; + List<ApiClothesLocationRemarkVo> locationRemarkList = new ArrayList<>(); + List<ClothesLocationRemark> locationRemarks = clothesLocationRemarkMapper.selectList( + Wrappers.lambdaQuery(ClothesLocationRemark.class) + .eq(ClothesLocationRemark::getSourceId, entity.getId()) + .eq(ClothesLocationRemark::getType, SocialPatternLocationTypeEnum.MUSE.getValue()) + ); + if(CollUtil.isNotEmpty(locationRemarks)){ + for (ClothesLocationRemark locationRemark : locationRemarks){ + ApiClothesLocationRemarkVo vo = new ApiClothesLocationRemarkVo(); + ClothesLocation clothesLocation = clothesLocationMapper.selectById(locationRemark.getLocationId()); + vo.setLocationName(clothesLocation.getName()); + vo.setLocationRemark(locationRemark.getRemark()); + vo.setLocationPrice(clothesLocation.getPrice()); + vo.setLocationId(clothesLocation.getId()); + locationRemarkList.add(vo); + + totalLocationAmount = totalLocationAmount.add(clothesLocation.getPrice()); } + record.setLocationRemarkList(locationRemarkList); } Long artId = ObjectUtil.defaultIfNull(entity.getArtId(),0L); @@ -412,10 +485,11 @@ BigDecimal amount = record.getClothPrice() - .add(record.getLocationPrice()) + .add(totalLocationAmount) .add(record.getArtPrice()) .add(record.getSizePrice()) - .add(record.getPatternPrice()).setScale(2, RoundingMode.DOWN); + .add(totalPatternAmount) + .setScale(2, RoundingMode.DOWN); record.setAmount(amount); } diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java index f84f1a6..f52d65f 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java @@ -16,7 +16,9 @@ import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; import cc.mrbird.febs.mall.service.IMallMoneyFlowService; import cc.mrbird.febs.mall.vo.AdminMallOrderInfoVo; +import cc.mrbird.febs.mall.vo.clothes.AdminClothesLocationRemarkVo; import cc.mrbird.febs.mall.vo.clothes.AdminClothesOrderListVo; +import cc.mrbird.febs.mall.vo.clothes.AdminClothesPatternRemarkVo; import cc.mrbird.febs.mall.vo.clothes.AdminClothesSocialListVo; import cc.mrbird.febs.pay.util.WeixinServiceUtil; import cn.hutool.core.bean.BeanUtil; @@ -25,6 +27,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -68,6 +71,9 @@ private final ClothesSocialFileMapper clothesSocialFileMapper; private final ClothesSocialMuseMapper clothesSocialMuseMapper; private final ClothesSocialCategoryMapper clothesSocialCategoryMapper; + + private final ClothesPatternRemarkMapper clothesPatternRemarkMapper; + private final ClothesLocationRemarkMapper clothesLocationRemarkMapper; private final IApiMallMemberWalletService memberWalletService; private final IMallMoneyFlowService mallMoneyFlowService; @@ -158,6 +164,7 @@ public FebsResponse sizeAdd(ClothesSize dto) { ClothesSize clothesSize = new ClothesSize(); clothesSize.setName(dto.getName()); + clothesSize.setCode(dto.getCode()); clothesSize.setOrderNum(dto.getOrderNum()); clothesSize.setPrice(dto.getPrice()); clothesSize.setType(dto.getType()); @@ -200,7 +207,7 @@ ClothesPattern clothesPattern = new ClothesPattern(); clothesPattern.setName(dto.getName()); clothesPattern.setCode(dto.getCode()); - clothesPattern.setType(dto.getType()); +// clothesPattern.setType(dto.getType()); clothesPattern.setPrice(dto.getPrice()); clothesPattern.setOrderNum(dto.getOrderNum()); clothesPattern.setImage(dto.getImage()); @@ -223,7 +230,6 @@ .set(ClothesPattern::getContent, dto.getContent()) .set(ClothesPattern::getOrderNum, dto.getOrderNum()) .set(ClothesPattern::getPrice, dto.getPrice()) - .set(ClothesPattern::getType, dto.getType()) ); } return new FebsResponse().success().message("操作成功"); @@ -918,6 +924,10 @@ if(ObjectUtil.isNull(entity)){ throw new RuntimeException("内容不存在,无法操作"); } + + if(ObjectUtil.isNull(dto.getTypeId())){ + throw new RuntimeException("请选择设计类型"); + } entity.setCategoryId(dto.getCategoryId()); entity.setMemberId(dto.getMemberId()); entity.setName(dto.getName()); @@ -946,17 +956,10 @@ } } } - - clothesSocialMuseMapper.delete( - Wrappers.lambdaQuery(ClothesSocialMuse.class) - .eq(ClothesSocialMuse::getSocialId, entity.getId()) - ); - if(ObjectUtil.isNotNull(dto.getTypeId())){ - ClothesSocialMuse clothesSocialMuse = new ClothesSocialMuse(); - clothesSocialMuse.setSocialId(entity.getId()); - clothesSocialMuse.setTypeId(dto.getTypeId()); - clothesSocialMuseMapper.insert(clothesSocialMuse); - } + ClothesSocialMuse clothesSocialMuse = new ClothesSocialMuse(); + clothesSocialMuse.setSocialId(entity.getId()); + clothesSocialMuse.setTypeId(dto.getTypeId()); + clothesSocialMuseMapper.insert(clothesSocialMuse); return new FebsResponse().success().message("操作成功"); } @@ -1046,19 +1049,64 @@ ClothesSocialMuse entity = clothesSocialMuseMapper.selectById(id); if(ObjectUtil.isNotNull(entity)){ entity.setClothId(dto.getClothId()); - entity.setLocationId(dto.getLocationId()); entity.setSizeId(dto.getSizeId()); - entity.setPatternId(dto.getPatternId()); entity.setArtId(dto.getArtId()); - - JSONObject jsonObject = new JSONObject(); - jsonObject.putByPath("text", dto.getPatternText()); - jsonObject.putByPath("file", dto.getPatternImage()); - entity.setPatternRemark(jsonObject.toString()); - clothesSocialMuseMapper.updateById(entity); } + Long socialId = entity.getSocialId(); + ClothesSocial clothesSocial = clothesSocialMapper.selectById(socialId); + + List<AdminClothesPatternRemarkVo> patternData = dto.getPatternData(); + if(CollUtil.isNotEmpty(patternData)){ + Set<Long> patternIds = patternData.stream().map(AdminClothesPatternRemarkVo::getPatternId).collect(Collectors.toSet()); + + clothesPatternRemarkMapper.delete( + Wrappers.lambdaQuery(ClothesPatternRemark.class) + .eq(ClothesPatternRemark::getType, SocialPatternLocationTypeEnum.MUSE.getValue()) + .eq(ClothesPatternRemark::getSourceId, id) + .in(ClothesPatternRemark::getPatternId, patternIds) + ); + for (AdminClothesPatternRemarkVo pattern : patternData) { + ClothesPatternRemark clothesPatternRemark = new ClothesPatternRemark(); + clothesPatternRemark.setMemberId(clothesSocial.getMemberId()); + clothesPatternRemark.setType(SocialPatternLocationTypeEnum.MUSE.getValue()); + clothesPatternRemark.setSourceId(entity.getId()); + clothesPatternRemark.setPatternId(pattern.getPatternId()); + + Map<String,String> remarkMap = new HashMap<>(); + remarkMap.put("file",pattern.getSkuPatternImage()); + remarkMap.put("text",pattern.getPatternText()); + clothesPatternRemark.setRemark(JSONUtil.parse(remarkMap).toString()); + clothesPatternRemarkMapper.insert(clothesPatternRemark); + } + } + + List<AdminClothesLocationRemarkVo> locationData = dto.getLocationData(); + if(CollUtil.isNotEmpty(locationData)){ + Set<Long> locationIds = locationData.stream().map(AdminClothesLocationRemarkVo::getLocationId).collect(Collectors.toSet()); + + clothesLocationRemarkMapper.delete( + Wrappers.lambdaQuery(ClothesLocationRemark.class) + .eq(ClothesLocationRemark::getType, SocialPatternLocationTypeEnum.MUSE.getValue()) + .eq(ClothesLocationRemark::getSourceId, id) + .in(ClothesLocationRemark::getLocationId, locationIds) + ); + for (AdminClothesLocationRemarkVo location : locationData) { + ClothesLocationRemark clothesLocationRemark = new ClothesLocationRemark(); + clothesLocationRemark.setMemberId(clothesSocial.getMemberId()); + clothesLocationRemark.setType(SocialPatternLocationTypeEnum.MUSE.getValue()); + clothesLocationRemark.setSourceId(entity.getId()); + clothesLocationRemark.setLocationId(location.getLocationId()); + + Map<String,String> remarkMap = new HashMap<>(); + remarkMap.put("file",location.getSkuLocationImage()); + remarkMap.put("text",location.getLocationText()); + clothesLocationRemark.setRemark(JSONUtil.parse(remarkMap).toString()); + clothesLocationRemarkMapper.insert(clothesLocationRemark); + } + } + return new FebsResponse().success().message("操作成功"); } diff --git a/src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesLocationRemarkVo.java b/src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesLocationRemarkVo.java new file mode 100644 index 0000000..180be5c --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesLocationRemarkVo.java @@ -0,0 +1,12 @@ +package cc.mrbird.febs.mall.vo.clothes; + +import lombok.Data; + +@Data +public class AdminClothesLocationRemarkVo { + + private Long locationId; + private String locationName; + private String locationText; + private String skuLocationImage; +} diff --git a/src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesPatternRemarkVo.java b/src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesPatternRemarkVo.java new file mode 100644 index 0000000..efc996c --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesPatternRemarkVo.java @@ -0,0 +1,12 @@ +package cc.mrbird.febs.mall.vo.clothes; + +import lombok.Data; + +@Data +public class AdminClothesPatternRemarkVo { + + private Long patternId; + private String patternName; + private String patternText; + private String skuPatternImage; +} diff --git a/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesLocationInfoVo.java b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesLocationInfoVo.java new file mode 100644 index 0000000..cce33bd --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesLocationInfoVo.java @@ -0,0 +1,22 @@ +package cc.mrbird.febs.mall.vo.clothes; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +@ApiModel(value = "ApiClothesLocationInfoVo", description = "参数") +public class ApiClothesLocationInfoVo { + + + @ApiModelProperty(value = "反面图案ID") + private Long locationId; + @ApiModelProperty(value = "反面图案名称") + private String locationName; + @ApiModelProperty(value = "反面图案价格") + private BigDecimal locationPrice = BigDecimal.ZERO; + @ApiModelProperty(value = "反面自定义内容") + private String locationRemark; +} diff --git a/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesLocationRemarkVo.java b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesLocationRemarkVo.java new file mode 100644 index 0000000..df2ba42 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesLocationRemarkVo.java @@ -0,0 +1,22 @@ +package cc.mrbird.febs.mall.vo.clothes; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +@ApiModel(value = "ApiClothesLocationRemarkVo", description = "参数") +public class ApiClothesLocationRemarkVo { + + + @ApiModelProperty(value = "反面图案ID") + private Long locationId; + @ApiModelProperty(value = "反面图案名称") + private String locationName; + @ApiModelProperty(value = "反面图案价格") + private BigDecimal locationPrice = BigDecimal.ZERO; + @ApiModelProperty(value = "反面自定义内容") + private String locationRemark; +} diff --git a/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesPatternInfoVo.java b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesPatternInfoVo.java new file mode 100644 index 0000000..a1fe32b --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesPatternInfoVo.java @@ -0,0 +1,22 @@ +package cc.mrbird.febs.mall.vo.clothes; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +@ApiModel(value = "ApiClothesPatternInfoVo", description = "参数") +public class ApiClothesPatternInfoVo { + + + @ApiModelProperty(value = "正面图案ID") + private Long patternId; + @ApiModelProperty(value = "正面图案名称") + private String patternName; + @ApiModelProperty(value = "正面图案价格") + private BigDecimal patternPrice = BigDecimal.ZERO; + @ApiModelProperty(value = "正面自定义内容") + private String patternRemark; +} diff --git a/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesPatternRemarkVo.java b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesPatternRemarkVo.java new file mode 100644 index 0000000..aed07b4 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesPatternRemarkVo.java @@ -0,0 +1,22 @@ +package cc.mrbird.febs.mall.vo.clothes; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +@ApiModel(value = "ApiClothesPatternRemarkVo", description = "参数") +public class ApiClothesPatternRemarkVo { + + + @ApiModelProperty(value = "正面图案ID") + private Long patternId; + @ApiModelProperty(value = "正面图案名称") + private String patternName; + @ApiModelProperty(value = "正面图案价格") + private BigDecimal patternPrice = BigDecimal.ZERO; + @ApiModelProperty(value = "正面自定义内容") + private String patternRemark; +} diff --git a/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesSocialMuseVo.java b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesSocialMuseVo.java index dc9db5f..2d7539b 100644 --- a/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesSocialMuseVo.java +++ b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesSocialMuseVo.java @@ -5,6 +5,7 @@ import lombok.Data; import java.math.BigDecimal; +import java.util.List; @Data @ApiModel(value = "ApiClothesSocialMuseVo", description = "参数") @@ -37,22 +38,6 @@ @ApiModelProperty(value = "尺码价格") private BigDecimal sizePrice = BigDecimal.ZERO; - @ApiModelProperty(value = "图案ID") - private Long patternId; - @ApiModelProperty(value = "图案名称") - private String patternName; - @ApiModelProperty(value = "图案价格") - private BigDecimal patternPrice = BigDecimal.ZERO; - @ApiModelProperty(value = "自定义内容") - private String patternRemark; - - @ApiModelProperty(value = "图案位置ID") - private Long locationId; - @ApiModelProperty(value = "图案位置") - private String locationName; - @ApiModelProperty(value = "图案位置价格") - private BigDecimal locationPrice = BigDecimal.ZERO; - @ApiModelProperty(value = "布料ID") private Long clothId; @ApiModelProperty(value = "布料名称") @@ -60,4 +45,12 @@ @ApiModelProperty(value = "布料价格") private BigDecimal clothPrice = BigDecimal.ZERO; + + + @ApiModelProperty(value = "正面图案详情") + private List<ApiClothesPatternRemarkVo> patternRemarkList; + + @ApiModelProperty(value = "反面图案详情") + private List<ApiClothesLocationRemarkVo> locationRemarkList; + } diff --git a/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiMyDraftVo.java b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiMyDraftVo.java index f25e914..f789d3b 100644 --- a/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiMyDraftVo.java +++ b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiMyDraftVo.java @@ -5,6 +5,7 @@ import lombok.Data; import java.math.BigDecimal; +import java.util.List; @Data @ApiModel(value = "ApiMyDraftVo", description = "参数") @@ -37,21 +38,13 @@ @ApiModelProperty(value = "尺码价格") private BigDecimal sizePrice = BigDecimal.ZERO; - @ApiModelProperty(value = "图案ID") - private Long patternId; - @ApiModelProperty(value = "图案名称") - private String patternName; - @ApiModelProperty(value = "图案价格") - private BigDecimal patternPrice = BigDecimal.ZERO; - @ApiModelProperty(value = "自定义内容") - private String patternRemark; + @ApiModelProperty(value = "正面图案") + private List<ApiClothesPatternInfoVo> patternList; - @ApiModelProperty(value = "图案位置ID") - private Long locationId; - @ApiModelProperty(value = "图案位置") - private String locationName; - @ApiModelProperty(value = "图案位置价格") - private BigDecimal locationPrice = BigDecimal.ZERO; + @ApiModelProperty(value = "反面图案") + private List<ApiClothesLocationInfoVo> locationList; + + @ApiModelProperty(value = "布料ID") private Long clothId; diff --git a/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiSocialMuseVo.java b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiSocialMuseVo.java index 382c54f..6b4159c 100644 --- a/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiSocialMuseVo.java +++ b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiSocialMuseVo.java @@ -5,6 +5,7 @@ import lombok.Data; import java.math.BigDecimal; +import java.util.List; @Data @ApiModel(value = "ApiSocialMuseVo", description = "参数") @@ -25,15 +26,13 @@ private String artName; @ApiModelProperty(value = "尺码名称") private String sizeName; - @ApiModelProperty(value = "图案名称") - private String patternName; - @ApiModelProperty(value = "图案图片内容") - private String patternImage; - @ApiModelProperty(value = "图案文案内容") - private String patternText; - @ApiModelProperty(value = "图案位置名称") - private String locationName; @ApiModelProperty(value = "布料名称") private String clothName; + + @ApiModelProperty(value = "正面图案详情") + private List<ApiClothesPatternRemarkVo> patternRemarkList; + + @ApiModelProperty(value = "反面图案详情") + private List<ApiClothesLocationRemarkVo> locationRemarkList; } diff --git a/src/main/resources/mapper/modules/ClothesLocationRemarkMapper.xml b/src/main/resources/mapper/modules/ClothesLocationRemarkMapper.xml new file mode 100644 index 0000000..0f0cc70 --- /dev/null +++ b/src/main/resources/mapper/modules/ClothesLocationRemarkMapper.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="cc.mrbird.febs.mall.mapper.ClothesLocationRemarkMapper"> + +</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/modules/ClothesPatternRemarkMapper.xml b/src/main/resources/mapper/modules/ClothesPatternRemarkMapper.xml new file mode 100644 index 0000000..5e33ae4 --- /dev/null +++ b/src/main/resources/mapper/modules/ClothesPatternRemarkMapper.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="cc.mrbird.febs.mall.mapper.ClothesPatternRemarkMapper"> + +</mapper> \ No newline at end of file diff --git a/src/main/resources/templates/febs/views/modules/clothesType/locationList.html b/src/main/resources/templates/febs/views/modules/clothesType/locationList.html index 94601e2..89c1da1 100644 --- a/src/main/resources/templates/febs/views/modules/clothesType/locationList.html +++ b/src/main/resources/templates/febs/views/modules/clothesType/locationList.html @@ -1,4 +1,4 @@ -<div class="layui-fluid layui-anim febs-anim" id="febs-location" lay-title="图案位置管理"> +<div class="layui-fluid layui-anim febs-anim" id="febs-location" lay-title="反面图案管理"> <div class="layui-row febs-container"> <div class="layui-col-md12"> <div class="layui-card"> diff --git a/src/main/resources/templates/febs/views/modules/clothesType/patternAdd.html b/src/main/resources/templates/febs/views/modules/clothesType/patternAdd.html index c09063a..f78993c 100644 --- a/src/main/resources/templates/febs/views/modules/clothesType/patternAdd.html +++ b/src/main/resources/templates/febs/views/modules/clothesType/patternAdd.html @@ -28,18 +28,18 @@ </div> </div> - <div class="layui-row layui-col-space10 layui-form-item"> - <div class="layui-col-lg6"> - <label class="layui-form-label febs-form-item-require">图案类型:</label> - <div class="layui-input-block"> - <select name="type"> - <option value="1">文字</option> - <option value="2">图案</option> - <option value="3">文字和图案</option> - </select> - </div> - </div> - </div> +<!-- <div class="layui-row layui-col-space10 layui-form-item">--> +<!-- <div class="layui-col-lg6">--> +<!-- <label class="layui-form-label febs-form-item-require">图案类型:</label>--> +<!-- <div class="layui-input-block">--> +<!-- <select name="type">--> +<!-- <option value="1">文字</option>--> +<!-- <option value="2">图案</option>--> +<!-- <option value="3">文字和图案</option>--> +<!-- </select>--> +<!-- </div>--> +<!-- </div>--> +<!-- </div>--> <div class="layui-row layui-col-space10 layui-form-item"> <div class="layui-col-lg6"> diff --git a/src/main/resources/templates/febs/views/modules/clothesType/patternInfo.html b/src/main/resources/templates/febs/views/modules/clothesType/patternInfo.html index 5bd799b..b5ae00e 100644 --- a/src/main/resources/templates/febs/views/modules/clothesType/patternInfo.html +++ b/src/main/resources/templates/febs/views/modules/clothesType/patternInfo.html @@ -30,18 +30,18 @@ </div> </div> - <div class="layui-row layui-col-space10 layui-form-item"> - <div class="layui-col-lg6"> - <label class="layui-form-label febs-form-item-require">图案类型:</label> - <div class="layui-input-block"> - <select name="type"> - <option value="1">文字</option> - <option value="2">图案</option> - <option value="3">文字和图案</option> - </select> - </div> - </div> - </div> +<!-- <div class="layui-row layui-col-space10 layui-form-item">--> +<!-- <div class="layui-col-lg6">--> +<!-- <label class="layui-form-label febs-form-item-require">图案类型:</label>--> +<!-- <div class="layui-input-block">--> +<!-- <select name="type">--> +<!-- <option value="1">文字</option>--> +<!-- <option value="2">图案</option>--> +<!-- <option value="3">文字和图案</option>--> +<!-- </select>--> +<!-- </div>--> +<!-- </div>--> +<!-- </div>--> <div class="layui-row layui-col-space10 layui-form-item"> <div class="layui-col-lg6"> @@ -190,7 +190,6 @@ "name": clothesPattern.name, "code": clothesPattern.code, "price": clothesPattern.price, - "type": clothesPattern.type, "orderNum": clothesPattern.orderNum, }); diff --git a/src/main/resources/templates/febs/views/modules/clothesType/patternList.html b/src/main/resources/templates/febs/views/modules/clothesType/patternList.html index 5134a83..f210610 100644 --- a/src/main/resources/templates/febs/views/modules/clothesType/patternList.html +++ b/src/main/resources/templates/febs/views/modules/clothesType/patternList.html @@ -1,4 +1,4 @@ -<div class="layui-fluid layui-anim febs-anim" id="febs-pattern" lay-title="图案管理"> +<div class="layui-fluid layui-anim febs-anim" id="febs-pattern" lay-title="正面图案管理"> <div class="layui-row febs-container"> <div class="layui-col-md12"> <div class="layui-card"> @@ -52,16 +52,16 @@ <script type="text/html" id="patternOption"> <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="patternInfo:view" lay-event="patternInfoEvent">编辑</button> </script> -<script type="text/html" id="patternTypeOption"> - {{# - var type = { - 1: {title: '文字', color: 'green'}, - 2: {title: '图案', color: 'blue'}, - 3: {title: '文字和图案', color: 'red'}, - }[d.type]; - }} - <span class="layui-badge febs-bg-{{type.color}}">{{ type.title }}</span> -</script> +<!--<script type="text/html" id="patternTypeOption">--> +<!-- {{#--> +<!-- var type = {--> +<!-- 1: {title: '文字', color: 'green'},--> +<!-- 2: {title: '图案', color: 'blue'},--> +<!-- 3: {title: '文字和图案', color: 'red'},--> +<!-- }[d.type];--> +<!-- }}--> +<!-- <span class="layui-badge febs-bg-{{type.color}}">{{ type.title }}</span>--> +<!--</script>--> <!-- 表格操作栏 end --> @@ -156,7 +156,7 @@ {field: 'code', title: '编码', minWidth: 150,align:'center'}, {field: 'orderNum', title: '序号', minWidth: 100,align:'center'}, {field: 'price', title: '价格', minWidth: 150,align:'center'}, - {title: '图案类型', templet: '#patternTypeOption', minWidth: 150,align:'center'}, + // {title: '图案类型', templet: '#patternTypeOption', minWidth: 150,align:'center'}, {field: 'image',title: '小图标', templet: function (d) { return '<a lay-event="seePatternImage">' + diff --git a/src/main/resources/templates/febs/views/modules/clothesType/socialMuseUpdate.html b/src/main/resources/templates/febs/views/modules/clothesType/socialMuseUpdate.html index 735c7a6..9be04e7 100644 --- a/src/main/resources/templates/febs/views/modules/clothesType/socialMuseUpdate.html +++ b/src/main/resources/templates/febs/views/modules/clothesType/socialMuseUpdate.html @@ -26,58 +26,6 @@ </div> </div> </div> - - <div class="layui-row layui-col-space10 layui-form-item"> - <div class="layui-col-lg6"> - <label class="layui-form-label febs-form-item-require">图案:</label> - <div class="layui-input-block"> - <div id="sc-pattern"></div> - </div> - </div> - </div> - - - <div class="layui-row layui-col-space10 layui-form-item"> - <div class="layui-col-lg6"> - <label class="layui-form-label">图案-文字:</label> - <div class="layui-input-block"> - <input type="text" name="patternText" - placeholder="" autocomplete="off" class="layui-input"> - </div> - </div> - </div> - <div class="layui-row layui-col-space10 layui-form-item"> - <div class="layui-col-lg6"> - <label class="layui-form-label">图案-图片:</label> - <div class="layui-input-block"> - <div class="layui-upload"> - <button type="button" class="layui-btn layui-btn-normal layui-btn" id="patternImageUploadButton">上传</button> - <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> - <div class="layui-upload-list" id="patternImageUpload"></div> - </blockquote> - </div> - </div> - </div> - </div> - - <div class="layui-row layui-col-space10 layui-form-item febs-hide"> - <div class="layui-col-lg6"> - <label class="layui-form-label">图案:</label> - <div class="layui-input-block"> - <input type="text" id="patternImage" name="patternImage" autocomplete="off" class="layui-input" readonly> - </div> - </div> - </div> - - <div class="layui-row layui-col-space10 layui-form-item"> - <div class="layui-col-lg6"> - <label class="layui-form-label febs-form-item-require">位置:</label> - <div class="layui-input-block"> - <div id="sc-location"></div> - </div> - </div> - </div> - <div class="layui-row layui-col-space10 layui-form-item"> <div class="layui-col-lg6"> <label class="layui-form-label febs-form-item-require">尺码:</label> @@ -92,6 +40,50 @@ <label class="layui-form-label febs-form-item-require">工艺:</label> <div class="layui-input-block"> <div id="sc-art"></div> + </div> + </div> + </div> + + <div class="layui-form-item multi-rule-table"> + <div class="layui-row layui-col-space10 layui-form-item"> + <blockquote class="layui-elem-quote blue-border">正面图案</blockquote> + + <div class="layui-col-lg6"> + <label class="layui-form-label">图案:</label> + <div class="layui-input-block"> + <div id="sc-pattern"></div> + </div> + </div> + <div class="layui-col-lg6"> + <button type="button" class="layui-btn layui-btn-normal layui-btn" id="testPattern" >添加</button> + </div> + </div> + + <div class="layui-form-item"> + <div class="layui-input-block"> + <table id="multiPattern" lay-filter="multiPattern"></table> + </div> + </div> + </div> + + <div class="layui-form-item multi-rule-table"> + <div class="layui-row layui-col-space10 layui-form-item"> + <blockquote class="layui-elem-quote blue-border">反面图案</blockquote> + + <div class="layui-col-lg6"> + <label class="layui-form-label">图案:</label> + <div class="layui-input-block"> + <div id="sc-location"></div> + </div> + </div> + <div class="layui-col-lg6"> + <button type="button" class="layui-btn layui-btn-normal layui-btn" id="testLocation" >添加</button> + </div> + </div> + + <div class="layui-form-item"> + <div class="layui-input-block"> + <table id="multiLocation" lay-filter="multiLocation"></table> </div> </div> </div> @@ -119,6 +111,30 @@ <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" lay-event="delSku">删除</button> </div> </script> + +<script type="text/html" id="tablePatternImgUpload"> + <div class="layui-upload"> + <button type="button" class="layui-btn layui-btn-normal layui-btn-xs sku-img" id="skuPatternImg{{d.index}}">上传 + </button> + </br> + <img class="layui-upload-img" id="imagePatternUrls{{d.index}}" style="width: 100px; display:none;" + src="{{d.skuPatternImage}}"> + <input type="text" id="skuPatternImage{{d.index}}" name="skuPatternImage{{d.index}}" autoComplete="off" value="{{d.skuPatternImage}}" + class="layui-input febs-hide"> + </div> +</script> + +<script type="text/html" id="tableLocationImgUpload"> + <div class="layui-upload"> + <button type="button" class="layui-btn layui-btn-normal layui-btn-xs sku-img" id="skuLocationImg{{d.index}}">上传 + </button> + </br> + <img class="layui-upload-img" id="imageLocationUrls{{d.index}}" style="width: 100px; display:none;" + src="{{d.skuLocationImage}}"> + <input type="text" id="skuLocationImage{{d.index}}" name="skuLocationImage{{d.index}}" autoComplete="off" value="{{d.skuLocationImage}}" + class="layui-input febs-hide"> + </div> +</script> <!-- 表格操作栏 end --> <script data-th-inline="javascript"> layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','dropdown', 'laydate', 'layedit', 'upload', 'element', 'table', 'xmSelect'], function () { @@ -138,8 +154,312 @@ validate = layui.validate, element = layui.element; - + form.render(); formSelects.render(); + + var patternSet = xmSelect.render({ + + el: '#sc-pattern', + language: 'zn', + prop : { + value : 'id', + children : 'child' + }, + iconfont: { + parent: 'hidden', + }, + tips: '请选择', + filterable: true, + radio: true, + clickClose: true, + tree: { + show: true, + //非严格模式 + strict: false, + }, + data: [] + }) + febs.get(ctx + 'admin/clothesType/allPattern/' + socialMuse.typeId, null, function(res) { + patternSet.update({ + data : res.data, + autoRow: true, + }); + }) + + $('#testPattern').on('click', function (){ + let patternChoice = patternSet.getValue(); + console.log(patternChoice); + if(patternChoice == null || patternChoice == ""){ + febs.alert.warn('请选择图案'); + return false; + } + for (let i = 0; i < patternChoice.length; i++) { + let data = {}; + data.patternId = patternChoice[i].id; + data.patternName = patternChoice[i].name; + addTablePatternDate(data); + } + }); + + var patternData=[]; + var tableInitPattern = table.render({ + elem: '#multiPattern' + ,limit:999 + ,toolbar:"#toolbar" + ,defaultToolbar:[] + ,cols:[[//表头 + + {type: 'checkbox'}, + {field: 'patternId', title: '正面ID', width:200,edit:'text'}, + {field: 'patternName', title: '正面图案', width:200,edit:'text'}, + {field: 'patternText', title: '文字', width:200,edit:'text'}, + {templet: '#tablePatternImgUpload', title: '图案', width:150}, + {field: 'skuPatternImage', title: '图案地址'}, + ]] + ,data: [] + + }); + + table.on('toolbar(multiPattern)', function(obj){ + var data = obj.data; + var hasData = table.cache['multiPattern']; + var checkData = table.checkStatus('multiPattern').data; + + if (checkData.length <= 0) { + febs.alert.warn('请选择删除数据'); + return; + } + if(obj.event === 'delSku'){ + for (let i = 0; i < checkData.length; i++) { + var delData = checkData[i]; + for (let j = 0; j < hasData.length; j++) { + if (hasData[j].index == delData.index) { + hasData.splice(j, 1); + break; + } + } + } + + for (let i = 0; i < hasData.length; i++) { + hasData[i].index = i + 1; + } + + patternData=hasData; + reloadPatternTable(hasData); + } + }); + + function addTablePatternDate(data) { + var hasData = table.cache['multiPattern']; + + data.index = hasData.length + 1; + patternData.push(data); + + reloadPatternTable(patternData); + return data.index; + } + + function reloadPatternTable(data) { + table.reload('multiPattern', { + data : data + }); + + for (let i = 0; i < data.length; i++) { + if (data[i].skuPatternImage) { + $('#imagePatternUrls' + (i + 1)).css('display', 'block'); + } + // 重新绑定图片上传 + bindPatternUpload(i + 1); + } + } + + table.on('edit(multiPattern)', function(obj){ + var value = obj.value //得到修改后的值 + ,data = obj.data //得到所在行所有键值 + ,field = obj.field; //得到字段 + + for (let i = 0; i < patternData.length; i++) { + if (patternData[i].index == data.index) { + patternData[i] = data; + } + } + }); + + function bindPatternUpload(index) { + // 普通图片上传 + upload.render({ + elem: '#skuPatternImg' + index + , url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 + , done: function (res) { + febs.alert.success(res.data.src); + $('#imagePatternUrls' + index).attr('src', res.data.src); + $('#imagePatternUrls' + index).css('display', 'block'); + $('#skuPatternImage' + index).val(res.data.src); + + + for (let i = 0; i < patternData.length; i++) { + if (patternData[i].index == index) { + patternData[i].skuPatternImage = res.data.src; + } + } + + reloadPatternTable(patternData); + } + }); + } + + var locationSet = xmSelect.render({ + + el: '#sc-location', + language: 'zn', + prop : { + value : 'id', + children : 'child' + }, + iconfont: { + parent: 'hidden', + }, + tips: '请选择', + filterable: true, + radio: true, + clickClose: true, + tree: { + show: true, + //非严格模式 + strict: false, + }, + data: [] + }) + + febs.get(ctx + 'admin/clothesType/allLocation/' + socialMuse.typeId, null, function(res) { + locationSet.update({ + data : res.data, + autoRow: true, + }); + }) + + $('#testLocation').on('click', function (){ + let locationChoice = locationSet.getValue(); + console.log(locationChoice); + if(locationChoice == null || locationChoice == ""){ + febs.alert.warn('请选择图案'); + return false; + } + for (let i = 0; i < locationChoice.length; i++) { + let data = {}; + data.locationId = locationChoice[i].id; + data.locationName = locationChoice[i].name; + addTableLocationDate(data); + } + }); + + var locationData=[]; + var tableInitLocation = table.render({ + elem: '#multiLocation' + ,limit:999 + ,toolbar:"#toolbar" + ,defaultToolbar:[] + ,cols:[[//表头 + + {type: 'checkbox'}, + {field: 'locationId', title: '反面ID', width:200,edit:'text'}, + {field: 'locationName', title: '反面图案', width:200,edit:'text'}, + {field: 'locationText', title: '文字', width:200,edit:'text'}, + {templet: '#tableLocationImgUpload', title: '图案', width:150}, + {field: 'skuLocationImage', title: '图案地址'}, + ]] + ,data: [] + + }); + + table.on('toolbar(multiLocation)', function(obj){ + var data = obj.data; + var hasData = table.cache['multiLocation']; + var checkData = table.checkStatus('multiLocation').data; + + if (checkData.length <= 0) { + febs.alert.warn('请选择删除数据'); + return; + } + if(obj.event === 'delSku'){ + for (let i = 0; i < checkData.length; i++) { + var delData = checkData[i]; + for (let j = 0; j < hasData.length; j++) { + if (hasData[j].index == delData.index) { + hasData.splice(j, 1); + break; + } + } + } + + for (let i = 0; i < hasData.length; i++) { + hasData[i].index = i + 1; + } + + locationData=hasData; + reloadLocationTable(hasData); + } + }); + + function addTableLocationDate(data) { + var hasData = table.cache['multiLocation']; + + data.index = hasData.length + 1; + locationData.push(data); + + reloadLocationTable(locationData); + return data.index; + } + + function reloadLocationTable(data) { + table.reload('multiLocation', { + data : data + }); + + for (let i = 0; i < data.length; i++) { + if (data[i].skuLocationImage) { + $('#imageLocationUrls' + (i + 1)).css('display', 'block'); + } + // 重新绑定图片上传 + bindLocationUpload(i + 1); + } + } + + table.on('edit(multiLocation)', function(obj){ + var value = obj.value //得到修改后的值 + ,data = obj.data //得到所在行所有键值 + ,field = obj.field; //得到字段 + + for (let i = 0; i < locationData.length; i++) { + if (locationData[i].index == data.index) { + locationData[i] = data; + } + } + }); + + function bindLocationUpload(index) { + // 普通图片上传 + upload.render({ + elem: '#skuLocationImg' + index + , url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 + , done: function (res) { + febs.alert.success(res.data.src); + $('#imageLocationUrls' + index).attr('src', res.data.src); + $('#imageLocationUrls' + index).css('display', 'block'); + $('#skuLocationImage' + index).val(res.data.src); + + + for (let i = 0; i < locationData.length; i++) { + if (locationData[i].index == index) { + locationData[i].skuLocationImage = res.data.src; + } + } + + reloadLocationTable(locationData); + } + }); + } + //图片上传 upload.render({ @@ -216,64 +536,6 @@ }); }) - let scLocation = xmSelect.render({ - el: '#sc-location', - language: 'zn', - prop : { - value : 'id', - children : 'child' - }, - iconfont: { - parent: 'hidden', - }, - tips: '请选择', - filterable: true, - radio: true, - clickClose: true, - tree: { - show: true, - //非严格模式 - strict: false, - }, - data: [] - }) - - febs.get(ctx + 'admin/clothesType/allLocation/' + socialMuse.typeId, null, function(res) { - scLocation.update({ - data : res.data, - autoRow: true, - }); - }) - - let scPattern = xmSelect.render({ - el: '#sc-pattern', - language: 'zn', - prop : { - value : 'id', - children : 'child' - }, - iconfont: { - parent: 'hidden', - }, - tips: '请选择', - filterable: true, - radio: true, - clickClose: true, - tree: { - show: true, - //非严格模式 - strict: false, - }, - data: [] - }) - - febs.get(ctx + 'admin/clothesType/allPattern/' + socialMuse.typeId, null, function(res) { - scPattern.update({ - data : res.data, - autoRow: true, - }); - }) - let scCloth = xmSelect.render({ el: '#sc-cloth', language: 'zn', @@ -316,12 +578,8 @@ form.val("sc-muse-update-form", { "id": socialMuse.id, - "patternImage": socialMuse.patternImage, - "patternText": socialMuse.patternText, }); - $('#patternImageUpload').append('<img src="' + socialMuse.patternImage + '" alt="" class="layui-upload-img single-image" style="width: 130px">'); - $("#patternImage").val(socialMuse.patternImage); var artList = []; artList.push(socialMuse.artId); @@ -331,27 +589,42 @@ sizeList.push(socialMuse.sizeId); scSize.setValue(sizeList); - var patternList = []; - patternList.push(socialMuse.patternId); - scPattern.setValue(patternList); - var clothList = []; clothList.push(socialMuse.clothId); scCloth.setValue(clothList); - var locationList = []; - locationList.push(socialMuse.locationId); - scLocation.setValue(locationList); + var patternDataList = socialMuse.patternData; + if (patternDataList) { + for (let i = 0; i < patternDataList.length; i++) { + patternDataList[i].index = i+1; + } + patternData = patternDataList; + reloadPatternTable(patternData); + } + + var locationDataList = socialMuse.locationData; + if (locationDataList) { + for (let i = 0; i < locationDataList.length; i++) { + locationDataList[i].index = i+1; + } + locationData = locationDataList; + reloadLocationTable(locationData); + } } + + + form.on('submit(sc-muse-update-form-submit)', function (data) { data.field.artId = scArt.getValue('valueStr'); data.field.sizeId = scSize.getValue('valueStr'); - data.field.patternId = scPattern.getValue('valueStr'); - data.field.locationId = scLocation.getValue('valueStr'); + + data.field.patternData = patternData; + data.field.locationData = locationData; + data.field.clothId = scCloth.getValue('valueStr'); $.ajax({ 'url':ctx + 'admin/clothesType/socialMuseUpdate', diff --git a/src/main/resources/templates/febs/views/modules/clothesType/typeList.html b/src/main/resources/templates/febs/views/modules/clothesType/typeList.html index 69e3714..190cf0d 100644 --- a/src/main/resources/templates/febs/views/modules/clothesType/typeList.html +++ b/src/main/resources/templates/febs/views/modules/clothesType/typeList.html @@ -57,8 +57,8 @@ <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="artSet:view" lay-event="artSet">工艺配置</button> <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="sizeSet:view" lay-event="sizeSet">尺码配置</button> <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="clothSet:view" lay-event="clothSet">布料配置</button> - <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="patternSet:view" lay-event="patternSet">图案文字配置</button> - <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="locationSet:view" lay-event="locationSet">图案位置配置</button> + <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="patternSet:view" lay-event="patternSet">正面图案配置</button> + <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="locationSet:view" lay-event="locationSet">反面图案配置</button> </div> </script> @@ -335,7 +335,7 @@ febs.alert.warn('每次操作只能操作一行数据'); return; } - febs.modal.open('图案文字配置', 'modules/clothesType/patternSet/' + checkData[0].id, { + febs.modal.open('正面图案配置', 'modules/clothesType/patternSet/' + checkData[0].id, { btn: ['提交', '取消'], area:['100%','100%'], yes: function (index, layero) { @@ -353,7 +353,7 @@ febs.alert.warn('每次操作只能操作一行数据'); return; } - febs.modal.open('图案位置配置', 'modules/clothesType/locationSet/' + checkData[0].id, { + febs.modal.open('反面图案配置', 'modules/clothesType/locationSet/' + checkData[0].id, { btn: ['提交', '取消'], area:['100%','100%'], yes: function (index, layero) { @@ -382,8 +382,8 @@ {field: 'state', title: '允许上线', templet: '#stateSwitch', minWidth: 130,align:'center'}, {field: 'clothState', title: '允许选择布料', templet: '#clothStateSwitch', minWidth: 130,align:'center'}, {field: 'artState', title: '允许选择工艺', templet: '#artStateSwitch', minWidth: 130,align:'center'}, - {field: 'patternState', title: '允许选择图案', templet: '#patternStateSwitch', minWidth: 130,align:'center'}, - {field: 'locationState', title: '允许选择图案位置', templet: '#locationStateSwitch', minWidth: 180,align:'center'}, + {field: 'patternState', title: '允许选择正面图案', templet: '#patternStateSwitch', minWidth: 130,align:'center'}, + {field: 'locationState', title: '允许选择反面图案', templet: '#locationStateSwitch', minWidth: 180,align:'center'}, {field: 'sizeState', title: '允许选择尺码', templet: '#sizeStateSwitch', minWidth: 130,align:'center'}, {field: 'image',title: '小图标', templet: function (d) { -- Gitblit v1.9.1