Browse Source

物联网 BUG修复

mengkang 4 years ago
parent
commit
09c4d48ff1

+ 10 - 6
svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java

@ -162,9 +162,11 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    @GetMapping(value = IotRequestMapping.Platform.findAllLog)
    @ApiOperation(value = "分页查询所有接口日志信息",notes = "分页查询所有接口日志信息")
    public MixEnvelop<IotInterfaceLogVO,IotInterfaceLogVO> findAllLog(@ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                       @RequestParam(value = "page", required = false) Integer page,
                                                                        @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                       @RequestParam(value = "size", required = false) Integer size){
                                                                            @RequestParam(value = "page", required = false) Integer page,
                                                                      @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                            @RequestParam(value = "size", required = false) Integer size,
                                                                      @ApiParam(name = "name", value = "接口名或方法名称", defaultValue = "")
                                                                          @RequestParam(value = "name", required = false) String name){
        try {
            if(page == null|| page < 0){
@ -173,7 +175,7 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
            if(size == null){
                size = 10;
            }
            return iotInterfaceLogService.findAll(page,size);
            return iotInterfaceLogService.findAll(page,size,name);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
@ -309,7 +311,9 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
                                                                             @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                                 @RequestParam(value = "size", required = false) Integer size,
                                                                             @ApiParam(name = "interfaceName", value = "接口名称", defaultValue = "")
                                                                                 @RequestParam(value = "interfaceName") String interfaceName) {
                                                                                 @RequestParam(value = "interfaceName") String interfaceName,
                                                                             @ApiParam(name = "addresssIp", value = "IP地址", defaultValue = "")
                                                                                 @RequestParam(value = "addresssIp") String addresssIp) {
        try {
            if(page == null|| page < 0){
@ -319,7 +323,7 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
                size = 10;
            }
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_find, iotInterfaceLogService.findInterfaceLog(page,size,interfaceName));
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_find, iotInterfaceLogService.findInterfaceLog(page,size,interfaceName,addresssIp));
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());

+ 5 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyAppDao.java

@ -22,5 +22,10 @@ public interface IotCompanyAppDao extends PagingAndSortingRepository<IotCompanyA
        @Query("from IotCompanyAppDO w where w.id =?1 and w.del=1")
        IotCompanyAppDO findById(String appId);
        @Query("from IotCompanyAppDO w where w.companyId =?1 and w.del=0")
        List<IotCompanyAppDO> findByCompanyIdAndDel(String companyId);
        @Query("from IotCompanyAppDO w where w.del=0")
        List<IotCompanyAppDO> findAllByDel();
        }

+ 335 - 90
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -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")){

+ 11 - 7
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceLogService.java

@ -65,11 +65,13 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
     * @return
     * @throws ParseException
     */
    public MixEnvelop<IotInterfaceLogVO,IotInterfaceLogVO> findAll(Integer page, Integer size) throws ParseException {
    public MixEnvelop<IotInterfaceLogVO,IotInterfaceLogVO> findAll(Integer page, Integer size,String name) throws ParseException {
        StringBuffer sql = new StringBuffer("SELECT * FROM (select * from iot_interface_log c where 1=1  ORDER BY c.time desc) b GROUP BY b.interface_name ");
        sql.append(" limit ").append((page-1)*size).append(",").append(size);
        StringBuffer sql = new StringBuffer("SELECT * FROM (select * from iot_interface_log c where 1=1  ORDER BY c.time desc) b where  ");
        if (StringUtils.isNotBlank(name)){
            sql.append("b.method LIKE '%").append(name).append("%'OR b.interface_name LIKE '%").append(name).append("%'");
        }
        sql.append(" GROUP BY b.interface_name limit ").append((page-1)*size).append(",").append(size);
        List<IotInterfaceLogDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotInterfaceLogDO.class));
@ -94,7 +96,7 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
     * @param interfaceName
     * @return
     */
    public MixEnvelop<IotInterfaceLogVO, IotInterfaceLogVO> findInterfaceLog(Integer page, Integer size, String interfaceName) {
    public MixEnvelop<IotInterfaceLogVO, IotInterfaceLogVO> findInterfaceLog(Integer page, Integer size, String interfaceName,String addressIP) {
        StringBuffer sql =new StringBuffer("SELECT c.* FROM iot_interface_log c WHERE ");
@ -102,8 +104,10 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
        if (StringUtils.isNotBlank(interfaceName)){
            sql.append(" c.interface_name like'%").append(interfaceName).append("%'");
        }
        sql.append("order by c.time desc limit ").append((page-1)*size).append(",").append(size);
//        List<IotInterfaceLogDO> list = iotInterfaceLogDao.findAllByInterfaceName(interfaceName);
        if (StringUtils.isNotBlank(addressIP)){
            sql.append(" c.address_ip like'%").append(addressIP).append("%'");
        }
        sql.append(" order by c.time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotInterfaceLogDO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(IotInterfaceLogDO.class));