|
|
@@ -1,6 +1,7 @@
|
|
|
package com.goafanti.user.controller;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.Base64;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
@@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import com.goafanti.business.service.JtBusinessService;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.BaseApiController;
|
|
|
@@ -42,7 +44,6 @@ import com.goafanti.common.utils.TimeUtils;
|
|
|
import com.goafanti.common.utils.VerifyCodeUtils;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
import com.goafanti.easemob.EasemobUtils;
|
|
|
-import com.goafanti.order.enums.AuditState;
|
|
|
import com.goafanti.user.bo.ExpertUserIdentity;
|
|
|
import com.goafanti.user.bo.InputOrgPro;
|
|
|
import com.goafanti.user.bo.InputOrganizationIdentity;
|
|
|
@@ -85,6 +86,9 @@ public class UserApiController extends BaseApiController {
|
|
|
private UserContactService userContactService;
|
|
|
@Autowired
|
|
|
private EasemobUtils easemobUtils;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private JtBusinessService jtBusinessService;
|
|
|
|
|
|
private static final Integer STEP_ONE = 1;
|
|
|
|
|
|
@@ -515,19 +519,13 @@ public class UserApiController extends BaseApiController {
|
|
|
UserIdentityFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
return res;
|
|
|
}
|
|
|
- if(StringUtils.isBlank(organizationIdentity.getUid())) {
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "用户ID"));
|
|
|
+ res=validation(organizationIdentity, res);
|
|
|
+ if (!res.getError().isEmpty()) {
|
|
|
return res;
|
|
|
}
|
|
|
- if(organizationIdentity.getAuthentication() == UserAuthentication.AUTHENTICATION.getCode()
|
|
|
- && organizationIdentity.getType() == UserType.PERSONAL.getCode()){
|
|
|
- res.getError().add(buildError(null, "", "用户已经个人认证"));
|
|
|
- return res;
|
|
|
- }else if(organizationIdentity.getAuthentication() == UserAuthentication.UN_AUTHENTICATION.getCode()){
|
|
|
- organizationIdentity.setType(UserType.ORGANIZATION.getCode());
|
|
|
- organizationIdentity.setAuthentication(UserAuthentication.AUTHENTICATION.getCode());
|
|
|
- }
|
|
|
+
|
|
|
if (res.getError().isEmpty()) {
|
|
|
+
|
|
|
OrganizationIdentity oi = new OrganizationIdentity();
|
|
|
User user = new User();
|
|
|
BeanUtils.copyProperties(organizationIdentity, oi);
|
|
|
@@ -539,6 +537,9 @@ public class UserApiController extends BaseApiController {
|
|
|
organizationIdentityService.insert(oi);
|
|
|
} else {
|
|
|
oi.setId(u.getId());
|
|
|
+ if(null == oi.getEnterpriseScale()){
|
|
|
+ oi.setEnterpriseScale("");
|
|
|
+ }
|
|
|
organizationIdentityService.updateByPrimaryKeySelective(oi);
|
|
|
}
|
|
|
user.setId(TokenManager.getUserId());
|
|
|
@@ -547,6 +548,54 @@ public class UserApiController extends BaseApiController {
|
|
|
res.setData(organizationIdentity);
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ private Result validation(InputOrganizationIdentity organizationIdentity, Result res) {
|
|
|
+ if(StringUtils.isBlank(organizationIdentity.getUid())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "用户ID", "用户ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(organizationIdentity.getQq())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "企业QQ", "企业QQ"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(organizationIdentity.getIdentifyName())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "单位名称", "单位名称"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(organizationIdentity.getCompanyLogoUrl())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "LOGO", "LOGO"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(organizationIdentity.getBusinessScope())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "业务范围", "业务范围"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(organizationIdentity.getIntroduction())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "企业简介", "企业简介"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(organizationIdentity.getHonorPicture())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "荣誉资质", "荣誉资质"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(organizationIdentity.getEmail())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "企业邮箱", "企业邮箱"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ /*if(null==organizationIdentity.getLicenceProvince()||null==organizationIdentity.getLicenceCity()) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "地区"));
|
|
|
+ return res;
|
|
|
+ }*/
|
|
|
+ if(organizationIdentity.getAuthentication() == UserAuthentication.AUTHENTICATION.getCode()
|
|
|
+ && organizationIdentity.getType() == UserType.PERSONAL.getCode()){
|
|
|
+ res.getError().add(buildError(null, "", "用户已经个人认证"));
|
|
|
+ return res;
|
|
|
+ }else if(organizationIdentity.getAuthentication() == UserAuthentication.UN_AUTHENTICATION.getCode()){
|
|
|
+ organizationIdentity.setType(UserType.ORGANIZATION.getCode());
|
|
|
+ organizationIdentity.setAuthentication(UserAuthentication.AUTHENTICATION.getCode());
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 个人资料/团体会员资料
|
|
|
@@ -914,4 +963,27 @@ public class UserApiController extends BaseApiController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 解码base64位图片
|
|
|
+ * @param picturebase
|
|
|
+ * @param filename
|
|
|
+ * @param sign
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value="/uploadPicture64")
|
|
|
+ public Result uploadPicture64(String picturebase, String filename,String sign){
|
|
|
+ Result res = new Result();
|
|
|
+ byte[] bs=Base64.getDecoder().decode(picturebase);
|
|
|
+ AttachmentType attachmentType = AttachmentType.getField(sign);
|
|
|
+ if (attachmentType == AttachmentType.USER_PICTURE) {
|
|
|
+ filename = System.nanoTime() + filename.substring(filename.indexOf("."));
|
|
|
+ res.setData(handleBaseFiles(res, "/user/", false,bs, sign, TokenManager.getUserId(),filename));
|
|
|
+ } else {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|