From 7a74745bad7ff20df9e170433c1e1cb851ce7fa9 Mon Sep 17 00:00:00 2001
From: huliguo <2023611923@qq.com>
Date: 星期二, 29 七月 2025 09:17:00 +0800
Subject: [PATCH] Merge branches '2.0' and '2.0' of http://120.76.84.145:10101/gitblit/r/java/HongRuiTang into 2.0

---
 ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/service/RemoteOrderService.java               |   13 +++++-
 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java   |   13 ++++++
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopAppointableTimeServiceImpl.java |   16 ++++---
 ruoyi-modules/ruoyi-order/src/main/resources/bootstrap.yml                                                  |    1 
 ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteOrderFallbackFactory.java       |    6 +++
 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/business/MerOrderController.java         |   26 ++++++++++--
 ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml                                                 |    1 
 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/order/OrderService.java                     |   12 ++++++
 ruoyi-modules/ruoyi-goods/src/main/resources/bootstrap.yml                                                  |    1 
 ruoyi-auth/src/main/resources/bootstrap.yml                                                                 |    1 
 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java            |   19 ++++++---
 ruoyi-modules/ruoyi-shop/src/main/resources/bootstrap.yml                                                   |    1 
 12 files changed, 83 insertions(+), 27 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteOrderFallbackFactory.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteOrderFallbackFactory.java
index 9b0595b..c97a5db 100644
--- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteOrderFallbackFactory.java
+++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteOrderFallbackFactory.java
@@ -6,6 +6,7 @@
 import com.ruoyi.system.api.domain.dto.MerBaseDto;
 import com.ruoyi.system.api.domain.dto.MgtBasePlatformDto;
 import com.ruoyi.system.api.domain.vo.*;
+import com.ruoyi.system.api.model.AddOrderVo;
 import com.ruoyi.system.api.service.RemoteOrderService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -102,6 +103,11 @@
 	        public R<List<Integer>> countShopServicePerson(Long shopId) {
 		        return R.fail("获取今日到店用户失败:" + throwable.getMessage());
 	        }
+
+            @Override
+            public R addOrder(AddOrderVo orderVo) {
+                return R.fail("抽奖活动添加订单失败:" + throwable.getMessage());
+            }
         };
     }
 }
diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/service/RemoteOrderService.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/service/RemoteOrderService.java
index d5ea5b1..fa287b2 100644
--- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/service/RemoteOrderService.java
+++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/service/RemoteOrderService.java
@@ -8,10 +8,9 @@
 import com.ruoyi.system.api.domain.dto.MgtBasePlatformDto;
 import com.ruoyi.system.api.domain.vo.*;
 import com.ruoyi.system.api.factory.RemoteOrderFallbackFactory;
+import com.ruoyi.system.api.model.AddOrderVo;
 import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -137,4 +136,12 @@
     @PostMapping("/order/countShopServicePerson")
     R<List<Integer>> countShopServicePerson(@RequestParam("shopId") Long shopId);
 
+    /**
+     * 抽奖活动添加订单
+     * @param orderVo
+     * @return
+     */
+    @PostMapping(value = "/order/addOrder")
+    R addOrder(@RequestBody AddOrderVo orderVo);
+
 }
diff --git a/ruoyi-auth/src/main/resources/bootstrap.yml b/ruoyi-auth/src/main/resources/bootstrap.yml
index 534ed65..9aefc29 100644
--- a/ruoyi-auth/src/main/resources/bootstrap.yml
+++ b/ruoyi-auth/src/main/resources/bootstrap.yml
@@ -17,7 +17,6 @@
 #        server-addr: 47.109.78.184:5000
 #        server-addr: 127.0.0.1:8848
         server-addr: 192.168.110.80:8848
-        ip: 192.168.110.21
         #pro
 #        namespace: 9591ef9f-a49a-4900-be35-d77258bdd639
         #test
diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java
index eeda868..2364d54 100644
--- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java
+++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java
@@ -20,8 +20,10 @@
 import com.ruoyi.system.api.domain.poji.member.Member;
 import com.ruoyi.system.api.domain.poji.member.MemberGiftRecord;
 import com.ruoyi.system.api.domain.poji.shop.Shop;
+import com.ruoyi.system.api.model.AddOrderVo;
 import com.ruoyi.system.api.service.RemoteCouponService;
 import com.ruoyi.system.api.service.RemoteMemberService;
+import com.ruoyi.system.api.service.RemoteOrderService;
 import com.ruoyi.system.api.service.RemoteShopService;
 import org.redisson.api.RLock;
 import org.redisson.api.RedissonClient;
@@ -68,6 +70,9 @@
 
 	@Resource
 	private ILotteryEventQuestionsService lotteryEventQuestionsService;
