jk-GitHub-coder 4 gadi atpakaļ
vecāks
revīzija
82abecebaa

+ 10 - 0
YijiaRestful/src/main/java/com/platform/yijia/controller/ElectronicMembershipCardController.java

@@ -150,6 +150,15 @@ public class ElectronicMembershipCardController {
                 customerCardUseRecord.setPayType(payType);      //1表示微信
                 customerCardUseRecord.setCreateTime(new Date());
                 customerCardUseRecord.setStatus("0");
+
+                CustomerElectronicCard c = new CustomerElectronicCard();
+                c.setUnionId(unionId);
+                c.setCardOilsType(cardOilsType);
+                CustomerElectronicCard electronicCardInfoByUnionId = electronicMembershipCardService.getElectronicCardInfoByUnionId(c);
+                if(electronicCardInfoByUnionId !=null && electronicCardInfoByUnionId.getCustomerNo() !=null){
+                    customerCardUseRecord.setCustomerNo(electronicCardInfoByUnionId.getCustomerNo());
+                }
+
                 //订单规则 时间+6位随机数
                 Random random = new Random();
                 String str="";
@@ -420,6 +429,7 @@ public class ElectronicMembershipCardController {
                 customerElectronicCard.setRecentlyTime(new Date());
                 electronicMembershipCardService.updateElectronicCardInfoByUnionId(customerElectronicCard);
                 customerCardUseRecord.setStatus("1");
+                customerCardUseRecord.setBalance(customerElectronicCard.getAmt());
                 electronicMembershipCardService.updateCardRecordStatusByOrderNo(customerCardUseRecord);
                 logger.info("=====================电子会员卡充值成功=============================");
             }

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

@@ -13,12 +13,14 @@ public class CustomerCardUseRecord {
     private Integer id;
     private String orderNo;      //'充值订单号',
     private String unionId;        //'微信用户唯一标识',
+    private String customerNo;      //会员ID
     private String customerName;    //''客户名'',
     private String usageType;            //'电子会员卡消费充值类型:+,充值;-,消费;',
     private String payType;      //'电子会员卡充值消费类型:1.微信;2.POS机',
     private String cardOilsType;        //油类:1.柴油;2.汽油;
     private BigDecimal amt;         //'充值,消费金额'
     private BigDecimal presentAmt;     //''赠送金额''
+    private BigDecimal balance;         //余额
     private Date createTime;            //'记录时间'
     private Integer stationId;      //'油站ID'
     private String stationName;     //'油站名称'

+ 16 - 0
YijiaRestful/src/main/resources/mapper/ElectronicMembershipCardMapper.xml

@@ -23,12 +23,14 @@
         <id     column="id"                    jdbcType="INTEGER"   property="id" />
         <result column="order_no"              jdbcType="VARCHAR"   property="orderNo" />
         <result column="union_id"              jdbcType="VARCHAR"   property="unionId" />
+        <result column="customer_no"           jdbcType="VARCHAR"   property="customerNo" />
         <result column="customer_name"         jdbcType="VARCHAR"   property="customerName" />
         <result column="usage_type"            jdbcType="VARCHAR"   property="usageType" />
         <result column="pay_type"              jdbcType="VARCHAR"   property="payType" />
         <result column="card_oils_type"        jdbcType="VARCHAR"   property="cardOilsType" />
         <result column="amt"                   jdbcType="DECIMAL"   property="amt" />
         <result column="present_amt"           jdbcType="DECIMAL"   property="presentAmt" />
+        <result column="balance"               jdbcType="DECIMAL"   property="balance" />
         <result column="create_time"           jdbcType="TIMESTAMP" property="createTime" />
         <result column="station_id"            jdbcType="INTEGER"   property="stationId" />
         <result column="station_name"          jdbcType="VARCHAR"   property="stationName" />
@@ -145,6 +147,9 @@
             <if test="unionId !=null">
                 union_id,
             </if>
+            <if test="customerNo !=null">
+                customer_no,
+            </if>
             <if test="customerName !=null">
                 customer_name,
             </if>
@@ -163,6 +168,9 @@
             <if test="presentAmt !=null">
                 present_amt,
             </if>
+            <if test="balance !=null">
+                balance,
+            </if>
             <if test="createTime !=null">
                 create_time,
             </if>
@@ -183,6 +191,9 @@
             <if test="unionId !=null">
                 #{unionId},
             </if>
+            <if test="customerNo !=null">
+                #{customerNo},
+            </if>
             <if test="customerName !=null">
                 #{customerName},
             </if>
@@ -201,6 +212,9 @@
             <if test="presentAmt !=null">
                 #{presentAmt},
             </if>
+            <if test="balance !=null">
+                #{balance},
+            </if>
             <if test="createTime !=null">
                 #{createTime},
             </if>
@@ -222,12 +236,14 @@
             id,
             order_no,
             union_id,
+            customer_no,
             customer_name,
             usage_type,
             pay_type,
             card_oils_type,
             amt,
             present_amt,
+            balance,
             create_time,
             station_id,
             station_name,