jk-GitHub-coder 4 سال پیش
والد
کامیت
e9a27341f6

+ 15 - 9
YijiaRestful/src/main/java/com/platform/yijia/controller/CustomerGradeController.java

@@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.*;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.util.HashMap;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 /**
 /**
@@ -53,11 +52,16 @@ public class CustomerGradeController {
      */
      */
     @RequestMapping(value = "/getCustomerGradeInfo", method = RequestMethod.POST)
     @RequestMapping(value = "/getCustomerGradeInfo", method = RequestMethod.POST)
     @ResponseBody
     @ResponseBody
-    public List<Map<String, Object>> getCustomerGradeInfo(@RequestBody JSONObject jsonObject){
+    public String getCustomerGradeInfo(@RequestBody JSONObject jsonObject){
+        Gson gson =new Gson();
+        ResultData resultData =null;
         Map<String, Object> params = new HashMap<>();
         Map<String, Object> params = new HashMap<>();
+        //oilName
+        params.put("oilName", jsonObject.get("oilName"));
         params.put("mobilePhone", jsonObject.get("mobilePhone"));
         params.put("mobilePhone", jsonObject.get("mobilePhone"));
         params.put("stationId", jsonObject.get("stationId"));
         params.put("stationId", jsonObject.get("stationId"));
         params.put("userType", jsonObject.get("userType"));
         params.put("userType", jsonObject.get("userType"));
+        //params.put("grade", jsonObject.get("grade"));
         switch (jsonObject.get("userType").toString()){
         switch (jsonObject.get("userType").toString()){
             case "1":
             case "1":
                 params.put("blogOpenid", jsonObject.get("openId").toString());
                 params.put("blogOpenid", jsonObject.get("openId").toString());
@@ -67,14 +71,16 @@ public class CustomerGradeController {
                 break;
                 break;
         }
         }
         logger.info("查询客户等级所传参数:"+params.toString());
         logger.info("查询客户等级所传参数:"+params.toString());
-        return customerGradeServices.getCustomerGradeInfo(params);
+        if(jsonObject.get("discountPlanType").toString().equals("直降")){
+            //直降
+            resultData = ResultData.success(customerGradeServices.getCustomerGradeInfo(params));
+        }else {
+            //营销优惠立减 满减
+            params.put("discountPlanType", jsonObject.get("discountPlanType").toString());
+            resultData = ResultData.success(customerGradeServices.getCustomerGradeInfoByYouHui(params));
+        }
+        return gson.toJson(resultData);
     }
     }
 
 
-    // 营销:立减方案
-    @RequestMapping("/getmarkertPlanList")
-    @ResponseBody
-    public List<Map> getmarkertPlanList(){
-        return customerGradeServices.getMarkertPlanListByDiscountPlanType();
-    }
 
 
 }
 }

+ 4 - 1
YijiaRestful/src/main/java/com/platform/yijia/dao/CustomerGradeMapper.java

