Browse Source

Merge remote-tracking branch 'remotes/origin/dev'

dev_shibei_match
jianjun 4 years ago
parent
commit
ae7244d568
  1. 34
      epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
  2. 2
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java
  3. 4
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerThirdplatApiServiceServiceImpl.java
  4. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java
  5. 23
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java

34
epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java

@ -79,13 +79,13 @@ public class GovLoginServiceImpl implements GovLoginService {
public void sendSmsCode(SendSmsCodeFormDTO formDTO) { public void sendSmsCode(SendSmsCodeFormDTO formDTO) {
//1、校验手机号是否符合规范 //1、校验手机号是否符合规范
if (!PhoneValidatorUtils.isMobile(formDTO.getMobile())) { if (!PhoneValidatorUtils.isMobile(formDTO.getMobile())) {
logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), EpmetErrorCode.ERROR_PHONE.getCode(), EpmetErrorCode.ERROR_PHONE.getMsg())); logger.warn(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), EpmetErrorCode.ERROR_PHONE.getCode(), EpmetErrorCode.ERROR_PHONE.getMsg()));
throw new RenException(EpmetErrorCode.ERROR_PHONE.getCode()); throw new RenException(EpmetErrorCode.ERROR_PHONE.getCode());
} }
//2、根据手机号校验用户是否存在 //2、根据手机号校验用户是否存在
Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile()); Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile());
if (!customerStaffResult.success()) { if (!customerStaffResult.success()) {
logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg())); logger.warn(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
throw new RenException(customerStaffResult.getCode()); throw new RenException(customerStaffResult.getCode());
} }
//3、发送短信验证码 //3、发送短信验证码
@ -94,7 +94,7 @@ public class GovLoginServiceImpl implements GovLoginService {
sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.LGOIN_CONFIRM); sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.LGOIN_CONFIRM);
Result<SendVerificationCodeResultDTO> smsCodeResult=epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO); Result<SendVerificationCodeResultDTO> smsCodeResult=epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO);
if (!smsCodeResult.success()) { if (!smsCodeResult.success()) {
logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), smsCodeResult.getCode(), smsCodeResult.getMsg())); logger.warn(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), smsCodeResult.getCode(), smsCodeResult.getMsg()));
throw new RenException(smsCodeResult.getCode()); throw new RenException(smsCodeResult.getCode());
} }
//4、保存短信验证码(删除现有短信验证码、将新的短信验证码存入Redis) //4、保存短信验证码(删除现有短信验证码、将新的短信验证码存入Redis)
@ -114,13 +114,13 @@ public class GovLoginServiceImpl implements GovLoginService {
//1、根据手机号查询到用户信息 //1、根据手机号查询到用户信息
Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile()); Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile());
if (!customerStaffResult.success()) { if (!customerStaffResult.success()) {
logger.error(String.format("手机验证码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg())); logger.warn(String.format("手机验证码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
throw new RenException(customerStaffResult.getCode()); throw new RenException(customerStaffResult.getCode());
} }
//2、验证码是否正确 //2、验证码是否正确
String rightSmsCode = captchaRedis.getSmsCode(formDTO.getMobile()); String rightSmsCode = captchaRedis.getSmsCode(formDTO.getMobile());
if (!formDTO.getSmsCode().equals(rightSmsCode)) { if (!formDTO.getSmsCode().equals(rightSmsCode)) {
logger.error(String.format("验证码错误code[%s],msg[%s]",EpmetErrorCode.MOBILE_CODE_ERROR.getCode(),EpmetErrorCode.MOBILE_CODE_ERROR.getMsg())); logger.warn(String.format("验证码错误code[%s],msg[%s]",EpmetErrorCode.MOBILE_CODE_ERROR.getCode(),EpmetErrorCode.MOBILE_CODE_ERROR.getMsg()));
throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
} }
//3、查询用户所有的组织信息 //3、查询用户所有的组织信息
@ -134,7 +134,7 @@ public class GovLoginServiceImpl implements GovLoginService {
if(result.success()&&null!=result.getData()){ if(result.success()&&null!=result.getData()){
return result.getData(); return result.getData();
} }
logger.error(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,验证码%s,返回错误码%s,错误提示信息%s", ServiceConstant.GOV_ORG_SERVER,formDTO.getMobile(),formDTO.getSmsCode(),result.getCode(),result.getMsg())); logger.warn(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,验证码%s,返回错误码%s,错误提示信息%s", ServiceConstant.GOV_ORG_SERVER,formDTO.getMobile(),formDTO.getSmsCode(),result.getCode(),result.getMsg()));
return new ArrayList<>(); return new ArrayList<>();
} }
@ -147,7 +147,7 @@ public class GovLoginServiceImpl implements GovLoginService {
} }
Result<StaffLatestAgencyResultDTO> latestStaffWechat = epmetUserFeignClient.getLatestStaffWechatLoginRecord(wxMaJscode2SessionResult.getOpenid()); Result<StaffLatestAgencyResultDTO> latestStaffWechat = epmetUserFeignClient.getLatestStaffWechatLoginRecord(wxMaJscode2SessionResult.getOpenid());
if (!latestStaffWechat.success() || null == latestStaffWechat.getData()) { if (!latestStaffWechat.success() || null == latestStaffWechat.getData()) {
logger.error(String.format("没有获取到用户最近一次登录账户信息,code[%s],msg[%s]", EpmetErrorCode.PLEASE_LOGIN.getCode(), EpmetErrorCode.PLEASE_LOGIN.getMsg())); logger.warn(String.format("没有获取到用户最近一次登录账户信息,code[%s],msg[%s]", EpmetErrorCode.PLEASE_LOGIN.getCode(), EpmetErrorCode.PLEASE_LOGIN.getMsg()));
throw new RenException(EpmetErrorCode.PLEASE_LOGIN.getCode()); throw new RenException(EpmetErrorCode.PLEASE_LOGIN.getCode());
} }
StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = latestStaffWechat.getData(); StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = latestStaffWechat.getData();
@ -222,7 +222,7 @@ public class GovLoginServiceImpl implements GovLoginService {
public Set<String> getGridIdList(String staffId) { public Set<String> getGridIdList(String staffId) {
Result<List<GridByStaffResultDTO>> result = govOrgFeignClient.listGridsbystaffid(staffId); Result<List<GridByStaffResultDTO>> result = govOrgFeignClient.listGridsbystaffid(staffId);
if (!result.success()) { if (!result.success()) {
logger.error("登录:查询网格列表,远程调用返回错误:{}", result.getMsg()); logger.warn("登录:查询网格列表,远程调用返回错误:{}", result.getMsg());
return null; return null;
} else { } else {
List<GridByStaffResultDTO> grids = result.getData(); List<GridByStaffResultDTO> grids = result.getData();
@ -239,11 +239,11 @@ public class GovLoginServiceImpl implements GovLoginService {
return deptIdLists; return deptIdLists;
} }
} else { } else {
logger.error("登录:查询部门列表,远程调用返回错误:{}", deptListResult.getMsg()); logger.warn("登录:查询部门列表,远程调用返回错误:{}", deptListResult.getMsg());
} }
} catch (Exception e) { } catch (Exception e) {
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); String errorStackTrace = ExceptionUtils.getErrorStackTrace(e);
logger.error("登录:查询部门列表异常:{}", errorStackTrace); logger.warn("登录:查询部门列表异常:{}", errorStackTrace);
} }
return null; return null;
} }
@ -268,7 +268,7 @@ public class GovLoginServiceImpl implements GovLoginService {
customerStaffFormDTO.setMobile(formDTO.getMobile()); customerStaffFormDTO.setMobile(formDTO.getMobile());
Result<CustomerStaffDTO> customerStaffDTOResult = epmetUserFeignClient.getCustomerStaffInfo(customerStaffFormDTO); Result<CustomerStaffDTO> customerStaffDTOResult = epmetUserFeignClient.getCustomerStaffInfo(customerStaffFormDTO);
if (!customerStaffDTOResult.success() || null == customerStaffDTOResult.getData()) { if (!customerStaffDTOResult.success() || null == customerStaffDTOResult.getData()) {
logger.error(String.format("获取工作人员信息失败,手机号[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg())); logger.warn(String.format("获取工作人员信息失败,手机号[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg()));
throw new RenException(customerStaffDTOResult.getCode()); throw new RenException(customerStaffDTOResult.getCode());
} }
CustomerStaffDTO customerStaff = customerStaffDTOResult.getData(); CustomerStaffDTO customerStaff = customerStaffDTOResult.getData();
@ -291,7 +291,7 @@ public class GovLoginServiceImpl implements GovLoginService {
@Override @Override
public void loginOut(TokenDto tokenDto) { public void loginOut(TokenDto tokenDto) {
if(null == tokenDto){ if(null == tokenDto){
logger.error("token解析失败,直接跳转重新登录即可"); logger.warn("token解析失败,直接跳转重新登录即可");
throw new RenException("当前用户信息获取失败"); throw new RenException("当前用户信息获取失败");
} }
cpUserDetailRedis.logout(tokenDto.getApp() , tokenDto.getClient() , tokenDto.getUserId()); cpUserDetailRedis.logout(tokenDto.getApp() , tokenDto.getClient() , tokenDto.getUserId());
@ -328,7 +328,7 @@ public class GovLoginServiceImpl implements GovLoginService {
//1、根据手机号查询到用户信息 //1、根据手机号查询到用户信息
Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile()); Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile());
if (!customerStaffResult.success()) { if (!customerStaffResult.success()) {
logger.error(String.format("手机密码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg())); logger.warn(String.format("手机密码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
throw new RenException(customerStaffResult.getCode()); throw new RenException(customerStaffResult.getCode());
} }
//2、密码是否正确 //2、密码是否正确
@ -357,7 +357,7 @@ public class GovLoginServiceImpl implements GovLoginService {
} }
//根据手机号查出来所有用户,密码都为空,表明用户未激活账户,未设置密码 //根据手机号查出来所有用户,密码都为空,表明用户未激活账户,未设置密码
if(!havePasswordFlag){ if(!havePasswordFlag){
logger.error(String.format("当前手机号(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getMobile())); logger.warn(String.format("当前手机号(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getMobile()));
throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode()); throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode());
} }
//密码错误 //密码错误
@ -371,7 +371,7 @@ public class GovLoginServiceImpl implements GovLoginService {
if(result.success()&&null!=result.getData()){ if(result.success()&&null!=result.getData()){
return result.getData(); return result.getData();
} }
logger.error(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,密码%s,返回错误码%s,错误提示信息%s", logger.warn(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,密码%s,返回错误码%s,错误提示信息%s",
ServiceConstant.GOV_ORG_SERVER, ServiceConstant.GOV_ORG_SERVER,
formDTO.getMobile(), formDTO.getMobile(),
formDTO.getPassword(), formDTO.getPassword(),
@ -466,7 +466,7 @@ public class GovLoginServiceImpl implements GovLoginService {
public String getOrgIdPath(String staffId) { public String getOrgIdPath(String staffId) {
Result<CustomerAgencyDTO> result = govOrgFeignClient.getAgencyByStaff(staffId); Result<CustomerAgencyDTO> result = govOrgFeignClient.getAgencyByStaff(staffId);
if (!result.success()) { if (!result.success()) {
logger.error("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg()); logger.warn("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg());
return null; return null;
} }
CustomerAgencyDTO agency = result.getData(); CustomerAgencyDTO agency = result.getData();
@ -484,7 +484,7 @@ public class GovLoginServiceImpl implements GovLoginService {
public CustomerAgencyDTO getAgencyByStaffId(String staffId) { public CustomerAgencyDTO getAgencyByStaffId(String staffId) {
Result<CustomerAgencyDTO> result = govOrgFeignClient.getAgencyByStaff(staffId); Result<CustomerAgencyDTO> result = govOrgFeignClient.getAgencyByStaff(staffId);
if (!result.success()) { if (!result.success()) {
logger.error("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg()); logger.warn("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg());
return null; return null;
} }
return result.getData(); return result.getData();

2
epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java

@ -479,7 +479,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
} }
//根据手机号查出来所有用户,密码都为空,表明用户未激活账户,未设置密码 //根据手机号查出来所有用户,密码都为空,表明用户未激活账户,未设置密码
if(!havePasswordFlag){ if(!havePasswordFlag){
logger.error(String.format("当前手机号(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getMobile())); logger.warn(String.format("当前手机号(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getMobile()));
throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode()); throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode());
} }
//密码错误 //密码错误

4
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerThirdplatApiServiceServiceImpl.java

@ -3,9 +3,9 @@ package com.epmet.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.CustomerThirdplatApiserviceDao; import com.epmet.dao.CustomerThirdplatApiserviceDao;
import com.epmet.dto.result.ThirdplatApiserviceResultDTO; import com.epmet.dto.result.ThirdplatApiserviceResultDTO;
import com.epmet.entity.CustomerThirdplatApiserviceEntity;
import com.epmet.service.CustomerThirdplatApiServiceService; import com.epmet.service.CustomerThirdplatApiServiceService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -29,7 +29,7 @@ public class CustomerThirdplatApiServiceServiceImpl implements CustomerThirdplat
// 查redis,存redis // 查redis,存redis
Map<String, Object> apiServiceMap = redisUtils.hGetAll(RedisKeys.getCustomerApiServiceKey(customerId)); Map<String, Object> apiServiceMap = redisUtils.hGetAll(RedisKeys.getCustomerApiServiceKey(customerId));
if (!CollectionUtils.isEmpty(apiServiceMap)) { if (!CollectionUtils.isEmpty(apiServiceMap)) {
apiService = BeanUtil.mapToBean(apiServiceMap, ThirdplatApiserviceResultDTO.class, true); apiService = ConvertUtils.mapToEntity(apiServiceMap, ThirdplatApiserviceResultDTO.class);
} }
if (apiService == null) { if (apiService == null) {

5
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -150,7 +151,9 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
logger.warn("queryUserBaseInfo return empty,userId:{}", userId); logger.warn("queryUserBaseInfo return empty,userId:{}", userId);
return null; return null;
} }
return userBaseInfoResultDTOS.get(0); UserBaseInfoResultDTO userBaseInfoResultDTO = userBaseInfoResultDTOS.get(0);
logger.debug("getUserResiInfoDTO userId:{},result:{}", userId,JSON.toJSONString(userBaseInfoResultDTO));
return userBaseInfoResultDTO;
} }
/** /**

23
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java

@ -173,17 +173,20 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
resultDTO.setDistrict(userBaseInfoResultDTO.getDistrict()); resultDTO.setDistrict(userBaseInfoResultDTO.getDistrict());
resultDTO.setBuildingAddress(userBaseInfoResultDTO.getBuildingAddress()); resultDTO.setBuildingAddress(userBaseInfoResultDTO.getBuildingAddress());
resultDTO.setNickName(userBaseInfoResultDTO.getNickname()); resultDTO.setNickName(userBaseInfoResultDTO.getNickname());
resultDTO.setShowName(StrConstant.EPMETY_STR);
String gender = null; if (StringUtils.isNotBlank(userBaseInfoResultDTO.getStreet()) && StringUtils.isNotBlank(userBaseInfoResultDTO.getSurname())){
if (NumConstant.ONE_STR.equals(userBaseInfoResultDTO.getGender())) { String gender = null;
gender = UserConstant.MAN; if (NumConstant.ONE_STR.equals(userBaseInfoResultDTO.getGender())) {
} else if (NumConstant.TWO_STR.equals(userBaseInfoResultDTO.getGender())) { gender = UserConstant.MAN;
gender = UserConstant.WOMAN; } else if (NumConstant.TWO_STR.equals(userBaseInfoResultDTO.getGender())) {
} else { gender = UserConstant.WOMAN;
gender = UserConstant.MAN_WOMAN; } else {
gender = UserConstant.MAN_WOMAN;
}
String leaderName = userBaseInfoResultDTO.getStreet().concat(StrConstant.HYPHEN).concat(userBaseInfoResultDTO.getSurname()).concat(gender);
resultDTO.setShowName(leaderName);
} }
String leaderName = userBaseInfoResultDTO.getStreet().concat(StrConstant.HYPHEN).concat(userBaseInfoResultDTO.getSurname()).concat(gender);
resultDTO.setShowName(leaderName);
resultDTO.setHeadPhoto(userBaseInfoResultDTO.getHeadImgUrl()); resultDTO.setHeadPhoto(userBaseInfoResultDTO.getHeadImgUrl());
return new Result<UserResiInfoResultDTO>().ok(resultDTO); return new Result<UserResiInfoResultDTO>().ok(resultDTO);
} }

Loading…
Cancel
Save