|
|
@@ -24,8 +24,13 @@ import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.BaseApiController;
|
|
|
+import com.goafanti.common.enums.OrgProFields;
|
|
|
+import com.goafanti.common.enums.OrganizationIdentityFields;
|
|
|
+import com.goafanti.common.enums.UserAbilityFields;
|
|
|
+import com.goafanti.common.enums.UserCareerFields;
|
|
|
+import com.goafanti.common.enums.UserEduFields;
|
|
|
import com.goafanti.common.enums.UserIdentityFields;
|
|
|
-import com.goafanti.common.model.AftUser;
|
|
|
+import com.goafanti.common.enums.UserInfoBoFields;
|
|
|
import com.goafanti.common.model.OrgHumanResource;
|
|
|
import com.goafanti.common.model.OrganizationIdentity;
|
|
|
import com.goafanti.common.model.OrganizationInfo;
|
|
|
@@ -43,6 +48,10 @@ import com.goafanti.common.utils.TimeUtils;
|
|
|
import com.goafanti.common.utils.VerifyCodeUtils;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
import com.goafanti.techproject.service.TechWebsiteService;
|
|
|
+import com.goafanti.user.bo.InputOrgPro;
|
|
|
+import com.goafanti.user.bo.InputUserAbility;
|
|
|
+import com.goafanti.user.bo.InputUserCareer;
|
|
|
+import com.goafanti.user.bo.InputUserEdu;
|
|
|
import com.goafanti.user.bo.InputUserIdentity;
|
|
|
import com.goafanti.user.bo.OrgIdentityBo;
|
|
|
import com.goafanti.user.bo.OrgProBo;
|
|
|
@@ -322,43 +331,27 @@ public class UserApiController extends BaseApiController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/userInfo", method = RequestMethod.POST)
|
|
|
- public Result personalData(UserInfoBo userInfoBo, BindingResult bindingResult) {
|
|
|
+ public Result personalData(@Valid UserInfoBo userInfoBo, BindingResult bindingResult) {
|
|
|
Result res = new Result();
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
- bindingResult.getFieldError().getField()));
|
|
|
+ UserInfoBoFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
return res;
|
|
|
}
|
|
|
if (res.getError().isEmpty()) {
|
|
|
- UserInfo info = userInfoService.selectUserInfoByUserId(TokenManager.getUserId());
|
|
|
User u = userService.selectByPrimaryKey(TokenManager.getUserId());
|
|
|
u.setNickname(userInfoBo.getNickname());
|
|
|
u.setEmail(userInfoBo.getEmail());
|
|
|
userService.updateByPrimaryKeySelective(u);
|
|
|
- AftUser user = TokenManager.getToken();
|
|
|
- if(user instanceof User) {
|
|
|
- ((User)user).setNickname(userInfoBo.getNickname());
|
|
|
- }
|
|
|
- UserInfo userInfo = new UserInfo();
|
|
|
- userInfo.setResidenceProvince(userInfoBo.getResidenceProvince());
|
|
|
- userInfo.setResidenceCity(userInfoBo.getResidenceCity());
|
|
|
- userInfo.setResidenceArea(userInfoBo.getResidenceArea());
|
|
|
- userInfo.setPersonPortraitUrl(userInfoBo.getPersonPortraitUrl());
|
|
|
- userInfo.setPersonalProfile(userInfoBo.getPersonalProfile());
|
|
|
- userInfo.setLifePhotoUrl(userInfoBo.getLifePhotoUrl());
|
|
|
- userInfo.setFixedTelArea(userInfoBo.getFixedTelArea());
|
|
|
- userInfo.setFixedTel(userInfoBo.getFixedTel());
|
|
|
- userInfo.setFixedTelExtension(userInfoBo.getFixedTelExtension());
|
|
|
- userInfo.setQq(userInfoBo.getQq());
|
|
|
- userInfo.setPostalAddress(userInfoBo.getPostalAddress());
|
|
|
- userInfo.setPostcode(userInfoBo.getPostcode());
|
|
|
- if (info == null) {
|
|
|
- userInfo.setId(UUID.randomUUID().toString());
|
|
|
- userInfo.setUid(TokenManager.getUserId());
|
|
|
- userInfoService.insert(userInfo);
|
|
|
+
|
|
|
+ UserInfo ui = new UserInfo();
|
|
|
+ BeanUtils.copyProperties(userInfoBo, ui);
|
|
|
+ if (StringUtils.isBlank(ui.getId())) {
|
|
|
+ ui.setId(UUID.randomUUID().toString());
|
|
|
+ ui.setUid(TokenManager.getUserId());
|
|
|
+ userInfoService.insert(ui);
|
|
|
} else {
|
|
|
- userInfo.setId(info.getId());
|
|
|
- userInfoService.updateByPrimaryKeySelective(userInfo);
|
|
|
+ userInfoService.updateByPrimaryKeySelective(ui);
|
|
|
}
|
|
|
}
|
|
|
res.setData(userInfoBo);
|
|
|
@@ -372,17 +365,23 @@ public class UserApiController extends BaseApiController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/userEdu", method = RequestMethod.POST)
|
|
|
- public Result educationInfo(UserEdu userEdu) {
|
|
|
+ public Result educationInfo(@Valid InputUserEdu userEdu, BindingResult bindingResult) {
|
|
|
Result res = new Result();
|
|
|
- UserEdu edu = userEduService.selectUserEduByUserId(TokenManager.getUserId());
|
|
|
-
|
|
|
- if (edu == null) {
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
+ UserEduFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ UserEdu ue = new UserEdu();
|
|
|
+ BeanUtils.copyProperties(userEdu, ue);
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(ue.getId())) {
|
|
|
userEdu.setId(UUID.randomUUID().toString());
|
|
|
userEdu.setUid(TokenManager.getUserId());
|
|
|
- userEduService.insert(userEdu);
|
|
|
+ userEduService.insert(ue);
|
|
|
} else {
|
|
|
- userEdu.setId(edu.getId());
|
|
|
- userEduService.updateByPrimaryKeySelective(userEdu);
|
|
|
+ userEduService.updateByPrimaryKeySelective(ue);
|
|
|
}
|
|
|
res.setData(userEdu);
|
|
|
return res;
|
|
|
@@ -396,17 +395,23 @@ public class UserApiController extends BaseApiController {
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = "/userCareer", method = RequestMethod.POST)
|
|
|
- public Result careerInfo(UserCareer userCareer) {
|
|
|
+ public Result careerInfo(@Valid InputUserCareer userCareer, BindingResult bindingResult) {
|
|
|
Result res = new Result();
|
|
|
- UserCareer career = userCareerService.selectUserCareerByUserId(TokenManager.getUserId());
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
+ UserCareerFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ UserCareer uc = new UserCareer();
|
|
|
+ BeanUtils.copyProperties(userCareer, uc);
|
|
|
+
|
|
|
|
|
|
- if (career == null) {
|
|
|
- userCareer.setId(UUID.randomUUID().toString());
|
|
|
- userCareer.setUid(TokenManager.getUserId());
|
|
|
- userCareerService.insert(userCareer);
|
|
|
+ if (StringUtils.isBlank(uc.getId())) {
|
|
|
+ uc.setId(UUID.randomUUID().toString());
|
|
|
+ uc.setUid(TokenManager.getUserId());
|
|
|
+ userCareerService.insert(uc);
|
|
|
} else {
|
|
|
- userCareer.setId(career.getId());
|
|
|
- userCareerService.updateByPrimaryKeySelective(userCareer);
|
|
|
+ userCareerService.updateByPrimaryKeySelective(uc);
|
|
|
}
|
|
|
res.setData(userCareer);
|
|
|
return res;
|
|
|
@@ -420,16 +425,21 @@ public class UserApiController extends BaseApiController {
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = "/userAbility", method = RequestMethod.POST)
|
|
|
- public Result abilityLabel(UserAbility userAbility) {
|
|
|
+ public Result abilityLabel(@Valid InputUserAbility userAbility, BindingResult bindingResult) {
|
|
|
Result res = new Result();
|
|
|
- UserAbility ability = userAbilityService.selectUserAbilityByUserId(TokenManager.getUserId());
|
|
|
- if (ability == null) {
|
|
|
- userAbility.setId(UUID.randomUUID().toString());
|
|
|
- userAbility.setUid(TokenManager.getUserId());
|
|
|
- userAbilityService.insert(userAbility);
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
+ UserAbilityFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ UserAbility ua = new UserAbility();
|
|
|
+ BeanUtils.copyProperties(userAbility, ua);
|
|
|
+ if (StringUtils.isBlank(ua.getId())) {
|
|
|
+ ua.setId(UUID.randomUUID().toString());
|
|
|
+ ua.setUid(TokenManager.getUserId());
|
|
|
+ userAbilityService.insert(ua);
|
|
|
} else {
|
|
|
- userAbility.setId(ability.getId());
|
|
|
- userAbilityService.updateByPrimaryKeySelective(userAbility);
|
|
|
+ userAbilityService.updateByPrimaryKeySelective(ua);
|
|
|
}
|
|
|
res.setData(userAbility);
|
|
|
return res;
|
|
|
@@ -442,32 +452,24 @@ public class UserApiController extends BaseApiController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/orgIdentity", method = RequestMethod.POST)
|
|
|
- public Result groupBasicInfo(OrgIdentityBo orgIdentityBo) {
|
|
|
+ public Result groupBasicInfo(@Valid OrgIdentityBo orgIdentityBo, BindingResult bindingResult) {
|
|
|
Result res = new Result();
|
|
|
- OrganizationIdentity organizationIdentity = new OrganizationIdentity();
|
|
|
- OrganizationIdentity identity = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
+ 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);
|
|
|
- organizationIdentity.setContacts(orgIdentityBo.getContacts());
|
|
|
- organizationIdentity.setFixedTel(orgIdentityBo.getFixedTel());
|
|
|
- organizationIdentity.setQq(orgIdentityBo.getQq());
|
|
|
- organizationIdentity.setPostalAddress(orgIdentityBo.getPostalAddress());
|
|
|
- organizationIdentity.setPostcode(orgIdentityBo.getPostcode());
|
|
|
- organizationIdentity.setLegalPerson(orgIdentityBo.getLegalPerson());
|
|
|
- organizationIdentity.setFirstContacts(orgIdentityBo.getFirstContacts());
|
|
|
- organizationIdentity.setSecondContacts(orgIdentityBo.getSecondContacts());
|
|
|
- organizationIdentity.setThirdContacts(orgIdentityBo.getThirdContacts());
|
|
|
- organizationIdentity.setFirstMobile(orgIdentityBo.getFirstMobile());
|
|
|
- organizationIdentity.setSecondMobile(orgIdentityBo.getSecondMobile());
|
|
|
- organizationIdentity.setThirdMobile(orgIdentityBo.getThirdMobile());
|
|
|
- if (identity == null) {
|
|
|
- organizationIdentity.setId(UUID.randomUUID().toString());
|
|
|
- organizationIdentity.setUid(TokenManager.getUserId());
|
|
|
- organizationIdentityService.insert(organizationIdentity);
|
|
|
+ if (StringUtils.isBlank(oi.getId())) {
|
|
|
+ oi.setId(UUID.randomUUID().toString());
|
|
|
+ oi.setUid(TokenManager.getUserId());
|
|
|
+ organizationIdentityService.insert(oi);
|
|
|
} else {
|
|
|
- organizationIdentity.setId(identity.getId());
|
|
|
- organizationIdentityService.updateByPrimaryKeySelective(organizationIdentity);
|
|
|
+ organizationIdentityService.updateByPrimaryKeySelective(oi);
|
|
|
}
|
|
|
res.setData(orgIdentityBo);
|
|
|
return res;
|
|
|
@@ -480,29 +482,22 @@ public class UserApiController extends BaseApiController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/orgPro", method = RequestMethod.POST)
|
|
|
- public Result groupProInfo(OrgProBo proBo) {
|
|
|
- Result res = new Result();
|
|
|
- OrganizationInfo orgInfo = proBo.getInfo();
|
|
|
- OrganizationProperties orgPro = proBo.getPro();
|
|
|
- OrganizationInfo info = organizationInfoService.selectOrgInfoByUserId(TokenManager.getUserId());
|
|
|
- OrganizationProperties pro = organizationPropertiesService.selectOrgProByUserId(TokenManager.getUserId());
|
|
|
- if (info == null) {
|
|
|
- orgInfo.setId(UUID.randomUUID().toString());
|
|
|
- orgInfo.setUid(TokenManager.getUserId());
|
|
|
- orgInfo = organizationInfoService.insert(orgInfo);
|
|
|
- } else {
|
|
|
- orgInfo.setId(info.getId());
|
|
|
- organizationInfoService.updateByPrimaryKeySelective(orgInfo);
|
|
|
- }
|
|
|
- if (pro == null) {
|
|
|
- orgPro.setId(UUID.randomUUID().toString());
|
|
|
- orgPro.setOid(orgInfo.getId());
|
|
|
- organizationPropertiesService.insert(orgPro);
|
|
|
- } else {
|
|
|
- orgPro.setId(pro.getId());
|
|
|
- organizationPropertiesService.updateByPrimaryKeySelective(orgPro);
|
|
|
+ public Result groupProInfo(@Valid InputOrgPro pro, BindingResult bindingResult) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
+ OrgProFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
+ return res;
|
|
|
}
|
|
|
- res.setData(proBo);
|
|
|
+
|
|
|
+ OrganizationInfo oi = new OrganizationInfo();
|
|
|
+ OrganizationProperties op = new OrganizationProperties();
|
|
|
+ BeanUtils.copyProperties(pro, oi);
|
|
|
+ BeanUtils.copyProperties(pro, op);
|
|
|
+ oi.setId(pro.getIid());
|
|
|
+ op.setId(pro.getPid());
|
|
|
+ organizationInfoService.insertInfoAndPro(oi, op);
|
|
|
+ res.setData(pro);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
@@ -513,7 +508,7 @@ public class UserApiController extends BaseApiController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/orgTech", method = RequestMethod.POST)
|
|
|
- public Result tech(OrganizationTech orgTech) {
|
|
|
+ public Result tech(OrganizationTech orgTech, BindingResult bindingResult) {
|
|
|
Result res = new Result();
|
|
|
OrganizationTech tech = organizationTechService.selectOrgTechByUserId(TokenManager.getUserId());
|
|
|
if (tech == null) {
|