| 
					
				 | 
			
			
				@ -279,6 +279,165 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 新增 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param iotCompany 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    public MixEnvelop<IotCompanyVO, IotCompanyVO> creat(IotCompanyDO iotCompany) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        //判断账户是否重复 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        IotCompanyDO account = iotCompanyDao.findByEhrUserId(userAgent.getUID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        if (account!=null&&(account.getStatus().equalsIgnoreCase("2")==false)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            return MixEnvelop.getSuccess("账户已注册",-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        List<IotCompanyTypeDO> list = iotCompany.getTypeList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        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")||iotCompanyDO.getStatus().equalsIgnoreCase("0"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                if(iotCompany.getName().equalsIgnoreCase(iotCompanyDO.getName())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    //该公司重新申请注册,则删除原先注册信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    if(iotCompanyDO.getStatus().equalsIgnoreCase("2")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				////                        List<IotCompanyAppDO> apps = iotCompanyAppDao.findByCompanyId(iotCompanyDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				////                        iotCompanyAppDao.delete(apps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				////                        iotCompanyDao.delete(iotCompanyDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        //更新类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        List<IotCompanyTypeDO> typeList = iotCompanyTypeDao.findByCompanyId(iotCompany.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        iotCompanyTypeDao.delete(typeList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        String id = iotCompany.getId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        iotCompany.getTypeList().forEach(one->{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            IotCompanyTypeDO companyType = new IotCompanyTypeDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            companyType.setSaasId(getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            companyType.setCompanyId(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            companyType.setType(one.getType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            companyType.setTypeName(one.getTypeName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            companyType.setDel("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            companyTypes.add(companyType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        iotCompanyTypeDao.save(companyTypes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        iotCompany.setStatus("0");//待审核 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        iotCompany.setSaasId(getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        iotCompany.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        iotCompany = iotCompanyDao.save(iotCompany); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        return MixEnvelop.getError("该企业已经注册,请使用注册账号登录"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            //保存产商信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            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()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                companyType.setDel("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                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")||iotCompanyDO.getStatus().equalsIgnoreCase("0"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            //判断应用是否已经注册 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            IotCompanyAppDO companyAppDO = iotCompany.getAppList().get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            //查找所有应用名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            Iterable<IotCompanyAppDO> appDOList = iotCompanyAppDao.findAll(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            for (IotCompanyAppDO app : appDOList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                if(app.getName().equalsIgnoreCase(companyAppDO.getName())&& 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        app.getCompanyId().equalsIgnoreCase(iotCompany.getId())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String companyId = app.getCompanyId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    IotCompanyDO companyDO = iotCompanyDao.findOne(companyId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    //该平台重新申请注册 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    if(iotCompany.getId().equalsIgnoreCase(companyDO.getId())&&companyDO.getStatus().equalsIgnoreCase("2")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        //查找该企业下的app 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        List<IotCompanyAppDO> apps = iotCompanyAppDao.findByCompanyId(companyDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        //遍历apps找出与注册相同的app 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        for (IotCompanyAppDO appDO : apps) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            if (appDO.getId().equalsIgnoreCase(companyAppDO.getId())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                appDO.setDel("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                appDO.setCompanyName(iotCompany.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                appDO.setName(companyAppDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                appDO.setAddressIp(companyAppDO.getAddressIp()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                                iotCompanyAppDao.save(appDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            iotCompany.setStatus("0");//待审核 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            iotCompany.setSaasId(getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            iotCompany.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            iotCompany.setAccount(userAgent.getUNAME()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            iotCompany.setEhrUserId(userAgent.getUID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            iotCompany = iotCompanyDao.save(iotCompany); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create,convertToModelVO(iotCompany)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        return MixEnvelop.getError("该应用已经注册,请使用注册账号登录"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				////                    return MixEnvelop.getError("该应用已经注册,请使用注册账号登录"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            //平台接入 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            iotCompany.setStatus("0");//待审核 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            iotCompany.setSaasId(getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            iotCompany.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            iotCompany = iotCompanyDao.save(iotCompany); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            //保存应用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            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("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            iotCompanyAppDao.save(iotCompanyAppDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        iotCompany.setAccount(userAgent.getUNAME()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        iotCompany.setEhrUserId(userAgent.getUID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create,convertToModelVO(iotCompany)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 新增 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param iotCompany 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -286,117 +445,193 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<IotCompanyVO, IotCompanyVO> create(IotCompanyDO iotCompany) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //判断账户是否重复 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        IotCompanyDO account = iotCompanyDao.findByEhrUserId(userAgent.getUID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (account!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return MixEnvelop.getSuccess("账户已注册",-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (account != null && (!account.getStatus().equalsIgnoreCase("2"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return MixEnvelop.getSuccess("账户已注册", -1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //id不为空,则重新注册 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(iotCompany.getId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //判断是产商还是平台入驻 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //厂商 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (iotCompany.getAccountType().equalsIgnoreCase("1")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //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<IotCompanyTypeDO> typeList = iotCompanyTypeDao.findByCompanyId(iotCompany.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                iotCompanyTypeDao.delete(typeList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String id = iotCompany.getId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                iotCompany.getTypeList().forEach(one -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    IotCompanyTypeDO companyType = new IotCompanyTypeDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    companyType.setSaasId(getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    companyType.setCompanyId(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    companyType.setType(one.getType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    companyType.setTypeName(one.getTypeName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    companyType.setDel("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    companyTypes.add(companyType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                iotCompanyTypeDao.save(companyTypes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //平台 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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("该企业名称已被注册,请使用其他企业"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<IotCompanyTypeDO> list = iotCompany.getTypeList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                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 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        return MixEnvelop.getError("该企业已经注册,请使用注册账号登录"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<IotCompanyAppDO> apps = iotCompanyAppDao.findAllByDel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //遍历apps找出与注册相同的app 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (IotCompanyAppDO appDO : apps) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(companyAppDO.getName().equalsIgnoreCase(appDO.getName())&&(!appDO.getId().equalsIgnoreCase(companyAppDO.getId()))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        return MixEnvelop.getError("该企业名称已被注册,请使用其他企业"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (appDO.getId().equalsIgnoreCase(companyAppDO.getId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        appDO.setDel("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        appDO.setCompanyName(iotCompany.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        appDO.setCompanyId(iotCompany.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        appDO.setName(companyAppDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        appDO.setAddressIp(companyAppDO.getAddressIp()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        iotCompanyAppDao.save(appDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //保存产商信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                companyType.setDel("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                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")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        IotCompanyDO companyDO = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //id为空,新增企业 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isEmpty(iotCompany.getId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            companyDO= iotCompanyDao.save(iotCompany); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //厂商 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (companyDO.getAccountType().equalsIgnoreCase("1")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //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("该企业名称已被注册,请使用其他企业"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<IotCompanyTypeDO> list = companyDO.getTypeList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String id = companyDO.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()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    companyType.setDel("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    companyTypes.add(companyType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                iotCompanyTypeDao.save(companyTypes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //判断应用是否已经注册 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            IotCompanyAppDO companyAppDO = iotCompany.getAppList().get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //查找所有应用名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Iterable<IotCompanyAppDO> appDOList = iotCompanyAppDao.findAll(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       iotCompany.setId(getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        //遍历apps找出与注册相同的app 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        for (IotCompanyAppDO appDO : apps) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            if (appDO.getName().equalsIgnoreCase(companyAppDO.getName())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                appDO.setDel("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                iotCompanyAppDao.save(appDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            //更改公司ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            appDO.setCompanyId(iotCompany.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //平台 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (companyDO.getAccountType().equalsIgnoreCase("0")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(companyDO.getAccountType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                IotCompanyAppDO companyAppDO = companyDO.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("该企业名称已被注册,请使用其他企业"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findAllByDel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (IotCompanyAppDO one : appDOList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (one.getName().equalsIgnoreCase(companyAppDO.getName())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        return MixEnvelop.getError("该应用已注册,请使用其他应用"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    return MixEnvelop.getError("该应用已经注册,请使用注册账号登录"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //保存应用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                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"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                iotCompanyAppDao.save(iotCompanyAppDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //平台接入 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            iotCompany.setStatus("0");//待审核 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            iotCompany.setSaasId(getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            iotCompany.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            iotCompany = iotCompanyDao.save(iotCompany); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //保存应用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        iotCompany.setAccount(userAgent.getUNAME()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        iotCompany.setEhrUserId(userAgent.getUID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create,convertToModelVO(iotCompany)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        companyDO= iotCompanyDao.save(iotCompany); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        companyDO.setStatus("0");//待审核 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        companyDO.setSaasId(getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        companyDO.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //保存账户与UID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        companyDO.setAccount(userAgent.getUNAME()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        companyDO.setEhrUserId(userAgent.getUID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        iotCompanyDao.save(companyDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create, convertToModelVO(iotCompany)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 新增平台应用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param iotCompany 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -713,6 +948,16 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        companyDO.setAuditName(uname); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        iotCompanyDao.save(companyDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //审核通过 设置平台应用为有效 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (companyDO.getAccountType().equalsIgnoreCase("0")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findByCompanyIdAndDel(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            appDOList.forEach(one->{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                one.setDel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                iotCompanyAppDao.save(one); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //根据注册类型配置相应角色菜单,注册类型(1:厂商注册  0:平台注册) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String roleId = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(companyDO.getAccountType().equals("0")){ 
			 |