Jelajahi Sumber

修改优化

jk-GitHub-coder 4 tahun lalu
induk
melakukan
2a1cdf3be0

+ 12 - 9
YijiaRestful/src/main/java/com/platform/yijia/controller/AppUserInfoController.java

@@ -183,17 +183,17 @@ public class AppUserInfoController {
             String openId = "";     //此参数用于查询该用户是否已注册过
             if(request.getUserType()!=null){
                 //1-微信公众号
-                if(request.getUserType().equals("1") &&StringUtils.isNotBlank(request.getBlogOpenid())){
+                if(request.getUserType().equals("1") &&StringUtils.isNotBlank(request.getOpenId())){
                     appUserInfo.setUserType(request.getUserType());
                     appUserInfo.setBlogToken(request.getBlogToken());
-                    openId = request.getBlogOpenid();
+                    openId = request.getOpenId();
                     appUserInfo.setBlogOpenid(openId);
                     customerPoints.setBlogOpenId(openId);
                  //2-微信小程序
-                }else if(request.getUserType().equals("2") &&StringUtils.isNotBlank(request.getMinaOpenid())){
+                }else if(request.getUserType().equals("2") &&StringUtils.isNotBlank(request.getOpenId())){
                     appUserInfo.setUserType(request.getUserType());
                     appUserInfo.setMinaToken(request.getMinaToken());
-                    openId = request.getMinaOpenid();
+                    openId = request.getOpenId();
                     appUserInfo.setMinaOpenid(openId);
                     customerPoints.setMinaOpenId(openId);
                 }
@@ -264,11 +264,14 @@ public class AppUserInfoController {
             //此处用于:如果客户积分信息存在可能会出现小程序ID或者公众号ID没有的情况
             CustomerPoints c = new CustomerPoints();
             c.setUnionId(customerPoints.getUnionId());
-            c.setMinaOpenId(customerPoints.getMinaOpenId());
-            c.setBlogOpenId(customerPoints.getBlogOpenId());
-//            c.setStationId(request.getStationId());
-//            c.setStationName(request.getStationName());
-//            c.setMobilePhone(request.getMobilePhone());
+            if(request.getUserType().equals("1")){
+                c.setBlogOpenId(customerPoints.getBlogOpenId());
+            }else if(request.getUserType().equals("2")){
+                c.setMinaOpenId(customerPoints.getMinaOpenId());
+            }
+            c.setStationId(request.getStationId());
+            c.setStationName(request.getStationName());
+            c.setMobilePhone(request.getMobilePhone());
             customerPointsService.updateCustomerPointsInfo(c);
         }
     }

+ 3 - 0
YijiaRestful/src/main/java/com/platform/yijia/controller/PayController.java

@@ -563,6 +563,9 @@ public class PayController {
                             if(appUserInfoList != null && appUserInfoList.size() >0){
                                 for(AppUserInfo u : appUserInfoList){
                                     //向客户表插入小程序和公众号的openId 用户表ID 用户手机号 注册时间
+                                    if(u.getUnionId() !=null && u.getUnionId() !=""){
+                                        customerManage.setUnionId(u.getUnionId());
+                                    }
                                     switch (u.getUserType()){
                                         case "1":
                                             customerManage.setBlogOpenid(u.getBlogOpenid());

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

@@ -37,10 +37,10 @@ public class PayOrderController {
         appUserInfo.setUserType(payOrderRequest.getUserType());
         if(payOrderRequest.getUserType().equals("1")){
             //1 是公众号
-            appUserInfo.setBlogOpenid(payOrderRequest.getToken());
+            appUserInfo.setBlogOpenid(payOrderRequest.getOpenId());
         }else if(payOrderRequest.getUserType().equals("2")){
             //2是小程序
-            appUserInfo.setMinaOpenid(payOrderRequest.getToken());
+            appUserInfo.setMinaOpenid(payOrderRequest.getOpenId());
         }
         List<AppUserInfo> appUserInfoList =appUserInfoService.Authentication(appUserInfo);
         //判断登录人员是否验证成功

+ 1 - 0
YijiaRestful/src/main/java/com/platform/yijia/param/request/AppUserInfoRequest.java

@@ -11,6 +11,7 @@ import lombok.Data;
 @Data
 public class AppUserInfoRequest {
     private String userType;        //注册类型:1-微信公众号;2-微信小程序
+    private String openId;          //用户openId
     private String blogOpenid;      //公众号的openid
     private String minaOpenid;      //小程序的openid
     private String mobilePhone;     //注册者手机号码

+ 1 - 0
YijiaRestful/src/main/java/com/platform/yijia/param/request/PayOrderRequest.java

@@ -9,6 +9,7 @@ public class PayOrderRequest {
     private String oilGun;
     private String oilName;
     private String token;
+    private String openId;
     private String amt;     //实收金额
     private Integer stationId;
     private String status;

+ 2 - 2
YijiaRestful/src/main/java/com/platform/yijia/utils/CodeMsg.java

@@ -23,8 +23,8 @@ public class CodeMsg {
 
     public static CodeMsg CHECK_DATA = new CodeMsg(007,"与后台检验不一致,请联系……");
     public static CodeMsg PARAMS_NUll = new CodeMsg(010,"请求失败,参数缺失");
-    public static CodeMsg WARSECOUNT_FAIL = new CodeMsg(011,"暂无库存");
-    public static CodeMsg INTEGRAL_INSUFFICIENT = new CodeMsg(012,"您的积分不足");
+    public static CodeMsg WARSECOUNT_FAIL = new CodeMsg(010,"暂无库存");
+    public static CodeMsg INTEGRAL_INSUFFICIENT = new CodeMsg(010,"您的积分不足");
     private CodeMsg(int retCode, String message) {
         this.retCode = retCode;
         this.message = message;

+ 3 - 3
YijiaRestful/src/main/java/com/platform/yijia/utils/weixinapp/WeiXinUserUtil.java

@@ -68,13 +68,13 @@ public class WeiXinUserUtil {
         JSONObject jsonObject = HttpRequestUtil.getHttpsRequestData(requestUrl, "GET", null);
         logger.info("用户openid和session_key:" + jsonObject.toString());
         if(jsonObject != null && jsonObject.containsKey("openid")){
-            resultMap.put("openid", jsonObject.getString("openid"));
+            resultMap.put("openId", jsonObject.getString("openid"));
         }
         if(jsonObject != null && jsonObject.containsKey("session_key")){
-            resultMap.put("session_key", jsonObject.getString("session_key"));
+            resultMap.put("sessionKey", jsonObject.getString("session_key"));
         }
         if(jsonObject != null && jsonObject.containsKey("unionid")){
-            resultMap.put("unionid", jsonObject.getString("unionid"));
+            resultMap.put("unionId", jsonObject.getString("unionid"));
         }
         return resultMap;
     }

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

@@ -166,7 +166,7 @@
         station_name =#{stationName},
       </if>
       <if test="createTime !=null">
-        create_time =#{createTime}
+        create_time =#{createTime},
       </if>
     </set>
     <where>

+ 11 - 2
YijiaRestful/src/main/resources/mapper/PayOrderMapper.xml

@@ -888,6 +888,9 @@
       <if test="amt !=null ">
         amt = #{amt},
       </if>
+      <if test="unionId !=null and unionId !=null">
+        union_id = #{unionId},
+      </if>
     </set>
     <where>
       <if test="phoneNumber !=null and phoneNumber !='' ">
@@ -1016,7 +1019,10 @@
             mina_user_id,
           </if>
           <if test="grade !=null ">
-            grade
+            grade,
+          </if>
+          <if test="unionId !=null and unionId !=''">
+            union_id
           </if>
 
         </trim>
@@ -1090,7 +1096,10 @@
             #{minaUserId, jdbcType=INTEGER},
           </if>
           <if test="grade !=null ">
-            #{grade, jdbcType=VARCHAR}
+            #{grade, jdbcType=VARCHAR},
+          </if>
+          <if test="unionId !=null and unionId !=''">
+            #{unionId, jdbcType=VARCHAR}
           </if>
         </trim>
   </insert>