From c4bade94a970fca41493ec5a8e02a91219248a57 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Wed, 01 Dec 2021 10:47:47 +0800
Subject: [PATCH] Merge branch 'score-shop' of http://120.27.238.55:7000/r/xzx into score-shop

---
 gc-user/src/main/resources/mapper/user/AccountMapper.xml             |    2 
 gc-shop/src/main/java/com/xzx/gc/shop/service/JhyService.java        |    2 
 gc-order/src/main/resources/mapper/order/JhyInfoMapper.xml           |    2 
 gc-shop/src/main/java/com/xzx/gc/shop/vo/JhyOrderItemsVo.java        |    4 
 gc-user/src/main/java/com/xzx/gc/user/service/UserService.java       |    8 +-
 gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java |    4 
 gc-user/src/main/resources/mapper/user/OrderMapper.xml               |  108 ++++++++++++++++++++++++++++++++++++
 gc-user/src/main/java/com/xzx/gc/user/mapper/OrderMapper.java        |    4 +
 8 files changed, 124 insertions(+), 10 deletions(-)

diff --git a/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java b/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java
index 4ef021c..41d1839 100644
--- a/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java
+++ b/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java
@@ -156,7 +156,7 @@
 
         BigDecimal total = BigDecimal.ZERO;
         for (JhyOrderItems item : items) {
-            item.setPrice(item.getPrice().multiply(BigDecimal.valueOf(40)));
+            item.setPrice(item.getPrice().multiply(BigDecimal.valueOf(50)));
             total = total.add(StrUtil.isNotBlank(item.getScore()) ? new BigDecimal(item.getScore()) : BigDecimal.ZERO);
         }
 
@@ -236,7 +236,7 @@
                     orderItems.setItemType(item.getId());
                     orderItems.setTitle(environmentalInfo.getTitle());
                     orderItems.setPrice(new BigDecimal(environmentalInfo.getPrice()));
-                    BigDecimal total = orderItems.getPrice().multiply(BigDecimal.valueOf(40)).multiply(weight);
+                    BigDecimal total = orderItems.getPrice().multiply(BigDecimal.valueOf(50)).multiply(weight);
                     orderItems.setScore(total.setScale(0, BigDecimal.ROUND_DOWN).toString());
                     orderItems.setWeight(weight);
                     jhyOrderItemsMapper.insert(orderItems);
diff --git a/gc-order/src/main/resources/mapper/order/JhyInfoMapper.xml b/gc-order/src/main/resources/mapper/order/JhyInfoMapper.xml
index 3bc213f..7813f66 100644
--- a/gc-order/src/main/resources/mapper/order/JhyInfoMapper.xml
+++ b/gc-order/src/main/resources/mapper/order/JhyInfoMapper.xml
@@ -9,6 +9,6 @@
 
     <select id="selectJhyInfoListInAddressRange" resultType="com.xzx.gc.entity.JhyInfo">
         select * from xzx_jhy_info a
