Commit 95b766b6 authored by 李健华's avatar 李健华

修改需要更新的接口

parent e0c6fe5e
package cn.quantgroup.xyqb.controller.internal.querylog; package cn.quantgroup.xyqb.controller.internal.querylog;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.quantgroup.xyqb.exception.UserQueryLogException;
import cn.quantgroup.xyqb.util.encrypt.Rsa;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.google.gson.*;
import io.swagger.annotations.ApiOperation;
import cn.quantgroup.xyqb.Constants; import cn.quantgroup.xyqb.Constants;
import cn.quantgroup.xyqb.entity.Address; import cn.quantgroup.xyqb.entity.Address;
import cn.quantgroup.xyqb.entity.UserDetail; import cn.quantgroup.xyqb.entity.UserDetail;
import cn.quantgroup.xyqb.entity.UserQueryLog; import cn.quantgroup.xyqb.entity.UserQueryLog;
import cn.quantgroup.xyqb.exception.UserQueryLogException;
import cn.quantgroup.xyqb.model.JsonResult; import cn.quantgroup.xyqb.model.JsonResult;
import cn.quantgroup.xyqb.model.PageModel; import cn.quantgroup.xyqb.model.PageModel;
import cn.quantgroup.xyqb.model.UserQueryInfo; import cn.quantgroup.xyqb.model.UserQueryInfo;
...@@ -39,6 +15,26 @@ import cn.quantgroup.xyqb.service.user.IUserQueryLogService; ...@@ -39,6 +15,26 @@ import cn.quantgroup.xyqb.service.user.IUserQueryLogService;
import cn.quantgroup.xyqb.util.IdcardValidator; import cn.quantgroup.xyqb.util.IdcardValidator;
import cn.quantgroup.xyqb.util.ValidationUtil; import cn.quantgroup.xyqb.util.ValidationUtil;
import cn.quantgroup.xyqb.util.encrypt.Md5Util; import cn.quantgroup.xyqb.util.encrypt.Md5Util;
import cn.quantgroup.xyqb.util.encrypt.Rsa;
import com.google.gson.*;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
/** /**
* Created by zenglibin on 17/06/13. * Created by zenglibin on 17/06/13.
...@@ -129,7 +125,7 @@ public class UserQueryLogController { ...@@ -129,7 +125,7 @@ public class UserQueryLogController {
/** /**
* @yapi http://yapi.quantgroups.com/project/17/interface/api/261 * @yapi http://yapi.quantgroups.com/project/17/interface/api/261
*/ */
@RequestMapping("/queryUserInfo") // @RequestMapping("/queryUserInfo")
@ApiOperation(value = "给运营系统提供的查询用户信息的接口", notes = "给运营系统提供的查询用户信息的接口", httpMethod = "POST") @ApiOperation(value = "给运营系统提供的查询用户信息的接口", notes = "给运营系统提供的查询用户信息的接口", httpMethod = "POST")
public JsonResult queryForResult(HttpServletRequest request, String key, String keyValues, String columns, Integer pageId, Integer pageSize) { public JsonResult queryForResult(HttpServletRequest request, String key, String keyValues, String columns, Integer pageId, Integer pageSize) {
String token = request.getHeader(Constants.X_AUTH_TOKEN); String token = request.getHeader(Constants.X_AUTH_TOKEN);
......
...@@ -187,8 +187,6 @@ public class AppController implements IBaseController { ...@@ -187,8 +187,6 @@ public class AppController implements IBaseController {
* 发现新手机号,自动执行注册 * 发现新手机号,自动执行注册
* *
* @param phoneNo - 手机号 * @param phoneNo - 手机号
* @param idNo - 用户身份证号
* @param name - 用户姓名
* @param key - merchant表的name属性(跳转相关) * @param key - merchant表的name属性(跳转相关)
* @param btRegisterChannelId - 白条注册渠道id * @param btRegisterChannelId - 白条注册渠道id
* @param registerFrom - 注册渠道(第一次用户来源channelId) * @param registerFrom - 注册渠道(第一次用户来源channelId)
...@@ -197,13 +195,14 @@ public class AppController implements IBaseController { ...@@ -197,13 +195,14 @@ public class AppController implements IBaseController {
* @param request * @param request
* @return 用户信息 * @return 用户信息
* @yapi http://yapi.quantgroups.com/project/17/interface/api/173 * @yapi http://yapi.quantgroups.com/project/17/interface/api/173
* @yapi 合规 http://yapi.quantgroups.com/project/17/interface/api/30450
*/ */
@IpValidator @IpValidator
@RequestMapping("/login_super") @RequestMapping("/login_super")
@ApiOperation(value = "免密登陆, 新手机号还自动注册", notes = "免密登陆, 新手机号还自动注册", httpMethod = "POST") @ApiOperation(value = "免密登陆, 新手机号还自动注册", notes = "免密登陆, 新手机号还自动注册", httpMethod = "POST")
public JsonResult loginSuper( public JsonResult loginSuper(
String phoneNo, String phoneNo,
String idNo, String name, String key, String key,
@RequestParam(required = false) Long btRegisterChannelId, @RequestParam(required = false) Long btRegisterChannelId,
@RequestParam(required = false, defaultValue = "1") Long registerFrom, @RequestParam(required = false, defaultValue = "1") Long registerFrom,
@RequestParam(required = false, defaultValue = "1") Long channelId, @RequestParam(required = false, defaultValue = "1") Long channelId,
...@@ -216,12 +215,12 @@ public class AppController implements IBaseController { ...@@ -216,12 +215,12 @@ public class AppController implements IBaseController {
if (!ValidationUtil.validatePhoneNo(phoneNo)) { if (!ValidationUtil.validatePhoneNo(phoneNo)) {
return JsonResult.buildErrorStateResult(USER_ERROR_OR_PASSWORD_ERROR, null); return JsonResult.buildErrorStateResult(USER_ERROR_OR_PASSWORD_ERROR, null);
} }
log.info("第三方用户登录 [AppController] loginSuper --> loginFrom:{},phoneNo:{},appChannel:{},channelId:{},btRegisterChannelId:{} requestIp:{},idNo:{},name:{}", registerFrom, phoneNo, appChannel, channelId, btRegisterChannelId, IpUtil.getRemoteIP(request), idNo, name); log.info("第三方用户登录 [AppController] loginSuper --> loginFrom:{},phoneNo:{},appChannel:{},channelId:{},btRegisterChannelId:{} requestIp:{}", registerFrom, phoneNo, appChannel, channelId, btRegisterChannelId, IpUtil.getRemoteIP(request));
User user = userService.findByPhoneInDb(phoneNo); User user = userService.findByPhoneInDb(phoneNo);
boolean isRegister=false; boolean isRegister=false;
if (user == null) { if (user == null) {
try { try {
user = userRegisterService.register(registerFrom, phoneNo, idNo, name, channelId, btRegisterChannelId); user = userRegisterService.register(registerFrom, phoneNo, channelId, btRegisterChannelId);
isRegister=true; isRegister=true;
} catch (PersistenceException e) { } catch (PersistenceException e) {
user = userService.findByPhoneInDb(phoneNo); user = userService.findByPhoneInDb(phoneNo);
......
...@@ -199,11 +199,12 @@ public class InnerController implements IBaseController { ...@@ -199,11 +199,12 @@ public class InnerController implements IBaseController {
} }
/** /**
* @yapi unknown * @yapi http://yapi.quantgroups.com/project/17/interface/api/30452
*/ */
//与旧的区别就是新的如果返回多个的时候只取最新的 //与旧的区别就是新的如果返回多个的时候只取最新的
@GetMapping("/user/search/hash2") @GetMapping("/user/search/hash2")
@ApiOperation(httpMethod = "GET", value = "根据md5(手机号)或md5(身份证号)查询用户信息") // @ApiOperation(httpMethod = "GET", value = "根据md5(手机号)或md5(身份证号)查询用户信息")
@ApiOperation(httpMethod = "GET", value = "根据md5(手机号)查询用户信息")
public JsonResult findByHash(@RequestParam String md5Value, public JsonResult findByHash(@RequestParam String md5Value,
@RequestParam(defaultValue = "1") Integer type, @RequestParam(defaultValue = "1") Integer type,
@RequestParam(required = false) Integer tenantId) { @RequestParam(required = false) Integer tenantId) {
...@@ -214,6 +215,10 @@ public class InnerController implements IBaseController { ...@@ -214,6 +215,10 @@ public class InnerController implements IBaseController {
return JsonResult.buildErrorStateResult("参数长度有误", null); return JsonResult.buildErrorStateResult("参数长度有误", null);
} }
if (FindByMd5Enum.PHONENO.getType() != type) {
return JsonResult.buildErrorStateResult("不支持查询类型,只支持手机", null);
}
User user = userService.findByMd5New(type, md5Value); User user = userService.findByMd5New(type, md5Value);
if (user == null) { if (user == null) {
return JsonResult.buildSuccessResult("", null); return JsonResult.buildSuccessResult("", null);
......
...@@ -3,30 +3,21 @@ package cn.quantgroup.xyqb.controller.modifyphoneno; ...@@ -3,30 +3,21 @@ package cn.quantgroup.xyqb.controller.modifyphoneno;
import cn.quantgroup.xyqb.controller.IBaseController; import cn.quantgroup.xyqb.controller.IBaseController;
import cn.quantgroup.xyqb.controller.modifyphoneno.req.AuditReq; import cn.quantgroup.xyqb.controller.modifyphoneno.req.AuditReq;
import cn.quantgroup.xyqb.controller.modifyphoneno.req.ModifyPhoneNoQueryReq; import cn.quantgroup.xyqb.controller.modifyphoneno.req.ModifyPhoneNoQueryReq;
import cn.quantgroup.xyqb.controller.modifyphoneno.req.Step1Req; import cn.quantgroup.xyqb.controller.modifyphoneno.req.Step1ComplianceReq;
import cn.quantgroup.xyqb.controller.modifyphoneno.req.Step2Req; import cn.quantgroup.xyqb.controller.modifyphoneno.req.Step2Req;
import cn.quantgroup.xyqb.controller.modifyphoneno.resp.ProgressResp; import cn.quantgroup.xyqb.controller.modifyphoneno.resp.ProgressResp;
import cn.quantgroup.xyqb.entity.ModifyPhoneNo; import cn.quantgroup.xyqb.entity.ModifyPhoneNo;
import cn.quantgroup.xyqb.entity.User; import cn.quantgroup.xyqb.entity.User;
import cn.quantgroup.xyqb.model.JsonResult; import cn.quantgroup.xyqb.model.JsonResult;
import cn.quantgroup.xyqb.service.user.IModifyPhoneNoService; import cn.quantgroup.xyqb.service.user.IModifyPhoneNoService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationConfig;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
/** /**
...@@ -64,12 +55,12 @@ public class ModifyPhoneNoController implements IBaseController { ...@@ -64,12 +55,12 @@ public class ModifyPhoneNoController implements IBaseController {
*/ */
@ApiOperation("app - 申请修改手机号Step_1") @ApiOperation("app - 申请修改手机号Step_1")
@PostMapping("/step_1") @PostMapping("/step_1")
public JsonResult step1(@Valid @RequestBody Step1Req step1Req) { public JsonResult step1(@Valid @RequestBody Step1ComplianceReq step1ComplianceReq) {
User user = getCurrentUserFromRedis(); User user = getCurrentUserFromRedis();
if (user == null) { if (user == null) {
return JsonResult.buildErrorStateResult("系统错误", null); return JsonResult.buildErrorStateResult("系统错误", null);
} }
return JsonResult.buildSuccessResultGeneric(modifyPhoneNoService.saveStep1(user.getId(), step1Req)); return JsonResult.buildSuccessResultGeneric(modifyPhoneNoService.saveStep1Compliance(user.getId(), step1ComplianceReq));
} }
/** /**
......
package cn.quantgroup.xyqb.controller.modifyphoneno.req;
import cn.quantgroup.xyqb.entity.ModifyPhoneNo;
import cn.quantgroup.xyqb.util.ValidationUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.beans.BeanUtils;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
/**
* Date: 2019/11/4
* Time: 上午11:29
*
* @author: yangrui
*/
@Data
public class Step1ComplianceReq implements Serializable {
private static final long serialVersionUID = 3072182423041383540L;
/**
* 当前手机号码
*/
@ApiModelProperty("当前手机号码")
@NotBlank(message = "当前手机号码不能为空")
@Pattern(regexp = ValidationUtil.phoneRegExp, message = "当前手机号码格式错误")
private String prevPhoneNo;
/**
* 新手机号码
*/
@ApiModelProperty("新手机号码")
@NotBlank(message = "新手机号码不能为空")
@Pattern(regexp = ValidationUtil.phoneRegExp, message = "新手机号码格式错误")
private String curPhoneNo;
/**
* 新手机号码短信验证码
*/
@ApiModelProperty("新手机号码短信验证码")
@NotBlank(message = "新手机号码短信验证码不能为空")
private String smsCode;
public static ModifyPhoneNo adapt(Step1ComplianceReq step1Req) {
ModifyPhoneNo modifyPhoneNo = new ModifyPhoneNo();
BeanUtils.copyProperties(step1Req, modifyPhoneNo);
return modifyPhoneNo ;
}
}
...@@ -28,17 +28,17 @@ public class ModifyPhoneNo extends BaseEntity implements Serializable { ...@@ -28,17 +28,17 @@ public class ModifyPhoneNo extends BaseEntity implements Serializable {
@Column(name = "user_id") @Column(name = "user_id")
private Long userId; private Long userId;
/** // /**
* 注册人真实姓名 // * 注册人真实姓名
*/ // */
private String name; // private String name;
//
/** // /**
* 注册人身份证件号 // * 注册人身份证件号
*/ // */
@Column(name = "id_card") // @Column(name = "id_card")
private String idCard; // private String idCard;
//
/** /**
* 原手机号码 * 原手机号码
*/ */
...@@ -51,23 +51,23 @@ public class ModifyPhoneNo extends BaseEntity implements Serializable { ...@@ -51,23 +51,23 @@ public class ModifyPhoneNo extends BaseEntity implements Serializable {
@Column(name = "cur_phone_no") @Column(name = "cur_phone_no")
private String curPhoneNo; private String curPhoneNo;
/** // /**
* 身份证正面 // * 身份证正面
*/ // */
@Column(name = "id_card_face_url") // @Column(name = "id_card_face_url")
private String idCardFaceUrl; // private String idCardFaceUrl;
//
/** // /**
* 身份证背面 // * 身份证背面
*/ // */
@Column(name = "id_card_rear_url") // @Column(name = "id_card_rear_url")
private String idCardRearUrl; // private String idCardRearUrl;
//
/** // /**
* 本人手持身份证照片 // * 本人手持身份证照片
*/ // */
@Column(name = "id_card_hold_url") // @Column(name = "id_card_hold_url")
private String idCardHoldUrl; // private String idCardHoldUrl;
/** /**
* 申请状态 0处理中; 1修改完成; 2不允许修改; * 申请状态 0处理中; 1修改完成; 2不允许修改;
......
...@@ -18,7 +18,7 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long>, ...@@ -18,7 +18,7 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long>,
UserDetail findByUserId(Long userId); UserDetail findByUserId(Long userId);
UserDetail findByPhoneNo(String phone); UserDetail findByPhoneNo(String phoneNo);
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Modifying @Modifying
...@@ -67,4 +67,5 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long>, ...@@ -67,4 +67,5 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long>,
List<UserDetail> findByIdBetween(Long id, Long endId); List<UserDetail> findByIdBetween(Long id, Long endId);
UserDetail findByUserIdAndPhoneNoAndNameAndIdNo(Long userId, String phoneNo, String name, String idNo); UserDetail findByUserIdAndPhoneNoAndNameAndIdNo(Long userId, String phoneNo, String name, String idNo);
UserDetail findByUserIdAndPhoneNo(Long userId, String phoneNo);
} }
...@@ -27,6 +27,8 @@ public interface IUserRegisterService { ...@@ -27,6 +27,8 @@ public interface IUserRegisterService {
* @param btRegisterChannelId * @param btRegisterChannelId
* @return * @return
*/ */
User register(Long registerFrom, String phoneNo, Long channelId, Long btRegisterChannelId);
User register(Long registerFrom, String phoneNo, String idNo, String name, Long channelId, Long btRegisterChannelId); User register(Long registerFrom, String phoneNo, String idNo, String name, Long channelId, Long btRegisterChannelId);
User register(Long registerFrom, String phoneNo, String idNo, String name, Long channelId, Long btRegisterChannelId, Integer tenantId); User register(Long registerFrom, String phoneNo, String idNo, String name, Long channelId, Long btRegisterChannelId, Integer tenantId);
......
...@@ -88,6 +88,23 @@ import java.util.UUID; ...@@ -88,6 +88,23 @@ import java.util.UUID;
return user; return user;
} }
@Transactional(rollbackFor = Exception.class)
@Override
public User register(Long registerFrom, String phoneNo, Long channelId, Long btRegisterChannelId) {
UserRegisterParam userRegisterParam = UserRegisterParam.builder()
.registerFrom(registerFrom)
.phoneNo(phoneNo)
.channelId(channelId)
.btRegisterChannelId(btRegisterChannelId)
.sendSuccessSms(true)
.sendAppSms(true)
.sendSuccessMq(true)
.build();
User user = saveUser(userRegisterParam);
applicationEventPublisher.publishEvent(new RegisterEvent(this, userRegisterParam));
return user;
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public User register(Long registerFrom, String phoneNo, String idNo, String name, Long channelId, Long btRegisterChannelId, Integer tenantId) { public User register(Long registerFrom, String phoneNo, String idNo, String name, Long channelId, Long btRegisterChannelId, Integer tenantId) {
......
package cn.quantgroup.xyqb.service.user; package cn.quantgroup.xyqb.service.user;
import cn.quantgroup.xyqb.controller.modifyphoneno.req.AuditReq; import cn.quantgroup.xyqb.controller.modifyphoneno.req.*;
import cn.quantgroup.xyqb.controller.modifyphoneno.req.ModifyPhoneNoQueryReq;
import cn.quantgroup.xyqb.controller.modifyphoneno.req.Step1Req;
import cn.quantgroup.xyqb.controller.modifyphoneno.req.Step2Req;
import cn.quantgroup.xyqb.controller.modifyphoneno.resp.ProgressResp; import cn.quantgroup.xyqb.controller.modifyphoneno.resp.ProgressResp;
import cn.quantgroup.xyqb.entity.ModifyPhoneNo; import cn.quantgroup.xyqb.entity.ModifyPhoneNo;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
...@@ -33,4 +30,6 @@ public interface IModifyPhoneNoService { ...@@ -33,4 +30,6 @@ public interface IModifyPhoneNoService {
void feedback(Long id); void feedback(Long id);
void audit(AuditReq auditReq); void audit(AuditReq auditReq);
Long saveStep1Compliance(Long id, Step1ComplianceReq step1ComplianceReq);
} }
package cn.quantgroup.xyqb.service.user.impl; package cn.quantgroup.xyqb.service.user.impl;
import cn.quantgroup.xyqb.model.ModifyPhoneNoApplyStatusEnum;
import cn.quantgroup.xyqb.model.ModifyPhoneNoProcessingStatusEnum;
import cn.quantgroup.xyqb.aspect.limit.AccessLimit; import cn.quantgroup.xyqb.aspect.limit.AccessLimit;
import cn.quantgroup.xyqb.controller.modifyphoneno.req.AuditReq; import cn.quantgroup.xyqb.controller.modifyphoneno.req.*;
import cn.quantgroup.xyqb.controller.modifyphoneno.req.ModifyPhoneNoQueryReq;
import cn.quantgroup.xyqb.controller.modifyphoneno.req.Step1Req;
import cn.quantgroup.xyqb.controller.modifyphoneno.req.Step2Req;
import cn.quantgroup.xyqb.controller.modifyphoneno.resp.ProgressResp; import cn.quantgroup.xyqb.controller.modifyphoneno.resp.ProgressResp;
import cn.quantgroup.xyqb.entity.ModifyPhoneNo; import cn.quantgroup.xyqb.entity.ModifyPhoneNo;
import cn.quantgroup.xyqb.exception.DataException; import cn.quantgroup.xyqb.exception.DataException;
import cn.quantgroup.xyqb.model.JsonResult; import cn.quantgroup.xyqb.model.JsonResult;
import cn.quantgroup.xyqb.model.ModifyPhoneNoApplyStatusEnum;
import cn.quantgroup.xyqb.model.ModifyPhoneNoProcessingStatusEnum;
import cn.quantgroup.xyqb.repository.IModifyPhoneNoRepository; import cn.quantgroup.xyqb.repository.IModifyPhoneNoRepository;
import cn.quantgroup.xyqb.repository.IUserDetailRepository; import cn.quantgroup.xyqb.repository.IUserDetailRepository;
import cn.quantgroup.xyqb.repository.IUserRepository; import cn.quantgroup.xyqb.repository.IUserRepository;
...@@ -36,8 +33,10 @@ import org.springframework.stereotype.Service; ...@@ -36,8 +33,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.persistence.criteria.*; import javax.persistence.criteria.CriteriaBuilder;
import java.util.Date; import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.util.List; import java.util.List;
/** /**
...@@ -97,9 +96,9 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService { ...@@ -97,9 +96,9 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
if (modifyPhoneNo == null) { if (modifyPhoneNo == null) {
throw new DataException("数据不存在。"); throw new DataException("数据不存在。");
} }
modifyPhoneNo.setIdCardFaceUrl(step2Req.getIdCardFaceUrl()); // modifyPhoneNo.setIdCardFaceUrl(step2Req.getIdCardFaceUrl());
modifyPhoneNo.setIdCardRearUrl(step2Req.getIdCardRearUrl()); // modifyPhoneNo.setIdCardRearUrl(step2Req.getIdCardRearUrl());
modifyPhoneNo.setIdCardHoldUrl(step2Req.getIdCardHoldUrl()); // modifyPhoneNo.setIdCardHoldUrl(step2Req.getIdCardHoldUrl());
modifyPhoneNo.setApplyStatus(ModifyPhoneNoApplyStatusEnum.INIT.ordinal()); modifyPhoneNo.setApplyStatus(ModifyPhoneNoApplyStatusEnum.INIT.ordinal());
modifyPhoneNo.setProcessingStatus(ModifyPhoneNoProcessingStatusEnum.INIT.ordinal()); modifyPhoneNo.setProcessingStatus(ModifyPhoneNoProcessingStatusEnum.INIT.ordinal());
} }
...@@ -118,15 +117,15 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService { ...@@ -118,15 +117,15 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
progressResp.setProgress(0); progressResp.setProgress(0);
return progressResp; return progressResp;
} }
if (StringUtils.isBlank(modifyPhoneNo.getIdCardFaceUrl()) && StringUtils.isBlank(modifyPhoneNo.getIdCardRearUrl()) && StringUtils.isBlank(modifyPhoneNo.getIdCardHoldUrl())) { // if (StringUtils.isBlank(modifyPhoneNo.getIdCardFaceUrl()) && StringUtils.isBlank(modifyPhoneNo.getIdCardRearUrl()) && StringUtils.isBlank(modifyPhoneNo.getIdCardHoldUrl())) {
progressResp.setProgress(1); // progressResp.setProgress(1);
progressResp.setId(modifyPhoneNo.getId()); // progressResp.setId(modifyPhoneNo.getId());
return progressResp; // return progressResp;
} // }
if (StringUtils.isNotBlank(modifyPhoneNo.getIdCardFaceUrl()) && StringUtils.isNotBlank(modifyPhoneNo.getIdCardRearUrl()) && StringUtils.isNotBlank(modifyPhoneNo.getIdCardHoldUrl())) { // if (StringUtils.isNotBlank(modifyPhoneNo.getIdCardFaceUrl()) && StringUtils.isNotBlank(modifyPhoneNo.getIdCardRearUrl()) && StringUtils.isNotBlank(modifyPhoneNo.getIdCardHoldUrl())) {
progressResp.setProgress(2); // progressResp.setProgress(2);
return progressResp; // return progressResp;
} // }
progressResp.setProgress(-1); progressResp.setProgress(-1);
return progressResp; return progressResp;
} }
...@@ -166,15 +165,15 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService { ...@@ -166,15 +165,15 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
if (CollectionUtils.isNotEmpty(modifyPhoneNos)) { if (CollectionUtils.isNotEmpty(modifyPhoneNos)) {
modifyPhoneNos.forEach(modifyPhoneNo -> { modifyPhoneNos.forEach(modifyPhoneNo -> {
Auth auth = Auth.create(accessKey, secretKey); Auth auth = Auth.create(accessKey, secretKey);
if (StringUtils.isNotBlank(modifyPhoneNo.getIdCardFaceUrl())) { // if (StringUtils.isNotBlank(modifyPhoneNo.getIdCardFaceUrl())) {
modifyPhoneNo.setIdCardFaceUrl(auth.privateDownloadUrl(modifyPhoneNo.getIdCardFaceUrl())); // modifyPhoneNo.setIdCardFaceUrl(auth.privateDownloadUrl(modifyPhoneNo.getIdCardFaceUrl()));
} // }
if (StringUtils.isNotBlank(modifyPhoneNo.getIdCardRearUrl())) { // if (StringUtils.isNotBlank(modifyPhoneNo.getIdCardRearUrl())) {
modifyPhoneNo.setIdCardRearUrl(auth.privateDownloadUrl(modifyPhoneNo.getIdCardRearUrl())); // modifyPhoneNo.setIdCardRearUrl(auth.privateDownloadUrl(modifyPhoneNo.getIdCardRearUrl()));
} // }
if (StringUtils.isNotBlank(modifyPhoneNo.getIdCardHoldUrl())) { // if (StringUtils.isNotBlank(modifyPhoneNo.getIdCardHoldUrl())) {
modifyPhoneNo.setIdCardHoldUrl(auth.privateDownloadUrl(modifyPhoneNo.getIdCardHoldUrl())); // modifyPhoneNo.setIdCardHoldUrl(auth.privateDownloadUrl(modifyPhoneNo.getIdCardHoldUrl()));
} // }
}); });
} }
return page; return page;
...@@ -206,10 +205,13 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService { ...@@ -206,10 +205,13 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
modifyPhoneNo.setProcessingStatus(ModifyPhoneNoProcessingStatusEnum.WAIT_4_USER_FEEDBACK.ordinal()); modifyPhoneNo.setProcessingStatus(ModifyPhoneNoProcessingStatusEnum.WAIT_4_USER_FEEDBACK.ordinal());
} }
if (ModifyPhoneNoApplyStatusEnum.DONE == auditReq.getApplyStatus()) { if (ModifyPhoneNoApplyStatusEnum.DONE == auditReq.getApplyStatus()) {
log.info("audit userId = 【{}】, name = 【{}】, idCard = 【{}】, prevPhoneNo = 【{}】, " + // log.info("audit userId = 【{}】, name = 【{}】, idCard = 【{}】, prevPhoneNo = 【{}】, " +
"curPhoneNo = 【{}】", modifyPhoneNo.getUserId(), modifyPhoneNo.getName(), modifyPhoneNo.getIdCard(), modifyPhoneNo.getPrevPhoneNo(), modifyPhoneNo.getCurPhoneNo()); // "curPhoneNo = 【{}】", modifyPhoneNo.getUserId(), modifyPhoneNo.getName(), modifyPhoneNo.getIdCard(), modifyPhoneNo.getPrevPhoneNo(), modifyPhoneNo.getCurPhoneNo());
if (userDetailRepository.findByUserIdAndPhoneNoAndNameAndIdNo(modifyPhoneNo.getUserId(), modifyPhoneNo.getPrevPhoneNo(), modifyPhoneNo.getName(), modifyPhoneNo.getIdCard()) == null) { // if (userDetailRepository.findByUserIdAndPhoneNoAndNameAndIdNo(modifyPhoneNo.getUserId(), modifyPhoneNo.getPrevPhoneNo(), modifyPhoneNo.getName(), modifyPhoneNo.getIdCard()) == null) {
throw new DataException("姓名、身份证、电话号不符。"); // throw new DataException("姓名、身份证、电话号不符。");
// }
if (userDetailRepository.findByUserIdAndPhoneNo(modifyPhoneNo.getUserId(), modifyPhoneNo.getPrevPhoneNo()) == null) {
throw new DataException("电话号不符。");
} }
if (userRepository.findByPhoneNo(modifyPhoneNo.getCurPhoneNo()) != null) { if (userRepository.findByPhoneNo(modifyPhoneNo.getCurPhoneNo()) != null) {
throw new DataException("新手机号已存在,不支持更换。"); throw new DataException("新手机号已存在,不支持更换。");
...@@ -221,6 +223,16 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService { ...@@ -221,6 +223,16 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
} }
} }
@Override
public Long saveStep1Compliance(Long userId, Step1ComplianceReq step1ComplianceReq) {
allowModify4Step1Compliance(userId, step1ComplianceReq.getPrevPhoneNo(), step1ComplianceReq.getCurPhoneNo(),
step1ComplianceReq.getSmsCode());
ModifyPhoneNo modifyPhoneNo = Step1ComplianceReq.adapt(step1ComplianceReq);
modifyPhoneNo.setUserId(userId);
modifyPhoneNoRepository.saveAndFlush(modifyPhoneNo);
return modifyPhoneNo.getId();
}
/** /**
* 验证用户是否允许修改手机号 * 验证用户是否允许修改手机号
* <p> * <p>
...@@ -256,6 +268,24 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService { ...@@ -256,6 +268,24 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
checkLoanStatus(userId); checkLoanStatus(userId);
} }
public void allowModify4Step1Compliance(Long userId, String prevPhoneNo, String curPhoneNo, String smsCode) {
log.info("allowModify4Step1 userId = 【{}】, prevPhoneNo = 【{}】, " +
"curPhoneNo = 【{}】, smsCode = 【{}】", userId, prevPhoneNo, curPhoneNo, smsCode);
if (modifyPhoneNoRepository.findFirstByUserIdAndApplyStatus(userId, ModifyPhoneNoProcessingStatusEnum.INIT.ordinal()) != null) {
throw new DataException("已存在处理中的申请单,不支持再次更换。");
}
if (!smsService.verifyPhoneAndCode(curPhoneNo, smsCode)) {
throw new DataException("验证码不正确。");
}
// if (userDetailRepository.findByUserIdAndPhoneNoAndNameAndIdNo(userId, prevPhoneNo, name, idCard) == null) {
// throw new DataException("信息填写有误,请重新填写。");
// }
if (userRepository.findByPhoneNo(curPhoneNo) != null) {
throw new DataException("填写信息有误,新手机号已注册。");
}
checkLoanStatus(userId);
}
/** /**
* @param userId user.id * @param userId user.id
*/ */
......
...@@ -269,20 +269,21 @@ public class UserServiceImpl implements IUserService, IBaseController { ...@@ -269,20 +269,21 @@ public class UserServiceImpl implements IUserService, IBaseController {
UserHashMapping userHashMapping = null; UserHashMapping userHashMapping = null;
if (FindByMd5Enum.PHONENO.getType() == type) { if (FindByMd5Enum.PHONENO.getType() == type) {
userHashMapping = userHashMappingRepository.findByPhoneNoMd5ShortAndPhoneNoMd5(value, md5Value); userHashMapping = userHashMappingRepository.findByPhoneNoMd5ShortAndPhoneNoMd5(value, md5Value);
} else if (FindByMd5Enum.IDNO.getType() == type) {
List<UserHashMapping> userHashMappings = userHashMappingRepository.findByIdNoMd5AndIdNoMd5Short(md5Value, value);
if (!CollectionUtils.isEmpty(userHashMappings)) {
//如果多个只返回最新的
userHashMapping = userHashMappings.stream().max(Comparator.comparing(UserHashMapping::getId)).orElse(null);
}
} else {
userHashMapping = null;
UserHashPhoneNoIdNoMapping userHashPhoneNoIdNoMapping = userHashPhoneNoIdNoMappingRepository.findFirstByPhoneNoIdNoMd5(md5Value);
if (userHashPhoneNoIdNoMapping != null) {
userHashMapping = new UserHashMapping();
userHashMapping.setUserId(userHashPhoneNoIdNoMapping.getUserId());
}
} }
// } else if (FindByMd5Enum.IDNO.getType() == type) {
// List<UserHashMapping> userHashMappings = userHashMappingRepository.findByIdNoMd5AndIdNoMd5Short(md5Value, value);
// if (!CollectionUtils.isEmpty(userHashMappings)) {
// //如果多个只返回最新的
// userHashMapping = userHashMappings.stream().max(Comparator.comparing(UserHashMapping::getId)).orElse(null);
// }
// } else {
// userHashMapping = null;
// UserHashPhoneNoIdNoMapping userHashPhoneNoIdNoMapping = userHashPhoneNoIdNoMappingRepository.findFirstByPhoneNoIdNoMd5(md5Value);
// if (userHashPhoneNoIdNoMapping != null) {
// userHashMapping = new UserHashMapping();
// userHashMapping.setUserId(userHashPhoneNoIdNoMapping.getUserId());
// }
// }
if (userHashMapping == null) { if (userHashMapping == null) {
return null; return null;
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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