فهرست منبع

appuerinfo 添加stationId字段

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

+ 2 - 0
YijiaRestful/src/main/java/com/platform/yijia/controller/AppUserInfoController.java

@@ -148,6 +148,7 @@ public class AppUserInfoController {
             Map<String, String> param = new HashMap<>();
             param.put("unionId", unionId);
             param.put("userType", "1");
+            param.put("stationId", stationId.toString());
             String openId = appUserInfoService.whetherFollowGzh(param);
             if(openId !=null){
                 Map<String, String> m = stationService.getStationAppIdAndAppSecret(stationId);
@@ -401,6 +402,7 @@ public class AppUserInfoController {
                 customerElectronicCard.setUnionId(request.getUnionId());
             }
 
+            appUserInfo.setStationId(request.getStationId());
             appUserInfo.setRegisteDate(new Date());
             appUserInfo.setUpdateDate(new Date());
 

+ 2 - 1
YijiaRestful/src/main/java/com/platform/yijia/controller/PayController.java

@@ -596,6 +596,7 @@ public class PayController {
         CustomerManage customerManage = new CustomerManage();   //存放客户信息
         AppUserInfo appUserInfo = new AppUserInfo();    //存放查询用户信息
         appUserInfo.setMobilePhone(infoMap.get("mobilePhone").toString());
+        appUserInfo.setStationId(Integer.valueOf(infoMap.get("stationId").toString()));
         //从客户信息表查询数据用于插入客户表 使用List原因:app_user_info存在小程序和公众号两种信息
         List<AppUserInfo> appUserInfoList = payOrderService.getUserInfoByOpenId(appUserInfo);
         Date blogRegTime = null;    //公众号注册时间
@@ -1082,7 +1083,7 @@ public class PayController {
             customerPoints.setStationId(calculateIntegral.getStationId());
             customerPoints.setMinaOpenId(openId);
             customerPoints.setUnionId(calculateIntegral.getUnionId());
-            CustomerPoints customerPointsInfo = customerPointsService.getCustomerPointsInfoByMinaOpenId(customerPoints);
+            CustomerPoints customerPointsInfo = customerPointsService.getCustomerPointsInfoByUnionId(customerPoints);
             if(customerPointsInfo !=null){
                 logger.info("当前存在客户:"+ customerPointsInfo.getMinaOpenId());
                 logger.info("当前客户原有剩余积分:"+ customerPointsInfo.getPoints().toString());

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

@@ -244,7 +244,8 @@ public class PayOrderController {
                 payOrder.setDzkAmt(Double.valueOf(resultMap.get("amt").toString()));        //订单电子会员卡消费金额
                 CustomerElectronicCard customerElectronicCard = new CustomerElectronicCard();
                 customerElectronicCard.setCardOilsType(cardOilsType);
-                customerElectronicCard.setMinaOpenid(payOrderRequest.getOpenId());
+                //customerElectronicCard.setMinaOpenid(payOrderRequest.getOpenId());
+                customerElectronicCard.setUnionId(appUserInfoList.get(0).getUnionId());
                 customerElectronicCard.setStationId(payOrderRequest.getStationId());
                 //获取用户电子会员卡信息
                 CustomerElectronicCard cardInfo = electronicMembershipCardService.getElectronicCardInfoByMinaOpenId(customerElectronicCard);
@@ -305,7 +306,7 @@ public class PayOrderController {
                         }
                         customerManagerService.updateCustomerInfo(customerManage);
                     }else {
-                        customerManage.setCommendMan(payOrder.getConsumer());
+                        customerManage.setCustomerName(payOrder.getConsumer());
                         customerManage.setStationName(payOrder.getStationName());
                         customerManage.setLiters(new BigDecimal(resultMap.get("oilLiters").toString()));
                         customerManage.setAmt(new BigDecimal(resultMap.get("amt").toString()));
@@ -333,6 +334,7 @@ public class PayOrderController {
                     calculateIntegral.setOilName(payOrder.getOilName());
                     calculateIntegral.setOilType(payOrder.getOrderType());
                     calculateIntegral.setStationId(payOrder.getStationId());
+                    calculateIntegral.setUnionId(appUserInfoList.get(0).getUnionId());
                     calculateIntegral.setOpenId(payOrderRequest.getOpenId());   //小程序openId
                     //计算积分且推送积分
                     //CustomerManage customerManage = new CustomerManage();
@@ -763,7 +765,8 @@ public class PayOrderController {
                     }
                 }
             }
-            this.pushIntegral(calculateIntegral.getStationId(), integral, calculateIntegral.getOpenId());
+            calculateIntegral.setIntegral(integral);
+            this.pushIntegral(calculateIntegral);
         }
     }
 
@@ -773,7 +776,11 @@ public class PayOrderController {
      * @param integral  本次所得积分
      * @param openId    小程序用户openID
      */
-    public void pushIntegral(Integer stationId, int integral, String openId){
+    public void pushIntegral(CalculateIntegral calculateIntegral){
+        Integer stationId = calculateIntegral.getStationId();
+        int integral = calculateIntegral.getIntegral();
+        String openId = calculateIntegral.getOpenId();
+        String unionId = calculateIntegral.getUnionId();
         String gzhAppId ="";
         String gzhAppSecret ="";
         String stationName = "";        //油站名称
@@ -789,7 +796,8 @@ public class PayOrderController {
             CustomerPoints customerPoints = new CustomerPoints();
             customerPoints.setStationId(stationId);
             customerPoints.setMinaOpenId(openId);
-            CustomerPoints customerPointsInfo = customerPointsService.getCustomerPointsInfoByMinaOpenId(customerPoints);
+            customerPoints.setUnionId(unionId);
+            CustomerPoints customerPointsInfo = customerPointsService.getCustomerPointsInfoByUnionId(customerPoints);
             if(customerPointsInfo !=null){
                 customerName =customerPointsInfo.getCustomerName();
                 surplusIntegral =new BigDecimal(customerPointsInfo.getPoints()).add(new BigDecimal(integral));
@@ -817,8 +825,6 @@ public class PayOrderController {
                     wxMpTemplate.add(new WxMpTemplateData("From", stationName));
                     wxMpTemplate.add(new WxMpTemplateData("remark",
                             "截止至" + new SimpleDateFormat(" yyyy年MM月dd日HH时mm分").format(new Date())+",您在"+stationName+"的可用积分为 "+surplusIntegral.toString()+" 分"));
-                    //String templateId = "G9tN--a3tGM5BN3otqZr73b4ErQCYWISSgyshbTqLYc";  //积分兑换成功通知模板
-                    //wxPushUtil.push(gzhAppId, gzhAppSecret, templateId, blogOpenId, wxMpTemplate);  //oJR5R6r4EJhaORFcPap70r_mtFZo
                     GzhNewsTemplate gzhNewsTemplate = new GzhNewsTemplate();
                     gzhNewsTemplate.setStationId(stationId);
                     gzhNewsTemplate.setTemplateType("1");

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

@@ -17,5 +17,5 @@ public interface CustomerPointsMapper {
     int isExistCustomerPointsInfo(CustomerPoints customerPoints);
 
     //根据小程序用户的openId查询客户积分信息
-    CustomerPoints getCustomerPointsInfoByMinaOpenId(CustomerPoints customerPoints);
+    CustomerPoints getCustomerPointsInfoByUnionId(CustomerPoints customerPoints);
 }

+ 10 - 0
YijiaRestful/src/main/java/com/platform/yijia/pojo/AppUserInfo.java

@@ -113,6 +113,16 @@ public class AppUserInfo {
 
     private String unionId;
 
+    private Integer stationId;
+
+    public Integer getStationId() {
+        return stationId;
+    }
+
+    public void setStationId(Integer stationId) {
+        this.stationId = stationId;
+    }
+
     public String getUnionId() {
         return unionId;
     }

+ 1 - 1
YijiaRestful/src/main/java/com/platform/yijia/service/CustomerPointsService.java

@@ -18,5 +18,5 @@ public interface CustomerPointsService {
     boolean isExistCustomerPointsInfo(CustomerPoints customerPoints);
 
     //根据小程序用户的openId查询客户积分信息
-    CustomerPoints getCustomerPointsInfoByMinaOpenId(CustomerPoints customerPoints);
+    CustomerPoints getCustomerPointsInfoByUnionId(CustomerPoints customerPoints);
 }

+ 5 - 4
YijiaRestful/src/main/java/com/platform/yijia/service/impl/CustomerManagerServiceImpl.java

@@ -1,5 +1,6 @@
 package com.platform.yijia.service.impl;
 
+import com.platform.yijia.dao.CustomerManagerMapper;
 import com.platform.yijia.pojo.CustomerManage;
 import com.platform.yijia.service.CustomerManagerService;
 import org.springframework.stereotype.Service;
@@ -9,23 +10,23 @@ import javax.annotation.Resource;
 @Service("customerManagerService")
 public class CustomerManagerServiceImpl implements CustomerManagerService {
     @Resource
-    private CustomerManagerService customerManagerService;
+    private CustomerManagerMapper customerManagerMapper;
 
     //更新客户信息
     @Override
     public void updateCustomerInfo(CustomerManage customerManage) {
-        customerManagerService.updateCustomerInfo(customerManage);
+        customerManagerMapper.updateCustomerInfo(customerManage);
     }
 
     //插入客户信息
     @Override
     public void insertCustomerInfo(CustomerManage customerManage) {
-        customerManagerService.insertCustomerInfo(customerManage);
+        customerManagerMapper.insertCustomerInfo(customerManage);
     }
 
     //获取客户信息
     @Override
     public CustomerManage getCustomerManageInfo(CustomerManage customerManage) {
-        return customerManagerService.getCustomerManageInfo(customerManage);
+        return customerManagerMapper.getCustomerManageInfo(customerManage);
     }
 }

+ 2 - 2
YijiaRestful/src/main/java/com/platform/yijia/service/impl/CustomerPointsServiceImpl.java

@@ -13,8 +13,8 @@ public class CustomerPointsServiceImpl implements CustomerPointsService {
 
     //根据小程序用户的openId查询客户积分信息
     @Override
-    public CustomerPoints getCustomerPointsInfoByMinaOpenId(CustomerPoints customerPoints) {
-        return customerPointsMapper.getCustomerPointsInfoByMinaOpenId(customerPoints);
+    public CustomerPoints getCustomerPointsInfoByUnionId(CustomerPoints customerPoints) {
+        return customerPointsMapper.getCustomerPointsInfoByUnionId(customerPoints);
     }
 
     //获取用户积分信息

+ 13 - 3
YijiaRestful/src/main/resources/mapper/AppUserInfoMapper.xml

@@ -15,6 +15,7 @@
     <result column="blog_profile_photo" jdbcType="VARCHAR" property="blogProfilePhoto" />
     <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
     <result column="union_id" jdbcType="VARCHAR" property="unionId" />
+    <result column="station_id" jdbcType="INTEGER" property="stationId" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <!--
@@ -88,7 +89,7 @@
       This element is automatically generated by MyBatis Generator, do not modify.
     -->
     user_id, user_type, blog_openid, mina_openid, mobile_phone, blog_nick_name, sex_flag,
-    registe_date, blog_token, mina_token, blog_profile_photo, update_date, union_id
+    registe_date, blog_token, mina_token, blog_profile_photo, update_date, union_id, station_id
   </sql>
 
   <!-- 判断注册账户是否已存在-->
@@ -107,6 +108,9 @@
       <if test="userType !=null and userType ==2 ">
         AND mina_openid = #{openId}
       </if>
+      <if test="stationId !=null and stationId !=''">
+        AND station_id = #{stationId}
+      </if>
     </where>
   </select>
 
@@ -165,13 +169,13 @@
     insert into app_user_info (user_id, user_type, blog_openid,
       mina_openid, mobile_phone, blog_nick_name,
       sex_flag, registe_date, blog_token,
-      mina_token, blog_profile_photo, update_date, union_id
+      mina_token, blog_profile_photo, update_date, union_id,station_id
       )
     values (#{userId,jdbcType=INTEGER}, #{userType,jdbcType=VARCHAR}, #{blogOpenid,jdbcType=VARCHAR},
       #{minaOpenid,jdbcType=VARCHAR}, #{mobilePhone,jdbcType=VARCHAR}, #{blogNickName,jdbcType=VARCHAR},
       #{sexFlag,jdbcType=VARCHAR}, #{registeDate,jdbcType=TIMESTAMP}, #{blogToken,jdbcType=VARCHAR},
       #{minaToken,jdbcType=VARCHAR}, #{blogProfilePhoto,jdbcType=VARCHAR}, #{updateDate,jdbcType=TIMESTAMP},
-      #{unionId,jdbcType=VARCHAR}
+      #{unionId,jdbcType=VARCHAR},#{stationId,jdbcType=INTEGER}
       )
   </insert>
   <insert id="insertSelective" parameterType="com.platform.yijia.pojo.AppUserInfo">
@@ -484,6 +488,9 @@
       <if test="minaOpenid !=null and minaOpenid !=''">
         AND mina_openid = #{minaOpenid}
       </if>
+      <if test="stationId !=null and stationId !=''">
+        AND station_id = #{stationId}
+      </if>
     </where>
   </update>
 
@@ -500,6 +507,9 @@
       <if test="unionId !=null and unionId !=''">
         AND union_id = #{unionId}
       </if>
+      <if test="stationId !=null and stationId !=''">
+        AND station_id = #{stationId}
+      </if>
     </where>
 
   </select>

+ 1 - 1
YijiaRestful/src/main/resources/mapper/CustomerManagerMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.platform.yijia.dao.CustomerManageMapper">
+<mapper namespace="com.platform.yijia.dao.CustomerManagerMapper">
   <!--客户信息返回结果-->
   <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.CustomerManage">
       <id     column="id"                       jdbcType="INTEGER"      property="id" />

+ 1 - 1
YijiaRestful/src/main/resources/mapper/CustomerPointsMapper.xml

@@ -41,7 +41,7 @@
   </select>
 
   <!--根据小程序用户的openId查询客户积分信息-->
-  <select id="getCustomerPointsInfoByMinaOpenId" resultMap="BaseResultMap" parameterType="com.platform.yijia.pojo.CustomerPoints">
+  <select id="getCustomerPointsInfoByUnionId" resultMap="BaseResultMap" parameterType="com.platform.yijia.pojo.CustomerPoints">
     SELECT
     <include refid="Base_Column_List" />
     FROM customer_points

+ 5 - 2
YijiaRestful/src/main/resources/mapper/ElectronicMembershipCardMapper.xml

@@ -560,8 +560,11 @@
             <if test="stationId !='' and stationId != null" >
                 station_id = #{stationId}
             </if>
-            <if test="minaOpenid !='' and minaOpenid != null" >
-                AND mina_openid = #{minaOpenid}
+<!--            <if test="minaOpenid !='' and minaOpenid != null" >-->
+<!--                AND mina_openid = #{minaOpenid}-->
+<!--            </if>-->
+            <if test="unionId !='' and unionId != null" >
+                AND union_id = #{unionId}
             </if>
             <if test="cardOilsType !='' and cardOilsType != null" >
                 AND card_oils_type = #{cardOilsType}

+ 5 - 1
YijiaRestful/src/main/resources/mapper/PayOrderMapper.xml

@@ -854,13 +854,17 @@
         registe_date     AS registeDate,
         mobile_phone     AS mobilePhone,
         user_type 	     AS userType,
-        union_id 	     AS unionId
+        union_id 	     AS unionId,
+        station_id       AS stationId
     FROM
         app_user_info
     <where>
         <if test="mobilePhone !=null and mobilePhone !='' ">
           mobile_phone = #{mobilePhone}
         </if>
+        <if test="stationId !=null and stationId !='' ">
+          station_id = #{stationId}
+        </if>
     </where>
   </select>