jk-GitHub-coder 4 年 前
コミット
0070571cd2

+ 7 - 5
YijiaRestful/src/main/java/com/platform/yijia/controller/PayOrderController.java

@@ -239,6 +239,7 @@ public class PayOrderController {
         CustomerLabel customerLabelInfo = labelService.getCustomerLabel(customerLabel);
         if(payOrderRequest.getLabelFlag() !=null && payOrderRequest.getLabelFlag().equals("1") && customerLabelInfo !=null){
             //表示此用户为标签用户,计算标签用户优惠
+            params.put("labelId", customerLabelInfo.getLabelId());
             payOrderResultInfo = this.calculateLabelDiscount(params);
         }else {
             //不为标签用户时
@@ -280,23 +281,24 @@ public class PayOrderController {
         LabelRule labelRule = new LabelRule();
         labelRule.setStationId(Integer.valueOf(params.get("stationId").toString()));        //油站ID
         labelRule.setOilName(params.get("oilName").toString());                         //oilName
+        labelRule.setLabelId(Integer.valueOf(params.get("labelId").toString()));//
         List<LabelRule> labelRuleList = labelService.getLabelRuleList(labelRule);
         if(labelRuleList !=null && labelRuleList.size()> 0){
             //获取该油品的优惠明细
             List<LabelRuleDetail> labelRuleDetailList = labelRuleList.get(0).getLabelRuleDetailList();
             if(labelRuleDetailList !=null && labelRuleDetailList.size() ==1){
-                BigDecimal discountLitersAmt = new BigDecimal(labelRuleDetailList.get(0).getDiscountLitersAmt());
+                BigDecimal discountAmt_B = new BigDecimal(labelRuleDetailList.get(0).getDiscountAmt()); //满足享受优惠条件(满多少升、满多少元)
                 String discountTerm = labelRuleDetailList.get(0).getDiscountTerm();
                 switch (discountTerm){
                     case "1":   //按加油升数
-                        if(oilLiters.compareTo(discountLitersAmt) ==1 || oilLiters.compareTo(discountLitersAmt) ==0 ){
-                            discountAmt = oilLiters.multiply(new BigDecimal(labelRuleDetailList.get(0).getDiscountAmt()));
+                        if(oilLiters.compareTo(discountAmt_B) ==1 || oilLiters.compareTo(discountAmt_B) ==0 ){
+                            discountAmt = oilLiters.multiply(new BigDecimal(labelRuleDetailList.get(0).getDiscountLitersAmt()));
                             discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
                         }
                         break;
                     case "2":   //按加油金额
-                        if(receivableAmt.compareTo(discountLitersAmt) ==1 || receivableAmt.compareTo(discountLitersAmt) ==0 ){
-                            discountAmt = oilLiters.multiply(new BigDecimal(labelRuleDetailList.get(0).getDiscountAmt()));
+                        if(receivableAmt.compareTo(discountAmt_B) ==1 || receivableAmt.compareTo(discountAmt_B) ==0 ){
+                            discountAmt = oilLiters.multiply(new BigDecimal(labelRuleDetailList.get(0).getDiscountLitersAmt()));
                             discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
                         }
                         break;

+ 1 - 0
YijiaRestful/src/main/java/com/platform/yijia/pojo/LabelRule.java

@@ -22,4 +22,5 @@ public class LabelRule {
 
     //查询参数
     private String oilName;         //油品名称
+    private Integer labelId;        //标签ID
 }

+ 2 - 2
YijiaRestful/src/main/java/com/platform/yijia/pojo/LabelRuleDetail.java

@@ -14,8 +14,8 @@ public class LabelRuleDetail {
     private  Integer parentId;              //规则主表主键id
     private  String oilName;                //`油品
     private  String discountTerm;           //`优惠条件当为1按金额优惠;2按升数优惠
-    private  String discountLitersAmt;      //规则满足条件(满足多少升,多少元
-    private  String discountAmt;            //优惠金额
+    private  String discountLitersAmt;      //每升优惠的金额
+    private  String discountAmt;            //满足享受优惠条件(满多少升、满多少元)
     private  String createBy;               //创建人
     private Date createTime;                //创建时间
     private  String updateBy;               //更新人

+ 1 - 0
YijiaRestful/src/main/java/com/platform/yijia/pojo/PayOrder.java

@@ -54,6 +54,7 @@ public class PayOrder implements Serializable {
     private Integer printCount; //打印小票数量
     private String carNo; //车牌号
     private String customerPhone; //客户电话
+    private String mobilePhone; //关联app_user_info字段手机号
     private String customerGrade; //客户等级
     private String oilType; //油品类型 oil_type
     private String printSetting;        //打印方式

+ 2 - 2
YijiaRestful/src/main/resources/application.yml

@@ -19,7 +19,7 @@ yijia:
     domainName: mp.huijy.net
     # 路径前缀 test:测试; api:生产一线;prod:生产二线; demo:演示;
     path:
-        global-prefix: test
+        global-prefix: demo
 
 
 # POS机登录解密密文密码
@@ -30,7 +30,7 @@ yijia:
 spring:
     datasource:
 #        url: jdbc:mysql://47.105.116.204:3306/jiaduoduo_db?useUnicode=true&characterEncoding=utf8&nullCatalogMeansCurrent=true&serverTimezone=GMT%2b8&useSSL=true
-        url: jdbc:mysql://115.28.211.17:3306/jiaduoduo_db_test?useUnicode=true&characterEncoding=utf8&nullCatalogMeansCurrent=true&serverTimezone=GMT%2b8&useSSL=true
+        url: jdbc:mysql://115.28.211.17:3306/jiaduoduo_db_demo?useUnicode=true&characterEncoding=utf8&nullCatalogMeansCurrent=true&serverTimezone=GMT%2b8&useSSL=true
         username: develop
         password: 1234.Abcd
         driver-class-name: com.mysql.cj.jdbc.Driver

+ 3 - 0
YijiaRestful/src/main/resources/mapper/LabelMapper.xml

@@ -59,6 +59,9 @@
       label_rule AS T1 LEFT JOIN label_rule_detail AS T2 ON T1.id = T2.parent_id
     <where>
             T2.del_flag ="0"
+          <if test="labelId !=null and labelId !=''">
+             AND T1.id = #{labelId}
+          </if>
           <if test="stationId !=null and stationId !=''">
              AND T1.station_id = #{stationId}
           </if>

+ 3 - 0
YijiaRestful/src/main/resources/mapper/PayOrderMapper.xml

@@ -40,6 +40,7 @@
     <result column="print_count"            jdbcType="INTEGER"   property="printCount" />
     <result column="car_no"                 jdbcType="VARCHAR"   property="carNo" />
     <result column="customer_phone"         jdbcType="VARCHAR"   property="customerPhone" />
+    <result column="mobile_phone"           jdbcType="VARCHAR"   property="mobilePhone" />
     <result column="customer_grade"         jdbcType="VARCHAR"   property="customerGrade" />
     <result column="oil_type"               jdbcType="VARCHAR"   property="oilType" />
     <result column="payTypeName"            property="payTypeName" />
@@ -116,6 +117,7 @@
     T1.receivable_amt, T1.received_amt, T1.discount_amt, T1.discount_coupon_amt, T1.discount_coupon, T1.wx_amt,
     T1.zfb_amt, T1.pos_amt, T1.xj_amt, T1.didi_app_amt, T1.ty_app_amt, T1.other_amt, T1.dzk_amt, T1.score, T1.member_no, T1.member_amt,
     T1.print_count, T1.car_no, T1.customer_phone, T1.customer_grade, T1.oil_type,
+    CONCAT(LEFT(T3.mobile_phone,3),'****',RIGHT(T3.mobile_phone,4)) AS mobile_phone,
     T2.dict_label    AS payTypeName
   </sql>
   <sql id="Base_Column_List">
@@ -325,6 +327,7 @@
         FROM
                     pay_order       AS T1
         LEFT JOIN   sys_dict_data   AS T2 ON T1.pay_type = T2.dict_value
+        LEFT JOIN   app_user_info   AS T3 ON T1.consumer_id = T3.user_id
         <where>
             <if test="stationId !=null">
                 T1.station_id= #{stationId}