Просмотр исходного кода

微信支付 监听订单状态

zhs 3 лет назад
Родитель
Сommit
7271c31795

+ 19 - 6
src/main/java/com/travel/controller/ReleaseTravelController.java

@@ -1,10 +1,7 @@
 package com.travel.controller;
 
 import com.alibaba.fastjson.JSONArray;
-import com.travel.model.PrivateOrder;
-import com.travel.model.Travel;
-import com.travel.model.TravelExperience;
-import com.travel.model.TravelGive;
+import com.travel.model.*;
 import com.travel.service.PrivateOrderService;
 import com.travel.service.ReleaseTravelService;
 import com.travel.util.ParsingToken;
@@ -169,11 +166,27 @@ public class ReleaseTravelController {
             if(travel.getTypeForm().equals("ptyh")){
                 releaseTravelService.updateLookNum(travel);//修改查看数量
                 listTravel = releaseTravelService.getTravelID(travel);//查询游记内容
-                listTravel.setTravelArray(releaseTravelService.getTravelExper(travel));//查询游记每天内容
+                List<TravelExperience> list = releaseTravelService.getTravelExper(travel);
+                if(list.size() != 0){
+                    listTravel.setTravelArray(list);//查询游记每天内容
+                }
+                //查询收藏
+                List<OrderingConllection> list1 = releaseTravelService.getTravelConllection(travel.getUuid());
+                if(list1.size() != 0){
+                    listTravel.setCollection(list1);
+                }
             } else {
                 releaseTravelService.updateLookNumRoute(travel);//修改查看数量
                 listTravel = releaseTravelService.getTravelRoute(travel);//查询供应商路线内容
-                listTravel.setTravelArrayRoute(privateOrderService.getSupplierReleasePlay(travel.getUuid()));
+                List<SupplierReleasePlay> list = privateOrderService.getSupplierReleasePlay(travel.getUuid());
+                if(list.size() != 0){
+                    listTravel.setTravelArrayRoute(list);//查询游记每天内容
+                }
+                //查询收藏
+                List<OrderingConllection> list1 = releaseTravelService.getTravelConllection(travel.getUuid());
+                if(list1.size() != 0){
+                    listTravel.setCollection(list1);
+                }
             }
             map.put("data", listTravel);
             map.put("msg", "200");

+ 5 - 4
src/main/java/com/travel/mapper/ReleaseTravelMapper.java

@@ -1,9 +1,6 @@
 package com.travel.mapper;
 
-import com.travel.model.PrivateOrder;
-import com.travel.model.Travel;
-import com.travel.model.TravelExperience;
-import com.travel.model.TravelGive;
+import com.travel.model.*;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
@@ -52,4 +49,8 @@ public interface ReleaseTravelMapper {
     PrivateOrder getTravelVal(String id);
 
     List<Map<String, Object>> getRoute();
+
+    Map<Object, Object> getReleseType(String uuid);
+
+    List<OrderingConllection> getTravelConllection(String uuid);
 }

+ 4 - 0
src/main/java/com/travel/model/OrderingConllection.java

@@ -48,4 +48,8 @@ public class OrderingConllection implements Serializable {
      * 标题
      */
     private String titleTravel;
+    /**
+     * 头像
+     */
+    private String headpir;
 }

+ 4 - 0
src/main/java/com/travel/model/PrivateOrder.java

@@ -164,4 +164,8 @@ public class PrivateOrder implements Serializable {
      * 供应商名称
      */
     private String supplieName;
+    /**
+     * 是否有过退款记录
+     */
+    private String refundCount;
 }

+ 4 - 0
src/main/java/com/travel/model/Travel.java

@@ -53,6 +53,10 @@ public class Travel implements Serializable {
      * 供应商游玩信息
      */
     private List<SupplierReleasePlay> travelArrayRoute;
+    /**
+     * 收藏
+     */
+    private List<OrderingConllection> collection;
     /**
      * 游记状态
      */

+ 3 - 4
src/main/java/com/travel/service/ReleaseTravelService.java

@@ -1,9 +1,6 @@
 package com.travel.service;
 
-import com.travel.model.PrivateOrder;
-import com.travel.model.Travel;
-import com.travel.model.TravelExperience;
-import com.travel.model.TravelGive;
+import com.travel.model.*;
 
 import java.util.List;
 import java.util.Map;
@@ -50,4 +47,6 @@ public interface ReleaseTravelService {
     PrivateOrder getTravelVal(String id);
 
     Map<String, Object> getRoute();
+
+    List<OrderingConllection> getTravelConllection(String uuid);
 }

+ 6 - 4
src/main/java/com/travel/service/impl/ReleaseTravelServiceImpl.java

@@ -1,10 +1,7 @@
 package com.travel.service.impl;
 
 import com.travel.mapper.ReleaseTravelMapper;
-import com.travel.model.PrivateOrder;
-import com.travel.model.Travel;
-import com.travel.model.TravelExperience;
-import com.travel.model.TravelGive;
+import com.travel.model.*;
 import com.travel.service.ReleaseTravelService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -142,4 +139,9 @@ public class ReleaseTravelServiceImpl implements ReleaseTravelService {
         }
         return map;
     }
+
+    @Override
+    public List<OrderingConllection> getTravelConllection(String uuid) {
+        return releaseTravelMapperl.getTravelConllection(uuid);
+    }
 }

