Commit d92e5b84 authored by huyuchen's avatar huyuchen

失败原因配置

parent 86ed9134
...@@ -60,6 +60,13 @@ public class R<T> implements Serializable { ...@@ -60,6 +60,13 @@ public class R<T> implements Serializable {
this.msg = e.getMessage(); this.msg = e.getMessage();
this.code = CommonConstants.FAIL; this.code = CommonConstants.FAIL;
} }
public R( String msg ,int code) {
super();
this.msg = msg;
this.code = code;
}
public static <T> R<T> ok() { public static <T> R<T> ok() {
return restResult(null, CommonConstants.SUCCESS, null); return restResult(null, CommonConstants.SUCCESS, null);
} }
......
...@@ -504,7 +504,7 @@ public class UserController { ...@@ -504,7 +504,7 @@ public class UserController {
*/ */
@SysLog("从ldap实时更新用户和部门") @SysLog("从ldap实时更新用户和部门")
@PostMapping("/updateUserAndDept") @PostMapping("/updateUserAndDept")
public R updateUserAndDept(HttpServletRequest request,@RequestBody JSONObject json) { public R<String> updateUserAndDept(HttpServletRequest request,@RequestBody JSONObject json) {
return R.ok(userService.updateUserAndDept(request,json)); return userService.updateUserAndDept(request,json);
} }
} }
...@@ -184,5 +184,5 @@ public interface SysUserService extends IService<SysUser> { ...@@ -184,5 +184,5 @@ public interface SysUserService extends IService<SysUser> {
* 从ldap实时更新用户和部门 * 从ldap实时更新用户和部门
* @return R * @return R
*/ */
R updateUserAndDept(HttpServletRequest request, JSONObject json); R<String> updateUserAndDept(HttpServletRequest request, JSONObject json);
} }
...@@ -739,18 +739,18 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl ...@@ -739,18 +739,18 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
* @return R * @return R
*/ */
@Override @Override
public R updateUserAndDept(HttpServletRequest request,JSONObject json) { public R<String> updateUserAndDept(HttpServletRequest request,JSONObject json) {
//权限验证 //权限验证
String appId = request.getHeader("HRBS-APP-ID"); String appId = request.getHeader("HRBS-APP-ID");
String appSecret = request.getHeader("HRBS-APP-SECRET"); String appSecret = request.getHeader("HRBS-APP-SECRET");
if(Common.isEmpty(appId) || Common.isEmpty(appSecret)){ if(Common.isEmpty(appId) || Common.isEmpty(appSecret)){
return R.failed("操作失败,权限标识错误!"); return new R<>("操作失败,权限标识错误!", 500);
} }
if(!hcmId.equals(appId) || !hcmSecret.equals(appSecret) ){ if(!hcmId.equals(appId) || !hcmSecret.equals(appSecret) ){
return R.failed("操作失败,无权限!"); return new R<>("操作失败,无权限!", 500);
} }
if(Common.isEmpty(json)) { if(Common.isEmpty(json)) {
return R.failed("传参不能为空"); return new R<>("传参不能为空", 500);
} }
boolean isAll = (boolean) json.get("isAll"); boolean isAll = (boolean) json.get("isAll");
String dataType = json.get("dataType").toString(); String dataType = json.get("dataType").toString();
...@@ -767,7 +767,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl ...@@ -767,7 +767,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
//更新或者新增部门信息 //更新或者新增部门信息
updateOrSaveDept(updateParamsArr); updateOrSaveDept(updateParamsArr);
} }
return R.ok(); return new R<>("同步成功!", 200);
} }
/** /**
......
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