Переглянути джерело

优化 微信 公众号 小程序 app 统一登录问题

java110 5 роки тому
батько
коміт
3a7c034bd8

+ 16 - 0
java110-bean/src/main/java/com/java110/dto/owner/OwnerAppUserDto.java

@@ -15,6 +15,13 @@ import java.util.Date;
  **/
  **/
 public class OwnerAppUserDto extends PageDto implements Serializable {
 public class OwnerAppUserDto extends PageDto implements Serializable {
 
 
+    public static final String APP_TYPE_APP = "APP";//app绑定业主
+    public static final String APP_TYPE_WECHAT_MINA = "WECHAT_MINA";//小程序绑定业主
+    public static final String APP_TYPE_WECHAT = "WECHAT";//公众号绑定业主
+    public static final String STATE_AUDITING = "10000";// 审核中
+    public static final String STATE_AUDIT_SUCCESS = "12000";//审核成功
+    public static final String STATE_AUDIT_ERROR = "13000";//审核失败
+
     private String idCard;
     private String idCard;
     private String openId;
     private String openId;
     private String link;
     private String link;
@@ -28,6 +35,7 @@ public class OwnerAppUserDto extends PageDto implements Serializable {
     private String appTypeCd;
     private String appTypeCd;
     private String memberId;
     private String memberId;
     private String userId;
     private String userId;
+    private String appType;
     private String[] userIds;
     private String[] userIds;
 
 
 
 
@@ -175,4 +183,12 @@ public class OwnerAppUserDto extends PageDto implements Serializable {
     public void setUserIds(String[] userIds) {
     public void setUserIds(String[] userIds) {
         this.userIds = userIds;
         this.userIds = userIds;
     }
     }
+
+    public String getAppType() {
+        return appType;
+    }
+
+    public void setAppType(String appType) {
+        this.appType = appType;
+    }
 }
 }

+ 9 - 0
java110-bean/src/main/java/com/java110/po/owner/OwnerAppUserPo.java

@@ -21,6 +21,7 @@ public class OwnerAppUserPo implements Serializable {
     private String link;
     private String link;
     private String openId;
     private String openId;
     private String appTypeCd;
     private String appTypeCd;
+    private String appType;
     private String state;
     private String state;
     private String remark;
     private String remark;
     private String userId;
     private String userId;
@@ -120,4 +121,12 @@ public class OwnerAppUserPo implements Serializable {
     public void setUserId(String userId) {
     public void setUserId(String userId) {
         this.userId = userId;
         this.userId = userId;
     }
     }
+
+    public String getAppType() {
+        return appType;
+    }
+
+    public void setAppType(String appType) {
+        this.appType = appType;
+    }
 }
 }

+ 35 - 5
java110-bean/src/main/java/com/java110/vo/ResultVo.java

@@ -1,6 +1,7 @@
 package com.java110.vo;
 package com.java110.vo;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.http.ResponseEntity;
 
 
@@ -25,6 +26,7 @@ public class ResultVo implements Serializable {
     public static final int CODE_MACHINE_ERROR = -1; // 未知异常
     public static final int CODE_MACHINE_ERROR = -1; // 未知异常
 
 
     public static final int CODE_UNAUTHORIZED = 401; //认证失败
     public static final int CODE_UNAUTHORIZED = 401; //认证失败
+    public static final int CODE_WECHAT_UNAUTHORIZED = 1401; //认证失败
 
 
     public static final int ORDER_ERROR = 500; //订单调度异常
     public static final int ORDER_ERROR = 500; //订单调度异常
 
 
@@ -154,9 +156,10 @@ public class ResultVo implements Serializable {
 
 
     /**
     /**
      * 创建ResponseEntity对象
      * 创建ResponseEntity对象
+     *
      * @param records 页数
      * @param records 页数
-     * @param total 总记录数
-     * @param data 数据对象
+     * @param total   总记录数
+     * @param data    数据对象
      * @return
      * @return
      */
      */
     public static ResponseEntity<String> createResponseEntity(int records, int total, Object data) {
     public static ResponseEntity<String> createResponseEntity(int records, int total, Object data) {
@@ -165,15 +168,42 @@ public class ResultVo implements Serializable {
         return responseEntity;
         return responseEntity;
     }
     }
 
 
+    /**
+     * 页面跳转
+     * @param url
+     * @return
+     */
+    public static ResponseEntity<String> redirectPage(String url) {
+        HttpHeaders headers = new HttpHeaders();
+        headers.add(HttpHeaders.LOCATION, url);
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>("", headers, HttpStatus.FOUND);
+        return responseEntity;
+    }
+
     /**
     /**
      * 创建ResponseEntity对象
      * 创建ResponseEntity对象
-     * @param records 页数
-     * @param total 总记录数
+     *
      * @param code 状态嘛
      * @param code 状态嘛
-     * @param msg 返回信息
+     * @param msg  返回信息
      * @param data 数据对象
      * @param data 数据对象
      * @return
      * @return
      */
      */
+    public static ResponseEntity<String> createResponseEntity(int code, String msg, Object data) {
+        ResultVo resultVo = new ResultVo(code, msg, data);
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+        return responseEntity;
+    }
+
+    /**
+     * 创建ResponseEntity对象
+     *
+     * @param records 页数
+     * @param total   总记录数
+     * @param code    状态嘛
+     * @param msg     返回信息
+     * @param data    数据对象
+     * @return
+     */
     public static ResponseEntity<String> createResponseEntity(int records, int total, int code, String msg, Object data) {
     public static ResponseEntity<String> createResponseEntity(int records, int total, int code, String msg, Object data) {
         ResultVo resultVo = new ResultVo(records, total, code, msg, data);
         ResultVo resultVo = new ResultVo(records, total, code, msg, data);
         ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
         ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);

+ 21 - 6
java110-db/src/main/resources/mapper/user/OwnerAppUserServiceDaoImplMapper.xml

@@ -7,9 +7,10 @@
     <!-- 保存绑定业主信息 add by wuxw 2018-07-03 -->
     <!-- 保存绑定业主信息 add by wuxw 2018-07-03 -->
     <insert id="saveBusinessOwnerAppUserInfo" parameterType="Map">
     <insert id="saveBusinessOwnerAppUserInfo" parameterType="Map">
         insert into business_owner_app_user(
         insert into business_owner_app_user(
-        id_card,open_id,link,remark,operate,app_user_name,community_name,state,app_user_id,community_id,app_type_cd,b_id,member_id,user_id
+        id_card,open_id,link,remark,operate,app_user_name,community_name,state,app_user_id,community_id,app_type_cd,b_id,member_id,user_id,app_type
         ) values (
         ) values (
-        #{idCard},#{openId},#{link},#{remark},#{operate},#{appUserName},#{communityName},#{state},#{appUserId},#{communityId},#{appTypeCd},#{bId},#{memberId},#{userId}
+        #{idCard},#{openId},#{link},#{remark},#{operate},#{appUserName},#{communityName},#{state},#{appUserId},#{communityId},
+        #{appTypeCd},#{bId},#{memberId},#{userId},#{appType}
         )
         )
     </insert>
     </insert>
 
 
@@ -19,7 +20,8 @@
         select t.id_card,t.id_card idCard,t.open_id,t.open_id
         select t.id_card,t.id_card idCard,t.open_id,t.open_id
         openId,t.link,t.remark,t.operate,t.app_user_name,t.app_user_name appUserName,t.community_name,t.community_name
         openId,t.link,t.remark,t.operate,t.app_user_name,t.app_user_name appUserName,t.community_name,t.community_name
         communityName,t.state,t.app_user_id,t.app_user_id appUserId,t.community_id,t.community_id
         communityName,t.state,t.app_user_id,t.app_user_id appUserId,t.community_id,t.community_id
-        communityId,t.app_type_cd,t.app_type_cd appTypeCd,t.b_id,t.b_id bId,t.member_id,t.member_id memberId,t.user_id,t.user_id userId
+        communityId,t.app_type_cd,t.app_type_cd appTypeCd,t.b_id,t.b_id bId,t.member_id,t.member_id memberId,t.user_id,
+        t.user_id userId,t.app_type,t.app_type appType
         from business_owner_app_user t
         from business_owner_app_user t
         where 1 =1
         where 1 =1
         <if test="idCard !=null and idCard != ''">
         <if test="idCard !=null and idCard != ''">
@@ -71,9 +73,11 @@
     <!-- 保存绑定业主信息至 instance表中 add by wuxw 2018-07-03 -->
     <!-- 保存绑定业主信息至 instance表中 add by wuxw 2018-07-03 -->
     <insert id="saveOwnerAppUserInfoInstance" parameterType="Map">
     <insert id="saveOwnerAppUserInfoInstance" parameterType="Map">
         insert into owner_app_user(
         insert into owner_app_user(
-        id_card,open_id,link,remark,status_cd,app_user_name,community_name,state,app_user_id,community_id,app_type_cd,b_id,member_id,user_id
+        id_card,open_id,link,remark,status_cd,app_user_name,community_name,state,app_user_id,community_id,app_type_cd,b_id,member_id,user_id,
+        app_type
         ) select
         ) select
-        t.id_card,t.open_id,t.link,t.remark,'0',t.app_user_name,t.community_name,t.state,t.app_user_id,t.community_id,t.app_type_cd,t.b_id,t.member_id,t.user_id
+        t.id_card,t.open_id,t.link,t.remark,'0',t.app_user_name,t.community_name,t.state,t.app_user_id,t.community_id,t.app_type_cd,t.b_id,
+        t.member_id,t.user_id,t.app_type
         from business_owner_app_user t where 1=1
         from business_owner_app_user t where 1=1
         <if test="idCard !=null and idCard != ''">
         <if test="idCard !=null and idCard != ''">
             and t.id_card= #{idCard}
             and t.id_card= #{idCard}
@@ -124,7 +128,8 @@
         select t.id_card,t.id_card idCard,t.open_id,t.open_id openId,t.link,t.remark,t.status_cd,t.status_cd
         select t.id_card,t.id_card idCard,t.open_id,t.open_id openId,t.link,t.remark,t.status_cd,t.status_cd
         statusCd,t.app_user_name,t.app_user_name appUserName,t.community_name,t.community_name
         statusCd,t.app_user_name,t.app_user_name appUserName,t.community_name,t.community_name
         communityName,t.state,t.app_user_id,t.app_user_id appUserId,t.community_id,t.community_id
         communityName,t.state,t.app_user_id,t.app_user_id appUserId,t.community_id,t.community_id
-        communityId,t.app_type_cd,t.app_type_cd appTypeCd,t.b_id,t.b_id bId,t.member_id,t.member_id memberId,td1.name stateName,t.user_id,t.user_id userId
+        communityId,t.app_type_cd,t.app_type_cd appTypeCd,t.b_id,t.b_id bId,t.member_id,t.member_id memberId,
+        td1.name stateName,t.user_id,t.user_id userId,t.app_type,t.app_type appType
         from owner_app_user t,t_dict td1
         from owner_app_user t,t_dict td1
         where 1 =1
         where 1 =1
         and t.state = td1.status_cd
         and t.state = td1.status_cd
@@ -179,6 +184,9 @@
         <if test="userId !=null and userId != ''">
         <if test="userId !=null and userId != ''">
             and t.user_id = #{userId}
             and t.user_id = #{userId}
         </if>
         </if>
+        <if test="appType !=null and appType != ''">
+            and t.app_type = #{appType}
+        </if>
         <if test="userIds !=null">
         <if test="userIds !=null">
             and t.user_id in
             and t.user_id in
             <foreach collection="userIds" open="(" close=")"
             <foreach collection="userIds" open="(" close=")"
@@ -186,6 +194,7 @@
                 #{item}
                 #{item}
             </foreach>
             </foreach>
         </if>
         </if>
+        order by t.create_time desc
         <if test="page != -1 and page != null ">
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
             limit #{page}, #{row}
         </if>
         </if>
@@ -232,6 +241,9 @@
         <if test="userId !=null and userId != ''">
         <if test="userId !=null and userId != ''">
             , t.user_id= #{userId}
             , t.user_id= #{userId}
         </if>
         </if>
+        <if test="appType !=null and appType != ''">
+            , t.app_type = #{appType}
+        </if>
         where 1=1
         where 1=1
         <if test="appUserId !=null and appUserId != ''">
         <if test="appUserId !=null and appUserId != ''">
             and t.app_user_id= #{appUserId}
             and t.app_user_id= #{appUserId}
@@ -293,6 +305,9 @@
         <if test="userId !=null and userId != ''">
         <if test="userId !=null and userId != ''">
             and t.user_id= #{userId}
             and t.user_id= #{userId}
         </if>
         </if>
+        <if test="appType !=null and appType != ''">
+            and t.app_type = #{appType}
+        </if>
         <if test="userIds !=null">
         <if test="userIds !=null">
             and t.user_id in
             and t.user_id in
             <foreach collection="userIds" open="(" close=")"
             <foreach collection="userIds" open="(" close=")"

+ 41 - 17
java110-utils/src/main/java/com/java110/utils/cache/CommonCache.java

@@ -5,38 +5,60 @@ import redis.clients.jedis.Jedis;
 /**
 /**
  * Created by wuxw on 2018/5/5.
  * Created by wuxw on 2018/5/5.
  */
  */
-public class CommonCache extends BaseCache{
+public class CommonCache extends BaseCache {
 
 
-    public final static int defaultExpireTime = 5*60;
+    public final static int defaultExpireTime = 5 * 60;
 
 
     /**
     /**
      * 获取值(用户ID)
      * 获取值(用户ID)
+     *
      * @returne
      * @returne
      */
      */
-    public static String getValue(String key){
+    public static String getValue(String key) {
         Jedis redis = null;
         Jedis redis = null;
         try {
         try {
             redis = getJedis();
             redis = getJedis();
             return redis.get(key);
             return redis.get(key);
-        }finally {
-            if(redis != null){
+        } finally {
+            if (redis != null) {
                 redis.close();
                 redis.close();
             }
             }
         }
         }
     }
     }
 
 
+    /**
+     * 获取值(用户ID)
+     *
+     * @returne
+     */
+    public static String getAndRemoveValue(String key) {
+        Jedis redis = null;
+        String value = "";
+        try {
+            redis = getJedis();
+            value = redis.get(key);
+            removeValue(key);
+        } finally {
+            if (redis != null) {
+                redis.close();
+            }
+        }
+        return value;
+    }
+
     /**
     /**
      * 保存数据
      * 保存数据
+     *
      * @param key
      * @param key
      */
      */
-    public static void setValue(String key,String value,int expireTime){
+    public static void setValue(String key, String value, int expireTime) {
         Jedis redis = null;
         Jedis redis = null;
         try {
         try {
             redis = getJedis();
             redis = getJedis();
-            redis.set(key,value);
-            redis.expire(key,expireTime);
-        }finally {
-            if(redis != null){
+            redis.set(key, value);
+            redis.expire(key, expireTime);
+        } finally {
+            if (redis != null) {
                 redis.close();
                 redis.close();
             }
             }
         }
         }
@@ -45,15 +67,16 @@ public class CommonCache extends BaseCache{
 
 
     /**
     /**
      * 删除记录
      * 删除记录
+     *
      * @param key
      * @param key
      */
      */
-    public static void removeValue(String key){
+    public static void removeValue(String key) {
         Jedis redis = null;
         Jedis redis = null;
         try {
         try {
             redis = getJedis();
             redis = getJedis();
             redis.del(key);
             redis.del(key);
-        }finally {
-            if(redis != null){
+        } finally {
+            if (redis != null) {
                 redis.close();
                 redis.close();
             }
             }
         }
         }
@@ -61,17 +84,18 @@ public class CommonCache extends BaseCache{
 
 
     /**
     /**
      * 重设超时间
      * 重设超时间
+     *
      * @param jdi
      * @param jdi
      * @param expireTime
      * @param expireTime
      */
      */
-    public static void resetExpireTime(String jdi,int expireTime){
+    public static void resetExpireTime(String jdi, int expireTime) {
 
 
         Jedis redis = null;
         Jedis redis = null;
         try {
         try {
             redis = getJedis();
             redis = getJedis();
-            redis.expire(jdi,expireTime);
-        }finally {
-            if(redis != null){
+            redis.expire(jdi, expireTime);
+        } finally {
+            if (redis != null) {
                 redis.close();
                 redis.close();
             }
             }
         }
         }

+ 3 - 0
java110-utils/src/main/java/com/java110/utils/constant/ServiceCodeConstant.java

@@ -480,6 +480,9 @@ public class ServiceCodeConstant {
      */
      */
     public static final String UPDATE_APPUSERBINDINGOWNER = "owner.updateAppUserBindingOwner";
     public static final String UPDATE_APPUSERBINDINGOWNER = "owner.updateAppUserBindingOwner";
     public static final String DELETE_APPUSERBINDINGOWNER = "owner.deleteAppUserBindingOwner";
     public static final String DELETE_APPUSERBINDINGOWNER = "owner.deleteAppUserBindingOwner";
+    public static final String REFRESH_APP_USER_BINDING_OWNER_TOKEN = "owner.refreshAppUserBindingOwnerToken";
+
+
 
 
 
 
     public static final String SERVICE_CODE_APPLICATION_KEY = "owner.applicationKey";
     public static final String SERVICE_CODE_APPLICATION_KEY = "owner.applicationKey";

+ 4 - 0
java110-utils/src/main/java/com/java110/utils/constant/WechatConstant.java

@@ -33,4 +33,8 @@ public class WechatConstant {
 
 
     public static final String GET_ACCESS_TOKEN = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=SECRET";
     public static final String GET_ACCESS_TOKEN = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=SECRET";
 
 
+    public static final String APP_GET_ACCESS_TOKEN_URL = "http://app.java110.com/oauth2Controller/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
+
+    public static final String OPEN_AUTH = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URL&response_type=code&scope=SCOPE&state=STATE#wechat_redirect";
+
 }
 }

+ 98 - 0
service-api/src/main/java/com/java110/api/listener/owner/RefreshAppUserBindingOwnerOpenIdListener.java

@@ -0,0 +1,98 @@
+package com.java110.api.listener.owner;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.owner.IOwnerBMO;
+import com.java110.api.listener.AbstractServiceApiPlusListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.event.service.api.ServiceDataFlowEvent;
+import com.java110.core.smo.user.IOwnerAppUserInnerServiceSMO;
+import com.java110.dto.owner.OwnerAppUserDto;
+import com.java110.po.owner.OwnerAppUserPo;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.ServiceCodeConstant;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+
+import java.util.List;
+
+/**
+ * 刷入最新token
+ * add by wuxw 2019-06-30
+ */
+@Java110Listener("refreshAppUserBindingOwnerTokenListener")
+public class RefreshAppUserBindingOwnerOpenIdListener extends AbstractServiceApiPlusListener {
+
+    @Autowired
+    private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMOImpl;
+
+    @Autowired
+    private IOwnerBMO ownerBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+
+        Assert.hasKeyAndValue(reqJson, "appUserId", "绑定ID不能为空");
+        Assert.hasKeyAndValue(reqJson, "openId", "必填,请填写状态");
+        Assert.hasKeyAndValue(reqJson, "communityId", "必填,请填写小区ID");
+        if (reqJson.getString("appUserId").startsWith("-")) {
+            Assert.hasKeyAndValue(reqJson, "oldAppUserId", "必填,请填写老绑定ID");
+            Assert.hasKeyAndValue(reqJson, "appType", "必填,请填写appType");
+        }
+
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+        //ownerBMOImpl.updateAuditAppUserBindingOwner(reqJson, context);
+
+        String appUserId = reqJson.getString("appUserId");
+
+        if (appUserId.startsWith("-")) {
+            OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto();
+            ownerAppUserDto.setAppUserId(reqJson.getString("oldAppUserId"));
+            ownerAppUserDto.setCommunityId(reqJson.getString("communityId"));
+            List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto);
+
+            Assert.listOnlyOne(ownerAppUserDtos, "传入oldAppUserId错误");
+            OwnerAppUserPo ownerAppUserPo = BeanConvertUtil.covertBean(ownerAppUserDtos.get(0), OwnerAppUserPo.class);
+            ownerAppUserPo.setAppUserId("-1");
+            ownerAppUserPo.setAppType(reqJson.getString("appType"));
+            ownerAppUserPo.setOpenId(reqJson.getString("openId"));
+            super.insert(context, ownerAppUserPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_OWNER_APP_USER);
+
+            return;
+        }
+
+        OwnerAppUserPo ownerAppUserPo = new OwnerAppUserPo();
+        ownerAppUserPo.setAppUserId(appUserId);
+        ownerAppUserPo.setCommunityId(reqJson.getString("communityId"));
+        ownerAppUserPo.setOpenId(reqJson.getString("openId"));
+        super.update(context, ownerAppUserPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_OWNER_APP_USER);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.REFRESH_APP_USER_BINDING_OWNER_TOKEN;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+    public IOwnerAppUserInnerServiceSMO getOwnerAppUserInnerServiceSMOImpl() {
+        return ownerAppUserInnerServiceSMOImpl;
+    }
+
+    public void setOwnerAppUserInnerServiceSMOImpl(IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMOImpl) {
+        this.ownerAppUserInnerServiceSMOImpl = ownerAppUserInnerServiceSMOImpl;
+    }
+}

+ 0 - 3
service-api/src/main/java/com/java110/api/listener/owner/UpdateAppUserBindingOwnerListener.java

@@ -36,9 +36,6 @@ public class UpdateAppUserBindingOwnerListener extends AbstractServiceApiPlusLis
 
 
     @Override
     @Override
     protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
     protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
-
-
-
         ownerBMOImpl.updateAuditAppUserBindingOwner(reqJson, context);
         ownerBMOImpl.updateAuditAppUserBindingOwner(reqJson, context);
 
 
     }
     }

+ 2 - 3
service-front/src/main/java/com/java110/front/controller/OwnerAppLoginController.java

@@ -16,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
-import org.thymeleaf.util.StringUtils;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 
 
@@ -25,8 +24,8 @@ import javax.servlet.http.HttpServletRequest;
  */
  */
 @RestController
 @RestController
 @RequestMapping(path = "/app")
 @RequestMapping(path = "/app")
-public class OwnerAppLoginController extends BaseController {
-    private final static Logger logger = LoggerFactory.getLogger(OwnerAppLoginController.class);
+public class LoginOwnerController extends BaseController {
+    private final static Logger logger = LoggerFactory.getLogger(LoginOwnerController.class);
 
 
     @Autowired
     @Autowired
     private IOwnerAppLoginSMO ownerAppLoginSMOImpl;
     private IOwnerAppLoginSMO ownerAppLoginSMOImpl;

+ 64 - 0
service-front/src/main/java/com/java110/front/controller/LoginOwnerWechatAuthController.java

@@ -0,0 +1,64 @@
+package com.java110.front.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.base.controller.BaseController;
+import com.java110.core.context.IPageData;
+import com.java110.core.context.PageData;
+import com.java110.front.smo.ownerLogin.IOwnerAppLoginSMO;
+import com.java110.utils.constant.CommonConstant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+
+/**
+ * 微信小程序登录处理类
+ */
+@RestController
+@RequestMapping(path = "/app")
+public class LoginOwnerWechatAuthController extends BaseController {
+    private final static Logger logger = LoggerFactory.getLogger(LoginOwnerWechatAuthController.class);
+
+    @Autowired
+    private IOwnerAppLoginSMO ownerAppLoginSMOImpl;
+
+
+    /**
+     * 微信登录接口
+     *
+     * @param request
+     */
+    @RequestMapping(path = "/loginOwnerWechatAuth")
+    public ResponseEntity<String> loginOwnerWechatAuth(HttpServletRequest request) {
+
+        Map<String, String> params = getParameterStringMap(request);
+        String appId = params.get("appId");
+        IPageData pd = PageData.newInstance().builder("", "", "", JSONObject.toJSONString(params),
+                "login", "", "", "", appId
+        );
+        ResponseEntity responseEntity = ownerAppLoginSMOImpl.getPageAccessToken(pd);
+        request.setAttribute(CommonConstant.CONTEXT_PAGE_DATA, pd);
+        return responseEntity;
+    }
+
+    /**
+     * 微信公众号号鉴权
+     *
+     * @param request
+     */
+    @RequestMapping(path = "/refreshToken")
+    public String refreshToken(@RequestParam String redirectUrl,
+                               HttpServletRequest request,
+                               HttpServletResponse response) {
+        return ownerAppLoginSMOImpl.refreshToken(null, redirectUrl, request, response);
+
+    }
+
+}

+ 22 - 0
service-front/src/main/java/com/java110/front/smo/ownerLogin/IOwnerAppLoginSMO.java

@@ -4,6 +4,9 @@ import com.java110.core.context.IPageData;
 import com.java110.utils.exception.SMOException;
 import com.java110.utils.exception.SMOException;
 import org.springframework.http.ResponseEntity;
 import org.springframework.http.ResponseEntity;
 
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 /**
 /**
  * 组织管理管理服务接口类
  * 组织管理管理服务接口类
  * <p>
  * <p>
@@ -19,4 +22,23 @@ public interface IOwnerAppLoginSMO {
      * @throws SMOException 业务代码层
      * @throws SMOException 业务代码层
      */
      */
     ResponseEntity<String> doLogin(IPageData pd) throws SMOException;
     ResponseEntity<String> doLogin(IPageData pd) throws SMOException;
+
+    /**
+     * 获取access_token
+     *
+     * @param pd
+     * @return
+     * @throws SMOException
+     */
+    ResponseEntity<String> getPageAccessToken(IPageData pd) throws SMOException;
+
+
+    /**
+     * 微信刷新token
+     *
+     * @param pd
+     * @return
+     * @throws SMOException
+     */
+    String refreshToken(IPageData pd, String redirectUrl, HttpServletRequest request, HttpServletResponse response) throws SMOException;
 }
 }

+ 240 - 16
service-front/src/main/java/com/java110/front/smo/ownerLogin/impl/OwnerAppLoginSMOImpl.java

@@ -5,13 +5,19 @@ import com.alibaba.fastjson.JSONObject;
 import com.java110.core.context.IPageData;
 import com.java110.core.context.IPageData;
 import com.java110.core.context.PageData;
 import com.java110.core.context.PageData;
 import com.java110.core.factory.AuthenticationFactory;
 import com.java110.core.factory.AuthenticationFactory;
+import com.java110.dto.owner.OwnerAppUserDto;
 import com.java110.front.properties.WechatAuthProperties;
 import com.java110.front.properties.WechatAuthProperties;
 import com.java110.front.smo.AppAbstractComponentSMO;
 import com.java110.front.smo.AppAbstractComponentSMO;
 import com.java110.front.smo.ownerLogin.IOwnerAppLoginSMO;
 import com.java110.front.smo.ownerLogin.IOwnerAppLoginSMO;
+import com.java110.utils.cache.CommonCache;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.constant.ServiceConstant;
 import com.java110.utils.constant.ServiceConstant;
+import com.java110.utils.constant.WechatConstant;
 import com.java110.utils.exception.SMOException;
 import com.java110.utils.exception.SMOException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.StringUtil;
 import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,6 +27,14 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
 import org.springframework.web.client.RestTemplate;
 
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
 /**
 /**
  * wx登录
  * wx登录
  */
  */
@@ -29,6 +43,8 @@ public class OwnerAppLoginSMOImpl extends AppAbstractComponentSMO implements IOw
 
 
     private final static Logger logger = LoggerFactory.getLogger(OwnerAppLoginSMOImpl.class);
     private final static Logger logger = LoggerFactory.getLogger(OwnerAppLoginSMOImpl.class);
 
 
+    private final static int expireTime = 7200;
+
     @Autowired
     @Autowired
     private RestTemplate restTemplate;
     private RestTemplate restTemplate;
 
 
@@ -45,13 +61,117 @@ public class OwnerAppLoginSMOImpl extends AppAbstractComponentSMO implements IOw
     }
     }
 
 
     @Override
     @Override
-    protected void validate(IPageData pd, JSONObject paramIn) {
+    public ResponseEntity<String> getPageAccessToken(IPageData pd) throws SMOException {
+        JSONObject paramIn = JSONObject.parseObject(pd.getReqData());
+        String authCode = paramIn.getString("code");
+        String state = paramIn.getString("state");
+        String urlCode = CommonCache.getAndRemoveValue(paramIn.getString("urlCode"));
+
+        if (StringUtil.isEmpty(urlCode)) {
+            return ResultVo.redirectPage("/#/page/login/login");
+        }
+
+        String url = WechatConstant.APP_GET_ACCESS_TOKEN_URL.replace("APPID", wechatAuthProperties.getWechatAppId())
+                .replace("SECRET", wechatAuthProperties.getWechatAppSecret())
+                .replace("CODE", authCode);
+
+        ResponseEntity<String> paramOut = outRestTemplate.getForEntity(url, String.class);
+
+        logger.debug("调用微信换去token ", paramOut);
+        if (paramOut.getStatusCode() != HttpStatus.OK) {
+            return ResultVo.redirectPage("/#/page/login/login");
+
+        }
+
+        JSONObject paramObj = JSONObject.parseObject(paramOut.getBody());
+
+        //获取 openId
+        String openId = paramObj.getString("openid");
+        //判断当前openId 是否绑定了业主
+
+        pd = PageData.newInstance().builder("-1", "", "", pd.getReqData(),
+                "", "", "", "",
+                pd.getAppId());
+        ResponseEntity responseEntity = this.callCenterService(restTemplate, pd, "", ServiceConstant.SERVICE_API_URL + "/api/owner.listAppUserBindingOwners?openId=" + openId, HttpMethod.GET);
+        if (responseEntity.getStatusCode() != HttpStatus.OK) {
+            //将openId放到redis 缓存,给前段下发临时票据
+            String code = UUID.randomUUID().toString();
+            CommonCache.setValue(code, openId, expireTime);
+            return ResultVo.redirectPage("/#/page/login/login?code=" + code);
+        }
+        JSONObject ownerInfo = JSONObject.parseObject(responseEntity.getBody().toString());
+        if (ownerInfo.getInteger("total") < 1) {
+            //将openId放到redis 缓存,给前段下发临时票据
+            String code = UUID.randomUUID().toString();
+            CommonCache.setValue(code, openId, expireTime);
+            return ResultVo.redirectPage("/#/page/login/login?code=" + code);
+        }
 
 
-        //super.validatePageInfo(pd);
+        // String accessToken = paramObj.getString("access_token");//暂时不用
+        Map userMap = new HashMap();
+        userMap.put(CommonConstant.LOGIN_USER_ID, ownerInfo.getString("userId"));
+        userMap.put(CommonConstant.LOGIN_USER_NAME, ownerInfo.getString("appUserName"));
+        String token = "";
+        try {
+            token = AuthenticationFactory.createAndSaveToken(userMap);
+            pd.setToken(token);
+        } catch (Exception e) {
+            logger.error("创建token失败");
+        }
+        return ResultVo.redirectPage(urlCode);
+
+    }
+
+    /**
+     * 刷新token
+     *
+     * @param pd
+     * @param redirectUrl
+     * @param request
+     * @param response
+     * @return
+     * @throws SMOException
+     */
+    @Override
+    public String refreshToken(IPageData pd, String redirectUrl, HttpServletRequest request, HttpServletResponse response) throws SMOException {
+        //分配urlCode
+        String urlCode = UUID.randomUUID().toString();
+        CommonCache.setValue(urlCode, redirectUrl, expireTime);
+
+        URL url = null;
+        String openUrl = "";
+        try {
+            url = new URL(redirectUrl);
+
+            String newUrl = url.getProtocol() + "://" + url.getHost();
+            if (url.getPort() > 0) {
+                newUrl += (":" + url.getPort());
+            }
+
+            openUrl = WechatConstant.OPEN_AUTH
+                    .replace("APPID", wechatAuthProperties.getWechatAppId())
+                    .replace("SCOPE", "snsapi_base")
+                    .replace(
+                            "REDIRECT_URL",
+                            URLEncoder
+                                    .encode(
+                                            (newUrl
+                                                    + "/app/loginOwnerWechatAuth?appId=992020061452450002&urlCode=" + urlCode),
+                                            "UTF-8")).replace("STATE", "1");
+
+        } catch (Exception e) {
+            logger.error("微信公众号鉴权 redirectUrl 错误 " + redirectUrl, e);
+            throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, e.getLocalizedMessage());
+        }
+
+        return "redirect:" + openUrl;
+    }
+
+    @Override
+    protected void validate(IPageData pd, JSONObject paramIn) {
 
 
         Assert.hasKeyAndValue(paramIn, "username", "请求报文中未包含用户名");
         Assert.hasKeyAndValue(paramIn, "username", "请求报文中未包含用户名");
         Assert.hasKeyAndValue(paramIn, "password", "请求报文中未包含密码");
         Assert.hasKeyAndValue(paramIn, "password", "请求报文中未包含密码");
-        //super.checkUserHasPrivilege(pd, restTemplate, PrivilegeCodeConstant.LIST_ORG);
     }
     }
 
 
     @Override
     @Override
@@ -84,31 +204,103 @@ public class OwnerAppLoginSMOImpl extends AppAbstractComponentSMO implements IOw
 
 
         JSONObject ownerInfo = JSONObject.parseObject(responseEntity.getBody().toString());
         JSONObject ownerInfo = JSONObject.parseObject(responseEntity.getBody().toString());
 
 
-        if (ownerInfo.getInteger("total") != 1) {
+        if (ownerInfo.getInteger("total") < 1) {
             responseEntity = new ResponseEntity<>("用户未绑定业主", HttpStatus.BAD_REQUEST);
             responseEntity = new ResponseEntity<>("用户未绑定业主", HttpStatus.BAD_REQUEST);
             return responseEntity;
             return responseEntity;
         }
         }
 
 
-        JSONObject appUser = ownerInfo.getJSONArray("auditAppUserBindingOwners").getJSONObject(0);
+        JSONArray auditAppUserBindingOwners = ownerInfo.getJSONArray("auditAppUserBindingOwners");
+
+        JSONObject appUser = auditAppUserBindingOwners.getJSONObject(0);
         appUser.put("userId", userId);
         appUser.put("userId", userId);
         appUser.put("userName", paramIn.getString("username"));
         appUser.put("userName", paramIn.getString("username"));
         JSONObject paramOut = new JSONObject();
         JSONObject paramOut = new JSONObject();
         paramOut.put("result", 0);
         paramOut.put("result", 0);
         paramOut.put("owner", appUser);
         paramOut.put("owner", appUser);
         paramOut.put("token", userInfo.getString("token"));
         paramOut.put("token", userInfo.getString("token"));
-        //可能是app 登录 直接返回
-        if (!paramIn.containsKey("code") || StringUtil.isEmpty(paramIn.getString("code"))) {
+
+        String appId = pd.getAppId();
+
+        if ("992020061452450002".equals(appId)) { //公众号
+            return wechat(pd, paramIn, paramOut, userId, auditAppUserBindingOwners);
+        } else if ("992019111758490006".equals(appId)) { //小程序
+            return mina(pd, paramIn, paramOut, userId, auditAppUserBindingOwners);
+        } else {//app
             return new ResponseEntity<>(paramOut.toJSONString(), HttpStatus.OK);
             return new ResponseEntity<>(paramOut.toJSONString(), HttpStatus.OK);
         }
         }
-        //如果code不为空调用微信接口获取openId 刷入到当前用户属性表
+    }
 
 
+    /**
+     * 公众号登录
+     *
+     * @param pd
+     * @param paramIn
+     * @param paramOut
+     * @param userId
+     * @param auditAppUserBindingOwners
+     * @return
+     */
+    private ResponseEntity<String> wechat(IPageData pd, JSONObject paramIn, JSONObject paramOut, String userId,
+                                          JSONArray auditAppUserBindingOwners) {
+
+        ResponseEntity<String> responseEntity = null;
+        //查询微信信息
+        pd = PageData.newInstance().builder(userId, "", "", pd.getReqData(),
+                "", "", "", "",
+                pd.getAppId());
+
+
+        String code = paramIn.getString("code");
+
+        String openId = CommonCache.getValue(code);
+
+        if (StringUtil.isEmpty(openId)) {
+            responseEntity = new ResponseEntity<>("页面失效,请刷新后重试", HttpStatus.UNAUTHORIZED);
+            return responseEntity;
+        }
+
+        JSONObject curOwnerApp = judgeCurrentOwnerBind(auditAppUserBindingOwners, OwnerAppUserDto.APP_TYPE_WECHAT_MINA);
+
+        //说明 当前的openId 就是最新的
+        if (curOwnerApp != null && openId.equals(curOwnerApp.getString("openId"))) {
+            return new ResponseEntity<>(paramOut.toJSONString(), HttpStatus.OK);
+        }
+
+        JSONObject userOwnerInfo = new JSONObject();
+
+        userOwnerInfo.put("openId", openId);
+        userOwnerInfo.put("appType", OwnerAppUserDto.APP_TYPE_WECHAT_MINA);
+        if (curOwnerApp != null) {
+            userOwnerInfo.put("appUserId", curOwnerApp.getString("appUserId"));
+            userOwnerInfo.put("communityId", curOwnerApp.getString("communityId"));
+        } else {
+            userOwnerInfo.put("oldAppUserId", auditAppUserBindingOwners.getJSONObject(0).getString("appUserId"));
+            userOwnerInfo.put("appUserId", "-1");
+            userOwnerInfo.put("communityId", auditAppUserBindingOwners.getJSONObject(0).getString("communityId"));
+        }
+
+        //查询微信信息
+        pd = PageData.newInstance().builder(userId, "", "", pd.getReqData(),
+                "", "", "", "",
+                pd.getAppId());
+        responseEntity = this.callCenterService(restTemplate, pd, userOwnerInfo.toJSONString(),
+                ServiceConstant.SERVICE_API_URL + "/api/owner.refreshAppUserBindingOwnerToken", HttpMethod.POST);
+        if (responseEntity.getStatusCode() != HttpStatus.OK) {
+            return responseEntity;
+        }
+        return new ResponseEntity<>(paramOut.toJSONString(), HttpStatus.OK);
+    }
+
+    private ResponseEntity<String> mina(IPageData pd, JSONObject paramIn, JSONObject paramOut, String userId, JSONArray auditAppUserBindingOwners) {
+
+        ResponseEntity<String> responseEntity = null;
         //查询微信信息
         //查询微信信息
         pd = PageData.newInstance().builder(userId, "", "", pd.getReqData(),
         pd = PageData.newInstance().builder(userId, "", "", pd.getReqData(),
                 "", "", "", "",
                 "", "", "", "",
                 pd.getAppId());
                 pd.getAppId());
         responseEntity = this.callCenterService(restTemplate, pd, "",
         responseEntity = this.callCenterService(restTemplate, pd, "",
                 ServiceConstant.SERVICE_API_URL + "/api/smallWeChat.listSmallWeChats?appId="
                 ServiceConstant.SERVICE_API_URL + "/api/smallWeChat.listSmallWeChats?appId="
-                        + paramIn.getString("appId")+"&page=1&row=1", HttpMethod.GET);
+                        + paramIn.getString("appId") + "&page=1&row=1", HttpMethod.GET);
 
 
         if (responseEntity.getStatusCode() != HttpStatus.OK) {
         if (responseEntity.getStatusCode() != HttpStatus.OK) {
             return responseEntity;
             return responseEntity;
@@ -144,23 +336,55 @@ public class OwnerAppLoginSMOImpl extends AppAbstractComponentSMO implements IOw
 
 
         String openId = responseObj.getString("openid");
         String openId = responseObj.getString("openid");
 
 
-        JSONObject userAttrInfo = new JSONObject();
-        userAttrInfo.put("userId", userId);
-        userAttrInfo.put("specCd", "100201911001");//微信openId
-        userAttrInfo.put("value", openId);
+        JSONObject curOwnerApp = judgeCurrentOwnerBind(auditAppUserBindingOwners, OwnerAppUserDto.APP_TYPE_WECHAT_MINA);
+
+        //说明 当前的openId 就是最新的
+        if (curOwnerApp != null && openId.equals(curOwnerApp.getString("openId"))) {
+            return new ResponseEntity<>(paramOut.toJSONString(), HttpStatus.OK);
+        }
+
+        JSONObject userOwnerInfo = new JSONObject();
+
+        userOwnerInfo.put("openId", openId);
+        userOwnerInfo.put("appType", OwnerAppUserDto.APP_TYPE_WECHAT_MINA);
+        if (curOwnerApp != null) {
+            userOwnerInfo.put("appUserId", curOwnerApp.getString("appUserId"));
+            userOwnerInfo.put("communityId", curOwnerApp.getString("communityId"));
+        } else {
+            userOwnerInfo.put("oldAppUserId", auditAppUserBindingOwners.getJSONObject(0).getString("appUserId"));
+            userOwnerInfo.put("appUserId", "-1");
+            userOwnerInfo.put("communityId", auditAppUserBindingOwners.getJSONObject(0).getString("communityId"));
+        }
 
 
         //查询微信信息
         //查询微信信息
         pd = PageData.newInstance().builder(userId, "", "", pd.getReqData(),
         pd = PageData.newInstance().builder(userId, "", "", pd.getReqData(),
                 "", "", "", "",
                 "", "", "", "",
                 pd.getAppId());
                 pd.getAppId());
-        responseEntity = this.callCenterService(restTemplate, pd, userAttrInfo.toJSONString(),
-                ServiceConstant.SERVICE_API_URL + "/api/user.saveOrUpdateUserAttr", HttpMethod.POST);
-        if(responseEntity.getStatusCode() != HttpStatus.OK){
+        responseEntity = this.callCenterService(restTemplate, pd, userOwnerInfo.toJSONString(),
+                ServiceConstant.SERVICE_API_URL + "/api/owner.refreshAppUserBindingOwnerToken", HttpMethod.POST);
+        if (responseEntity.getStatusCode() != HttpStatus.OK) {
             return responseEntity;
             return responseEntity;
         }
         }
         return new ResponseEntity<>(paramOut.toJSONString(), HttpStatus.OK);
         return new ResponseEntity<>(paramOut.toJSONString(), HttpStatus.OK);
     }
     }
 
 
+    /**
+     * 判断 绑定表里是否存在当前 端 绑定信息
+     *
+     * @param auditAppUserBindingOwners
+     * @param appType
+     * @return
+     */
+    private JSONObject judgeCurrentOwnerBind(JSONArray auditAppUserBindingOwners, String appType) {
+
+        for (int appUserIndex = 0; appUserIndex < auditAppUserBindingOwners.size(); appUserIndex++) {
+            if (appType.equals(auditAppUserBindingOwners.getJSONObject(appUserIndex).getString("appType"))) {
+                return auditAppUserBindingOwners.getJSONObject(appUserIndex);
+            }
+        }
+        return null;
+    }
+
     public RestTemplate getRestTemplate() {
     public RestTemplate getRestTemplate() {
         return restTemplate;
         return restTemplate;
     }
     }

+ 2 - 0
service-user/src/main/java/com/java110/user/listener/ownerAppUser/AbstractOwnerAppUserBusinessServiceDataFlowListener.java

@@ -50,6 +50,7 @@ public abstract class AbstractOwnerAppUserBusinessServiceDataFlowListener extend
         businessOwnerAppUserInfo.put("appTypeCd", businessOwnerAppUserInfo.get("app_type_cd"));
         businessOwnerAppUserInfo.put("appTypeCd", businessOwnerAppUserInfo.get("app_type_cd"));
         businessOwnerAppUserInfo.put("memberId", businessOwnerAppUserInfo.get("member_id"));
         businessOwnerAppUserInfo.put("memberId", businessOwnerAppUserInfo.get("member_id"));
         businessOwnerAppUserInfo.put("userId", businessOwnerAppUserInfo.get("user_id"));
         businessOwnerAppUserInfo.put("userId", businessOwnerAppUserInfo.get("user_id"));
+        businessOwnerAppUserInfo.put("appType", businessOwnerAppUserInfo.get("app_type"));
         businessOwnerAppUserInfo.remove("bId");
         businessOwnerAppUserInfo.remove("bId");
         businessOwnerAppUserInfo.put("statusCd", statusCd);
         businessOwnerAppUserInfo.put("statusCd", statusCd);
     }
     }
@@ -87,6 +88,7 @@ public abstract class AbstractOwnerAppUserBusinessServiceDataFlowListener extend
         currentOwnerAppUserInfo.put("appTypeCd", currentOwnerAppUserInfo.get("app_type_cd"));
         currentOwnerAppUserInfo.put("appTypeCd", currentOwnerAppUserInfo.get("app_type_cd"));
         currentOwnerAppUserInfo.put("memberId", currentOwnerAppUserInfo.get("member_id"));
         currentOwnerAppUserInfo.put("memberId", currentOwnerAppUserInfo.get("member_id"));
         currentOwnerAppUserInfo.put("userId", currentOwnerAppUserInfo.get("user_id"));
         currentOwnerAppUserInfo.put("userId", currentOwnerAppUserInfo.get("user_id"));
+        currentOwnerAppUserInfo.put("appType", currentOwnerAppUserInfo.get("app_type"));
 
 
 
 
         currentOwnerAppUserInfo.put("operate", StatusConstant.OPERATE_DEL);
         currentOwnerAppUserInfo.put("operate", StatusConstant.OPERATE_DEL);