|
|
@ -11,6 +11,7 @@ import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.*; |
|
|
|
import com.elink.esua.epdc.dto.*; |
|
|
|
import com.elink.esua.epdc.dto.epdc.EpdcCompleteAppUserDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.form.EpdcGridLeaderRegisterFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.GridLeaderRegisterDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.form.*; |
|
|
@ -253,7 +254,6 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
|
appUser.setLastLoginTime(now); |
|
|
|
appUser.setRegisterTime(now); |
|
|
|
appUser.setState(AppUserStatesEnum.STATE_INFORMATION_PASSED.value()); |
|
|
|
appUser.setGridId(NumConstant.ZERO_L); |
|
|
|
appUser.setRegisterSource(AppUserRegisterSourceEnum.MA.value()); |
|
|
|
appUser.setRegisterWay(AppUserRegisterWayEnum.WX.value()); |
|
|
|
appUser.setMobile(mobile); |
|
|
@ -521,7 +521,7 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<EpdcAppAuthorizationDTO> gridLeaderSwitchGrid(TokenDto userDetail, String gridId) { |
|
|
|
public Result<EpdcAppAuthorizationDTO> userSwitchGrid(TokenDto userDetail, String gridId) { |
|
|
|
|
|
|
|
String userId = userDetail.getUserId(); |
|
|
|
|
|
|
@ -529,7 +529,7 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
|
switchGrid.setAppUserId(userId); |
|
|
|
switchGrid.setGridId(gridId); |
|
|
|
// 更新用户-网格关系表,更新将要切换的网格的 SWITCHED_TIME 字段
|
|
|
|
Result<UserGridRelationDTO> appUserResult = userFeignClient.leaderSwitchGrid(switchGrid); |
|
|
|
Result<UserGridRelationDTO> appUserResult = userFeignClient.userSwitchGrid(switchGrid); |
|
|
|
if (!appUserResult.success()) { |
|
|
|
return new Result().error(appUserResult.getMsg()); |
|
|
|
} |
|
|
@ -542,8 +542,8 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<List<EpdcLeaderGridResultDTO>> listGridForLeader(String userId) { |
|
|
|
return userFeignClient.listGridForLeader(userId); |
|
|
|
public Result<List<EpdcLeaderGridResultDTO>> listUserGrid(String userId) { |
|
|
|
return userFeignClient.listUserGrid(userId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -677,6 +677,7 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
|
public Result<EpdcAppAuthorizationDTO> completeUserInfo(TokenDto tokenDto, EpdcCompleteUserInfoFormDTO infoDto) { |
|
|
|
|
|
|
|
UserDTO userDto = ConvertUtils.sourceToTarget(infoDto, UserDTO.class); |
|
|
|
userDto.setId(tokenDto.getUserId()); |
|
|
|
|
|
|
|
// 党员提交,验证身份证号
|
|
|
|
if (YesOrNoEnum.YES.value().equals(userDto.getPartyFlag())) { |
|
|
@ -692,22 +693,18 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
|
} |
|
|
|
// 验证手机号
|
|
|
|
this.checkSmsCode(userDto.getMobile(), infoDto.getSmsCode()); |
|
|
|
|
|
|
|
|
|
|
|
userDto.setId(tokenDto.getUserId()); |
|
|
|
// 验证用户提交的信息
|
|
|
|
Result verifyResult = userFeignClient.verifyUserCompleteData(userDto); |
|
|
|
if (!verifyResult.success()) { |
|
|
|
return new Result().error(verifyResult.getMsg()); |
|
|
|
} |
|
|
|
|
|
|
|
UserGridRelationDTO userGrid = this.packageUserGridRelationInfo(tokenDto.getGridId()); |
|
|
|
EpdcCompleteAppUserDTO completeAppUserDto = ConvertUtils.sourceToTarget(userDto, EpdcCompleteAppUserDTO.class); |
|
|
|
completeAppUserDto = this.packageUserCompleteInfo(completeAppUserDto); |
|
|
|
// 组装对象,准备保存用户信息
|
|
|
|
EpdcAppUserCompleteInfoFormDTO dto = new EpdcAppUserCompleteInfoFormDTO(); |
|
|
|
|
|
|
|
UserGridRelationDTO userGrid = this.packageUserGridRelationInfo(tokenDto.getGridId()); |
|
|
|
userDto = this.packageUserCompleteInfo(userDto); |
|
|
|
|
|
|
|
dto.setUserDto(userDto); |
|
|
|
dto.setCompleteAppUser(completeAppUserDto); |
|
|
|
dto.setUserGridRelation(userGrid); |
|
|
|
|
|
|
|
Result<UserDTO> completeResult = userFeignClient.completeUserInfo(dto); |
|
|
@ -736,27 +733,37 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
|
return new Result().error("获取用户信息失败"); |
|
|
|
} |
|
|
|
|
|
|
|
private UserDTO packageUserCompleteInfo(UserDTO userDto) { |
|
|
|
private EpdcCompleteAppUserDTO packageUserCompleteInfo(EpdcCompleteAppUserDTO dto) { |
|
|
|
|
|
|
|
if (YesOrNoEnum.YES.value().equals(userDto.getPartyFlag())) { |
|
|
|
userDto.setState(AppUserStatesEnum.STATE_INFORMATION_PASSED.value()); |
|
|
|
userDto.setSex(IdentityNoUtils.getSex(userDto.getIdentityNo())); |
|
|
|
userDto.setNickname( |
|
|
|
userDto.getRoad().concat("-").concat(userDto.getRealName().substring(NumConstant.ZERO, NumConstant.ONE)) |
|
|
|
.concat(NumConstant.ZERO_STR.equals(userDto.getSex()) ? "女士" : "先生")); |
|
|
|
userDto.setBirthday(DateUtils.parse(IdentityNoUtils.getBirthday(userDto.getIdentityNo()), DateUtils.DATE_PATTERN)); |
|
|
|
String road = dto.getRoad(); |
|
|
|
String villageName = dto.getVillageName(); |
|
|
|
String dwellingPlace = dto.getDwellingPlace(); |
|
|
|
String identityNo = dto.getIdentityNo(); |
|
|
|
|
|
|
|
if (YesOrNoEnum.YES.value().equals(dto.getPartyFlag())) { |
|
|
|
dto.setState(AppUserStatesEnum.STATE_INFORMATION_PASSED.value()); |
|
|
|
dto.setSex(IdentityNoUtils.getSex(identityNo)); |
|
|
|
dto.setNickname( |
|
|
|
road.concat("-").concat(dto.getRealName().substring(NumConstant.ZERO, NumConstant.ONE)) |
|
|
|
.concat(NumConstant.ZERO_STR.equals(dto.getSex()) ? "女士" : "先生")); |
|
|
|
dto.setBirthday(DateUtils.parse(IdentityNoUtils.getBirthday(identityNo), DateUtils.DATE_PATTERN)); |
|
|
|
} else { |
|
|
|
userDto.setState(AppUserStatesEnum.STATE_COMPLETED_INFORMATION_PENDING_REVIEW.value()); |
|
|
|
dto.setState(AppUserStatesEnum.STATE_COMPLETED_INFORMATION_PENDING_REVIEW.value()); |
|
|
|
} |
|
|
|
|
|
|
|
PhoneDto phoneDto = PhoneUtil.getPhoneDto(userDto.getMobile()); |
|
|
|
String address = road |
|
|
|
.concat(StringUtils.isNotBlank(villageName) ? villageName : "") |
|
|
|
.concat(StringUtils.isNotBlank(dwellingPlace) ? dwellingPlace : ""); |
|
|
|
dto.setAddress(address); |
|
|
|
|
|
|
|
PhoneDto phoneDto = PhoneUtil.getPhoneDto(dto.getMobile()); |
|
|
|
if (phoneDto != null) { |
|
|
|
userDto.setMobileCarrier(phoneDto.getCarrier()); |
|
|
|
userDto.setMobileCity(phoneDto.getCityName()); |
|
|
|
userDto.setMobileProvince(phoneDto.getProvinceName()); |
|
|
|
dto.setMobileCarrier(phoneDto.getCarrier()); |
|
|
|
dto.setMobileCity(phoneDto.getCityName()); |
|
|
|
dto.setMobileProvince(phoneDto.getProvinceName()); |
|
|
|
} |
|
|
|
|
|
|
|
return userDto; |
|
|
|
return dto; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|