From e2fff23080dc797b644c3d0c930c4d3f229310db Mon Sep 17 00:00:00 2001 From: lele0521 Date: Thu, 4 Jan 2024 17:36:39 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E6=98=B5=E7=A7=B0=E9=BB=98=E8=AE=A4=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/lili/common/utils/CommonUtil.java | 7 +++++++ .../java/cn/lili/modules/member/entity/dos/Member.java | 3 ++- .../lili/modules/member/serviceimpl/MemberServiceImpl.java | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/framework/src/main/java/cn/lili/common/utils/CommonUtil.java b/framework/src/main/java/cn/lili/common/utils/CommonUtil.java index 61e7ebe98..c764f895a 100644 --- a/framework/src/main/java/cn/lili/common/utils/CommonUtil.java +++ b/framework/src/main/java/cn/lili/common/utils/CommonUtil.java @@ -34,4 +34,11 @@ public class CommonUtil { return sb.toString(); } + /** + * 获取特定字符 + 6位随机数 + * @return + */ + public static String getSpecialStr(String value) { + return value + getRandomNum(); + } } diff --git a/framework/src/main/java/cn/lili/modules/member/entity/dos/Member.java b/framework/src/main/java/cn/lili/modules/member/entity/dos/Member.java index b39565fc8..8027050a4 100644 --- a/framework/src/main/java/cn/lili/modules/member/entity/dos/Member.java +++ b/framework/src/main/java/cn/lili/modules/member/entity/dos/Member.java @@ -3,6 +3,7 @@ package cn.lili.modules.member.entity.dos; import cn.lili.common.enums.ClientTypeEnum; import cn.lili.common.security.sensitive.Sensitive; import cn.lili.common.security.sensitive.enums.SensitiveStrategy; +import cn.lili.common.utils.CommonUtil; import cn.lili.mybatis.BaseEntity; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; @@ -101,7 +102,7 @@ public class Member extends BaseEntity { this.username = username; this.password = password; this.mobile = mobile; - this.nickName = "临时昵称"; + this.nickName = CommonUtil.getSpecialStr("用户"); this.disabled = true; this.haveStore = false; this.sex = 0; diff --git a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java index 6be253512..c64773f88 100644 --- a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java @@ -241,7 +241,7 @@ public class MemberServiceImpl extends ServiceImpl impleme public Member autoRegister(ConnectAuthUser authUser) { if (CharSequenceUtil.isEmpty(authUser.getNickname())) { - authUser.setNickname("临时昵称"); + authUser.setNickname(CommonUtil.getSpecialStr("用户")); } if (CharSequenceUtil.isEmpty(authUser.getAvatar())) { authUser.setAvatar("https://i.loli.net/2020/11/19/LyN6JF7zZRskdIe.png"); @@ -841,4 +841,5 @@ public class MemberServiceImpl extends ServiceImpl impleme throw new ServiceException(ResultCode.USER_EXIST); } } + } \ No newline at end of file -- Gitee From b40533c553c53e145b44b569ff42737cc0bb0ad8 Mon Sep 17 00:00:00 2001 From: lele0521 Date: Thu, 4 Jan 2024 18:10:57 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=97=A5=E5=BF=97=EF=BC=88=E5=95=86=E5=93=81=E3=80=81?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E3=80=81=E4=BF=83=E9=94=80=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=93=8D=E4=BD=9C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/modules/goods/serviceimpl/GoodsServiceImpl.java | 9 +++++++++ .../promotion/serviceimpl/PromotionGoodsServiceImpl.java | 2 ++ .../controller/passport/MemberManagerController.java | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java index bab900705..106e43e42 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java @@ -33,6 +33,7 @@ import cn.lili.modules.store.entity.dos.Store; import cn.lili.modules.store.entity.vos.StoreVO; import cn.lili.modules.store.service.FreightTemplateService; import cn.lili.modules.store.service.StoreService; +import cn.lili.modules.system.aspect.annotation.SystemLogPoint; import cn.lili.modules.system.entity.dos.Setting; import cn.lili.modules.system.entity.dto.GoodsSetting; import cn.lili.modules.system.entity.enums.SettingEnum; @@ -165,6 +166,7 @@ public class GoodsServiceImpl extends ServiceImpl implements @Override @Transactional(rollbackFor = Exception.class) + @SystemLogPoint(description = "添加商品", customerLog = "'新增商品名称:['+#goodsOperationDTO.goodsName+']'") public void addGoods(GoodsOperationDTO goodsOperationDTO) { Goods goods = new Goods(goodsOperationDTO); //检查商品 @@ -192,6 +194,7 @@ public class GoodsServiceImpl extends ServiceImpl implements @Override @Transactional(rollbackFor = Exception.class) + @SystemLogPoint(description = "修改商品", customerLog = "'操作的商品ID:['+#goodsId+']'") public void editGoods(GoodsOperationDTO goodsOperationDTO, String goodsId) { Goods goods = new Goods(goodsOperationDTO); goods.setId(goodsId); @@ -290,6 +293,7 @@ public class GoodsServiceImpl extends ServiceImpl implements } @Override + @SystemLogPoint(description = "审核商品", customerLog = "'操作的商品ID:['+#goodsIds+']', '操作后商品状态:['+#goodsAuthEnum+']'") @Transactional(rollbackFor = Exception.class) public boolean auditGoods(List goodsIds, GoodsAuthEnum goodsAuthEnum) { List goodsCacheKeys = new ArrayList<>(); @@ -312,6 +316,7 @@ public class GoodsServiceImpl extends ServiceImpl implements @Override @Transactional(rollbackFor = Exception.class) + @SystemLogPoint(description = "商品状态操作", customerLog = "'操作类型:['+#goodsStatusEnum+']', 操作对象:['+#goodsIds+']', 操作原因:['+#underReason+']'") public Boolean updateGoodsMarketAble(List goodsIds, GoodsStatusEnum goodsStatusEnum, String underReason) { boolean result; @@ -343,6 +348,7 @@ public class GoodsServiceImpl extends ServiceImpl implements * @return 更新结果 */ @Override + @SystemLogPoint(description = "店铺关闭下架商品", customerLog = "'操作类型:['+#goodsStatusEnum+']', 操作对象:['+#storeId+']', 操作原因:['+#underReason+']'") public Boolean updateGoodsMarketAbleByStoreId(String storeId, GoodsStatusEnum goodsStatusEnum, String underReason) { @@ -358,6 +364,7 @@ public class GoodsServiceImpl extends ServiceImpl implements } @Override + @SystemLogPoint(description = "管理员关闭下架商品", customerLog = "'操作类型:['+#goodsStatusEnum+']', 操作对象:['+#goodsIds+']', 操作原因:['+#underReason+']'") @Transactional(rollbackFor = Exception.class) public Boolean managerUpdateGoodsMarketAble(List goodsIds, GoodsStatusEnum goodsStatusEnum, String underReason) { boolean result; @@ -386,6 +393,7 @@ public class GoodsServiceImpl extends ServiceImpl implements @Override @Transactional(rollbackFor = Exception.class) + @SystemLogPoint(description = "删除商品", customerLog = "操作对象:['+#goodsIds+']'") public Boolean deleteGoods(List goodsIds) { LambdaUpdateWrapper updateWrapper = this.getUpdateWrapperByStoreAuthority(); @@ -432,6 +440,7 @@ public class GoodsServiceImpl extends ServiceImpl implements } @Override + @SystemLogPoint(description = "修改商品库存", customerLog = "操作的商品ID:['+#goodsId+']', 修改后的库存:['+#quantity+']'") public void updateStock(String goodsId, Integer quantity) { LambdaUpdateWrapper lambdaUpdateWrapper = Wrappers.lambdaUpdate(); lambdaUpdateWrapper.set(Goods::getQuantity, quantity); diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java index ee4e41d50..1225e623a 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java @@ -26,6 +26,7 @@ import cn.lili.modules.promotion.service.SeckillApplyService; import cn.lili.modules.promotion.tools.PromotionTools; import cn.lili.modules.search.entity.dos.EsGoodsIndex; import cn.lili.modules.search.service.EsGoodsIndexService; +import cn.lili.modules.system.aspect.annotation.SystemLogPoint; import cn.lili.mybatis.util.PageUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -273,6 +274,7 @@ public class PromotionGoodsServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(PromotionGoods::getSkuId, skuId); diff --git a/manager-api/src/main/java/cn/lili/controller/passport/MemberManagerController.java b/manager-api/src/main/java/cn/lili/controller/passport/MemberManagerController.java index b64308d75..aad8564ff 100644 --- a/manager-api/src/main/java/cn/lili/controller/passport/MemberManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/passport/MemberManagerController.java @@ -11,6 +11,7 @@ import cn.lili.modules.member.entity.dto.MemberAddDTO; import cn.lili.modules.member.entity.vo.MemberSearchVO; import cn.lili.modules.member.entity.vo.MemberVO; import cn.lili.modules.member.service.MemberService; +import cn.lili.modules.system.aspect.annotation.SystemLogPoint; import com.baomidou.mybatisplus.core.metadata.IPage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -51,6 +52,7 @@ public class MemberManagerController { } @ApiOperation(value = "添加会员") + @SystemLogPoint(description = "添加会员", customerLog = "'新增会员名称: ['+#member.username+']'") @PostMapping public ResultMessage save(@Valid MemberAddDTO member) { @@ -59,6 +61,7 @@ public class MemberManagerController { @DemoSite @PreventDuplicateSubmissions + @SystemLogPoint(description = "修改会员信息", customerLog = "'修改的会员名称: ['+#managerMemberEditDTO.username+']'") @ApiOperation(value = "修改会员基本信息") @PutMapping public ResultMessage update(@Valid ManagerMemberEditDTO managerMemberEditDTO) { @@ -67,6 +70,7 @@ public class MemberManagerController { @DemoSite @PreventDuplicateSubmissions + @SystemLogPoint(description = "修改会员状态", customerLog = "'修改的会员名称: ['+#memberIds+']', '是否开启: ['+#disabled+']'") @ApiOperation(value = "修改会员状态,开启关闭会员") @ApiImplicitParams({ @ApiImplicitParam(name = "memberIds", value = "会员ID", required = true, dataType = "String", allowMultiple = true, paramType = "query"), -- Gitee From c9a0ce79855aabc0465adcf4c3bc8e1e35dbf9cb Mon Sep 17 00:00:00 2001 From: lele0521 Date: Fri, 5 Jan 2024 17:29:34 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E9=80=80?= =?UTF-8?q?=E6=AC=BE=E7=8A=B6=E6=80=81=EF=BC=88=E9=83=A8=E5=88=86=E9=80=80?= =?UTF-8?q?=E6=AC=BE=E3=80=81=E5=85=A8=E9=83=A8=E9=80=80=E6=AC=BE=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DB/2024-1-5.sql | 10 ++++++ .../common/FileDirectoryController.java | 5 +-- .../event/impl/OrderStatusHandlerExecute.java | 20 +++++++++-- .../modules/file/entity/FileDirectory.java | 3 ++ .../serviceimpl/AfterSaleServiceImpl.java | 35 ++++++++++++++----- .../order/order/entity/dos/OrderItem.java | 16 +++++++++ .../order/entity/enums/OrderStatusEnum.java | 2 +- .../order/entity/enums/RefundStatusEnum.java | 34 ++++++++++++++++++ .../order/order/service/OrderItemService.java | 6 ++++ .../serviceimpl/OrderItemServiceImpl.java | 9 +++++ 10 files changed, 125 insertions(+), 15 deletions(-) create mode 100644 DB/2024-1-5.sql create mode 100644 framework/src/main/java/cn/lili/modules/order/order/entity/enums/RefundStatusEnum.java diff --git a/DB/2024-1-5.sql b/DB/2024-1-5.sql new file mode 100644 index 000000000..5fc249aad --- /dev/null +++ b/DB/2024-1-5.sql @@ -0,0 +1,10 @@ + +/** + 交易唤醒表,增加交易流水详情 + */ +ALTER TABLE li_order_item ADD `is_refund` varchar(255) DEFAULT NULL COMMENT '是否退款'; + +/** + 交易表增加订单状态字段 + */ +ALTER TABLE li_order_item ADD `refund_price` decimal(10,2) DEFAULT NULL COMMENT '退款金额'; diff --git a/common-api/src/main/java/cn/lili/controller/common/FileDirectoryController.java b/common-api/src/main/java/cn/lili/controller/common/FileDirectoryController.java index 0057887fe..a6cad2613 100644 --- a/common-api/src/main/java/cn/lili/controller/common/FileDirectoryController.java +++ b/common-api/src/main/java/cn/lili/controller/common/FileDirectoryController.java @@ -12,6 +12,7 @@ import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; +import javax.validation.Valid; import java.util.List; /** @@ -37,7 +38,7 @@ public class FileDirectoryController { @ApiOperation(value = "添加文件目录") @PostMapping - public ResultMessage addSceneFileList(@RequestBody FileDirectory fileDirectory) { + public ResultMessage addSceneFileList(@RequestBody @Valid FileDirectory fileDirectory) { fileDirectory.setDirectoryType(UserContext.getCurrentUser().getRole().name()); fileDirectoryService.save(fileDirectory); return ResultUtil.data(fileDirectory); @@ -45,7 +46,7 @@ public class FileDirectoryController { @ApiOperation(value = "修改文件目录") @PutMapping - public ResultMessage editSceneFileList(@RequestBody FileDirectory fileDirectory) { + public ResultMessage editSceneFileList(@RequestBody @Valid FileDirectory fileDirectory) { fileDirectory.setDirectoryType(UserContext.getCurrentUser().getRole().name()); fileDirectoryService.updateById(fileDirectory); return ResultUtil.data(fileDirectory); diff --git a/consumer/src/main/java/cn/lili/event/impl/OrderStatusHandlerExecute.java b/consumer/src/main/java/cn/lili/event/impl/OrderStatusHandlerExecute.java index d6bb11e44..54beb2e5c 100644 --- a/consumer/src/main/java/cn/lili/event/impl/OrderStatusHandlerExecute.java +++ b/consumer/src/main/java/cn/lili/event/impl/OrderStatusHandlerExecute.java @@ -1,10 +1,13 @@ package cn.lili.event.impl; +import cn.lili.common.utils.CurrencyUtil; import cn.lili.event.AfterSaleStatusChangeEvent; import cn.lili.event.TradeEvent; import cn.lili.modules.order.aftersale.entity.dos.AfterSale; import cn.lili.modules.order.cart.entity.dto.TradeDTO; +import cn.lili.modules.order.order.entity.dos.Order; import cn.lili.modules.order.order.entity.dos.OrderItem; +import cn.lili.modules.order.order.entity.enums.RefundStatusEnum; import cn.lili.modules.order.order.service.OrderItemService; import cn.lili.modules.order.order.service.OrderService; import cn.lili.modules.order.order.service.TradeService; @@ -43,16 +46,27 @@ public class OrderStatusHandlerExecute implements TradeEvent, AfterSaleStatusCha @Override public void afterSaleStatusChange(AfterSale afterSale) { + Order order = orderService.getBySn(afterSale.getOrderSn()); + OrderItem orderItem = orderItemService.getBySn(afterSale.getOrderItemSn()); + if (afterSale.getServiceStatus().equals(AfterSaleStatusEnum.COMPLETE.name())) { + if (orderItem.getReturnGoodsNumber().equals(orderItem.getNum())) { + orderItem.setIsRefund(RefundStatusEnum.ALL_REFUND.name()); + } else { + orderItem.setIsRefund(RefundStatusEnum.PART_REFUND.name()); + } + orderItem.setRefundPrice(CurrencyUtil.add(afterSale.getActualRefundPrice(), orderItem.getRefundPrice())); + orderItemService.updateByAfterSale(orderItem); + //循环订单货物,判断是否已经全部售后 List orderItems = orderItemService.getByOrderSn(afterSale.getOrderSn()); // 总退货数量 int returnCount = 0; // 总购买数量 int deliverCount = 0; - for (OrderItem orderItem : orderItems) { - returnCount += orderItem.getReturnGoodsNumber(); - deliverCount += orderItem.getNum(); + for (OrderItem item : orderItems) { + returnCount += item.getReturnGoodsNumber(); + deliverCount += item.getNum(); } if (returnCount == deliverCount) { orderService.systemCancel(afterSale.getOrderSn(),"订单货物全部退款",false); diff --git a/framework/src/main/java/cn/lili/modules/file/entity/FileDirectory.java b/framework/src/main/java/cn/lili/modules/file/entity/FileDirectory.java index 807db5ce3..c9e888dd5 100644 --- a/framework/src/main/java/cn/lili/modules/file/entity/FileDirectory.java +++ b/framework/src/main/java/cn/lili/modules/file/entity/FileDirectory.java @@ -9,6 +9,7 @@ import lombok.Data; import javax.validation.constraints.Max; import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; @Data @TableName("li_file_directory") @@ -26,7 +27,9 @@ public class FileDirectory extends BaseEntity { private String ownerId; @ApiModelProperty(value = "父分类ID") private String parentId; + @ApiModelProperty(value = "层级") + @NotNull(message = "层级不能为空") @Min(value = 0, message = "层级最小为0") @Max(value = 2, message = "层级最大为2") private Integer level; diff --git a/framework/src/main/java/cn/lili/modules/order/aftersale/serviceimpl/AfterSaleServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/aftersale/serviceimpl/AfterSaleServiceImpl.java index 70bfab19a..a1bb7ffec 100644 --- a/framework/src/main/java/cn/lili/modules/order/aftersale/serviceimpl/AfterSaleServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/aftersale/serviceimpl/AfterSaleServiceImpl.java @@ -2,6 +2,7 @@ package cn.lili.modules.order.aftersale.serviceimpl; import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; @@ -22,10 +23,7 @@ import cn.lili.modules.order.aftersale.mapper.AfterSaleMapper; import cn.lili.modules.order.aftersale.service.AfterSaleService; import cn.lili.modules.order.order.entity.dos.Order; import cn.lili.modules.order.order.entity.dos.OrderItem; -import cn.lili.modules.order.order.entity.enums.OrderItemAfterSaleStatusEnum; -import cn.lili.modules.order.order.entity.enums.OrderStatusEnum; -import cn.lili.modules.order.order.entity.enums.OrderTypeEnum; -import cn.lili.modules.order.order.entity.enums.PayStatusEnum; +import cn.lili.modules.order.order.entity.enums.*; import cn.lili.modules.order.order.service.OrderItemService; import cn.lili.modules.order.order.service.OrderService; import cn.lili.modules.order.trade.entity.enums.AfterSaleRefundWayEnum; @@ -461,8 +459,9 @@ public class AfterSaleServiceImpl extends ServiceImpl() + + LambdaUpdateWrapper lambdaUpdateWrapper = new LambdaUpdateWrapper() .eq(OrderItem::getSn, orderItem.getSn()) .set(OrderItem::getAfterSaleStatus, orderItem.getAfterSaleStatus()) - .set(OrderItem::getReturnGoodsNumber, orderItem.getReturnGoodsNumber())); + .set(OrderItem::getReturnGoodsNumber, orderItem.getReturnGoodsNumber()); + + if (afterSale.getServiceStatus().equals(AfterSaleStatusEnum.COMPLETE.name())) { + if (orderItem.getReturnGoodsNumber().equals(orderItem.getNum())) { + lambdaUpdateWrapper.set(OrderItem::getIsRefund, RefundStatusEnum.ALL_REFUND.name()); + } else { + lambdaUpdateWrapper.set(OrderItem::getIsRefund, RefundStatusEnum.PART_REFUND.name()); + } + } else if (afterSale.getServiceStatus().equals(AfterSaleStatusEnum.APPLY.name())) { + lambdaUpdateWrapper.set(OrderItem::getIsRefund, RefundStatusEnum.REFUNDING.name()); + } else if (afterSale.getServiceStatus().equals(AfterSaleStatusEnum.REFUSE.name()) || + afterSale.getServiceStatus().equals(AfterSaleStatusEnum.BUYER_CANCEL.name()) || + afterSale.getServiceStatus().equals(AfterSaleStatusEnum.SELLER_TERMINATION.name())) { + lambdaUpdateWrapper.set(OrderItem::getIsRefund, RefundStatusEnum.NO_REFUND.name()); + } + + orderItemService.update(lambdaUpdateWrapper); } } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/OrderItem.java b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/OrderItem.java index ae8c270f8..95025028b 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/OrderItem.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/OrderItem.java @@ -11,6 +11,7 @@ import cn.lili.modules.order.order.entity.dto.PriceDetailDTO; import cn.lili.modules.order.order.entity.enums.CommentStatusEnum; import cn.lili.modules.order.order.entity.enums.OrderComplaintStatusEnum; import cn.lili.modules.order.order.entity.enums.OrderItemAfterSaleStatusEnum; +import cn.lili.modules.order.order.entity.enums.RefundStatusEnum; import cn.lili.modules.promotion.entity.vos.PromotionSkuVO; import cn.lili.mybatis.BaseEntity; import com.baomidou.mybatisplus.annotation.TableName; @@ -115,6 +116,14 @@ public class OrderItem extends BaseEntity { @ApiModelProperty(value = "退货商品数量") private Integer returnGoodsNumber; + /** + * @see cn.lili.modules.order.order.entity.enums.RefundStatusEnum + */ + @ApiModelProperty(value = "退款状态") + private String isRefund; + + @ApiModelProperty(value = "退款金额") + private Double refundPrice; public OrderItem(CartSkuVO cartSkuVO, CartVO cartVO, TradeDTO tradeDTO) { String oldId = this.getId(); @@ -146,6 +155,13 @@ public class OrderItem extends BaseEntity { } + public String getIsRefund() { + if (isRefund == null) { + return RefundStatusEnum.NO_REFUND.name(); + } + return isRefund; + } + public PriceDetailDTO getPriceDetailDTO() { return JSONUtil.toBean(priceDetail, PriceDetailDTO.class); } diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/enums/OrderStatusEnum.java b/framework/src/main/java/cn/lili/modules/order/order/entity/enums/OrderStatusEnum.java index 8edcaccfa..8c3b7f894 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/enums/OrderStatusEnum.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/enums/OrderStatusEnum.java @@ -21,7 +21,7 @@ public enum OrderStatusEnum { * 虚拟订单需要核验商品 */ TAKE("待核验"), - CANCELLED("已取消"); + CANCELLED("已关闭"); private final String description; diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/enums/RefundStatusEnum.java b/framework/src/main/java/cn/lili/modules/order/order/entity/enums/RefundStatusEnum.java new file mode 100644 index 000000000..a64f52b95 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/enums/RefundStatusEnum.java @@ -0,0 +1,34 @@ +package cn.lili.modules.order.order.entity.enums; + +/** + * 退款状态枚举 + * + * @author Lele + * @since 2024-1-5 10:59:22 + */ +public enum RefundStatusEnum { + + /** + * 退款状态 + */ + ALL_REFUND("全部退款"), + PART_REFUND("部分退款"), + NO_REFUND("未退款"), + REFUNDING("退款中"); + + private final String description; + + RefundStatusEnum(String description) { + this.description = description; + } + + public String getDescription() { + return description; + } + + public String description() { + return this.description; + } + + +} diff --git a/framework/src/main/java/cn/lili/modules/order/order/service/OrderItemService.java b/framework/src/main/java/cn/lili/modules/order/order/service/OrderItemService.java index c40a2d842..703c85af9 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/service/OrderItemService.java +++ b/framework/src/main/java/cn/lili/modules/order/order/service/OrderItemService.java @@ -33,6 +33,12 @@ public interface OrderItemService extends IService { */ void updateAfterSaleStatus(String orderItemSn, OrderItemAfterSaleStatusEnum orderItemAfterSaleStatusEnum); + /** + * 更新售后状态 + * @param orderItem + */ + void updateByAfterSale(OrderItem orderItem); + /** * 更新订单可投诉状态 * diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderItemServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderItemServiceImpl.java index bc03843b7..e4841bd8c 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderItemServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderItemServiceImpl.java @@ -44,6 +44,15 @@ public class OrderItemServiceImpl extends ServiceImpl lambdaUpdateWrapper = new LambdaUpdateWrapper() + .eq(OrderItem::getSn, orderItem.getSn()) + .set(OrderItem::getIsRefund, orderItem.getIsRefund()) + .set(OrderItem::getRefundPrice, orderItem.getRefundPrice()); + this.update(lambdaUpdateWrapper); + } + /** * 更新订单可投诉状态 * -- Gitee From 4c47d4aba201309875ba8301e27e37bbaca2cc94 Mon Sep 17 00:00:00 2001 From: lele0521 Date: Tue, 16 Jan 2024 15:53:37 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E5=8C=BA=E5=88=86=E5=95=86=E5=AE=B6?= =?UTF-8?q?=E3=80=81=E7=AE=A1=E7=90=86=E7=AB=AFOSS=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E7=9A=84=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/controller/common/FileDirectoryController.java | 2 ++ .../modules/file/serviceimpl/FileDirectoryServiceImpl.java | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/common-api/src/main/java/cn/lili/controller/common/FileDirectoryController.java b/common-api/src/main/java/cn/lili/controller/common/FileDirectoryController.java index a6cad2613..fd82a9c36 100644 --- a/common-api/src/main/java/cn/lili/controller/common/FileDirectoryController.java +++ b/common-api/src/main/java/cn/lili/controller/common/FileDirectoryController.java @@ -40,6 +40,7 @@ public class FileDirectoryController { @PostMapping public ResultMessage addSceneFileList(@RequestBody @Valid FileDirectory fileDirectory) { fileDirectory.setDirectoryType(UserContext.getCurrentUser().getRole().name()); + fileDirectory.setOwnerId(UserContext.getCurrentUser().getId()); fileDirectoryService.save(fileDirectory); return ResultUtil.data(fileDirectory); } @@ -48,6 +49,7 @@ public class FileDirectoryController { @PutMapping public ResultMessage editSceneFileList(@RequestBody @Valid FileDirectory fileDirectory) { fileDirectory.setDirectoryType(UserContext.getCurrentUser().getRole().name()); + fileDirectory.setOwnerId(UserContext.getCurrentUser().getId()); fileDirectoryService.updateById(fileDirectory); return ResultUtil.data(fileDirectory); } diff --git a/framework/src/main/java/cn/lili/modules/file/serviceimpl/FileDirectoryServiceImpl.java b/framework/src/main/java/cn/lili/modules/file/serviceimpl/FileDirectoryServiceImpl.java index 4ba07bc75..015009511 100644 --- a/framework/src/main/java/cn/lili/modules/file/serviceimpl/FileDirectoryServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/file/serviceimpl/FileDirectoryServiceImpl.java @@ -1,10 +1,12 @@ package cn.lili.modules.file.serviceimpl; import cn.lili.common.security.enums.UserEnums; +import cn.lili.modules.distribution.entity.dos.DistributionOrder; import cn.lili.modules.file.entity.FileDirectory; import cn.lili.modules.file.entity.dto.FileDirectoryDTO; import cn.lili.modules.file.mapper.FileDirectoryMapper; import cn.lili.modules.file.service.FileDirectoryService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -34,8 +36,7 @@ public class FileDirectoryServiceImpl extends ServiceImpl getFileDirectoryList(String scene) { - - List fileDirectoryList = this.list(); + List fileDirectoryList = this.list(new LambdaQueryWrapper().eq(FileDirectory::getOwnerId, scene)); List fileDirectoryDTOList = new ArrayList<>(); fileDirectoryList.forEach(item -> { -- Gitee