+ 10 - 1
src/main/java/com/travel/service/impl/WxRefundServiceImpl.java

@@ -1,5 +1,6 @@
 package com.travel.service.impl;
 
+import com.travel.mapper.ReleaseTravelMapper;
 import com.travel.mapper.WxPayMapper;
 import com.travel.mapper.WxRefundMapper;
 import com.travel.model.WxRefund;
@@ -21,6 +22,8 @@ public class WxRefundServiceImpl implements WxRefundService {
     private WxRefundMapper wxRefundMapper;
     @Autowired
     private WxPayMapper wxPayMapper;
+    @Autowired
+    private ReleaseTravelMapper releaseTravelMapper;
 
     //雪花算法 生成id
     private SnowflakeUtil snowflakeUtil = new SnowflakeUtil(1,1,1);
@@ -30,9 +33,15 @@ public class WxRefundServiceImpl implements WxRefundService {
     public Map<String, Object> addRefund(WxRefund wxRefund, HttpServletRequest request) {
         Map<String, Object> map = new HashMap<>();
         try{
+            Map<Object, Object> mapVal = releaseTravelMapper.getReleseType(wxRefund.getUuid());
+            if(null != mapVal){
+                map.put("msg", "500");
+                map.put("errMsg", "此订单不允许退款!");
+                return map;
+            }
             //判断该报价单是否存在退款申请
             Map<String, Object> mapRefund = wxPayMapper.getRefund(wxRefund.getReleaseUuid());
-            if(!mapRefund.isEmpty()){
+            if(null != mapRefund){
                 map.put("msg", "500");
                 map.put("errMsg", "该订单已存在退款申请!");
                 return map;

+ 5 - 4
src/main/resources/config/mapping/PrivateOrderMapper.xml

@@ -12,12 +12,13 @@
     <!-- 查询私人订制 -->
     <select id="getPrivate" resultType="PrivateOrder">
         SELECT
-            b.*,c.uuid as uuidRele,c.*,c.order_no as orderNoRelease,a.order_type as orderType,e.name as supplieName
+            b.*,c.uuid as uuidRele,c.*,c.order_no as orderNoRelease,a.order_type as orderType,e.name as supplieName,d.refundCount
         FROM
             bus_private_ordering AS b
             LEFT JOIN bus_supplier_release c ON b.uuid = c.demand_uuid
             LEFT JOIN sys_supplier e on c.code = e.code
             JOIN bus_private_ordering_type a on order_type = #{orderType} and b.uuid = a.demand_uuid
+            LEFT JOIN (SELECT count(*) as refundCount,release_uuid FROM bus_refund GROUP BY release_uuid) d ON c.uuid = d.release_uuid
         <trim prefix="WHERE" prefixOverrides="and | or">
             <if test="uuid != null and uuid != ''">
                 and b.uuid = #{uuid}
@@ -121,10 +122,10 @@
     <!-- 查询那些定制单已经行程开始 -->
     <select id="updatePrivateThree" parameterType="PrivateOrder" resultType="PrivateOrder">
         SELECT
-            a.*
+            a.*,b.code as supplieName
         FROM
             bus_private_ordering a
-            JOIN ( SELECT demand_uuid FROM bus_private_ordering_type WHERE order_type = '2') b ON a.uuid = b.demand_uuid
+            JOIN ( SELECT demand_uuid,code FROM bus_private_ordering_type WHERE order_type = '2') b ON a.uuid = b.demand_uuid
         WHERE a.start_time <![CDATA[ <= ]]> SYSDATETIME()
     </select>
     <!-- 查询有多少个行程开始且已经到达结束时间的订制单 -->
@@ -147,7 +148,7 @@
         set order_type = #{orderType}
         where
               demand_uuid = #{uuid}
-            <if test="code != null and code != ''">
+            <if test="supplieName != null and supplieName != ''">
                 and code = #{supplieName}
             </if>
     </update>

+ 39 - 8
src/main/resources/config/mapping/ReleaseTravelMapper.xml

@@ -73,13 +73,13 @@
                     LEFT JOIN ( SELECT headpir, name, code FROM sys_users ) f ON f.code = a.code
                 <trim prefix="WHERE" prefixOverrides="and | or">
                     <if test="destination != null and destination != ''">
-                        a.destination like CONCAT(CONCAT('%', #{destination}), '%')
+                        and a.destination like CONCAT(CONCAT('%', #{destination}), '%')
                     </if>
                     <if test="titleTravel != null and titleTravel != ''">
-                        a.title_travel like CONCAT(CONCAT('%', #{titleTravel}), '%')
+                        and a.title_travel like CONCAT(CONCAT('%', #{titleTravel}), '%')
                     </if>
                     <if test="jdrq != null and jdrq != ''">
-                        #{startTime} <![CDATA[ <= ]]> a.jdrq and #{endTime} <![CDATA[ > ]]> jdrq
+                        and #{startTime} <![CDATA[ <= ]]> a.jdrq and #{endTime} <![CDATA[ > ]]> jdrq
                     </if>
                 </trim>
                 UNION ALL
@@ -113,13 +113,13 @@
                     LEFT JOIN ( SELECT headpir, name, code FROM sys_supplier ) f ON f.code = a.code
                 <trim prefix="WHERE" prefixOverrides="and | or">
                     <if test="destination != null and destination != ''">
-                        a.destination like CONCAT(CONCAT('%', #{destination}), '%')
+                        and a.destination like CONCAT(CONCAT('%', #{destination}), '%')
                     </if>
                     <if test="titleTravel != null and titleTravel != ''">
-                        a.offer_name like CONCAT(CONCAT('%', #{titleTravel}), '%')
+                        and a.offer_name like CONCAT(CONCAT('%', #{titleTravel}), '%')
                     </if>
                     <if test="jdrq != null and jdrq != ''">
-                        #{startTime} <![CDATA[ <= ]]> a.jdrq and #{endTime} <![CDATA[ > ]]> jdrq
+                        and #{startTime} <![CDATA[ <= ]]> a.jdrq and #{endTime} <![CDATA[ > ]]> jdrq
                     </if>
                 </trim>
             ) e
@@ -294,7 +294,13 @@
                         and code = #{code}
                     </if>
                     <if test="destination != null and destination != ''">
-                        destination = #{destination}
+                        and destination like CONCAT(CONCAT('%', #{destination}), '%')
+                    </if>
+                    <if test="titleTravel != null and titleTravel != ''">
+                        and  title_travel like CONCAT(CONCAT('%', #{titleTravel}), '%')
+                    </if>
+                    <if test="jdrq != null and jdrq != ''">
+                        and #{startTime} <![CDATA[ <= ]]> jdrq and #{endTime} <![CDATA[ > ]]> jdrq
                     </if>
                 </trim>
                 UNION ALL
@@ -311,7 +317,13 @@
                         and code = #{code}
                     </if>
                     <if test="destination != null and destination != ''">
-                        destination = #{destination}
+                        and destination like CONCAT(CONCAT('%', #{destination}), '%')
+                    </if>
+                    <if test="titleTravel != null and titleTravel != ''">
+                        and offer_name like CONCAT(CONCAT('%', #{titleTravel}), '%')
+                    </if>
+                    <if test="jdrq != null and jdrq != ''">
+                        and #{startTime} <![CDATA[ <= ]]> jdrq and #{endTime} <![CDATA[ > ]]> jdrq
                     </if>
                 </trim>
             ) a
@@ -359,6 +371,7 @@
             a.jdrq,
             a.look_num,
             a.destination,
+            a.people_num as peopleAll,
             b.name,
             b.headpir,
             c.countNum,
@@ -427,4 +440,22 @@
             LEFT JOIN sys_supplier b ON a.code = b.code
             LEFT JOIN (SELECT count(*) AS routeNum,code FROM bus_supplier_route GROUP BY code) c ON a.code = c.code
     </select>
+    <!-- 查询指定报价单的状态是否是2跟3 -->
+    <select id="getReleseType" resultType="Map">
+        SELECT
+            b.orderTypeCount
+        FROM
+            bus_supplier_release a
+            join (select count(*) as orderTypeCount,code,demand_uuid from bus_private_ordering_type where order_type = '2' or order_type = '3' GROUP BY code,demand_uuid) b on a.code = b.code and a.demand_uuid = b.demand_uuid
+        where a.uuid = #{uuid}
+    </select>
+    <!-- 查询指定游记的收藏 -->
+    <select id="getTravelConllection" resultType="OrderingConllection">
+        SELECT
+            b.code,b.headpir
+        FROM
+            bus_collection a
+            left join sys_users b on a.code = b.code
+        where ordering_uuid = #{uuid}
+    </select>
 </mapper>