Commit 40f9941a authored by 王亮's avatar 王亮

Merge remote-tracking branch 'origin/feature/modify-phone-no-20221117' into...

Merge remote-tracking branch 'origin/feature/modify-phone-no-20221117' into feature/modify-phone-no-20221117
parents 1ab91015 ac7b1113
......@@ -3,12 +3,14 @@ package cn.quantgroup.xyqb.controller.modifyphoneno;
import cn.quantgroup.xyqb.controller.IBaseController;
import cn.quantgroup.xyqb.controller.modifyphoneno.req.*;
import cn.quantgroup.xyqb.controller.modifyphoneno.resp.ProgressResp;
import cn.quantgroup.xyqb.controller.modifyphoneno.resp.UserModifyPhoneRecordResp;
import cn.quantgroup.xyqb.entity.ModifyPhoneNo;
import cn.quantgroup.xyqb.entity.User;
import cn.quantgroup.xyqb.entity.UserModifyPhoneRecord;
import cn.quantgroup.xyqb.model.JsonResult;
import cn.quantgroup.xyqb.service.user.IModifyPhoneNoService;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
......@@ -135,7 +137,12 @@ public class ModifyPhoneNoController implements IBaseController {
public JsonResult getModifyPhoneNolist(@RequestParam("userId") Long userId,
@RequestParam(value = "pageNo", defaultValue = "1", required = false) int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10", required = false) int pageSize) {
Page<UserModifyPhoneRecord> pageData = modifyPhoneNoService.query(userId, pageNo, pageSize);
Page<UserModifyPhoneRecordResp> pageData = modifyPhoneNoService.query(userId, pageNo, pageSize).map(record -> {
UserModifyPhoneRecordResp userModifyPhoneRecordResp = new UserModifyPhoneRecordResp();
BeanUtils.copyProperties(record, userModifyPhoneRecordResp);
userModifyPhoneRecordResp.setReason(record.getReason().name());
return userModifyPhoneRecordResp;
});
return JsonResult.buildSuccessResult("修改手机号列表", pageData);
}
......
package cn.quantgroup.xyqb.controller.modifyphoneno.resp;
import cn.quantgroup.xyqb.entity.enums.Reason;
import lombok.Data;
import java.sql.Timestamp;
@Data
public class UserModifyPhoneRecordResp {
private Long id;
private Long userId;
private String prevPhoneNo;
private String curPhoneNo;
private String reason;
private String operator;
private String remark;
private String financialResponse;
private Timestamp createdAt;
private Timestamp updatedAt;
}
......@@ -6,6 +6,7 @@ import cn.quantgroup.xyqb.controller.modifyphoneno.resp.ProgressResp;
import cn.quantgroup.xyqb.entity.ModifyPhoneNo;
import cn.quantgroup.xyqb.entity.User;
import cn.quantgroup.xyqb.entity.UserModifyPhoneRecord;
import cn.quantgroup.xyqb.entity.enums.Reason;
import cn.quantgroup.xyqb.exception.AppletException;
import cn.quantgroup.xyqb.exception.DataException;
import cn.quantgroup.xyqb.model.JsonResult;
......@@ -239,10 +240,27 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
if (userRepository.findByPhoneNo(modifyPhoneNo.getCurPhoneNo()) != null) {
throw new DataException("新手机号已存在,不支持更换。");
}
checkLoanStatus(modifyPhoneNo.getUserId());
userService.modifyPhoneNo(modifyPhoneNo.getPrevPhoneNo(), modifyPhoneNo.getCurPhoneNo());
modifyPhoneNo.setApplyStatus(ModifyPhoneNoApplyStatusEnum.DONE.ordinal());
modifyPhoneNo.setProcessingStatus(ModifyPhoneNoProcessingStatusEnum.WAIT_4_USER_FEEDBACK.ordinal());
// 请求其他系统信息
HashMap<String, String> parameters = new HashMap<>();
HashMap<String, String> headers = new HashMap<>();
headers.put("qg-tenant-id", TenantUtil.TENANT_DEFAULT.toString());
parameters.put("oldPhoneNo", modifyPhoneNo.getPrevPhoneNo());
parameters.put("phoneNo", modifyPhoneNo.getCurPhoneNo());
parameters.put("exUserId", String.valueOf(modifyPhoneNo.getUserId()));
// parameters.put("remark", modifyPhoneNo.getApplyStatusReason());
parameters.put("changeRecord", Reason.SYNCHRONOUSCHANGE.toString());
String resultStr = httpService.postJson(userHost + "/api/finance-gateway/finance-user/shop/notify/changePhoneNo", headers, parameters);
JsonResult resultStrJson = JSONObject.parseObject(resultStr, JsonResult.class);
// 如果有返回值
if ("0000".equals(resultStrJson.getBusinessCode()) || "4014".equals(resultStrJson.getBusinessCode())) {
// 同步金融修改电商
userService.modifyPhoneNo(modifyPhoneNo.getPrevPhoneNo(), modifyPhoneNo.getCurPhoneNo());
modifyPhoneNo.setApplyStatus(ModifyPhoneNoApplyStatusEnum.DONE.ordinal());
modifyPhoneNo.setProcessingStatus(ModifyPhoneNoProcessingStatusEnum.WAIT_4_USER_FEEDBACK.ordinal());
} else {
String msg = resultStrJson.getMsg();
throw new DataException("金融返回失败" + (StringUtils.isNotBlank(msg) ? ":" + msg : ""));
}
}
}
......@@ -393,12 +411,14 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
if (userService.findByPhoneInDb(curPhoneNo) != null) {
throw new DataException("填写信息有误,新手机号已注册。");
}
checkLoanStatus(userId);
// checkLoanStatus(userId); 调用金融接口方式是错误的,改为同步金融一起修改手机号
}
/**
* @param userId user.id
* 弃用,这里调金融传的是电商userId,结果不可信
*/
@Deprecated
public void checkLoanStatus(Long userId) {
log.info("allowModify userId = 【{}】", userId);
String res = httpService.get(apiHttps + "/ex/loan/user/loan_status.json?userId=" + userId);
......
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