|  | @ -44,7 +44,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 审核通过 分页查找
 | 
	
		
			
				|  |  |      *分页查找
 | 
	
		
			
				|  |  |      * @param page
 | 
	
		
			
				|  |  |      * @param size
 | 
	
		
			
				|  |  |      * @param accountType
 | 
	
	
		
			
				|  | @ -87,6 +87,58 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 按类型分页查找
 | 
	
		
			
				|  |  |      * @param page
 | 
	
		
			
				|  |  |      * @param size
 | 
	
		
			
				|  |  |      * @param status
 | 
	
		
			
				|  |  |      * @param accountType
 | 
	
		
			
				|  |  |      * @param enterType
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     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));
 | 
	
		
			
				|  |  |         if(accountType.equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |             //得到list数据
 | 
	
		
			
				|  |  |             list.forEach(one->{
 | 
	
		
			
				|  |  |                 findType(one);
 | 
	
		
			
				|  |  |             });
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(accountType.equalsIgnoreCase("0")){
 | 
	
		
			
				|  |  |             list.forEach(one->{
 | 
	
		
			
				|  |  |                 findAppType(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);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 转换
 | 
	
		
			
				|  |  |      * @param sources
 | 
	
	
		
			
				|  | @ -162,56 +214,6 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
 | 
	
		
			
				|  |  |         return target;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 按类型分页查找
 | 
	
		
			
				|  |  |      * @param page
 | 
	
		
			
				|  |  |      * @param size
 | 
	
		
			
				|  |  |      * @param status
 | 
	
		
			
				|  |  |      * @param accountType
 | 
	
		
			
				|  |  |      * @param enterType
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     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));
 | 
	
		
			
				|  |  |         if(accountType.equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |             //得到list数据
 | 
	
		
			
				|  |  |             list.forEach(one->{
 | 
	
		
			
				|  |  |                 findType(one);
 | 
	
		
			
				|  |  |             });
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(accountType.equalsIgnoreCase("0")){
 | 
	
		
			
				|  |  |             list.forEach(one->{
 | 
	
		
			
				|  |  |                 findAppType(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);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 条件分页查找
 | 
	
	
		
			
				|  | @ -326,7 +328,6 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
 | 
	
		
			
				|  |  |             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();
 | 
	
	
		
			
				|  | @ -336,7 +337,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
 | 
	
		
			
				|  |  |                         //查找该企业下的app
 | 
	
		
			
				|  |  |                         List<IotCompanyAppDO> apps = iotCompanyAppDao.findByCompanyId(companyDO.getId());
 | 
	
		
			
				|  |  |                         //保存注册信息获取CompangId
 | 
	
		
			
				|  |  |                          companyTemp = iotCompanyDao.save(iotCompany);
 | 
	
		
			
				|  |  |                        iotCompany.setId(getCode());
 | 
	
		
			
				|  |  |                         //遍历apps找出与注册相同的app
 | 
	
		
			
				|  |  |                         for (IotCompanyAppDO appDO : apps) {
 | 
	
		
			
				|  |  |                             if (appDO.getName().equalsIgnoreCase(companyAppDO.getName())){
 | 
	
	
		
			
				|  | @ -344,17 +345,17 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
 | 
	
		
			
				|  |  |                                 iotCompanyAppDao.save(appDO);
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                             //更改公司ID
 | 
	
		
			
				|  |  |                             appDO.setCompanyId(companyTemp.getId());
 | 
	
		
			
				|  |  |                             appDO.setCompanyId(iotCompany.getId());
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     return MixEnvelop.getError("该应用已经注册,请使用注册账号登录");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //平台接入
 | 
	
		
			
				|  |  |             companyTemp.setStatus("0");//待审核
 | 
	
		
			
				|  |  |             companyTemp.setSaasId(getCode());
 | 
	
		
			
				|  |  |             companyTemp.setDel(1);
 | 
	
		
			
				|  |  |             iotCompany = iotCompanyDao.save(companyTemp);
 | 
	
		
			
				|  |  |             iotCompany.setStatus("0");//待审核
 | 
	
		
			
				|  |  |             iotCompany.setSaasId(getCode());
 | 
	
		
			
				|  |  |             iotCompany.setDel(1);
 | 
	
		
			
				|  |  |             iotCompany = iotCompanyDao.save(iotCompany);
 | 
	
		
			
				|  |  |             //保存应用
 | 
	
		
			
				|  |  |             String id = iotCompany.getId();
 | 
	
		
			
				|  |  |             IotCompanyAppDO iotCompanyAppDO = new IotCompanyAppDO();
 | 
	
	
		
			
				|  | @ -370,7 +371,8 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
 | 
	
		
			
				|  |  |         iotCompany.setAccount(userAgent.getUNAME());
 | 
	
		
			
				|  |  |         iotCompany.setEhrUserId(userAgent.getUID());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create,iotCompany);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create,convertToModelVO(iotCompany));
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 |