@@ -9,7 +9,10 @@ public interface CustomerGradeMapper {
     List<Map> getCustomerGradeList(Map map);
     List<Map> getCustomerGradeList(Map map);
 
 
     //获取客户等级信息
     //获取客户等级信息
-    List<Map<String, Object>> getCustomerGradeInfo(Map map);
+    Map<String, Object> getCustomerGradeInfo(Map map);
+
+    //获取客户优惠等级信息
+    Map<String, Object> getCustomerGradeInfoByYouHui(Map map);
 
 
     //营销 立减
     //营销 立减
     List<Map> getMarkertPlanListByDiscountPlanType();
     List<Map> getMarkertPlanListByDiscountPlanType();

+ 4 - 2
YijiaRestful/src/main/java/com/platform/yijia/service/CustomerGradeServices.java

@@ -1,6 +1,5 @@
 package com.platform.yijia.service;
 package com.platform.yijia.service;
 
 
-import org.springframework.stereotype.Service;
 
 
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -12,7 +11,10 @@ public interface CustomerGradeServices {
     List<Map> getCustomerGradeList(Map map);
     List<Map> getCustomerGradeList(Map map);
 
 
     //获取客户等级信息
     //获取客户等级信息
-    List<Map<String, Object>> getCustomerGradeInfo(Map map);
+    Map<String, Object> getCustomerGradeInfo(Map map);
+
+    //获取客户优惠等级信息
+    Map<String, Object> getCustomerGradeInfoByYouHui(Map map);
 
 
     //立减
     //立减
     List<Map> getMarkertPlanListByDiscountPlanType();
     List<Map> getMarkertPlanListByDiscountPlanType();

+ 7 - 1
YijiaRestful/src/main/java/com/platform/yijia/service/impl/CustomerGradeServiceImpl.java

@@ -23,10 +23,16 @@ public class CustomerGradeServiceImpl implements CustomerGradeServices {
 
 
     //查询客户等级信息
     //查询客户等级信息
     @Override
     @Override
-    public List<Map<String, Object>> getCustomerGradeInfo(Map map) {
+    public Map<String, Object> getCustomerGradeInfo(Map map) {
         return customerGradeMapper.getCustomerGradeInfo(map);
         return customerGradeMapper.getCustomerGradeInfo(map);
     }
     }
 
 
+    //获取客户优惠等级信息
+    @Override
+    public Map<String, Object> getCustomerGradeInfoByYouHui(Map map) {
+        return customerGradeMapper.getCustomerGradeInfoByYouHui(map);
+    }
+
     //营销立减
     //营销立减
     @Override
     @Override
     public List<Map> getMarkertPlanListByDiscountPlanType() {
     public List<Map> getMarkertPlanListByDiscountPlanType() {

+ 58 - 12
YijiaRestful/src/main/resources/mapper/CustomerGradeMapper.xml

@@ -25,24 +25,64 @@
     </where>
     </where>
   </select>
   </select>
 
 
-    <!--查询客户等级信息-->
+    <!--查询客户等级直降信息-->
     <select id="getCustomerGradeInfo" parameterType="map" resultType="map">
     <select id="getCustomerGradeInfo" parameterType="map" resultType="map">
         SELECT
         SELECT
+            T2.station_name			        AS stationName,
+            T2.member_grade			        AS memberGradeId,
+            T3.grade					    AS grade,
+            T3.discount_way                 AS discountWay,
+            T3.oil_name                     AS oilName,
+            T3.gasoil_discount_litre        AS gasoilDiscountLitre,
+            T3.member_condit_start          AS memberConditStart,
+            T3.member_condit_end            AS memberConditEnd,
+            T3.member_condit                AS memberCondit
+        FROM
+            app_user_info 					AS T1
+        LEFT JOIN customer_manage 			AS T2   ON T1.mobile_phone = T2.phone_number
+        LEFT JOIN customer_grade_setting 	AS T3   ON T2.station_id = T3.station_id AND T2.oil_name = T3.oil_name
+<!--            <if test="grade !=null and grade != ''"> AND T3.grade = T2.member_grade </if>-->
+        <where>
+            <if test="mobilePhone != null and mobilePhone !=''">
+                T1.mobile_phone = #{mobilePhone}
+            </if>
+            <if test="userType != null and userType !=''">
+                AND T1.user_type = #{userType}
+            </if>
+            <if test="oilName != null and oilName !=''">
+                AND T2.oil_name = #{oilName}
+            </if>
+            <if test="stationId != null and stationId != ''">
+                AND T2.station_id = #{stationId}
+            </if>
+            <if test="blogOpenid != null and blogOpenid != ''">
+                AND T1.blog_openid = #{blogOpenid}
+            </if>
+            <if test="minaOpenid != null and minaOpenid != ''">
+                AND T1.mina_openid = #{minaOpenid}
+            </if>
+        </where>
+    </select>
+
+
+    <!--查询客户等级优惠信息-->
+    <select id="getCustomerGradeInfoByYouHui" parameterType="map" resultType="map">
+        SELECT
             T2.station_name			    AS stationName,
             T2.station_name			    AS stationName,
-            T2.liters 			        AS liters,
-            T2.amt					    AS amt,
+            T3.oil_name                 AS oilName,
             T2.member_grade			    AS memberGradeId,
             T2.member_grade			    AS memberGradeId,
             T3.grade					AS grade,
             T3.grade					AS grade,
-            T3.discount_way             AS discountWay,
-            T3.oil_name                 AS oilName,
-            T3.gasoil_discount_litre    AS gasoilDiscountLitre,
-            T3.member_condit_start      AS memberConditStart,
-            T3.member_condit_end        AS memberConditEnd,
-            T3.member_condit            AS memberCondit
+            T3.discount_term            AS discountTerm,
+            T3.gasoil_discount_amt      AS gasoilDiscountAmt,
+            T3.discount_amt             AS discountAmt,
+            T3.vip_discounty_plus       AS vipDiscountyPlus,
+            T3.coupon_plus              AS couponPlus,
+            T3.discount_plan_type       AS discountPlanType
         FROM
         FROM
-            app_user_info 					AS T1
-        LEFT JOIN customer_manage 			AS T2   ON T1.mobile_phone = T2.phone_number
-        LEFT JOIN customer_grade_setting 	AS T3   ON T2.member_grade = T3.id
+            app_user_info 				AS T1
+        LEFT JOIN customer_manage 		AS T2   ON T1.mobile_phone = T2.phone_number
+        LEFT JOIN markert_plan 	        AS T3   ON T3.station_id = T2.station_id AND T3.oil_name = T2.oil_name
+<!--            <if test="grade !=null and grade != ''"> AND T3.grade = T2.member_grade </if>-->
         <where>
         <where>
             <if test="mobilePhone != null and mobilePhone !=''">
             <if test="mobilePhone != null and mobilePhone !=''">
                 T1.mobile_phone = #{mobilePhone}
                 T1.mobile_phone = #{mobilePhone}
@@ -50,6 +90,12 @@
             <if test="userType != null and userType !=''">
             <if test="userType != null and userType !=''">
                 AND T1.user_type = #{userType}
                 AND T1.user_type = #{userType}
             </if>
             </if>
+            <if test="oilName != null and oilName !=''">
+                AND T2.oil_name = #{oilName}
+            </if>
+            <if test="discountPlanType != null and discountPlanType !=''">
+                AND T3.discount_plan_type = #{discountPlanType}
+            </if>
             <if test="stationId != null and stationId != ''">
             <if test="stationId != null and stationId != ''">
                 AND T2.station_id = #{stationId}
                 AND T2.station_id = #{stationId}
             </if>
             </if>