|
|
@ -56,8 +56,6 @@ import me.chanjar.weixin.mp.api.WxMpService; |
|
|
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken; |
|
|
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken; |
|
|
import me.chanjar.weixin.mp.bean.result.WxMpUser; |
|
|
import me.chanjar.weixin.mp.bean.result.WxMpUser; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.slf4j.Logger; |
|
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
@ -78,7 +76,7 @@ import java.util.List; |
|
|
@Slf4j |
|
|
@Slf4j |
|
|
@Service |
|
|
@Service |
|
|
public class AppUserServiceImpl implements AppUserService { |
|
|
public class AppUserServiceImpl implements AppUserService { |
|
|
private static final Logger logger = LoggerFactory.getLogger(AppUserServiceImpl.class); |
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private AppUserRedis appUserRedis; |
|
|
private AppUserRedis appUserRedis; |
|
|
|
|
|
|
|
|
@ -248,7 +246,7 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
if (!userInfoResult.success()) { |
|
|
if (!userInfoResult.success()) { |
|
|
return new Result().error(userInfoResult.getMsg()); |
|
|
return new Result().error(userInfoResult.getMsg()); |
|
|
} |
|
|
} |
|
|
return this.getTokenByUserDto(userInfoResult.getData(),null); |
|
|
return this.getTokenByUserDto(userInfoResult.getData(), null); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private Result<EpdcAppAuthorizationDTO> getNPMTokenByOpenId(WxMaJscode2SessionResult wxMaJscode2SessionResult, EpdcAppUserTokenFormDTO loginDto) { |
|
|
private Result<EpdcAppAuthorizationDTO> getNPMTokenByOpenId(WxMaJscode2SessionResult wxMaJscode2SessionResult, EpdcAppUserTokenFormDTO loginDto) { |
|
|
@ -280,7 +278,7 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
authorization.setUserState(AppUserStatesEnum.STATE_NOT_REGISTERED.value()); |
|
|
authorization.setUserState(AppUserStatesEnum.STATE_NOT_REGISTERED.value()); |
|
|
return new Result().ok(authorization); |
|
|
return new Result().ok(authorization); |
|
|
} |
|
|
} |
|
|
if(StringUtils.isEmpty(loginDto.getMobile()) || !userDto.getMobile().equals(loginDto.getMobile())){ |
|
|
if (StringUtils.isEmpty(loginDto.getMobile()) || !userDto.getMobile().equals(loginDto.getMobile())) { |
|
|
return new Result<EpdcAppAuthorizationDTO>().error(-1, "请确认账号或密码是否正确!"); |
|
|
return new Result<EpdcAppAuthorizationDTO>().error(-1, "请确认账号或密码是否正确!"); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNotEmpty(loginDto.getPassword())) { |
|
|
if (StringUtils.isNotEmpty(loginDto.getPassword())) { |
|
|
@ -1486,7 +1484,7 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
@Override |
|
|
@Override |
|
|
public Result |
|
|
public Result |
|
|
volunteerAuthenticate(TokenDto tokenDto, EpdcCompleteVolunteerInfoFormDTO formDto) { |
|
|
volunteerAuthenticate(TokenDto tokenDto, EpdcCompleteVolunteerInfoFormDTO formDto) { |
|
|
logger.info("志愿者认证wxCode=" + formDto.getWxCode() + ";userId=" + tokenDto.getUserId()); |
|
|
log.info("志愿者认证wxCode=" + formDto.getWxCode() + ";userId=" + tokenDto.getUserId()); |
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(formDto.getSmsCode())) { |
|
|
if (StringUtils.isNotBlank(formDto.getSmsCode())) { |
|
|
this.checkSmsCode(formDto.getMobile(), formDto.getSmsCode()); |
|
|
this.checkSmsCode(formDto.getMobile(), formDto.getSmsCode()); |
|
|
@ -1673,6 +1671,38 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
return new Result<EpdcPartyMemberRegistDTO>().ok(partyMemberRegistDTO); |
|
|
return new Result<EpdcPartyMemberRegistDTO>().ok(partyMemberRegistDTO); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Result<EpdcPartyMemberRegistDTO> updateReportparty(ReportPartyDTO dto) { |
|
|
|
|
|
EpdcPartyMemberRegistDTO partyMemberRegistDTO = new EpdcPartyMemberRegistDTO(); |
|
|
|
|
|
CityCenterFromDTO formDTO = new CityCenterFromDTO(); |
|
|
|
|
|
if (dto.getDeptId() != null) { |
|
|
|
|
|
formDTO.setDeptId(Long.parseLong(dto.getAllDeptIds()[dto.getAllDeptIds().length - 2])); |
|
|
|
|
|
SysDeptDTO liveDept = adminFeignClient.getDeptInfo(formDTO).getData(); |
|
|
|
|
|
partyMemberRegistDTO.setLiveAddress(liveDept.getAddress()); |
|
|
|
|
|
partyMemberRegistDTO.setLiveCommunity(liveDept.getName()); |
|
|
|
|
|
partyMemberRegistDTO.setLiveMobile(liveDept.getMobile()); |
|
|
|
|
|
partyMemberRegistDTO.setLiveSecretaryName(liveDept.getSecretaryName()); |
|
|
|
|
|
partyMemberRegistDTO.setLiveTelephone(liveDept.getTelephone()); |
|
|
|
|
|
partyMemberRegistDTO.setLiveStreetName(liveDept.getStreetName()); |
|
|
|
|
|
partyMemberRegistDTO.setLiveLongitude(liveDept.getLongitude()); |
|
|
|
|
|
partyMemberRegistDTO.setLiveLatitude(liveDept.getLatitude()); |
|
|
|
|
|
} |
|
|
|
|
|
if (null != dto.getCouplingCommunity()) { |
|
|
|
|
|
formDTO.setDeptId(Long.parseLong(dto.getCouplingCommunity()[dto.getCouplingCommunity().length - 2])); |
|
|
|
|
|
SysDeptDTO couplingDept = adminFeignClient.getDeptInfo(formDTO).getData(); |
|
|
|
|
|
partyMemberRegistDTO.setCouplingAddress(couplingDept.getAddress()); |
|
|
|
|
|
partyMemberRegistDTO.setCouplingCommunity(couplingDept.getName()); |
|
|
|
|
|
partyMemberRegistDTO.setCouplingMobile(couplingDept.getMobile()); |
|
|
|
|
|
partyMemberRegistDTO.setCouplingSecretaryName(couplingDept.getSecretaryName()); |
|
|
|
|
|
partyMemberRegistDTO.setCouplingelephone(couplingDept.getTelephone()); |
|
|
|
|
|
partyMemberRegistDTO.setCouplingStreetName(couplingDept.getStreetName()); |
|
|
|
|
|
partyMemberRegistDTO.setCouplingLongitude(couplingDept.getLongitude()); |
|
|
|
|
|
partyMemberRegistDTO.setCouplingLatitude(couplingDept.getLatitude()); |
|
|
|
|
|
} |
|
|
|
|
|
userFeignClient.updateReportparty(dto); |
|
|
|
|
|
return new Result<EpdcPartyMemberRegistDTO>().ok(partyMemberRegistDTO); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Result getByIdCardAndName(ReportPartyDTO dto) { |
|
|
public Result getByIdCardAndName(ReportPartyDTO dto) { |
|
|
return userFeignClient.getByIdCardAndName(dto); |
|
|
return userFeignClient.getByIdCardAndName(dto); |
|
|
@ -1731,36 +1761,38 @@ public class AppUserServiceImpl implements AppUserService { |
|
|
|
|
|
|
|
|
private UserDTO generateNpmUserDTO(EpdcUserNpmRegisterFormDTO formDto) { |
|
|
private UserDTO generateNpmUserDTO(EpdcUserNpmRegisterFormDTO formDto) { |
|
|
EpdcUserRegistFormDTO epdcUserRegistFormDTO = ConvertUtils.sourceToTarget(formDto, EpdcUserRegistFormDTO.class); |
|
|
EpdcUserRegistFormDTO epdcUserRegistFormDTO = ConvertUtils.sourceToTarget(formDto, EpdcUserRegistFormDTO.class); |
|
|
if(StringUtils.isNotEmpty(formDto.getPassword())){ |
|
|
if (StringUtils.isNotEmpty(formDto.getPassword())) { |
|
|
String pwd = PasswordUtils.encode(formDto.getPassword()); |
|
|
String pwd = PasswordUtils.encode(formDto.getPassword()); |
|
|
epdcUserRegistFormDTO.setPassword(pwd); |
|
|
epdcUserRegistFormDTO.setPassword(pwd); |
|
|
|
|
|
npmVerifyUserRegisterData(epdcUserRegistFormDTO); |
|
|
} |
|
|
} |
|
|
epdcUserRegistFormDTO.setRoad(""); |
|
|
epdcUserRegistFormDTO.setRoad(""); |
|
|
if (null != formDto.getCouplingCommunity()) { |
|
|
if (null != formDto.getCouplingCommunity()) { |
|
|
epdcUserRegistFormDTO.setCouplingCommunity(String.join(",", formDto.getCouplingCommunity())); |
|
|
epdcUserRegistFormDTO.setCouplingCommunity(String.join(",", formDto.getCouplingCommunity())); |
|
|
} |
|
|
} |
|
|
npmVerifyUserRegisterData(epdcUserRegistFormDTO); |
|
|
|
|
|
|
|
|
|
|
|
Long deptId; |
|
|
UserDTO userDTO = new UserDTO(); |
|
|
if (formDto.getAllDeptIds() != null && formDto.getAllDeptIds().length > 1) { |
|
|
//判断是否在市北居住,如果居住,需要填写社区信息
|
|
|
deptId = Long.parseLong(formDto.getAllDeptIds()[formDto.getAllDeptIds().length - 1]); |
|
|
if (formDto.getShibei() == 1) { |
|
|
} else { |
|
|
Long deptId; |
|
|
UserDetail user = SecurityUser.getUser(); |
|
|
if (formDto.getAllDeptIds() != null && formDto.getAllDeptIds().length > 1) { |
|
|
deptId = user.getDeptId(); |
|
|
deptId = Long.parseLong(formDto.getAllDeptIds()[formDto.getAllDeptIds().length - 1]); |
|
|
} |
|
|
} else { |
|
|
|
|
|
UserDetail user = SecurityUser.getUser(); |
|
|
WxMaJscode2SessionResult nmpWxUser = this.getNMPWxUser(formDto.getWxCode()); |
|
|
deptId = user.getDeptId(); |
|
|
|
|
|
} |
|
|
|
|
|
// 获取网格机构详情
|
|
|
|
|
|
Result<CompleteDeptDTO> adminDeptResult = adminFeignClient.getCompleteDept(deptId); |
|
|
|
|
|
if (!adminDeptResult.success() || null == adminDeptResult.getData()) { |
|
|
|
|
|
throw new RenException("查询网格信息失败"); |
|
|
|
|
|
} |
|
|
|
|
|
CompleteDeptDTO completeDept = adminDeptResult.getData(); |
|
|
|
|
|
|
|
|
// 获取网格机构详情
|
|
|
epdcUserRegistFormDTO.setGridId(deptId); |
|
|
Result<CompleteDeptDTO> adminDeptResult = adminFeignClient.getCompleteDept(deptId); |
|
|
WxMaJscode2SessionResult nmpWxUser = this.getNMPWxUser(formDto.getWxCode()); |
|
|
if (!adminDeptResult.success() || null == adminDeptResult.getData()) { |
|
|
userDTO = this.packageUserDto(epdcUserRegistFormDTO, nmpWxUser.getUnionid(), nmpWxUser.getOpenid(), completeDept); |
|
|
throw new RenException("查询网格信息失败"); |
|
|
userDTO.setDeptId(deptId); |
|
|
} |
|
|
} |
|
|
CompleteDeptDTO completeDept = adminDeptResult.getData(); |
|
|
|
|
|
|
|
|
|
|
|
epdcUserRegistFormDTO.setGridId(deptId); |
|
|
|
|
|
UserDTO userDTO = this.packageUserDto(epdcUserRegistFormDTO, nmpWxUser.getUnionid(), nmpWxUser.getOpenid(), completeDept); |
|
|
|
|
|
userDTO.setDeptId(deptId); |
|
|
|
|
|
userDTO.setHobbies(formDto.getHobbies()); |
|
|
userDTO.setHobbies(formDto.getHobbies()); |
|
|
userDTO.setPartyFlag(String.valueOf(formDto.getPartyFlag())); |
|
|
userDTO.setPartyFlag(String.valueOf(formDto.getPartyFlag())); |
|
|
userDTO.setShibei(formDto.getShibei()); |
|
|
userDTO.setShibei(formDto.getShibei()); |
|
|
|