|
|
|
@ -88,25 +88,24 @@ public class UserUController {
|
|
|
|
|
u.setOpenid(openid);
|
|
|
|
|
u.setTel(k.getString("phoneNumber"));
|
|
|
|
|
u.setToken(new JwtUtil().createJWT(openid));
|
|
|
|
|
// u.setToken(new JwtUtils().generateToken(openid, new Date().getTime()));
|
|
|
|
|
u.setCreatAt(LocalDateTime.now());
|
|
|
|
|
|
|
|
|
|
// 用户企业微信信息获取
|
|
|
|
|
String access_token = httpUtil.qywxGetToken();
|
|
|
|
|
JSONObject qywxRes = httpUtil.qywxUserSession(access_token, obj.getString("code"));
|
|
|
|
|
String userid = qywxRes.getString("userid");
|
|
|
|
|
JSONObject res1 = httpUtil.qywxUser(access_token, userid);
|
|
|
|
|
Integer main_department = res1.getInteger("main_department");
|
|
|
|
|
JSONArray department = res1.getJSONArray("department");
|
|
|
|
|
|
|
|
|
|
if (null == userid || null == main_department) {
|
|
|
|
|
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "获取企业用户信息失败");
|
|
|
|
|
}
|
|
|
|
|
Integer sub_department = main_department;
|
|
|
|
|
if (sub_department != null && sub_department != 1 && sub_department != 0) {
|
|
|
|
|
sub_department = httpUtil.qywxDepartmentParentid(access_token, main_department, 0);
|
|
|
|
|
}
|
|
|
|
|
u.setMain_department(main_department).setSub_department(sub_department);
|
|
|
|
|
// String access_token = httpUtil.qywxGetToken();
|
|
|
|
|
// JSONObject qywxRes = httpUtil.qywxUserSession(access_token, obj.getString("code"));
|
|
|
|
|
// String userid = qywxRes.getString("userid");
|
|
|
|
|
// JSONObject res1 = httpUtil.qywxUser(access_token, userid);
|
|
|
|
|
// Integer main_department = res1.getInteger("main_department");
|
|
|
|
|
// JSONArray department = res1.getJSONArray("department");
|
|
|
|
|
//
|
|
|
|
|
// if (null == userid || null == main_department) {
|
|
|
|
|
// return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "获取企业用户信息失败");
|
|
|
|
|
// }
|
|
|
|
|
// Integer sub_department = main_department;
|
|
|
|
|
// if (sub_department != null && sub_department != 1 && sub_department != 0) {
|
|
|
|
|
// sub_department = httpUtil.qywxDepartmentParentid(access_token, main_department, 0);
|
|
|
|
|
// }
|
|
|
|
|
// u.setMain_department(main_department).setSub_department(sub_department);
|
|
|
|
|
userService.save(u);
|
|
|
|
|
return Result.success(u);
|
|
|
|
|
}
|
|
|
|
|