-        where 7500 > lat_lng_distance(a.lat, a.lon, (select latitude from xzx_user_address_info where address_id=#{addressId}), (select longitude from xzx_user_address_info where address_id=#{addressId}))*1000
+        where 6000 > lat_lng_distance(a.lat, a.lon, (select latitude from xzx_user_address_info where address_id=#{addressId}), (select longitude from xzx_user_address_info where address_id=#{addressId}))*1000
     </select>
 </mapper>
\ No newline at end of file
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/service/JhyService.java b/gc-shop/src/main/java/com/xzx/gc/shop/service/JhyService.java
index e594674..671a7db 100644
--- a/gc-shop/src/main/java/com/xzx/gc/shop/service/JhyService.java
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/service/JhyService.java
@@ -117,7 +117,7 @@
         List<JhyOrderItemsVo> jhyOrderItemsList = jhyOrderItemsMapper.selectJhyOrderItemListByOrderId(id);
         if(CollUtil.isNotEmpty(jhyOrderItemsList)){
             for(JhyOrderItemsVo jhyOrderItemsVo : jhyOrderItemsList){
-                BigDecimal multiply = jhyOrderItemsVo.getPrice().multiply(new BigDecimal(40));
+                BigDecimal multiply = jhyOrderItemsVo.getPrice().multiply(new BigDecimal(50));
                 jhyOrderItemsVo.setPrice(multiply);
                 jhyOrderItemsVo.setAllPrice(new BigDecimal(StrUtil.isEmpty(jhyOrderItemsVo.getScore())?"0":jhyOrderItemsVo.getScore()).setScale( 2, BigDecimal.ROUND_DOWN ));
             }
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/vo/JhyOrderItemsVo.java b/gc-shop/src/main/java/com/xzx/gc/shop/vo/JhyOrderItemsVo.java
index cfaf04e..1478a9f 100644
--- a/gc-shop/src/main/java/com/xzx/gc/shop/vo/JhyOrderItemsVo.java
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/vo/JhyOrderItemsVo.java
@@ -15,10 +15,10 @@
     @ApiModelProperty(value="标题")
     private String title;
 
-    @ApiModelProperty(value="单价(积分)= 价格*40")
+    @ApiModelProperty(value="单价(积分)= 价格*50")
     private BigDecimal price;
 
-    @ApiModelProperty(value="总积分= 价格*重量*40")
+    @ApiModelProperty(value="总积分= 价格*重量*50")
     private BigDecimal allPrice;
 
     @ApiModelProperty(value="图片")
diff --git a/gc-user/src/main/java/com/xzx/gc/user/mapper/OrderMapper.java b/gc-user/src/main/java/com/xzx/gc/user/mapper/OrderMapper.java
index e7e33e5..461aa64 100644
--- a/gc-user/src/main/java/com/xzx/gc/user/mapper/OrderMapper.java
+++ b/gc-user/src/main/java/com/xzx/gc/user/mapper/OrderMapper.java
@@ -68,5 +68,9 @@
     List<CategaryVo> selectJHYListByOrderId(String orderId);
 
     String selectTGRMobileByPhone(@Param("mobilePhone")String mobilePhone);
+
+    Map<String, Object> queryCuserOrderByUserIdOrderIng(@Param("userId")String userId);
+
+    Map<String, Object> queryCuserOrderByUserIdOrderDone(@Param("userId")String userId);
 }
 
diff --git a/gc-user/src/main/java/com/xzx/gc/user/service/UserService.java b/gc-user/src/main/java/com/xzx/gc/user/service/UserService.java
index c975ff7..3789202 100644
--- a/gc-user/src/main/java/com/xzx/gc/user/service/UserService.java
+++ b/gc-user/src/main/java/com/xzx/gc/user/service/UserService.java
@@ -469,9 +469,11 @@
                 mx.setNickName(com.xzx.gc.common.utils.StringUtils.decode(mx.getNickName()));
             }
             // 待完成订单总数
-            Map<String, Object> osMap = orderMapper.queryCuserOrderByUserIdCount1(mx.getUserId());
-            mx.setOrderStatus3(Integer.parseInt(osMap.get("count1").toString()));
-            mx.setOrderStatus5(Integer.parseInt(osMap.get("count").toString()));
+//            Map<String, Object> osMap = orderMapper.queryCuserOrderByUserIdCount1(mx.getUserId());
+            Map<String, Object> orderIng = orderMapper.queryCuserOrderByUserIdOrderIng(mx.getUserId());
+            Map<String, Object> orderDone = orderMapper.queryCuserOrderByUserIdOrderDone(mx.getUserId());
+            mx.setOrderStatus3(Integer.parseInt(orderIng.get("count").toString()));
+            mx.setOrderStatus5(Integer.parseInt(orderDone.get("count").toString()));
 
             //查询用户首次下单时间和最近下单时间
             List<OrderInfo> byCreateUserId = orderService.findByCreateUserId(mx.getUserId(), null);
diff --git a/gc-user/src/main/resources/mapper/user/AccountMapper.xml b/gc-user/src/main/resources/mapper/user/AccountMapper.xml
index a417c05..bff7cb9 100644
--- a/gc-user/src/main/resources/mapper/user/AccountMapper.xml
+++ b/gc-user/src/main/resources/mapper/user/AccountMapper.xml
@@ -255,7 +255,7 @@
             c.nick_name nickname,
             c.mobile_phone phone,
             (select sum(score) from xzx_jhy_order_items where b.id = order_id) score,
-            (select sum(score/ 40) from xzx_jhy_order_items where b.id = order_id) amount
+            (select sum(score/ 50) from xzx_jhy_order_items where b.id = order_id) amount
         FROM
             xzx_user_head_details a
                 LEFT JOIN xzx_jhy_order b ON a.order_no = b.order_no
diff --git a/gc-user/src/main/resources/mapper/user/OrderMapper.xml b/gc-user/src/main/resources/mapper/user/OrderMapper.xml
index f1b5c08..3427663 100644
--- a/gc-user/src/main/resources/mapper/user/OrderMapper.xml
+++ b/gc-user/src/main/resources/mapper/user/OrderMapper.xml
@@ -620,4 +620,112 @@
         WHERE  a.register_mobile_phone = #{mobilePhone}
     </select>
 
+
+
+    <select id="queryCuserOrderByUserIdOrderIng" resultType="java.util.Map">
+
+        SELECT
+            COUNT(*) as count
+        FROM
+            (
+            (
+            SELECT
+            a.order_id orderId,
+            a.order_status STATUS,
+            '1' type,
+            ifnull(sum(d.money), 0) money,
+            '0' score,
+            a.address address,
+            ifnull(sum(d.weight), 0) weight,
+            e. NAME NAME,
+            a.create_time createTime
+            FROM
+            xzx_order_info a
+            LEFT JOIN xzx_order_item_info d ON a.order_id = d.order_id
+            LEFT JOIN xzx_user_info e ON e.user_id = a.receiver
+            WHERE
+            a.create_user_id=#{userId}
+            and a.order_status in (1,2,3)
+            GROUP BY
+            a.order_id
+            )
+            UNION
+            (
+            SELECT
+            a.id orderId,
+            a. STATUS STATUS,
+            '2' type,
+            '0' money,
+            ifnull(sum(d.score), 0) score,
+            a.address address,
+            ifnull(sum(d.weight), 0) weight,
+            a.username NAME,
+            a.CREATED_TIME createTime
+            FROM
+            xzx_jhy_order a
+            LEFT JOIN xzx_jhy_order_items d ON a.id = d.order_id
+            WHERE
+            a.user_id = #{userId}
+            and a.status in (1,2)
+            GROUP BY
+            a.id
+            )
+            ) v
+        ORDER BY
+            createTime DESC
+    </select>
+
+    <select id="queryCuserOrderByUserIdOrderDone" resultType="java.util.Map">
+
+        SELECT
+            COUNT(*) as count
+        FROM
+            (
+            (
+            SELECT
+            a.order_id orderId,
+            a.order_status STATUS,
+            '1' type,
+            ifnull(sum(d.money), 0) money,
+            '0' score,
+            a.address address,
+            ifnull(sum(d.weight), 0) weight,
+            e. NAME NAME,
+            a.create_time createTime
+            FROM
+            xzx_order_info a
+            LEFT JOIN xzx_order_item_info d ON a.order_id = d.order_id
+            LEFT JOIN xzx_user_info e ON e.user_id = a.receiver
+            WHERE
+            a.create_user_id=#{userId}
+            and a.order_status in (4,5,7)
+            GROUP BY
+            a.order_id
+            )
+            UNION
+            (
+            SELECT
+            a.id orderId,
+            a. STATUS STATUS,
+            '2' type,
+            '0' money,
+            ifnull(sum(d.score), 0) score,
+            a.address address,
+            ifnull(sum(d.weight), 0) weight,
+            a.username NAME,
+            a.CREATED_TIME createTime
+            FROM
+            xzx_jhy_order a
+            LEFT JOIN xzx_jhy_order_items d ON a.id = d.order_id
+            WHERE
+            a.user_id = #{userId}
+            and a.status = 3
+            GROUP BY
+            a.id
+            )
+            ) v
+        ORDER BY
+            createTime DESC
+    </select>
+
 </mapper>

--
Gitblit v1.9.1