|
|
@ -771,12 +771,13 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
|
// 验证手机号
|
|
|
|
this.checkSmsCode(infoDto.getMobile(), infoDto.getSmsCode()); |
|
|
|
|
|
|
|
String userId = tokenDto.getUserId(); |
|
|
|
Long gridId = getGridId(infoDto.getGridId(), tokenDto.getGridId(), userId); |
|
|
|
|
|
|
|
UserDTO userDto = ConvertUtils.sourceToTarget(infoDto, UserDTO.class); |
|
|
|
userDto.setRealName(ModuleUtils.replaceIllegalCharacter(infoDto.getRealName())); |
|
|
|
Long gridId = infoDto.getGridId(); |
|
|
|
gridId = (null == gridId || NumConstant.ZERO_L == gridId) ? tokenDto.getGridId() : gridId; |
|
|
|
userDto.setDeptId(gridId); |
|
|
|
userDto.setId(tokenDto.getUserId()); |
|
|
|
userDto.setId(userId); |
|
|
|
userDto.setRealName(ModuleUtils.replaceIllegalCharacter(infoDto.getRealName())); |
|
|
|
|
|
|
|
// 党员提交,验证身份证号
|
|
|
|
String identityNo = ModuleUtils.replaceIllegalCharacter(infoDto.getIdentityNo()); |
|
|
@ -797,7 +798,7 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
|
return new Result().error(verifyResult.getMsg()); |
|
|
|
} |
|
|
|
String userState = verifyResult.getData(); |
|
|
|
userDto.setWxUnionId(getWxUnionId(infoDto.getWxCode(), infoDto.getIv(), infoDto.getEncryptedData())); |
|
|
|
userDto.setWxUnionId(this.getWxUnionId(infoDto.getWxCode(), infoDto.getIv(), infoDto.getEncryptedData(), userId)); |
|
|
|
|
|
|
|
UserGridRelationDTO userGrid = this.packageUserGridRelationInfo(gridId); |
|
|
|
EpdcCompleteAppUserDTO completeAppUserDto = ConvertUtils.sourceToTarget(userDto, EpdcCompleteAppUserDTO.class); |
|
|
@ -826,7 +827,7 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
|
EpdcAppAuthorizationDTO authorizationDto = this.packageEpdcAppAuthorization(tokenDto, userGrid.getGrid(), user.getState()); |
|
|
|
|
|
|
|
// 更新社群用户党员标识并加入关联的所有网格党员群
|
|
|
|
if (NumConstant.ONE_STR.equals(user.getPartyFlag())) { |
|
|
|
if (YesOrNoEnum.YES.value().equals(user.getPartyFlag())) { |
|
|
|
GroupUserPartyMemberFormDTO formDto = new GroupUserPartyMemberFormDTO(); |
|
|
|
formDto.setUserId(user.getId()); |
|
|
|
formDto.setPartyMember(user.getPartyFlag()); |
|
|
@ -842,6 +843,23 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
|
return new Result().ok(authorizationDto); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 判断用户居住网格id |
|
|
|
* |
|
|
|
* @param gridIdByCompleteDto 完善信息提交时的网格id |
|
|
|
* @param gridIdByToken token里的网格id |
|
|
|
* @return java.lang.Long |
|
|
|
* @author work@yujt.net.cn |
|
|
|
* @date 2020/3/3 14:22 |
|
|
|
*/ |
|
|
|
private Long getGridId(Long gridIdByCompleteDto, Long gridIdByToken, String userId) { |
|
|
|
if (null == gridIdByCompleteDto || NumConstant.ZERO_L == gridIdByCompleteDto) { |
|
|
|
log.info("用户{}完善信息时选择居住网格为:{}", userId, gridIdByCompleteDto); |
|
|
|
return gridIdByToken; |
|
|
|
} |
|
|
|
return gridIdByCompleteDto; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 解析微信用户unionid |
|
|
|
* <p>代码说明: |
|
|
@ -852,11 +870,12 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
|
* @param wxCode |
|
|
|
* @param iv |
|
|
|
* @param encryptedData |
|
|
|
* @param userId |
|
|
|
* @return java.lang.String |
|
|
|
* @author work@yujt.net.cn |
|
|
|
* @date 2020/2/28 14:51 |
|
|
|
*/ |
|
|
|
private String getWxUnionId(String wxCode, String iv, String encryptedData) { |
|
|
|
private String getWxUnionId(String wxCode, String iv, String encryptedData, String userId) { |
|
|
|
if (StringUtils.isBlank(wxCode) || StringUtils.isBlank(iv) || StringUtils.isBlank(encryptedData)) { |
|
|
|
return null; |
|
|
|
} |
|
|
@ -869,12 +888,14 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
|
* 将解密得到的JSON字符串,用{@link JSONObject}组装为目标对象 |
|
|
|
*/ |
|
|
|
WxMaUserInfo wxMaUserInfo = null; |
|
|
|
String decrypt = null; |
|
|
|
try { |
|
|
|
String decrypt = WxMaCryptUtils.decrypt(sessionKey, encryptedData, iv); |
|
|
|
decrypt = WxMaCryptUtils.decrypt(sessionKey, encryptedData, iv); |
|
|
|
if (StringUtils.isNotBlank(decrypt)) { |
|
|
|
wxMaUserInfo = JSONObject.parseObject(decrypt, WxMaUserInfo.class); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("解析或组装用户{}的微信信息失败,解密数据:::::", userId, decrypt); |
|
|
|
log.error(e.getMessage()); |
|
|
|
} |
|
|
|
if (null == wxMaUserInfo || StringUtils.isBlank(wxMaUserInfo.getUnionId())) { |
|
|
|