From 1bd4ff2dea7dde4592c31f6911255c9d28d45f87 Mon Sep 17 00:00:00 2001 From: Administrator <15274802129@163.com> Date: Thu, 10 Jul 2025 16:35:03 +0800 Subject: [PATCH] feat(mall): 为衣服类型添加运费模板 ID --- src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java | 127 ++++++++++++++++++++++++++++++++++++----- 1 files changed, 110 insertions(+), 17 deletions(-) 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 6d6c591..0c1efce 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,14 +16,15 @@ 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.AdminClothesOrderListVo; -import cc.mrbird.febs.mall.vo.clothes.AdminClothesSocialListVo; +import cc.mrbird.febs.mall.vo.clothes.*; import cc.mrbird.febs.pay.util.WeixinServiceUtil; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; 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; @@ -67,6 +68,10 @@ private final ClothesSocialFileMapper clothesSocialFileMapper; private final ClothesSocialMuseMapper clothesSocialMuseMapper; private final ClothesSocialCategoryMapper clothesSocialCategoryMapper; + + private final ClothesPatternRemarkMapper clothesPatternRemarkMapper; + private final ClothesLocationRemarkMapper clothesLocationRemarkMapper; + private final ClothesSocialCommentMapper clothesSocialCommentMapper; private final IApiMallMemberWalletService memberWalletService; private final IMallMoneyFlowService mallMoneyFlowService; @@ -157,6 +162,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()); @@ -199,7 +205,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()); @@ -222,7 +228,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("操作成功"); @@ -745,6 +750,13 @@ } @Override + public IPage<AdminClothesSocialCommentVo> socialComment(ClothesSocialComment dto, QueryRequest request) { + Page<AdminClothesSocialCommentVo> page = new Page<>(request.getPageNum(), request.getPageSize()); + IPage<AdminClothesSocialCommentVo> vos = clothesSocialCommentMapper.selectSocialCommentListInPage(page, dto); + return vos; + } + + @Override public FebsResponse socialState(Long id, Integer state) { ClothesSocial clothesSocial = clothesSocialMapper.selectById(id); @@ -756,6 +768,39 @@ Wrappers.lambdaUpdate(ClothesSocial.class) .set(ClothesSocial::getState, state) .eq(ClothesSocial::getId, id) + ); + return new FebsResponse().success().message("操作成功"); + } + + @Override + public FebsResponse commentStateSwitch(Long id, Integer state) { + + ClothesSocial clothesSocial = clothesSocialMapper.selectById(id); + if(ObjectUtil.isNull(clothesSocial)){ + throw new RuntimeException("内容不存在"); + } + clothesSocialMapper.update( + null, + Wrappers.lambdaUpdate(ClothesSocial.class) + .set(ClothesSocial::getCommentState, state) + .eq(ClothesSocial::getId, id) + ); + return new FebsResponse().success().message("操作成功"); + } + + @Override + public FebsResponse showStateSwitch(Long id, Integer state) { + + ClothesSocialComment clothesSocialComment = clothesSocialCommentMapper.selectById(id); + + if(ObjectUtil.isNull(clothesSocialComment)){ + throw new RuntimeException("评论不存在"); + } + clothesSocialCommentMapper.update( + null, + Wrappers.lambdaUpdate(ClothesSocialComment.class) + .set(ClothesSocialComment::getShowState, state) + .eq(ClothesSocialComment::getId, id) ); return new FebsResponse().success().message("操作成功"); } @@ -917,6 +962,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()); @@ -945,17 +994,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("操作成功"); } @@ -1045,13 +1087,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()); 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("操作成功"); } -- Gitblit v1.9.1