+
+	@Resource
+	private RemoteOrderService remoteOrderService;
 	
 	/**
 	 * 根据id查询抽奖活动信息
@@ -209,6 +214,14 @@
 						memberGiftRecord.setGoodsId(userLotteryEvent.getObjectId());
 						memberGiftRecord.setGoodsNumber(userLotteryEvent.getNumber());
 						memberGiftRecord.setGoodsName(userLotteryEvent.getObjectName());
+						//添加待核销订单
+						AddOrderVo orderVo = new AddOrderVo();
+						orderVo.setShopId(member.getRelationShopId());
+						orderVo.setUserId(member.getUserId());
+						orderVo.setId(userLotteryEvent.getId());
+						orderVo.setGoodsId(userLotteryEvent.getObjectId());
+						orderVo.setGoodsNum(userLotteryEvent.getNumber());
+						remoteOrderService.addOrder(orderVo);
 						break;
 					case 3:
 						memberGiftRecord.setGiftType(4);
diff --git a/ruoyi-modules/ruoyi-goods/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-goods/src/main/resources/bootstrap.yml
index 19ec320..75d9cea 100644
--- a/ruoyi-modules/ruoyi-goods/src/main/resources/bootstrap.yml
+++ b/ruoyi-modules/ruoyi-goods/src/main/resources/bootstrap.yml
@@ -16,7 +16,6 @@
         # 服务注册地址
         #        server-addr: 47.109.78.184:5000
         server-addr: 192.168.110.80:8848
-        ip: 192.168.110.21
         #pro
         #        namespace: 9591ef9f-a49a-4900-be35-d77258bdd639
         #test
diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/business/MerOrderController.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/business/MerOrderController.java
index 97b9812..7fb8691 100644
--- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/business/MerOrderController.java
+++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/business/MerOrderController.java
@@ -9,12 +9,12 @@
 import com.ruoyi.order.domain.vo.*;
 import com.ruoyi.order.service.order.OrderService;
 import com.ruoyi.system.api.constant.AppErrorConstant;
+import com.ruoyi.system.api.domain.poji.goods.Goods;
+import com.ruoyi.system.api.model.AddOrderVo;
+import com.ruoyi.system.api.service.RemoteGoodsService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.util.Date;
@@ -34,6 +34,9 @@
 
     @Resource
     private OrderService orderService;
+
+    @Resource
+    private RemoteGoodsService remoteGoodsService;
 
 
     @RequestMapping(value = "/verifyCode", method = RequestMethod.POST)
@@ -235,4 +238,17 @@
         return R.ok(page.setRecords(merOrderPageVoList));
     }
 
-}
+
+    /**
+     * 抽奖的平台商品生成订单--待审核
+     * @param orderVo
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping(value = "/addOrder", method = RequestMethod.POST)
+    public R addOrder(@RequestBody AddOrderVo orderVo){
+        Goods goods = remoteGoodsService.getGoods(orderVo.getGoodsId()).getData();
+        orderService.addOrder(orderVo.getShopId(), orderVo.getUserId(), goods, orderVo.getGoodsNum(), orderVo.getId(), 2);
+        return R.ok();
+    }
+}
\ No newline at end of file
diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
index 1245694..68504f4 100644
--- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
+++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
@@ -1601,16 +1601,15 @@
         appPlaceOrderVo.setSignType(payArr[4]);
         appPlaceOrderVo.setPaySign(payArr[5]);
         appPlaceOrderVo.setPrepayId(orderPayment.getPrepayId());
+        appPlaceOrderVo.setLotteryDraw(false);
         // 返回AppPlaceOrderVo对象
         List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(2).getData();
         if (data.size() > 0) {
             List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(order.getPayMoney()) >= 0).collect(Collectors.toList());
-            appPlaceOrderVo.setLotteryDraw(collect.size() > 0);
             if (collect.size() > 0) {
+                appPlaceOrderVo.setLotteryDraw(true);
                 appPlaceOrderVo.setLotteryEventId(collect.get(0).getId());
             }
-        } else {
-            appPlaceOrderVo.setLotteryDraw(false);
         }
         return appPlaceOrderVo;
     }
@@ -3167,7 +3166,13 @@
                 consumerGoodsService.sendGoodsGift(giftSendDtoList);
                 //抽奖奖品中的平台商品需要生成订单数据
                 if (memberGiftRecord.getPrizeFrom() == 2) {
-                    addOrder(memberGiftRecord.getShopId(), memberGiftRecord.getUserId(), goods, memberGiftRecord.getGoodsNumber(), memberGiftRecord.getGiftId());
+                    Order one = this.getOne(new QueryWrapper<Order>().eq("activity_id", memberGiftRecord.getGiftId()).eq("order_from", 4));
+                    if(null == one){
+                        addOrder(memberGiftRecord.getShopId(), memberGiftRecord.getUserId(), goods, memberGiftRecord.getGoodsNumber(), memberGiftRecord.getGiftId(), 3);
+                    }else{
+                        one.setOrderStatus(3);
+                        this.updateById(one);
+                    }
                 }
                 break;
             case 3:
@@ -3205,18 +3210,18 @@
     
     
     /**
-     * 核销抽奖的平台商品生成订单
+     * 抽奖的平台商品生成订单--待审核
      *
      * @param shopId
      * @param userId
      * @param goods
      * @param goodsNum
      */
