|
@ -1,8 +1,10 @@
|
|
package com.yihu.iot.service.company;
|
|
package com.yihu.iot.service.company;
|
|
|
|
|
|
import com.yihu.iot.dao.company.*;
|
|
import com.yihu.iot.dao.company.*;
|
|
|
|
import com.yihu.iot.dao.platform.IotCompanyAppInterfaceDao;
|
|
import com.yihu.iot.service.useragent.UserAgent;
|
|
import com.yihu.iot.service.useragent.UserAgent;
|
|
import com.yihu.jw.entity.iot.company.*;
|
|
import com.yihu.jw.entity.iot.company.*;
|
|
|
|
import com.yihu.jw.entity.iot.platform.IotCompanyAppInterfaceDO;
|
|
import com.yihu.jw.restmodel.iot.company.IotCompanyAppVO;
|
|
import com.yihu.jw.restmodel.iot.company.IotCompanyAppVO;
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
import com.yihu.jw.restmodel.iot.company.IotCompanyTypeVO;
|
|
import com.yihu.jw.restmodel.iot.company.IotCompanyTypeVO;
|
|
@ -40,7 +42,8 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
private IotCompanyAppDao iotCompanyAppDao;
|
|
private IotCompanyAppDao iotCompanyAppDao;
|
|
@Autowired
|
|
@Autowired
|
|
private UserAgent userAgent;
|
|
private UserAgent userAgent;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private IotCompanyAppInterfaceDao iotCompanyAppInterfaceDao;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -309,6 +312,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
companyType.setCompanyId(id);
|
|
companyType.setCompanyId(id);
|
|
companyType.setType(one.getType());
|
|
companyType.setType(one.getType());
|
|
companyType.setTypeName(one.getTypeName());
|
|
companyType.setTypeName(one.getTypeName());
|
|
|
|
companyType.setDel("0");
|
|
companyTypes.add(companyType);
|
|
companyTypes.add(companyType);
|
|
});
|
|
});
|
|
iotCompanyTypeDao.save(companyTypes);
|
|
iotCompanyTypeDao.save(companyTypes);
|
|
@ -462,6 +466,42 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
return MixEnvelop.getError("该企业已删除,请勿重复操作");
|
|
return MixEnvelop.getError("该企业已删除,请勿重复操作");
|
|
}
|
|
}
|
|
company.setDel(0);
|
|
company.setDel(0);
|
|
|
|
//删除企业下的信息 平台信息
|
|
|
|
if(company.getAccountType().equalsIgnoreCase("0")){
|
|
|
|
List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findByCompanyId(company.getId());
|
|
|
|
if (appDOList!=null&&appDOList.size()>0){
|
|
|
|
//删除应用信息
|
|
|
|
appDOList.forEach(one->{
|
|
|
|
one.setDel("0");
|
|
|
|
//删除接口信息
|
|
|
|
List<IotCompanyAppInterfaceDO> interfaceDOList = iotCompanyAppInterfaceDao.findByAppId(one.getId());
|
|
|
|
if (interfaceDOList!=null&&interfaceDOList.size()>0){
|
|
|
|
interfaceDOList.forEach(tow->{
|
|
|
|
tow.setDel("1");
|
|
|
|
iotCompanyAppInterfaceDao.save(tow);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
iotCompanyAppDao.save(one);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//删除产商信息
|
|
|
|
if (company.getAccountType().equalsIgnoreCase("1")){
|
|
|
|
List<IotCompanyTypeDO> typeDOList = iotCompanyTypeDao.findByCompanyId(company.getId());
|
|
|
|
//删除产商类型
|
|
|
|
if (typeDOList!=null&&typeDOList.size()>0){
|
|
|
|
typeDOList.forEach(one->{
|
|
|
|
one.setDel("1");
|
|
|
|
iotCompanyTypeDao.save(one);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
iotCompanyDao.save(company);
|
|
iotCompanyDao.save(company);
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_delete);
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_delete);
|
|
}
|
|
}
|
|
@ -475,7 +515,10 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
if(accountType.equalsIgnoreCase("1")){
|
|
if(accountType.equalsIgnoreCase("1")){
|
|
//更新类型
|
|
//更新类型
|
|
List<IotCompanyTypeDO> typeList = iotCompanyTypeDao.findByCompanyId(iotCompany.getId());
|
|
List<IotCompanyTypeDO> typeList = iotCompanyTypeDao.findByCompanyId(iotCompany.getId());
|
|
iotCompanyTypeDao.delete(typeList);
|
|
|
|
|
|
typeList.forEach(one->{
|
|
|
|
one.setDel("1");
|
|
|
|
iotCompanyTypeDao.save(one);
|
|
|
|
});
|
|
List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
|
|
List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
|
|
|
|
|
|
iotCompany.getTypeList().forEach(one->{
|
|
iotCompany.getTypeList().forEach(one->{
|
|
@ -484,10 +527,12 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
companyType.setCompanyId(iotCompany.getId());
|
|
companyType.setCompanyId(iotCompany.getId());
|
|
companyType.setType(one.getType());
|
|
companyType.setType(one.getType());
|
|
companyType.setTypeName(one.getTypeName());
|
|
companyType.setTypeName(one.getTypeName());
|
|
|
|
companyType.setDel("0");
|
|
companyTypes.add(companyType);
|
|
companyTypes.add(companyType);
|
|
});
|
|
});
|
|
|
|
|
|
iotCompanyTypeDao.save(companyTypes);
|
|
iotCompanyTypeDao.save(companyTypes);
|
|
|
|
|
|
}
|
|
}
|
|
//更新应用
|
|
//更新应用
|
|
if(accountType.equalsIgnoreCase("0")){
|
|
if(accountType.equalsIgnoreCase("0")){
|
|
@ -678,7 +723,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
|
|
|
IotCompanyDO companyDO = iotCompanyDao.findByAccount(userAgent.getUNAME());
|
|
IotCompanyDO companyDO = iotCompanyDao.findByAccount(userAgent.getUNAME());
|
|
if (companyDO==null){
|
|
if (companyDO==null){
|
|
return MixEnvelop.getError("未入驻企业",-1);
|
|
|
|
|
|
return MixEnvelop.getSuccess("未入驻企业",-1);
|
|
}
|
|
}
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,companyDO.getStatus());
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,companyDO.getStatus());
|
|
}
|
|
}
|