|
@ -1,11 +1,15 @@
|
|
|
package com.yihu.iot.service.company;
|
|
|
|
|
|
import com.yihu.iot.dao.company.IotCompanyAppDao;
|
|
|
import com.yihu.iot.dao.company.IotCompanyCertificateChangeRecordDao;
|
|
|
import com.yihu.iot.dao.company.IotCompanyDao;
|
|
|
import com.yihu.iot.dao.company.IotCompanyTypeDao;
|
|
|
import com.yihu.iot.service.useragent.UserAgent;
|
|
|
import com.yihu.jw.entity.iot.company.IotCompanyAppDO;
|
|
|
import com.yihu.jw.entity.iot.company.IotCompanyCertificateChangeRecordDO;
|
|
|
import com.yihu.jw.entity.iot.company.IotCompanyDO;
|
|
|
import com.yihu.jw.entity.iot.company.IotCompanyTypeDO;
|
|
|
import com.yihu.jw.restmodel.iot.company.IotCompanyAppVO;
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
|
import com.yihu.jw.restmodel.iot.company.IotCompanyTypeVO;
|
|
|
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
|
|
@ -38,33 +42,47 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
private JdbcTemplate jdbcTempalte;
|
|
|
@Autowired
|
|
|
private IotCompanyCertificateChangeRecordDao iotCompanyCertificateChangeRecordDao;
|
|
|
@Autowired
|
|
|
private IotCompanyAppDao iotCompanyAppDao;
|
|
|
@Autowired
|
|
|
private UserAgent userAgent;
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 分页查找
|
|
|
* 审核通过 分页查找
|
|
|
* @param page
|
|
|
* @param size
|
|
|
* @param status
|
|
|
* @param name
|
|
|
* @param accountType
|
|
|
* @param enterType
|
|
|
* @return
|
|
|
* @throws ParseException
|
|
|
*/
|
|
|
public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String status, String name) throws ParseException {
|
|
|
public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String accountType, String enterType) throws ParseException {
|
|
|
String filters = "del=1;";
|
|
|
String semicolon = "";
|
|
|
if(StringUtils.isNotBlank(name)){
|
|
|
filters += "name?"+name+" g1;contactsName?"+name+" g1";
|
|
|
if(StringUtils.isNotBlank(accountType)){
|
|
|
filters += "accountType?"+accountType;
|
|
|
semicolon = ";";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(status)){
|
|
|
filters += semicolon +"status="+status;
|
|
|
if(StringUtils.isNotBlank(enterType)){
|
|
|
filters += semicolon +"enterType="+enterType;
|
|
|
semicolon = ";";
|
|
|
}
|
|
|
String sorts = "-updateTime";
|
|
|
//得到list数据
|
|
|
String sorts = "-updateTime";//按更新时间降序
|
|
|
List<IotCompanyDO> list = search(null, filters, sorts, page, size);
|
|
|
list.forEach(one->{
|
|
|
findType(one);
|
|
|
});
|
|
|
|
|
|
if(accountType.equalsIgnoreCase("1")){
|
|
|
//得到list数据
|
|
|
list.forEach(one->{
|
|
|
findType(one);
|
|
|
});
|
|
|
}
|
|
|
if(accountType.equalsIgnoreCase("0")){
|
|
|
list.forEach(one->{
|
|
|
findAppType(one);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//获取总数
|
|
|
long count = getCount(filters);
|
|
|
|
|
@ -84,8 +102,18 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
sources.forEach(one -> {
|
|
|
IotCompanyVO target = new IotCompanyVO();
|
|
|
BeanUtils.copyProperties(one, target);
|
|
|
List<IotCompanyTypeVO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeVO.class);
|
|
|
target.setTypeList(voList);
|
|
|
if(target.getTypeList()!=null){
|
|
|
List<IotCompanyTypeVO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeVO.class);
|
|
|
target.setTypeList(voList);
|
|
|
}
|
|
|
if (target.getAppList()!=null){
|
|
|
List<IotCompanyAppVO> appList = convertToModels(target.getAppList(),new ArrayList<>(target.getAppList().size()),IotCompanyAppVO.class);
|
|
|
target.setAppList(appList);
|
|
|
}
|
|
|
// List<IotCompanyTypeVO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeVO.class);
|
|
|
// List<IotCompanyAppVO> appList = convertToModels(target.getAppList(),new ArrayList<>(target.getAppList().size()),IotCompanyAppVO.class);
|
|
|
// target.setTypeList(voList);
|
|
|
// target.setAppList(appList);
|
|
|
targets.add(target);
|
|
|
});
|
|
|
return targets;
|
|
@ -107,6 +135,10 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
List<IotCompanyTypeVO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeVO.class);
|
|
|
target.setTypeList(voList);
|
|
|
}
|
|
|
if (target.getAppList()!=null){
|
|
|
List<IotCompanyAppVO> appList = convertToModels(target.getAppList(),new ArrayList<>(target.getAppList().size()),IotCompanyAppVO.class);
|
|
|
target.setAppList(appList);
|
|
|
}
|
|
|
return target;
|
|
|
}
|
|
|
|
|
@ -123,8 +155,15 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
if(StringUtils.isNotBlank(iotCompanyVO.getBusinessStartTime())){
|
|
|
target.setBusinessStartTime(DateUtil.strToDate(iotCompanyVO.getBusinessStartTime()));
|
|
|
}
|
|
|
List<IotCompanyTypeDO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeDO.class);
|
|
|
target.setTypeList(voList);
|
|
|
if (iotCompanyVO.getTypeList()!=null){
|
|
|
List<IotCompanyTypeDO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeDO.class);
|
|
|
target.setTypeList(voList);
|
|
|
}
|
|
|
if (iotCompanyVO.getAppList()!=null){
|
|
|
List<IotCompanyAppDO> appList = convertToModels(target.getAppList(),new ArrayList<>(target.getAppList().size()),IotCompanyAppDO.class);
|
|
|
|
|
|
target.setAppList(appList);
|
|
|
}
|
|
|
return target;
|
|
|
}
|
|
|
|
|
@ -133,11 +172,44 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
* @param page
|
|
|
* @param size
|
|
|
* @param status
|
|
|
* @param name
|
|
|
* @param type
|
|
|
* @param accountType
|
|
|
* @param enterType
|
|
|
* @return
|
|
|
*/
|
|
|
public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String status, String name, String type){
|
|
|
public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String status, String accountType, String enterType){
|
|
|
StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_company c WHERE c.del=1 ");
|
|
|
StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_company c WHERE c.del=1 ");
|
|
|
List<Object> args = new ArrayList<>();
|
|
|
if(StringUtils.isNotBlank(status)){
|
|
|
sql.append(" and c.status=? ");
|
|
|
sqlCount.append(" and c.status='").append(status).append("' ");
|
|
|
args.add(status);
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(accountType)){
|
|
|
sql.append(" and c.account_type=? ");
|
|
|
sqlCount.append(" and c.account_type='").append(accountType).append("' ");
|
|
|
args.add(accountType);
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(enterType)){
|
|
|
sql.append(" and c.enter_type=? ");
|
|
|
sqlCount.append(" and c.enter_type='").append(enterType).append("' ");
|
|
|
args.add(enterType);
|
|
|
}
|
|
|
sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
|
|
|
|
|
|
List<IotCompanyDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotCompanyDO.class));
|
|
|
list.forEach(one->{
|
|
|
findType(one);
|
|
|
});
|
|
|
List<Map<String,Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
|
|
|
long count = Long.valueOf(countList.get(0).get("count").toString());
|
|
|
|
|
|
//DO转VO
|
|
|
List<IotCompanyVO> iotCompanyVOList = convertToModelVOs(list,new ArrayList<>(list.size()));
|
|
|
|
|
|
return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
|
|
|
}
|
|
|
/* public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String status, String name, String type){
|
|
|
StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_company c ,iot_company_type t WHERE c.del=1 ");
|
|
|
StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_company c ,iot_company_type t WHERE c.del=1 ");
|
|
|
List<Object> args = new ArrayList<>();
|
|
@ -170,7 +242,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
List<IotCompanyVO> iotCompanyVOList = convertToModelVOs(list,new ArrayList<>(list.size()));
|
|
|
|
|
|
return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
|
|
|
}
|
|
|
}*/
|
|
|
|
|
|
/**
|
|
|
* 新增
|
|
@ -178,23 +250,100 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
* @return
|
|
|
*/
|
|
|
public IotCompanyDO create(IotCompanyDO iotCompany) {
|
|
|
iotCompany.setStatus("1");
|
|
|
iotCompany.setSaasId(getCode());
|
|
|
iotCompany.setDel(1);
|
|
|
List<IotCompanyTypeDO> list = iotCompany.getTypeList();
|
|
|
iotCompany = iotCompanyDao.save(iotCompany);
|
|
|
String id = iotCompany.getId();
|
|
|
//新增类型
|
|
|
List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
|
|
|
list.forEach(one->{
|
|
|
IotCompanyTypeDO companyType = new IotCompanyTypeDO();
|
|
|
companyType.setSaasId(getCode());
|
|
|
companyType.setCompanyId(id);
|
|
|
companyType.setType(one.getType());
|
|
|
companyType.setTypeName(one.getTypeName());
|
|
|
companyTypes.add(companyType);
|
|
|
});
|
|
|
iotCompanyTypeDao.save(companyTypes);
|
|
|
if("1".equalsIgnoreCase(iotCompany.getAccountType())){
|
|
|
//产商注册
|
|
|
//1、判断企业名称是否已经注册
|
|
|
List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(iotCompany.getAccountType());
|
|
|
for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
|
|
|
//判断营业执照号是否被注册
|
|
|
if(iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense())&&iotCompanyDO.getStatus().equalsIgnoreCase("1")){
|
|
|
throw new RuntimeException("该营业执照号已经注册,请使用其他执照");
|
|
|
}
|
|
|
if(iotCompany.getName().equalsIgnoreCase(iotCompanyDO.getName())){
|
|
|
//该公司重新申请注册,则删除原先注册信息
|
|
|
if(iotCompanyDO.getStatus().equalsIgnoreCase("2")){
|
|
|
List<IotCompanyAppDO> apps = iotCompanyAppDao.findByCompanyId(iotCompanyDO.getId());
|
|
|
iotCompanyAppDao.delete(apps);
|
|
|
iotCompanyDao.delete(iotCompanyDO);
|
|
|
}else {
|
|
|
throw new RuntimeException("该企业已经注册,请使用注册账号登录");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//保存产商信息
|
|
|
iotCompany.setStatus("0");//待审核
|
|
|
iotCompany.setSaasId(getCode());
|
|
|
iotCompany.setDel(1);
|
|
|
iotCompany = iotCompanyDao.save(iotCompany);
|
|
|
String id = iotCompany.getId();
|
|
|
//新增类型
|
|
|
List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
|
|
|
list.forEach(one->{
|
|
|
IotCompanyTypeDO companyType = new IotCompanyTypeDO();
|
|
|
companyType.setSaasId(getCode());
|
|
|
companyType.setCompanyId(id);
|
|
|
companyType.setType(one.getType());
|
|
|
companyType.setTypeName(one.getTypeName());
|
|
|
companyTypes.add(companyType);
|
|
|
});
|
|
|
iotCompanyTypeDao.save(companyTypes);
|
|
|
}
|
|
|
if("0".equalsIgnoreCase(iotCompany.getAccountType())){
|
|
|
|
|
|
List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(iotCompany.getAccountType());
|
|
|
for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
|
|
|
//判断营业执照号是否被注册
|
|
|
if (iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) && iotCompanyDO.getStatus().equalsIgnoreCase("1")) {
|
|
|
throw new RuntimeException("该营业执照号已经注册,请使用其他执照");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//判断应用是否已经注册
|
|
|
IotCompanyAppDO companyAppDO = iotCompany.getAppList().get(0);
|
|
|
//查找所有应用名称
|
|
|
Iterable<IotCompanyAppDO> appDOList = iotCompanyAppDao.findAll();
|
|
|
IotCompanyDO companyTemp = new IotCompanyDO();
|
|
|
for (IotCompanyAppDO app : appDOList) {
|
|
|
if(app.getName().equalsIgnoreCase(companyAppDO.getName())){
|
|
|
String companyId = app.getCompanyId();
|
|
|
IotCompanyDO companyDO = iotCompanyDao.findOne(companyId);
|
|
|
//该平台重新申请注册
|
|
|
if(iotCompany.getName().equalsIgnoreCase(companyDO.getName())&&companyDO.getStatus().equalsIgnoreCase("2")){
|
|
|
//查找该企业下的app
|
|
|
List<IotCompanyAppDO> apps = iotCompanyAppDao.findByCompanyId(companyDO.getId());
|
|
|
//保存注册信息获取CompangId
|
|
|
companyTemp = iotCompanyDao.save(iotCompany);
|
|
|
//遍历apps找出与注册相同的app
|
|
|
for (IotCompanyAppDO appDO : apps) {
|
|
|
if (appDO.getName().equalsIgnoreCase(companyAppDO.getName())){
|
|
|
appDO.setDel("0");
|
|
|
iotCompanyAppDao.save(appDO);
|
|
|
}
|
|
|
//更改公司ID
|
|
|
appDO.setCompanyId(companyTemp.getId());
|
|
|
}
|
|
|
}
|
|
|
throw new RuntimeException("该应用已经注册,请使用注册账号登录");
|
|
|
}
|
|
|
}
|
|
|
//平台接入
|
|
|
companyTemp.setStatus("0");//待审核
|
|
|
companyTemp.setSaasId(getCode());
|
|
|
companyTemp.setDel(1);
|
|
|
iotCompany = iotCompanyDao.save(companyTemp);
|
|
|
//保存应用
|
|
|
String id = iotCompany.getId();
|
|
|
IotCompanyAppDO iotCompanyAppDO = new IotCompanyAppDO();
|
|
|
iotCompanyAppDO.setSaasId(getCode());
|
|
|
iotCompanyAppDO.setCompanyId(id);
|
|
|
iotCompanyAppDO.setCompanyName(iotCompany.getName());
|
|
|
iotCompanyAppDO.setName(companyAppDO.getName());
|
|
|
iotCompanyAppDO.setAddressIp(companyAppDO.getAddressIp());
|
|
|
iotCompanyAppDO.setDel("1");
|
|
|
iotCompanyAppDao.save(iotCompanyAppDO);
|
|
|
}
|
|
|
|
|
|
|
|
|
return iotCompany;
|
|
|
}
|
|
@ -206,7 +355,14 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
*/
|
|
|
public IotCompanyDO findById(String id) {
|
|
|
IotCompanyDO company = iotCompanyDao.findById(id);
|
|
|
findType(company);
|
|
|
String accountType = company.getAccountType();
|
|
|
if ("1".equalsIgnoreCase(accountType)){
|
|
|
findType(company);
|
|
|
}
|
|
|
if ("0".equalsIgnoreCase(accountType)){
|
|
|
List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findByCompanyId(company.getId());
|
|
|
company.setAppList(appDOList);
|
|
|
}
|
|
|
return company;
|
|
|
}
|
|
|
|
|
@ -215,8 +371,8 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
* @param businessLincense
|
|
|
* @return
|
|
|
*/
|
|
|
public IotCompanyDO findByBusinessLicense(String businessLincense){
|
|
|
return iotCompanyDao.findByBusinessLicense(businessLincense);
|
|
|
public IotCompanyDO findByBusinessLicense(String businessLincense,String accountType){
|
|
|
return iotCompanyDao.findByBusinessLicense(businessLincense,accountType);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -241,6 +397,25 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
company.setTypeList(list);
|
|
|
}
|
|
|
|
|
|
public void findAppType(IotCompanyDO company){
|
|
|
if(company==null){
|
|
|
return;
|
|
|
}
|
|
|
//查找类型
|
|
|
List<IotCompanyAppDO> appList = iotCompanyAppDao.findByCompanyId(company.getId());
|
|
|
List<IotCompanyAppDO> list = new ArrayList<>(8);
|
|
|
if(appList.size()>0){
|
|
|
appList.forEach(one->{
|
|
|
IotCompanyAppDO vo = new IotCompanyAppDO();
|
|
|
vo.setName(one.getName());
|
|
|
vo.setAddressIp(one.getAddressIp());
|
|
|
vo.setId(one.getId());
|
|
|
list.add(vo);
|
|
|
});
|
|
|
}
|
|
|
company.setAppList(appList);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查找企业类型
|
|
|
* @param companyId
|
|
@ -256,6 +431,9 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
*/
|
|
|
public void delCompany(String id){
|
|
|
IotCompanyDO company = iotCompanyDao.findById(id);
|
|
|
if (company==null){
|
|
|
throw new RuntimeException("该企业已删除,请勿重复操作");
|
|
|
}
|
|
|
company.setDel(0);
|
|
|
iotCompanyDao.save(company);
|
|
|
}
|
|
@ -264,22 +442,38 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
* 修改
|
|
|
* @param iotCompany
|
|
|
*/
|
|
|
public void updCompany(IotCompanyDO iotCompany){
|
|
|
//更新类型
|
|
|
List<IotCompanyTypeDO> typeList = iotCompanyTypeDao.findByCompanyId(iotCompany.getId());
|
|
|
iotCompanyTypeDao.delete(typeList);
|
|
|
List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
|
|
|
|
|
|
iotCompany.getTypeList().forEach(one->{
|
|
|
IotCompanyTypeDO companyType = new IotCompanyTypeDO();
|
|
|
companyType.setSaasId(getCode());
|
|
|
companyType.setCompanyId(iotCompany.getId());
|
|
|
companyType.setType(one.getType());
|
|
|
companyType.setTypeName(one.getTypeName());
|
|
|
companyTypes.add(companyType);
|
|
|
});
|
|
|
public void updCompany(IotCompanyDO iotCompany,String accountType){
|
|
|
|
|
|
if(accountType.equalsIgnoreCase("1")){
|
|
|
//更新类型
|
|
|
List<IotCompanyTypeDO> typeList = iotCompanyTypeDao.findByCompanyId(iotCompany.getId());
|
|
|
iotCompanyTypeDao.delete(typeList);
|
|
|
List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
|
|
|
|
|
|
iotCompany.getTypeList().forEach(one->{
|
|
|
IotCompanyTypeDO companyType = new IotCompanyTypeDO();
|
|
|
companyType.setSaasId(getCode());
|
|
|
companyType.setCompanyId(iotCompany.getId());
|
|
|
companyType.setType(one.getType());
|
|
|
companyType.setTypeName(one.getTypeName());
|
|
|
companyTypes.add(companyType);
|
|
|
});
|
|
|
|
|
|
iotCompanyTypeDao.save(companyTypes);
|
|
|
iotCompanyTypeDao.save(companyTypes);
|
|
|
}
|
|
|
//更新应用
|
|
|
if(accountType.equalsIgnoreCase("0")){
|
|
|
IotCompanyAppDO newApp = iotCompany.getAppList().get(0);
|
|
|
IotCompanyAppDO oldApp = iotCompanyAppDao.findOne(newApp.getId());
|
|
|
oldApp.setAddressIp(newApp.getAddressIp());
|
|
|
oldApp.setName(newApp.getName());
|
|
|
oldApp.setId(newApp.getId());
|
|
|
oldApp.setCompanyId(iotCompany.getId());
|
|
|
oldApp.setCompanyName(iotCompany.getName());
|
|
|
oldApp.setSaasId(getCode());
|
|
|
iotCompanyAppDao.save(oldApp);
|
|
|
}
|
|
|
|
|
|
|
|
|
//记录三证变更记录
|
|
|
IotCompanyDO iotCompanyOld = iotCompanyDao.findById(iotCompany.getId());
|
|
@ -328,6 +522,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
}
|
|
|
|
|
|
//修改企业记录
|
|
|
iotCompanyOld.setEnterType(iotCompany.getEnterType());
|
|
|
iotCompanyOld.setName(iotCompany.getName());
|
|
|
iotCompanyOld.setIsThreeInOne(iotCompany.getIsThreeInOne());
|
|
|
iotCompanyOld.setBusinessLicense(iotCompany.getBusinessLicense());
|
|
@ -361,4 +556,87 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 通过审核
|
|
|
* @param id 企业ID
|
|
|
* @return
|
|
|
*/
|
|
|
public MixEnvelop auditCompany(String id) {
|
|
|
IotCompanyDO companyDO = findById(id);
|
|
|
if (companyDO==null){
|
|
|
|
|
|
}
|
|
|
String uname = userAgent.getUNAME();
|
|
|
if (uname==null){
|
|
|
companyDO.setAuditName("system");
|
|
|
}
|
|
|
companyDO.setStatus("1");
|
|
|
companyDO.setAuditTime(DateUtil.getNowDate());
|
|
|
companyDO.setAuditName(uname);
|
|
|
iotCompanyDao.save(companyDO);
|
|
|
return MixEnvelop.getSuccess("审核操作成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 审核失败
|
|
|
* @param id 企业ID
|
|
|
* @param msg 拒绝说明
|
|
|
* @return
|
|
|
*/
|
|
|
public MixEnvelop auditCompany(String id,String msg) {
|
|
|
IotCompanyDO companyDO = findById(id);
|
|
|
if (companyDO==null){
|
|
|
return MixEnvelop.getError("无该企业");
|
|
|
}
|
|
|
String uname = userAgent.getUNAME();
|
|
|
if (uname==null){
|
|
|
companyDO.setAuditName("system");
|
|
|
}
|
|
|
companyDO.setStatus("2");
|
|
|
companyDO.setAuditTime(DateUtil.getNowDate());
|
|
|
companyDO.setAuditMessage(msg);
|
|
|
companyDO.setAuditName(uname);
|
|
|
iotCompanyDao.save(companyDO);
|
|
|
return MixEnvelop.getSuccess("审核操作成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据入驻类型查找企业信息
|
|
|
* @param entryCode 入驻类型
|
|
|
* @return
|
|
|
*/
|
|
|
public List<IotCompanyDO> findByEnterType(String entryCode) {
|
|
|
List<IotCompanyDO> companyDOList = iotCompanyDao.findByEnterType(entryCode);
|
|
|
for (IotCompanyDO companyDO : companyDOList) {
|
|
|
List<IotCompanyTypeDO> typeList = iotCompanyTypeDao.findByCompanyId(companyDO.getId());
|
|
|
companyDO.setTypeList(typeList);
|
|
|
}
|
|
|
return companyDOList;
|
|
|
}
|
|
|
/**
|
|
|
* 查找所有企业
|
|
|
* @param accountType 标识 1:厂商 0:平台
|
|
|
* @return
|
|
|
*/
|
|
|
public List<IotCompanyDO> findAll(String accountType) {
|
|
|
List<IotCompanyDO> iotCompanyDOS = new ArrayList<>();
|
|
|
if("1".equalsIgnoreCase(accountType)){
|
|
|
iotCompanyDOS = iotCompanyDao.findByAccountType(accountType);
|
|
|
for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
|
|
|
List<IotCompanyTypeDO> companyTypeDOS = iotCompanyTypeDao.findByCompanyId(iotCompanyDO.getId());
|
|
|
iotCompanyDO.setTypeList(companyTypeDOS);
|
|
|
}
|
|
|
}
|
|
|
if ("0".equalsIgnoreCase(accountType)){
|
|
|
Iterable<IotCompanyDO> companyDOS = iotCompanyDao.findByAccountType(accountType);
|
|
|
for (IotCompanyDO companyDO : companyDOS) {
|
|
|
List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findByCompanyId(companyDO.getId());
|
|
|
companyDO.setAppList(appDOList);
|
|
|
iotCompanyDOS.add(companyDO);
|
|
|
}
|
|
|
}
|
|
|
return iotCompanyDOS;
|
|
|
}
|
|
|
|
|
|
}
|