|
|
@@ -62,7 +62,6 @@ import com.goafanti.user.bo.InputUserEdu;
|
|
|
import com.goafanti.user.bo.InputUserIdentity;
|
|
|
import com.goafanti.user.bo.OrgIdentityBo;
|
|
|
import com.goafanti.user.bo.OrgProBo;
|
|
|
-import com.goafanti.user.bo.UidAndTypeBo;
|
|
|
import com.goafanti.user.bo.UserIdentityBo;
|
|
|
import com.goafanti.user.bo.UserInfoBo;
|
|
|
import com.goafanti.user.service.OrgHumanResourceService;
|
|
|
@@ -226,7 +225,7 @@ public class UserApiController extends BaseApiController {
|
|
|
ui.setUid(TokenManager.getUserId());
|
|
|
userIdentityService.insert(ui);
|
|
|
} else {
|
|
|
- if (StringUtils.isBlank(ui.getId())){
|
|
|
+ if (StringUtils.isBlank(ui.getId())) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "认证信息ID"));
|
|
|
return res;
|
|
|
}
|
|
|
@@ -288,28 +287,9 @@ public class UserApiController extends BaseApiController {
|
|
|
UserInfoBoFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
return res;
|
|
|
}
|
|
|
- if (res.getError().isEmpty()) {
|
|
|
- User u = userService.selectByPrimaryKey(TokenManager.getUserId());
|
|
|
- u.setNickname(userInfoBo.getNickname());
|
|
|
- u.setEmail(userInfoBo.getEmail());
|
|
|
- userService.updateByPrimaryKeySelective(u);
|
|
|
-
|
|
|
- UserInfo ui = new UserInfo();
|
|
|
- BeanUtils.copyProperties(userInfoBo, ui);
|
|
|
- UserInfo info = userInfoService.selectUserInfoByUserId(TokenManager.getUserId());
|
|
|
- if (null == info && StringUtils.isBlank(ui.getId())) {
|
|
|
- ui.setId(UUID.randomUUID().toString());
|
|
|
- ui.setUid(TokenManager.getUserId());
|
|
|
- userInfoService.insert(ui);
|
|
|
- } else {
|
|
|
- if (StringUtils.isBlank(ui.getId())){
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "个人资料ID"));
|
|
|
- return res;
|
|
|
- }
|
|
|
- userInfoService.updateByPrimaryKeySelective(ui);
|
|
|
- }
|
|
|
- }
|
|
|
- res.setData(userInfoBo);
|
|
|
+ UserInfo ui = new UserInfo();
|
|
|
+ BeanUtils.copyProperties(userInfoBo, ui);
|
|
|
+ userInfoService.saveUserInfo(userInfoBo);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
@@ -330,13 +310,13 @@ public class UserApiController extends BaseApiController {
|
|
|
|
|
|
UserEdu ue = new UserEdu();
|
|
|
BeanUtils.copyProperties(userEdu, ue);
|
|
|
- UserEdu u= userEduService.selectUserEduByUserId(TokenManager.getUserId());
|
|
|
+ UserEdu u = userEduService.selectUserEduByUserId(TokenManager.getUserId());
|
|
|
if (null == u && StringUtils.isBlank(ue.getId())) {
|
|
|
ue.setId(UUID.randomUUID().toString());
|
|
|
ue.setUid(TokenManager.getUserId());
|
|
|
userEduService.insert(ue);
|
|
|
} else {
|
|
|
- if (StringUtils.isBlank(ue.getId())){
|
|
|
+ if (StringUtils.isBlank(ue.getId())) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "教育信息ID"));
|
|
|
return res;
|
|
|
}
|
|
|
@@ -369,7 +349,7 @@ public class UserApiController extends BaseApiController {
|
|
|
uc.setUid(TokenManager.getUserId());
|
|
|
userCareerService.insert(uc);
|
|
|
} else {
|
|
|
- if (StringUtils.isBlank(uc.getId())){
|
|
|
+ if (StringUtils.isBlank(uc.getId())) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "职业信息ID"));
|
|
|
return res;
|
|
|
}
|
|
|
@@ -402,7 +382,7 @@ public class UserApiController extends BaseApiController {
|
|
|
ua.setUid(TokenManager.getUserId());
|
|
|
userAbilityService.insert(ua);
|
|
|
} else {
|
|
|
- if (StringUtils.isBlank(ua.getId())){
|
|
|
+ if (StringUtils.isBlank(ua.getId())) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "能力标签ID"));
|
|
|
return res;
|
|
|
}
|
|
|
@@ -426,18 +406,7 @@ public class UserApiController extends BaseApiController {
|
|
|
OrganizationIdentityFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
return res;
|
|
|
}
|
|
|
- OrganizationIdentity oi = new OrganizationIdentity();
|
|
|
- BeanUtils.copyProperties(orgIdentityBo, oi);
|
|
|
- User u = userService.selectByPrimaryKey(TokenManager.getUserId());
|
|
|
- u.setEmail(orgIdentityBo.getEmail());
|
|
|
- userService.updateByPrimaryKeySelective(u);
|
|
|
- if (StringUtils.isBlank(oi.getId())) {
|
|
|
- oi.setId(UUID.randomUUID().toString());
|
|
|
- oi.setUid(TokenManager.getUserId());
|
|
|
- organizationIdentityService.insert(oi);
|
|
|
- } else {
|
|
|
- organizationIdentityService.updateByPrimaryKeySelective(oi);
|
|
|
- }
|
|
|
+ organizationIdentityService.save(orgIdentityBo);
|
|
|
res.setData(orgIdentityBo);
|
|
|
return res;
|
|
|
}
|
|
|
@@ -485,7 +454,8 @@ public class UserApiController extends BaseApiController {
|
|
|
|
|
|
OrganizationTech ot = new OrganizationTech();
|
|
|
BeanUtils.copyProperties(orgTech, ot);
|
|
|
- if (StringUtils.isBlank(ot.getId())) {
|
|
|
+ OrganizationTech o = organizationTechService.selectOrgTechByUserId(TokenManager.getUserId());
|
|
|
+ if (null == o && StringUtils.isBlank(ot.getId())) {
|
|
|
ot.setId(UUID.randomUUID().toString());
|
|
|
ot.setUid(TokenManager.getUserId());
|
|
|
organizationTechService.insert(ot);
|
|
|
@@ -505,14 +475,14 @@ public class UserApiController extends BaseApiController {
|
|
|
@RequestMapping(value = "/base", method = RequestMethod.GET)
|
|
|
public Result basic() {
|
|
|
Result res = new Result();
|
|
|
- UidAndTypeBo ub = basicInfo(userService);
|
|
|
- if (UserType.PERSONAL.getCode().equals(ub.getType())) {
|
|
|
- UserIdentityBo u = userIdentityService.selectUserIdentityBoByUserId(ub.getUid());
|
|
|
+ if (UserType.PERSONAL.getCode().equals(TokenManager.getUserType())) {
|
|
|
+ UserIdentityBo u = userIdentityService.selectUserIdentityBoByUserId(TokenManager.getUserId());
|
|
|
res.setData(u);
|
|
|
} else {
|
|
|
- OrgIdentityBo o = organizationIdentityService.selectOrgIdentityBoByUserId(ub.getUid());
|
|
|
+ OrgIdentityBo o = organizationIdentityService.selectOrgIdentityBoByUserId(TokenManager.getUserId());
|
|
|
res.setData(o);
|
|
|
}
|
|
|
+
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
@@ -522,13 +492,12 @@ public class UserApiController extends BaseApiController {
|
|
|
@RequestMapping(value = "/member", method = RequestMethod.GET)
|
|
|
public Result member() {
|
|
|
Result res = new Result();
|
|
|
- UidAndTypeBo ub = basicInfo(userService);
|
|
|
- if (UserType.PERSONAL.getCode().equals(ub.getType())) {
|
|
|
- UserInfoBo u = userInfoService.selectUserInfoBoByUserId(ub.getUid());
|
|
|
+ if (UserType.PERSONAL.getCode().equals(TokenManager.getUserType())) {
|
|
|
+ UserInfoBo u = userInfoService.selectUserInfoBoByUserId(TokenManager.getUserId());
|
|
|
res.setData(u);
|
|
|
} else {
|
|
|
- OrganizationInfo o = organizationInfoService.selectOrgInfoByUserId(ub.getUid());
|
|
|
- OrganizationProperties p = organizationPropertiesService.selectOrgProByUserId(ub.getUid());
|
|
|
+ OrganizationInfo o = organizationInfoService.selectOrgInfoByUserId(TokenManager.getUserId());
|
|
|
+ OrganizationProperties p = organizationPropertiesService.selectOrgProByUserId(TokenManager.getUserId());
|
|
|
res.setData(new OrgProBo(o, p));
|
|
|
}
|
|
|
return res;
|
|
|
@@ -542,11 +511,8 @@ public class UserApiController extends BaseApiController {
|
|
|
@RequestMapping(value = "/educate", method = RequestMethod.GET)
|
|
|
public Result educate() {
|
|
|
Result res = new Result();
|
|
|
- UidAndTypeBo ub = basicInfo(userService);
|
|
|
- if (null != ub) {
|
|
|
- UserEdu u = userEduService.selectUserEduByUserId(ub.getUid());
|
|
|
- res.setData(u);
|
|
|
- }
|
|
|
+ UserEdu u = userEduService.selectUserEduByUserId(TokenManager.getUserId());
|
|
|
+ res.setData(u);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
@@ -558,12 +524,11 @@ public class UserApiController extends BaseApiController {
|
|
|
@RequestMapping(value = "/job", method = RequestMethod.GET)
|
|
|
public Result job() {
|
|
|
Result res = new Result();
|
|
|
- UidAndTypeBo ub = basicInfo(userService);
|
|
|
- if (UserType.PERSONAL.getCode().equals(ub.getType())) {
|
|
|
- UserCareer u = userCareerService.selectUserCareerByUserId(ub.getUid());
|
|
|
+ if (UserType.PERSONAL.getCode().equals(TokenManager.getUserType())) {
|
|
|
+ UserCareer u = userCareerService.selectUserCareerByUserId(TokenManager.getUserId());
|
|
|
res.setData(u);
|
|
|
} else {
|
|
|
- OrganizationTech o = organizationTechService.selectOrgTechByUserId(ub.getUid());
|
|
|
+ OrganizationTech o = organizationTechService.selectOrgTechByUserId(TokenManager.getUserId());
|
|
|
res.setData(o);
|
|
|
}
|
|
|
return res;
|
|
|
@@ -577,11 +542,8 @@ public class UserApiController extends BaseApiController {
|
|
|
@RequestMapping(value = "/ability", method = RequestMethod.GET)
|
|
|
public Result ability() {
|
|
|
Result res = new Result();
|
|
|
- UidAndTypeBo ub = basicInfo(userService);
|
|
|
- if (null != ub) {
|
|
|
- UserAbility u = userAbilityService.selectUserAbilityByUserId(ub.getUid());
|
|
|
- res.setData(u);
|
|
|
- }
|
|
|
+ UserAbility u = userAbilityService.selectUserAbilityByUserId(TokenManager.getUserId());
|
|
|
+ res.setData(u);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
@@ -900,16 +862,6 @@ public class UserApiController extends BaseApiController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
- private UidAndTypeBo basicInfo(UserService userService) {
|
|
|
- User u = userService.selectByPrimaryKey(TokenManager.getUserId());
|
|
|
- UidAndTypeBo ub = new UidAndTypeBo();
|
|
|
- if (null != u) {
|
|
|
- ub.setType(u.getType());
|
|
|
- ub.setUid(u.getId());
|
|
|
- }
|
|
|
- return ub;
|
|
|
- }
|
|
|
-
|
|
|
// 判断用户是否通过认证
|
|
|
private Result checkCertify(Result res) {
|
|
|
OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
|