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

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

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