From fd9ee9caa17d4d722532f6536d53ce40254fa722 Mon Sep 17 00:00:00 2001
From: phpcjl <phpcjl@gmail.com>
Date: 星期一, 09 十二月 2024 18:02:02 +0800
Subject: [PATCH] 1.
---
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java
new file mode 100644
index 0000000..1a2de9a
--- /dev/null
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java
@@ -0,0 +1,56 @@
+package com.ruoyi.other.service.impl;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.utils.StringUtils;
+import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
+import com.ruoyi.order.model.Order;
+import com.ruoyi.other.mapper.GoodsEvaluateMapper;
+import com.ruoyi.other.api.domain.GoodsEvaluate;
+import com.ruoyi.other.service.GoodsEvaluateService;
+import com.ruoyi.other.vo.GoodsEvaluateVO;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author luodangjia
+ * @since 2024-11-20
+ */
+@Service
+public class GoodsEvaluateServiceImpl extends ServiceImpl<GoodsEvaluateMapper, GoodsEvaluate> implements GoodsEvaluateService {
+ @Resource
+ private RemoteOrderGoodsClient remoteOrderGoodsClient;
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void addGoodsEvaluate(GoodsEvaluateVO goodsEvaluateVO) {
+ List<GoodsEvaluate> evaluates = goodsEvaluateVO.getEvaluates();
+ for (GoodsEvaluate goodsEvaluate : evaluates) {
+ goodsEvaluate.setStatus(2);
+ if (StringUtils.isNotEmpty(goodsEvaluate.getIdStr())){
+ goodsEvaluate.setId(Long.valueOf(goodsEvaluate.getIdStr()));
+ saveOrUpdate(goodsEvaluate);
+ }else {
+ save(goodsEvaluate);
+ }
+ }
+ if (CollectionUtil.isNotEmpty(evaluates)){
+ Order order = new Order();
+ order.setId(goodsEvaluateVO.getEvaluates().get(0).getOrderId());
+ order.setOrderStatus(8);
+ R<Void> r = remoteOrderGoodsClient.updateOrderStatus(order);
+ if (R.isError(r)){
+ throw new RuntimeException("修改订单状态失败");
+ }
+ }
+
+ }
+}
--
Gitblit v1.7.1