-    public void addOrder(Long shopId, Long userId, Goods goods, Integer goodsNum, String giftId) {
+    public void addOrder(Long shopId, Long userId, Goods goods, Integer goodsNum, String giftId, Integer status) {
         Order order = new Order();
         order.setOrderId(IdUtils.simpleUUID());
         order.setDelFlag(0);
-        order.setOrderStatus(3);
+        order.setOrderStatus(status);
         order.setOrderNo(CodeFactoryUtil.getShopOrderNo());
         order.setOrderFrom(4);
         order.setShopId(shopId);
diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/order/OrderService.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/order/OrderService.java
index e3382a0..72edbc3 100644
--- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/order/OrderService.java
+++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/order/OrderService.java
@@ -12,6 +12,7 @@
 import com.ruoyi.order.domain.pojo.order.Order;
 import com.ruoyi.order.domain.vo.*;
 import com.ruoyi.system.api.domain.dto.*;
+import com.ruoyi.system.api.domain.poji.goods.Goods;
 import com.ruoyi.system.api.domain.vo.*;
 
 import java.math.BigDecimal;
@@ -670,4 +671,15 @@
      * @return
      */
     StaticsShopMgtGoodsVO getGoodsSellStatic(List<String> goodsIdList);
+
+
+    /**
+     * 手动添加订单
+     * @param shopId
+     * @param userId
+     * @param goods
+     * @param goodsNum
+     * @param giftId
+     */
+    void addOrder(Long shopId, Long userId, Goods goods, Integer goodsNum, String giftId, Integer status);
 }
diff --git a/ruoyi-modules/ruoyi-order/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-order/src/main/resources/bootstrap.yml
index e3cdd85..5654d3e 100644
--- a/ruoyi-modules/ruoyi-order/src/main/resources/bootstrap.yml
+++ b/ruoyi-modules/ruoyi-order/src/main/resources/bootstrap.yml
@@ -17,7 +17,6 @@
 #        server-addr: 47.109.78.184:5000
 #        server-addr: 127.0.0.1:8848
         server-addr: 192.168.110.80:8848
-        ip: 192.168.110.21
         #pro
 #        namespace: 9591ef9f-a49a-4900-be35-d77258bdd639
         #test
diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopAppointableTimeServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopAppointableTimeServiceImpl.java
index b627ec7..ef9b62d 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopAppointableTimeServiceImpl.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopAppointableTimeServiceImpl.java
@@ -60,14 +60,16 @@
 			shopAppointableTimeListVo.setAppointableTime(shopAppointableTime.getAppointmentTime());
 			shopAppointableTimeListVo.setStatus(shopAppointableTime.getStatus());
 			Member member = remoteMemberService.getMember(shopAppointableTime.getUserId()).getData();
-			shopAppointableTimeListVo.setUserName(member.getRealName());
-			shopAppointableTimeListVo.setMobile(member.getMobile());
-			if (null == member.getGender()) {
-				shopAppointableTimeListVo.setSex("未知");
-			} else {
-				shopAppointableTimeListVo.setSex(member.getGender() == 1 ? "女" : member.getGender() == 0 ? "男" : "未知");
+			if(null != member){
+				shopAppointableTimeListVo.setUserName(member.getRealName());
+				shopAppointableTimeListVo.setMobile(member.getMobile());
+				if (null == member.getGender()) {
+					shopAppointableTimeListVo.setSex("未知");
+				} else {
+					shopAppointableTimeListVo.setSex(member.getGender() == 1 ? "女" : member.getGender() == 0 ? "男" : "未知");
+				}
+				list.add(shopAppointableTimeListVo);
 			}
-			list.add(shopAppointableTimeListVo);
 		});
 		return list;
 	}
diff --git a/ruoyi-modules/ruoyi-shop/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-shop/src/main/resources/bootstrap.yml
index 8d7f697..d0c83a2 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/resources/bootstrap.yml
+++ b/ruoyi-modules/ruoyi-shop/src/main/resources/bootstrap.yml
@@ -15,7 +15,6 @@
       discovery:
         # 服务注册地址
         server-addr: 192.168.110.80:8848
-        ip: 192.168.110.21
 #        server-addr: 47.109.78.184:5000
 #        server-addr: 127.0.0.1:8848
 #        pro
diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml
index a6bbb52..aaca3a5 100644
--- a/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml
+++ b/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml
@@ -21,7 +21,6 @@
 #        server-addr: 47.109.78.184:5000
 #        server-addr: 127.0.0.1:8848
         server-addr: 192.168.110.80:8848
-        ip: 192.168.110.21
         #pro
 #        namespace: 9591ef9f-a49a-4900-be35-d77258bdd639
         #test

--
Gitblit v1.7.1