소스 검색

修改 :原来用户添加unionId操作

jk-GitHub-coder 4 년 전
부모
커밋
135b075d38

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

@@ -198,6 +198,9 @@ public class AppUserInfoController {
 //                if(!boo){
 //                    customerPointsService.insertCustomerPointsInfo(customerPoints);
 //                }
+//                if(appUserInfoService.getUserUnionId(appUserInfo)==null){
+//                    appUserInfoService.updateUnionId(appUserInfo);
+//                }
                 resultData = ResultData.error(CodeMsg.USER_EXSIST);
             }else {
                 appUserInfoService.AddAppUserInfo(appUserInfo);

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

@@ -715,7 +715,7 @@ public class PayController {
                                                     if(datePicker !=null){
                                                         for(String str: datePicker){
                                                             if (str.contains(currentTime) && rule.get(0).getIntegralProportion() != null){
-                                                                integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
+                                                                integral=integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
                                                                 break;
                                                             }
                                                         }
@@ -738,7 +738,7 @@ public class PayController {
                                                     if(datePicker !=null){
                                                         for(String str: datePicker){
                                                             if (str.contains(currentTime) && rule.get(0).getIntegralProportion() != null){
-                                                                integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
+                                                                integral=integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
                                                                 break;
                                                             }
                                                         }
@@ -760,7 +760,7 @@ public class PayController {
                                                     if(datePicker !=null){
                                                         for(String str: datePicker){
                                                             if (str.contains(currentTime) && rule.get(0).getIntegralProportion() !=null ){
-                                                                integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
+                                                                integral=integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
                                                                 break;
                                                             }
                                                         }

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

@@ -102,4 +102,10 @@ public interface AppUserInfoMapper {
      * @mbg.generated
      */
     int updateByPrimaryKey(AppUserInfo record);
-}
+
+    //更新unionID
+    void updateUnionId(AppUserInfo appUserInfo);
+
+    //查询客户UnionId
+    String getUserUnionId(AppUserInfo appUserInfo);
+}

+ 6 - 0
YijiaRestful/src/main/java/com/platform/yijia/service/AppUserInfoService.java

@@ -18,4 +18,10 @@ public interface AppUserInfoService {
 
     //验证身份
     boolean selectAppUserInfo(String token, String userType);
+
+    //更新unionID
+    void updateUnionId(AppUserInfo appUserInfo);
+
+    //查询客户UnionId
+    String getUserUnionId(AppUserInfo appUserInfo);
 }

+ 11 - 0
YijiaRestful/src/main/java/com/platform/yijia/service/impl/AppUserInfoServiceImpl.java

@@ -71,4 +71,15 @@ public class AppUserInfoServiceImpl implements AppUserInfoService {
         }
         return flag;
     }
+
+    //更新unionID
+    @Override
+    public void updateUnionId(AppUserInfo appUserInfo) {
+        appUserInfoMapper.updateUnionId(appUserInfo);
+    }
+
+    @Override
+    public String getUserUnionId(AppUserInfo appUserInfo) {
+        return appUserInfoMapper.getUserUnionId(appUserInfo);
+    }
 }

+ 42 - 0
YijiaRestful/src/main/resources/mapper/AppUserInfoMapper.xml

@@ -417,4 +417,46 @@
       union_id = #{unionId,jdbcType=VARCHAR}
     where user_id = #{userId,jdbcType=INTEGER}
   </update>
+
+
+  <!--查询客户unionId-->
+  <select id="getUserUnionId" parameterType="com.platform.yijia.pojo.AppUserInfo" resultType="String">
+    SELECT
+        unionId
+    from app_user_info
+    <where>
+      <if test="userType !=null and userType !=''">
+        user_type = #{userType}
+      </if>
+      <if test="userType !=null and userType ==1 ">
+        AND blog_openid = #{openId}
+      </if>
+      <if test="userType !=null and userType ==2 ">
+        AND mina_openid = #{openId}
+      </if>
+    </where>
+  </select>
+
+  <!--更新UnionId-->
+  <update id="updateUnionId" parameterType="com.platform.yijia.pojo.AppUserInfo">
+    UPDATE app_user_info
+    <set>
+      <if test="unionId !=null">
+        union_id = #{unionId}
+      </if>
+    </set>
+    <where>
+      <if test="userType !=null and userType !=''">
+        user_type = #{userType}
+      </if>
+      <if test="userType !=null and userType ==1 ">
+        AND blog_openid = #{openId}
+      </if>
+      <if test="userType !=null and userType ==2 ">
+        AND mina_openid = #{openId}
+      </if>
+    </where>
+  </update>
+
+
 </mapper>