Commit cab11d26 authored by Java-刘 彧阳's avatar Java-刘 彧阳

Merge branch 'master' into log_without_phone

parents dab76508 b2a9fa67
...@@ -494,7 +494,7 @@ public class MotanUserServiceImpl implements UserMotanService { ...@@ -494,7 +494,7 @@ public class MotanUserServiceImpl implements UserMotanService {
xUserSpouse.setSpouseName(userSpouse.getSpouseName()); xUserSpouse.setSpouseName(userSpouse.getSpouseName());
xUserSpouse.setCreatedAt(userSpouse.getCreatedAt()); xUserSpouse.setCreatedAt(userSpouse.getCreatedAt());
xUserSpouse.setUpdateAt(userSpouse.getUpdateAt()); xUserSpouse.setUpdateAt(userSpouse.getUpdateAt());
xUserSpouse.setStatus(cn.quantgroup.motan.enums.MaritalStatus.valueOf(userSpouse.getStatus().name())); xUserSpouse.setStatus(cn.quantgroup.user.enums.MaritalStatus.valueOf(userSpouse.getStatus().name()));
return xUserSpouse; return xUserSpouse;
} }
...@@ -528,10 +528,10 @@ public class MotanUserServiceImpl implements UserMotanService { ...@@ -528,10 +528,10 @@ public class MotanUserServiceImpl implements UserMotanService {
if (xUserSpouse.getUserId() == null || xUserSpouse.getUserId() == 0) { if (xUserSpouse.getUserId() == null || xUserSpouse.getUserId() == 0) {
return returnErrorValue("用户不能为空"); return returnErrorValue("用户不能为空");
} }
cn.quantgroup.motan.enums.MaritalStatus status = xUserSpouse.getStatus(); cn.quantgroup.user.enums.MaritalStatus status = xUserSpouse.getStatus();
String spousePhone = xUserSpouse.getSpousePhone(); String spousePhone = xUserSpouse.getSpousePhone();
String spouseName = xUserSpouse.getSpouseName(); String spouseName = xUserSpouse.getSpouseName();
if (xUserSpouse.getStatus() == cn.quantgroup.motan.enums.MaritalStatus.MARRIED) { if (xUserSpouse.getStatus() == cn.quantgroup.user.enums.MaritalStatus.MARRIED) {
if (!ValidationUtil.validatePhoneNo(spousePhone)) { if (!ValidationUtil.validatePhoneNo(spousePhone)) {
return returnErrorValue("手机号格式错误"); return returnErrorValue("手机号格式错误");
} }
...@@ -545,8 +545,8 @@ public class MotanUserServiceImpl implements UserMotanService { ...@@ -545,8 +545,8 @@ public class MotanUserServiceImpl implements UserMotanService {
userSpouse = new UserSpouse(xUserSpouse.getUserId()); userSpouse = new UserSpouse(xUserSpouse.getUserId());
userSpouse.setCreatedAt(timestamp); userSpouse.setCreatedAt(timestamp);
} }
userSpouse.setSpouseName(status == cn.quantgroup.motan.enums.MaritalStatus.MARRIED ? spouseName : ""); userSpouse.setSpouseName(status == cn.quantgroup.user.enums.MaritalStatus.MARRIED ? spouseName : "");
userSpouse.setSpousePhone(status == cn.quantgroup.motan.enums.MaritalStatus.MARRIED ? spousePhone : ""); userSpouse.setSpousePhone(status == cn.quantgroup.user.enums.MaritalStatus.MARRIED ? spousePhone : "");
userSpouse.setStatus(MaritalStatus.valueOf(status.name())); userSpouse.setStatus(MaritalStatus.valueOf(status.name()));
userSpouse.setUpdateAt(timestamp); userSpouse.setUpdateAt(timestamp);
userSpouse = userSpouseService.save(userSpouse); userSpouse = userSpouseService.save(userSpouse);
......
...@@ -27,6 +27,7 @@ import java.text.ParseException; ...@@ -27,6 +27,7 @@ import java.text.ParseException;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* Created by Miraculous on 2016/12/19. * Created by Miraculous on 2016/12/19.
...@@ -476,6 +477,29 @@ public class InnerController implements IBaseController { ...@@ -476,6 +477,29 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult(null, UserSpouseRet.getUserSpouseRet(userSpouse)); return JsonResult.buildSuccessResult(null, UserSpouseRet.getUserSpouseRet(userSpouse));
} }
@RequestMapping("/user/findByPhones")
public JsonResult getUserIdByPhones(@RequestParam("userPhones")String userPhones){
//todo now
if(StringUtils.isBlank(userPhones)){
return JsonResult.buildErrorStateResult("传入用户手机号不可为空",null);
}
List<String> phones = JSONObject.parseObject(userPhones, new TypeReference<List<String>>() {});
if(org.apache.commons.collections.CollectionUtils.isNotEmpty(phones)) {
if(!(phones.size()>500)) {
List<User> users = userService.findByPhones(phones);
if(org.apache.commons.collections.CollectionUtils.isNotEmpty(users)) {
return JsonResult.buildSuccessResult(null, users.stream().map(User::getId).collect(Collectors.toList()));
}else {
return JsonResult.buildSuccessResult(null, null);
}
}
return JsonResult.buildErrorStateResult("单次批量查询不可超过500个手机号",null);
}
return JsonResult.buildErrorStateResult("传入用户手机号不可为空",null);
}
/** /**
* 重置密码接口,供内部人员使用(例如绝影) * 重置密码接口,供内部人员使用(例如绝影)
* @param key * @param key
......
...@@ -75,10 +75,10 @@ public class UserDetail implements Serializable { ...@@ -75,10 +75,10 @@ public class UserDetail implements Serializable {
xUserDetail.setName(this.getName()); xUserDetail.setName(this.getName());
xUserDetail.setIdNo(this.getIdNo()); xUserDetail.setIdNo(this.getIdNo());
if (this.getIdType() != null) { if (this.getIdType() != null) {
xUserDetail.setIdType(cn.quantgroup.motan.enums.IdType.valueOf(this.getIdType().name())); xUserDetail.setIdType(cn.quantgroup.user.enums.IdType.valueOf(this.getIdType().name()));
} }
if (this.getGender() != null) { if (this.getGender() != null) {
xUserDetail.setGender(cn.quantgroup.motan.enums.Gender.valueOf(this.getGender().name())); xUserDetail.setGender(cn.quantgroup.user.enums.Gender.valueOf(this.getGender().name()));
} }
xUserDetail.setEmail(this.getEmail()); xUserDetail.setEmail(this.getEmail());
xUserDetail.setQq(this.getQq()); xUserDetail.setQq(this.getQq());
......
...@@ -32,4 +32,5 @@ public interface IUserService { ...@@ -32,4 +32,5 @@ public interface IUserService {
User findById(Long userId); User findById(Long userId);
List<User> findByPhones(List<String> phones);
} }
...@@ -7,6 +7,7 @@ import cn.quantgroup.xyqb.service.sms.ISmsService; ...@@ -7,6 +7,7 @@ import cn.quantgroup.xyqb.service.sms.ISmsService;
import cn.quantgroup.xyqb.service.user.ILkbUserService; import cn.quantgroup.xyqb.service.user.ILkbUserService;
import cn.quantgroup.xyqb.service.user.IUserService; import cn.quantgroup.xyqb.service.user.IUserService;
import cn.quantgroup.xyqb.util.PasswordUtil; import cn.quantgroup.xyqb.util.PasswordUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -17,6 +18,7 @@ import org.springframework.data.redis.core.RedisTemplate; ...@@ -17,6 +18,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.persistence.criteria.Predicate;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
...@@ -88,6 +90,14 @@ public class UserServiceImpl implements IUserService { ...@@ -88,6 +90,14 @@ public class UserServiceImpl implements IUserService {
return userRepository.findById(userId); return userRepository.findById(userId);
} }
@Override
public List<User> findByPhones(List<String> phones) {
return userRepository.findAll((root, query, cb) -> {
query.where(root.get("phoneNo").as(String.class).in(phones));
return query.getRestriction();
});
}
@Override @Override
public User registerAndReturn(String phoneNo, String password, Long registerFrom) { public User registerAndReturn(String phoneNo, String password, Long registerFrom) {
......
...@@ -68,10 +68,10 @@ public class UserDetailVO { ...@@ -68,10 +68,10 @@ public class UserDetailVO {
xUserDetail.setName(this.getName()); xUserDetail.setName(this.getName());
xUserDetail.setIdNo(this.getIdNo()); xUserDetail.setIdNo(this.getIdNo());
if (this.getIdType() != null) { if (this.getIdType() != null) {
xUserDetail.setIdType(cn.quantgroup.motan.enums.IdType.valueOf(this.getIdType().name())); xUserDetail.setIdType(cn.quantgroup.user.enums.IdType.valueOf(this.getIdType().name()));
} }
if (this.getGender() != null) { if (this.getGender() != null) {
xUserDetail.setGender(cn.quantgroup.motan.enums.Gender.valueOf(this.getGender().name())); xUserDetail.setGender(cn.quantgroup.user.enums.Gender.valueOf(this.getGender().name()));
} }
xUserDetail.setEmail(this.getEmail()); xUserDetail.setEmail(this.getEmail());
xUserDetail.setQq(this.getQq()); xUserDetail.setQq(this.getQq());
......
server.port=8080 server.port=8082
security.sessions=if_required security.sessions=if_required
spring.aop.proxy-target-class=true spring.aop.proxy-target-class=true
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment