Browse Source

Merge branch 'dev' of suhaiwen/wlyy2.0 into dev

叶仕杰 5 năm trước cách đây
mục cha
commit
08579da0ac

+ 4 - 5
svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java

@ -47,6 +47,8 @@ public class IotCompanyController extends EnvelopRestEndpoint {
                                       @RequestParam(value = "status", required = false) String status,
                                                    @ApiParam(name = "enterType", value = "入驻类型", defaultValue = "")
                                       @RequestParam(value = "enterType", required = false) String enterType,
                                                    @ApiParam(name = "companyName",value = "产商名称或平台名称")
                                       @RequestParam(value = "companyName",required = false) String companyName,
                                                    @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                       @RequestParam(value = "page", required = false) Integer page,
                                                    @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
@ -58,11 +60,8 @@ public class IotCompanyController extends EnvelopRestEndpoint {
            if(size == null){
                size = 10;
            }
            if(StringUtils.isBlank(status)){
                return iotCompanyService.queryPage(page,size,accountType,enterType);
            }else {
                return iotCompanyService.queryPage(page,size,status,accountType,enterType);
            }
            return iotCompanyService.queryPage(page,size,companyName,status,accountType,enterType);
        } catch (Exception e) {
            e.printStackTrace();

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

@ -354,10 +354,10 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    @GetMapping(value = IotRequestMapping.Platform.interfaceDoc)
    @ApiOperation(value = "接口文档说明", notes = "接口文档说明")
    public MixEnvelop interfaceDoc( @ApiParam(name = "interfaceName", value = "接口名称", defaultValue = "")
                                        @RequestParam(value = "interfaceName") String interfaceName){
    public MixEnvelop interfaceDoc( @ApiParam(name = "dictName", value = "字典名称", defaultValue = "")
                                        @RequestParam(value = "dictName") String dictName){
       String url =  iotShareInterfaceService.interfaceDoc(interfaceName);
       String url =  iotShareInterfaceService.interfaceDoc(dictName);
       return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,url);
    }

+ 77 - 55
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -46,49 +46,53 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
    private IotCompanyAppInterfaceDao iotCompanyAppInterfaceDao;
    /**
     *分页查找
     * @param page
     * @param size
     * @param accountType
     * @param enterType
     * @return
     * @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(accountType)){
            filters += "accountType?"+accountType;
            semicolon = ";";
        }
        if(StringUtils.isNotBlank(enterType)){
            filters += semicolon +"enterType="+enterType;
            semicolon = ";";
        }
        String sorts = "-updateTime";//按更新时间降序
        List<IotCompanyDO> list = search(null, filters, sorts, page, size);
        if(accountType.equalsIgnoreCase("1")){
            //得到list数据
            list.forEach(one->{
                findType(one);
            });
        }
        if(accountType.equalsIgnoreCase("0")){
            list.forEach(one->{
                findAppType(one);
            });
        }
        //获取总数
        long count = getCount(filters);
        //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 page
//     * @param size
//     * @param accountType
//     * @param enterType
//     * @return
//     * @throws ParseException
//     */
//    public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size,String companyName, String accountType, String enterType) throws ParseException {
//        String filters = "del=1;";
//        String semicolon = "";
//        if(StringUtils.isNotBlank(accountType)){
//            filters += "accountType?"+accountType;
//            semicolon = ";";
//        }
//        if (StringUtils.isNotBlank(companyName)){
//            filters+="name?"+companyName;
//            semicolon = ";";
//        }
//        if(StringUtils.isNotBlank(enterType)){
//            filters += semicolon +"enterType="+enterType;
//            semicolon = ";";
//        }
//        String sorts = "-updateTime";//按更新时间降序
//        List<IotCompanyDO> list = search(null, filters, sorts, page, size);
//
//        if(accountType.equalsIgnoreCase("1")){
//            //得到list数据
//            list.forEach(one->{
//                findType(one);
//            });
//        }
//        if(accountType.equalsIgnoreCase("0")){
//            list.forEach(one->{
//                findAppType(one);
//            });
//        }
//
//        //获取总数
//        long count = getCount(filters);
//
//        //DO转VO
//        List<IotCompanyVO> iotCompanyVOList = convertToModelVOs(list,new ArrayList<>(list.size()));
//
//        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
//    }
    /**
@ -100,7 +104,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     * @param enterType
     * @return
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String status, String accountType, String enterType){
    public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size,String companyName, 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<>();
@ -114,6 +118,10 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            sqlCount.append(" and c.account_type='").append(accountType).append("' ");
            args.add(accountType);
        }
        if(StringUtils.isNotBlank(companyName)){
            sql.append(" and (c.name like '%").append(companyName).append("%')");
            sqlCount.append(" and (c.name like '%").append(companyName).append("%')");
        }
        if(StringUtils.isNotBlank(enterType)){
            sql.append(" and c.enter_type=? ");
            sqlCount.append(" and c.enter_type='").append(enterType).append("' ");
@ -515,10 +523,14 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        if(accountType.equalsIgnoreCase("1")){
            //更新类型
            List<IotCompanyTypeDO> typeList = iotCompanyTypeDao.findByCompanyId(iotCompany.getId());
           typeList.forEach(one->{
               one.setDel("1");
               iotCompanyTypeDao.save(one);
           });
            if (typeList!=null&&typeList.size()>0){
                typeList.forEach(one->{
                    one.setDel("1");
                    iotCompanyTypeDao.save(one);
                });
            }
            List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
            iotCompany.getTypeList().forEach(one->{
@ -538,13 +550,23 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        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);
            //无应用
            if (oldApp!=null){
                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);
            }else {
                newApp.setDel("1");
                newApp.setCompanyName(iotCompany.getName());
                newApp.setCompanyId(iotCompany.getId());
                newApp.setSaasId(getCode());
                iotCompanyAppDao.save(newApp);
            }
        }
       

+ 3 - 3
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotShareInterfaceService.java

@ -150,11 +150,11 @@ public class IotShareInterfaceService extends BaseJpaService<IotShareInterfaceDO
    /**
     * 接口文档说明
     * @param interfaceName
     * @param dictName
     * @return
     */
    public String interfaceDoc(String interfaceName) {
        IotSystemDictDO systemDictDO = iotSystemDictDao.findByDictName(interfaceName).get(0);
    public String interfaceDoc(String dictName) {
        IotSystemDictDO systemDictDO = iotSystemDictDao.findByDictName(dictName).get(0);
        return systemDictDO.getCode();
    }