|
|
@@ -16,7 +16,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import com.alibaba.druid.sql.parser.Token;
|
|
|
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.IdentityAuditStatus;
|
|
|
@@ -25,6 +27,7 @@ import com.goafanti.common.enums.OrgProFields;
|
|
|
import com.goafanti.common.enums.OrganizationIdentityFields;
|
|
|
import com.goafanti.common.enums.OrganizationTechFields;
|
|
|
import com.goafanti.common.enums.UserAbilityFields;
|
|
|
+import com.goafanti.common.enums.UserAuthentication;
|
|
|
import com.goafanti.common.enums.UserCareerFields;
|
|
|
import com.goafanti.common.enums.UserEduFields;
|
|
|
import com.goafanti.common.enums.UserIdentityFields;
|
|
|
@@ -42,17 +45,20 @@ import com.goafanti.common.utils.VerifyCodeUtils;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
import com.goafanti.easemob.EasemobUtils;
|
|
|
import com.goafanti.user.bo.InputOrgPro;
|
|
|
+import com.goafanti.user.bo.InputOrganizationIdentity;
|
|
|
import com.goafanti.user.bo.InputOrganizationTech;
|
|
|
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.UserContactBo;
|
|
|
import com.goafanti.user.bo.UserIdentityBo;
|
|
|
import com.goafanti.user.service.OrganizationIdentityService;
|
|
|
import com.goafanti.user.service.OrganizationTechService;
|
|
|
import com.goafanti.user.service.UserAbilityService;
|
|
|
import com.goafanti.user.service.UserCareerService;
|
|
|
+import com.goafanti.user.service.UserContactService;
|
|
|
import com.goafanti.user.service.UserEduService;
|
|
|
import com.goafanti.user.service.UserIdentityService;
|
|
|
import com.goafanti.user.service.UserService;
|
|
|
@@ -76,6 +82,8 @@ public class UserApiController extends BaseApiController {
|
|
|
private OrganizationIdentityService organizationIdentityService;
|
|
|
@Resource
|
|
|
private OrganizationTechService organizationTechService;
|
|
|
+ @Resource
|
|
|
+ private UserContactService userContactService;
|
|
|
@Autowired
|
|
|
private EasemobUtils easemobUtils;
|
|
|
|
|
|
@@ -171,40 +179,7 @@ public class UserApiController extends BaseApiController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 个人会员基本信息
|
|
|
- *
|
|
|
- * @param userIdentity
|
|
|
- * @param bindingResult
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/userIndentity", method = RequestMethod.POST)
|
|
|
- public Result basicInfo(@Valid InputUserIdentity userIdentity, BindingResult bindingResult) {
|
|
|
- Result res = new Result();
|
|
|
- if (bindingResult.hasErrors()) {
|
|
|
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
- UserIdentityFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
- return res;
|
|
|
- }
|
|
|
- if (res.getError().isEmpty()) {
|
|
|
- UserIdentity ui = new UserIdentity();
|
|
|
- BeanUtils.copyProperties(userIdentity, ui);
|
|
|
- UserIdentity u = userIdentityService.selectUserIdentityByUserId(TokenManager.getUserId());
|
|
|
- if (null == u && StringUtils.isBlank(ui.getId())) {
|
|
|
- ui.setId(UUID.randomUUID().toString());
|
|
|
- ui.setUid(TokenManager.getUserId());
|
|
|
- userIdentityService.insert(ui);
|
|
|
- } else {
|
|
|
- if (StringUtils.isBlank(ui.getId())) {
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "认证信息ID"));
|
|
|
- return res;
|
|
|
- }
|
|
|
- userIdentityService.updateByPrimaryKeySelective(ui);
|
|
|
- }
|
|
|
- }
|
|
|
- res.setData(userIdentity);
|
|
|
- return res;
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 公共
|
|
|
@@ -356,25 +331,6 @@ public class UserApiController extends BaseApiController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 团体会员基本信息
|
|
|
- *
|
|
|
- * @param orgIdentityBo
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/orgIdentity", method = RequestMethod.POST)
|
|
|
- public Result groupBasicInfo(@Valid OrgIdentityBo orgIdentityBo, BindingResult bindingResult) {
|
|
|
- Result res = new Result();
|
|
|
- if (bindingResult.hasErrors()) {
|
|
|
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
- OrganizationIdentityFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
- return res;
|
|
|
- }
|
|
|
- organizationIdentityService.save(orgIdentityBo);
|
|
|
- res.setData(orgIdentityBo);
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* 团体会员单位资料
|
|
|
*
|
|
|
* @param orgInfo
|
|
|
@@ -431,8 +387,8 @@ public class UserApiController extends BaseApiController {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- @RequestMapping(value = "/personalBase", method = RequestMethod.GET)
|
|
|
- public Result personalBase() {
|
|
|
+ @RequestMapping(value = "/getUserDetail", method = RequestMethod.GET)
|
|
|
+ public Result getUserDetail() {
|
|
|
Result res = new Result();
|
|
|
UserIdentityBo u = userIdentityService.selectUserIdentityBoByUserId(TokenManager.getUserId());
|
|
|
res.setData(u);
|
|
|
@@ -440,16 +396,109 @@ public class UserApiController extends BaseApiController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 团体会员基本信息
|
|
|
+ * 个人会员基本信息
|
|
|
+ *
|
|
|
+ * @param userIdentity
|
|
|
+ * @param bindingResult
|
|
|
* @return
|
|
|
*/
|
|
|
- @RequestMapping(value = "/organizationBase", method = RequestMethod.GET)
|
|
|
- public Result organizationBase(){
|
|
|
+ @RequestMapping(value = "/updateUserDetail", method = RequestMethod.POST)
|
|
|
+ public Result updateUserDetail(@Valid InputUserIdentity userIdentity, BindingResult bindingResult) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
+ UserIdentityFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(userIdentity.getId())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "认证信息ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(userIdentity.getUid())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "用户ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(userIdentity.getAuthentication() == UserAuthentication.PERSON_AUTHENTICATION.getCode()){
|
|
|
+ res.getError().add(buildError(null, "", "用户已经企业认证"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (res.getError().isEmpty()) {
|
|
|
+ UserIdentity ui = new UserIdentity();
|
|
|
+ User user = new User();
|
|
|
+ BeanUtils.copyProperties(userIdentity, ui);
|
|
|
+ BeanUtils.copyProperties(userIdentity, user);
|
|
|
+ UserIdentity u = userIdentityService.selectUserIdentityByUserId(TokenManager.getUserId());
|
|
|
+ if (null == u) {
|
|
|
+ ui.setId(UUID.randomUUID().toString());
|
|
|
+ ui.setUid(TokenManager.getUserId());
|
|
|
+ userIdentityService.insert(ui);
|
|
|
+ } else {
|
|
|
+ userIdentityService.updateByPrimaryKeySelective(ui);
|
|
|
+ }
|
|
|
+ userService.updateByPrimaryKeySelective(user);
|
|
|
+ }
|
|
|
+ res.setData(userIdentity);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业信息详情
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/getOrganizationDetail", method = RequestMethod.GET)
|
|
|
+ public Result getOrganizationDetail(){
|
|
|
Result res = new Result();
|
|
|
OrgIdentityBo o = organizationIdentityService.selectOrgIdentityBoByUserId(TokenManager.getUserId());
|
|
|
res.setData(o);
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改企业信息
|
|
|
+ *
|
|
|
+ * @param userIdentity
|
|
|
+ * @param bindingResult
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/updateOrganizationDetail", method = RequestMethod.POST)
|
|
|
+ public Result updateOrganizationDetail(@Valid InputOrganizationIdentity organizationIdentity, BindingResult bindingResult) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
+ UserIdentityFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(organizationIdentity.getId())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "认证信息ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(organizationIdentity.getUid())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "用户ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(organizationIdentity.getAuthentication() == UserAuthentication.PERSON_AUTHENTICATION.getCode()){
|
|
|
+ res.getError().add(buildError(null, "", "用户已经个人认证"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (res.getError().isEmpty()) {
|
|
|
+ OrganizationIdentity oi = new OrganizationIdentity();
|
|
|
+ User user = new User();
|
|
|
+ BeanUtils.copyProperties(organizationIdentity, oi);
|
|
|
+ BeanUtils.copyProperties(organizationIdentity, user);
|
|
|
+ OrgIdentityBo u = organizationIdentityService.selectOrgIdentityBoByUserId(TokenManager.getUserId());
|
|
|
+ if (null == u) {
|
|
|
+ oi.setId(UUID.randomUUID().toString());
|
|
|
+ oi.setUid(TokenManager.getUserId());
|
|
|
+ organizationIdentityService.insert(oi);
|
|
|
+ } else {
|
|
|
+ organizationIdentityService.updateByPrimaryKeySelective(oi);
|
|
|
+ }
|
|
|
+ userService.updateByPrimaryKeySelective(user);
|
|
|
+ }
|
|
|
+ res.setData(organizationIdentity);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 个人资料/团体会员资料
|
|
|
*/
|
|
|
@@ -619,16 +668,6 @@ public class UserApiController extends BaseApiController {
|
|
|
return dealUserProcess(res, userIdentity, TokenManager.getUserId());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取公司联系人
|
|
|
- */
|
|
|
- @RequestMapping(value = "/getContacts", method = RequestMethod.GET)
|
|
|
- public Result getContacts() {
|
|
|
- Result res = new Result();
|
|
|
- res.setData(organizationIdentityService.selectContactsByUserId(TokenManager.getUserId()));
|
|
|
- return res;
|
|
|
- }
|
|
|
|
|
|
// 认证失败清除相关认证信息
|
|
|
private Result dealFaild(Result res) {
|
|
|
@@ -676,4 +715,70 @@ public class UserApiController extends BaseApiController {
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增客户联系人
|
|
|
+ * @param bo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/addUserContcat", method = RequestMethod.POST)
|
|
|
+ public Result addUserContcat(UserContactBo bo){
|
|
|
+ Result res = new Result();
|
|
|
+ if(StringUtils.isBlank(bo.getMobile())){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "手机号码不能为空"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(userContactService.checkUserContact(TokenManager.getUserId(), bo.getMobile())){
|
|
|
+ res.getError().add(buildError(ErrorConstants.USER_CONTACT_ALREADY_EXIST,"联系人已存在"));
|
|
|
+ }
|
|
|
+ userContactService.insertSelective(bo);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改客户联系人
|
|
|
+ * @param bo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/udpateUserContact", method = RequestMethod.POST)
|
|
|
+ public Result udpateUserContact(UserContactBo bo){
|
|
|
+ Result res = new Result();
|
|
|
+ if(StringUtils.isBlank(bo.getMobile())){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "手机号码不能为空"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(bo.getId())){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "联系人ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ userContactService.updateByPrimaryKeySelective(bo);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除客户联系人
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/deleteUserContact", method = RequestMethod.GET)
|
|
|
+ public Result deleteUserContact(String id){
|
|
|
+ Result res = new Result();
|
|
|
+ if(StringUtils.isBlank(id)){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "联系人ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ userContactService.deleteUserContact(id);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取用户联系人
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/getUserContacts", method = RequestMethod.GET)
|
|
|
+ public Result getUserContacts(){
|
|
|
+ Result res = new Result();
|
|
|
+ res.setData(userContactService.selectContactByUid(TokenManager.getUserId()));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
}
|