Commit 33050e19 authored by xiaozhe.chen's avatar xiaozhe.chen

客服系统对接中台接口,用户修改、修改密码、修改账户状态

parent 7ed01169
......@@ -11,6 +11,7 @@ import cn.quantgroup.customer.rest.param.phone.ModifyPhoneFeedback;
import cn.quantgroup.customer.rest.param.phone.ModifyPhoneQuery;
import cn.quantgroup.customer.rest.param.user.UserCombinationParam;
import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.rest.vo.MoResult;
import cn.quantgroup.customer.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -139,8 +140,11 @@ public class UserRest {
public JsonResult modifyUserDetail(@RequestParam(required = true) Long userId,
@RequestParam(required = true) String realName,
@RequestParam(required = true) String idNO) {
String response = userService.modifyUserDetail(userId, realName, idNO);
return GSON.fromJson(response, JsonResult.class);
MoResult<String> result = userService.modifyUserDetail(userId, realName, idNO);
if(!result.isSuccess()){
return JsonResult.buildErrorStateResult(result.getMsg(),result.getData());
}
return JsonResult.buildSuccessResult(result.getMsg(),result.getData());
}
/**
......@@ -149,9 +153,12 @@ public class UserRest {
* @return
*/
@PostMapping(value = "/pwd/reset")
public JsonResult passwordReset(@RequestParam(required = true) String phoneNo) {
String response = userService.passwordRest(phoneNo);
return GSON.fromJson(response, JsonResult.class);
public JsonResult passwordReset(@RequestParam(required = true) String phone) {
MoResult<String> result = userService.passwordRest(phone);
if(!result.isSuccess()){
return JsonResult.buildErrorStateResult(result.getMsg(),result.getData());
}
return JsonResult.buildSuccessResult(result.getMsg(),result.getData());
}
/**
......@@ -161,8 +168,11 @@ public class UserRest {
*/
@PostMapping(value = "/modify/account/status/disable")
public JsonResult modifyAccountStatusDisable(@RequestParam(required = true) Long userId) {
String response = userService.modifyAccountStatusDisable(userId);
return GSON.fromJson(response, JsonResult.class);
MoResult<Boolean> result = userService.modifyAccountStatusDisable(userId);
if(!result.isSuccess()){
return JsonResult.buildErrorStateResult(result.getMsg(),result.getData());
}
return JsonResult.buildSuccessResult(result.getMsg(),result.getData());
}
/**
......@@ -172,8 +182,11 @@ public class UserRest {
*/
@PostMapping(value = "/modify/account/status/active")
public JsonResult modifyAccountStatusActive(@RequestParam(required = true) Long userId) {
String response = userService.modifyAccountStatusActive(userId);
return GSON.fromJson(response, JsonResult.class);
MoResult<Boolean> result = userService.modifyAccountStatusActive(userId);
if(!result.isSuccess()){
return JsonResult.buildErrorStateResult(result.getMsg(),result.getData());
}
return JsonResult.buildSuccessResult(result.getMsg(),result.getData());
}
......
......@@ -88,7 +88,4 @@ public class JsonResult<T> implements Serializable {
return "0000".equals(code) && "0000".equals(businessCode);
}
public boolean isSuccess2() {
return "0".equals(code);
}
}
......@@ -8,6 +8,7 @@ import cn.quantgroup.customer.rest.param.phone.ModifyPhoneQuery;
import cn.quantgroup.customer.rest.param.user.UserCombinationParam;
import cn.quantgroup.customer.rest.param.user.UserQueryParam;
import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.rest.vo.MoResult;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Service;
......@@ -40,21 +41,21 @@ public interface IUserService extends UserDetailsService {
* @param phoneNo
* @return
*/
String passwordRest(String phoneNo);
MoResult<String> passwordRest(String phoneNo);
/**
* 注销账户
* @param userId
* @return
*/
String modifyAccountStatusDisable(Long userId);
MoResult<Boolean> modifyAccountStatusDisable(Long userId);
/**
* 激活账户
* @param userId
* @return
*/
String modifyAccountStatusActive(Long userId);
MoResult<Boolean> modifyAccountStatusActive(Long userId);
/**
* 修改用户姓名、身份证
......@@ -63,6 +64,6 @@ public interface IUserService extends UserDetailsService {
* @param idNO
* @return
*/
String modifyUserDetail(Long userId, String realName, String idNO);
MoResult<String> modifyUserDetail(Long userId, String realName, String idNO);
}
......@@ -19,6 +19,7 @@ import cn.quantgroup.customer.rest.param.phone.ModifyPhoneQuery;
import cn.quantgroup.customer.rest.param.user.UserCombinationParam;
import cn.quantgroup.customer.rest.param.user.UserQueryParam;
import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.rest.vo.MoResult;
import cn.quantgroup.customer.service.IKaService;
import cn.quantgroup.customer.service.IUserService;
import cn.quantgroup.customer.service.IXyqbService;
......@@ -572,16 +573,17 @@ public class UserServiceImpl implements IUserService {
@Override
public String passwordRest(String phoneNo) {
String url = sidecarUrl + "/middle_office/middle_office/kefu/password/reset";
public MoResult<String> passwordRest(String phoneNo) {
String url = sidecarUrl + "/middle_office/kefu/password/reset";
try {
Map<String, String> header = Maps.newHashMap();
header.put("Content-type", "application/x-www-form-urlencoded");
Map param = Maps.newHashMap();
param.put("phoneNo", phoneNo);
param.put("phone", phoneNo);
String result = httpService.post(url, header, param);
MoResult moResult = GSON.fromJson(result, MoResult.class);
log.info("[user][passwordRest] 请求业务系统返回值:{}", result);
return result;
return moResult;
} catch (Exception e) {
log.error("[user][passwordRest] 网络通讯异常,phoneNo:{},ex:{}", phoneNo, ExceptionUtils.getStackTrace(e));
throw new BusinessException(ErrorCodeEnum.NET_ERROR);
......@@ -589,16 +591,17 @@ public class UserServiceImpl implements IUserService {
}
@Override
public String modifyAccountStatusDisable(Long userId) {
String url = sidecarUrl + "/middle_office/middle_office/kefu/user/disable";
public MoResult<Boolean> modifyAccountStatusDisable(Long userId) {
String url = sidecarUrl + "/middle_office/kefu/user/disable";
try {
Map<String, String> header = Maps.newHashMap();
header.put("Content-type", "application/x-www-form-urlencoded");
Map param = Maps.newHashMap();
param.put("userId", userId);
param.put("userId", String.valueOf(userId));
String result = httpService.post(url, header, param);
MoResult moResult = GSON.fromJson(result, MoResult.class);
log.info("[user][modifyAccountStatus] 请求业务系统返回值:{}", result);
return result;
return moResult;
} catch (Exception e) {
log.error("[user][modifyAccountStatus] 网络通讯异常,userId:{},ex:{}", userId, ExceptionUtils.getStackTrace(e));
throw new BusinessException(ErrorCodeEnum.NET_ERROR);
......@@ -606,16 +609,17 @@ public class UserServiceImpl implements IUserService {
}
@Override
public String modifyAccountStatusActive(Long userId) {
String url = sidecarUrl + "/middle_office/middle_office/kefu/user/active";
public MoResult<Boolean> modifyAccountStatusActive(Long userId) {
String url = sidecarUrl + "/middle_office/kefu/user/active";
try {
Map<String, String> header = Maps.newHashMap();
header.put("Content-type", "application/x-www-form-urlencoded");
Map param = Maps.newHashMap();
param.put("userId", userId);
param.put("userId", String.valueOf(userId));
String result = httpService.post(url, header, param);
MoResult moResult = GSON.fromJson(result, MoResult.class);
log.info("[user][modifyAccountStatusActive] 请求业务系统返回值:{}", result);
return result;
return moResult;
} catch (Exception e) {
log.error("[user][modifyAccountStatusActive] 网络通讯异常,userId:{},ex:{}", userId, ExceptionUtils.getStackTrace(e));
throw new BusinessException(ErrorCodeEnum.NET_ERROR);
......@@ -623,18 +627,19 @@ public class UserServiceImpl implements IUserService {
}
@Override
public String modifyUserDetail(Long userId, String realName, String idNO) {
String url = sidecarUrl + "/middle_office/middle_office/kefu/userDetail/reset";
public MoResult<String> modifyUserDetail(Long userId, String realName, String idNO) {
String url = sidecarUrl + "/middle_office/kefu/userDetail/reset";
try {
Map<String, String> header = Maps.newHashMap();
header.put("Content-type", "application/x-www-form-urlencoded");
Map param = Maps.newHashMap();
param.put("userId", userId);
param.put("userId", String.valueOf(userId));
param.put("realName", realName);
param.put("idNO", idNO);
String result = httpService.post(url, header, param);
MoResult moResult = GSON.fromJson(result, MoResult.class);
log.info("[user][modifyUserDetail] 请求业务系统返回值:{}", result);
return result;
return moResult;
} catch (Exception e) {
log.error("[user][modifyUserDetail] 网络通讯异常,userId:{},ex:{}", userId, ExceptionUtils.getStackTrace(e));
throw new BusinessException(ErrorCodeEnum.NET_ERROR);
......
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