| @@ -249,6 +249,9 @@ public class WxInfoController extends BaseController { | |||||
| if (StringUtils.isBlank(iv)) { | if (StringUtils.isBlank(iv)) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "iv 不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "iv 不能为空"); | ||||
| } | } | ||||
| if (StringUtils.isBlank(openId)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "openId 不能为空"); | |||||
| } | |||||
| WxAppinfo wxAppinfo = getAppInfo(appId); | WxAppinfo wxAppinfo = getAppInfo(appId); | ||||
| if (wxAppinfo == null) { | if (wxAppinfo == null) { | ||||
| @@ -261,7 +264,8 @@ public class WxInfoController extends BaseController { | |||||
| TenantEntity tenantEntity = new TenantEntity(); | TenantEntity tenantEntity = new TenantEntity(); | ||||
| tenantEntity.setTenantId(wxAppinfo.getTenantId()); | tenantEntity.setTenantId(wxAppinfo.getTenantId()); | ||||
| CUser buser = getCUser(); | |||||
| CUser buser = cuserFactory.getBUserService(appPlat).getByOpenId(openId,tenantEntity.getTenantId()); | |||||
| try { | try { | ||||
| // 解密 | // 解密 | ||||
| String phone = cuserFactory.getBUserService(appPlat).decryptPhoneNoInfo(encryptedData, iv, buser, wxAppinfo, isFmOpen); | String phone = cuserFactory.getBUserService(appPlat).decryptPhoneNoInfo(encryptedData, iv, buser, wxAppinfo, isFmOpen); | ||||
| @@ -316,14 +320,22 @@ public class WxInfoController extends BaseController { | |||||
| if (StringUtils.isBlank(iv)) { | if (StringUtils.isBlank(iv)) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "iv 不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "iv 不能为空"); | ||||
| } | } | ||||
| if (StringUtils.isBlank(openId)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "openId 不能为空"); | |||||
| } | |||||
| CUser buser = getCUser(); | |||||
| WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(buser.getAppId()); | |||||
| WxAppinfo wxAppinfo = getAppInfo(appId); | |||||
| if(wxAppinfo == null){ | if(wxAppinfo == null){ | ||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | ||||
| } | } | ||||
| EnumAppPlat appPlat = EnumAppPlat.getByCode(wxAppinfo.getPlat()); | |||||
| if(appPlat == null){ | |||||
| return new ResultData(ErrorCode.APP_PLAT_ERROR); | |||||
| } | |||||
| CUser buser = cuserFactory.getBUserService(appPlat).getByOpenId(openId,wxAppinfo.getTenantId()); | |||||
| try { | try { | ||||
| String phone = cuserFactory.getBUserService(buser.getAppPlat()).decryptPhoneNoInfo(encryptedData, iv, buser, wxAppinfo, isFmOpen); | |||||
| String phone = cuserFactory.getBUserService(appPlat).decryptPhoneNoInfo(encryptedData, iv, buser, wxAppinfo, isFmOpen); | |||||
| resultMap.put("msg", "授权手机成功!"); | resultMap.put("msg", "授权手机成功!"); | ||||
| resultMap.put("phone", phone); | resultMap.put("phone", phone); | ||||
| return new ResultData(resultMap); | return new ResultData(resultMap); | ||||
| @@ -32,6 +32,7 @@ public interface CUserServiceApapter { | |||||
| CUser handleLoginUser(CUser cUser, WxCUserFrom wxCUserFrom); | CUser handleLoginUser(CUser cUser, WxCUserFrom wxCUserFrom); | ||||
| CUser getById(Long id, String tenantId); | CUser getById(Long id, String tenantId); | ||||
| CUser getByOpenId(String openId, String tenantId); | |||||
| void updateScene(CUser user); | void updateScene(CUser user); | ||||
| @@ -46,4 +47,5 @@ public interface CUserServiceApapter { | |||||
| List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys); | List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys); | ||||
| void actionAfterLogin(CUser user); | void actionAfterLogin(CUser user); | ||||
| } | } | ||||
| @@ -197,6 +197,14 @@ public class TtBUserServiceAdapter extends BasicCUserService implements CUserSer | |||||
| return ttBuserMapper.selectById(id); | return ttBuserMapper.selectById(id); | ||||
| } | } | ||||
| @Override | |||||
| public CUser getByOpenId(String openId, String tenantId) { | |||||
| TtBuser buser = new TtBuser(); | |||||
| buser.setTenantId(tenantId); | |||||
| buser.setOpenId(openId); | |||||
| return ttBuserMapper.findByOpenId(buser); | |||||
| } | |||||
| @Override | @Override | ||||
| public void updateScene(CUser user) { | public void updateScene(CUser user) { | ||||
| TtBuser userL = new TtBuser(); | TtBuser userL = new TtBuser(); | ||||
| @@ -246,6 +246,14 @@ public class TtCUserServiceAdapter extends BasicCUserService implements CUserSer | |||||
| return ttCUserMapper.selectById(id,tenantId); | return ttCUserMapper.selectById(id,tenantId); | ||||
| } | } | ||||
| @Override | |||||
| public CUser getByOpenId(String openId, String tenantId) { | |||||
| TtCUser cUser = new TtCUser(); | |||||
| cUser.setTenantId(tenantId); | |||||
| cUser.setOpenId(openId); | |||||
| return ttCUserMapper.findByOpenId(cUser); | |||||
| } | |||||
| @Override | @Override | ||||
| public void updateScene(CUser user) { | public void updateScene(CUser user) { | ||||
| TtCUser userL = new TtCUser(); | TtCUser userL = new TtCUser(); | ||||
| @@ -197,6 +197,14 @@ public class WxBUserServiceAdapter extends BasicCUserService implements CUserSer | |||||
| return wxBuserMapper.selectById(id); | return wxBuserMapper.selectById(id); | ||||
| } | } | ||||
| @Override | |||||
| public CUser getByOpenId(String openId, String tenantId) { | |||||
| WxBuser buser = new WxBuser(); | |||||
| buser.setTenantId(tenantId); | |||||
| buser.setOpenId(openId); | |||||
| return wxBuserMapper.findByOpenId(buser); | |||||
| } | |||||
| @Override | @Override | ||||
| public void updateScene(CUser user) { | public void updateScene(CUser user) { | ||||
| WxBuser userL = new WxBuser(); | WxBuser userL = new WxBuser(); | ||||
| @@ -253,6 +253,14 @@ public class WxCUserServiceAdapter extends BasicCUserService implements CUserSer | |||||
| return wxCUserMapper.selectById(id,tenantId); | return wxCUserMapper.selectById(id,tenantId); | ||||
| } | } | ||||
| @Override | |||||
| public CUser getByOpenId(String openId, String tenantId) { | |||||
| WxCUser wxCUser = new WxCUser(); | |||||
| wxCUser.setTenantId(tenantId); | |||||
| wxCUser.setOpenId(openId); | |||||
| return wxCUserMapper.findByOpenId(wxCUser); | |||||
| } | |||||
| @Override | @Override | ||||
| public void updateScene(CUser user) { | public void updateScene(CUser user) { | ||||
| WxCUser userL = new WxCUser(); | WxCUser userL = new WxCUser(); | ||||
| @@ -231,7 +231,10 @@ | |||||
| <select id="findByOpenId" parameterType="com.iformall.domain.po.TtBuser" resultMap="BaseResultMap"> | <select id="findByOpenId" parameterType="com.iformall.domain.po.TtBuser" resultMap="BaseResultMap"> | ||||
| select * from tt_buser | select * from tt_buser | ||||
| where `app_id` = #{appId} and `open_id` = #{openId} | |||||
| where `open_id` = #{openId} | |||||
| <if test=" null != appId and '' != appId"> | |||||
| and `app_id` = #{appId} | |||||
| </if> | |||||
| </select> | </select> | ||||
| <select id="findByUnionId" parameterType="com.iformall.domain.po.TtBuser" resultMap="BaseResultMap"> | <select id="findByUnionId" parameterType="com.iformall.domain.po.TtBuser" resultMap="BaseResultMap"> | ||||
| @@ -231,7 +231,10 @@ | |||||
| <select id="findByOpenId" parameterType="com.iformall.domain.po.WxBuser" resultMap="BaseResultMap"> | <select id="findByOpenId" parameterType="com.iformall.domain.po.WxBuser" resultMap="BaseResultMap"> | ||||
| select * from wx_buser | select * from wx_buser | ||||
| where `app_id` = #{appId} and `open_id` = #{openId} | |||||
| where `open_id` = #{openId} | |||||
| <if test=" null != appId and '' != appId"> | |||||
| and `app_id` = #{appId} | |||||
| </if> | |||||
| </select> | </select> | ||||
| <select id="findByUnionId" parameterType="com.iformall.domain.po.WxBuser" resultMap="BaseResultMap"> | <select id="findByUnionId" parameterType="com.iformall.domain.po.WxBuser" resultMap="BaseResultMap"> | ||||