|
@ -462,16 +462,27 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
|
|
|
|
|
|
//1、判断企业名称是否已经注册
|
|
|
List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(iotCompany.getAccountType());
|
|
|
for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
|
|
|
//判断营业执照号是否被注册
|
|
|
if (iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) &&
|
|
|
(iotCompanyDO.getStatus().equalsIgnoreCase("1") || iotCompanyDO.getStatus().equalsIgnoreCase("0"))) {
|
|
|
return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
|
|
|
}
|
|
|
if(iotCompany.getName().equalsIgnoreCase(iotCompanyDO.getName())&&(!iotCompany.getId().equalsIgnoreCase(iotCompanyDO.getId()))){
|
|
|
return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
|
|
|
}
|
|
|
// List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(iotCompany.getAccountType());
|
|
|
// for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
|
|
|
// //判断营业执照号是否被注册
|
|
|
// if (iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) &&
|
|
|
// (iotCompanyDO.getStatus().equalsIgnoreCase("1") || iotCompanyDO.getStatus().equalsIgnoreCase("0"))) {
|
|
|
// return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
|
|
|
// }
|
|
|
// if(iotCompany.getName().equalsIgnoreCase(iotCompanyDO.getName())&&(!iotCompany.getId().equalsIgnoreCase(iotCompanyDO.getId()))){
|
|
|
// return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
|
|
|
IotCompanyDO businessLicense = iotCompanyDao.findByBusinessLicenseAndAccountType(iotCompany.getBusinessLicense(), iotCompany.getAccountType());
|
|
|
if (businessLicense!=null){
|
|
|
return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
|
|
|
}
|
|
|
|
|
|
IotCompanyDO name = iotCompanyDao.findByNameAndAccountTypeAndId(iotCompany.getName(), iotCompany.getAccountType(), iotCompany.getId());
|
|
|
if (name!=null){
|
|
|
return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
|
|
|
}
|
|
|
|
|
|
|
|
@ -500,20 +511,16 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
//平台
|
|
|
if (iotCompany.getAccountType().equalsIgnoreCase("0")) {
|
|
|
|
|
|
List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(iotCompany.getAccountType());
|
|
|
|
|
|
IotCompanyAppDO companyAppDO = iotCompany.getAppList().get(0);
|
|
|
|
|
|
for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
|
|
|
//判断营业执照号是否被注册
|
|
|
if (iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) &&
|
|
|
(iotCompanyDO.getStatus().equalsIgnoreCase("1")||iotCompanyDO.getStatus().equalsIgnoreCase("0"))) {
|
|
|
return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
|
|
|
}
|
|
|
if(iotCompany.getName().equalsIgnoreCase(iotCompanyDO.getName())&&(!iotCompany.getId().equalsIgnoreCase(iotCompanyDO.getId()))){
|
|
|
return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
|
|
|
}
|
|
|
IotCompanyDO businessLicense = iotCompanyDao.findByBusinessLicenseAndAccountType(iotCompany.getBusinessLicense(), iotCompany.getAccountType());
|
|
|
if (businessLicense!=null){
|
|
|
return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
|
|
|
}
|
|
|
|
|
|
IotCompanyDO name = iotCompanyDao.findByNameAndAccountTypeAndId(iotCompany.getName(), iotCompany.getAccountType(), iotCompany.getId());
|
|
|
if (name!=null){
|
|
|
return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
|
|
|
}
|
|
|
|
|
|
List<IotCompanyAppDO> apps = iotCompanyAppDao.findAllByDel();
|
|
@ -521,11 +528,12 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
for (IotCompanyAppDO appDO : apps) {
|
|
|
|
|
|
if(companyAppDO.getName().equalsIgnoreCase(appDO.getName())&&(!appDO.getId().equalsIgnoreCase(companyAppDO.getId()))){
|
|
|
return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
|
|
|
return MixEnvelop.getError("该应用名称已被注册,请使用其他企业");
|
|
|
}
|
|
|
|
|
|
if (appDO.getId().equalsIgnoreCase(companyAppDO.getId())) {
|
|
|
appDO.setDel("0");
|
|
|
appDO.setStatus("0");
|
|
|
appDO.setCompanyName(iotCompany.getName());
|
|
|
appDO.setCompanyId(iotCompany.getId());
|
|
|
appDO.setName(companyAppDO.getName());
|
|
@ -542,27 +550,23 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
IotCompanyDO companyDO = null;
|
|
|
//id为空,新增企业
|
|
|
if (StringUtils.isEmpty(iotCompany.getId())) {
|
|
|
companyDO= iotCompanyDao.save(iotCompany);
|
|
|
//厂商
|
|
|
if (companyDO.getAccountType().equalsIgnoreCase("1")) {
|
|
|
if (iotCompany.getAccountType().equalsIgnoreCase("1")) {
|
|
|
|
|
|
IotCompanyDO businessLicense = iotCompanyDao.findByBusinessLicenseAndAccountType(iotCompany.getBusinessLicense(), iotCompany.getAccountType());
|
|
|
if (businessLicense!=null){
|
|
|
return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
|
|
|
}
|
|
|
|
|
|
//1、判断企业名称是否已经注册
|
|
|
List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(companyDO.getAccountType());
|
|
|
for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
|
|
|
//判断营业执照号是否被注册
|
|
|
if (companyDO.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) &&
|
|
|
(iotCompanyDO.getStatus().equalsIgnoreCase("1") || iotCompanyDO.getStatus().equalsIgnoreCase("0"))) {
|
|
|
return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
|
|
|
}
|
|
|
if(companyDO.getName().equalsIgnoreCase(iotCompanyDO.getName())){
|
|
|
return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
|
|
|
}
|
|
|
IotCompanyDO name = iotCompanyDao.findByNameAndAccountType(iotCompany.getName(), iotCompany.getAccountType());
|
|
|
if (name!=null){
|
|
|
return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
|
|
|
}
|
|
|
|
|
|
|
|
|
List<IotCompanyTypeDO> list = companyDO.getTypeList();
|
|
|
String id = companyDO.getId();
|
|
|
List<IotCompanyTypeDO> list = iotCompany.getTypeList();
|
|
|
iotCompany= iotCompanyDao.save(iotCompany);
|
|
|
String id = iotCompany.getId();
|
|
|
//新增类型
|
|
|
List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
|
|
|
list.forEach(one->{
|
|
@ -578,37 +582,43 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
}
|
|
|
|
|
|
//平台
|
|
|
if (companyDO.getAccountType().equalsIgnoreCase("0")) {
|
|
|
|
|
|
List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(companyDO.getAccountType());
|
|
|
if (iotCompany.getAccountType().equalsIgnoreCase("0")) {
|
|
|
|
|
|
IotCompanyAppDO companyAppDO = companyDO.getAppList().get(0);
|
|
|
IotCompanyAppDO companyAppDO = iotCompany.getAppList().get(0);
|
|
|
|
|
|
for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
|
|
|
//判断营业执照号是否被注册
|
|
|
if (companyDO.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) &&
|
|
|
(iotCompanyDO.getStatus().equalsIgnoreCase("1")||iotCompanyDO.getStatus().equalsIgnoreCase("0"))) {
|
|
|
return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
|
|
|
}
|
|
|
if(companyDO.getName().equalsIgnoreCase(iotCompanyDO.getName())){
|
|
|
return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
|
|
|
}
|
|
|
IotCompanyDO businessLicense = iotCompanyDao.findByBusinessLicenseAndAccountType(iotCompany.getBusinessLicense(), iotCompany.getAccountType());
|
|
|
if (businessLicense!=null){
|
|
|
return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
|
|
|
}
|
|
|
|
|
|
IotCompanyDO name = iotCompanyDao.findByNameAndAccountType(iotCompany.getName(), iotCompany.getAccountType());
|
|
|
if (name!=null){
|
|
|
return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
|
|
|
}
|
|
|
List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findAllByDel();
|
|
|
for (IotCompanyAppDO one : appDOList) {
|
|
|
if (one.getName().equalsIgnoreCase(companyAppDO.getName())){
|
|
|
return MixEnvelop.getError("该应用已注册,请使用其他应用");
|
|
|
}
|
|
|
|
|
|
// List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findAllByDel();
|
|
|
// for (IotCompanyAppDO one : appDOList) {
|
|
|
// if (one.getName().equalsIgnoreCase(companyAppDO.getName())){
|
|
|
// return MixEnvelop.getError("该应用已注册,请使用其他应用");
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
IotCompanyAppDO appDaoByName = iotCompanyAppDao.findByName(companyAppDO.getName());
|
|
|
if (appDaoByName!=null){
|
|
|
return MixEnvelop.getError("该应用已注册,请使用其他应用");
|
|
|
}
|
|
|
|
|
|
//保存应用
|
|
|
companyDO= iotCompanyDao.save(iotCompany);
|
|
|
IotCompanyAppDO iotCompanyAppDO = new IotCompanyAppDO();
|
|
|
iotCompanyAppDO.setSaasId(getCode());
|
|
|
iotCompanyAppDO.setCompanyId(companyDO.getId());
|
|
|
iotCompanyAppDO.setCompanyName(companyDO.getName());
|
|
|
iotCompanyAppDO.setName(companyAppDO.getName());
|
|
|
iotCompanyAppDO.setAddressIp(companyAppDO.getAddressIp());
|
|
|
iotCompanyAppDO.setDel("0");
|
|
|
iotCompanyAppDO.setDel("1");
|
|
|
//新增应用 先设置应用无效 审核通过后更改为有效
|
|
|
iotCompanyAppDO.setStatus("0");
|
|
|
iotCompanyAppDao.save(iotCompanyAppDO);
|
|
|
}
|
|
|
}
|
|
@ -658,6 +668,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
appDO.setCompanyName(iotCompany.getName());
|
|
|
appDO.setDel("1");
|
|
|
appDO.setSaasId(getCode());
|
|
|
appDO.setStatus("1");
|
|
|
iotCompanyAppDao.save(appDO);
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_create);
|
|
|
}
|
|
@ -954,9 +965,9 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
|
|
|
//审核通过 设置平台应用为有效
|
|
|
if (companyDO.getAccountType().equalsIgnoreCase("0")){
|
|
|
List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findByCompanyIdAndDel(id);
|
|
|
List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findByCompanyIdAndStatus(id);
|
|
|
appDOList.forEach(one->{
|
|
|
one.setDel("1");
|
|
|
one.setStatus("1");
|
|
|
iotCompanyAppDao.save(one);
|
|
|
});
|
|
|
}
|