package com.xzx.gc.pay.service;
|
|
import com.xzx.gc.common.constant.CommonEnum;
|
import com.xzx.gc.common.constant.Constants;
|
import com.xzx.gc.common.utils.BusinessUtil;
|
import com.xzx.gc.entity.OtherUserInfo;
|
import com.xzx.gc.entity.UserInfo;
|
import com.xzx.gc.pay.mapper.UserMapper;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@Service
|
@Transactional
|
public class UserService {
|
|
@Autowired
|
private UserMapper userMapper;
|
|
@Autowired
|
private OtherUserService otherUserService;
|
|
@Autowired
|
private HttpServletRequest request;
|
@Autowired
|
private BusinessUtil businessUtil;
|
|
public UserInfo findByMobile(String mobilePhone){
|
UserInfo userInfo = new UserInfo();
|
userInfo.setMobilePhone(mobilePhone);
|
userInfo.setDelFlag(Constants.DEL_NOT_FLAG);
|
userInfo.setIsProhibit(false);
|
UserInfo userInfo1 = userMapper.selectOne(userInfo);
|
return userInfo1;
|
}
|
|
public UserInfo findById(String userId){
|
UserInfo userInfo1 = userMapper.selectByPrimaryKey(userId);
|
return userInfo1;
|
}
|
|
/**
|
* 查询手机号码
|
* @param userId
|
* @param type 类型 0普通用户 1平台用户
|
* @return
|
*/
|
public String findOtherByUserId(String userId,int type){
|
if (businessUtil.isApp(request.getHeader("clientType"))) {
|
OtherUserInfo byId = otherUserService.findById(userId);
|
if(byId!=null)return byId.getMobilePhone();
|
}else{
|
UserInfo byId = findById(userId);
|
if(byId!=null)return byId.getMobilePhone();
|
}
|
|
|
return "未知";
|
|
}
|
}
|