|
@@ -6,6 +6,7 @@ import com.uas.account.util.AccountUtils;
|
|
|
import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
|
|
import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
|
|
|
import com.uas.platform.b2c.common.account.dao.UserBaseInfoDao;
|
|
import com.uas.platform.b2c.common.account.dao.UserBaseInfoDao;
|
|
|
import com.uas.platform.b2c.common.account.model.Enterprise;
|
|
import com.uas.platform.b2c.common.account.model.Enterprise;
|
|
|
|
|
+import com.uas.platform.b2c.common.account.model.FormEnterprise;
|
|
|
import com.uas.platform.b2c.common.account.model.User;
|
|
import com.uas.platform.b2c.common.account.model.User;
|
|
|
import com.uas.platform.b2c.common.account.model.UserBaseInfo;
|
|
import com.uas.platform.b2c.common.account.model.UserBaseInfo;
|
|
|
import com.uas.platform.b2c.common.account.service.EnterpriseService;
|
|
import com.uas.platform.b2c.common.account.service.EnterpriseService;
|
|
@@ -21,6 +22,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
+import java.lang.reflect.Array;
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -129,18 +132,32 @@ public class EnterpriseServiceImpl implements EnterpriseService{
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public ResultMap registerEnterprise(Enterprise enterprise, String filePath, User user) {
|
|
|
|
|
|
|
+ public ResultMap registerEnterprise(FormEnterprise enterprise, String filePath, User user) {
|
|
|
UserSpaceDetail detail = new UserSpaceDetail();
|
|
UserSpaceDetail detail = new UserSpaceDetail();
|
|
|
- detail.setName(enterprise.getEnName());
|
|
|
|
|
- detail.setShortName(enterprise.getEnShortname());
|
|
|
|
|
- detail.setBusinessCode(enterprise.getEnBussinessCode());
|
|
|
|
|
- detail.setBusinessCodeImage(filePath);
|
|
|
|
|
- if (null == detail.getName()|| null == detail.getShortName() || null==detail.getBusinessCode() || null==detail.getBusinessCodeImage()){
|
|
|
|
|
|
|
+ detail.setName(enterprise.getName());
|
|
|
|
|
+ detail.setShortName(null);
|
|
|
|
|
+ detail.setBusinessCode(enterprise.getLicenceId());
|
|
|
|
|
+ detail.setBusinessCodeImage(enterprise.getUrl());
|
|
|
|
|
+ if (null == detail.getName()|| null==detail.getBusinessCode() || null==detail.getBusinessCodeImage()){
|
|
|
return new ResultMap(CodeType.SYSTEM_NOT_EXIST, "参数不能为空");
|
|
return new ResultMap(CodeType.SYSTEM_NOT_EXIST, "参数不能为空");
|
|
|
}
|
|
}
|
|
|
detail.setArea("中国大陆");
|
|
detail.setArea("中国大陆");
|
|
|
- detail.setAddress(enterprise.getEnAddress());
|
|
|
|
|
- detail.setUrl(enterprise.getEnUrl());
|
|
|
|
|
|
|
+ detail.setCorporation(enterprise.getLawPerson());
|
|
|
|
|
+ detail.setAddress(enterprise.getAddress());
|
|
|
|
|
+ detail.setUrl(enterprise.getWebsite());
|
|
|
|
|
+ detail.setContactMan(enterprise.getLinkman());
|
|
|
|
|
+ detail.setContactTel(enterprise.getPhone());
|
|
|
|
|
+ detail.setContactEmail(enterprise.getEmail());
|
|
|
|
|
+ detail.setFax(enterprise.getFax());
|
|
|
|
|
+ detail.setLogoImage(enterprise.getLogoUrl());
|
|
|
|
|
+ detail.setProfession(enterprise.getProfession());
|
|
|
|
|
+ if (null != enterprise.getTagsData() || enterprise.getTagsData().length>0){
|
|
|
|
|
+ String str = Arrays.toString(enterprise.getTagsData());
|
|
|
|
|
+ str = str.substring(1, str.length()-1);
|
|
|
|
|
+ detail.setTags(str);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ detail.setTags(null);
|
|
|
|
|
+ }
|
|
|
detail.setAdminName(user.getUserName());
|
|
detail.setAdminName(user.getUserName());
|
|
|
detail.setAdminEmail(user.getUserEmail());
|
|
detail.setAdminEmail(user.getUserEmail());
|
|
|
detail.setAdminTel(user.getUserTel());
|
|
detail.setAdminTel(user.getUserTel());
|
|
@@ -161,6 +178,9 @@ public class EnterpriseServiceImpl implements EnterpriseService{
|
|
|
public ResultMap validName(String name) {
|
|
public ResultMap validName(String name) {
|
|
|
try {
|
|
try {
|
|
|
String result = AccountUtils.validName(name);
|
|
String result = AccountUtils.validName(name);
|
|
|
|
|
+ if ("connect timed out".equals(result) || "Read timed out".equals(result)){
|
|
|
|
|
+ return new ResultMap(CodeType.TIME_OUT, "请求超时");
|
|
|
|
|
+ }
|
|
|
JSONObject resultJSON = JSONObject.parseObject(result);
|
|
JSONObject resultJSON = JSONObject.parseObject(result);
|
|
|
if (true == (boolean)resultJSON.get("inCloud") || true == (boolean)resultJSON.get("hasCreate")){
|
|
if (true == (boolean)resultJSON.get("inCloud") || true == (boolean)resultJSON.get("hasCreate")){
|
|
|
return new ResultMap(CodeType.SYSTEM_ERROR, "校验失败");
|
|
return new ResultMap(CodeType.SYSTEM_ERROR, "校验失败");
|
|
@@ -168,7 +188,7 @@ public class EnterpriseServiceImpl implements EnterpriseService{
|
|
|
return ResultMap.success("校验成功");
|
|
return ResultMap.success("校验成功");
|
|
|
}
|
|
}
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
|
- return new ResultMap(CodeType.SYSTEM_ERROR, "校验失败");
|
|
|
|
|
|
|
+ return new ResultMap(CodeType.TIME_OUT, "请求超时");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -176,6 +196,9 @@ public class EnterpriseServiceImpl implements EnterpriseService{
|
|
|
public ResultMap validBusinessCode(String businessCode) {
|
|
public ResultMap validBusinessCode(String businessCode) {
|
|
|
try {
|
|
try {
|
|
|
String result = AccountUtils.validBusinessCode(businessCode);
|
|
String result = AccountUtils.validBusinessCode(businessCode);
|
|
|
|
|
+ if ("connect timed out".equals(result) || "Read timed out".equals(result)){
|
|
|
|
|
+ return new ResultMap(CodeType.TIME_OUT, "请求超时");
|
|
|
|
|
+ }
|
|
|
JSONObject resultJSON = JSONObject.parseObject(result);
|
|
JSONObject resultJSON = JSONObject.parseObject(result);
|
|
|
if (true == (boolean)resultJSON.get("inCloud") || true == (boolean)resultJSON.get("hasCreate")){
|
|
if (true == (boolean)resultJSON.get("inCloud") || true == (boolean)resultJSON.get("hasCreate")){
|
|
|
return new ResultMap(CodeType.SYSTEM_ERROR, "校验失败");
|
|
return new ResultMap(CodeType.SYSTEM_ERROR, "校验失败");
|
|
@@ -183,7 +206,24 @@ public class EnterpriseServiceImpl implements EnterpriseService{
|
|
|
return ResultMap.success("校验成功");
|
|
return ResultMap.success("校验成功");
|
|
|
}
|
|
}
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
|
- return new ResultMap(CodeType.SYSTEM_ERROR, "校验失败");
|
|
|
|
|
|
|
+ return new ResultMap(CodeType.TIME_OUT, "请求超时");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Enterprise openVendor(Long enUU , boolean isRead , boolean isOpen) {
|
|
|
|
|
+ Enterprise existEnterprise = enterpriseDao.findOne(enUU);
|
|
|
|
|
+ if (isOpen){
|
|
|
|
|
+ existEnterprise.setEnMallVendorStatus((short) Status.ENABLED.value());
|
|
|
|
|
+ Enterprise enterprise = enterpriseDao.save(existEnterprise);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isRead) {
|
|
|
|
|
+ existEnterprise.setEnMallVendorStatus((short) Status.ISREAD.value());
|
|
|
|
|
+ }else{
|
|
|
|
|
+ existEnterprise.setEnMallVendorStatus(null);
|
|
|
}
|
|
}
|
|
|
|
|
+ Enterprise enterprise = enterpriseDao.save(existEnterprise);
|
|
|
|
|
+ return null;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|