From 47a33d3f93c3d7ac3e251386e8cc44a9ad806549 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Tue, 22 Jul 2025 09:58:12 +0800
Subject: [PATCH] feat(mall): 添加获取草稿角标数量的功能
---
src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java | 348 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 323 insertions(+), 25 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 f84f1a6..25b929a 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
@@ -3,6 +3,7 @@
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.entity.QueryRequest;
import cc.mrbird.febs.common.enumerates.*;
+import cc.mrbird.febs.common.exception.FebsException;
import cc.mrbird.febs.common.properties.XcxProperties;
import cc.mrbird.febs.common.utils.SpringContextHolder;
import cc.mrbird.febs.common.utils.excl.ExcelSheetPO;
@@ -16,15 +17,16 @@
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.JSON;
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;
@@ -41,6 +43,7 @@
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.net.URLEncoder;
import java.util.*;
import java.util.stream.Collectors;
@@ -63,11 +66,17 @@
private final ClothesTypePatternMapper clothesTypePatternMapper;
private final ClothesTypeLocationMapper clothesTypeLocationMapper;
private final ClothesOrderMapper clothesOrderMapper;
+ private final ClothesOrderItemMapper clothesOrderItemMapper;
private final MallExpressInfoMapper mallExpressInfoMapper;
private final ClothesSocialMapper clothesSocialMapper;
private final ClothesSocialFileMapper clothesSocialFileMapper;
private final ClothesSocialMuseMapper clothesSocialMuseMapper;
private final ClothesSocialCategoryMapper clothesSocialCategoryMapper;
+ private final ClothesMemberStatureMapper clothesMemberStatureMapper;
+
+ private final ClothesPatternRemarkMapper clothesPatternRemarkMapper;
+ private final ClothesLocationRemarkMapper clothesLocationRemarkMapper;
+ private final ClothesSocialCommentMapper clothesSocialCommentMapper;
private final IApiMallMemberWalletService memberWalletService;
private final IMallMoneyFlowService mallMoneyFlowService;
@@ -158,6 +167,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 +210,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 +233,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("操作成功");
@@ -543,8 +552,8 @@
clothesOrderMapper.update(
null,
Wrappers.lambdaUpdate(ClothesOrder.class)
- .set(ClothesOrder::getStatus, ClothesOrderStatusEnum.CANCEL.getValue())
- .set(ClothesOrder::getUpdatedTime, new Date())
+ .set(ClothesOrder::getStatus, value)
+ .set(ClothesOrder::getUpdatedTime, date)
.eq(ClothesOrder::getId, id)
);
}
@@ -746,6 +755,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);
@@ -757,6 +773,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("操作成功");
}
@@ -918,6 +967,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 +999,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,20 +1092,272 @@
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("操作成功");
}
+ @Override
+ public FebsResponse printOrder(AdminClothesPrintOrderDto dto) {
+ HashMap<String, Object> objectObjectHashMap = new HashMap<>();
+ ClothesOrder order = clothesOrderMapper.selectById(dto.getId());
+ if (ObjectUtil.isNotNull(order)){
+ objectObjectHashMap.put("orderNo", order.getOrderNo());
+ }
+ ClothesType clothesType = clothesTypeMapper.selectById(order.getTypeId());
+ if (ObjectUtil.isNotNull(clothesType)) {
+ objectObjectHashMap.put("typeName", clothesType.getName());
+ objectObjectHashMap.put("typeFront", clothesType.getImageFront());
+ objectObjectHashMap.put("typeBack", clothesType.getImageBack());
+ }
+ List<ClothesOrderItem> clothesOrderItems = clothesOrderItemMapper.selectList(
+ Wrappers.lambdaQuery(ClothesOrderItem.class)
+ .eq(ClothesOrderItem::getOrderId, order.getId())
+ );
+ if(CollUtil.isNotEmpty(clothesOrderItems)){
+ for (ClothesOrderItem item : clothesOrderItems){
+ if (ClothesOrderItemEnum.CLOTH.getCode() == item.getType()) {
+ ClothesCloth cloth = clothesClothMapper.selectById(item.getItemId());
+ if (ObjectUtil.isNotNull(cloth)) {
+ objectObjectHashMap.put("clothName", cloth.getName());
+ objectObjectHashMap.put("clothCode", cloth.getCode());
+ }
+ continue;
+ } else if (ClothesOrderItemEnum.SIZE.getCode() == item.getType()) {
+ ClothesSize size = clothesSizeMapper.selectById(item.getItemId());
+ if (ObjectUtil.isNotNull(size)) {
+ objectObjectHashMap.put("sizeName", size.getName());
+ objectObjectHashMap.put("sizeCode", size.getCode());
+ }
+ continue;
+ } else if (ClothesOrderItemEnum.LOCATION.getCode() == item.getType()) {
+ ClothesLocation location = clothesLocationMapper.selectById(item.getItemId());
+ if (ObjectUtil.isNotNull(location)) {
+ objectObjectHashMap.put("locationName", location.getName());
+ objectObjectHashMap.put("locationCode", location.getCode());
+
+ JSON parse = JSONUtil.parse(item.getRemark());
+ objectObjectHashMap.put("locationText", parse.getByPath("text", String.class));
+ objectObjectHashMap.put("locationImage", parse.getByPath("file", String.class));
+ }else{
+ objectObjectHashMap.put("locationName", "");
+ objectObjectHashMap.put("locationCode", "");
+ objectObjectHashMap.put("locationText", "");
+ objectObjectHashMap.put("locationImage", "");
+ }
+ continue;
+ } else if (ClothesOrderItemEnum.PATTERN.getCode() == item.getType()) {
+ ClothesPattern pattern = clothesPatternMapper.selectById(item.getItemId());
+ if (ObjectUtil.isNotNull(pattern)) {
+ objectObjectHashMap.put("patternName", pattern.getName());
+ objectObjectHashMap.put("patternCode", pattern.getCode());
+
+ JSON parse = JSONUtil.parse(item.getRemark());
+ objectObjectHashMap.put("patternText", parse.getByPath("text", String.class));
+ objectObjectHashMap.put("patternImage", parse.getByPath("file", String.class));
+ }else{
+ objectObjectHashMap.put("patternName", "");
+ objectObjectHashMap.put("patternCode", "");
+ objectObjectHashMap.put("patternText", "");
+ objectObjectHashMap.put("patternImage", "");
+ }
+ continue;
+ } else if (ClothesOrderItemEnum.ART.getCode() == item.getType()) {
+ ClothesArt art = clothesArtMapper.selectById(item.getItemId());
+ if (ObjectUtil.isNotNull(art)) {
+ objectObjectHashMap.put("artName", art.getName());
+ objectObjectHashMap.put("artCode", art.getCode());
+ }
+ continue;
+ } else if (ClothesOrderItemEnum.CUSTOMIZE.getCode() == item.getType()) {
+ ClothesMemberStature clothesMemberStature = clothesMemberStatureMapper.selectById(item.getItemId());
+ if (ObjectUtil.isNotNull(clothesMemberStature)) {
+ objectObjectHashMap.put("statureName", clothesMemberStature.getName());
+ }
+ continue;
+ } else {
+ continue;
+ }
+ }
+ }
+ return new FebsResponse().success().data(objectObjectHashMap);
+ }
+
+ @Override
+ public AdminClothesPrintOrderVo printOrderEvent(AdminClothesPrintOrderDto dto) {
+
+ AdminClothesPrintOrderVo vo = new AdminClothesPrintOrderVo();
+
+ ClothesOrder order = clothesOrderMapper.selectById(dto.getId());
+ if (ObjectUtil.isNotNull(order)){
+ vo.setOrderNo(order.getOrderNo());
+ }
+ ClothesType clothesType = clothesTypeMapper.selectById(order.getTypeId());
+ if (ObjectUtil.isNotNull(clothesType)) {
+ vo.setTypeName(clothesType.getName());
+ vo.setTypeFront(clothesType.getImageFront());
+ vo.setTypeBack(clothesType.getImageBack());
+ }
+ List<ClothesOrderItem> clothesOrderItems = clothesOrderItemMapper.selectList(
+ Wrappers.lambdaQuery(ClothesOrderItem.class)
+ .eq(ClothesOrderItem::getOrderId, order.getId())
+ );
+ if(CollUtil.isNotEmpty(clothesOrderItems)){
+ String nullStr = "暂无";
+ List<AdminClothesPrintLocationVo> locations = new ArrayList<>();
+ List<AdminClothesPrintPatternVo> patterns = new ArrayList<>();
+ for (ClothesOrderItem item : clothesOrderItems){
+ if (ClothesOrderItemEnum.CLOTH.getCode() == item.getType()) {
+ ClothesCloth cloth = clothesClothMapper.selectById(item.getItemId());
+ if (ObjectUtil.isNotNull(cloth)) {
+ vo.setClothCode(cloth.getCode());
+ vo.setClothName(cloth.getName());
+ }else{
+ vo.setClothCode(nullStr);
+ vo.setClothName(nullStr);
+ }
+ continue;
+ } else if (ClothesOrderItemEnum.SIZE.getCode() == item.getType()) {
+ ClothesSize size = clothesSizeMapper.selectById(item.getItemId());
+ if (ObjectUtil.isNotNull(size)) {
+ vo.setSizeName(size.getName());
+ vo.setSizeCode(size.getCode());
+ }else {
+ vo.setSizeName(nullStr);
+ vo.setSizeCode(nullStr);
+ }
+ continue;
+ } else if (ClothesOrderItemEnum.LOCATION.getCode() == item.getType()) {
+ AdminClothesPrintLocationVo locationVo = new AdminClothesPrintLocationVo();
+ ClothesLocation location = clothesLocationMapper.selectById(item.getItemId());
+ if (ObjectUtil.isNotNull(location)) {
+ locationVo.setLocationName(location.getName());
+ locationVo.setLocationCode(location.getCode());
+
+ JSON parse = JSONUtil.parse(item.getRemark());
+ locationVo.setLocationText(parse.getByPath("text", String.class));
+ locationVo.setLocationImage(parse.getByPath("file", String.class));
+ }else{
+ locationVo.setLocationName(nullStr);
+ locationVo.setLocationCode(nullStr);
+ locationVo.setLocationText(nullStr);
+ locationVo.setLocationImage(nullStr);
+ }
+ locations.add(locationVo);
+ vo.setLocations( locations);
+ continue;
+ } else if (ClothesOrderItemEnum.PATTERN.getCode() == item.getType()) {
+ AdminClothesPrintPatternVo patternVo = new AdminClothesPrintPatternVo();
+
+ ClothesPattern pattern = clothesPatternMapper.selectById(item.getItemId());
+ if (ObjectUtil.isNotNull(pattern)) {
+ patternVo.setPatternName(pattern.getName());
+ patternVo.setPatternCode(pattern.getCode());
+
+ JSON parse = JSONUtil.parse(item.getRemark());
+ patternVo.setPatternText(parse.getByPath("text", String.class));
+ patternVo.setPatternImage(parse.getByPath("file", String.class));
+ }else{
+ patternVo.setPatternName(nullStr);
+ patternVo.setPatternCode(nullStr);
+ patternVo.setPatternText(nullStr);
+ patternVo.setPatternImage(nullStr);
+ }
+ patterns.add(patternVo);
+ vo.setPatterns( patterns);
+ continue;
+ } else if (ClothesOrderItemEnum.ART.getCode() == item.getType()) {
+ ClothesArt art = clothesArtMapper.selectById(item.getItemId());
+ if (ObjectUtil.isNotNull(art)) {
+ vo.setArtName(art.getName());
+ vo.setArtCode(art.getCode());
+ }else{
+ vo.setArtName(nullStr);
+ vo.setArtCode(nullStr);
+ }
+ continue;
+ } else if (ClothesOrderItemEnum.CUSTOMIZE.getCode() == item.getType()) {
+ AdminClothesPrintMemberStatureVo memberStature = new AdminClothesPrintMemberStatureVo();
+ ClothesMemberStature clothesMemberStature = clothesMemberStatureMapper.selectById(item.getItemId());
+ if (ObjectUtil.isNotNull(clothesMemberStature)) {
+ memberStature.setName(clothesMemberStature.getName());
+ memberStature.setHeightLine(clothesMemberStature.getHeightLine());
+ memberStature.setBustLine(clothesMemberStature.getBustLine());
+ memberStature.setWaistLine(clothesMemberStature.getWaistLine());
+ memberStature.setWideLine(clothesMemberStature.getWideLine());
+ memberStature.setHipLine(clothesMemberStature.getHipLine());
+ }else{
+ memberStature.setName(nullStr);
+ memberStature.setHeightLine(BigDecimal.ZERO);
+ memberStature.setBustLine(BigDecimal.ZERO);
+ memberStature.setWaistLine(BigDecimal.ZERO);
+ memberStature.setWideLine(BigDecimal.ZERO);
+ memberStature.setHipLine(BigDecimal.ZERO);
+ }
+ vo.setMemberStature(memberStature);
+ continue;
+ } else {
+ continue;
+ }
+ }
+ }
+ return vo;
+ }
+
}
--
Gitblit v1.9.1